Text records are key-value pairs that can be used to store any arbitrary data associated with a name. Think of this as a user’s digital backpack utilized for the storage of preferences, public details, and more.
These methods allow you to manage text records for a given ENS subname. You can fetch, add, update, or delete individual records.

1. addTextRecord

Adds or updates a text record for the specified subname.

Usage Example

client.addTextRecord({
  subname: "ns.myensname.eth",
  key: "description",
  value: "HODL ENS!",
});
  • subname: The full ENS subname.
  • key: The key for the text record (e.g., "description").
  • value: The value to associate with the key.

2. deleteTextRecord

Deletes a text record from the specified subname.

Usage Example

client.deleteTextRecord({ subname: "ns.myensname.eth", key: "description" });
  • key: The key of the text record to delete.
  • subname: The full ENS subname.

3. getTextRecords

Retrieves all text records associated with the specified subname.

Usage Example

client.getTextRecords("ns.myensname.eth");
Returns a Record<string, string> mapping each text record key to its value.

4. getTextRecord

Retrieves a specific text record from a subname by key.

Usage Example

const response = await client.getTextRecord("ns.myensname.eth", "description");
const description = response.record;

Return Type

export interface GetRecordResponse {
  record: string;
}
  • record: The value associated with the requested key.