1.1.3 • Published 1 year ago

@vandeurenglenn/connect-wallet v1.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

connect-wallet

easy wallet connections

install

npm i @vandeurenglenn/connect-wallet

usage

import ConnectWallet from '@vandeurenglenn/connect-wallet'

const options = {
  chainId: Number,
  walletConnect: {
    projectId: String,
    modalOptions: { themeMode: 'dark' },
    metadata: {
      name: String,
      description: String,
      url: String, // origin must match your domain & subdomain
      icons: Array
    }
  }
}

const connectWallet = new ConnectWallet(options)

connectWallet.subscribe('networkChange', (chainId) => console.log(chainId)) // 1

connectWallet.subscribe('accountsChange', (accounts) => console.log(accounts)) // [0x0.........]

await connectWallet.connect('metamask')
console.log(`signer: ${connectWallet.signer}`)

await connectWallet.connect('walletConnect')
console.log(`signer: ${connectWallet.signer}`)

// provider is always the same (if not switching chainId)
console.log(`provider: ${connectWallet.provider}`)

await connectWallet.changeNetwork(56)
1.1.1

1 year ago

1.0.2

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.1.3

1 year ago

1.0.4

1 year ago

1.1.2

1 year ago

1.0.3

1 year ago

1.0.0

1 year ago