diff --git a/bridge/bsc.html b/bridge/bsc.html index 2f596f8..18b8b39 100644 --- a/bridge/bsc.html +++ b/bridge/bsc.html @@ -734,8 +734,8 @@ } else { let myEthAddress; try { - const accounts = (await ethereum.send('eth_requestAccounts')).result; - myEthAddress = accounts[0] + const accounts = await ethereum.request({method: 'eth_requestAccounts'}); + myEthAddress = accounts[0]; console.log('address is', myEthAddress); } catch (error) { console.log(error); @@ -753,7 +753,8 @@ console.log('address is', provider.myEthAddress); }); - if (ethereum.networkVersion !== ETH_CHAIN_ID.toString()) { + const networkVersion = await ethereum.request({ method: 'net_version' }); + if (networkVersion !== ETH_CHAIN_ID.toString()) { alert('Set chain to ' + (IS_TESTNET ? 'BSC Testnet' : 'BSC') + ' in Metamask'); return null; } diff --git a/bridge/index.html b/bridge/index.html index 65f7410..0fe325c 100644 --- a/bridge/index.html +++ b/bridge/index.html @@ -732,7 +732,7 @@ } else { let myEthAddress; try { - const accounts = (await ethereum.send('eth_requestAccounts')).result; + const accounts = await ethereum.request({method: 'eth_requestAccounts'}); myEthAddress = accounts[0] console.log('address is', myEthAddress); } catch (error) { @@ -751,7 +751,8 @@ console.log('address is', provider.myEthAddress); }); - if (ethereum.networkVersion !== ETH_CHAIN_ID.toString()) { + const networkVersion = await ethereum.request({ method: 'net_version' }); + if (networkVersion !== ETH_CHAIN_ID.toString()) { alert('Set chain to ' + (ETH_CHAIN_ID === 3 ? 'Ropsten' : 'Mainnet') + ' in Metamask'); return null; }