setFeeAmount method

void setFeeAmount(
  1. List<Coin>? coins
)

Sets the given coins as the transaction fees.

Implementation

void setFeeAmount(List<Coin>? coins) {
  // Do not include default values as per ADR-027
  if (coins == null || coins.isEmpty) {
    return;
  }

  // Create auth info if not existing
  if (!_stdTx.hasAuthInfo()) {
    _stdTx.authInfo = AuthInfo.create();
  }

  // Create fee if not existing
  if (!_stdTx.authInfo.hasFee()) {
    _stdTx.authInfo.fee = Fee.create();
  }

  // Set the fee amount
  _stdTx.authInfo.fee.amount.clear();
  _stdTx.authInfo.fee.amount.addAll(coins);
}