feat: enable account address resolution to support dApps connectivity#564
feat: enable account address resolution to support dApps connectivity#564baptiste-marchand wants to merge 12 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.


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 request routing/validation and the
sendTransferflow (including new user confirmation and stricter recipient constraints), which could break dapp compatibility or transfer UX if assumptions are wrong.Overview
Adds
KeyringRpcMethod.ResolveAccountAddresssupport so MetaMask can route incoming Bitcoin dapp signing requests to the correct account by validating the request shape (BtcWalletRequestStruct), filtering accounts by scope, and returning the matching CAIP-10 address (ornullon validation/lookup errors).Updates Bitcoin keyring request parameter validation to require an
account: { address }object for all supported BTC methods, and updates unit/integration tests accordingly.Changes
sendTransferto require exactly one recipient, build the PSBT with fee rate + frozen UTXOs, and block on a new unified confirmation UI (insertSendTransfer) that includes optional fiat exchange rate + request origin display.Written by Cursor Bugbot for commit b9224e6. This will update automatically on new commits. Configure here.