> ## 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="/cn/graphql/examples/dex-trades">
    查询 DEX 交易数据 — 代币成交、钱包活动与头部交易者。
  </Card>

  <Card title="余额与持币者" icon="wallet" href="/cn/graphql/examples/balance-holders">
    查询钱包余额、余额历史与头部代币持币者。
  </Card>

  <Card title="池子与流动性" icon="droplet" href="/cn/graphql/examples/pools-liquidity">
    探索 DEX 池子与流动性数据。
  </Card>

  <Card title="OHLC 与统计" icon="chart-candlestick" href="/cn/graphql/examples/ohlc-stats">
    获取 K 线、成交统计、市值与代币元数据。
  </Card>
</CardGroup>
