> ## 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.

# Escrow SDK

> Cross-chain escrow lifecycle — create, release, dispute, and query

# Escrow SDK

Cross-chain escrow lifecycle — create, release, dispute, and query

## Operations

| Method               | Description                          |
| -------------------- | ------------------------------------ |
| `lucidCreateEscrow`  | Create a time-locked escrow          |
| `lucidReleaseEscrow` | Release escrow with verified receipt |
| `lucidDisputeEscrow` | Dispute an escrow                    |
| `lucidGetEscrow`     | Get escrow details                   |

## Generated Reference

### Overview

Cross-chain escrow lifecycle — create, release, dispute, and query

#### Available Operations

* [lucidCreateEscrow](#lucidcreateescrow) - Create a time-locked escrow
* [lucidReleaseEscrow](#lucidreleaseescrow) - Release escrow with verified receipt
* [lucidDisputeEscrow](#luciddisputeescrow) - Dispute an escrow
* [lucidGetEscrow](#lucidgetescrow) - Get escrow details

### lucidCreateEscrow

Create a new time-locked escrow for agent-to-agent transactions on a specific chain. Funds are held until released by receipt verification or timed out.

#### Example Usage

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

const raijinLabsLucidAi = new RaijinLabsLucidAi();

async function run() {
  const result = await raijinLabsLucidAi.escrow.lucidCreateEscrow({
    chainId: "<id>",
    beneficiary: "<value>",
    token: "<value>",
    amount: "398.30",
    duration: 430908,
  });

  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 { escrowLucidCreateEscrow } from "raijin-labs-lucid-ai/funcs/escrowLucidCreateEscrow.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 escrowLucidCreateEscrow(raijinLabsLucidAi, {
    chainId: "<id>",
    beneficiary: "<value>",
    token: "<value>",
    amount: "398.30",
    duration: 430908,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("escrowLucidCreateEscrow failed:", res.error);
  }
}

run();
```

#### Parameters

| Parameter              | Type                                                                                                                            | Required             | Description                                                                                                                                                                    |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [models.CreateEscrowRequest](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/createescrowrequest.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.SuccessResponse](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/successresponse.md)>**

#### Errors

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

### lucidReleaseEscrow

Release escrowed funds to the beneficiary after verifying the associated receipt. Requires a valid receipt hash proving service delivery.

#### Example Usage

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

const raijinLabsLucidAi = new RaijinLabsLucidAi();

async function run() {
  const result = await raijinLabsLucidAi.escrow.lucidReleaseEscrow({
    chainId: "<id>",
    escrowId: "<id>",
    receiptHash: "<value>",
    signature: "<value>",
    signerPubkey: "<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 { escrowLucidReleaseEscrow } from "raijin-labs-lucid-ai/funcs/escrowLucidReleaseEscrow.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 escrowLucidReleaseEscrow(raijinLabsLucidAi, {
    chainId: "<id>",
    escrowId: "<id>",
    receiptHash: "<value>",
    signature: "<value>",
    signerPubkey: "<value>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("escrowLucidReleaseEscrow failed:", res.error);
  }
}

run();
```

#### Parameters

| Parameter              | Type                                                                                                                              | Required             | Description                                                                                                                                                                    |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [models.ReleaseEscrowRequest](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/releaseescrowrequest.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.SuccessResponse](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/successresponse.md)>**

#### Errors

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

### lucidDisputeEscrow

Dispute an active escrow, freezing the funds and initiating the arbitration process. The escrow must be in 'active' status to be disputed.

#### Example Usage

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

const raijinLabsLucidAi = new RaijinLabsLucidAi();

async function run() {
  const result = await raijinLabsLucidAi.escrow.lucidDisputeEscrow({
    chainId: "<id>",
    escrowId: "<id>",
    reason: "<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 { escrowLucidDisputeEscrow } from "raijin-labs-lucid-ai/funcs/escrowLucidDisputeEscrow.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 escrowLucidDisputeEscrow(raijinLabsLucidAi, {
    chainId: "<id>",
    escrowId: "<id>",
    reason: "<value>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("escrowLucidDisputeEscrow failed:", res.error);
  }
}

run();
```

#### Parameters

| Parameter              | Type                                                                                                                              | Required             | Description                                                                                                                                                                    |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [models.DisputeEscrowRequest](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/disputeescrowrequest.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.SuccessResponse](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/successresponse.md)>**

#### Errors

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

### lucidGetEscrow

Retrieve the full details of a specific escrow by chain and escrow ID, including status, parties, amounts, timeout, and associated receipt hashes.

#### Example Usage

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

const raijinLabsLucidAi = new RaijinLabsLucidAi();

async function run() {
  const result = await raijinLabsLucidAi.escrow.lucidGetEscrow({
    chainId: "<id>",
    escrowId: "<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 { escrowLucidGetEscrow } from "raijin-labs-lucid-ai/funcs/escrowLucidGetEscrow.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 escrowLucidGetEscrow(raijinLabsLucidAi, {
    chainId: "<id>",
    escrowId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("escrowLucidGetEscrow failed:", res.error);
  }
}

run();
```

#### Parameters

| Parameter              | Type                                                                                                                                               | Required             | Description                                                                                                                                                                    |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [operations.LucidGetEscrowRequest](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/operations/lucidgetescrowrequest.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.GetEscrowResponse](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/getescrowresponse.md)>**

#### Errors

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