Skip to content

Invoice Batch Creation in a Single Transaction #524

Description

@Kingsman-99

Description

Creators who issue many invoices simultaneously (e.g. for a multi-track project) currently must submit individual transactions. A batch_create_invoices method should create up to N invoices atomically, returning all new invoice IDs.

Technical Context

Add batch_create_invoices(invoices: Vec<InvoiceParams>) -> Vec<u64> to contracts/split/src/lib.rs. Define InvoiceParams struct in types.rs mirroring create_invoice parameters. Iterate and call the internal _create_invoice helper for each entry. Enforce a MaxBatchSize cap stored in storage::instance. Emit BatchInvoiceCreated(ids: Vec<u64>) from events.rs.

Acceptance Criteria

  • All invoices in the batch are created or none are (atomic failure)
  • Returned Vec<u64> contains one new invoice_id per input entry, in order
  • Batch size exceeding MaxBatchSize returns BatchTooLarge
  • Each created invoice emits an individual InvoiceCreated event plus one BatchInvoiceCreated
  • Creator invoice count cap is checked and updated atomically across the whole batch
  • All CI checks (cargo build --target wasm32-unknown-unknown, cargo test, cargo clippy) pass and the branch has no merge conflicts

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programcomplexity: highComplex feature requiring deep knowledge - 200 ptsperformance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions