Skip to content

Commit 2997785

Browse files
authored
fix: Bump @metamask/transaction-pay-controller to ^16.5.0, Predict Withdraw fix (#27422)
## **Description** Bumps @metamask/transaction-pay-controller to ^16.5.0 and includes a Predict Withdraw fix (subtract MM fee in UI). ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: #26927 #26934 #26929 ## **Manual testing steps** ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] 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). - [ ] I've completed the PR template to the best of my ability - [ ] I've included tests if applicable - [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] 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. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Updates withdrawal receive-amount calculation and bumps `@metamask/transaction-pay-controller`, which can affect fee math and transaction-pay flows. Risk is moderated by the change being localized to fee totals display and dependency updates, but regressions could impact user-facing quotes. > > **Overview** > Fixes the withdrawal confirmation *"You’ll receive"* calculation by subtracting the `metaMask` fee (in addition to provider and network fees) when computing the displayed USD receive amount. > > Bumps `@metamask/transaction-pay-controller` to `^16.5.0` (and updates related lockfile dependencies), and refreshes test fixtures/snapshots to include new `AssetsController.selectedCurrency` state. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 7c57579. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
1 parent 249c5c3 commit 2997785

File tree

5 files changed

+81
-129
lines changed

5 files changed

+81
-129
lines changed

app/components/Views/confirmations/components/rows/receive-row/receive-row.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ export function ReceiveRow({ inputAmountUsd }: ReceiveRowProps) {
4242
const targetNetworkFee = new BigNumber(
4343
totals.fees?.targetNetwork?.usd ?? 0,
4444
);
45+
const metaMaskFee = new BigNumber(totals.fees?.metaMask?.usd ?? 0);
4546

46-
const totalFees = providerFee.plus(sourceNetworkFee).plus(targetNetworkFee);
47+
const totalFees = providerFee
48+
.plus(sourceNetworkFee)
49+
.plus(targetNetworkFee)
50+
.plus(metaMaskFee);
4751
const youReceive = inputUsd.minus(totalFees);
4852
return formatFiat(youReceive.isPositive() ? youReceive : new BigNumber(0));
4953
}, [totals, formatFiat, inputAmountUsd]);

app/util/logs/__snapshots__/index.test.ts.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ exports[`logs :: generateStateLogs Sanitized SeedlessOnboardingController State
4747
"assetsInfo": {},
4848
"assetsPrice": {},
4949
"customAssets": {},
50+
"selectedCurrency": "usd",
5051
},
5152
"AuthenticationController": {
5253
"isSignedIn": false,
@@ -911,6 +912,7 @@ exports[`logs :: generateStateLogs generates a valid json export 1`] = `
911912
"assetsInfo": {},
912913
"assetsPrice": {},
913914
"customAssets": {},
915+
"selectedCurrency": "usd",
914916
},
915917
"AuthenticationController": {
916918
"isSignedIn": false,

app/util/test/initial-background-state.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,8 @@
469469
"assetsBalance": {},
470470
"assetsInfo": {},
471471
"assetsPrice": {},
472-
"customAssets": {}
472+
"customAssets": {},
473+
"selectedCurrency": "usd"
473474
},
474475
"PermissionController": {
475476
"subjects": {}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@
309309
"@metamask/swappable-obj-proxy": "^2.1.0",
310310
"@metamask/swaps-controller": "^15.0.0",
311311
"@metamask/transaction-controller": "^62.19.0",
312-
"@metamask/transaction-pay-controller": "^16.4.0",
312+
"@metamask/transaction-pay-controller": "^16.5.0",
313313
"@metamask/tron-wallet-snap": "1.22.1",
314314
"@metamask/utils": "^11.8.1",
315315
"@myx-trade/sdk": "^0.1.265",

0 commit comments

Comments
 (0)