Skip to content

Add EIP-1559 (type 2) transaction signing for EVM swaps#71

Open
TimNooren wants to merge 1 commit intomainfrom
eip1559-signing
Open

Add EIP-1559 (type 2) transaction signing for EVM swaps#71
TimNooren wants to merge 1 commit intomainfrom
eip1559-signing

Conversation

@TimNooren
Copy link
Contributor

@TimNooren TimNooren commented Feb 25, 2026

Summary

  • Add signEip1559EvmTransaction() for type 2 EVM transaction signing
  • signEvmTransaction() now picks type 2 when the quote provides maxFeePerGas, falling back to legacy type 0 for gasPrice-only quotes
  • Pass top-level quote EIP-1559 fields (maxFeePerGas, maxPriorityFeePerGas) through to the signing function in the execute handler

With legacy (type 0), the chain charges the full gasPrice. With EIP-1559 (type 2), the chain charges baseFee + tip and refunds the difference vs maxFeePerGas. E2e tests on Base showed ~18% savings per gas unit.

Test plan

  • npm test — all 591 unit tests pass
  • npm run test:swap — e2e round-trip (ETH<->USDC on Base) passes
  • Verified both e2e transactions are type 2 on-chain via eth_getTransactionByHash
  • Confirmed effectiveGasPrice < maxFeePerGas (~18% refund per gas unit)

🤖 Generated with Claude Code

signEvmTransaction() now uses type 2 signing when the quote provides
maxFeePerGas, falling back to legacy type 0 for gasPrice-only quotes.
This avoids overpaying on chains where the base fee drops between
quoting and inclusion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Post Launch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants