chainId

window.phantom.ethereum.chainId

The chainId of the network you are currently connected to, returned as a hexadecimal string.

const chainId = window.phantom.ethereum.chainId;
console.log(chainId);
// "0x1"
// hexidecimal representation of Ethereum Mainnet

Last updated