# 交易資訊

### <mark style="color:blue;">交易物件</mark>

以下端點（`POST Transfers` 和 `POST Transaction Details`）使用共用的 交易物件 (Transaction Object) 來回應。以下是**交易物件**的結構：

欄位：

| 欄位                   | 類別                                                                                                     | 說明                                     |
| -------------------- | ------------------------------------------------------------------------------------------------------ | -------------------------------------- |
| fromAddress          | string                                                                                                 | 傳送地址                                   |
| toAddress            | string                                                                                                 | 接收地址                                   |
| layer                | [TransactionLayer](https://docs.akashicpay.com/traditional-chinese/can-kao-zi-liao#transactionlayer)   | 交易層（`L1Transaction` 或 `L2Transaction`） |
| initiatedAt          | string                                                                                                 | ISO8601 格式的日期                          |
| confirmededAt        | string                                                                                                 | 以 ISO8601 格式確認的日期                      |
| amount               | string                                                                                                 | 交易金額（以字串形式，以避免精確度問題）                   |
| coinSymbol           | [NetworkSymbol](https://docs.akashicpay.com/traditional-chinese/can-kao-zi-liao#networksymbol)         | 交易的網路 (L1) (例如 `ETH`)                  |
| status               | [TransactionStatus](https://docs.akashicpay.com/traditional-chinese/can-kao-zi-liao#transactionstatus) | 交易狀態 (`Pending`、`Confirmed`或`Failed`)  |
| txHash               | string                                                                                                 | L1 交易的網路哈希值 (L2 可選擇使用)                 |
| feesPaid             | string                                                                                                 | 在網絡上支付礦工費（L2 可選）                       |
| l2TxnHash            | string                                                                                                 | Akashic 交易哈希值 (L1 和 L2)                |
| tokenSymbol          | [TokenSymbol](https://docs.akashicpay.com/traditional-chinese/can-kao-zi-liao#tokensymbol)             | 代幣交易的代幣符號（可選）                          |
| reason               | string                                                                                                 | 失敗原因 (如果狀態為 `Failed`)                  |
| internalFee          | object                                                                                                 | Akashic 費用詳細資訊（可選）                     |
| internalFee.deposit  | string                                                                                                 | 存款費用（可選）                               |
| internalFee.withdraw | string                                                                                                 | 提款費用（可選）                               |
| identifier           | string                                                                                                 | 存款的使用者識別碼(identifier)（可選）              |

範例：

```json
{
  "fromAddress": "string",
  "toAddress": "string",
  "layer": "string",
  "initiatedAt": "string",
  "confirmededAt": "string",
  "amount": "string",
  "coinSymbol": "string",
  "status": "string",
  "txHash": "string",
  "feesPaid": "string",
  "l2TxnHash": "string",
  "tokenSymbol": "string",
  "reason": "string",
  "internalFee": {
    "deposit": "string",
    "withdraw": "string"
  },
  "identifier": "string"
}
```

### <mark style="color:blue;">取得交易詳細資料</mark>

端點： `POST /getTransactionDetails`

說明： 擷取個別交易的詳細資訊。如果沒有找到所查詢雜湊的交易，則返回 `null`。

請求參數：

| 參數       | 類別     | 需要 | 說明                      |
| -------- | ------ | -- | ----------------------- |
| l2TxHash | string | 是  | 交易的 L2 AkashicChain 哈希值 |

回應： 返回單一交易物件或 `null`。

### <mark style="color:blue;">取得傳輸 (Get Transfers)</mark>

端點： `POST /getTransfers`

說明： 擷取所有或部分交易，可選擇 `layer`、`status`、`startDate`、`endDate` 或 `hideSmallTransactions` 篩選。支援 `page` 和 `limit`。`hideSmallTransactions` 參數排除價值低於 1 美元的交易。

請求參數：

| 參數                    | 類別                                                                                                     | 需要 | 說明                                        |
| --------------------- | ------------------------------------------------------------------------------------------------------ | -- | ----------------------------------------- |
| page                  | number                                                                                                 | 否  | 用於分頁的頁碼                                   |
| limit                 | number                                                                                                 | 否  | 每頁的交易筆數                                   |
| layer                 | [TransactionLayer](https://docs.akashicpay.com/traditional-chinese/can-kao-zi-liao#transactionlayer)   | 否  | 依交易層（`L1Transaction` 或 `L2Transaction`）篩選 |
| status                | [TransactionStatus](https://docs.akashicpay.com/traditional-chinese/can-kao-zi-liao#transactionstatus) | 否  | 依交易狀態篩選 (`Pending`、已`Confirmed`或`Failed`) |
| startDate             | string                                                                                                 | 否  | ISO8601 格式的開始日期                           |
| endDate               | string                                                                                                 | 否  | ISO8601 格式的結束日期                           |
| hideSmallTransactions | boolean                                                                                                | 否  | 不包括價值低於 1 美元的交易                           |
| identifier            | string                                                                                                 | 否  | 依 `identifier` 篩選結果                       |
| referenceId           | string                                                                                                 | 否  | 依 referenceId 篩選結果                        |

> 注意：最小 `limit` 為 10，預設行為為 `hideSmallTransactions` .

回應： 傳回一個交易物件陣列。

```json
[
  {
    "fromAddress": "string",
    "toAddress": "string",
    "layer": "string",
    "initiatedAt": "string",
    "confirmededAt": "string",
    "amount": "string",
    "coinSymbol": "string",
    "status": "string",
    "txHash": "string",
    "feesPaid": "string",
    "l2TxnHash": "string",
    "tokenSymbol": "string",
    "reason": "string",
    "internalFee": {
      "deposit": "string",
      "withdraw": "string"
    },
    "identifier": "string"
  }
]
```
