Links

TriggerConstantContract

Trigger the constant of the smart contract, the transaction is off the blockchain. Returns the Transaction Object. The corresponding method must be marked view or pure.
Body params:
  • owner_address - Owner address that triggers the contract. If visible=true, use base58check format, otherwise use hex format. For constant call you can use the all-zero address.
  • contract_address - Smart contract address. If visible=true, use base58check format, otherwise use hex format.
  • function_selector - Function call, must not be left blank.
  • parameter - Parameter encoding needs to be in accordance with the ABI rules, the rules are more complicated, users can use the ethers library to encode,For details, please refer to the document-Guide-Smart Contract-Best Practice-Parameter Encoding and Decoding.
  • visible - Optional.Whehter the address is in base58 format.
Request
curl --request POST \
--url https://tron.api.watchdata.io/wallet/triggerconstantcontract \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
{
"owner_address": "410000000000000000000000000000000000000000",
"contract_address": "41a614f803b6fd780986a42c78ec9c7f77e6ded13c",
"function_selector": "balanceOf(address)",
"parameter": "000000000000000000000000a614f803b6fd780986a42c78ec9c7f77e6ded13c",
"visible": true
}
'
Response
{
"result": {
"code": "OTHER_ERROR",
"message": "class java.lang.IllegalArgumentException : Illegal character 0 at 2"
}
}