Preflight
Preflight calculates the gas limit and fees to include in a signing request, and verifies before signing the allowance that a contract needs to transfer tokens on an owner's behalf. It supports gas limit estimation, retrieval of recent base fees and priority fees, and access list creation.
If you set the fee too low, the transaction stays pending without being included in a block, and later transactions from the same address are not processed either. If you set it too high, operating costs increase. With Preflight, you calculate a fee that fits current network conditions and check the allowance in advance, so you can process withdrawals without stalls or failures.
Use Cases
- Withdrawal OpsAutomatic withdrawal fee calculation
For each withdrawal request, calculate the priority fee from the fee distribution of recent blocks. You can process withdrawals without entering fees manually.
- Withdrawal OpsAvoid pending transactions during network congestion
Reflect the latest fees even when fees spike, so transactions do not stay pending. This reduces cases where a pending transaction delays later withdrawals from the same address.
- EngineeringPrevent failures caused by insufficient allowance
Before signing, check the allowance for transactions in which a contract transfers tokens on the owner's behalf. If the allowance is insufficient, process an approval transaction first to prevent the failure.
Available APIs
Gas Limit
Fees
Allowance
Recommended Sequence
- Estimate the gas limit required for execution with
eth_estimateGas. - Retrieve the fee distribution of recent blocks with
eth_feeHistoryand calculate the priority fee. - For transactions in which a contract transfers tokens on the owner's behalf, check with Get Token Allowance that the allowance is sufficient.
- Include the calculated gas limit and fees in the signing request. If gas estimation fails, do not submit the transaction; identify the cause with Simulation.