JavaScript library to easily onboard users to ethereum apps by enabling wallet selection, connection, wallet checks and real time state updates.
npm install @requestnetwork/onboard-extra
importOnboardfrom'@requestnetwork/onboard-extra'importWeb3from'web3'// set a variable to store instantiated web3letweb3// head to blocknative.com to create a keyconstBLOCKNATIVE_KEY='blocknative-api-key'// the network id that your dapp runs onconstNETWORK_ID=1// initialize onboardconstonboard=Onboard({dappId: BLOCKNATIVE_KEY,networkId: NETWORK_ID,subscriptions: {wallet: wallet=>{// instantiate web3 when the user has selected a walletweb3=newWeb3(wallet.provider)console.log(`${wallet.name} connected!`)}}})// Prompt user to select a walletawaitonboard.walletSelect()// Run wallet checks to make sure that user is ready to transactawaitonboard.walletCheck()For detailed documentation head to docs.blocknative.com