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

@nettlelabs/nfd-lookup

v1.1.0

Published

Allows the lookup of on-chain NFDomain metadata by address

Downloads

4

Readme

Table of contents

📦 1. Installation

  • Using npm:
$ npm install @nettlelabs/nfd-lookup
  • Using yarn:
$ yarn add @nettlelabs/nfd-lookup

🪄 2. Usage

2.1 Quick Start

import { INfdMetadata, lookupNfDomainByAddress } from '@nettlelabs/nfd-lookup';
import { Algodv2 } from 'algosdk';

const algodClient: Algodv2 = new Algodv2(
  '',
  'https://testnet-api.algonode.cloud',
  ''
); // first initialize your algod client
const metadata: INfdMetadata | null = await lookupNfDomainByAddress(
  'QSTBDZMDPUHM6LESD54ZUT55KICOECJ4CPOMLAWNMSS3563ZK64HKJ65TM',
  {
    algodClient,
    registryAppId: BigInt('84366825'), // this application ID MUST be the right one for the network
  },
);

if (metadata) {
  console.info(metadata.name); // kieran.algo
}

Back to top ^

2.2 API

lookupNfDomainByAddress(address, [options])

Lookup NFDomain metadata for an Algorand address (public key) on-chain.

Parameters

| Name | Type | Description | |---------|----------|----------------------------------------------| | address | string | The Algorand address (public key) to lookup. |

Options

An additional object must be provided:

| Name | Type | Default | Description | |----------------|--------------------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | algodClient | Algodv2 | - | An initialized Algod client that will be used to query the chain. | | debug | ILogLevel | silent | Whether logs will be printed to console. Can be one of debug, error, info, silent or warn. Defaults to silent. | | registryAppId | bigint | - | the registry app ID for the NFDomain you want to lookup. NOTE: you must use the correct registry that matches the client network connection. See Registry Application IDs. |

Returns

| Type | Description | |--------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Promise<INfdMetadata> or Promise<null> | An object containing the metadata for this address or null if no NFDomain exists for address or an error was encountered. See the available properties. |

TypeScript Example

import { INfdMetadata, lookupNfDomainByAddress } from '@nettlelabs/nfd-lookup';
import { Algodv2 } from 'algosdk';

const algodClient: Algodv2 = new Algodv2(
  '',
  'https://testnet-api.algonode.cloud',
  ''
); // first initialize your algod client
const metadata: INfdMetadata | null = await lookupNfDomainByAddress(
  'QSTBDZMDPUHM6LESD54ZUT55KICOECJ4CPOMLAWNMSS3563ZK64HKJ65TM',
  {
    algodClient,
    registryAppId: BigInt('84366825'), // this application ID MUST be the right one for the network
  },
);

console.info(result);
/*
Prints:
{
  internal: {
    asaid: '91947211',
    category: 'premium',
    commission1: '\x00\x00\x00\x00\x00\x00\x002',
    commission1Agent: '7ZZWL6MDVXBOWQPEFEAQQ3LKV755ONNMCBKO2WB3GARF5F2IQVJ5KYGTZY',
    contractLocked: '0',
    highestSoldAmt: '269000000',
    name: 'kieran.algo',
    owner: 'QSTBDZMDPUHM6LESD54ZUT55KICOECJ4CPOMLAWNMSS3563ZK64HKJ65TM',
    saleType: 'buyItNow',
    seller: 'QSTBDZMDPUHM6LESD54ZUT55KICOECJ4CPOMLAWNMSS3563ZK64HKJ65TM',
    timeChanged: '1667805899',
    timeCreated: '1653460340',
    timePurchased: '1653460421',
    ver: '1.13g'
  },
  verified: {},
  userDefined: {}
}
*/

Back to top ^

🛠 3. Development

3.1. Requirements

Back to top ^

3.2. Setup

  1. Install the dependencies:
$ yarn install

Back to top ^

3.3. Build

  • To build simply run:
$ yarn build

This will compile the Typescript source code into a dist/ directory.

Back to top ^

📑 4. Appendix

4.1 Useful Information

Back to top ^

👏 5. How To Contribute

Please read the Contributing Guide to learn about the development process.

Back to top ^

📄 6. License

Please refer to the LICENSE file.

Back to top ^

🎉 7. Credits

  • A massive shout-out to TxnLab and the amazing work they are doing for the Algorand ecosystem. ❤️

Back to top ^