@web3-onboard/walletconnect
Wallet module for connecting Wallet Connect to web3-onboard
Install
npm i @web3-onboard/core @web3-onboard/walletconnect
Options
type WalletConnectOptions = {
projectId: string
dappUrl?: string
requiredChains?: number[] | undefined
optionalChains?: number[] | undefined
qrModalOptions?: EthereumProviderOptions['qrModalOptions']
additionalRequiredMethods?: string[] | undefined
additionalOptionalMethods?: string[] | undefined
handleUri?: (uri: string) => Promise<unknown>
)
Usage
import Onboard from '@web3-onboard/core'
import walletConnectModule from '@web3-onboard/walletconnect'
const wcInitOptions = {
projectId: 'abc123...',
requiredChains: [1],
optionalChains: [42161, 8453, 10, 137, 56],
dappUrl: 'http://YourAwesomeDapp.com'
}
const walletConnect = walletConnectModule(wcInitOptions)
const onboard = Onboard({
wallets: [
walletConnect
]
})
const connectedWallets = await onboard.connectWallet()
const { instance } = connectedWallets[0]
console.log(connectedWallets)