Description
When the payer and recipients use different Stellar assets, the SDK must route payment through Stellar's decentralised exchange pathfinding to find the best conversion path. Currently the SDK only supports direct same-asset payments and rejects cross-asset invoices. A DEX pathfinding router should query findStrictSendPaths or findStrictReceivePaths on Horizon and select the optimal path for each split leg.
Technical Context
Add src/pathRouter.ts. Uses @stellar/stellar-sdk Server.strictSendPaths() and Server.strictReceivePaths() methods. Consumes SplitConfig.paymentAsset and RecipientShare.receiveAsset from src/types.ts. Integrates with src/txBuilder.ts to replace Payment operations with PathPaymentStrictSend or PathPaymentStrictReceive operations when paths are needed. Caches path results via src/cache.ts.
Acceptance Criteria
Description
When the payer and recipients use different Stellar assets, the SDK must route payment through Stellar's decentralised exchange pathfinding to find the best conversion path. Currently the SDK only supports direct same-asset payments and rejects cross-asset invoices. A DEX pathfinding router should query
findStrictSendPathsorfindStrictReceivePathson Horizon and select the optimal path for each split leg.Technical Context
Add
src/pathRouter.ts. Uses@stellar/stellar-sdkServer.strictSendPaths()andServer.strictReceivePaths()methods. ConsumesSplitConfig.paymentAssetandRecipientShare.receiveAssetfromsrc/types.ts. Integrates withsrc/txBuilder.tsto replacePaymentoperations withPathPaymentStrictSendorPathPaymentStrictReceiveoperations when paths are needed. Caches path results viasrc/cache.ts.Acceptance Criteria
PathRouter.findBestPath(sourceAsset, destAsset, amount): Promise<PathResult>returns the highest-value path from HorizonstrictSendvsstrictReceivebased on whether the payer or recipient amount is the fixed quantitysrc/txBuilder.tscallsPathRouterper recipient leg and builds the appropriate operation typeNoPathError)