HNS Resolution SDK
The HNS namespace currently includes .hbar
, .boo
, and .cream
TLDs, which are native to HNS. Since the namespace will expand over time, a hardcoded list of TLDs for recognizing HNS names will regularly be out-of-date. The HNS Resolution SDK ensures a correct resolution of account holders and their domains.
Name Resolution
Domains can have many types of data associated with them; the most common is cryptocurrency addresses, or Hedera Account IDs in the context of HNS.
Installation
Install the SDK. There are no additional peer dependencies required at this time.
npm install @hedera-name-service/hns-resolution-sdk
Initialization
Initialize the resolver by defining the API service you will use with the SDK. The SDK currently supports the following services:
hedera_main
: Hedera Mainnet Public Mirror Nodehedera_test
: Hedera Testnet Public Mirror Node
Example to initialize resolver with hedera_main
:
import { Resolver } from 'hns-resolution-sdk';
const resolver = new Resolver('hedera_main');
arkhia_main
: Hedera Mainnet Arkhia API Servicearkhia_test
: Hedera Testnet Arkhia API Service
Example to initialize resolver with arkhia_main
:
import { Resolver } from 'hns-resolution-sdk';
const resolver = new Resolver('arkhia_main', 'x-api-key', `${process.env.apiKey}`);
Note: The example above demonstrates how to initialize the resolver with Arkhia. This is only for demonstration purposes and should not be implemented on any client side code. Always keep your API keys hidden!