feat: use .env to setup chain ID

This commit is contained in:
Ting-Jun Wang 2023-06-08 19:27:40 +08:00
parent af788a526e
commit 454ab1ae21
Signed by: snsd0805
GPG Key ID: 8DB0D22BC1217D33

View File

@ -20,7 +20,8 @@ export default {
const provider = await detectEthereumProvider() const provider = await detectEthereumProvider()
if (provider) { if (provider) {
const chainId = await window.ethereum.request({ method: 'eth_chainId' }) const chainId = await window.ethereum.request({ method: 'eth_chainId' })
if (chainId == 0xaa36a7) { console.log(chainId)
if (chainId == import.meta.env.VITE_CHAIN_ID) {
const account = await window.ethereum.request({ method: 'eth_requestAccounts' }) const account = await window.ethereum.request({ method: 'eth_requestAccounts' })
this.client.address = account[0] this.client.address = account[0]
this.client.linked = true this.client.linked = true