@bonfida/sns-warp-evm
v0.0.4
Published
Cross-chain (EVM) resolution of Solana Name Service domain names
Downloads
53
Readme
With Yarn:
yarn add @bonfida/sns-warp-evm
With NPM:
npm i @bonfida/sns-warp-evm
This package can be used to resolve .sol
domains on EVM chains. Currently the package only supports BNB testnet.
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
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