Skip to main content
POST
/
v1
/
w3s
/
contracts
/
query
Execute a query function on a contract
curl --request POST \
  --url https://api.circle.com/v1/w3s/contracts/query \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "abiFunctionSignature": "burn(uint256)",
  "abiParameters": [
    "100",
    "1"
  ],
  "abiJson": "[{\"inputs\": [],\"stateMutability\": \"nonpayable\",\"type\": \"constructor\"},...",
  "address": "0x1e124d7384cd34448ea5907bd0052a79355ab5eb",
  "blockchain": "MATIC-AMOY",
  "callData": "<string>",
  "fromAddress": "<string>"
}'
{
  "data": {
    "outputValues": [
      "<any>"
    ],
    "outputData": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Circle's API Keys are formatted in the following structure "PREFIX:ID:SECRET". All three parts are requred to make a successful request.

Headers

X-Request-Id
string

Developer-provided parameter used to identify this request. Useful when communicating with Circle Support.

Example:

"2adba88e-9d63-44bc-b975-9b6ae3440dde"

Body

application/json

Read contract state by executing a read ABI function.

address
string
required

Address of the contract to be queried.

Example:

"0x1e124d7384cd34448ea5907bd0052a79355ab5eb"

blockchain
enum<string>
required

The blockchain network that the resource is to be created on or is currently on. Required along with sourceAddress if you don't provide walletId. The blockchain and walletId fields are mutually exclusive.

Available options:
ETH,
ETH-SEPOLIA,
MATIC,
MATIC-AMOY,
ARB,
ARB-SEPOLIA,
UNI,
UNI-SEPOLIA,
BASE,
BASE-SEPOLIA,
OP,
OP-SEPOLIA
Example:

"MATIC-AMOY"

abiFunctionSignature
string

The contract ABI function signature or callData field is required for interacting with the smart contract. The ABI function signature cannot be used simultaneously with callData. e.g. burn(uint256)

Example:

"burn(uint256)"

abiParameters
AbiParameters · array

The contract ABI function signature parameters for executing the contract interaction. Supported parameter types include string, integer, boolean, and array. These parameters should be used exclusively with the abiFunctionSignature and cannot be used with callData.

Example:
["100", "1"]
abiJson
string

The contract's ABI in a JSON stringified format.

Example:

"[{\"inputs\": [],\"stateMutability\": \"nonpayable\",\"type\": \"constructor\"},..."

callData
string

CallData is input data that encodes method and parameters.

fromAddress
string

FromAddress is the address that will populate msg.sender in the contract call.

Response

Contract read successfully.

data
object
required
I