-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51ba0c0
commit 4b0c528
Showing
8 changed files
with
401 additions
and
34 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// add-zilliqa-chain.js | ||
|
||
document.addEventListener('DOMContentLoaded', function() { | ||
const addZilliqaChainButton = document.getElementById('addZilliqaChainButton'); | ||
|
||
if (addZilliqaChainButton) { | ||
addZilliqaChainButton.addEventListener('click', addZilliqaChain); | ||
} | ||
}); | ||
|
||
async function addZilliqaChain() { | ||
if (typeof window.ethereum !== 'undefined') { | ||
try { | ||
await window.ethereum.request({ | ||
method: "wallet_addEthereumChain", | ||
params: [ | ||
{ | ||
blockExplorerUrls: [ | ||
"https://otterscan.zq2-prototestnet.zilliqa.com/" | ||
], | ||
iconUrls: [ | ||
"https://www.zilliqa.com/images/icon-zilliqa-testnet.svg", | ||
"https://www.zilliqa.com/images/icon-zilliqa-testnet.png" | ||
], | ||
nativeCurrency: { | ||
name: "ZIL", | ||
symbol: "ZIL", | ||
decimals: 18 | ||
}, | ||
rpcUrls: [ | ||
"https://api.zq2-prototestnet.zilliqa.com" | ||
], | ||
chainId: "0x814f", | ||
chainName: "Zilliqa 2 EVM proto-testnet" | ||
} | ||
], | ||
}); | ||
alert('Zilliqa 2 EVM proto-testnet has been added to your wallet!'); | ||
} catch (error) { | ||
console.error(error); | ||
alert('An error occurred while trying to add the network: ' + error.message); | ||
} | ||
} else { | ||
alert('MetaMask is not installed. Please install it to use this feature.'); | ||
} | ||
} |
Oops, something went wrong.