Skip to content

Feat/four new features - #569

Open
Emmy6654 wants to merge 4 commits into
Stellar-split:mainfrom
Emmy6654:feat/four-new-features
Open

Feat/four new features#569
Emmy6654 wants to merge 4 commits into
Stellar-split:mainfrom
Emmy6654:feat/four-new-features

Conversation

@Emmy6654

Copy link
Copy Markdown

Closes #512
Closes #513
Closes #514
Closes #515

Horizon returns transaction result codes as opaque strings like tx_bad_seq or op_no_trust, which the SDK surfaces verbatim in thrown errors. Callers must parse these strings themselves to implement retry logic, user-facing messages, or routing decisions. A classification layer should map every known Horizon result code to a structured error taxonomy with retry advice, severity, and a human-readable description.

Technical Context
Add src/horizonErrorClassifier.ts. References the full result code taxonomy from @stellar/stellar-sdk HorizonApi.TransactionFailedResultCodes and the xdr.TransactionResultCode enum. Extends src/errors.ts with ClassifiedHorizonError. Integrates with src/retryEngine.ts and src/fallbackChain.ts to determine whether an error is retryable. Adds HorizonErrorClassification to src/types.ts.

Emmy6654 added 4 commits July 28, 2026 16:08
…e utilities

- Add estimateSwapOutput() using constant-product formula (x * y = k)
- Add calculatePoolShare() for proportional LP share computation
- Add PoolSwapEstimate and PoolShareResult types
- Add InsufficientLiquidityError with configurable threshold (default 30%)
- Price impact computed as (spotPrice - effectivePrice) / spotPrice * 100
- Pure calculation functions with BigInt-safe decimal arithmetic
- Includes comprehensive unit tests for known pool states
…ion actions

- Add EscalationManager class with configurable EscalationStep triggers
- Support warn, retryHigherFee, switchEndpoint, and abort actions
- Abort step throws PaymentEscalationAbortError
- Integrates with FallbackChain for switchEndpoint escalation
- Add EscalationStep and TimeoutPolicy types
- Emits escalation events via callback at each threshold
- Includes unit tests for all escalation steps and timing
…t of duplicate accounts

- Add deduplicateRecipients() with 'merge' and 'reject' modes
- Merge mode consolidates duplicate accounts by summing their ratios
- Reject mode throws DuplicateRecipientError listing all duplicate IDs
- Case-insensitive comparison for Stellar account IDs (G... addresses)
- Integrated into paymentValidator.ts for pre-submission checks
- Integrated into splitPreview.ts to show merged entries
- Includes unit tests for merge, reject, case-insensitivity, and edge cases
… taxonomy

- Add classifyHorizonError() mapping tx_*/op_* codes to structured taxonomy
- Covers all documented tx_* codes (tx_bad_seq, tx_insufficient_fee, etc.)
- Covers all documented op_* codes (op_no_trust, op_underfunded, etc.)
- Returns HorizonErrorClassification with isRetryable, severity, description
- Unknown codes return { severity: 'unknown', isRetryable: false }
- Integrated into RetryEngine.classifyError() for automatic retry decisions
- Add ClassifiedHorizonError wrapper for runtime classification
- Includes unit tests for tx_bad_seq (retryable), op_no_trust (not retryable),
  op_underfunded (not retryable), and edge cases
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

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

1 participant