-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
30 lines (27 loc) · 867 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// const currentUrl = new URL(window.location.href)
// const forwarderOrigin = currentUrl.hostname === 'localhost' ? 'http://localhost:9010' : undefined
const checkNetwork = async () => {
var addNet = $('#addNetBtn')
addNet.on('click', function (e) {
if (window.ethereum) {
ethereum.request({
method: 'wallet_addEthereumChain',
params: [
{
chainId: '0x50',
chainName: 'GeneChain',
nativeCurrency: { name: 'RNA', symbol: 'RNA', decimals: 18 },
rpcUrls: ['https://rpc.genechain.io'],
blockExplorerUrls: ['https://scan.genechain.io']
}
]
})
} else {
window.open('https://github.com/genechain-io/geneth/wiki/Metamask')
}
})
}
const initialize = () => {
checkNetwork()
}
window.addEventListener('DOMContentLoaded', initialize)