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-resolver.js

v1.1.0

Published

RNS Resolver

Downloads

33

Readme

Use this library to resolver RNS domains.

npm i @rsksmart/rns-resolver.js

Features

  • Resolve RSK addresses
  • Resolve other coins addresses
  • Common JS, DOM, Node.js and React Native support

Usage

import Resolver from '@rsksmart/rns-resolver.js'

const resolver = new Resolver.forRskMainnet()

resolver.addr('moneyonchain.rsk').then(console.log) // gets rsk address
// 0x135601C736ddB4C58a4b8fd3CD9F66dF244d28AA


resolver.addr('multichain.testing.rsk', 0).then(console.log) // gets btc address
// 1Ftu4C8VW18RkB8PZxXwwHocMLyEynLcrG

resolver.reverse('0xe9a4e6fae8217E032A08848E227d2b57D3E1e0A5').then(console.log) // gets address of a domain if reverse is set
// testing.rsk

Take a look at the sample apps!

Usage with other networks

For RSK Testnet:

const resolver = new Resolver.forRskTestnet()

For other networks:

const resolver = new Resolver({
  rpcUrl, // your custom network rpc url
  registryAddress: rnsRegistryContractAddress, // deployed on your custom network
  addrEncoder: (buff: Buffer) => `0x${buff.toString('hex')}`, // mock address encoder
})

To deploy RNS Registry contract in your local network you can either:

  • Run the whole RNS Suite: https://github.com/rnsdomains/rns-suite
  • Deploy just the RNS Registry: https://github.com/rnsdomains/rns-registry
  • Deploy programatically as done in unit tests in this repo - see test/resolver.test.ts

Usage in Node.js

This library uses fetch by default. To use the ibrary in Node.js please install node-fetch and set it up this way:

import Resolver from '@rsksmart/rns-resolver.js'
import nodeFetch from 'node-fetch'

const resolver = new Resolver.forRskMainnet({
  fetch: nodeFetch
})

Usage in React Native

The resolver uses some Node.js modules that are not implemented by React Native. You need to fill the globals.

  1. Install the resolver
yarn add @rsksmart/rns-resolver.js
  1. It . Install them
yarn add buffer big-integer
  1. Add a shim.js file
if (typeof Buffer === 'undefined') global.Buffer = require('buffer').Buffer
if (typeof BigInt === 'undefined') global.BigInt = require('big-integer')
  1. Import shim.js from index.js
import './shim'

Integrations references

| Wallet | Type | PR | | - | - | - | | Edge | Mobile wallet (React Native) | EdgeApp/edge-react-gui#2505 | | rWallet | Mobile wallet (React Native) | rsksmart/rwallet/#652 |

Develop

Install dependencies:

npm i

Run tests

Start a ganache-cli in a spearate terminal with

npm run ganache

Then run:

npm run test

Run linter

npm run lint