Skip to content

sui_tryGetPastObject ​

Read API

Note there is no software-level guarantee/SLA that objects with past versions can be retrieved by this API, even if the object and version exists/existed. The result may vary across nodes depending on their pruning policies. Return the object information for a specified version

Parameters ​

  • object_id · ObjectID · requiredthe ID of the queried object

  • version · SequenceNumber2 · requiredthe version of the queried object. If None, default to the latest known version

  • options · ObjectDataOptions · optionaloptions for specifying the content to be returned

    • showBcs · boolean · optionalWhether to show the content in BCS format. Default to be False
    • showContent · boolean · optionalWhether to show the content(i.e., package content or Move struct content) of the object. Default to be False
    • showDisplay · boolean · optionalWhether to show the Display metadata of the object for frontend rendering. Default to be False
    • showOwner · boolean · optionalWhether to show the owner of the object. Default to be False
    • showPreviousTransaction · boolean · optionalWhether to show the previous transaction digest of the object. Default to be False
    • showStorageRebate · boolean · optionalWhether to show the storage rebate of the object. Default to be False
    • showType · boolean · optionalWhether to show the type of the object. Default to be False

Result ​

  • SuiPastObjectResponse · ObjectRead

    • object - The object exists and is found with this version

      • details · ObjectData · required
      • status · "VersionFound" · required
    • object - The object does not exist

      • details · ObjectID · required
      • status · "ObjectNotExists" · required
    • object - The object is found to be deleted with this version

      • details · ObjectRef · required
      • status · "ObjectDeleted" · required
    • object - The object exists but not found with this version

    • object - The asked object version is higher than the latest

      • details · object · required
      • status · "VersionTooHigh" · required

Example ​

Request ​

bash
curl https://mainnet-api.inodra.com/v1/jsonrpc \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: YOUR_API_KEY' \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "sui_tryGetPastObject",
  "params": [
    "0x11af4b844ff94b3fbef6e36b518da3ad4c5856fa686464524a876b463d129760",
    4,
    {
      "showType": true,
      "showOwner": true,
      "showPreviousTransaction": true,
      "showDisplay": false,
      "showContent": true,
      "showBcs": false,
      "showStorageRebate": true
    }
  ]
}'

Response ​

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "status": "VersionFound",
    "details": {
      "objectId": "0x11af4b844ff94b3fbef6e36b518da3ad4c5856fa686464524a876b463d129760",
      "version": "4",
      "digest": "5VPAwDXy3BL72ehFc7gSJoz27ahMd6spUg5YwYc4ibcv",
      "type": "0x2::coin::Coin<0x2::sui::SUI>",
      "owner": {
        "AddressOwner": "0x3568c40e814d9d5396d23087a0fd641e91e0e00df6c012cded9ef9ba5e5bf042"
      },
      "previousTransaction": "5jQByoouHBwaico5pQB73GdbzerC2StjTiHh5garBjiV",
      "storageRebate": "100",
      "content": {
        "dataType": "moveObject",
        "type": "0x2::coin::Coin<0x2::sui::SUI>",
        "hasPublicTransfer": true,
        "fields": {
          "balance": "10000",
          "id": {
            "id": "0x11af4b844ff94b3fbef6e36b518da3ad4c5856fa686464524a876b463d129760"
          }
        }
      }
    }
  }
}

The full-stack Sui data layer.