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

@onsol/tldparser

v0.6.7

Published

TLD House (Solana) Javascript API

Downloads

12,040

Readme

TLD Parser

library to parse tld house domains via alternative name service (ANS) on the Solana Blockchain.

  • TLD Parser is in active development.
  • So all APIs are subject to change.

Active Tlds

TLD     => parentAccountKey
.bonk   => 2j6gC6MMrnw4JJpAKR5FyyUFdxxvdZdG2sg4FrqfyWi5
.poor   => 8err4ThuTiZo9LbozHAvMrzXUmyPWj9urnMo38vC6FdQ
.abc    => 3pSeaEVTcKLkXPCpZHDpHUMWAogYFZgKSiVtyvqcgo8a
.eth    => GCzHo7kQPQrrLKbcmF3dAb3uv5EG1TxuSqvoNaAdgwHK

Examples

current functions and how to use them.

the library only works in mainnet.

the devnet values are in constants.ts file

the example below is a replica of the tests in tests folder

// constants
const RPC_URL = '';
const owner = new PublicKey("owner pubkey");
const tld = 'poor';
const domain = 'miester.poor';

// initialize
const connection = new Connection(RPC_URL);
const parser = new TldParser(connection);

// list of name record header publickeys owned by user
const ownerDomains = await parser.getAllUserDomains(owner); 
// ["6iE5btnTaan1eqfnwChLdVAyFERdn5uCVnp5GiXVg1aB"]

// list of name record header publickeys owned by user in a tld
const ownedTldDomains = await parser.getAllUserDomainsFromTld(owner, tld);
// ["6iE5btnTaan1eqfnwChLdVAyFERdn5uCVnp5GiXVg1aB"]

// retrieve owner of a particular domain
const owner = await parser.getOwnerFromDomainTld(domain);
// owner pubkey

// retrieve NameRecordHeader of a particular domain
const nameRecord = await parser.getNameRecordFromDomainTld(domain);
// a NameRecordHeader state
// if domain is expired, owner and data fields would be undefined

// retrieve tld of a particular domain Tld
const tldReceived = await parser.getTldFromParentAccount(nameRecord.parentName);
// .poor

// retrieve domain of a particular nameAccount with parentAccountOwner (TldHouse) in our case .poor
const parentNameRecord = await NameRecordHeader.fromAccountAddress(connection, nameRecord?.parentName);
const domain = await parser.reverseLookupNameAccount(nameAccount, parentNameRecord?.owner);
// miester

// retrieve dns from domains. works with different records
const recordPubkey = (await getDomainKey(Record.IPFS + "." + domain, true)).pubkey
const nameRecord = await NameRecordHeader.fromAccountAddress(recordPubkey);
// ipfs://...

const allTlds = await getAllTlds(connection);
// [{ 
//    tld: '.bonk',
//    parentAccount: "2j6gC6MMrnw4JJpAKR5FyyUFdxxvdZdG2sg4FrqfyWi5",
//  },
//  {
//    tld: '.poor',
//    parentAccount: "8err4ThuTiZo9LbozHAvMrzXUmyPWj9urnMo38vC6FdQ",
//  },
//  {
//    tld: '.abc',
//    parentAccount: "3pSeaEVTcKLkXPCpZHDpHUMWAogYFZgKSiVtyvqcgo8a",
// }]

States

current state is the NameRecordHeader, it is the data retrieved from any ANS account.

the account structure:

  • parentName: PublicKey;

parent is a name account that can have many children (name accounts)

  • owner: PublicKey | undefined;

name account owner can be undefined if the name account has expired

  • nclass: PublicKey;

name class is an account that holds an account state (Main domain, DNS, Subdomains) or can be Publickey.default

  • expiresAt: Date;

the date by which the name account will expire. would be 0 if non expirable domains

  • isValid: boolean;

only valid for expirable domains

  • data: Buffer | undefined;

any data that is held by the name account