Skip to content

Extract the shared amount parameter into a reusable payments type#535

Merged
nuttycom merged 2 commits into
mainfrom
dw/extract-amount-parameter
Jul 1, 2026
Merged

Extract the shared amount parameter into a reusable payments type#535
nuttycom merged 2 commits into
mainfrom
dw/extract-amount-parameter

Conversation

@dannywillems

@dannywillems dannywillems commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Extracting logic from #531. The idea is to have !531 as small as possible, and merge relatively unrelated changes to main, to decrease the reviewer time on the actual feature, while we're merging NU6.3 related changes.


Move the AmountParameter request type out of z_send_many into json_rpc::payments (with accessor methods) and extract the shared build_request amount-parsing helper, so the type and parsing can be reused by other send-path RPC methods. Update z_sendmany, the method trait, and the OpenRPC generation to reference the relocated type.

@dannywillems
dannywillems force-pushed the dw/extract-amount-parameter branch from 43f6c99 to b6a100b Compare July 1, 2026 14:46
@dannywillems
dannywillems marked this pull request as draft July 1, 2026 14:54
Move the `AmountParameter` request type out of `z_send_many` into
`json_rpc::payments` (with accessor methods) and extract the shared
`build_request` amount-parsing helper, so the type and parsing can be reused by
other send-path RPC methods. Update the method trait and OpenRPC generation to
reference the relocated type, and keep the `AmountParameter` import in the
wallet-gated block so the merchant-terminal build still compiles.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dannywillems
dannywillems force-pushed the dw/extract-amount-parameter branch 2 times, most recently from 2be1e92 to 2c4056d Compare July 1, 2026 15:05
@dannywillems
dannywillems requested a review from nuttycom July 1, 2026 15:07
@dannywillems dannywillems self-assigned this Jul 1, 2026
@dannywillems
dannywillems marked this pull request as ready for review July 1, 2026 15:07
@dannywillems dannywillems linked an issue Jul 1, 2026 that may be closed by this pull request
Add a `payments::arb` test module with reusable constructors for
`AmountParameter` (`amount`, `amount_with_memo`), a mixed-protocol address pool,
and a zatoshi/ZEC formatting helper, so the send-path RPC method tests can share
them instead of redefining fixtures. Move the `build_request` unit tests and the
multi-recipient, mixed-protocol proptests next to `build_request` in `payments`,
using those helpers. Add `proptest` as a dev-dependency.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@nuttycom nuttycom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK; essentially move-only.

@nuttycom
nuttycom merged commit c2d8366 into main Jul 1, 2026
28 checks passed
@nuttycom
nuttycom deleted the dw/extract-amount-parameter branch July 1, 2026 15:44
sellout added a commit that referenced this pull request Jul 11, 2026
Extract the propose/validate pipeline that z_sendmany and pczt_create had
in common into a shared payments::propose_and_check helper: the
privacy-policy validation loop, propose_transfer with the standard change
strategy and input selector, privacy-policy enforcement, and the
Orchard-action-limit check. Both call sites now share one implementation.

Also have pczt_create reuse the recently-added payments::AmountParameter
type and payments::build_request (upstream #535), instead of its own
AmountParam struct and inline recipient parsing.

And tidy pczt_create's signing hints: drop the unused zallet.v1.network
proprietary field (pczt_sign never reads it) and collapse the two Updater
passes into one chained pass.

Finally, centralize the `zallet.v1.*` signing-hint keys and the key-scope
encoding in `pczt_common`, so the `pczt_create` writer and the `pczt_sign`
reader share one definition rather than duplicating the string keys and the
scope-to-u32 mapping.
sellout added a commit that referenced this pull request Jul 11, 2026
Extract the propose/validate pipeline that z_sendmany and pczt_create had
in common into a shared payments::propose_and_check helper: the
privacy-policy validation loop, propose_transfer with the standard change
strategy and input selector, privacy-policy enforcement, and the
Orchard-action-limit check. Both call sites now share one implementation.

Also have pczt_create reuse the recently-added payments::AmountParameter
type and payments::build_request (upstream #535), instead of its own
AmountParam struct and inline recipient parsing.

And tidy pczt_create's signing hints: drop the unused zallet.v1.network
proprietary field (pczt_sign never reads it) and collapse the two Updater
passes into one chained pass.

Finally, centralize the `zallet.v1.*` signing-hint keys and the key-scope
encoding in `pczt_common`, so the `pczt_create` writer and the `pczt_sign`
reader share one definition rather than duplicating the string keys and the
scope-to-u32 mapping.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rpc: Design and implement z_sendfromaccount

2 participants