feat: update sendTransfer params - #2634
Conversation
|
Leather Web build 43826cb — Web staging |
|
Leather Extension build 43826cb — Extension build |
|
Claude finished @edgar-stacks's task in 2m 22s —— View job PR ReviewOverall the change looks solid and focused. A few items worth flagging: Bugs / correctness
Security
CLAUDE.md conventions
Nits (ignore if you like)
Nothing blocking. |
There was a problem hiding this comment.
Pull request overview
This PR extends the Bitcoin sendTransfer RPC method to support an optional broadcast parameter (allowing “sign only” behavior) and to return the signed raw transaction hex (transaction) in responses across mobile + extension flows.
Changes:
- Add optional
broadcastto both legacy and newsendTransferparam schemas and propagate it through extension request plumbing. - Extend
sendTransferresult shape to optionally includetransactionand update mobile/extension implementations to return it (and to skip broadcasting whenbroadcast: false). - Add/extend unit + E2E coverage for
broadcasthandling and the updated result schema.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/rpc/src/methods/bitcoin/send-transfer.ts | Adds broadcast param support and extends result schema with optional transaction. |
| packages/rpc/src/methods/bitcoin/send-transfer.spec.ts | New schema-focused unit tests for broadcast params and result acceptance. |
| apps/mobile/src/features/browser/approver-sheet/send-transfer.tsx | Passes broadcast through to the signer (defaulting to true) and returns transaction in the RPC result. |
| apps/extension/tests/specs/rpc-send-transfer/rpc-send-transfer.spec.ts | Updates E2E expectations to include transaction and adds a no-broadcast test verifying no broadcast call occurs. |
| apps/extension/src/shared/rpc/methods/send-transfer.ts | Adds broadcast to extension-side zod schemas and carries it through legacy→new param conversion. |
| apps/extension/src/shared/rpc/methods/send-transfer.spec.ts | Adds schema/legacy-conversion tests covering broadcast. |
| apps/extension/src/background/messaging/rpc-methods/send-transfer.ts | Propagates broadcast into popup URL params (defaulting to true). |
| apps/extension/src/app/pages/rpc-send-transfer/use-rpc-send-transfer.ts | Parses broadcast from URL params into request state. |
| apps/extension/src/app/pages/rpc-send-transfer/use-rpc-send-transfer-actions.tsx | Implements “sign only” flow when broadcast is false; returns transaction in responses (including multisig proposal flow). |
| apps/extension/src/app/pages/rpc-send-transfer/rpc-send-transfer.context.ts | Extends RPC send-transfer context to include broadcast. |
Suppressed comments (1)
packages/rpc/src/methods/bitcoin/send-transfer.ts:43
- The
sendTransferresult schema is currently fully-optional, so an empty{}result would validate successfully. This makes it easy for implementations to accidentally return an invalid/meaningless response (e.g., missingtxid,transaction, and multisig fields) without being caught by schema validation.
result: z.object({
txid: z.string().optional(),
transaction: z.string().optional(),
// Present (and `status: 'proposed'`) when the active account is a multisig
// policy: the transaction was proposed to the coordinator, not broadcast, so
// `txid` is empty until co-signers complete and broadcast it.
proposalId: z.string().optional(),
status: z.enum(['broadcast', 'proposed']).optional(),
}),
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
5452c8c to
d45d532
Compare
No description provided.