getTransactionFee method

Future<TransactionFee> getTransactionFee(
  1. Transaction transaction
)

Get transaction fees

Implementation

Future<TransactionFee> getTransactionFee(Transaction transaction) async {
  final jsonRPCRequest = setJsonRPCRequest(
    'estimate_transaction_fee',
    {
      'transaction': jsonDecode(
        transaction.toNodeRPC(),
      ),
    },
  );

  _logger.fine('getTransactionFee: requestHttp.body=$jsonRPCRequest');

  final responseHttp = await http.post(
    Uri.parse('$endpoint/api/rpc'),
    body: jsonRPCRequest,
    headers: kRequestHeaders,
  );
  _logger.fine('getTransactionFee: responseHttp.body=${responseHttp.body}');
  final result = getJsonRPCResult(responseHttp.body);

  return TransactionFee.fromJson(
    result,
  );
}