setGasLimit method

void setGasLimit(
  1. Int64? limit
)

Sets the given limit as the gas limit to be used to execute the transaction.

Implementation

void setGasLimit(fixnum.Int64? limit) {
  // Do not include default values as per ADR-027
  if (limit == null || limit == 0) {
    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 gas limit
  _stdTx.authInfo.fee.gasLimit = limit;
}