Files
Hideyoshi Moriya 2febea66f4 add Dapp Example #19
2023-04-14 23:19:22 +09:00

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 {
}
})