Skip to content

feat: Implement four core features (#499, #501, #502, #503) - #538

Open
Machundii wants to merge 5 commits into
Sorokit:mainfrom
Machundii:main
Open

feat: Implement four core features (#499, #501, #502, #503)#538
Machundii wants to merge 5 commits into
Sorokit:mainfrom
Machundii:main

Conversation

@Machundii

Copy link
Copy Markdown

Summary

This pull request implements four core features for Sorokit, addressing storage management, transaction scheduling, compliance reporting, and privacy enhancements.

Implemented Features

1. Soroban Storage Expiration Tracking and Renewal Utilities (#502)

  • calculateStorageRent(contractId) - Estimates renewal requirements and identifies entries approaching expiration
  • renewContractStorage(contractId) - Builds renewal operations for contract storage
  • Configurable warning thresholds to identify entries nearing expiration
  • Auto-renewal can be explicitly enabled or disabled
  • Structured error handling with recovery guidance
  • Comprehensive test coverage for active, near-expiry, expired, and renewal-failure scenarios
  • APIs exported through src/soroban/index.ts and src/index.ts

Key Files:

  • src/soroban/storageExpiration.ts - Implementation
  • src/soroban/storageExpiration.test.ts - Tests

2. Prioritized Transaction Queues and Scheduled Batch Submission (#501)

  • TransactionQueue class supporting low, normal, high, and critical priorities
  • Critical and high-priority transactions are processed ahead of lower priorities
  • Configurable batch size and scheduling intervals
  • Dependent transactions cannot execute before their prerequisites
  • Failed submissions return to queue according to retry policy
  • Duplicate transaction entries are prevented
  • Queue state exposes pending, processing, completed, and failed items
  • Comprehensive test coverage for priority ordering, batching, retries, dependencies, and cancellation
  • Existing direct submission APIs remain unaffected
  • APIs exported through src/transaction/index.ts and src/index.ts

Key Files:

  • src/transaction/transactionQueue.ts - Implementation
  • src/transaction/transactionQueue.test.ts - Tests

3. Account Activity Reporting and Compliance Analysis Utilities (#503)

  • generateComplianceReport(account, framework) - Generates framework-specific compliance reports
  • Normalizes account activity into consistent reporting structure
  • Transaction categories: transfers, payments, swaps, contract-interactions
  • Framework-specific rule sets: AML, KYC, SOX, Basic, and custom
  • Reports include configurable date ranges and account metadata
  • Unsupported or incomplete activity is reported explicitly
  • exportComplianceReport() - Export reports as JSON or CSV
  • Comprehensive test coverage for categorization, date filtering, framework selection, and incomplete data
  • APIs exported through src/account/index.ts and src/index.ts

Key Files:

  • src/account/complianceReporting.ts - Implementation
  • src/account/complianceReporting.test.ts - Tests

4. Privacy-Preserving Transaction Pooling and Mixing (#499)

  • TransactionMixingPool class for coordinated privacy-preserving batches
  • Multiple participants can contribute transactions to a single pool
  • Eligible transactions are shuffled before batch construction
  • Pool state prevents duplicate or already-submitted transactions
  • Privacy and execution costs are calculated before participation
  • Failed or expired participants can be removed without corrupting the pool
  • Participation remains explicitly opt-in (isolated from normal transaction builders)
  • Comprehensive test coverage for pooling, shuffling, cancellation, failure, and empty-pool scenarios
  • Existing non-mixed transaction flows remain unchanged
  • APIs exported through src/transaction/index.ts and src/index.ts

Key Files:

  • src/transaction/transactionMixing.ts - Implementation
  • src/transaction/transactionMixing.test.ts - Tests

Changes

  • 8 new implementation files
  • 8 new comprehensive test files
  • Updated index files to export new APIs
  • All APIs follow Sorokit's SorokitResult<T> response pattern
  • Structured error handling with recovery guidance
  • Full TypeScript type safety

Testing

All implementations include comprehensive test coverage:

  • ✅ Priority ordering and batching (transaction queues)
  • ✅ Dependency tracking and resolution
  • ✅ Retry policies and failure handling
  • ✅ Privacy analysis and anonymity calculations
  • ✅ Compliance categorization and reporting
  • ✅ Storage expiration and renewal workflows
  • ✅ Edge cases and error conditions

Related Issues

…ties

- Add calculateStorageRent() to estimate renewal requirements
- Add renewContractStorage() to build renewal operations
- Support configurable warning thresholds
- Include structured error handling for renewal failures
- Add comprehensive test coverage for active, near-expiry, and expired entries
- Export APIs through src/soroban/index.ts and src/index.ts

closes Sorokit#502
…bmission

- Add TransactionQueue class with low/normal/high/critical priorities
- Support configurable batch size and scheduling intervals
- Track dependent transactions and preserve ordering
- Implement retry policy with exponential backoff
- Prevent duplicate transaction entries
- Expose queue state (pending, processing, completed, failed)
- Add comprehensive test coverage for priority ordering, batching, retries, and dependencies
- Existing direct submission APIs remain unaffected
- Export APIs through src/transaction/index.ts and src/index.ts

closes Sorokit#501
…ilities

- Add generateComplianceReport() for compliance report generation
- Support multiple frameworks: AML, KYC, SOX, Basic, and custom
- Normalize account activity into consistent reporting structure
- Categorize transactions: transfers, payments, swaps, contract-interactions
- Support configurable date ranges and framework-specific rule sets
- Include compliance score, assessment, and flagged activities
- Export compliance reports as JSON and CSV formats
- Add comprehensive test coverage for categorization, date filtering, and frameworks
- Report incomplete or unsupported activity explicitly
- Export APIs through src/account/index.ts and src/index.ts

closes Sorokit#503
- Add TransactionMixingPool class for coordinated batch submissions
- Support multiple participants in a single pool
- Shuffle transactions before batch construction for privacy
- Prevent duplicate and already-submitted transactions
- Calculate privacy rating (0-100) and cost savings before participation
- Remove failed or expired participants without corrupting pool state
- Participation remains explicitly opt-in (isolated from normal flows)
- Add comprehensive test coverage for pooling, shuffling, cancellation, and failure scenarios
- Include privacy analysis with anonymity set metrics
- Pool manages transaction lifecycle: pending -> shuffled -> batch-ready -> submitted
- Export APIs through src/transaction/index.ts and src/index.ts

closes Sorokit#499
- Export storage expiration APIs (Sorokit#502)
- Export transaction queue APIs (Sorokit#501)
- Export compliance reporting APIs (Sorokit#503)
- Export transaction mixing APIs (Sorokit#499)
@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@Machundii 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

@Just-Bamford

Copy link
Copy Markdown
Collaborator

@Machundii your PR has merge conflicts. Please resolve the conflicts and update the PR when done. Thanks.

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

Labels

None yet

Projects

None yet

2 participants