⚡ We welcome businesses to test our enterprise-grade service

Method: POST /wallet/triggerconstantcontract

dropdown

Method REST /wallet/triggerconstantcontract example for Tron (TRX)

POST /wallet/triggerconstantcontract

Method not allowed

Invoke the readonly function (modified by the view or pure modifier) of a contract for contract data query; or Invoke the non-readonly function of a contract for predicting whether the transaction can be successfully executed or estimating the energy consumption

TriggerConstantContract operation will not generate an on-chain transaction, nor will it change the status of the current node.

For estimating energy: use triggerconstantcontract to call the non-readonly method of the contract, and the energy_used field in the returned value is the energy consumption. Therefore, the fee_limit of the transaction can be set to energy_used x energy unit price.

Parameters

owner_address - string

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 - string

Smart contract address. If visible=true, use base58check format, otherwise use hex format.

function_selector - string

Function call, must not be left blank.

parameter - string

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 - string

Optional.Whehter the address is in base58 format.

Request

curl --location --request POST 'https://trx.getblock.io/wallet/triggerconstantcontract' \
--header 'x-api-key: YOUR-API-KEY' \
--header 'Content-Type: application/json' \
--data-raw '{}'


Response

{
    "result": "null",
    "id": "getblock.io",
    "status_code": 405,
    "message": "Method not allowed"
}