Skip to content

cedricsolignac/add-rpc-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

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)
    })
  }

About

Add RPC in JS for Metamask

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published