Skip to content

Fixes #952, Fixes #955, Fixes #956, Fixes #957 - #1027

Closed
thatElisha wants to merge 3 commits into
Sorokit:mainfrom
thatElisha:feat/tx-improvements-and-batch-queries
Closed

thatElisha wants to merge 3 commits into
Sorokit:mainfrom
thatElisha:feat/tx-improvements-and-batch-queries

Conversation

@thatElisha

Copy link
Copy Markdown

Fixes #952, Fixes #955, Fixes #956, Fixes #957

Summary of Changes

1. #952 Add transaction preflighting — estimate fees and check account sequence

  • New File: preflighting.ts
  • Implemented preflightTransaction(tx, publicKey, options):
    • Sequence validation against account sequence (currentSequence + 1).
    • Fee estimation (using network estimate or transaction fee with fallback).
    • Balance verification (checks sufficient native balance for fee + payment amounts).
    • Emits proactive warnings when remaining balance is near or below minimum reserve.
    • Returns SorokitResult<PreflightData>.
  • Exported from src/transaction/index.ts and src/index.ts.
  • Tests: preflighting.test.ts.

2. #955 Add transaction builder fluent API — chainable setter methods

  • Updated Files: transactionBuilder.ts and compose.ts
  • Added chainable setter methods returning this/builder:
    • .setSourceAccount(source)
    • .setFee(fee)
    • .setMemo(memo, type)
    • .setTimeout(seconds)
    • .setNetwork(network)
    • .setSequenceNumber(seq)
    • .build()
  • Preserved full backwards compatibility with existing methods and undo/redo history.
  • Tests: fluentBuilder.test.ts.

3. #956 Add transaction group builder — combine multiple transactions atomically

  • New File: groupBuilder.ts
  • Implemented TransactionGroupBuilder and createTransactionGroupBuilder():
    • .addTransaction(tx) and .addTransactions(txs) to add transactions to the group.
    • .setBaseSequence(seq) to define group base sequence.
    • Automatically manages sequence numbers monotonically (baseSequence + i) for sequential submissions.
    • .build() returning SorokitResult<Transaction[]>.
  • Exported from src/transaction/index.ts and src/index.ts.
  • Tests: groupBuilder.test.ts.

4. #957 Add batch account operations — fetch multiple accounts in one request

  • New File: batchQueries.ts
  • Implemented getAccountsBatch(publicKeys, options) and getBalancesBatch(publicKeys, options):
    • Parallel queries using Promise.allSettled to minimize roundtrips.
    • No caching overhead.
    • Graceful partial failure handling (collects and returns successful accounts).
    • Returns SorokitResult<AccountInfo[]> and SorokitResult<AssetBalance[][]>.
  • Exported from src/account/index.ts and src/index.ts.
  • Tests: batchQueries.test.ts.

OluwapelumiElisha and others added 2 commits November 21, 2026 04:27
…t#957

feat: implement transaction preflighting, fluent builder API, group builder, and batch account queries

- Fixes Sorokit#952: Add transaction preflighting (src/transaction/preflighting.ts) to validate sequence numbers, estimate fees, and check sufficient account balance with low balance warnings.
- Fixes Sorokit#955: Add transaction builder fluent API (src/transaction/transactionBuilder.ts, src/transaction/compose.ts) with chainable setter methods returning this.
- Fixes Sorokit#956: Add transaction group builder (src/transaction/groupBuilder.ts) to group multiple transactions and manage consecutive sequence numbers.
- Fixes Sorokit#957: Add batch account operations (src/account/batchQueries.ts) to fetch multiple accounts and balances in parallel without caching and with graceful error handling.
- Re-export new modules and types in src/transaction/index.ts, src/account/index.ts, and src/index.ts.
- Add comprehensive test suites for preflighting, fluent builders, group builders, and batch queries.
@drips-wave

drips-wave Bot commented Nov 21, 2026

Copy link
Copy Markdown

@thatElisha Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants