@bictory/cns-resolver
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

@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:

  1. Using Bictory's Concordium Node details:
import { BictoryCnsApi, Environment } from '@bictory/cns-resolver';

// Specify here TESTNET or MAINNET
const api = new BictoryCnsApi(Environment.TESTNET)
  1. 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

Package Sidebar

Install

npm i @bictory/cns-resolver

Weekly Downloads

3

Version

0.0.7

License

MIT

Unpacked Size

44.8 kB

Total Files

32

Last publish

Collaborators

  • bictory