Feat/four new features - #569
Open
Emmy6654 wants to merge 4 commits into
Open
Conversation
…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
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.