Working with PNS
Before you can begin interacting with ENS, you will need to obtain a reference to the ENS registry. How you do this depends on the library you are using.
Example code for the Javascript-based APIs (ensjs, web3.js, ethjs-ens, and ethers.js) here expect that they are being run inside a DApp browser, such as Chrome with metamask installed, which exposes the ethereum
object.
Some web3 libraries - e.g., ethers.js, - have integrated support for name resolution. In these libraries, you can pass in an PNS name anywhere you can supply an address, meaning you do not need to interact directly with their PNS APIs unless you want to manually resolve names or do other PNS operations.
If no library is available for your platform, you can instantiate the PNS registry contract directly using the interface definition here. Addresses for the PNS registry on each supported network are available in the PNS Deployments page.
Last updated