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

# API Reference

> Type definitions and data structures for the Metalayer SDK

# Core Types

Complex data structures used throughout the Metalayer SDK for transaction execution, order tracking, and cross-chain operations.

## Chain

Comprehensive blockchain network information including configuration and metadata.

| Property          | Type                                    | Description                                                              |
| ----------------- | --------------------------------------- | ------------------------------------------------------------------------ |
| `identifier`      | **[ChainIdentifier](#chainidentifier)** | Unique identifier for the blockchain network                             |
| `name`            | `string`                                | Human-readable name of the blockchain (e.g., "Ethereum", "Arbitrum One") |
| `isTestnet`       | `boolean`                               | Whether this is a testnet chain used for development and testing         |
| `imageUrl`        | `string`                                | URL to the chain's logo or icon image                                    |
| `parentChain`     | **[ChainIdentifier](#chainidentifier)** | Parent chain identifier with both ID and architecture                    |
| `stack`           | `RollupStack`                           | Stack used by this chain (Nitro, ZkSync, Optimism)                       |
| `nativeCurrency`  | `NativeCurrency`                        | Native currency information for this chain                               |
| `defaultRpc`      | `ChainRpc`                              | Default RPC for this chain                                               |
| `alternativeRpcs` | `ChainRpc[]`                            | Alternative RPCs for this chain                                          |
| `blockExplorer`   | `ChainBlockExplorer`                    | Block explorer information for this chain                                |
| `contracts`       | `Record<string, ChainContract>`         | Known deployed contracts on this chain                                   |
| `lastUpdatedAt`   | `Date`                                  | Timestamp for when this chain was last updated                           |

## ChainIdentifier

Minimal chain identifier containing ID and architecture information.

| Property       | Type                                        | Description                                            |
| -------------- | ------------------------------------------- | ------------------------------------------------------ |
| `id`           | `number`                                    | Unique numerical identifier for the blockchain network |
| `architecture` | **[ChainArchitecture](#chainarchitecture)** | Blockchain architecture (Ethereum, Solana)             |

## ExecutionStep

A transaction execution step containing the specific action data for EVM transactions, EIP-712 signatures, or Solana transactions.

| Property | Type                                            | Description                                          |
| -------- | ----------------------------------------------- | ---------------------------------------------------- |
| `action` | **[ExecutionStepAction](#executionstepaction)** | Union type containing the specific action to execute |

### ExecutionStepAction

The `action` property is a union type with `case` and `value` properties:

| Property | Type                                                                                                                          | Description                                           |
| -------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| `case`   | `"transactionRequest"` \| `"eip712Data"` \| `"solanaTransaction"`                                                             | Discriminator indicating which type of action this is |
| `value`  | **[TransactionRequest](#transactionrequest)** \| **[EIP712Data](#eip712data)** \| **[SolanaTransaction](#solanatransaction)** | The actual action data based on the case              |

### Action Types

| Case                   | Value Type                                    | Description                                 |
| ---------------------- | --------------------------------------------- | ------------------------------------------- |
| `"transactionRequest"` | **[TransactionRequest](#transactionrequest)** | Standard EVM transactions                   |
| `"eip712Data"`         | **[EIP712Data](#eip712data)**                 | EIP-712 typed data for gasless transactions |
| `"solanaTransaction"`  | **[SolanaTransaction](#solanatransaction)**   | Solana blockchain transactions              |

```typescript theme={null}
// Example: Processing ExecutionStep
for (const step of quote.steps) {
  switch (step.action.case) {
    case 'transactionRequest':
      // Handle EVM transaction
      const txRequest = step.action.value;
      break;
    case 'eip712Data':
      // Handle EIP-712 signature
      const typedData = step.action.value;
      break;
    case 'solanaTransaction':
      // Handle Solana transaction
      const solanaTransaction = step.action.value;
      break;
  }
}
```

## TransactionRequest

Standard EVM transaction request for on-chain operations.

| Property  | Type              | Description                                                       |
| --------- | ----------------- | ----------------------------------------------------------------- |
| `to`      | `string`          | Target contract address                                           |
| `data`    | `string`          | Encoded function call data                                        |
| `value`   | `string`          | ETH value in wei                                                  |
| `chainId` | `number`          | Execution chain ID                                                |
| `type`    | `TransactionType` | Transaction type (`ERC20_APPROVAL`, `CONTRACT_WRITE`, `TRANSFER`) |

## EIP712Data

EIP-712 typed data structure for gasless transactions and meta-transactions.

| Property      | Type                                   | Description                                             |
| ------------- | -------------------------------------- | ------------------------------------------------------- |
| `account`     | `string`                               | Account address that will sign this typed data          |
| `domain`      | `EIP712Domain`                         | Domain separator information for signature verification |
| `types`       | `Record<string, EIP712TypeDefinition>` | Type definitions for structured data                    |
| `primaryType` | `string`                               | Primary type name being signed                          |
| `message`     | `object`                               | The structured data to be signed                        |

## SolanaTransaction

Solana blockchain transaction containing multiple instructions.

| Property       | Type                               | Description                                |
| -------------- | ---------------------------------- | ------------------------------------------ |
| `instructions` | **[Instruction](#instruction)\[]** | List of instructions to execute atomically |

### Instruction

Individual instruction within a Solana transaction.

| Property    | Type                               | Description                                      |
| ----------- | ---------------------------------- | ------------------------------------------------ |
| `accounts`  | **[AccountMeta](#accountmeta)\[]** | Accounts involved with their access permissions  |
| `programId` | `string`                           | Public key of the Solana program to invoke       |
| `data`      | `string`                           | Encoded instruction data specific to the program |

### AccountMeta

Account metadata specifying permissions for Solana transactions.

| Property     | Type      | Description                                    |
| ------------ | --------- | ---------------------------------------------- |
| `pubkey`     | `string`  | Public key of the account                      |
| `isSigner`   | `boolean` | Whether this account must sign the transaction |
| `isWritable` | `boolean` | Whether this account's data may be modified    |

## Token

Token information including metadata and chain-specific details.

| Property   | Type     | Description                                    |
| ---------- | -------- | ---------------------------------------------- |
| `address`  | `string` | Contract address of the token                  |
| `symbol`   | `string` | Token symbol (e.g., "ETH", "USDC")             |
| `name`     | `string` | Full token name (e.g., "Ethereum", "USD Coin") |
| `decimals` | `number` | Number of decimal places for the token         |
| `chainId`  | `number` | Chain ID where this token exists               |
| `imageUrl` | `string` | URL to the token's logo or icon                |

## TokenList

Container for a list of tokens on a specific chain.

| Property | Type                   | Description                            |
| -------- | ---------------------- | -------------------------------------- |
| `tokens` | **[Token](#token)\[]** | Array of tokens available on the chain |

## Quote

Bridge quote containing execution steps and fee information.

| Property                | Type                                   | Description                               |
| ----------------------- | -------------------------------------- | ----------------------------------------- |
| `quoteId`               | `string`                               | Unique identifier for tracking            |
| `steps`                 | **[ExecutionStep](#executionstep)\[]** | Transaction steps to execute              |
| `amountOut`             | `bigint`                               | Expected output amount                    |
| `totalFees`             | `bigint`                               | Total fees in source token                |
| `provider`              | **[QuoteProvider](#quoteprovider)**    | Bridge provider                           |
| `estimatedFillTimeSecs` | `number`                               | Completion time (seconds)                 |
| `deadline`              | `Date`                                 | Quote expiration time                     |
| `fees`                  | `TokenFee[]`                           | Detailed fee breakdown by token and chain |

## Order

A cross-chain bridge order that tracks transaction status and details.

| Property                     | Type                                    | Description                                                 |
| ---------------------------- | --------------------------------------- | ----------------------------------------------------------- |
| `quoteId`                    | `string`                                | Unique identifier linking this order to the original quote  |
| `provider`                   | **[QuoteProvider](#quoteprovider)**     | Provider that processed this order                          |
| `status`                     | **[OrderStatus](#orderstatus)**         | Current status of the cross-chain order                     |
| `sourceTransactionHash`      | `string`                                | Transaction hash on the source chain                        |
| `destinationTransactionHash` | `string`                                | Transaction hash on the destination chain                   |
| `sourceChain`                | **[ChainIdentifier](#chainidentifier)** | Source chain with id and architecture                       |
| `destinationChain`           | **[ChainIdentifier](#chainidentifier)** | Destination chain with id and architecture                  |
| `senderAddress`              | `string`                                | Address that initiated the order                            |
| `receiverAddress`            | `string`                                | Address that will receive the tokens                        |
| `amountIn`                   | `string`                                | Input amount sent in source token's smallest unit           |
| `amountOut`                  | `string`                                | Output amount received in destination token's smallest unit |
| `sourceTokenAddress`         | `string`                                | Contract address of the source token                        |
| `destinationTokenAddress`    | `string`                                | Contract address of the destination token                   |
| `timestamp`                  | `Date`                                  | Block timestamp of the source transaction                   |
| `lastUpdated`                | `Date`                                  | Block timestamp of the last update to the order             |
| `nextSteps`                  | **[ExecutionStep](#executionstep)\[]**  | Required user actions to complete the order                 |
| `deadline`                   | `Date \| undefined`                     | Expiration time when the order becomes eligible for refund  |

# Enums

Enumeration types that define specific sets of values used across the SDK.

## ChainArchitecture

Blockchain architecture types supported by the Metalayer SDK.

| Architecture  | Description                        |
| ------------- | ---------------------------------- |
| `UNSPECIFIED` | Unspecified architecture           |
| `ETHEREUM`    | Ethereum and EVM-compatible chains |
| `SOLANA`      | Solana blockchain                  |

## QuoteProvider

Bridge providers that can process cross-chain transactions.

| Provider                | Description                  |
| ----------------------- | ---------------------------- |
| `UNSPECIFIED`           | Unspecified provider         |
| `NITRO_BRIDGE`          | Arbitrum Nitro native bridge |
| `BEDROCK_BRIDGE`        | OP Stack native bridge       |
| `ZKSYNC_BRIDGE`         | zkSync native bridge         |
| `ACROSS`                | Across protocol bridge       |
| `ECO`                   | Eco protocol bridge          |
| `RELAY`                 | Relay protocol bridge        |
| `METATOKEN`             | MetaToken bridge             |
| `LAYER_ZERO_OFT`        | LayerZero OFT bridge         |
| `HYPERLANE_WARP_ROUTES` | Hyperlane Warp Routes bridge |

## OrderStatus

Order status values indicating the current state of a cross-chain transaction.

| Status              | Description                                                 |
| ------------------- | ----------------------------------------------------------- |
| `PENDING`           | Order is in progress, waiting for completion                |
| `WAITING_TO_PROVE`  | Withdrawal is waiting for proof submission (native bridges) |
| `WITHDRAWAL_PROVEN` | Withdrawal proof has been submitted                         |
| `FULFILLED`         | Order completed successfully                                |
| `REFUNDED`          | Order was refunded to the source address                    |
| `FAILED`            | Order failed and cannot be completed                        |
| `READY_TO_REFUND`   | Order deadline passed, eligible for refund                  |

```typescript theme={null}
import { OrderStatus } from '@metalayer/sdk';

const { order } = await client.getOrder({
  sourceTransactionHash: '0xTxHash',
  sourceChainId: 1,
});

// Check specific status
if (order.status === OrderStatus.FULFILLED) {
  console.log('Bridge transaction completed!');
}
```
