Skip to content

Latest commit

 

History

History
28 lines (24 loc) · 593 Bytes

README.md

File metadata and controls

28 lines (24 loc) · 593 Bytes

Documentation

Ajouter un réseau dans metamask avec JavaScript.

  • HTML
  • JavaScript
function addNetwork() {
    window.ethereum.request({
      method: 'wallet_addEthereumChain',
      params: [{
      chainId: "0x146a2e",
      chainName: "shandong-testnet",
      nativeCurrency: {
          name: 'Testnet ETH',
          symbol: 'ETH',
          decimals: 18
      },
      rpcUrls: ["https:\/\/rpc.shandong.ethdevops.io"],
      blockExplorerUrls: ["https:\/\/explorer.shandong.ethdevops.io"]
      }]
    }).catch((error) => {
      console.log(error)
    })
  }