-
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.
Update network version, fix metamask button (#65)
* Network Version & Metamask * update node title * Test Fix for metamask button * Update network version, fix metamask button
- Loading branch information
Showing
6 changed files
with
71 additions
and
12 deletions.
There are no files selected for viewing
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
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-PM-chain.js | ||
|
||
document.addEventListener('DOMContentLoaded', function() { | ||
const addZilliqaPMChainButton = document.getElementById('addZilliqaPMChainButton'); | ||
|
||
if (addZilliqaPMChainButton) { | ||
addZilliqaPMChainButton.addEventListener('click', addZilliqaPMChain); | ||
} | ||
}); | ||
|
||
async function addZilliqaPMChain() { | ||
if (typeof window.ethereum !== 'undefined') { | ||
try { | ||
await window.ethereum.request({ | ||
method: "wallet_addEthereumChain", | ||
params: [ | ||
{ | ||
blockExplorerUrls: [ | ||
"https://explorer.zq2-protomainnet.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-protomainnet.zilliqa.com" | ||
], | ||
chainId: "0x8002", | ||
chainName: "Zilliqa 2 EVM proto-mainnet" | ||
} | ||
], | ||
}); | ||
alert('Zilliqa 2 EVM proto-mainnet 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.'); | ||
} | ||
} |
10 changes: 5 additions & 5 deletions
10
zq2/docs/js/add-zilliqa-chain.js → zq2/docs/js/add-zilliqa-PT-chain.js
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
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