跳转到主要内容
POST
使用标准的 getAccountInfo 方法读取账户过去的状态。在配置对象中添加以下其中一项:
  • slot:账户在该 slot 结束时的状态。
  • lastUpdateBeforeSlot:账户在该 slot 之前(不含)最后一次更新后的状态。
  • firstUpdateAfterSlot:账户在该 slot 之后(不含)第一次更新后的状态。
只能设置其中一项。都不设置时,getAccountInfo 返回账户的当前状态,见 getAccountInfo。

遍历账户历史

使用 lastUpdateBeforeSlot 和 firstUpdateAfterSlot 时,context.slot 是返回的那次更新所在的 slot。把它传回请求,即可逐次遍历账户的历史。 添加 changes(1 到 20)可在 result.changes 中同时获得相应数量的更早版本,按从新到旧排列,每个版本包含 slot、blockTime 和 txnSignature。

限制

  • 历史读取返回 finalized 数据。commitment 会被忽略,minContextSlot 不能与这些选项同时使用。
  • 账户在该时间点不存在或已关闭,或没有可用数据时,value 为 null。
  • SPL Token 和 Token-2022 的 mint 账户无法按历史读取:返回错误 -32033,data.reason 为 "splTokenMint"。Stake、vote、config 和 sysvar 账户也返回 -32033。
  • 代币账户根据其余额历史重建。会返回余额、mint、所有者和租金 lamports;不返回 Token-2022 扩展、委托人、冻结状态、关闭权限和精确的 space。
  • 晚于最新可用 slot 的 slot 返回 -32030,早于最早可用 slot 的返回 -32031,没有可用数据的 slot 返回 -32034。lastUpdateBeforeSlot 或 firstUpdateAfterSlot 遍历超过第一次或最后一次已知更新时返回 -32020。
  • dataSlice 不能与 jsonParsed 或 jsonParsedEnhanced 同时使用。
一次历史读取消耗 1 积分,与实时调用相同。一次读取多个账户,请使用历史 getMultipleAccounts。 请求配置和错误处理见 RPC 快速入门。计费见积分与限制。

授权

api_key
string
query
必填

请求体

application/json
jsonrpc
enum<string>
必填
可用选项:
2.0
id
integer
必填
method
enum<string>
必填
可用选项:
getAccountInfo
params
any[]
必填
Required array length: 2 elements

响应

200 - application/json

Successful response

jsonrpc
enum<string>
可用选项:
2.0
result
object
id
integer