ENSRainbow Typescript Client SDK
ENSRainbow provides an official TypeScript client SDK to simplify integrations with the API. You can find the SDK package at @ensnode/ensrainbow-sdk.
The SDK provides a simple, type-safe interface for all API endpoints and handles proper formatting of labelhashes and error handling.
The easiest way to use the SDK:
pnpm add @ensnode/ensrainbow-sdk
import { EnsRainbowApiClient } from '@ensnode/ensrainbow-sdk';
const client = new EnsRainbowApiClient({ baseUrl: 'https://api.ensrainbow.io', labelSet: { labelSetId: 'subgraph', labelSetVersion: 0 }});
const res = await client.healLabel('0xaf2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc');
if (res.status === 'success') { console.log(res.label);} else { console.error(res.error);}
ENSRainbow SDK
TypeScript library for interacting with the ENSRainbow API.
Learn more about ENSRainbow and ENSNode.
API Reference
Heal Label
Attempt to heal a labelhash to its original label.
const response = await client.heal( "0xaf2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc");
console.log(response);
// Output:// {// status: "success",// label: "vitalik"// }
Label Count
Get Count of Healable Labels
const response = await client.count();
console.log(response);
// {// "status": "success",// "count": 133856894,// "timestamp": "2024-01-30T11:18:56Z"// }
Health Check
Simple verification that the service is running, either in your local setup or for the provided hosted instance
const response = await client.health();
console.log(response);
// {// "status": "ok",// }
Response Types & Error Handling
Each API endpoint has a designated response type that includes a successful and an erroneous response to account for possible mishaps that could occur during a request.
Below is an example of a failed heal
operation, that shows the resulting error returned by the SDK
const notFoundResponse = await client.heal( "0xf64dc17ae2e2b9b16dbcb8cb05f35a2e6080a5ff1dc53ac0bc48f0e79111f264");
console.log(notFoundResponse);
// Output:// {// status: "error",// error: "Label not found",// errorCode: 404// }
Contact Us
Visit our website to get in contact.
License
Licensed under the MIT License, Copyright © 2025-present NameHash Labs.
See LICENSE for more information.