Skip to main content
Route swaps (or multi-hop swaps) allow you to trade between two assets by routing the transaction through one or more intermediary pools. This is useful when there’s no direct liquidity pool for a specific asset pair but a path exists through other pools. The Flashnet SDK simplifies this process by allowing you to define a series of “hops” that make up the desired route.
The maximum number of hops allowed in a single route swap is 4.

Simulating a Route Swap

Before executing, it’s crucial to simulate the route swap to get an estimate of the expected output, price impact, and fees.
The simulation provides a breakdown for each hop, allowing you to see how the swap progresses at each stage.

Executing a Route Swap

To execute the swap, you provide the same hop structure along with slippage parameters. The SDK handles the transfer to the first pool and the subsequent routing automatically.

Integrator Fees

You can also specify integrator fees for the entire route or for individual hops.

Error Handling

Route swaps involve multiple pools and can fail at various points. The SDK provides typed errors with automatic fund recovery. See Error Handling for the complete guide.

Next Steps