Adds liquidity to an existing pool by depositing both assets. The operation is processed synchronously and returns immediately with the results.
LP (Liquidity Provider) tokens represent your share of the pool. They can be:
Requires a valid JWT bearer token. The token’s public key must match the userPublicKey in the
request.
userPublicKey - Public key of the liquidity providerpoolId - LP public key of the poolassetASparkTransferId - Transfer proof for Asset AassetBSparkTransferId - Transfer proof for Asset B (empty for single-sided)assetAAmountToAdd - Amount of Asset A to depositassetBAmountToAdd - Amount of Asset B to deposit (0 for single-sided)nonce - Unique value for replay protectionsignature - Request signature200 OK with LP tokens minted and amounts used400 Bad Request if validation fails or transfers invalid401 Unauthorized if authentication fails409 Conflict if nonce already used500 Internal Server Error if liquidity addition failsBearer authentication header of the form Bearer <token>, where <token> is your auth token.
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.
Hex-encoded secp256k1 public key of the liquidity provider. This must match the public key in your authentication token.
"03abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567"
Unique identifier of the pool to add liquidity to. This is the pool's identity public key.
"03aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899"
Spark network transfer ID for the Asset A deposit. This transfer must not have been used before and will be reserved during validation.
"550e8400-e29b-41d4-a716-446655440000"
Spark network transfer ID for the Asset B deposit. Required for constant product pools, can be empty for single-sided pools.
"650f9500-f39c-51e5-b827-557766550001"
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.
x >= 0100000000
Amount of Asset B to add, in its smallest unit. For single-sided pools, this should be 0.
x >= 050000
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.
x >= 095000000
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.
x >= 045000
Unique nonce to prevent replay attacks.
Each nonce can only be used once per user.
"add-liquidity-nonce-456"
Hex-encoded secp256k1 signature of the request. Must be signed by the private key corresponding to userPublicKey.
"3045022100abc..."
Liquidity addition executed successfully
Response for adding liquidity to a pool
User-friendly request ID for tracking
"01HJZKFABCDEFGHJKLMNPQRSTVW"
Whether liquidity addition was accepted
true
Settlement service request ID for correlation
"018D5E56-9D80-7890-A1B2-C3D4E5F6G7H8"
LP tokens minted (populated if accepted)
"12340000.00000000"
Actual asset A amount used (populated if accepted)
x >= 0"100000000"
Actual asset B amount used (populated if accepted)
x >= 0"50000"
User-friendly error message (populated if rejected)
Details about refunded assets