Skip to content

TransactionEnvelope Errors

TransactionEnvelope.FeeCapTooHighError

Thrown when a fee cap is too high.

Examples

import { TransactionEnvelopeEip1559 } from 'ox'
 
TransactionEnvelopeEip1559.assert({
  maxFeePerGas: 2n ** 256n - 1n + 1n,
  chainId: 1,
})
TransactionEnvelope.FeeCapTooHighError: The fee cap (`maxFeePerGas`/`maxPriorityFeePerGas` = 115792089237316195423570985008687907853269984665640564039457584007913.129639936 gwei) cannot be higher than the maximum allowed value (2^256-1).

Source: src/core/TransactionEnvelope.ts

TransactionEnvelope.GasPriceTooHighError

Thrown when a gas price is too high.

Examples

import { TransactionEnvelopeLegacy } from 'ox'
 
TransactionEnvelopeLegacy.assert({
  gasPrice: 2n ** 256n - 1n + 1n,
  chainId: 1,
})
TransactionEnvelope.GasPriceTooHighError: The gas price (`gasPrice` = 115792089237316195423570985008687907853269984665640564039457584007913.129639936 gwei) cannot be higher than the maximum allowed value (2^256-1).

Source: src/core/TransactionEnvelope.ts

TransactionEnvelope.InvalidChainIdError

Thrown when a chain ID is invalid.

Examples

import { TransactionEnvelopeEip1559 } from 'ox'
 
TransactionEnvelopeEip1559.assert({ chainId: 0 })
TransactionEnvelope.InvalidChainIdError: Chain ID "0" is invalid.

Source: src/core/TransactionEnvelope.ts

TransactionEnvelope.InvalidSerializedError

Thrown when a serialized transaction is invalid.

Examples

import { TransactionEnvelopeEip1559 } from 'ox'
 
TransactionEnvelopeEip1559.deserialize('0x02c0')
TransactionEnvelope.InvalidSerializedError: Invalid serialized transaction of type "eip1559" was provided.
Serialized Transaction: "0x02c0"
Missing Attributes: chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gas, to, value, data, accessList

Source: src/core/TransactionEnvelope.ts

TransactionEnvelope.TipAboveFeeCapError

Thrown when a tip is higher than a fee cap.

Examples

import { TransactionEnvelopeEip1559 } from 'ox'
 
TransactionEnvelopeEip1559.assert({
  chainId: 1,
  maxFeePerGas: 10n,
  maxPriorityFeePerGas: 11n,
})
TransactionEnvelope.TipAboveFeeCapError: The provided tip (`maxPriorityFeePerGas` = 11 gwei) cannot be higher than the fee cap (`maxFeePerGas` = 10 gwei).

Source: src/core/TransactionEnvelope.ts