Skip to main content

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

Operations

MethodDescription
lucidCreateTbaCreate TBA for passport NFT
lucidGetTbaGet TBA address

Generated Reference

Overview

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

Available Operations

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

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:
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

ParameterTypeRequiredDescription
requestmodels.CreateTBARequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit: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.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.GetTBAResponse>

Errors

Error TypeStatus CodeContent Type
errors.ErrorResponse400application/json
errors.ErrorResponse500application/json
errors.RaijinLabsLucidAiDefaultError4XX, 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

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:
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

ParameterTypeRequiredDescription
requestoperations.LucidGetTbaRequest:heavy_check_mark:The request object to use for the request.
optionsRequestOptions:heavy_minus_sign:Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit: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.retriesRetryConfig:heavy_minus_sign:Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.GetTBAResponse>

Errors

Error TypeStatus CodeContent Type
errors.ErrorResponse400application/json
errors.ErrorResponse500application/json
errors.RaijinLabsLucidAiDefaultError4XX, 5XX*/*