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

# 轉帳查詢

> 鏈上轉帳資料的查詢範例

**Transfers** Cube 包含鏈上代幣轉賬事件 — 即代幣從一個錢包轉到另一個錢包的每一次記錄。可用於跟蹤錢包活動、監控巨鯨動向、分析代幣流向以及識別交易所充提。

<Note>
  以下示例均使用 `network: sol`（Solana）。其他支援的鏈可改為 `eth`、`bsc` 或 `polygon`。
</Note>

***

## 如何獲取最新的轉賬？

獲取 Solana 上最近 10 筆代幣轉賬，包含傳送方、接收方、數量與 USD 價值。

```graphql theme={null}
query {
  Solana {
    Transfers(
      limit: {count: 10}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time }
      Transaction { Hash }
      Transfer {
        Currency { MintAddress }
        Sender { Address }
        Receiver { Address }
        Amount
        AmountInUSD
      }
    }
  }
}
```

<Tip>
  [在 GraphQL IDE 中開啟](https://ide.chainstream.io) — 將上方查詢貼上進去即可互動執行，並享受自動補全與 schema 瀏覽。
</Tip>

<AccordionGroup>
  <Accordion title="關鍵欄位">
    | 欄位                              | 說明              |
    | :------------------------------ | :-------------- |
    | `Block.Time`                    | 區塊時間戳（ISO 8601） |
    | `Transaction.Hash`              | 鏈上交易雜湊          |
    | `Transfer.Currency.MintAddress` | 被轉賬的代幣地址        |
    | `Transfer.Sender.Address`       | 傳送代幣的錢包         |
    | `Transfer.Receiver.Address`     | 接收代幣的錢包         |
    | `Transfer.Amount`               | 轉賬代幣數量          |
    | `Transfer.AmountInUSD`          | 發生時的轉賬 USD 價值   |
  </Accordion>

  <Accordion title="自定義提示">
    * **按代幣過濾**：新增 `tokenAddress: {is: "TOKEN_ADDRESS"}` 僅看某一代幣的轉賬
    * **僅大額轉賬**：新增 `where: {Transfer: {AmountInUSD: {gt: 10000}}}` 查詢巨鯨動向
    * **時間範圍**：新增 `where: {Block: {Time: {after: "2025-03-01T00:00:00Z"}}}` 限定時段
  </Accordion>
</AccordionGroup>

***

## 如何獲取某錢包的轉出轉賬？

使用 `senderAddress` 選擇器查詢指定錢包的轉出記錄。

```graphql theme={null}
query {
  Solana {
    Transfers(
      limit: {count: 20}
      senderAddress: {is: "WALLET_ADDRESS"}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time }
      Transfer {
        Currency { MintAddress }
        Receiver { Address }
        Amount
        AmountInUSD
      }
    }
  }
}
```

<Tip>
  將 `WALLET_ADDRESS` 替換為你要分析的實際錢包地址。
</Tip>

<AccordionGroup>
  <Accordion title="關鍵欄位">
    | 欄位                              | 說明          |
    | :------------------------------ | :---------- |
    | `Transfer.Currency.MintAddress` | 傳送的是哪種代幣    |
    | `Transfer.Receiver.Address`     | 接收方是誰       |
    | `Transfer.Amount`               | 傳送了多少代幣     |
    | `Transfer.AmountInUSD`          | 轉賬時的 USD 價值 |
  </Accordion>

  <Accordion title="自定義提示">
    * **僅某一代幣**：新增 `tokenAddress: {is: "TOKEN_ADDRESS"}` 收窄到單一代幣
    * **增加條數**：將 `count: 20` 提高到最多 `10000` 以拉更深歷史
    * **增加接收方過濾**：使用 `where: {Transfer: {Receiver: {Address: {is: "RECEIVER_ADDRESS"}}}}` 追蹤兩個特定錢包之間的轉賬
  </Accordion>
</AccordionGroup>

***

## 如何獲取某錢包的轉入轉賬？

使用 `receiverAddress` 選擇器查詢轉入某錢包的記錄。

```graphql theme={null}
query {
  Solana {
    Transfers(
      limit: {count: 20}
      receiverAddress: {is: "WALLET_ADDRESS"}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time }
      Transfer {
        Currency { MintAddress }
        Sender { Address }
        Amount
        AmountInUSD
      }
    }
  }
}
```

<Tip>
  Transfers Cube 同時支援 `senderAddress` 與 `receiverAddress` 選擇器。可與 `where` 組合做進一步過濾（例如時間範圍或最小金額）。
</Tip>

***

## 如何獲取某代幣的全部轉賬？

跟蹤網路上某一代幣的全部轉賬。

```graphql theme={null}
query {
  Solana {
    Transfers(
      limit: {count: 20}
      tokenAddress: {is: "TOKEN_ADDRESS"}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time }
      Transaction { Hash }
      Transfer {
        Sender { Address }
        Receiver { Address }
        Amount
        AmountInUSD
      }
    }
  }
}
```

<AccordionGroup>
  <Accordion title="自定義提示">
    * **巨鯨提醒**：新增 `where: {Transfer: {AmountInUSD: {gt: 100000}}}` 僅看大額轉賬（>10 萬美元）
    * **排除粉塵**：新增 `where: {Transfer: {Amount: {gt: 0.01}}}` 過濾可忽略的小額
    * **限定時間**：與 `where: {Block: {Time: {since: "2025-03-27T00:00:00Z"}}}` 組合可檢視某日以來的轉賬
  </Accordion>
</AccordionGroup>

***

## 多鏈示例

<Tabs>
  <Tab title="Solana">
    ```graphql theme={null}
    query {
      Solana {
        Transfers(
          limit: {count: 5}
          orderBy: {descending: Block_Time}
        ) {
          Block { Time }
          Transfer {
            Currency { MintAddress }
            Sender { Address }
            Receiver { Address }
            Amount
          }
        }
      }
    }
    ```
  </Tab>

  <Tab title="Ethereum">
    ```graphql theme={null}
    query {
      EVM(network: eth) {
        Transfers(
          limit: {count: 5}
          orderBy: {descending: Block_Time}
        ) {
          Block { Time }
          Transfer {
            Currency { MintAddress }
            Sender { Address }
            Receiver { Address }
            Amount
          }
        }
      }
    }
    ```
  </Tab>

  <Tab title="BSC">
    ```graphql theme={null}
    query {
      EVM(network: bsc) {
        Transfers(
          limit: {count: 5}
          orderBy: {descending: Block_Time}
        ) {
          Block { Time }
          Transfer {
            Currency { MintAddress }
            Sender { Address }
            Receiver { Address }
            Amount
          }
        }
      }
    }
    ```
  </Tab>

  <Tab title="Polygon">
    ```graphql theme={null}
    query {
      EVM(network: polygon) {
        Transfers(
          limit: {count: 5}
          orderBy: {descending: Block_Time}
        ) {
          Block { Time }
          Transfer {
            Currency { MintAddress }
            Sender { Address }
            Receiver { Address }
            Amount
          }
        }
      }
    }
    ```
  </Tab>
</Tabs>

***

## 後續步驟

<CardGroup cols={2}>
  <Card title="DEX 成交" icon="arrow-right-arrow-left" href="/zh-Hant/graphql/examples/dex-trades">
    查詢 DEX 交易資料 — 代幣成交、錢包活動與頭部交易者。
  </Card>

  <Card title="餘額與持幣者" icon="wallet" href="/zh-Hant/graphql/examples/balance-holders">
    查詢錢包餘額、餘額歷史與頭部代幣持幣者。
  </Card>

  <Card title="池子與流動性" icon="droplet" href="/zh-Hant/graphql/examples/pools-liquidity">
    探索 DEX 池子與流動性資料。
  </Card>

  <Card title="OHLC 與統計" icon="chart-candlestick" href="/zh-Hant/graphql/examples/ohlc-stats">
    獲取 K 線、成交統計、市值與代幣後設資料。
  </Card>
</CardGroup>
