跳转到主要内容
POST
/
v1
/
wallets
/
{walletId}
/
addresses
/
{addressId}
/
contracts
/
read
Child Address Read
curl --request POST \
  --url https://api.blockradar.co/v1/wallets/{walletId}/addresses/{addressId}/contracts/read \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "calls": [
    {
      "abi": [
        {
          "constant": true,
          "inputs": [
            {
              "name": "account",
              "type": "address"
            }
          ],
          "name": "balanceOf",
          "outputs": [
            {
              "name": "",
              "type": "uint256"
            }
          ],
          "stateMutability": "view",
          "type": "function"
        }
      ],
      "address": "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
      "method": "balanceOf",
      "parameters": [
        "0x947514e4B803e312C312da0F1B41fEDdbe15ae7a"
      ]
    },
    {
      "abi": [
        {
          "constant": true,
          "inputs": [
            {
              "name": "owner",
              "type": "address"
            },
            {
              "name": "spender",
              "type": "address"
            }
          ],
          "name": "allowance",
          "outputs": [
            {
              "name": "",
              "type": "uint256"
            }
          ],
          "stateMutability": "view",
          "type": "function"
        }
      ],
      "address": "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
      "method": "allowance",
      "parameters": [
        "0x947514e4B803e312C312da0F1B41fEDdbe15ae7a",
        "0xSpenderAddress"
      ]
    }
  ]
}
'
{
"data": "10052335235393043",
"message": "Contract read successfully",
"statusCode": 200
}

Batch Operations

This endpoint supports batch operations, allowing you to read multiple contract methods in a single API call from a specific child address.

Batch Request Format

To execute multiple reads, use the calls array:
{
  "calls": [
    {
      "address": "0x1234...",
      "method": "balanceOf",
      "parameters": ["0xabcd..."],
      "abi": [...]
    },
    {
      "address": "0x5678...",
      "method": "totalSupply",
      "parameters": [],
      "abi": [...]
    }
  ]
}

Batch Response Format

Batch responses include success and errors arrays:
{
  "message": "Batch contract read completed (2/2 successful)",
  "statusCode": 200,
  "data": {
    "success": [
      { "index": 0, "method": "balanceOf", "data": "1000000" },
      { "index": 1, "method": "totalSupply", "data": "50000000" }
    ],
    "errors": []
  }
}

Validation Rules

RuleValue
Max batch size20 operations
Min batch size1 operation

Use Cases

  • Bulk reads: Read multiple contract states efficiently
  • Multi-asset balances: Query balances across multiple assets in one call
  • Protocol state: Read multiple protocol parameters simultaneously

授权

x-api-key
string
header
必填

路径参数

walletId
string
必填
示例:

"YOUR_WALLET_ID"

addressId
string
必填
示例:

"ADDRESS_ID"

请求体

application/json
calls
object[]
示例:
[
{
"abi": [
{
"constant": true,
"inputs": [{ "name": "account", "type": "address" }],
"name": "balanceOf",
"outputs": [{ "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
}
],
"address": "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
"method": "balanceOf",
"parameters": [
"0x947514e4B803e312C312da0F1B41fEDdbe15ae7a"
]
},
{
"abi": [
{
"constant": true,
"inputs": [
{ "name": "owner", "type": "address" },
{ "name": "spender", "type": "address" }
],
"name": "allowance",
"outputs": [{ "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
}
],
"address": "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
"method": "allowance",
"parameters": [
"0x947514e4B803e312C312da0F1B41fEDdbe15ae7a",
"0xSpenderAddress"
]
}
]

响应

200 - application/json

Ethereum / Tron / Ethereum (Batch) / Tron (Batch)

data
示例:

"10052335235393043"

message
string
示例:

"Contract read successfully"

statusCode
number
示例:

200