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

# getTransactionsForAddress

> 增强的交易历史 API，具有强大的过滤、排序和分页功能，可检索任何地址的全面交易数据。支持双向排序、时间/槽位/状态过滤和高效的键集分页。

## 请求参数

<ParamField body="address" type="string" required>
  用于检索交易历史的Solana账户地址（钱包、代币、程序、NFT等）。
</ParamField>

<ParamField body="transactionDetails" type="string" default="signatures">
  返回的交易详细程度。

  * `signatures`
  * `full`
</ParamField>

<ParamField body="sortOrder" type="string" default="desc">
  返回交易的排序顺序。

  * `asc`
  * `desc`
</ParamField>

<ParamField body="commitment" type="string" default="finalized">
  请求的承诺级别。不支持的`processed`级别。

  * `confirmed`
  * `finalized`
</ParamField>

<ParamField body="minContextSlot" type="number">
  请求使用的最小上下文槽（可选）。
</ParamField>

<ParamField body="limit" type="number" default="1000">
  每个请求的最大交易数量。对于 transactionDetails:"signatures" 使用 1–1000，对于 transactionDetails:"full" 使用 1–1000。
</ParamField>

<ParamField body="paginationToken" type="string">
  从上一个响应中获取下一页结果的分页令牌（格式为"slot:position"）。
</ParamField>

<ParamField body="encoding" type="string" default="json">
  交易数据的编码格式（仅适用于transactionDetails=full时）。

  * `json`
  * `jsonParsed`
  * `base58`
  * `base64`
</ParamField>

<ParamField body="maxSupportedTransactionVersion" type="number">
  返回的最大交易版本（仅适用于transactionDetails=full时）。
</ParamField>

<ParamField body="filters" type="object">
  用于缩小交易结果的高级筛选器。
</ParamField>

<ParamField body="filters.slot" type="object">
  按插槽编号过滤。
</ParamField>

<ParamField body="filters.slot.gte" type="number">
  大于或等于插槽编号。
</ParamField>

<ParamField body="filters.slot.gt" type="number">
  大于插槽编号。
</ParamField>

<ParamField body="filters.slot.lte" type="number">
  小于或等于插槽编号。
</ParamField>

<ParamField body="filters.slot.lt" type="number">
  小于插槽编号。
</ParamField>

<ParamField body="filters.blockTime" type="object">
  按区块时间戳（Unix时间戳）过滤。
</ParamField>

<ParamField body="filters.blockTime.gte" type="number">
  大于或等于时间戳。
</ParamField>

<ParamField body="filters.blockTime.gt" type="number">
  大于时间戳。
</ParamField>

<ParamField body="filters.blockTime.lte" type="number">
  小于或等于时间戳。
</ParamField>

<ParamField body="filters.blockTime.lt" type="number">
  小于时间戳。
</ParamField>

<ParamField body="filters.blockTime.eq" type="number">
  等于时间戳。
</ParamField>

<ParamField body="filters.signature" type="object">
  通过交易签名进行过滤。
</ParamField>

<ParamField body="filters.signature.gte" type="string">
  获取签名大于或等于此值的交易。
</ParamField>

<ParamField body="filters.signature.gt" type="string">
  获取此签名之后的交易。
</ParamField>

<ParamField body="filters.signature.lte" type="string">
  获取签名小于或等于此值的交易。
</ParamField>

<ParamField body="filters.signature.lt" type="string">
  获取此签名之前的交易。
</ParamField>

<ParamField body="filters.status" type="string" default="any">
  通过交易状态进行过滤。

  * `succeeded`
  * `failed`
  * `any`
</ParamField>

<ParamField body="filters.tokenAccounts" type="string" default="none">
  筛选相关代币账户的交易。控制是否包括涉及地址所拥有的代币账户的交易。

  * `none`
  * `balanceChanged`
  * `all`
</ParamField>

<ParamField body="filters.tokenTransfer" type="object">
  将结果限定为查询地址参与的符合特定条件的代币转移的交易。所有字段都是可选的，并且使用AND语义组合。
</ParamField>

<ParamField body="filters.tokenTransfer.with" type="string">
  对方地址。匹配另一方是此地址的转账。
</ParamField>

<ParamField body="filters.tokenTransfer.direction" type="string" default="any">
  相对于查询地址的转账方向。

  * `in`
  * `out`
  * `any`
