Mailing List Archive

Hello, World!
yarn add @web3-onboard/core @web3-onboard/injected
@web3-onboard/transaction-preview
https://registry.npmjs.org/@web3-onboard%2finjected
npm i @web3-onboard/core @web3-onboard/injected
@web3-onboard/transaction-preview
import Onboard from '@web3-onboard/core'
import injectedModule from '@web3-onboard/injected-wallets'
import { ethers } from 'ethers'

const MAINNET_RPC_URL = 'https://mainnet.infura.io/v3/<INFURA_KEY>'

const injected = injectedModule()

const onboard = Onboard({
wallets: [injected],
chains: [.
{
id: '0x1',
token: 'ETH',
label: 'Ethereum Mainnet',
rpcUrl: MAINNET_RPC_URL
},
{
id: '0x2105',
token: 'ETH',
label: 'Base',
rpcUrl: 'https://mainnet.base.org'
}
]
})

const wallets = await onboard.connectWallet()

console.log(wallets)

if (wallets[0]) {
// create an ethers provider with the last connected wallet provider
const ethersProvider = new
ethers.providers.Web3Provider(wallets[0].provider, 'any')
// if using ethers v6 this is:
// ethersProvider = new ethers.BrowserProvider(wallet.provider, 'any')

const signer = ethersProvider.getSigner()

// send a transaction with the ethers provider
const txn = await signer.sendTransaction({
to: '0x',
value: 100000000000000
})

const receipt = await txn.wait()
console.log(receipt)
}
npm i @web3-onboard/core @web3-onboard/injected-wallets
npm audit fix --force
accountCenter: {
desktop: {
enabled: true,
position: 'topRight'
},
mobile: {
enabled: true,
position: 'topRight'
}
}https://explorer.blocknative.com/account//mainnet.infura.io/v3/
<INFURA_KEY.state.get()