Skip to content

Multi-payment API with text and raw-byte memos, ZIP 321 and PCZT - #22

Open
ETIM-PAUL wants to merge 6 commits into
red-dev-inc:mainfrom
ETIM-PAUL:pr/payments-memo-api
Open

ETIM-PAUL wants to merge 6 commits into
red-dev-inc:mainfrom
ETIM-PAUL:pr/payments-memo-api

Conversation

@ETIM-PAUL

@ETIM-PAUL ETIM-PAUL commented Oct 28, 2026 •

Copy link
Copy Markdown

What

A multi-payment API with memos. All of it is additive, and existing propose_transfer behaves the same.

  • propose_payments(account, payments): several recipients in one transaction. Each payment has an amount and an optional memo, either text or raw bytes (up to 512 bytes, per ZIP 302).
  • propose_from_zip321(account, uri): the same, from a ZIP 321 payment URI.
  • Wallet::transfer_payments(...) (Rust only): propose, sign and send in one call.
  • pczt_create_payments / pczt_create_from_zip321: the PCZT path for both.
  • Proposal.fee() and Proposal.describe() return every output, its memo, the change and the ZIP 317 fee, so an app can show a review step before sending.
  • Inputs are validated before the backend sees them. Errors carry a stable JS code (malformed_payment, invalid_memo_type, memo_too_long, insufficient_funds, wrong_network, …).
  • TypeScript types: PaymentRequest, ProposalDescription.

Why

WebZjs could only send to a single recipient, and its memo was text only. Apps like payroll, exchanges and invoicing need batched payments and binary memos, and they need to show users what will be sent.

Stack

This is PR 2 of 4 and builds on #21. Until that merges, GitHub shows the combined diff. This PR's own changes: ETIM-PAUL/WebZjs-red-dev@pr/nu7-bump...pr/payments-memo-api

Testing

  • payments.rs has unit tests covering validation, memo encoding, ZIP 321 parsing and the error codes. cargo test -p webzjs-wallet --lib: all pass. fmt and clippy are clean.
  • Live on testnet: one transaction paid several recipients with text and hex memos. It was mined at 4,508,088 with a 20,000-zatoshi fee (23acbef465b98583f581977927ded0f9749e15987de43fe64254b05606a7e891), and each memo was read back after sync.
  • Not live-tested: signing and sending a multi-payment PCZT (creating one is tested), and a successful ZIP 321 send.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
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.

1 participant