Commit e30b500
authored
fix: MM pay request amount used when both paymentProvider and isPostQuote is defined (MetaMask#9070)
## 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
- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [X] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [X] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
<!-- CURSOR_SUMMARY -->
---
> [!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 **`paymentOverride` is
Money Account** and **`isPostQuote`** is true: the relay request
**`amount`** for **`EXACT_OUTPUT`** now comes from
**`transactionData.tokens[0].amountRaw`** instead of
**`request.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/missing **`transactionData`**; the
package changelog records the fix.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
6d89828. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 4bf4fda commit e30b500
3 files changed
Lines changed: 98 additions & 4 deletions
File tree
- packages/transaction-pay-controller
- src/strategy/relay
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
| |||
Lines changed: 93 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3073 | 3073 | | |
3074 | 3074 | | |
3075 | 3075 | | |
| 3076 | + | |
3076 | 3077 | | |
3077 | 3078 | | |
3078 | 3079 | | |
3079 | 3080 | | |
3080 | 3081 | | |
| 3082 | + | |
3081 | 3083 | | |
3082 | 3084 | | |
3083 | 3085 | | |
3084 | 3086 | | |
3085 | 3087 | | |
3086 | 3088 | | |
3087 | 3089 | | |
3088 | | - | |
| 3090 | + | |
3089 | 3091 | | |
3090 | 3092 | | |
3091 | 3093 | | |
| |||
3097 | 3099 | | |
3098 | 3100 | | |
3099 | 3101 | | |
3100 | | - | |
| 3102 | + | |
3101 | 3103 | | |
3102 | 3104 | | |
3103 | 3105 | | |
| |||
3116 | 3118 | | |
3117 | 3119 | | |
3118 | 3120 | | |
3119 | | - | |
| 3121 | + | |
| 3122 | + | |
| 3123 | + | |
| 3124 | + | |
| 3125 | + | |
| 3126 | + | |
| 3127 | + | |
| 3128 | + | |
| 3129 | + | |
| 3130 | + | |
| 3131 | + | |
| 3132 | + | |
| 3133 | + | |
| 3134 | + | |
| 3135 | + | |
| 3136 | + | |
| 3137 | + | |
| 3138 | + | |
| 3139 | + | |
| 3140 | + | |
| 3141 | + | |
| 3142 | + | |
| 3143 | + | |
| 3144 | + | |
| 3145 | + | |
| 3146 | + | |
| 3147 | + | |
| 3148 | + | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
| 3156 | + | |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
| 3161 | + | |
| 3162 | + | |
| 3163 | + | |
| 3164 | + | |
| 3165 | + | |
| 3166 | + | |
| 3167 | + | |
| 3168 | + | |
| 3169 | + | |
| 3170 | + | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
| 3189 | + | |
| 3190 | + | |
| 3191 | + | |
| 3192 | + | |
| 3193 | + | |
| 3194 | + | |
| 3195 | + | |
| 3196 | + | |
| 3197 | + | |
| 3198 | + | |
| 3199 | + | |
| 3200 | + | |
| 3201 | + | |
| 3202 | + | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
| 3206 | + | |
| 3207 | + | |
| 3208 | + | |
| 3209 | + | |
3120 | 3210 | | |
3121 | 3211 | | |
3122 | 3212 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
464 | 464 | | |
465 | 465 | | |
466 | 466 | | |
467 | | - | |
| 467 | + | |
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
| |||
0 commit comments