MCPcopy Create free account
hub / github.com/wevm/viem / assertTransactionLegacy

Function assertTransactionLegacy

src/utils/transaction/assertTransaction.ts:144–158  ·  view source on GitHub ↗
(
  transaction: TransactionSerializableLegacy,
)

Source from the content-addressed store, hash-verified

142 | ErrorType
143
144export function assertTransactionLegacy(
145 transaction: TransactionSerializableLegacy,
146) {
147 const { chainId, maxPriorityFeePerGas, gasPrice, maxFeePerGas, to } =
148 transaction
149 if (to && !isAddress(to)) throw new InvalidAddressError({ address: to })
150 if (typeof chainId !== 'undefined' && chainId <= 0)
151 throw new InvalidChainIdError({ chainId })
152 if (maxPriorityFeePerGas || maxFeePerGas)
153 throw new BaseError(
154 '`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.',
155 )
156 if (gasPrice && gasPrice > maxUint256)
157 throw new FeeCapTooHighError({ maxFeePerGas: gasPrice })
158}

Callers 3

Calls 1

isAddressFunction · 0.50

Tested by

no test coverage detected