Try it Live
Run FeeMarket examples in the interactive playground
FeeMarket Utilities
Validation and conversion utilities.Validation
validateTxFeeParams
params- Transaction or blob transaction fee parameters
TxFeeParams):
maxFeePerGas >= 0maxPriorityFeePerGas >= 0maxPriorityFeePerGas <= maxFeePerGasbaseFee >= 0
BlobTxFeeParams), additionally:
maxFeePerBlobGas >= 0blobBaseFee >= 01 <= blobCount <= 6
validateState
state- Block fee market state
gasUsed >= 0gasLimit > 0gasUsed <= gasLimitbaseFee >= MIN_BASE_FEE(7 wei)excessBlobGas >= 0blobGasUsed >= 0blobGasUsed <= MAX_BLOB_GAS_PER_BLOCK(786432)
Conversion
weiToGwei
wei- Amount in wei
gweiToWei
gwei- Amount in gwei (JavaScript number)
Combined Usage
Validate and Display
State Validation Pipeline
User Input Validation
Implementation
Locations:BrandedFeeMarket/validateTxFeeParams.jsBrandedFeeMarket/validateState.jsBrandedFeeMarket/weiToGwei.jsBrandedFeeMarket/gweiToWei.js

