Query the state of a contract by providing the address and blockchain.
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)
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
.
The contract's ABI in a JSON stringified format.
Address of the contract to be queried.
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.
CallData is input data that encodes method and parameters.
FromAddress is the address that will populate msg.sender in the contract call.
Developer-provided parameter used to identify this request. Useful when communicating with Circle Support.
1from circle.web3 import smart_contract_platform
2from circle.web3 import utils
3
4client = utils.init_smart_contract_platform_client(api_key=key, entity_secret=entitySecret)
5
6api_instance = smart_contract_platform.InteractApi(client)
7request = smart_contract_platform.ReadContractStateRequest.from_dict({
8 "abiFunctionSignature": "ping()",
9 "address": "0x4e2f1c3a5d8b7c9e5f6a8b7c9e5f6a8b7c9e5f6a",
10 "blockchain": "ETH-SEPOLIA"
11})
12response = api_instance.query_contract(read_contract_state_request=request)
13print(response.json())
14
1{
2 "data": {
3 "output_values": [],
4 "output_data": ""
5 }
6}