estimateEnergy method
Future<BigInt>
estimateEnergy({
- XCBAddress? sender,
- XCBAddress? to,
- XCBAmount? value,
- BigInt? amountOfEnergy,
- XCBAmount? energyPrice,
- Uint8List? data,
- @Deprecated('Parameter is ignored') BlockNum? atBlock,
Estimate the amount of energy that would be necessary if the transaction was sent via sendTransaction. Note that the estimate may be significantly higher than the amount of energy actually used by the transaction.
Implementation
Future<BigInt> estimateEnergy({
XCBAddress? sender,
XCBAddress? to,
XCBAmount? value,
BigInt? amountOfEnergy,
XCBAmount? energyPrice,
Uint8List? data,
@Deprecated('Parameter is ignored') BlockNum? atBlock,
}) async {
final amountHex = await _makeRPCCall<String>('xcb_estimateEnergy', [
{
if (sender != null) 'from': sender.hexNo0x,
if (to != null) 'to': to.hexNo0x,
if (amountOfEnergy != null)
'energy': '0x${amountOfEnergy.toRadixString(16)}',
if (energyPrice != null)
'energyPrice': '0x${energyPrice.getInOre.toRadixString(16)}',
if (value != null) 'value': '0x${value.getInOre.toRadixString(16)}',
if (data != null) 'data': bytesToHex(data, include0x: true),
},
]);
return hexToInt(amountHex);
}