3.0.2 • Published 2 years ago

lotw v3.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

4.0.0-next.8

2 years ago

4.0.0-next.7

2 years ago

2.0.2

3 years ago

2.0.1

3 years ago

3.0.2

2 years ago

4.0.0-next.6

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

4.0.0-next.1

2 years ago

4.0.0-next.0

2 years ago

4.0.0-next.5

2 years ago

4.0.0-next.4

2 years ago

4.0.0-next.3

2 years ago

4.0.0-next.2

2 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

2.0.0

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago