fix(transaction-pay-controller): stop adding subsidized fee to target amount#8488
Merged
matthewwalsh0 merged 3 commits intomainfrom Apr 17, 2026
Merged
Conversation
Member
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
… amount Relay now returns currencyOut as the full amount the user receives, with subsidized fees no longer deducted from the output. Our code was adding the subsidized fee back to the target amount for EXACT_INPUT trade types, which now double-counts the fee.
b284401 to
7a08f64
Compare
cryptotavares
approved these changes
Apr 17, 2026
5 tasks
github-merge-queue bot
pushed a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Apr 17, 2026
…2.1 (#28978) ## **Description** Bumps `@metamask/transaction-pay-controller` from `^19.1.1` to `^19.2.1`. ### Changes included (since 19.1.1) **19.2.1** - Fix: Resolve correct `networkClientId` for source chain in Relay execute flow ([#8492](MetaMask/core#8492)) - Fix: Stop double-counting subsidized fees in Relay quote target amounts ([#8488](MetaMask/core#8488)) **19.2.0** - Bump `@metamask/ramps-controller` from `^13.1.0` to `^13.2.0` - Bump `@metamask/transaction-controller` from `^64.2.0` to `^64.3.0` **19.1.3** - Bump `@metamask/assets-controller` from `^5.0.1` to `^6.0.0` - Bump `@metamask/bridge-controller` from `^70.1.0` to `^70.1.1` - Fix: Resolve the effective transaction type from `nestedTransactions` when the parent is a batch transaction **19.1.2** - Bump `@metamask/base-controller` from `^9.0.1` to `^9.1.0` - Bump `@metamask/assets-controller` from `^5.0.0` to `^5.0.1` - Bump `@metamask/assets-controllers` from `^103.1.1` to `^104.0.0` - Bump `@metamask/bridge-controller` from `^70.0.1` to `^70.1.0` ## **Changelog** CHANGELOG entry: null ## **Related issues** ## **Manual testing steps** ## **Screenshots/Recordings** ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Dependency bumps touch transaction/bridge/payment controller logic, which can affect critical send/relay flows. There is also a likely compile/runtime issue from removing `NETWORK_CHAIN_ID.MANTLE` while it’s still referenced in the image mapping. > > **Overview** > Updates MetaMask core transaction dependencies, bumping `@metamask/transaction-pay-controller` to `^19.2.1` and aligning related controllers in `yarn.lock` (notably `@metamask/transaction-controller` to `64.3.0`, plus newer `assets`/`bridge`/`ramps` controller versions). > > Removes the `MANTLE` entry from `NETWORK_CHAIN_ID` in `customNetworks.tsx` while leaving `CustomNetworkImgMapping` referencing `NETWORK_CHAIN_ID.MANTLE`, which may break builds/type-checking or runtime mapping for Mantle. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 78d9b57. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
vinnyhoward
pushed a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Apr 17, 2026
…2.1 (#28978) ## **Description** Bumps `@metamask/transaction-pay-controller` from `^19.1.1` to `^19.2.1`. ### Changes included (since 19.1.1) **19.2.1** - Fix: Resolve correct `networkClientId` for source chain in Relay execute flow ([#8492](MetaMask/core#8492)) - Fix: Stop double-counting subsidized fees in Relay quote target amounts ([#8488](MetaMask/core#8488)) **19.2.0** - Bump `@metamask/ramps-controller` from `^13.1.0` to `^13.2.0` - Bump `@metamask/transaction-controller` from `^64.2.0` to `^64.3.0` **19.1.3** - Bump `@metamask/assets-controller` from `^5.0.1` to `^6.0.0` - Bump `@metamask/bridge-controller` from `^70.1.0` to `^70.1.1` - Fix: Resolve the effective transaction type from `nestedTransactions` when the parent is a batch transaction **19.1.2** - Bump `@metamask/base-controller` from `^9.0.1` to `^9.1.0` - Bump `@metamask/assets-controller` from `^5.0.0` to `^5.0.1` - Bump `@metamask/assets-controllers` from `^103.1.1` to `^104.0.0` - Bump `@metamask/bridge-controller` from `^70.0.1` to `^70.1.0` ## **Changelog** CHANGELOG entry: null ## **Related issues** ## **Manual testing steps** ## **Screenshots/Recordings** ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Dependency bumps touch transaction/bridge/payment controller logic, which can affect critical send/relay flows. There is also a likely compile/runtime issue from removing `NETWORK_CHAIN_ID.MANTLE` while it’s still referenced in the image mapping. > > **Overview** > Updates MetaMask core transaction dependencies, bumping `@metamask/transaction-pay-controller` to `^19.2.1` and aligning related controllers in `yarn.lock` (notably `@metamask/transaction-controller` to `64.3.0`, plus newer `assets`/`bridge`/`ramps` controller versions). > > Removes the `MANTLE` entry from `NETWORK_CHAIN_ID` in `customNetworks.tsx` while leaving `CustomNetworkImgMapping` referencing `NETWORK_CHAIN_ID.MANTLE`, which may break builds/type-checking or runtime mapping for Mantle. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 78d9b57. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Relay now returns
currencyOutas the full amount the user receives — subsidized fees are no longer deducted from the output. This was verified across all trade types (EXACT_INPUT,EXPECTED_OUTPUT), protocol versions (v2 — v1 is effectively dead), and execute/non-execute modes.Our
normalizeQuotecode was adding the subsidized fee USD amount back to the target amount forEXACT_INPUTtrades, which now double-counts the fee. For example, on a 0.032 USDC → mUSD swap with ~$2.10 in subsidized fees, the target amount was being inflated to ~$2.13 instead of the correct ~$0.032.Changes
additionalTargetAmountUsdlogic fromnormalizeQuoteinrelay-quotes.tssubsidizedFeeUsdis still used for zeroing the provider fee when fees are subsidized (unchanged)References
Verified via live API calls to
https://intents.dev-api.cx.metamask.io/relay/quote:currencyOut.amountsubsidized.amountUsdNote
Medium Risk
Changes how Relay
targetAmountfiat/USD values are computed, which can affect user-visible quote/totals for max-amount flows. Risk is limited to quote presentation/math and is covered by updated unit tests.Overview
Prevents Relay quote normalization (
relay-quotes.ts) from adding subsidized fee USD back into the target amount, avoiding double-counting now that Relay returnscurrencyOutas the full user-received amount.Updates Relay quote tests to assert subsidized fees do not change
targetAmount(including stablecoin-fee cases) and records the fix in theCHANGELOG.Reviewed by Cursor Bugbot for commit 7a08f64. Bugbot is set up for automated code reviews on this repo. Configure here.