feat: swap add warning msg when EVM native reserve#29712
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
8d8b7da to
7afc3b1
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7afc3b1. Configure here.
7afc3b1 to
dbb1325
Compare
dbb1325 to
1d06ecd
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag Selection Rationale:
No other tags are needed as changes are isolated to the Bridge/Swap UI components with no impact on accounts, networks, identity, snaps, browser, or other wallet features. Performance Test Selection: |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #29712 +/- ##
==========================================
+ Coverage 81.86% 81.87% +0.01%
==========================================
Files 5255 5272 +17
Lines 138980 139498 +518
Branches 31518 31701 +183
==========================================
+ Hits 113774 114216 +442
- Misses 17465 17520 +55
- Partials 7741 7762 +21 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|




Description
Problem statement:
10 MONfor Monad.MONin a swap that would put it's reserve below the10 MONthreshold.Proposed solution
insufficientBalparameter totrue.Use max availableCTA in the Alert Banner that will prefill automaticallybalance - minimumReserveas source amount. This solution ticks three boxes:Changelog
CHANGELOG entry: Swap/Bridge to warn user if native balance will go below a minimum threshold.
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/NEB-1113?atlOrigin=eyJpIjoiYmRkZGU5ZjE0MTRhNDM4OTgyNWZjOGJlMDU1YTliZDMiLCJwIjoiaiJ9
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Medium risk: changes swap/bridge quote-request parameters and submit gating, which can affect quote fetching and transaction eligibility on gas-sponsored networks (especially for native-token swaps). Logic is new but scoped and covered by unit tests and copy additions.
Overview
Adds detection for native-token minimum reserve constraints on gas-sponsored EVM networks (e.g., Monad), via a new
useInsufficientNativeReserveErrorhook that computes a required reserve and max swappable amount.When triggered, the Bridge view shows a dedicated warning banner with a “Use max allowed” CTA that pre-fills the allowable amount, disables the confirm button (labeling it as insufficient funds), and includes the condition in quote analytics warnings. Quote requests now set
insufficientBal=truewhen this reserve constraint is hit so quotes can still be fetched/displayed, and tests/i18n strings are added to cover the new behavior.Reviewed by Cursor Bugbot for commit 1d06ecd. Bugbot is set up for automated code reviews on this repo. Configure here.