> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lucid.foundation/llms.txt
> Use this file to discover all available pages before exploring further.

# TBA SDK

> ERC-6551 Token Bound Accounts — create and query agent wallets

# TBA SDK

ERC-6551 Token Bound Accounts — create and query agent wallets

## Operations

| Method           | Description                 |
| ---------------- | --------------------------- |
| `lucidCreateTba` | Create TBA for passport NFT |
| `lucidGetTba`    | Get TBA address             |

## Generated Reference

### Overview

ERC-6551 Token Bound Accounts — create and query agent wallets

#### Available Operations

* [lucidCreateTba](#lucidcreatetba) - Create TBA for passport NFT
* [lucidGetTba](#lucidgettba) - Get TBA address

### lucidCreateTba

Create an ERC-6551 Token Bound Account for a passport NFT on a specific EVM chain. The TBA enables the AI asset to hold tokens and interact with smart contracts autonomously.

#### Example Usage

```typescript theme={null}
import { RaijinLabsLucidAi } from "raijin-labs-lucid-ai";

const raijinLabsLucidAi = new RaijinLabsLucidAi();

async function run() {
  const result = await raijinLabsLucidAi.tba.lucidCreateTba({
    chainId: "<id>",
    tokenContract: "<value>",
    tokenId: "<id>",
  });

  console.log(result);
}

run();
```

#### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { tbaLucidCreateTBA } from "raijin-labs-lucid-ai/funcs/tbaLucidCreateTBA.js";

// Use `RaijinLabsLucidAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raijinLabsLucidAi = new RaijinLabsLucidAiCore();

async function run() {
  const res = await tbaLucidCreateTBA(raijinLabsLucidAi, {
    chainId: "<id>",
    tokenContract: "<value>",
    tokenId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("tbaLucidCreateTBA failed:", res.error);
  }
}

run();
```

#### Parameters

| Parameter              | Type                                                                                                                      | Required             | Description                                                                                                                                                                    |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [models.CreateTBARequest](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/createtbarequest.md) | :heavy\_check\_mark: | The request object to use for the request.                                                                                                                                     |
| `options`              | RequestOptions                                                                                                            | :heavy\_minus\_sign: | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                   | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`      | [RetryConfig](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/lib/utils/retryconfig.md)               | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

#### Response

**Promise\<[models.GetTBAResponse](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/gettbaresponse.md)>**

#### Errors

| Error Type                           | Status Code | Content Type     |
| ------------------------------------ | ----------- | ---------------- |
| errors.ErrorResponse                 | 400         | application/json |
| errors.ErrorResponse                 | 500         | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX    | \*/\*            |

### lucidGetTba

Retrieve the Token Bound Account address for an NFT by chain, token ID, and contract address. Returns the computed TBA address and deployment status.

#### Example Usage

```typescript theme={null}
import { RaijinLabsLucidAi } from "raijin-labs-lucid-ai";

const raijinLabsLucidAi = new RaijinLabsLucidAi();

async function run() {
  const result = await raijinLabsLucidAi.tba.lucidGetTba({
    chainId: "<id>",
    tokenId: "<id>",
    tokenContract: "<value>",
  });

  console.log(result);
}

run();
```

#### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { tbaLucidGetTBA } from "raijin-labs-lucid-ai/funcs/tbaLucidGetTBA.js";

// Use `RaijinLabsLucidAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raijinLabsLucidAi = new RaijinLabsLucidAiCore();

async function run() {
  const res = await tbaLucidGetTBA(raijinLabsLucidAi, {
    chainId: "<id>",
    tokenId: "<id>",
    tokenContract: "<value>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("tbaLucidGetTBA failed:", res.error);
  }
}

run();
```

#### Parameters

| Parameter              | Type                                                                                                                                         | Required             | Description                                                                                                                                                                    |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [operations.LucidGetTbaRequest](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/operations/lucidgettbarequest.md) | :heavy\_check\_mark: | The request object to use for the request.                                                                                                                                     |
| `options`              | RequestOptions                                                                                                                               | :heavy\_minus\_sign: | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                      | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`      | [RetryConfig](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/lib/utils/retryconfig.md)                                  | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

#### Response

**Promise\<[models.GetTBAResponse](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/gettbaresponse.md)>**

#### Errors

| Error Type                           | Status Code | Content Type     |
| ------------------------------------ | ----------- | ---------------- |
| errors.ErrorResponse                 | 400         | application/json |
| errors.ErrorResponse                 | 500         | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX    | \*/\*            |
