Skip to content

fix: ARC bridge/swap USDC hide max button + cleanup#32108

Open
maxime-oe wants to merge 1 commit into
mainfrom
fix/arc-bridge-swap-USDC-cleanup
Open

fix: ARC bridge/swap USDC hide max button + cleanup#32108
maxime-oe wants to merge 1 commit into
mainfrom
fix/arc-bridge-swap-USDC-cleanup

Conversation

@maxime-oe

@maxime-oe maxime-oe commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Description

Changelog

CHANGELOG entry: hide max button for ARC USDC Swap

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

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.

useTokensWithBalance now overrides native-address token decimals from getNativeAssetForChainId before EVM balance math, so formatted balances and the decimals field stay aligned when TokensController has stale 18-decimal data.

Adds parseUnitsSafe (rounds fractional amounts up to the token’s precision, then parseUnits) and wires it into useHasSufficientGas and useHasSufficientGasEvenIfGasIncludedOrSponsored instead of raw ethers.utils.parseUnits, avoiding under-counting when quote gas strings exceed decimal precision.

Pins @metamask/bridge-controller to preview 75.1.1-preview-2c09cc947 via package.json resolutions (with matching yarn.lock updates).

Reviewed by Cursor Bugbot for commit 0195ea1. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label Jun 19, 2026
@mm-token-exchange-service mm-token-exchange-service Bot added the team-networks Networks team label Jun 19, 2026
@mm-token-exchange-service

Copy link
Copy Markdown

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Description section is empty. Describe what changed and why.
  • Related issues section is empty. Add Fixes: #123 / Closes: <URL> / Refs: <Jira key>, or write a short rationale after the colon.
  • Manual testing steps still contain template content (the Gherkin example title or a [...] placeholder). Replace with real steps, or write N/A — <reason>.
  • Screenshots/Recordings section is empty. Add an image/video for user-facing changes, logs/console output for non-user-facing changes, or write N/A if no evidence is applicable.
  • Pre-merge author checklist has unchecked items (e.g. "I've followed MetaMask Contributor Docs and MetaMask Mobile Coding Standards."). Every box must be consciously checked — see docs/readme/ready-for-review.md.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@socket-security

socket-security Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​metamask/​bridge-controller@​75.1.1-preview-2c09cc94700000

View full report

@maxime-oe maxime-oe marked this pull request as ready for review June 19, 2026 16:45
@maxime-oe maxime-oe requested a review from a team as a code owner June 19, 2026 16:45

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread app/components/UI/Bridge/hooks/useTokensWithBalance/index.ts Outdated
@github-actions github-actions Bot added the risk:high AI analysis: high risk label Jun 19, 2026
@maxime-oe maxime-oe force-pushed the fix/arc-bridge-swap-USDC-cleanup branch from 82fe9fe to 0195ea1 Compare June 19, 2026 17:50
@maxime-oe maxime-oe removed the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label Jun 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations, SmokeIdentity, SmokeNetworkAbstractions, SmokeNetworkExpansion, SmokeSwap, SmokeStake, SmokeWalletPlatform, SmokeMoney, SmokePerps, SmokeMultiChainAPI, SmokePredictions, SmokeSeedlessOnboarding, SmokeBrowser, SmokeSnaps
  • Selected Performance tags: @PerformanceSwaps
  • Risk Level: high
  • AI Confidence: 100%
click to see 🤖 AI reasoning details

E2E Test Selection:
Hard rule (controller-version-update): @MetaMask controller package version updated in package.json: @metamask/bridge-controller. Running all tests.

Performance Test Selection:
The package.json adds a resolution for a preview version of @metamask/bridge-controller, and the hook changes affect token balance computation and gas fee calculations in the swap/bridge flow. These changes could impact swap quote fetching and execution performance. The @PerformanceSwaps tag covers quote fetching, token selection, swap execution, and transaction completion times — all of which are touched by these changes.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

⚡ Performance Test Results

ℹ️ Performance test results are currently non-blocking and will not block this PR.

All tests passed · 2 tests · 1 device

📱 Devices tested (1)

Android: Google Pixel 8 Pro (v14.0)

✅ Passed Tests (2)
Test Platform Device Duration Team Recording
Swap flow - ETH to LINK, SRP 1 + SRP 2 + SRP 3 Android Google Pixel 8 Pro (v14.0) 3.74s @swap-bridge-dev-team 📹 Watch
Cross-chain swap flow - ETH to SOL - 50+ accounts, SRP 1 + SRP 2 + SRP 3 Android Google Pixel 8 Pro (v14.0) 5.27s @swap-bridge-dev-team 📹 Watch

Branch: fix/arc-bridge-swap-USDC-cleanup · Build: Normal · Commit: 45c5f47 · View full run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:high AI analysis: high risk size-S team-networks Networks team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant