npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rsksmart/rns

v1.9.0

Published

RIF Name Service library.

Downloads

461

Readme

rns-js

npm version CircleCI

RNS JavaScript library.

npm i web3 @rsksmart/rns

Types are exposed under '@rsksmart/rns/types'

Or just use it directly in your webpage:

<script src="https://unpkg.com/[email protected]/dist/web3.min.js"></script>
<script src="https://unpkg.com/@rsksmart/[email protected]/lib/rns.min.js"></script>

Don't forget to specify the desired version of the package!

Basic usage

Instance de library:

import Web3 from 'web3'
import RNS from '@rsksmart/rns'
import { ChainId } from '@rsksmart/rns/types'

const web3 = new Web3('https://public-node.rsk.co')
const rns = new RNS(web3)

Get an address:

rns.addr('testing.rsk').then(console.log)

Get Bitcoin address:

rns.addr('testing.rsk', ChainId.BITCOIN).then(console.log)

Check if testing.rsk domain is available:

rns.available('testing.rsk').then(console.log)

Check if example.testing.rsk subdomain is available:

rns.subdomains.available('testing.rsk', 'example').then(console.log)

Reverse lookup: get name of a given address:

rns.reverse('0x0000000000000000000000000000000123456789').then(console.log)

Check out more operations details in the RSK Developers Portal.

Advanced usage

Use Web3 Contract directly

async function myCustomGetOwner(domain) {
  const web3 = new Web3('https://public-node.rsk.co')
  const rns = new RNS(web3)

  await rns.compose()

  const owner = await rns.contracts.registry.methods.owner(domain).call()

  return owner;
}

Resource record implementations

Coins supported:

  • BTC (base58check P2PKH and P2SH, and bech32 segwit)
  • LTC (base58check P2PHK and P2SH, and bech32 segwit)
  • DOGE (base58check P2PKH and P2SH)
  • MONA (base58check P2PKH and P2SH, and bech32 segwit)
  • DASH (base58check P2PKH and P2SH)
  • ETH (checksummed-hex)
  • ETC (checksummed-hex)
  • RSK (checksummed-hex)
  • XDAI (checksummed-hex)
  • XRP (base58check-ripple)
  • BCH (base58check and cashAddr; decodes to cashAddr)
  • BNB (bech32)
  • XLM (ed25519 public key)
  • ATOM (bech32)
  • TRX (base58check)
  • NEM (base32)
  • EOS
  • KSM (ss58)

Content types supported:

  • ipfs
  • bzz
  • onion
  • onion3

Run for development

Install dependencies:

git clone [email protected]:rnsdomains/rns-js.git
cd rns-js
npm i

Run tests:

npm test

Try out your development, create a testing project:

# in rns-js folder
npm run build
npm link
cd ..
mkdir rns-js-test
cd rns-js-test
npm init
npm i web3
npm link @rsksmart/rns

Versioning

  • master branch point to latest release.
  • develop branch contains changes that will apply next release. The first commit after release bumps to next version.
  • Other branches (feature branches) point to develop.

Find releases scopes in milestones