1.2.0 • Published 1 year ago
bns-resolver v1.2.0
bns-resolver
The Blockprime Name Resolver Library
Install
npm install bns-resolver
Usage
Import and initialization
import { BnsResolver } from "bns-resolver";
const bnsResolver = await BnsResolver.init(RPC_NODE);
Name resolution
- This function should be used when the input is a human readable name or alias like
alex.sxt
. The sample code:
const addr = await bnsResolver.resolveName('alex.sxt');
Lookup the address
- This function performs reverse resolution returning the primary alias of the given address. Typically it is used when the Ethereum account is connected to the dApp. The sample code:
const addr = await bnsResolver.lookupAddress('0x084B5B4967b6EaB4EeDc628C12c7E63292cD5FC6');
Running tests
npm run test