fix: MM pay request amount used when both paymentProvider and isPostQuote is defined#9070
Merged
Conversation
jpuri
commented
Jun 10, 2026
| requestBody.authorizationList = normalizeAuthorizationList(authorizationList); | ||
| requestBody.tradeType = 'EXACT_OUTPUT'; | ||
| requestBody.amount = request.sourceTokenAmount; | ||
| requestBody.amount = transactionData?.tokens?.[0]?.amountRaw ?? '0'; |
Contributor
Author
There was a problem hiding this comment.
request.sourceTokenAmount is raw value of source token and transactionData?.tokens?.[0]?.amountRaw is value in destination token which we need.
Using request.sourceTokenAmount is breaking perps withdraw as USDC has 8 decimal places but mUSD has 6 and relay expect mUSD value here so it result in 100X value of token and hence perps withdraw to Money Balance is failing in latest code.
matthewwalsh0
previously approved these changes
Jun 10, 2026
matthewwalsh0
previously approved these changes
Jun 10, 2026
matthewwalsh0
approved these changes
Jun 10, 2026
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
Fix MM pay request amount used when both paymentOverride and isPostQuote is defined.
References
Related to https://consensyssoftware.atlassian.net/browse/CONF-1520
Checklist
Note
Medium Risk
Changes payment quote amounts sent to the relay API for a specific MM Pay path; wrong amounts could affect funding quotes, though scope is narrow and well-tested.
Overview
Fixes MetaMask Pay relay quote bodies when
paymentOverrideis Money Account andisPostQuoteis true: the relay requestamountforEXACT_OUTPUTnow comes fromtransactionData.tokens[0].amountRawinstead ofrequest.sourceTokenAmount, so the quoted output matches the destination token’s units when decimals differ.Missing token data falls back to
'0'. Tests cover the new amount source, decimal mismatch, and empty/missingtransactionData; the package changelog records the fix.Reviewed by Cursor Bugbot for commit 6d89828. Bugbot is set up for automated code reviews on this repo. Configure here.