setFeePayer method

void setFeePayer(
  1. String? payer
)

Sets the given payer as the transaction fee payer.

Implementation

void setFeePayer(String? payer) {
  // Do not include default values as per ADR-027
  if (payer == null || payer.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.payer = payer;
}