Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lotw

Package Overview
Dependencies
Maintainers
5
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lotw

Web3 Wallet connection driven by state charts!

  • 3.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

Lotw

Web3 Wallet connection driven by state charts!

Documentation is work-in-progress

Install

Requires Typescript 4.7+

To install Lotw, you will also need to install xstate and ethers:

yarn add lotw xstate @xstate/react ethers

Setup

// src/utils/lotw.ts (or wherever)

import { Lotw, type InferConnectorIds } from 'lotw'
import { MetaMaskConnector } from 'lotw/connectors/metamask'
import { createHooksFrom } from 'lotw/react'

export type Connectors = InferConnectorIds<typeof lotw>

export const lotw = new Lotw([
  new MetaMaskConnector(),
])

export const { useChainId, useAccounts, useProvider, useWalletActor } =
  createHooksFrom(lotw)
// src/index.ts (src/pages/_app.tsx if using Nextjs)

import 'utils/lotw'

// ... Rest of file

Connectors

Injected Connector

Just your basic injected connector

import { InjectedConnector } from 'lotw/connectors/injected'

new InjectedConnector({
  // options
})
Options

chainInfo - The chain info to use when initiating a connection

MetaMask

Connect with MetaMask

import { MetaMaskConnector } from 'lotw/connectors/metamask'

new MetaMaskConnector({
  // options
})
Options

chainInfo - The chain info to use when initiating a connection

Coinbase

Connect with Coinbase

import { CoinbaseConnector } from 'lotw/connectors/coinbase'

new CoinbaseConnector({
  // options
})
Options

chainInfo - The chain info to use when initiating a connection

Wallet Connect

Connect with Wallet Connect

import { WalletConnectConnector } from 'lotw/connectors/wallet-connect'

new WalletConnectConnector({
  // options
})
Options

chainInfo - The chain info to use when intiating a connection

All Wallet Connect options

Keywords

FAQs

Package last updated on 15 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc