getTransactionFee method

Future<TransactionFee> getTransactionFee(
  1. Transaction transaction
)

Get transaction fees @param {Object} tx Transaction to estimate fees

Implementation

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

  log(
    'getTransactionFee: requestHttp.body=$jsonRPCRequest',
    logsActivation: logsActivation,
  );

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

  return TransactionFee.fromJson(
    result,
  );
}