Skip to content

feat: four SDK improvements — split ratio validator, trustline checker, XDR parser, fee surge detector - #573

Open
Prasiejames wants to merge 6 commits into
Stellar-split:mainfrom
Prasiejames:main
Open

feat: four SDK improvements — split ratio validator, trustline checker, XDR parser, fee surge detector#573
Prasiejames wants to merge 6 commits into
Stellar-split:mainfrom
Prasiejames:main

Conversation

@Prasiejames

Copy link
Copy Markdown

Closes #494
Closes #495
Closes #496
Closes #497

Summary

This PR adds four new SDK features:

1. Pre-submission Split Ratio Validator (src/validators/splitRatioValidator.ts)

Catches ratio-sum violations, negative shares, duplicate recipient addresses, and zero-weight entries early with structured error objects, before Horizon submission. Integrated into client.createInvoice() and splitPreview.ts.

2. Proactive Trustline Checker (src/trustlineChecker.ts)

Verifies every recipient in a split invoice has the required trustline before building the payment transaction. Uses Horizon Server.loadAccount() to inspect balances for matching asset_code/asset_issuer, surfacing a per-recipient report. Integrated into client.validatePayment().

3. Typed XDR Envelope Parser (src/xdrParser.ts)

Decodes any base64-encoded TransactionEnvelope into a structured, human-readable ParsedEnvelope with operations, signers, memo, fee, and time bounds. Integrated as a debug helper client.parseXdrEnvelope(), gated behind config.debug.

4. Fee Surge Detector (src/feeSurgeDetector.ts)

Monitors real-time ledger fee statistics via Horizon and automatically recommends adjusted fee multipliers during network congestion. Uses Horizon.Server.feeStats() for p10/p50/p95 percentiles. Integrated into StellarSplitTxBuilder.submit() for surge-adjusted fees before signing.

Commits

  • 89c70ff feat: add pre-submission split ratio validator
  • 60ac9a5 feat: add proactive trustline checker for non-XLM asset payments
  • 1a815ba feat: add typed XDR envelope parser for debugging and audit logging
  • 28ce026 feat: add fee surge detector with Horizon fee-stats monitoring
  • adad0bd chore: integrate all four new modules into SDK surface

Adds src/validators/splitRatioValidator.ts to catch ratio-sum violations,
negative shares, duplicate recipient addresses, and zero-weight entries
early with structured error objects, before Horizon submission.

Integrates into createInvoice() in client.ts, splitPreview.ts, and
exports from index.ts with new types in types.ts.
Adds src/trustlineChecker.ts to verify every recipient in a split invoice
has the required trustline before building the payment transaction.
Uses Horizon Server.loadAccount() to inspect balances for matching
asset_code/asset_issuer, surfacing a per-recipient report.

Integrates into client.validatePayment() as an additional check.
Adds src/xdrParser.ts to decode any base64-encoded TransactionEnvelope
into a structured, human-readable ParsedEnvelope with operations,
signers, memo, fee, and time bounds.

Integrates into client.ts as parseXdrEnvelope() debug helper, gated
behind config.debug flag.
Adds src/feeSurgeDetector.ts to monitor real-time ledger fee statistics
via Horizon and automatically recommend adjusted fee multipliers during
network congestion.

Uses Horizon Server.feeStats() for p10/p50/p95 percentiles. Integrates
into txBuilder.ts for surge-adjusted fees before signing. Re-exported
from feeEstimator.ts.
- Add new types (RecipientShare, SplitConfig, TrustlineEntry,
  TrustlineCheckResult, ParsedEnvelope, ParsedTransaction,
  ParsedOperation, ParsedMemo, ParsedSignature, ParsedTimeBounds,
  FeeSurgeConfig, FeeRecommendation, CongestionLevel) to types.ts
- Wire split ratio validation into client.createInvoice()
- Wire trustline check into client.validatePayment()
- Add debug flag and parseXdrEnvelope() to client config
- Add fee surge config option to StellarSplitClientConfig
- Enable surge detection in StellarSplitTxBuilder.submit()
- Export all new modules from index.ts
- Re-export surge detector from feeEstimator.ts
feat: four SDK improvements — split ratio validator, trustline checker, XDR parser, fee surge detector
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

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

Development

Successfully merging this pull request may close these issues.

Dynamic Fee Surge Detector XDR Transaction Envelope Parser Asset Trustline Presence Checker Payment Split Ratio Validator

1 participant