In other blockchains, it is possible to call API method and get not the latest info but historical view. For example, I might be interested in address's balance at specific block height vs the current balance. Sometimes this is achieved by providing optional parameter (ETH way), sometimes with request header (Aptos way). I'm wondering if there is something similar in Sui. Documentation did not reveal an easy way of achieving that, maybe there is complicated way? In particular I need a view on address's stakes and unclaimed rewards at specific block height. Latest info is provided by suix_getStakes
Request historical information in Sui API
106 views Asked by DimaA6_ABC At
1
There are RPC methods to get earlier versions of objects:
sui_tryGetPastObject
but unless the node you are connecting to has indexing as well, objects generations will get 'pruned'.Sui is moving to a GraphQL RPC where the nodes are required to have indexing so this may be attainable with consistency and confidence once that rolls (appox Q124).
History via RPC:
So this is a bit tedious but Staked objects are Sui Objects. As such, each has a 'previous transaction digest (you can see this for example on testnet with
sui client object 0x77851d73e7c1227c048fc7cbf21ff9053faa872950dd33f5d0cb5b40a79d9d99
or via Sui Explorer.It then goes into a rinse and repeat cycle (pseudo here):
sui_tryGetPastObject
and get previous transaction digest