Giter Club home page Giter Club logo

web3ns.js's Introduction

web3ns

Install

To use this SDK, js-conflux-sdk is also required.

npm install @web3identity/web3ns js-conflux-sdk [email protected]

How to use

const { Conflux } = require('js-conflux-sdk');
const { Web3Domain, namehash } = require('@web3identity/web3ns');

const conflux = new Conflux({
    url: 'https://test.confluxrpc.com',
    networkId: 1,
});

const web3domain = new Web3Domain({
    client: conflux,
    registryAddress: 'cfxtest:acen57mpbzvs774tk6kffcsbkef3m4mn5eh0nxy4jx',
    ...
});

async function main() {
    const owner = await web3domain.Registry.owner(namehash('conflux.web3'));
    console.log(`Owner of ${'conflux.web3'} is : ${owner}`);
}

main().catch(console.error);

Web3Domain sub fields(contract)

  • Registry
  • ReverseRegistrar
  • Web3BaseRegistrar
  • Web3Controller
  • NameWrapper
  • PublicResolver

Utilities

  • namehash
  • labelhash
  • dnsNameNotationDecode

dnsNameNotationDecode

This method is used to decode a DNS name notation string to domain

const dnsNotation = '\x05hello\x04web3\x00';
const domain = dnsNameNotationDecode(dnsNotation);
// hello.web3

Constants

  • WEB3_NAMEHASH
  • REVERSE_NAMEHASH
  • ROOT_NODE

Related Library

web3ns.js's People

Contributors

pana avatar zctocm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.