POST
/
v1
/
route-swap
/
simulate
Simulate Route Swap
curl --request POST \
  --url https://api.amm.flashnet.xyz/v1/route-swap/simulate \
  --header 'Content-Type: application/json' \
  --data '{
  "amountIn": "100000000",
  "hops": [
    {
      "assetInAddress": "03bitcoinassetpubkey0000000000000000000000000000000000000000000000",
      "assetOutAddress": "03ethereumassetpubkey1111111111111111111111111111111111111111111111",
      "poolId": "03pool1aabbccddeeff00112233445566778899aabbccddeeff00112233445566778"
    },
    {
      "assetInAddress": "03ethereumassetpubkey1111111111111111111111111111111111111111111111",
      "assetOutAddress": "03usdstablecoinpubkey2222222222222222222222222222222222222222222222",
      "poolId": "03pool2bbccddeeffffaabbccddeeff00112233445566778899aabbccddeeff0011"
    }
  ],
  "maxRouteSlippageBps": "100"
}'
{
"executionPrice": "0.94",
"hopBreakdown": [
{
"amountIn": "100000000",
"amountOut": "4850000",
"poolId": "03pool1aabbccddeeff00112233445566778899aabbccddeeff00112233445566778",
"priceImpactPct": "3.00%"
},
{
"amountIn": "4850000",
"amountOut": "94000000",
"poolId": "03pool2bbccddeeffffaabbccddeeff00112233445566778899aabbccddeeff0011",
"priceImpactPct": "3.50%"
}
],
"outputAmount": "94000000",
"totalHostFees": "1500000",
"totalLpFees": "3000000",
"totalPriceImpactPct": "6.50%",
"warningMessage": "High total price impact"
}

Body

application/json

Route simulation details including hop sequence and input amount

Defines the request for simulating a swap across a defined route of liquidity pools.

hops
object[]
required

An ordered sequence of pools and assets that defines the swap route. Must contain at least 2 hops and no more than 4 hops.

Example:
[
{
"assetInAddress": "03bitcoinassetpubkey0000000000000000000000000000000000000000000000",
"assetOutAddress": "03ethereumassetpubkey1111111111111111111111111111111111111111111111",
"poolId": "03pool1aabbccddeeff00112233445566778899aabbccddeeff00112233445566778"
},
{
"assetInAddress": "03ethereumassetpubkey1111111111111111111111111111111111111111111111",
"assetOutAddress": "03usdstablecoinpubkey2222222222222222222222222222222222222222222222",
"poolId": "03pool2bbccddeeffffaabbccddeeff00112233445566778899aabbccddeeff0011"
}
]
amountIn
integer
required

The total amount of the input asset to be swapped, in its smallest unit.

Required range: x >= 0
Example:

100000000

maxRouteSlippageBps
integer
required

The maximum acceptable slippage for the entire route, in basis points (0-10000).

Required range: x >= 0
Example:

100

Response

Route simulation successful

Represents the complete simulation result for the requested route swap.

outputAmount
integer
required

The estimated final amount of the output asset to be received, in its smallest unit.

Required range: x >= 0
executionPrice
string
required

The estimated effective price of the swap, calculated as output_amount / input_amount.

totalLpFees
integer
required

The total estimated fees paid to liquidity providers across all hops.

Required range: x >= 0
totalHostFees
integer
required

The total estimated fees paid to pool hosts across all hops.

Required range: x >= 0
totalPriceImpactPct
string
required

The total estimated price impact for the entire route as a percentage string.

hopBreakdown
object[]
required

A detailed breakdown of the simulation results for each hop in the route.

warningMessage
string | null

An optional warning message, e.g., if the calculated slippage exceeds the user's maximum setting.