post https://api.shasta.trongrid.io/walletsolidity/triggerconstantcontract
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. (Confirmed state)
Note:
- 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, thefee_limit
of the transaction can be set toenergy_used x energy unit price
. - Parameter encoding and decoding example: Parameter and return value encoding and decoding
Returns
Field | Type | Description |
---|---|---|
result | Return | Run result, for detailed parameter definition, refer to EstimateEnergy |
energy_used | int64 | Estimated energy consumption |
constant_result | string array | Result list of tiggered functions |
transaction | Transaction | Transaction information, refer to GetTransactionByID |