Connect to ETHW ID using ethers.js

Ethw id is compatible with ens, you can use ethers.js to connect to ETHW ID

import { ethers } from "ethers";  

const network = {
  name: "ETHW",
  chainId: 10001,
  ensAddress: "0x00000000003dB7663112d1e121c6D2bb8220F671"
};  

//const provider = new ethers.providers.JsonRpcProvider("https://mainnet.ethereumpow.org/", network)
const provider = new ethers.providers.Web3Provider(window.ethereum, network)  

await provider.getBalance("369369.ethw");
// { BigNumber: "26959293642897667667" }

await provider.resolveName("369369.ethw");
// '0x32dCB300eaC6F7c1469d9c2d00909522Cbef155F'  

await provider.lookupAddress("0x32dCB300eaC6F7c1469d9c2d00909522Cbef155F");
// '369369.ethw'
// Requires primary name(reverse record) to be set

For more information on how to use it, you can check out the ethers.js docs

Last updated