Repository navigation
Commit 0144e95
feat(confirmations): support Money Account withdrawals to hardware wallet recipients (#47111)
<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
## **Description**
This lets users withdraw from a Money Account to any hardware wallet
account (Ledger, Trezor, Lattice, QR, OneKey), including withdrawals
that need a quote to another token or chain. The Money Account signs
everything and the recipient only receives the funds, so the device
never needs to be connected, unlocked, or asked to sign.
`@metamask/transaction-pay-controller` is now bumped to `^31.0.0`, which
ships
[MetaMask/core#10992](MetaMask/core#10992):
post-quote withdrawals are quoted and submitted from the transaction's
own `from` (the Money Account), and `accountOverride` only receives the
output. To match, a quoted withdrawal keeps the mUSD on the Money
Account, while same-chain mUSD still pays the recipient directly. Its
success toast says "your account", and the withdraw E2E mocks a gasless
Relay execute quote, which is how the Money Account submits.
Checked for the bump from 30.3.1 to 31.0.0:
- Withdraw call sites match the BREAKING change: the nested transfer
(re-encoded when the token or recipient changes), the confirm-time
re-encode, and the paying account all use `from`, and `accountOverride`
is only the recipient.
- No new required options or external messenger actions. The new
optional `clientId` is left unset.
- `transaction-controller` stays on the repo's `72.3.0` resolution, and
the pay controller calls the same transaction controller actions as
30.3.1. `gas-fee-controller` dedupes to 27.1.0, so the LavaMoat policies
pick up its newer `uuid`.
## **Changelog**
CHANGELOG entry: Added support for withdrawing from a Money Account to
hardware wallet accounts
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/CONF-2087
## **Manual testing steps**
1. Run the extension with Money Account enabled and a funded Money
Account.
2. Add a hardware wallet account (for example Ledger or QR), then
disconnect or lock the device.
3. Select the hardware account, go to Money home, and click Send.
4. Check that the hardware account is the recipient, is listed in
"Withdraw to", and the screen looks like a normal withdrawal.
5. Pick the Money Account token on its own chain, enter an amount, and
confirm. Check that no hardware wallet prompt appears and the funds
arrive at the hardware account.
6. Start another withdraw, pick a token on another chain (for example
USDC on Ethereum), enter an amount, and confirm. Check that no hardware
wallet prompt appears and the funds arrive at the hardware account.
7. Start a withdraw to the hardware account, switch the recipient to a
regular account, and confirm. Check that the funds arrive at the regular
account.
8. Withdraw to a regular account with a token on another chain, then run
a deposit. Check that both still work and the regular account is not
asked to sign the withdrawal.
<!--
## **Screenshots/Recordings**
### **Before**
### **After**
-->
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/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-extension/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_AGENT_PR_BODY_END -->
<div><a
href="https://cursor.com/agents/bc-d824f3b1-ec17-502f-bc13-b24184a7e741?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a
href="https://cursor.com/background-agent?bcId=bc-d824f3b1-ec17-502f-bc13-b24184a7e741&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div>
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **High Risk**
> Changes withdrawal calldata, Pay quote routing, and confirm approval
guards—incorrect transfer targets or reuse logic could send funds to the
wrong address or approve stale batches.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
921d970. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Daniel <dan437@users.noreply.github.com>1 parent 6c87b8d commit 0144e95
35 files changed
Lines changed: 1653 additions & 233 deletions
File tree
- app/scripts
- lib/money/pay
- messenger-client-init
- lavamoat/webpack
- mv2
- beta
- experimental
- flask
- main
- mv3
- beta
- experimental
- flask
- main
- test/e2e
- page-objects/pages/confirmations
- tests/confirmations/mocks
- ui
- components/app/money/money-account-toast
- hooks/money
- pages/confirmations
- components/rows/from-account-row
- constants
- hooks
- pay
- transactions
- selectors/money
- store/controller-actions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| 72 | + | |
69 | 73 | | |
70 | 74 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
75 | 98 | | |
76 | 99 | | |
77 | 100 | | |
| |||
0 commit comments