Onboard V2 Core Package
Getting Started
import Onboard from '@bn-onboard/core'
import InjectedWallets from '@bn-onboard/injected-wallets'
const injectedWallet = InjectedWallets()
const onboard = Onboard({
wallets: [injectedWallet],
appMetadata: {
name: '<APP_NAME>',
icon: '<APP_SVG_ICON_STRING>',
description: '<APP_DESCRIPTION'
},
i18n: {
es: {
connect: {
selectingWallet: {
sidebar: {
heading: 'Comenzar'
}
}
}
}
}
})
const state$ = onboard.state.select()
state$.subscribe(console.log)
const wallets$ = onboard.state.select('wallets')
wallets$.subscribe(console.log)
onboard.addChains([
{
id: '0x1',
token: 'ETH',
label: 'Ethereum Mainnet',
rpcUrl: 'https://mainnet.infura.io/v3/ababf9851fd845d0a167825f97eeb12b'
},
{
id: '0x4',
token: 'rETH',
label: 'Ethereum Rinkeby Testnet',
rpcUrl: 'https://rinkeby.infura.io/v3/ababf9851fd845d0a167825f97eeb12b'
},
{
id: '0x89',
token: 'MATIC',
label: 'Matic Mainnet',
rpcUrl: 'https://matic-mainnet.chainstacklabs.com'
}
])
onboard.connectWallet()
onboard.setChain('0x1')