Commit 8ab3233
chore(runway): cherry-pick fix: hide big transaction fee on Perps withdraw when no quotes available cp-7.74.0 (#29314)
- fix: hide big transaction fee on Perps withdraw when no quotes
available cp-7.74.0 (#29313)
## **Description**
When no viable quote existed for a Perps withdraw (e.g. $0.1 → ETH on
Ethereum), the confirmation still showed a big transaction fee and an
enabled Withdraw button, letting the user submit into a failing
transaction.
`useNoPayTokenQuotesAlert`'s `isOptionalOnly` check was matching the
post-quote `sourceAmount.targetTokenAddress` (the destination token,
e.g. native ETH `0x0…0`) against a `skipIfBalance` required token on a
different chain (Arbitrum native gas, also `0x0…0`). That false match
suppressed the `NoPayTokenQuotes` alert. `isOptionalOnly` is only
meaningful for non-post-quote flows, so this PR bypasses it for
post-quote. The existing `CustomAmountInfo` logic then hides the fee
rows and shows the disabled "No quotes" button as designed.
## **Changelog**
CHANGELOG entry: Fixed Perps withdraw showing a transaction fee and
enabled button when no route was available; the rows now hide and the
button shows "No quotes".
## **Related issues**
Fixes:
[#29297](#29297)
## **Manual testing steps**
~~~gherkin
Feature: Perps withdraw handles missing quotes
Scenario: no viable quote for the amount
Given user is on the Perps withdraw confirmation
When user enters "0.1" and selects "ETH on Ethereum"
And user presses Done
Then "Transaction fee" and "You'll receive" rows are not shown
And the primary button shows "No quotes" and is disabled
Scenario: viable quote exists (regression)
Given user is on the Perps withdraw confirmation
When user enters a viable amount and selects any receive token
And user presses Done
Then "Transaction fee" and "You'll receive" rows are shown
And the primary button shows "Withdraw" and is enabled
~~~
## **Screenshots/Recordings**
### **Before**
<img width="448" height="221" alt="image"
src="https://github.com/user-attachments/assets/727d8f21-ce3a-41af-a90e-d30bcadc5c1b"
/>
### **After**
$0.1
<img width="460" height="220" alt="image"
src="https://github.com/user-attachments/assets/05877a43-e94a-46ff-85d4-0ad7844fd622"
/>
$0.5
<img width="457" height="240" alt="image"
src="https://github.com/user-attachments/assets/773271b5-a001-405b-b608-4c5fc6de9564"
/>
## **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
- [ ] 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**
> Changes blocking alert logic in transaction confirmations for
post-quote flows, which can affect whether users can proceed with
withdrawals; risk is moderated by targeted condition and added tests.
>
> **Overview**
> Fixes a false-negative in the `NoPayTokenQuotes` blocking alert for
*post-quote* flows by bypassing the `isOptionalOnly` (skip-if-balance)
suppression when `useTransactionPayIsPostQuote` is true, preventing
cross-chain native-token address collisions (e.g., `0x0…0`) from hiding
the no-quotes state.
>
> Adds/updates unit tests to cover the non-post-quote optional-token
case and a regression scenario where a post-quote destination token
address would previously suppress the alert.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f3b1072. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
[0769701](0769701)
Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
Co-authored-by: Daniel <80175477+dan437@users.noreply.github.com>1 parent 8705283 commit 8ab3233
2 files changed
Lines changed: 88 additions & 5 deletions
File tree
- app/components/Views/confirmations/hooks/alerts
Lines changed: 72 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| |||
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
53 | 62 | | |
54 | 63 | | |
55 | 64 | | |
| |||
66 | 75 | | |
67 | 76 | | |
68 | 77 | | |
| 78 | + | |
| 79 | + | |
69 | 80 | | |
70 | 81 | | |
71 | 82 | | |
| |||
137 | 148 | | |
138 | 149 | | |
139 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
140 | 212 | | |
Lines changed: 16 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
34 | 45 | | |
35 | 46 | | |
36 | 47 | | |
| |||
0 commit comments