sui_tryGetPastObject - Sui

Example code for the sui_tryGetPastObject JSON-RPC method. Complete guide on how to use sui_tryGetPastObject JSON-RPC in GetBlock Web3 documentation.

This method returns the object data at a specific version on the SUI network. This is useful for inspecting historical state of objects, debugging, and auditing object changes over time. Unlike sui_getObject which returns current state, this method can access any previous version.

Parameters

Parameter
Type
Required
Description

object_id

ObjectID

Yes

The object ID to query

version

SequenceNumber

Yes

The version number to query

options

ObjectDataOptions

No

Options for response content

Returns

Field
Type
Description

status

string

VersionFound, ObjectNotExists, ObjectDeleted, or VersionNotFound

details

object

Object data if found

Request Example

cURL
curl -X POST https://go.getblock.io/<ACCESS-TOKEN>/ \
-H "Content-Type: application/json" \
-d '{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "method": "sui_tryGetPastObject",
  "params": [
    "0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809",
    4,
    { "showContent": true }
  ]
}'

Response Example

Response Parameters

Parameter
Type
Description

status

string

Query result status

details

object

Object data at specified version

Use Cases

  • Audit object state history

  • Debug state changes

  • Verify historical balances

  • Track NFT ownership history

Error Handling

Error Code
Description

-32602

Invalid params - malformed ID or version

-32603

Internal error - node issues

VersionNotFound

Requested version not available

ObjectDeleted

Object was deleted before version

SDK Integration

Last updated

Was this helpful?