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
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)
import 'utils/lotw'
Connectors
Injected Connector
Just your basic injected connector
import { InjectedConnector } from 'lotw/connectors/injected'
new InjectedConnector({
})
Options
chainInfo
- The chain info to use when initiating a connection
MetaMask
Connect with MetaMask
import { MetaMaskConnector } from 'lotw/connectors/metamask'
new MetaMaskConnector({
})
Options
chainInfo
- The chain info to use when initiating a connection
Coinbase
Connect with Coinbase
import { CoinbaseConnector } from 'lotw/connectors/coinbase'
new CoinbaseConnector({
})
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
chainInfo
- The chain info to use when intiating a connection
All Wallet Connect options