Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Rootstock Name service RNS #4786

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ahsan-javaiid
Copy link

Description

This PR adds RNS support to ether.js. Users will be able to resolve .rsk names on Rootstock network to easily find and locate addresses using ethers.js similiar to ens.

RNS service: https://manager.rns.rifos.org/

Note: RNS is a name service similiar to ens on Rootstock network.
https://dev.rootstock.io/rif/rns/

About Rootstock

Website: https://rootstock.io/
Defillama: https://defillama.com/chain/Rootstock
Explorer: https://explorer.rootstock.io/
Developer portal: https://dev.rootstock.io/

Motivation

Lot of wallets, web3 tools and defi projects are using ethers.js provider instance methods resolveName and lookupAddress to resolve ens names. Adding RNS support in ethers.js will automatically enable rns feature in lot of these defi projects.

Testing Script

The resolveName and lookupAddress on provider class will resolve .rsk names and addresses. Attached is the demo script.

Build the branch in this pr: npm run build-dist
Now run the below script in same directory.


const { ethers } = require("./dist/ethers.umd.js");


async function main() {

  const ROOTSTOCK_RPC_NODE = "https://public-node.rsk.co";
  
  const provider = new ethers.JsonRpcProvider(ROOTSTOCK_RPC_NODE);

  // rns name lookup
  const resolvedAddress = await provider.resolveName('alepc.rsk');

  console.log('resolved address: ', resolvedAddress);

  // lookup address
  const resolvedName = await provider.lookupAddress('0xA78C937844b27bEc024F042DCbE5B85d2B7344F6');

  console.log('resolved name:', resolvedName);
}

main();

Feel free to review the pr and let us know if any changes are required.

@ahsan-javaiid
Copy link
Author

cc @ricmoo for review on this PR. Feel free to let me know if any changes are required. Super excited to land this PR into ethers.js 🚀

@ahsan-javaiid
Copy link
Author

cc: @ricmoo Reminder for review on this PR.

@mehedihassan0
Copy link

looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants