Skip to content

fix: avoid fees in intent based swaps sent amount calculation#8845

Open
satyajeetkolhapure wants to merge 5 commits into
mainfrom
fix/sent-amount-for-intent-swaps
Open

fix: avoid fees in intent based swaps sent amount calculation#8845
satyajeetkolhapure wants to merge 5 commits into
mainfrom
fix/sent-amount-for-intent-swaps

Conversation

@satyajeetkolhapure
Copy link
Copy Markdown

@satyajeetkolhapure satyajeetkolhapure commented May 18, 2026

Explanation

Intent based swaps fees are already considered in sent amount. As the solvers take care of fees internally on provider side.
The current sent amount logic does add fees again in the calculation and shows larger amount than the actual amount sent.

This PR skips the fees from sent amount calculation logic resulting in correct amount.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Adjusts user-facing sent amount calculations for intent-based swaps, which could affect displayed totals and any downstream logic that relies on calcSentAmount outputs. Change is localized and covered by a new unit test, but impacts monetary amounts.

Overview
Fixes calcSentAmount to skip adding feeData source-token fees when a quote is intent-based (i.e., has intent), preventing protocol fees from being double-counted in the sent amount.

Adds a regression test for an intent-based quote scenario and updates the bridge-controller changelog to document the fix.

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

@satyajeetkolhapure satyajeetkolhapure self-assigned this May 18, 2026
@satyajeetkolhapure satyajeetkolhapure requested a review from a team as a code owner May 18, 2026 16:08
@Akaryatrh
Copy link
Copy Markdown
Contributor

@metamaskbot publish-preview

@github-actions
Copy link
Copy Markdown
Contributor

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/account-tree-controller@7.4.0-preview-f38d551fa
@metamask-previews/accounts-controller@38.1.1-preview-f38d551fa
@metamask-previews/address-book-controller@7.1.2-preview-f38d551fa
@metamask-previews/ai-controllers@0.6.3-preview-f38d551fa
@metamask-previews/analytics-controller@1.0.1-preview-f38d551fa
@metamask-previews/analytics-data-regulation-controller@0.0.0-preview-f38d551fa
@metamask-previews/announcement-controller@8.1.0-preview-f38d551fa
@metamask-previews/app-metadata-controller@2.0.1-preview-f38d551fa
@metamask-previews/approval-controller@9.0.1-preview-f38d551fa
@metamask-previews/assets-controller@7.1.2-preview-f38d551fa
@metamask-previews/assets-controllers@108.1.0-preview-f38d551fa
@metamask-previews/authenticated-user-storage@2.0.0-preview-f38d551fa
@metamask-previews/base-controller@9.1.0-preview-f38d551fa
@metamask-previews/base-data-service@0.1.3-preview-f38d551fa
@metamask-previews/bridge-controller@72.0.4-preview-f38d551fa
@metamask-previews/bridge-status-controller@71.1.4-preview-f38d551fa
@metamask-previews/build-utils@3.0.4-preview-f38d551fa
@metamask-previews/chain-agnostic-permission@1.6.1-preview-f38d551fa
@metamask-previews/chomp-api-service@3.1.0-preview-f38d551fa
@metamask-previews/claims-controller@0.5.1-preview-f38d551fa
@metamask-previews/client-controller@1.0.1-preview-f38d551fa
@metamask-previews/compliance-controller@2.0.1-preview-f38d551fa
@metamask-previews/composable-controller@12.0.1-preview-f38d551fa
@metamask-previews/config-registry-controller@0.3.1-preview-f38d551fa
@metamask-previews/connectivity-controller@0.2.0-preview-f38d551fa
@metamask-previews/controller-utils@12.1.0-preview-f38d551fa
@metamask-previews/core-backend@6.3.0-preview-f38d551fa
@metamask-previews/delegation-controller@3.0.0-preview-f38d551fa
@metamask-previews/earn-controller@12.1.2-preview-f38d551fa
@metamask-previews/eip-5792-middleware@3.0.4-preview-f38d551fa
@metamask-previews/eip-7702-internal-rpc-middleware@0.1.1-preview-f38d551fa
@metamask-previews/eip1193-permission-middleware@2.0.1-preview-f38d551fa
@metamask-previews/ens-controller@19.1.3-preview-f38d551fa
@metamask-previews/eth-block-tracker@15.0.1-preview-f38d551fa
@metamask-previews/eth-json-rpc-middleware@23.1.3-preview-f38d551fa
@metamask-previews/eth-json-rpc-provider@6.0.1-preview-f38d551fa
@metamask-previews/foundryup@1.0.1-preview-f38d551fa
@metamask-previews/gas-fee-controller@26.2.2-preview-f38d551fa
@metamask-previews/gator-permissions-controller@4.1.2-preview-f38d551fa
@metamask-previews/geolocation-controller@0.1.3-preview-f38d551fa
@metamask-previews/json-rpc-engine@10.5.0-preview-f38d551fa
@metamask-previews/json-rpc-middleware-stream@8.0.8-preview-f38d551fa
@metamask-previews/keyring-controller@25.5.0-preview-f38d551fa
@metamask-previews/logging-controller@8.0.2-preview-f38d551fa
@metamask-previews/message-manager@14.1.2-preview-f38d551fa
@metamask-previews/messenger@1.2.0-preview-f38d551fa
@metamask-previews/messenger-cli@0.2.0-preview-f38d551fa
@metamask-previews/money-account-balance-service@1.0.2-preview-f38d551fa
@metamask-previews/money-account-controller@0.3.0-preview-f38d551fa
@metamask-previews/money-account-upgrade-controller@2.0.2-preview-f38d551fa
@metamask-previews/multichain-account-service@10.0.0-preview-f38d551fa
@metamask-previews/multichain-api-middleware@3.1.2-preview-f38d551fa
@metamask-previews/multichain-network-controller@3.1.2-preview-f38d551fa
@metamask-previews/multichain-transactions-controller@7.1.0-preview-f38d551fa
@metamask-previews/name-controller@9.1.2-preview-f38d551fa
@metamask-previews/network-controller@32.0.0-preview-f38d551fa
@metamask-previews/network-enablement-controller@5.2.0-preview-f38d551fa
@metamask-previews/notification-services-controller@24.1.0-preview-f38d551fa
@metamask-previews/passkey-controller@2.0.1-preview-f38d551fa
@metamask-previews/permission-controller@13.1.1-preview-f38d551fa
@metamask-previews/permission-log-controller@5.1.0-preview-f38d551fa
@metamask-previews/perps-controller@6.1.0-preview-f38d551fa
@metamask-previews/phishing-controller@17.2.0-preview-f38d551fa
@metamask-previews/polling-controller@16.0.6-preview-f38d551fa
@metamask-previews/preferences-controller@23.1.0-preview-f38d551fa
@metamask-previews/profile-metrics-controller@3.1.4-preview-f38d551fa
@metamask-previews/profile-sync-controller@28.1.0-preview-f38d551fa
@metamask-previews/ramps-controller@13.3.1-preview-f38d551fa
@metamask-previews/rate-limit-controller@7.0.1-preview-f38d551fa
@metamask-previews/react-data-query@0.2.1-preview-f38d551fa
@metamask-previews/remote-feature-flag-controller@4.2.1-preview-f38d551fa
@metamask-previews/sample-controllers@5.0.1-preview-f38d551fa
@metamask-previews/seedless-onboarding-controller@9.1.0-preview-f38d551fa
@metamask-previews/selected-network-controller@26.1.3-preview-f38d551fa
@metamask-previews/shield-controller@5.1.2-preview-f38d551fa
@metamask-previews/signature-controller@39.2.2-preview-f38d551fa
@metamask-previews/snap-account-service@0.2.0-preview-f38d551fa
@metamask-previews/social-controllers@2.2.1-preview-f38d551fa
@metamask-previews/storage-service@1.0.1-preview-f38d551fa
@metamask-previews/subscription-controller@6.1.3-preview-f38d551fa
@metamask-previews/transaction-controller@65.4.0-preview-f38d551fa
@metamask-previews/transaction-pay-controller@22.5.0-preview-f38d551fa
@metamask-previews/user-operation-controller@41.2.2-preview-f38d551fa
@metamask-previews/wallet@0.0.0-preview-f38d551fa

@satyajeetkolhapure satyajeetkolhapure requested a review from a team as a code owner May 19, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants