> For the complete documentation index, see [llms.txt](https://docs.metanames.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.metanames.app/developers/records.md).

# Records

A domain record has the following fields:

* `class`: The class of the record, chosen from a predefined list of possibilities.
* `data`: The data associated with the record, which can be a string or a buffer, depending on the record class.

#### Available Record Classes

The following classes are available for domain records:

* Bio
* Discord
* Twitter
* Uri
* Wallet
* Avatar

### Minting a Domain Record

Minting a domain record involves creating a new record associated with a domain. You need to provide the `class` and `data` fields for the new record. Here's how you can use the `mint` function to achieve this:

```javascript
const { transactionHash, fetchResult } = await domain.getRecordRepository(metaNamesSdk).create({
  class: RecordClassEnum.Wallet,
  data: 'data'
});
console.log(`Transaction hash: ${transactionHash}`);
const result = await fetchResult;
console.log(`Domain record mint submitted: ${result}`);
```

Replace `'RecordClassEnum.Wallet'` with the desired record class and `'data'` with the appropriate data for the record.

### Updating a Domain Record

To update an existing domain record, you can use the `update` function. Here's how you can use the `update` function:

```javascript
const { transactionHash, fetchResult } = await domain.getRecordRepository(metaNamesSdk).update({
  class: RecordClassEnum.Wallet,
  data: 'newData'
});
console.log(`Transaction hash: ${transactionHash}`);
const result = await fetchResult;
console.log(`Domain record update submitted: ${result}`);
```

Replace `'RecordClassEnum.Wallet'` with the class of the record you want to update and `'newData'` with the updated data for the record.

### Deleting a Domain Record

Deleting an existing domain record can be achieved using the `delete` function. Here's how you can use the `delete` function:

```javascript
const { transactionHash, fetchResult } = await domain.getRecordRepository(metaNamesSdk).delete({
  class: RecordClassEnum.Wallet
});
console.log(`Transaction hash: ${transactionHash}`);
const result = await fetchResult;
console.log(`Domain record delete submitted: ${result}`);
```

Replace `'RecordClassEnum.Wallet'` with the class of the record you want to delete.

### Example Usage

Here's an example of how you can use these functionalities together:

```javascript
// Mint a new domain record
const { transactionHash: mintTransactionHash, fetchResult: mintFetchResult } = await domain.getRecordRepository(metaNamesSdk).mint({
  class: RecordClassEnum.Uri,
  data: 'website'
});
console.log(`Transaction hash: ${mintTransactionHash}`);
const mintResult = await mintFetchResult;
console.log(`Domain record mint submitted: ${mintResult}`);

// Update the existing domain record
const { transactionHash: updateTransactionHash, fetchResult: updateFetchResult } = await domain.getRecordRepository(metaNamesSdk).update({
  class: RecordClassEnum.Uri,
  data: 'new-website'
});
console.log(`Transaction hash: ${updateTransactionHash}`);
const updateResult = await updateFetchResult;
console.log(`Domain record update submitted: ${updateResult}`);

// Delete the existing domain record
const { transactionHash: deleteTransactionHash, fetchResult: deleteFetchResult } = await domain.getRecordRepository(metaNamesSdk).delete({
  class: RecordClassEnum.Uri
});
console.log(`Transaction hash: ${deleteTransactionHash}`);
const deleteResult = await deleteFetchResult;
console.log(`Domain record delete submitted: ${deleteResult}`);
```

Replace `'RecordClassEnum.Uri'`, `'website'`, and `'new-website'` with your actual values.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.metanames.app/developers/records.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
