Description
Stellar transactions are limited to 100 operations each. When a split invoice has more recipients than that limit, the SDK crashes attempting to build an over-limit transaction rather than splitting it into multiple chained transactions. A chunker should automatically partition recipient operations into valid transaction batches, submit them in sequence, and report the batch results as a single logical invoice payment.
Technical Context
Add src/operationChunker.ts. Reads MAX_OPERATIONS_PER_TRANSACTION = 100 constant. Accepts OperationOptions[] from @stellar/stellar-sdk and partitions them into chunks. Each chunk is built via src/txBuilder.ts. Chunks are submitted in sequence using src/client.ts. All chunk hashes are recorded in BatchPaymentResult added to src/types.ts. Integrates with src/idempotency.ts to prevent duplicate chunk submission on retry.
Acceptance Criteria
Description
Stellar transactions are limited to 100 operations each. When a split invoice has more recipients than that limit, the SDK crashes attempting to build an over-limit transaction rather than splitting it into multiple chained transactions. A chunker should automatically partition recipient operations into valid transaction batches, submit them in sequence, and report the batch results as a single logical invoice payment.
Technical Context
Add
src/operationChunker.ts. ReadsMAX_OPERATIONS_PER_TRANSACTION = 100constant. AcceptsOperationOptions[]from@stellar/stellar-sdkand partitions them into chunks. Each chunk is built viasrc/txBuilder.ts. Chunks are submitted in sequence usingsrc/client.ts. All chunk hashes are recorded inBatchPaymentResultadded tosrc/types.ts. Integrates withsrc/idempotency.tsto prevent duplicate chunk submission on retry.Acceptance Criteria
OperationChunker.chunk(operations: OperationOptions[], chunkSize = 100): OperationOptions[][]partitions operations into sub-arrays of at mostchunkSizeOperationChunker.submitAll(chunks, txBuilderConfig): Promise<BatchPaymentResult>submits each chunk sequentially and collectstxHashper chunkBatchPaymentResult.succeededand the failed chunk inBatchPaymentResult.failedsrc/idempotency.tsidempotency keys per chunk to ensure a retry does not resubmit already-successful chunks