estimateEnergy

Estimate the energy required to trigger the contract. This interface requires the fullnode node to enable the service. If the call is not enabled, an error will be reported. You can continue to use the triggerconstantcontract interface to estimate the energy. (v5.1.0 new interface)

Usage

tronWeb.transactionBuilder.estimateEnergy(contractAddress, functionSelector, options, parameter, issuerAddress);

Parameters

ParametersParameter DescriptionType
contractAddressthe smart contract addresshexString
functionSelectorfunction call, must not leave a blank spaceString
optionsoptional fields (permission id, feelimit and other parameters)Object
parameterthe parameter passed to 'function'Array
issuerAddressaddress that triggers the contracthexString

Return

Object

Example

>const result = await tronWeb.transactionBuilder.estimateEnergy(contractAddress, functionSelector, options, parameter, issuerAddress);
> {
  "result": {...}, //The result section is the result of the triggerconstantcontract
  "energy_required": 900000
}