Solana RPC API手册

getSignaturesForAddress

本方法仅在solana-core v1.7或更高版本中有效。在v1.6或之前版本中 请使用getConfirmedSignaturesForAddress2方法

getSignaturesForAddress方法返回指定
Returns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block

请求参数

  • <string> - base58编码的账号地址
  • <object> - (可选)包含以下字段的配置对象:
    • limit: <number> - (可选) maximum transaction signatures to return (between 1 and 1,000, default: 1,000).
    • before: <string> - (可选) start searching backwards from this transaction signature. If not provided the search starts from the top of the highest max confirmed block.
    • until: <string> - (可选) search until this transaction signature, if found before limit reached.
    • (可选) Commitment; "processed" is not supported. If parameter not provided, the default is "finalized".

响应结果

getSignaturesForAddress方法的result字段为交易签名信息数组,按交易时间顺序排列:

  • signature: <string> - transaction signature as base-58 encoded string
  • slot: <u64> - The slot that contains the block with the transaction
  • err: <object | null> - Error if transaction failed, null if transaction succeeded. TransactionError definitions
  • memo: <string |null> - Memo associated with the transaction, null if no memo is present
  • blockTime: <i64 | null> - estimated production time, as Unix timestamp (seconds since the Unix epoch) of when transaction was processed. null if not available.

示例代码

请求:

curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
  {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getSignaturesForAddress",
    "params": [
      "Vote111111111111111111111111111111111111111",
      {
        "limit": 1
      }
    ]
  }

响应:

{
  "jsonrpc": "2.0",
  "result": [
    {
      "err": null,
      "memo": null,
      "signature": "5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv",
      "slot": 114,
      "blockTime": null
    }
  ],
  "id": 1
}