It has been always a pain to configure xDAI or any other ânon-officialâ network on metamask, until now, the new Custom Network API is here!
It implements EIP-3085, and itâs as easy as call the following javascript snippet to add the xDAI network:
ethereum.request({
method: "wallet_addEthereumChain",
params: [{
chainId: "0x64",
chainName: "xDai",
rpcUrls: ["https://xdai.poanetwork.dev/"],
iconUrls: ["https://gblobscdn.gitbook.com/spaces%2F-Lpi9AHj62wscNlQjI-l%2Favatar.png"],
nativeCurrency: { name: "xDAI", symbol: "xDAI", decimals: 18 },
blockExplorerUrls: ["https://blockscout.com/poa/xdai/"]
}]
})
And this is how it looks like!
Itâs time to change the âWrong networkâ message in our interfaces, folks! Letâs make some pull requests!