Skip to content

Conversation

@GeorgeGkas
Copy link
Contributor

@GeorgeGkas GeorgeGkas commented Nov 11, 2025

Description

Re validate gas fees after users move from swap to bridge while they have selected max balance on a gasless transaction.

Changelog

CHANGELOG entry: Re validate gas fees after users move from swap to bridge while they have selected max balance on a gasless transaction.

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-3417

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

Screenshot 2025-11-11 at 2 02 32 PM

Pre-merge author checklist

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

Updates useIsInsufficientBalance to include native-token gas and SOL rent checks, handle scientific notation, and adds thorough unit tests across tokens and edge cases.

  • Bridge hook useInsufficientBalance:
    • Handle native-token gas by summing sourceAmount + gasFee using quotes.recommendedQuote.gasFee.effective.amount when gasIncluded is false.
    • Preserve SOL rent exemption check using selectMinSolBalance with lamports comparison.
    • Normalize numeric inputs (incl. scientific notation) via BigNumber.js/normalizeAmount; validate decimal precision.
    • Refactor native token detection (isNativeAddress) and branch logic; early-return safeguards for invalid inputs and gasless swaps.
  • Tests:
    • Add comprehensive unit tests covering ERC-20 (gasless/cross-chain), ETH/MATIC native gas scenarios, SOL rent exemption, scientific notation, and edge cases (undefined inputs, no quote, zero balance).

Written by Cursor Bugbot for commit b1025b2. This will update automatically on new commits. Configure here.

@GeorgeGkas GeorgeGkas requested a review from a team as a code owner November 11, 2025 12:25
@github-actions
Copy link
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.

@metamaskbot metamaskbot added the team-swaps-and-bridge Swaps and Bridge team label Nov 11, 2025
@sonarqubecloud
Copy link

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

Labels

size-L team-swaps-and-bridge Swaps and Bridge team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants