Namespace Client

A function to create a NamespaceClient

A Namespace Client is an interface for interacting with Namespace Backend API And Smart contracts on different chains.

The createNamespaceClientfunction sets up a Namespace Client with a given ChainId. The ChainId specifies an id of a blockchain where the subnames are being minted from.

index.ts
import { createNamespaceClient } from "namespace-sdk";
import { base } from "viem/chains";

const NamespaceClient = createNamespaceClient({
    chainId: base.id,
    mintSource: "my-app",
    rpcUrl: "https://alchemy-url"
});

Parameters

1. chainId ( required ) - Specifies chain id where subnames are minted from, supported chains include

  • Mainnet ( chainId: 1 )

  • Base ( chainId: 8453 )

  • Sepolia ( chainId: 11155111 )

  • BaseSepolia ( chainId: 84532)

  1. mintSource ( optional ) - Used to track the source of minted subnames on a blockchain, defaults to "namespace-sdk".

  2. rpcUrl ( optional ) - Http RPC URL which will be used by SDK when it performs blockchain operations, defaults to a public RPC for a given chain

Last updated