Solana RPC API手册

getSignatureStatuses

getSignatureStatuses方法返回一组签名的状态。除非设置了searchTransactionHistory参数, 否则该方法仅搜索最近的签名状态缓存。

请求参数

  • <array> - An array of transaction signatures to confirm, as base-58 encoded strings
  • <object> - (optional) Configuration object containing the following field:
    • searchTransactionHistory: <bool> - if true, a Solana node will search its ledger cache for any signatures not found in the recent status cache

响应结果

getSignatureStatuses方法返回一个RpcResponse对象,其中包含一个TransactionStatus对象数组, 每个对象的值可能是:

  • <null> - 未知的交易
  • <object>
    • slot: <u64> - The slot the transaction was processed
    • confirmations: <usize | null> - Number of blocks since signature confirmation, null if rooted, as well as finalized by a supermajority of the cluster
    • err: <object | null> - Error if transaction failed, null if transaction succeeded. TransactionError definitions
    • confirmationStatus: <string | null> - The transaction's cluster confirmation status; either processed, confirmed, or finalized. See Commitment for more on optimistic confirmation.
    • DEPRECATED: status: <object> - Transaction status
      • "Ok": <null> - Transaction was successful
      • "Err": <ERR> - Transaction failed with TransactionError

示例代码

请求:

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

响应:

{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "slot": 82
    },
    "value": [
      {
        "slot": 72,
        "confirmations": 10,
        "err": null,
        "status": {
          "Ok": null
        },
        "confirmationStatus": "confirmed",
      },
      null
    ]
  },
  "id": 1
}

请求:

curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
  {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getSignatureStatuses",
    "params": [
      [
        "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW"
      ],
      {
        "searchTransactionHistory": true
      }
    ]
  }

响应:

{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "slot": 82
    },
    "value": [
      {
        "slot": 48,
        "confirmations": null,
        "err": null,
        "status": {
          "Ok": null
        },
        "confirmationStatus": "finalized",
      },
      null
    ]
  },
  "id": 1
}