# @web3identity/web3ns

> The SDK for interacting with the conflux core web3ns

Latest version **0.2.2** (published 2023-03-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install @web3identity/web3ns
pnpm add @web3identity/web3ns
yarn add @web3identity/web3ns
bun add @web3identity/web3ns
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2023-03-01 |
| First published | 2022-10-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 43.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | iangeliaq, 0x74616e67, pana, zctocm |

## Links

- npm: https://www.npmjs.com/package/@web3identity/web3ns
- npm.io page: https://npm.io/package/@web3identity/web3ns

## Dependencies (3)

- [idna-uts46-hx](https://npm.io/package/idna-uts46-hx.md) ^4.0.4
- [@web3identity/cns-contracts](https://npm.io/package/@web3identity/cns-contracts.md) ^0.3.1
- [@web3identity/address-encoder](https://npm.io/package/@web3identity/address-encoder.md) ^0.2.20

## Recent versions

- 0.2.2 (latest) — 2023-03-01
- 0.2.1 — 2023-02-24
- 0.2.0 — 2023-02-24
- 0.1.3 — 2023-02-03
- 0.1.2 — 2022-11-15
- 0.1.1 — 2022-11-04
- 0.1.0 — 2022-10-13

## README

# web3ns

## Install

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

```bash
npm install @web3identity/web3ns js-conflux-sdk
```

## How to use

```js
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

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

## Constants

* WEB3_NAMEHASH
* REVERSE_NAMEHASH
* ROOT_NODE

## Related Library

* [erc165 id calbulator](https://github.com/blockful-io/erc165)

---
_Source: https://npm.io/package/@web3identity/web3ns · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
