POST
/
v1
/
liquidity
/
add
/
simulate
Simulate Add Liquidity
curl --request POST \
  --url https://api.amm.flashnet.xyz/v1/liquidity/add/simulate \
  --header 'Content-Type: application/json' \
  --data '{
  "assetAAmount": "100000000",
  "assetBAmount": "50000",
  "poolId": "03aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899"
}'
{
"assetAAmountToAdd": "100000000",
"assetARefundAmount": "0",
"assetBAmountToAdd": "50000",
"assetBRefundAmount": "0",
"lpTokensToMint": "7071067",
"poolSharePercentage": "25.5",
"warningMessage": null
}

Body

application/json

Liquidity addition simulation parameters

Request body for simulating liquidity addition without executing it.

Simulation allows users to preview the results including actual amounts that would be added, LP tokens that would be minted, and any refunds due to ratio mismatch.

poolId
string
required

LP public key of the pool to simulate adding liquidity to. The pool must exist and be active.

Example:

"03aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899"

assetAAmount
integer
required

Amount of Asset A to simulate adding, in its smallest unit. Must be positive. For constant product pools, actual amount used may be less to maintain the correct ratio.

Required range: x >= 0
Example:

100000000

assetBAmount
integer
required

Amount of Asset B to simulate adding, in its smallest unit. Must be positive for constant product pools, should be 0 for single-sided pools.

Required range: x >= 0
Example:

50000

Response

Simulation completed successfully

Response from liquidity addition simulation with expected outcomes.

lpTokensToMint
string
required

Amount of LP tokens that would be minted. This represents your share of the pool.

Example:

"7071067"

assetAAmountToAdd
integer
required

Actual amount of Asset A that would be added to the pool. May be less than requested if ratio adjustment is needed.

Required range: x >= 0
Example:

100000000

assetBAmountToAdd
integer
required

Actual amount of Asset B that would be added to the pool. May be less than requested if ratio adjustment is needed.

Required range: x >= 0
Example:

50000

assetARefundAmount
integer
required

Amount of Asset A that would be refunded due to ratio mismatch. Zero if the provided ratio matches the pool ratio.

Required range: x >= 0
Example:

0

assetBRefundAmount
integer
required

Amount of Asset B that would be refunded due to ratio mismatch. Zero if the provided ratio matches the pool ratio.

Required range: x >= 0
Example:

0

poolSharePercentage
string
required

Your estimated share of the pool after adding liquidity, as a percentage.

Example:

"25.5"

warningMessage
string | null

Warning message if the simulation detects potential issues. Common warnings include single-sided pool requirements or significant ratio mismatch.

Example:

"Impossible to add liquidity to a single-sided pool"