mirror of
https://github.com/a42inc/ETHGlobalTokyo2023.git
synced 2026-01-14 07:47:56 -05:00
25 lines
515 B
JavaScript
25 lines
515 B
JavaScript
async function connectWallet() {
|
|
await ethereum.request({ method: 'eth_accounts' })
|
|
}
|
|
|
|
$(window).on('load', async () => {
|
|
if (typeof window.ethereum === 'undefined') {
|
|
return
|
|
}
|
|
|
|
ethereum.on('connect', (connectInfo) => {
|
|
console.log("connect")
|
|
console.log(connectInfo)
|
|
})
|
|
|
|
ethereum.on('accountsChanged', (accounts) => {
|
|
console.log("accountChanged")
|
|
console.log(accounts)
|
|
})
|
|
|
|
if (ethereum.selectedAddress) {
|
|
console.log(ethereum.selectedAddress)
|
|
} else {
|
|
}
|
|
})
|