(args: AssertRequestParameters)
| 33 | | ErrorType |
| 34 | |
| 35 | export function assertRequest(args: AssertRequestParameters) { |
| 36 | const { account: account_, maxFeePerGas, maxPriorityFeePerGas, to } = args |
| 37 | const account = account_ ? parseAccount(account_) : undefined |
| 38 | if (account && !isAddress(account.address)) |
| 39 | throw new InvalidAddressError({ address: account.address }) |
| 40 | if (to && !isAddress(to)) throw new InvalidAddressError({ address: to }) |
| 41 | |
| 42 | if (maxFeePerGas && maxFeePerGas > maxUint256) |
| 43 | throw new FeeCapTooHighError({ maxFeePerGas }) |
| 44 | if ( |
| 45 | maxPriorityFeePerGas && |
| 46 | maxFeePerGas && |
| 47 | maxPriorityFeePerGas > maxFeePerGas |
| 48 | ) |
| 49 | throw new TipAboveFeeCapError({ maxFeePerGas, maxPriorityFeePerGas }) |
| 50 | } |
no test coverage detected