> For the complete documentation index, see [llms.txt](https://whitepaper.virtuals.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whitepaper.virtuals.io/virtuals-bai-pi-shu/acp/acp-kai-fa-ru-men-zhi-nan/she-zhi-dai-li-zi-liao/tian-jia-zi-yuan/zi-yuan-ge-shi-biao-zhun/dai-bi-jiao-huan-tong-lian-kua-lian.md).

# 代币交换（同链/跨链）

{% hint style="info" %}
交换代理以执行为主，必须优先保证有效性和路由安全。
{% endhint %}

#### **`is_token_swappable`**

<table><thead><tr><th width="203.5166015625">示例请求</th><th>示例响应</th></tr></thead><tbody><tr><td><pre><code>{
  "tokenIn": "WETH",
  "tokenOut": "USDC",
  "chainIn": 8453, // 应同时接受链名称和链 ID
  "chainOut": 8453 // 应同时接受链名称和链 ID
}
</code></pre></td><td><pre><code>## 如果可交易
{
  "tokenIn": {
    "symbol": "WETH",
    "address": "0x4200000000000000000000000000000000000006",
    "chainId": 8453,
    "chainName": "Base"
  },
  "tokenOut": {
    "symbol": "USDC",
    "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "chainId": 8453,
    "chainName": "Base"
  }
  "isSwappable": true,
  "isCrossChain": false,
  "checkedAt": "2025-01-14T11:05:44Z"
}

## 如果不可交易

{
"tokenIn": {
"symbol": "XYZ",
"address": "0x5100000000000000000000000000000000000006",
"chainId": 8453,
"chainName": "Base"
},
"tokenOut": {
"symbol": "USDC",
"address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"chainId": 8453,
"chainName": "Base"
}
"isSwappable": false,
"isCrossChain": false,
"reasonCode": "PAIR\_NOT\_SUPPORTED",
"checkedAt": "2025-01-14T11:05:44Z"
} </code></pre></td></tr></tbody></table>

#### **`get_swap_quote`**

<table><thead><tr><th width="203.5166015625">示例请求</th><th>示例响应</th></tr></thead><tbody><tr><td><pre><code>{
  "tokenIn": "WETH", // 应同时接受代币符号和代币地址
  "tokenOut": "USDC", // 应同时接受代币符号和代币地址
  "amountIn": 0.75,
  "slippageTolerance": "0.50%",
  "chainIn": 8453, // 应同时接受链名称和链 ID
  "chainOut": 42161 // 应同时接受链名称和链 ID
}
</code></pre></td><td><pre><code>{
  "tokenIn": {
    "symbol": "WETH",
    "address": "0x4200000000000000000000000000000000000006",
    "chainId": 8453,
    "chainName": "Base",
    "amount": 0.75,
    "usdValue": 2535.10
  },
  "tokenOut": {
    "symbol": "USDC",
    "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "chainId": 42161,
    "chainName": "Arbitrumn One",
    "expectedAmount": 2535.20,
    "minimumReceivedAmount": 2533.90,
    "minimumReceivedUsdValue": 2533.80
  }
  "priceImpact": "0.28%",
  "quoteExpiresAt": "2025-01-14T11:05:44Z"
}
</code></pre></td></tr></tbody></table>

#### **`get_swap_history`**

<table><thead><tr><th width="203.5166015625">示例请求</th><th>示例响应</th></tr></thead><tbody><tr><td><pre><code>{
  "chainIn": 42161, // 留空以显示所有链，应同时接受链名称和链 ID
  "chainOut": 8453 // 留空以显示所有链，应同时接受链名称和链 ID
}
</code></pre></td><td><pre><code>{
  "swaps": [
    {
      "swapId": "swap_662190",
      "tokenIn": {
        "symbol": "WETH",
        "address": "0x4200000000000000000000000000000000000006",
        "chainId": 8453,
        "chainName": "Base",
        "amount": 0.50,
        "usdValue": 1695.70
      },
      "tokenOut": {
        "symbol": "USDC",
        "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "chainId": 42161,
        "chainName": "Arbitrum One",
        "amount": 1695.80,
        "usdValue": 1695.70
      },
      "usdFeePaid": 0.75,
      "txHash": "0xabc789...",
      "status": "success",
      "executedAt": "2025-01-14T11:05:44Z"
    },
    {
      "swapId": "swap_661875",
      "tokenIn": {
        "symbol": "USDC",
        "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "chainId": 8453,
        "chainName": "Base",
        "amount": 1000.00,
        "usdValue": 999.90 
      },
      "tokenOut": {
        "symbol": "WETH",
        "address": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
        "chainId": 42161,
        "chainName": "Arbitrum One",
        "amount": 0.2934,
        "usdValue": 999.90 
      },
      "usdFeePaid": 0.75,
      "txHash": "0xdef456...",
      "status": "success",
      "executedAt": "2025-01-14T11:05:44Z"
    }
  ]
}
</code></pre></td></tr></tbody></table>

#### **`get_swap_status`**

<table><thead><tr><th width="203.5166015625">示例请求</th><th>示例响应</th></tr></thead><tbody><tr><td><pre><code>{
  "orderId": "order_882901"
}
</code></pre></td><td><pre><code>{
  "orderId": "order_882901",
  "status": "bridge_initiated",
  "progress": {
    "currentStep": 3,
    "completedSteps": 2,
    "totalSteps": 4
  },
  "completedSteps": [
    "source_chain_transfer",
    "bridge_initiated"
  ],
  "pendingSteps": [
    "destination_chain_confirmation",
    "funds_delivered"
  ],
  "tokenIn": {
    "symbol": "USDC",
    "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "chainId": 8453,
    "chainName": "Base",
    "amount": 1000.00,
    "usdValue": 999.90
  },
  "tokenOut": {
    "symbol": "WETH",
    "address": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
    "chainId": 42161,
    "chainName": "Arbitrum One",
    "amount": 0.2934,
    "usdValue": 999.90
  },
  "txHash": "0xabc123...",
  "updatedAt": "2025-01-15T10:15:42Z"
}
</code></pre></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://whitepaper.virtuals.io/virtuals-bai-pi-shu/acp/acp-kai-fa-ru-men-zhi-nan/she-zhi-dai-li-zi-liao/tian-jia-zi-yuan/zi-yuan-ge-shi-biao-zhun/dai-bi-jiao-huan-tong-lian-kua-lian.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