</ParamField>

<ParamField body="filters.tokenTransfer.mint" type="string">
  筛选的代币铸造。
</ParamField>

<ParamField body="filters.tokenTransfer.amount" type="object">
  原始链上金额范围过滤器。所有字段都是可选的，可以组合使用。
</ParamField>


## OpenAPI

````yaml zh/openapi/rpc-http/getTransactionsForAddress.yaml POST /
openapi: 3.1.0
info:
  title: Solana RPC API
  version: 1.0.0
  description: 高级Solana交易历史API，具有强大的过滤、排序和分页功能，可检索任何地址的全面交易数据。
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://mainnet.helius-rpc.com
    description: 主网RPC端点
  - url: https://devnet.helius-rpc.com
    description: 开发网RPC端点
security: []
paths:
  /:
    post:
      tags:
        - RPC
      summary: getTransactionsForAddress
      description: >
        增强的交易历史API，提供强大的过滤、排序和分页功能，用于检索与任何Solana地址相关的交易数据。此高级方法通过提供以下功能克服了getSignaturesForAddress的限制：


        - 双向排序（升序/降序时间顺序）

        - 按插槽、时间、签名和交易状态进行高级过滤

        - 支持代币账户（包括关联代币账户的交易）

        - 按交易对手、方向、铸造和原始金额过滤代币转账

        - 使用基于插槽的密钥进行高效的分页

        - 可以选择返回完整的交易详情或仅返回签名

        - 支持时间范围查询和状态过滤


        非常适合构建全面的钱包历史记录、分析仪表板、审核跟踪以及任何需要详细交易分析的应用程序，提供精确的数据检索控制。
      operationId: getTransactionsForAddress
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
                - params
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                  example: '2.0'
                  description: JSON-RPC协议版本。
                  default: '2.0'
                id:
                  type: string
                  example: '1'
                  description: 请求的唯一标识符。
                  default: '1'
                method:
                  type: string
                  enum:
                    - getTransactionsForAddress
                  example: getTransactionsForAddress
                  description: 要调用的RPC方法名称。
                  default: getTransactionsForAddress
                params:
                  type: array
                  description: 包含所需账户地址和可选配置对象的数组。
                  minItems: 1
                  maxItems: 2
                  prefixItems:
                    - type: string
                      description: 用于检索交易历史的 Solana 账户地址（钱包、代币、程序、NFT 等）。
                      example: Vote111111111111111111111111111111111111111
                    - type: object
                      description: 用于过滤、排序和分页的高级查询配置。
                      properties:
                        transactionDetails:
                          type: string
                          description: 返回的交易详情级别。
                          enum:
                            - signatures
                            - full
                          default: signatures
                          example: signatures
                        sortOrder:
                          type: string
                          description: 返回交易的排序顺序。
                          enum:
                            - asc
                            - desc
                          default: desc
                          example: desc
                        commitment:
                          type: string
                          description: 请求的承诺级别。不支持 `processed` 承诺。
                          enum:
                            - confirmed
                            - finalized
                          default: finalized
                          example: finalized
                        minContextSlot:
                          type: integer
                          description: 用于请求的最小上下文槽（可选）。
                          example: 1000
                        limit:
                          type: integer
                          description: >-
                            每个请求的最大交易数量。使用 1–1000 用于
                            transactionDetails:"signatures" 和 1–1000 用于
                            transactionDetails:"full"。
                          minimum: 1
                          maximum: 1000
                          default: 1000
                          example: 100
                        paginationToken:
                          type: string
                          description: 从上一个响应中获取下一页结果的分页令牌（格式为“slot:position”）。
                          example: '1053:13'
                        encoding:
                          type: string
                          description: 交易数据的编码格式（仅在transactionDetails=full时适用）。
                          enum:
                            - json
                            - jsonParsed
                            - base58
                            - base64
                          default: json
                          example: json
                        maxSupportedTransactionVersion:
                          type: integer
                          description: 返回的最大交易版本（仅在transactionDetails=full时适用）。
                          example: 0
                        filters:
                          type: object
                          description: 用于缩小交易结果的高级过滤器。
                          properties:
                            slot:
                              type: object
                              description: 按槽号过滤。
                              properties:
                                gte:
                                  type: integer
                                  description: 大于或等于槽号。
                                  example: 100
                                gt:
                                  type: integer
                                  description: 大于槽号。
                                  example: 100
                                lte:
                                  type: integer
                                  description: 小于或等于槽号。
                                  example: 200
                                lt:
                                  type: integer
                                  description: 小于槽号。
                                  example: 200
                              additionalProperties: false
                            blockTime:
                              type: object
                              description: 按区块时间戳（Unix时间戳）过滤。
                              properties:
                                gte:
                                  type: integer
                                  description: 大于或等于时间戳。
                                  example: 1640995200
                                gt:
                                  type: integer
                                  description: 大于时间戳。
                                  example: 1640995200
                                lte:
                                  type: integer
                                  description: 小于或等于时间戳。
                                  example: 1641081600
                                lt:
                                  type: integer
                                  description: 小于时间戳。
                                  example: 1641081600
                                eq:
                                  type: integer
                                  description: 等于时间戳。
                                  example: 1641038400
                              additionalProperties: false
                            signature:
                              type: object
                              description: 按交易签名过滤。
                              properties:
                                gte:
                                  type: string
                                  description: 获取签名大于或等于此值的交易。
                                  example: >-
                                    4h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv
                                gt:
                                  type: string
                                  description: 获取此签名之后的交易。
                                  example: >-
                                    3jweEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv
                                lte:
                                  type: string
                                  description: 获取签名小于或等于此值的交易。
                                  example: >-
                                    6k7xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv
                                lt:
                                  type: string
                                  description: 获取此签名之前的交易。
                                  example: >-
                                    5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv
                              additionalProperties: false
                            status:
                              type: string
                              description: 按交易状态过滤。
                              enum:
                                - succeeded
                                - failed
                                - any
                              default: any
                              example: succeeded
                            tokenAccounts:
                              type: string
                              description: 过滤相关代币账户的交易。控制是否包含涉及该地址拥有的代币账户的交易。
                              enum:
                                - none
                                - balanceChanged
                                - all
                              default: none
                              example: balanceChanged
                            tokenTransfer:
                              $ref: '#/components/schemas/TokenTransferFilter'
                              description: 过滤出查询地址参与的符合交易对手、方向、铸造或原始金额范围的代币转账的交易。
                          additionalProperties: false
                  items: false
                  default:
                    - Vote111111111111111111111111111111111111111
                    - transactionDetails: signatures
                      limit: 50
                      sortOrder: desc
                      filters:
                        status: succeeded
                        slot:
                          gte: 1000
                          lt: 2000
                        tokenTransfer:
                          direction: in
                          mint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                  example:
                    - Vote111111111111111111111111111111111111111
                    - transactionDetails: signatures
                      limit: 50
                      sortOrder: desc
                      filters:
                        status: succeeded
                        slot:
                          gte: 1000
                          lt: 2000
                        tokenTransfer:
                          direction: in
                          mint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
      responses:
        '200':
          description: 成功检索到指定地址的交易。
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    description: JSON-RPC协议版本。
                    enum:
                      - '2.0'
                    example: '2.0'
                  id:
                    type: string
                    description: 与请求匹配的标识符。
                    example: '1'
                  result:
                    type: object
                    description: 交易数据和分页信息。
                    properties:
                      data:
                        type: array
                        description: 交易信息列表。
                        items:
                          oneOf:
                            - type: object
                              description: >-
                                签名级别的交易摘要（当 transactionDetails 为 "signatures"
                                时）。
                              properties:
                                signature:
                                  type: string
                                  description: 交易签名，作为 base-58 编码的字符串。
                                  example: >-
                                    5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv
                                slot:
                                  type: integer
                                  description: 包含交易的区块所在的槽。
                                  example: 1054
                                transactionIndex:
                                  type: integer
                                  description: 交易在其区块内的从零开始的索引。用于确定区块内的交易顺序。
                                  example: 42
                                err:
                                  oneOf:
                                    - type: object
                                      description: 如果交易失败，则返回错误
                                    - type: 'null'
                                  description: 如果交易失败，则返回错误；如果成功，则返回 null。
                                  example: null
                                memo:
                                  oneOf:
                                    - type: string
                                      description: 与交易相关的备注
                                    - type: 'null'
                                  description: 与交易相关的备注，如果没有则为 null。
                                  example: null
                                blockTime:
                                  oneOf:
                                    - type: integer
                                      description: 估计的生产时间，作为 Unix 时间戳
                                    - type: 'null'
                                  description: 估计的生产时间，以Unix时间戳表示（自纪元以来的秒数），如果不可用则为null。
                                  example: 1641038400
                                confirmationStatus:
                                  oneOf:
                                    - type: string
                                      enum:
                                        - processed
                                        - confirmed
                                        - finalized
                                      description: 交易的集群确认状态
                                    - type: 'null'
                                  description: 交易的集群确认状态。
                                  example: finalized
                              required:
                                - signature
                                - slot
                                - transactionIndex
                              additionalProperties: false
                            - type: object
                              description: 带有状态元数据的完整交易（当transactionDetails为"full"时）。
                              properties:
                                slot:
                                  type: integer
                                  description: 包含交易的区块的插槽。
                                  example: 1054
                                transactionIndex:
                                  type: integer
                                  description: 交易在其区块内的从零开始的索引。用于确定区块内的交易顺序。
                                  example: 42
                                transaction:
                                  type: object
                                  description: 根据所选编码编码或解析的交易对象。
                                meta:
                                  type: object
                                  description: 交易状态元数据。
                                blockTime:
                                  oneOf:
                                    - type: integer
                                      description: 估计的生产时间，以Unix时间戳表示
                                    - type: 'null'
                                  description: 估计的生产时间，以Unix时间戳表示（自纪元以来的秒数），如果不可用则为null。
                              required:
                                - slot
                                - transactionIndex
                                - transaction
                      paginationToken:
                        oneOf:
                          - type: string
                            description: 用于检索下一页结果的令牌
                          - type: 'null'
                        description: 下一页的分页令牌，如果没有更多结果则为null。
                        example: '1055:5'
              examples:
                signaturesResponse:
                  summary: 仅包含签名详细信息的响应
                  value:
                    jsonrpc: '2.0'
                    id: '1'
                    result:
                      data:
                        - signature: >-
                            5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv
                          slot: 1054
                          transactionIndex: 42
                          err: null
                          memo: null
                          blockTime: 1641038400
                          confirmationStatus: 已完成
                        - signature: >-
                            kwjd820slPK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv
                          slot: 1055
                          transactionIndex: 15
                          err: null
                          memo: null
                          blockTime: 1641038460
                          confirmationStatus: 已完成
                      paginationToken: '1055:5'
                fullResponse:
                  summary: 包含完整交易详情的响应
                  value:
                    jsonrpc: '2.0'
                    id: '1'
                    result:
                      data:
                        - slot: 1054
                          transactionIndex: 42
                          transaction:
                            signatures:
                              - >-
                                5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv
                            message:
                              accountKeys:
                                - ...
                                - ...
                              instructions:
                                - ...
                          meta:
                            fee: 5000
                            preBalances:
                              - 1000000
                              - 2000000
                            postBalances:
                              - 999995000
                              - 2000000
                          blockTime: 1641038400
                      paginationToken: '1055:5'
        '400':
          description: 错误请求 - 请求参数无效或请求格式错误。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32602
                  message: 参数无效
                id: '1'
        '401':
          description: 未授权 - API密钥无效或缺失。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32001
                  message: 未授权
                id: '1'
        '429':
          description: 请求过多 - 超过速率限制。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32005
                  message: 请求过多
                id: '1'
        '500':
          description: 内部服务器错误 - 服务器发生错误。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32603
                  message: 内部错误
                id: '1'
        '503':
          description: 服务不可用 - 服务暂时不可用。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32002
                  message: 服务不可用
                id: '1'
        '504':
          description: 网关超时 - 请求超时。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32003
                  message: 网关超时
                id: '1'
      security:
        - ApiKeyQuery: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        jsonrpc:
          type: string
          description: JSON-RPC协议版本。
          enum:
            - '2.0'
          example: '2.0'
        error:
          type: object
          properties:
            code:
              type: integer
              description: 错误代码。
              example: -32602
            message:
              type: string
              description: 错误信息。
            data:
              type: object
              description: 关于错误的附加数据。
        id:
          type: string
          description: 与请求匹配的标识符。
          example: '1'
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: 您的Helius API密钥。您可以在[仪表板](https://dashboard.helius.dev/api-keys)中免费获取一个。

````