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

@namespacesdk/offchain-manager

v3.0.9

Published

Library for creating and managing offchain subnames

Readme

Namespace Ninja

Namespace SDK - Offchain Client

npm version

Overview

The namespace-sdk provides an easy-to-use client for managing ENS subnames off-chain. With this SDK, developers can create, update, delete, and query subnames, as well as manage associated records like addresses, text records, and data records.

Namespace Dev Portal

If you've already done this, feel free to skip this step.

To issue subnames, make them resolvable, and get an API key, you need to go to our Dev Portal.

  1. Subnames section allows you to create, edit, or update subnames and all of their records (text, addresses, content hash)
  2. Resolution section is there for you to update the Resolver contract to Namespace Hybrid resolver so the subnames issued are resolvable in all ENS-supported apps.
  3. API Keys section allows you to create and manage API keys for ENS names you're issuing subnames from.

Installation

npm install @namespacesdk/offchain-manager

or using Yarn:

npm install @namespacesdk/offchain-manager

Getting Started

Import the SDK

import { OffchainClient } from '@namespacesdk/offchain-manager';

Initialize the Client

To use the SDK, create an instance of the OffchainClient and set your API key, which you can obtain from https://dev.namespace.ninja.

const client = new OffchainClient();
client.setApiKey('your-ens-name.eth', 'your-api-key');

Subname Management

Create a Subname

import { ChainName } from "@namespacesdk/offchain-manageR"

await client.createSubname({
  parent: 'example.eth',
  label: 'sub',
  addresses: [
    {
      chain: ChainName.Ethereum
      value: "0x123..."
    }
  ],
  texts: [
    {
      key: "avatar",
      value: "https://my_avatar_url"
    }
  ]
});

Update a Subname

await client.updateSubname('sub.example.eth', {
   addresses: [
    {
      chain: ChainName.Ethereum
      value: "0x123..."
    }
  ],
  texts: [
    {
      key: "avatar",
      value: "https://my_avatar_url"
    }
  ]
});

Delete a Subname

await client.deleteSubname('sub.example.eth');

Check if a Subname is Available

const response = await client.isSubnameAvailable('sub.example.eth');
console.log(response.available);

Get a Subname

const subname = await client.getSingleSubname('sub.example.eth');
console.log(subname);

Query Subnames

const subnames = await client.getFilteredSubnames({ parent: 'example.eth' });
console.log(subnames);

Record Management

Add an Address Record

import { ChainName } from "@namespacesdk/offchain-manager"

await client.addAddressRecord('sub.example.eth',  ChainName.Ethereum, '0xYourEthereumAddress');

Delete an Address Record

await client.deleteAddressRecord('sub.example.eth',  ChainName.Base);

Add a Text Record

await client.addTextRecord('sub.example.eth', 'twitter', '@yourhandle');

Delete a Text Record

await client.deleteTextRecord('sub.example.eth', 'twitter');

Retrieve All Text Records

const records = await client.getTextRecords('sub.example.eth');
console.log(records);

Retrieve a Specific Text Record

const record = await client.getTextRecord('sub.example.eth', 'twitter');
console.log(record);

Add a Data Record

await client.addDataRecord('sub.example.eth', 'customData', { key: 'value' });

Delete a Data Record

await client.deleteDataRecord('sub.example.eth', 'customData');

Retrieve All Data Records

const dataRecords = await client.getDataRecords('sub.example.eth');
console.log(dataRecords);

Retrieve a Specific Data Record

const dataRecord = await client.getDataRecord('sub.example.eth', 'customData');
console.log(dataRecord);

API Reference

setApiKey(ensName: string, apiKey: string): void

Sets the API key for authentication.

createSubname(request: CreateSubnameRequest): Promise<void>

Creates a new subname under a parent domain.

updateSubname(subname: string, request: UpdateSubnameRequest): Promise<void>

Updates an existing subname.

deleteSubname(fullSubname: string): Promise<void>

Deletes a subname.

isSubnameAvailable(fullSubname: string): Promise<GetAvailableResponse>

Checks if a subname is available.

getSingleSubname(fullName: string): Promise<SubnameDTO | null>

Retrieves details of a subname.

getFilteredSubnames(query: QuerySubnamesRequest): Promise<PagedResponse<SubnameDTO[]>>

Fetches subnames based on query parameters.

addAddressRecord(subname: string, chain: ChainName, value: string): Promise<void>

Adds an address record to a subname.

deleteAddressRecord(subname: string, chain: ChainName): Promise<void>

Deletes an address record.

addTextRecord(subname: string, key: string, value: string): Promise<void>

Adds a text record to a subname.

deleteTextRecord(subname: string, key: string): Promise<void>

Deletes a text record.

getTextRecords(fullSubname: string): Promise<Record<string, string>>

Retrieves all text records for a subname.

getTextRecord(fullSubname: string, key: string): Promise<GetRecordResponse>

Retrieves a specific text record.

addDataRecord(fullSubname: string, key: string, data: any): Promise<void>

Adds a data record to a subname.

deleteDataRecord(subname: string, key: string): Promise<void>

Deletes a data record.

getDataRecords(fullSubname: string): Promise<Record<string, any>>

Retrieves all data records for a subname.

getDataRecord(fullSubname: string, key: string): Promise<GetRecordResponse>

Retrieves a specific data record.

License

This project is licensed under the MIT License.

Support

For any issues or feature requests, please open an issue on GitHub.

Contributing

Contributions are welcome! Please read our contributing guidelines before submitting a pull request.

Questions? Join our Builders Group chat

Consider joining the Namespace Builders group chat on Telegram if you have any questions, suggestions, feedback, or anything you want to talk about.