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 🙏

© 2026 – Pkg Stats / Ryan Hefner

namespace-sdk-no-axios

v1.2.10

Published

A library for interacting with namespace contracts and apis

Downloads

9

Readme

Namespace Ninja

Namespace-SDK

A Typescript library used to interact with Namespace contracts and apis. It uses Viem under the hood and can be used to:

  • Find names listed on Namespace platform
  • Check the availability of subnames
  • Mint subnames

This is the initial version, expect many more functionalities in the future!

Installation

Use a package manager to install library into your project

Yarn

yarn add namespace-sdk

Npm

npm install namespace-sdk

Getting started

First we can create a simple NamespaceClient and specify the chainId. The chain id specifies a chain on which read/write blockchain operations happen. If we list our name on a Mainnet and subnames are minted on Mainnet, we'll have to specify a chainId 1. We will use a sepolia testnet in the example.

The chainId is required since the library supports minting subnames on both Layer 1 and its testnet (Sepolia) but also on the Layer 2 ( Currently, only Base chain is supported )

import { createNamespaceClient } from "namespace-sdk";
import { sepolia } from "viem/chains";

const namespaceClient = createNamespaceClient({
  chainId: sepolia.id
});

Minting a subname

Minting ENS subnames requires a couple of steps.

1. Listing an ENS name

First, we would need to have an ENS name which is listed on Namespace platform. To do so, visit our Platform and check Manager

For testing purposes, you can use "namespace-sdk.eth" on Sepolia chain.

2. Generate minting parameters

After we list ENS name, our platform allows minting subnames under it. We can use a library to check for subname availability and to generate a mint transaction parameters.

import { createNamespaceClient, SetRecordsRequest, MintTransactionParameters } from "namespace-sdk";
import { sepolia } from "viem/chains";

const namespaceClient = createNamespaceClient({
  chainId: sepolia.id,
});

const LISTED_NAME = "namespace-sdk.eth"
const ETH_COIN_TYPE = 60;

const generateMintingParameters = async (): Promise<MintTransactionParameters> => {

  // Get listed name from namespace api
  const listedName = await namespaceClient.getListedName(
    LISTED_NAME,
    sepolia.id
  );

  const subnameLabel = "myfunnylabel";
  const minterAddress = "0x6CaBE5E77F90d58600A3C13127Acf6320Bee0aA7"

  // Check for name availability
  const isNotTaken = await namespaceClient.isSubnameAvailable(
    listedName,
    subnameLabel
  );
  
  if (!isNotTaken) {
    throw Error("Subname is already taken!");
  }

   // Generate mint transcation parameters
  const mintDetails = await namespaceClient.getMintTransactionParameters(listedName, {
    minterAddress: minterAddress,
    subnameLabel: subnameLabel,
    subnameOwner: minterAddress,
    // Optionaly, we can also set resolver records with the mint transaction
    records: {
        addresses: [
            {
                address: minterAddress,
                coinType: ETH_COIN_TYPE
            }
        ],
        texts: [
            {
                key: "name",
                value: "namespace"
            }
        ]
    }
  });
  return mintDetails;
};

3. Send Transaction

Sending a transaction is the last step. Since the library uses Viem under the hood, we will use WalletClient to send a transaction.

import { sepolia } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";
import { createWalletClient, http } from "viem";
import { generateMintingParameters } from "./minting";

const sendMintTransaction = async () => {

    // Import your wallet and create a Viem Wallet Client
    const wallet = privateKeyToAccount("0xYourWallet");
    const walletClient = createWalletClient({
        transport: http(),
        chain: sepolia,
        account: wallet
    })

    // Generate minting parameters
    const mintParams = await generateMintingParameters();

    // Send transaction
    const transactionHash = await walletClient.writeContract({
        abi: mintParams.abi,
        address: mintParams.contractAddress,
        functionName: mintParams.functionName,
        args: mintParams.args,
        value: mintParams.value
    })

    console.log(transactionHash);
}

Authors

artii.eth