@wehmoen/rnsts
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Ronin Name Serive - Typescript Wrapper

This is a typescript wrapper for the Ronin Name Service.

Installation

npm install @wehmoen/rnsts

Usage

import RNS  from '@wehmoen/rnsts';

const rns = new RNS();

(async () => {

    console.log("========= Forward Resolution =========")
    const name = "jihoz.ron";
    let result = await rns.getAddress(name)
    console.log(`${name} address: ${result}`);

    console.log("========= Reverse Resolution =========")
    const address = "0xa09a9b6F90AB23fCDcd6c3D087C1dfb65dDdfb05";
    result = await rns.getName(address)
    console.log(`${address} name: ${result}`);

    console.log("========= Batch Forward Resolution =========")
    const names = ["jihoz.ron", "dwi.ron", "wehmoen.ron"];
    let batchAddressResult = await rns.getAddressBatch(names)
    for (const name in batchAddressResult) {
        console.log(`${name} address: ${batchAddressResult[name]}`);
    }

    console.log("========= Batch Reverse Resolution =========")
    const addresses = ["0xa09a9b6F90AB23fCDcd6c3D087C1dfb65dDdfb05", "0x445ba6F9f553872Fa9cDC14F5c0639365b39C140", "0x3759468f9fd589665c8AfFBE52414Ef77F863f72"];
    let batchNameResult = await rns.getNameBatch(addresses)
    for (const address in batchNameResult) {
        console.log(`${address} name: ${batchNameResult[address]}`);
    }
})();

Package Sidebar

Install

npm i @wehmoen/rnsts

Weekly Downloads

4

Version

1.0.2

License

MIT

Unpacked Size

6.52 kB

Total Files

6

Last publish

Collaborators

  • wehmoen