Explorer

Read Contract Data (Aptos)

Read data from a smart contract on a specified network. The API returns the data from the contract based on the input parameters. Supports both EVM and Aptos networks. Below is an example for Aptos.

Check out the readContractData API template script for more details.

POST
/api/oc/v1/readContractData

Authorization

AuthorizationRequiredBearer <token>

In: header

Request Body

application/jsonRequired
caip2idRequiredstring

Caip2id of the network on which to read the contract data

dataRequiredobject

Contract Read Data

curl -X POST "https://sandbox-api.okto.tech/api/oc/v1/readContractData/" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "caip2id": "aptos:testnet",
    "data": {
      "function": "0x1::coin::balance",
      "typeArguments": [
        "0x1::aptos_coin::AptosCoin"
      ],
      "functionArguments": [
        "0x9ed7f8c95c5e2c3cb06dfbb48681b87401fabeb88b7d710db3720f7a2ca3fffc"
      ]
    }
  }'

Contract data read successfully

{
  "status": "success",
  "data": [
    "199839300"
  ]
}