POST
/
v1
/
swap
/
simulate
Simulate Swap
curl --request POST \
  --url https://api.amm.flashnet.xyz/v1/swap/simulate \
  --header 'Content-Type: application/json' \
  --data '{
  "amountIn": 100000000,
  "assetInAddress": "03bitcoinassetpubkey0000000000000000000000000000000000000000000000",
  "assetOutAddress": "03usdstablecoinpubkey111111111111111111111111111111111111111111111",
  "integratorBps": 25,
  "poolId": "03aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899"
}'
{
"amountOut": 4950000,
"executionPrice": "0.00004950",
"feePaidAssetIn": 50000,
"priceImpactPct": "0.51%",
"warningMessage": null
}

Body

application/json

Swap simulation parameters including pool, assets, and amount

Request body for simulating a swap without executing it.

Simulation allows users to preview swap outcomes including expected output, price impact, and fees before committing to the transaction.

poolId
string
required

LP public key of the pool to simulate the swap through. The pool must exist and be active.

Example:

"03aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899"

assetInAddress
string
required

Address of the asset the user would provide. Must be one of the two assets in the selected pool.

Example:

"03bitcoinassetpubkey0000000000000000000000000000000000000000000000"

assetOutAddress
string
required

Address of the asset the user wants to receive. Must be the other asset in the selected pool.

Example:

"03usdstablecoinpubkey111111111111111111111111111111111111111111111"

amountIn
integer
required

Amount of input asset to simulate swapping, in its smallest unit. Must be positive. Larger amounts will show greater price impact.

Required range: x >= 0
Example:

100000000

integratorBps
integer | null

Optional integrator fee rate in basis points applied on the input amount. 25 bps = 0.25%

Required range: x >= 0
Example:

25

Response

Simulation completed successfully

Response from swap simulation with expected outcomes.

amountOut
integer
required

Expected amount of output asset the user would receive, in its smallest unit. This is after all fees are deducted.

Required range: x >= 0
Example:

4950000

executionPrice
string | null

Effective execution price of the swap. Shows how many units of output asset per unit of input asset.

Example:

"0.00004950"

feePaidAssetIn
integer | null

Total fee paid denominated in the input asset only. For B->A swaps, this includes LP, host, and integrator fees (all charged in B). For A->B swaps, host and integrator fees are charged in the output asset (B) and are therefore not included here; only the LP fee (in A) is reported.

Required range: x >= 0
Example:

50000

priceImpactPct
string | null

Price impact of the swap as a percentage. Higher values indicate more slippage from the ideal price.

Example:

"0.51%"

warningMessage
string | null

Warning message if the simulation detects potential issues. Common warnings include high slippage or low liquidity.

Example:

"High price impact detected"