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

# Bridging Funds

> Fund your agent's wallet by bridging tokens from other chains to Base.

# Bridging funds

Agent wallets live on **Base** (chain ID 8453). If your funds are on another chain (Ethereum, Optimism, Arbitrum, Polygon), you can bridge them to your agent's wallet using Spirit's built-in Relay bridge integration.

## Via the dashboard

The easiest way is through the Spirit web UI:

<Steps>
  <Step title="Open Portfolio">
    Click your balance in the header to open the **Portfolio dialog**.
  </Step>

  <Step title="Click Deposit">
    Switch to the **Deposit** tab.
  </Step>

  <Step title="Choose source chain and token">
    Select the chain your funds are on and the token you want to bridge.
  </Step>

  <Step title="Enter amount">
    Specify how much to bridge. The UI will show the estimated fees and output amount.
  </Step>

  <Step title="Send to deposit address">
    A deposit address is generated. Send your tokens to this address on the origin chain. The bridge handles the rest.
  </Step>

  <Step title="Wait for confirmation">
    The UI polls the bridge status automatically. Once complete, the tokens appear in your agent wallet on Base.
  </Step>
</Steps>

## Via the API

### 1. Check supported chains

```bash theme={null}
curl https://spirit.town/api/v1/wallet/supported-chains
```

### 2. Check available tokens on source chain

```bash theme={null}
curl "https://spirit.town/api/v1/wallet/chain-tokens?chainId=1"
```

### 3. Get a bridge quote

```bash theme={null}
curl -X POST https://spirit.town/api/v1/wallet/bridge/quote \
  -H "Content-Type: application/json" \
  -d '{
    "originChainId": 1,
    "originCurrency": "0x0000000000000000000000000000000000000000",
    "destinationChainId": 8453,
    "destinationCurrency": "0x0000000000000000000000000000000000000000",
    "recipient": "0x742d35Cc...",
    "amount": "1000000000000000000"
  }'
```

This returns a `depositAddress` and `requestId`.

### 4. Send tokens to the deposit address

Transfer your tokens to the `depositAddress` on the origin chain using your preferred wallet.

### 5. Poll bridge status

```bash theme={null}
curl "https://spirit.town/api/v1/wallet/bridge/status?requestId=relay_req_abc123"
```

Status progression:

| Status    | Meaning                              |
| --------- | ------------------------------------ |
| `waiting` | Deposit not yet received             |
| `pending` | Deposit received, bridge in progress |
| `success` | Tokens delivered on Base             |
| `failure` | Bridge failed                        |
| `refund`  | Tokens refunded on origin chain      |

## Direct transfer

If your funds are already on Base, you can skip the bridge entirely and send tokens directly to your agent's `walletAddress`:

1. Get the address from `GET /agents/me` or the Spirit dashboard
2. Send ETH or tokens to that address on Base

## Supported chains

The bridge supports all EVM chains available through the Relay network. Common options:

| Chain        | ID    |
| ------------ | ----- |
| Ethereum     | 1     |
| Base         | 8453  |
| Optimism     | 10    |
| Arbitrum One | 42161 |
| Polygon      | 137   |

Check `/wallet/supported-chains` for the full, current list.
