@bictory/cns-resolver
v0.0.7
Published
Bictory CNS Resolver SDK
Downloads
8
Maintainers
Readme
@bictory/cns-resolver - Concordium CNS Resolver lib
The lib helps to work with CNS Smartcontracts directly.
Installation
Use the package manager npm or yarn to install @bictory/cns-resolver.
npm install @bictory/cns-resolver
OR
yarn add @bictory/cns-resolver
Usage
There are two possibilities to use the lib:
- Using Bictory's Concordium Node details:
import { BictoryCnsApi, Environment } from '@bictory/cns-resolver';
// Specify here TESTNET or MAINNET
const api = new BictoryCnsApi(Environment.TESTNET)
- If you want to use your own Concordium Node:
import { CnsApi } from '@bictory/cns-resolver';
// Specify here TESTNET or MAINNET
const api = new CnsApi(<your_node_ip>, <your_node_port>, Environment.TESTNET);
Resolve Method:
import { BictoryCnsApi, Environment } from '@bictory/cns-resolver';
// Specify here TESTNET or MAINNET
const api = new BictoryCnsApi(Environment.TESTNET)
// before use each function, api client should be called connect method
await api.connect()
// then you can use resolve method
const address = await api.resolve('my_domain.ccd');
// should return the address which the domain name belongs to
// if address can't be found resolve method returns an empty string ''
Support
Don't use this lib on Front end directly. Interaction front end with CNS Smartcontracts should be performed via web service!. This is a simple node js example that you can use and improve for your goals.
License
MIT