Skip to content

feat(stellar): implement Horizon path finding with strict receive support and public export (#448) - #571

Draft
s6pa1rta3n-lab wants to merge 1 commit into
Neurowealth:mainfrom
s6pa1rta3n-lab:fix-issue-448
Draft

s6pa1rta3n-lab wants to merge 1 commit into
Neurowealth:mainfrom
s6pa1rta3n-lab:fix-issue-448

Conversation

@s6pa1rta3n-lab

Copy link
Copy Markdown

Summary

Resolves #448. Implements and exports DEX auto-routing primitives querying Stellar Horizon /path/strict-send and /path/strict-receive endpoints with slippage clamping, price impact warnings, TTL expiration handling, and strict-receive operation construction.

Changes

  • Public Stellar Export (src/stellar/index.ts):

    • Re-exported all routing members (findStrictSendPath, findStrictReceivePath, buildPathPaymentOp, buildPathPaymentStrictSendOp, buildPathPaymentStrictReceiveOp, validateQuoteExpiry, clampSlippage, ROUTING_CONFIG, RoutedQuote, PathPaymentParams) from the stellar integration layer.
  • Routing Infrastructure (src/stellar/routing.ts):

    • Added JSDoc docstrings for public API contracts and functions.
    • Implemented buildPathPaymentStrictReceiveOp constructing Operation.pathPaymentStrictReceive with slippage-adjusted sendMax.
    • Added buildPathPaymentStrictSendOp as an explicit semantic alias to buildPathPaymentOp.
    • Enforced clamped slippage within buildPathPaymentOp and buildPathPaymentStrictReceiveOp.
    • Stripped non-docstring inline comments to keep code self-documenting.
  • Unit Testing Suite (tests/unit/stellar/routing.test.ts):

    • Added unit test for buildPathPaymentStrictReceiveOp verifying decoded XDR attributes, sendMax calculation, and destination.
    • Added failure tests for findStrictReceivePath: empty Horizon records (Horizon strict-receive returned no path), malformed source asset format, and malformed destination asset format.
    • Verified alias consistency between buildPathPaymentStrictSendOp and buildPathPaymentOp.

Verification

  • npm run lint: Passing with zero errors.
  • npx prettier --check src/stellar/routing.ts src/stellar/index.ts tests/unit/stellar/routing.test.ts: Passing.
  • npx jest tests/unit/stellar/routing.test.ts: 36/36 tests passing.
  • npx jest tests/unit/stellar: 94/94 tests passing across all 11 test suites.

Payout Routing

  • EVM (Base/Arbitrum/Polygon/ETH): 0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89
  • Stellar: GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC

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.

[FEATURE] Implement Horizon path finding in stellar/routing.ts (direct-path stub)

1 participant