Overview
Creates an unsigned transaction for withdrawing liquidity from a Meteora DAMM v2 (Dynamic AMM) pool. The API validates available liquidity, builds a combined transaction that removes liquidity and transfers withdrawn tokens to the manager wallet, and returns the transaction ready for manager wallet signing.Request Parameters
Percentage of unlocked liquidity to withdraw (
0 < value <= 15). For example, 12.5 withdraws 12.5% of available liquidity. Maximum 15% to prevent excessive liquidity removal.Response
Indicates if the operation was successful
Base58 encoded unsigned transaction that needs to be signed by the manager wallet
Unique identifier for this withdrawal request (needed for confirmation)
Address of the Meteora DAMM v2 pool
Mint address of Token A in the pool
Mint address of Token B in the pool
Whether Token B is native SOL (handled specially in transfers)
The withdrawal percentage requested
Number of instructions in the transaction
Object containing estimated withdrawal amounts:
tokenA(string): Estimated Token A amount to be withdrawntokenB(string): Estimated Token B amount to be withdrawnliquidityDelta(string): Amount of liquidity being removed
Instructions for the next step in the process
Success Response
Error Responses
400 - Missing Parameters
400 - Missing Parameters
400 - Invalid Withdrawal Percentage
400 - Invalid Withdrawal Percentage
404 - No Positions Found
404 - No Positions Found
400 - No Unlocked Liquidity
400 - No Unlocked Liquidity
400 - Withdrawal Too Small
400 - Withdrawal Too Small
500 - Configuration Error
500 - Configuration Error
500 - Transaction Creation Failed
500 - Transaction Creation Failed
Process Flow
This endpoint performs several steps to build the withdrawal transaction:Validate Parameters
Ensures withdrawalPercentage is provided and is a valid number between 0 and 15 (maximum 15% to prevent excessive liquidity removal)
Validate Server Configuration
Checks that the server is properly configured to process withdrawal requests
Calculate Withdrawal Amount
Calculates liquidityDelta based on the withdrawal percentage and available unlocked liquidity
Calculate Token Amounts
Calculates the exact token amounts that will be withdrawn based on current pool state
Build Transaction
Creates a transaction that:
- Removes liquidity from the pool position
- Transfers all withdrawn tokens to the manager wallet
- Creates any needed token accounts
Handle Native SOL
If Token B is native SOL, uses SystemProgram.transfer instead of SPL token transfer
Withdrawal Percentage Calculation
The withdrawal amount is calculated as:First position only: This endpoint withdraws from the first position in the pool. If multiple positions exist, you need to call this endpoint multiple times to withdraw from other positions.
Native SOL Handling
Special handling for wrapped SOL (wSOL):When Token B is the native SOL mint (So11111111111111111111111111111111111111112):
- Meteora automatically unwraps wSOL to native SOL during withdrawal
- No token account is created for Token B for the LP owner
- Transfers use
SystemProgram.transferinstead of SPL token transfer - Withdrawn SOL is received directly as native SOL in the manager wallet
Request ID
TherequestId is essential for the confirmation step:
- Format: Random 16-byte hex string
- Expiration: Automatically cleaned up after 15 minutes
- Required: Must be provided to
/damm/withdraw/confirm
Rate Limiting
This endpoint is subject to rate limiting:- 10 requests per 5-minute window per IP
- Returns HTTP 429 when limit exceeded with message: “Too many liquidity requests, please wait a moment.”
Security Considerations
Next Steps
After receiving the unsigned transaction:- Deserialize the transaction using
@solana/web3.js - Sign the transaction with your manager wallet
- Submit the signed transaction to
/damm/withdraw/confirm
Request Expiration
Withdrawal requests expire after a period of time:- Validity: You must call
/damm/withdraw/confirmwithin 10 minutes - After expiration: You’ll need to create a new withdrawal request
Related Endpoints
/damm/withdraw/confirm- Confirm and submit the withdrawal transaction/damm/deposit/build- Build deposit transaction
