getTransactionCost method

  1. @override
Future<TransactionCost> getTransactionCost({
  1. required String networkUrl,
  2. required String transactionRequestHexOrJson,
})
override

Implementation

@override
Future<TransactionCost> getTransactionCost(
    {required String networkUrl,
    required String transactionRequestHexOrJson}) async {
  final provider = fuels.Provider(bridge: _bridge, nodeUrl: networkUrl);
  final bytes = hex.decode(removeHexPrefix(transactionRequestHexOrJson));
  final txCost = await provider.estimateTransactionCost(
      encodedTx: Uint8List.fromList(bytes));
  return TransactionCost(
    gasPrice: txCost.gasPrice,
    gasUsed: txCost.gasUsed,
    minFee: txCost.totalFee,
    maxFee: txCost.totalFee,
  );
}