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

@justaname.id/address-resolution

v1.1.0

Published

Resolve address to its primary name

Downloads

39

Readme

Installation

npm install @justaname.id/address-resolution

Getting Started

import { addressResolution } from "@justaname.id/address-resolution";

const name = addressResolution("address", "providerUrl");

Reverse Resolution:

const nameHash = ethers.namehash(testAddress.substring(2) + ".addr.reverse");

First Step: Query Registry Contract:

The first step would be to query the registry contract to get the resolver contract’s address associated with a given nameHash. This should return the off-chain provider’s resolver contract address.

Second Step: Query the Resolver Contract:

Supports Interface:

Call the function [”function supportsInterface(bytes4 interfaceID) returns bool”] with interfaceId = “0x9061b923”.

False:

In case it returns false, call the function [”function name(bytes32 node) returns (string)”] on the Resolver contract. This should return the associated name.

True:

In case it returns true, call the function [”resolve(bytes name, bytes data) returns (bytes)”] on the Off-chain Resolver Contract.

The param name should be the DNS-encoded nameHash.

The param data should be [”name(bytes32)”]

Query the contract:

The rest of the flow would be an extension to CCIP-Read and ENSIP-10 The contract should revert with the same error:

error OffchainLookup(address sender, string[] urls, bytes callData, bytes4 callbackFunction, bytes extraData);

Call the gateway:

Query the gateway on the url returned by the contract in step2, and pass the sender with the calldata. Example: {url}/resolve/{sender}/{callData}.json

The off-chain gateway handling the request should add its own logic for handling the [”name(bytes32)”] and return the correct data, similar to how it is handling the logic of:

[”addr(bytes32)”, “addr(bytes32,uint256)”, “text(bytes32,string)”, “contenthash(bytes32)”]

Callback Function:

Call the callbackFunction of the contract (returned in revert error of step 2), and pass the gateway response of step3, along with the extraData returned in step 2. The response returned from the contract should be decoded and will return the primary name associated with the nameHash.