Gathering detailed insights and metrics for @web3-onboard/metamask
Gathering detailed insights and metrics for @web3-onboard/metamask
Gathering detailed insights and metrics for @web3-onboard/metamask
Gathering detailed insights and metrics for @web3-onboard/metamask
npm install @web3-onboard/metamask
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
860 Stars
3,061 Commits
510 Forks
41 Watching
35 Branches
175 Contributors
Updated on 27 Nov 2024
TypeScript (80.17%)
Svelte (18.52%)
JavaScript (1.19%)
CSS (0.08%)
HTML (0.04%)
Cumulative downloads
Total Downloads
Last day
-33%
227
Compared to previous day
Last week
2.1%
1,334
Compared to previous week
Last month
2%
5,450
Compared to previous month
Last year
2,967.7%
47,243
Compared to previous year
2
3
easy way to connect users to dapps
Install the core Onboard library, the injected wallets module and optionally ethers js to support browser extension and mobile wallets:
NPM
npm i @web3-onboard/core @web3-onboard/injected-wallets ethers
Yarn
yarn add @web3-onboard/core @web3-onboard/injected-wallets ethers
Then initialize in your app:
1import Onboard from '@web3-onboard/core' 2import injectedModule from '@web3-onboard/injected-wallets' 3import { ethers } from 'ethers' 4 5const MAINNET_RPC_URL = 'https://mainnet.infura.io/v3/<INFURA_KEY>' 6 7const injected = injectedModule() 8 9const onboard = Onboard({ 10 wallets: [injected], 11 chains: [ 12 { 13 id: '0x1', 14 token: 'ETH', 15 label: 'Ethereum Mainnet', 16 rpcUrl: MAINNET_RPC_URL 17 }, 18 { 19 id: 42161, 20 token: 'ARB-ETH', 21 label: 'Arbitrum One', 22 rpcUrl: 'https://rpc.ankr.com/arbitrum' 23 }, 24 { 25 id: '0xa4ba', 26 token: 'ARB', 27 label: 'Arbitrum Nova', 28 rpcUrl: 'https://nova.arbitrum.io/rpc' 29 }, 30 { 31 id: '0x2105', 32 token: 'ETH', 33 label: 'Base', 34 rpcUrl: 'https://mainnet.base.org' 35 } 36 ] 37}) 38 39const wallets = await onboard.connectWallet() 40 41console.log(wallets) 42 43if (wallets[0]) { 44 // create an ethers provider with the last connected wallet provider 45 const ethersProvider = new ethers.providers.Web3Provider( 46 wallets[0].provider, 47 'any' 48 ) 49 50 const signer = ethersProvider.getSigner() 51 52 // send a transaction with the ethers provider 53 const txn = await signer.sendTransaction({ 54 to: '0x', 55 value: 100000000000000 56 }) 57 58 const receipt = await txn.wait() 59 console.log(receipt) 60}
Onboard v1 migration guide
If you're coming from v1, we've created a migration guide for you.
For full documentation, check out the README.md for each package or the docs page here:
Core Repo
Injected Wallets
SDK Wallets
Hardware Wallets
Frameworks
If you would like to test out the current functionality of V2 in a small browser demo, then:
git clone git@github.com:blocknative/onboard.git
cd onboard
git checkout main
yarn
(if running a M1 mac - yarn install-m1-mac
)yarn dev
No vulnerabilities found.
No security vulnerabilities found.