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

# 交易状态跟踪

> 使用 LI.FI API 检查跨链交易状态的完整指南

# 交易状态

本指南解释了如何使用 LI.FI 提供的 `/status` 端点检查跨链和交换交易的状态。

***

## 查询状态端点

要获取转账的状态，可以使用以下任一方式查询 `/status` 端点：

1. 发送交易哈希
2. 接收交易哈希
3. transactionId

<Note>
  只需要上述值之一，并需要在 `txHash` 参数中传递。
</Note>

### 必需：

* `txHash`

### 可选：

* `fromChain`：加快请求速度（推荐）
* `toChain`
* `bridge`

对于交换交易，将 `fromChain` 和 `toChain` 设置为相同的值。可以省略 `bridge` 参数。

```typescript theme={"system"}
const getStatus = async (txHash: string) => {
  const result = await axios.get('https://li.quest/v1/status', {
    params: { txHash },
  });
  return result.data;
};
```

## 示例响应

```json theme={"system"}
{
  "transactionId": "0x0959ee0fbb37a868752d7ae40b25dbfa3b7d72f499fa8386fd5f4105b18b62bd",
  "sending": {
    "txHash": "0x5862726dbc6643c6a34b3496bb15e91f11771f6756ccf83826304846bbc93c0v",
    "txLink": "https://etherscan.io/tx/0x5862726dbc6643c6a34b3496bb15e91f11771f6756ccf83826304846bbc93c0v",
    "amount": "60000000000000000000000",
    "token": {
      "symbol": "ORDS",
      "priceUSD": "0.012027801612559667"
    },
    "gasPrice": "23079962248",
    "gasUsed": "231727",
    "gasAmountUSD": "14.0296",
    "amountUSD": "721.6681",
    "includedSteps": [
      {
        "tool": "feeCollection",
        "fromAmount": "60000000000000000000000",
        "toAmount": "59820000000000000000000"
      },
      {
        "tool": "1inch",
        "fromAmount": "59820000000000000000000",
        "toAmount": "275101169247651913"
      }
    ]
  },
  "receiving": {
    "txHash": "0x2862726dbc6643c6a34b3496bb15e91f11771f6756ccf83826604846bbc93c0v",
    "amount": "275101169247651913",
    "token": {
      "symbol": "ETH",
      "priceUSD": "2623.22"
    },
    "gasAmountUSD": "14.0296",
    "amountUSD": "721.6509"
  },
  "lifiExplorerLink": "https://scan.li.fi/tx/0x5862726dbc6643c6a34b3496bb15e91f11771f6756ccf83826304846bbc93c0v",
  "fromAddress": "0x14a980237fa9797fa27c5152c496cab65e36da4f",
  "toAddress": "0x14a980237fa9797fa27c5152c496cab65e36da4f",
  "tool": "1inch",
  "status": "DONE",
  "substatus": "COMPLETED",
  "substatusMessage": "The transfer is complete.",
  "metadata": {
    "integrator": "example_integrator"
  }
}
```

***

## 状态值

| 状态          | 描述           |
| ----------- | ------------ |
| `NOT_FOUND` | 交易不存在或尚未挖矿。  |
| `INVALID`   | 哈希未与请求的工具绑定。 |
| `PENDING`   | 桥接仍在进行中。     |
| `DONE`      | 交易成功完成。      |
| `FAILED`    | 桥接过程失败。      |

***

## 子状态定义

### PENDING

* `WAIT_SOURCE_CONFIRMATIONS`：等待源链确认
* `WAIT_DESTINATION_TRANSACTION`：等待目标交易
* `BRIDGE_NOT_AVAILABLE`：桥接 API 不可用
* `CHAIN_NOT_AVAILABLE`：源/目标链 RPC 不可用
* `REFUND_IN_PROGRESS`：退款进行中（如果支持）
* `UNKNOWN_ERROR`：状态不确定

### DONE

* `COMPLETED`：转账成功
* `PARTIAL`：仅部分转账完成（常见于 across、hop、stargate、amarok）
* `REFUNDED`：代币已退款

### FAILED

* `NOT_PROCESSABLE_REFUND_NEEDED`：无法完成，需要退款
* `OUT_OF_GAS`：交易 gas 不足
* `SLIPPAGE_EXCEEDED`：接收金额过低
* `INSUFFICIENT_ALLOWANCE`：授权额度不足
* `INSUFFICIENT_BALANCE`：余额不足
* `EXPIRED`：交易已过期
* `UNKNOWN_ERROR`：未知或无效状态
* `REFUNDED`：代币已退款
