@bonfida/sns-warp-evm
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

@bonfida/sns-warp-evm



Resolve .sol domain names on EVM chains


Table of contents


  1. Installation
  2. Introduction
  3. Supported chains
  4. Examples

Installation


With Yarn:

yarn add @bonfida/sns-warp-evm

With NPM:

npm i @bonfida/sns-warp-evm

Introduction


This package can be used to resolve .sol domains on EVM chains. Currently the package only supports BNB testnet.


Supported chains


The JS client currently support the following chains:

  • BNB Testnet (deployed at 0x4d50e149bb3d8c889f4ccdfffba0ef8016168d92)
  • BNB Mainnet (deployed at 0xd1Ae42Ce34E6b7ab5B41dcc851424F3cF410BF16)

The supported chains can be accessed through the enum SupportedChains:

export enum SupportedChains {
  BNBTestNet = "BNBTestNet",
  BNBMainnet = "BNBMainnet",
  // ...
}

The list of all supported chains is also exported through ALL_SUPPORTED_CHAINS


Examples


Resolving a .sol domain

The following code can be used to resolve .sol domains

// The domain name to resolve
const domain = "mock3.sol";
// The chain on which to resolve the domain
const targetChain = SupportedChains.BNBMainnet;

const sns = new SNS(SupportedChains.BNBMainnet);
const resolved = await sns.resolveName(domain);

console.log(resolved); // <- 0x1D719d2dB763f905b1924F46a5185e001Dd93786

Reverse look up

The following code can be used to resolve a name address

// The chain on which to perform the reverse lookup
const targetChain = SupportedChains.BNBMainnet;

const sns = new SNS(targetChain);
const nameHash = namehash("mock3.sol");

const resolved = await sns.resolveReverse(nameHash);
console.log(resolved); // <- mock3

Readme

Keywords

none

Package Sidebar

Install

npm i @bonfida/sns-warp-evm

Weekly Downloads

8

Version

0.0.4

License

MIT

Unpacked Size

488 kB

Total Files

16

Last publish

Collaborators

  • bonfida