Skip to content

Query a Contract Method

Use this guide to perform a read-only query against a deployed contract. Unlike a call, this does not produce a blockchain transaction and is free of gas fees.

Before you begin, ensure:

  • The contract ABI is uploaded
  • The contract deployment is registered
  • You have the deploymentId and method name
POST /v2/contract/deployment/{id}/query

Request Parameters

{
"method": "balanceOf",
"params": ["0xabc123..."]
}
  • method: The name of the method to query
  • params: An array of arguments in the same order as the method signature

Example Request

query-method.sh
curl -X POST https://api.fsco.io/v2/contract/deployment/dep_abc123/query \
-H "Authorization: Bearer $FSCO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"methodName": "balanceOf",
"paramCollection": ["0xabc"],
"isShared": false
}'

Response

response.json
{
"query": {
"deploymentId": "uuid",
"methodName": "balanceOf",
"paramCollection": ["0xabc"],
"isShared": false
},
"response": {
"balance": "1000000000000000000"
}
}
  • This request does not modify blockchain state
  • This request does not require a wallet
  • The query is executed on the latest block
  • The response is returned immediately
  • Make sure the method you’re calling is marked view or pure in the ABI
  • This is ideal for checking balances, ownerOf, or any informational method