Skip to content

fix: gas fees sponsored full swap native in transaction display#28930

Merged
Battambang merged 3 commits into
mainfrom
fix/full-swap-native-gas-fees-sponsored
Apr 16, 2026
Merged

fix: gas fees sponsored full swap native in transaction display#28930
Battambang merged 3 commits into
mainfrom
fix/full-swap-native-gas-fees-sponsored

Conversation

@Battambang
Copy link
Copy Markdown
Contributor

@Battambang Battambang commented Apr 16, 2026

Description

This pull request updates how the source token amount is displayed for gas-sponsored swap transactions, ensuring that the full amount sent by the user is shown instead of the post-fee amount. The changes affect both the transaction details UI and the transaction history decoding logic, and include new tests and mock data to cover this scenario.
The fix mirror the extension's display logic for this use case.

Gas-sponsored transaction handling:

  • Updated BridgeTransactionDetails to display the full user amount (pricingData.amountSent) when quote.gasSponsored is true, instead of the fee-deducted srcTokenAmount. (app/components/UI/Bridge/components/TransactionDetails/TransactionDetails.tsx)
  • Modified decodeSwapsTx to use pricingData.amountSent for gas-sponsored transactions, ensuring transaction history reflects the correct sent amount. (app/components/UI/Bridge/utils/transaction-history.ts)

Testing and mock data:

  • Added a new test to verify that the full amount is displayed for gas-sponsored transactions in the transaction details component. (app/components/UI/Bridge/components/TransactionDetails/TransactionDetails.test.tsx)
  • Added a new test to ensure decodeSwapsTx uses pricingData.amountSent when gas is sponsored. (app/components/UI/Bridge/utils/transaction-history.test.ts)
  • Extended the mock bridge transaction state with a gas-sponsored transaction example, including all relevant fields for accurate testing. (app/components/UI/Bridge/_mocks_/initialState.ts)

Changelog

CHANGELOG entry: display correct amount in swap native in transaction display for gas fees sponsored trx

Related issues

Fixes:

Manual testing steps

Feature: display the full amount swapped by the user

  Scenario: user swaps native token to any tokens
    Given the network is gas fees sponsored

    When user swaps max amount SEI for USDC 
    Then the transaction history should display the full amount sent

Screenshots/Recordings

Swapping 0.1 SEI for USDC on SEI gas fees sponsored network

Before

SEI native swap BEFORE

After

SEI native swap Activity trx AFTER SEI native swap details 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

Low Risk
Display-only changes that switch the source amount calculation for a specific gas-sponsored swap case; covered by new unit tests and mock state.

Overview
Fixes gas-sponsored swap/bridge UI and activity decoding to show the full user sent amount (pricingData.amountSent) instead of the fee-deducted quote.srcTokenAmount.

Updates BridgeTransactionDetails and decodeSwapsTx to prefer pricingData.amountSent when quote.gasSponsored is true, and adds a dedicated gas-sponsored transaction fixture plus tests to prevent regressions in both the details screen and transaction history decoding.

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

@Battambang Battambang requested a review from a team as a code owner April 16, 2026 15:36
@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.

@metamaskbotv2 metamaskbotv2 Bot added the team-networks Networks team label Apr 16, 2026
@github-actions github-actions Bot added size-M risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 16, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

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 2 potential issues.

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 3f57b98. Configure here.

Comment thread app/components/UI/Bridge/utils/transaction-history.ts
@Battambang Battambang force-pushed the fix/full-swap-native-gas-fees-sponsored branch from 3f57b98 to 1d54e44 Compare April 16, 2026 15:57
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeTrade, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are targeted bug fixes in the Bridge transaction display logic:

  1. transaction-history.ts: decodeSwapsTx now uses pricingData.amountSent (full user amount) instead of srcTokenAmount (fee-deducted amount) when quote.gasSponsored is true. This fixes incorrect amount display in transaction history for gas-sponsored bridge/swap transactions.

  2. TransactionDetails.tsx: Same fix applied to BridgeTransactionDetails component - sourceTokenAmount now correctly shows the full amount from pricingData.amountSent for gas-sponsored transactions.

  3. Test files and mock state updated to cover the new behavior.

SmokeTrade is selected because these changes directly affect bridge/swap transaction history display and the TransactionDetails component used in bridge flows. SmokeConfirmations is required per the tag dependency rule: "When selecting SmokeTrade for swap or bridge flows, also select SmokeConfirmations."

No other tags are needed as the changes are isolated to Bridge UI components and utilities, with no impact on accounts, identity, network management, onboarding, or other wallet features.

Performance Test Selection:
The changes are purely display/formatting logic fixes for gas-sponsored bridge transaction amounts. No performance-sensitive code paths (rendering loops, state management, data loading, app startup) are affected. No performance tests are needed.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@Battambang Battambang enabled auto-merge April 16, 2026 16:31
@github-project-automation github-project-automation Bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Apr 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
11 value mismatches detected (expected — fixture represents an existing user).
View details

@Battambang Battambang added this pull request to the merge queue Apr 16, 2026
Merged via the queue into main with commit dbc74ea Apr 16, 2026
179 of 181 checks passed
@Battambang Battambang deleted the fix/full-swap-native-gas-fees-sponsored branch April 16, 2026 17:17
@github-project-automation github-project-automation Bot moved this from Review finalised - Ready to be merged to Merged, Closed or Archived in PR review queue Apr 16, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 16, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.74.0 Issue or pull request that will be included in release 7.74.0 label Apr 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.74.0 Issue or pull request that will be included in release 7.74.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-M team-networks Networks team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants