feat: enable account address resolution to support dApps connectivity#564
feat: enable account address resolution to support dApps connectivity#564baptiste-marchand wants to merge 14 commits intomainfrom
Conversation
a041ba7 to
e0ea92e
Compare
There was a problem hiding this comment.
Bug: Account Field Mandate Breaks Tests
Existing unit tests create request params without the required account field, but the request struct changes now mandate this field. Tests for signPsbt, computeFee, fillPsbt, broadcastPsbt, sendTransfer, getUtxo, and signMessage will fail during assertion validation because their params lack the required account: { address: string } object.
packages/snap/src/handlers/KeyringRequestHandler.test.ts#L64-L431
105bfe9 to
62f251f
Compare
…rmation of sendFlow()
| default: { | ||
| throw new Error('Unsupported method'); | ||
| } | ||
| } |
There was a problem hiding this comment.
Redundant switch in resolveAccountAddress method
Low Severity
The switch statement in resolveAccountAddress is entirely redundant — every BtcMethod case performs the identical operation: extracting request.params.account.address. Since every variant of BtcWalletRequestStruct includes account: WalletAccountStruct in its params, TypeScript allows accessing request.params.account.address directly on the union type without narrowing. The whole switch (and unreachable default branch) can be replaced with a single line: const addressToValidate = request.params.account.address.
|
|
||
| const result = await response; | ||
|
|
||
| expect(result).toRespondWith({ |
There was a problem hiding this comment.
Promise used as response in test
High Severity
In the sendTransfer integration test, snap.onKeyringRequest(...) is no longer awaited, but the code calls response.getInterface() as if response were the resolved response object. If onKeyringRequest returns a Promise, this becomes a runtime failure and breaks the test flow/CI.


Implements account address resolution for Bitcoin requests, allowing MetaMask to route non-EVM dapp signing requests correctly. This is a requirement for Bitcoin dApps connectivity
resolveAccountAddressmethod inKeyringHandlerandKeyringRequestHandlerto determine the account address for signing requests.Note
Medium Risk
Touches keyring routing and transaction signing/sending flows, and introduces new user-confirmation gating that can block or misroute requests if validation or UI flows are incorrect.
Overview
Enables MetaMask to route incoming Bitcoin dApp requests by adding
KeyringRpcMethod.ResolveAccountAddresshandling inKeyringHandler, validating requests via a newBtcWalletRequestStruct, and resolving the correct CAIP-10 account based onscope+params.account.address(returningnullon failure).Tightens Bitcoin request schemas to require an
account: { address }param across keyring methods, and wires in user confirmations forSignPsbtandSendTransfer:KeyringRequestHandlernow blocks onJSXConfirmationRepository.insertSignPsbt, whileAccountUseCases.sendTransferis refactored to enforce exactly one recipient, build a PSBT with fee rate + frozen UTXOs, and prompt a unified send confirmation before signing/broadcasting.Adds a new
SignPsbtConfirmationViewUI (outputs/options/fees + optional fiat rate), plumbsorigininto unified send confirmations, expands i18n strings, and updates unit/integration tests and manifest shasum to match the new request/confirmation flow.Written by Cursor Bugbot for commit 7fc750e. This will update automatically on new commits. Configure here.