setGasPrice method

void setGasPrice(
  1. BigInt gasPrice
)

Sets the gas price for the Ethereum transaction.

Throws a MessageException if the transaction type is EIP-1559, as gas price is not used in this type of transaction.

Implementation

void setGasPrice(BigInt gasPrice) {
  if (_type == ETHTransactionType.eip1559) {
    throw const MessageException(
        "Do not specify a gasPrice for non-legacy transactions.");
  }
  _gasPrice = gasPrice;
  _replaceTr();
}