Stellar
SDEX & Path Payments
The Stellar Decentralized Exchange (SDEX) is a native order book built into every Stellar node. Unlike EVM DEXes that require separate smart contracts, the SDEX is part of the protocol itself.
Path Finding
Before executing a path payment, the system queries Horizon'sstrictReceivePathsendpoint to discover available conversion paths.
// Query: what paths convert XLM into the required destination asset?
GET /paths/strict-receive
?source_asset_type=native
&destination_asset_type=credit_alphanum4
&destination_asset_code=DEST
&destination_asset_issuer=GDEST...
&destination_amount=50.00
The response includes multiple paths sorted by source amount. The system selects the cheapest path (lowest XLM cost for the desired destination-asset output).
Slippage Control
A slippage multiplier (default 2%) is applied to the best path's source amount to compute sendMax. If the actual conversion cost exceeds this cap at execution time, the transaction fails atomically. No partial fills occur.
SDEX Rate Comparison
FX quote responses include live SDEX rate data alongside external provider quotes. This allows the agent to compare on-chain vs. off-chain rates in real time.
| Field | Description |
|---|---|
| sdex_available | Whether SDEX paths were found for this corridor |
| sdex_xlm_bridge_rate | Best XLM bridge rate discovered from the SDEX |
| sdex_effective_rate | Effective rate including path conversion costs |
| sdex_path_count | Number of viable conversion paths found |
| sdex_has_liquidity | Whether sufficient liquidity exists for the requested amount |
Transaction Building
Path payment transactions are built with surge-aware fees and a 30-second timeout. The intermediate path assets (returned by Horizon) are included in the operation so the network can route through the optimal order books.
Operation.pathPaymentStrictReceive({
sendAsset: Asset.native(),
sendMax: "520.00",
destination: recipientAddress,
destAsset: destinationAsset,
destAmount: "50.00",
path: [intermediateAsset1, intermediateAsset2]
})
StellarNotherc Docs