Created
September 10, 2021 10:18
-
-
Save AlexBHarley/e0049aa6dce2c0ea4273aa384601edc7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Onboard from "@pooltogether/bnc-onboard" | |
import Web3 from "web3" | |
let web3 = null | |
function App() { | |
const send = async () => { | |
if (!web3) { | |
return | |
} | |
const a = await web3.eth.sendTransaction({ | |
from: "0x85f1f7b4106929b368e33421dacdfa6ab30d54fb", | |
to: "0x85f1f7b4106929b368e33421dacdfa6ab30d54fb", | |
value: 1, | |
}) | |
console.log(a) | |
} | |
const connect = async () => { | |
const NETWORK_ID = 42220 | |
const onboard = Onboard({ | |
networkId: NETWORK_ID, | |
subscriptions: { | |
wallet: (wallet) => { | |
web3 = new Web3(wallet.provider) | |
console.log(`${wallet.name} connected!`) | |
}, | |
}, | |
walletSelect: { | |
wallets: [ | |
{ | |
walletName: "walletConnect", | |
rpc: { | |
42220: "https://forno.celo.org", | |
}, | |
}, | |
], | |
}, | |
}) | |
await onboard.walletSelect() | |
await onboard.walletCheck() | |
} | |
return ( | |
<div> | |
<button onClick={connect}>Connect</button> | |
<button onClick={send}>Send</button> | |
</div> | |
) | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment