POST
/
v1
/
liquidity
/
add
Add liquidity
curl --request POST \
  --url https://api.amm.flashnet.xyz/v1/liquidity/add \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "assetAAmountToAdd": "100000000",
  "assetAMinAmountIn": "95000000",
  "assetASparkTransferId": "550e8400-e29b-41d4-a716-446655440000",
  "assetBAmountToAdd": "50000",
  "assetBMinAmountIn": "45000",
  "assetBSparkTransferId": "650f9500-f39c-51e5-b827-557766550001",
  "nonce": "add-liquidity-1702934567890",
  "poolId": "03aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899",
  "signature": "3045022100abc...",
  "userPublicKey": "03abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567"
}'
{
"accepted": false,
"error": "Pool is not accepting liquidity",
"refund": {
"assetAAmount": "100000000",
"assetATransferId": "850h9700-h50e-73g7-d049-779988770003",
"assetBAmount": "50000",
"assetBTransferId": "950i0800-i61f-84h8-e150-880099880004"
},
"requestId": "01HJZKFABCDEFGHJKLMNPQRSTVW"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Liquidity addition details including assets, amounts, and authentication

Request body for adding liquidity to a pool.

When adding liquidity to a pool, you must provide both assets in the correct ratio for constant product pools, or can provide single-sided liquidity for single-sided pools. The system will automatically calculate the optimal amounts and refund any excess.

userPublicKey
string
required

Hex-encoded secp256k1 public key of the liquidity provider. This must match the public key in your authentication token.

Example:

"03abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567"

poolId
string
required

Unique identifier of the pool to add liquidity to. This is the pool's identity public key.

Example:

"03aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899"

assetASparkTransferId
string
required

Spark network transfer ID for the Asset A deposit. This transfer must not have been used before and will be reserved during validation.

Example:

"550e8400-e29b-41d4-a716-446655440000"

assetBSparkTransferId
string
required

Spark network transfer ID for the Asset B deposit. Required for constant product pools, can be empty for single-sided pools.

Example:

"650f9500-f39c-51e5-b827-557766550001"

assetAAmountToAdd
integer
required

Amount of Asset A to add, in its smallest unit (e.g., satoshis for Bitcoin). The actual amount used may be less if the ratio needs adjustment.

Required range: x >= 0
Example:

100000000

assetBAmountToAdd
integer
required

Amount of Asset B to add, in its smallest unit. For single-sided pools, this should be 0.

Required range: x >= 0
Example:

50000

assetAMinAmountIn
integer
required

Minimum amount of Asset A to receive, in its smallest unit. If the pool doesn't have enough liquidity to meet this, the request will be rejected.

Required range: x >= 0
Example:

95000000

assetBMinAmountIn
integer
required

Minimum amount of Asset B to receive, in its smallest unit. If the pool doesn't have enough liquidity to meet this, the request will be rejected.

Required range: x >= 0
Example:

45000

nonce
string
required

Unique nonce to prevent replay attacks. Each nonce can only be used once per user.

Example:

"add-liquidity-nonce-456"

signature
string
required

Hex-encoded secp256k1 signature of the request. Must be signed by the private key corresponding to userPublicKey.

Example:

"3045022100abc..."

Response

Liquidity addition executed successfully

Response for adding liquidity to a pool

requestId
string
required

User-friendly request ID for tracking

Example:

"01HJZKFABCDEFGHJKLMNPQRSTVW"

accepted
boolean
required

Whether liquidity addition was accepted

Example:

true

lpTokensMinted
string | null

LP tokens minted (populated if accepted)

Example:

"12340000.00000000"

assetAAmountUsed
integer | null

Actual asset A amount used (populated if accepted)

Required range: x >= 0
Example:

"100000000"

assetBAmountUsed
integer | null

Actual asset B amount used (populated if accepted)

Required range: x >= 0
Example:

"50000"

error
string | null

User-friendly error message (populated if rejected)

refund
object

Details about refunded assets