fix: ARC bridge/swap USDC hide max button + cleanup#32108
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. |
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
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 82fe9fe. Configure here.
82fe9fe to
0195ea1
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
|
⚡ Performance Test Results
✅ All tests passed · 2 tests · 1 device 📱 Devices tested (1)Android: Google Pixel 8 Pro (v14.0) ✅ Passed Tests (2)
Branch: |




Description
Changelog
CHANGELOG entry: hide max button for ARC USDC Swap
Related issues
Fixes:
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
Changes token balance and gas sufficiency math in bridge flows; incorrect decimals or rounding could mis-state balances or block/allow swaps, though scope is limited to bridge hooks and a dependency preview pin.
Overview
Fixes bridge/swap balance and gas checks for chains whose native gas asset is not 18-decimal ETH (e.g. Arc native USDC at 6 decimals), which was skewing displayed balances and sufficiency logic.
useTokensWithBalancenow overrides native-address token decimals fromgetNativeAssetForChainIdbefore EVM balance math, so formatted balances and thedecimalsfield stay aligned when TokensController has stale 18-decimal data.Adds
parseUnitsSafe(rounds fractional amounts up to the token’s precision, thenparseUnits) and wires it intouseHasSufficientGasanduseHasSufficientGasEvenIfGasIncludedOrSponsoredinstead of rawethers.utils.parseUnits, avoiding under-counting when quote gas strings exceed decimal precision.Pins
@metamask/bridge-controllerto preview75.1.1-preview-2c09cc947viapackage.jsonresolutions (with matchingyarn.lockupdates).Reviewed by Cursor Bugbot for commit 0195ea1. Bugbot is set up for automated code reviews on this repo. Configure here.