Skip to content

feat(trade): bypass gas check for high-value trades eligible for gasless routing#443

Merged
kome12 merged 1 commit into
mainfrom
feat/gasless-bypass-high-value-trades
May 26, 2026
Merged

feat(trade): bypass gas check for high-value trades eligible for gasless routing#443
kome12 merged 1 commit into
mainfrom
feat/gasless-bypass-high-value-trades

Conversation

@araa47
Copy link
Copy Markdown
Contributor

@araa47 araa47 commented May 25, 2026

Summary

  • Trades >= $10 USD now skip the native gas pre-check because solver-paid (gasless) routes like Relay are viable at that value
  • The threshold is exported as GASLESS_MIN_TRADE_USD from trade-validation.js — one place to change it
  • When gas validation does fail (trade < $10 + insufficient gas), the error message now suggests either topping up gas or increasing the trade to $10+ as alternatives

How it works

validateGasBalance accepts an optional tradeValueUsd param. If the quote's inUsdValue is >= GASLESS_MIN_TRADE_USD, the RPC balance check is skipped entirely and the function returns { hasSufficientNative: true }.

The call site in the quote handler passes response.quotes[0].inUsdValue (already populated from the API response at that point).

Test plan

  • npm test passes (1479 tests)
  • npm run lint passes
  • New unit tests cover: bypass at exactly $10, bypass above $10, still validates below $10, error message includes gasless suggestion
  • Existing integration test (quote with inUsdValue: '5.00') still correctly rejects on insufficient gas

🤖 Generated with Claude Code

…ess routing

Trades >= $10 USD can use solver-paid (gasless) routes such as Relay, so
the native gas pre-check is no longer a blocker for them. The threshold is
exported as GASLESS_MIN_TRADE_USD for easy future adjustment.

When the check does fail (trade < $10, insufficient gas), the error now
also suggests increasing the trade value as an alternative to topping up gas.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@araa47 araa47 requested review from TimNooren and kome12 May 25, 2026 07:30
@kome12 kome12 merged commit 1daf2e0 into main May 26, 2026
7 checks passed
@kome12 kome12 deleted the feat/gasless-bypass-high-value-trades branch May 26, 2026 05:39
@github-actions github-actions Bot mentioned this pull request May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants