Skip to main content

Overview

Creates an unsigned transaction for depositing liquidity into a Meteora DAMM v2 (Dynamic AMM) pool. The API validates the deposit amounts, builds a combined transaction that transfers tokens from the manager wallet to the LP owner and adds liquidity to the pool, and returns the transaction ready for manager wallet signing.
Manager-only operation: This endpoint requires the manager wallet to sign and submit the transaction. The manager wallet must be configured via the MANAGER_WALLET environment variable.

Request Parameters

number
required
Amount of Token A to deposit (in UI units, e.g., 1000 for 1000 USDC). Must be non-negative.
number
required
Amount of Token B to deposit (in UI units, e.g., 0.5 for 0.5 SOL). Must be non-negative.
UI units: Amounts are specified in human-readable units (e.g., 1.5 SOL, not 1500000000 lamports). The API automatically converts to raw token amounts based on token decimals.

Response

boolean
Indicates if the operation was successful
string
Base58 encoded unsigned transaction that needs to be signed by the manager wallet
string
Unique identifier for this deposit request (needed for confirmation)
string
Address of the Meteora DAMM v2 pool
string
Mint address of Token A in the pool
string
Mint address of Token B in the pool
boolean
Whether Token B is native SOL (handled specially in transfers)
number
Number of instructions in the transaction
object
Object containing deposit amounts (in raw token units):
  • tokenA (string): Token A amount in raw units
  • tokenB (string): Token B amount in raw units
  • liquidityDelta (string): Liquidity amount to be added
string
Instructions for the next step in the process

Success Response

Error Responses

Both amounts must be valid numbers, not strings or other types.
Deposit amounts cannot be negative.
The protocol wallet does not have any LP positions in the configured pool. A position must be created before depositing.
The calculated liquidity delta is too small to process (rounds to zero).
The server is not properly configured to process deposit requests.

Process Flow

This endpoint performs several steps to build the deposit transaction:
1

Validate Parameters

Ensures tokenAAmount and tokenBAmount are provided, are valid numbers, and are non-negative
2

Validate Server Configuration

Checks that the server is properly configured to process deposit requests
3

Verify Authorization

Validates that the manager wallet is authorized to deposit funds
4

Fetch Pool State

Retrieves the current state of the Meteora DAMM v2 pool
5

Convert to Raw Amounts

Converts UI amounts to raw token amounts based on token decimals (e.g., 1.5 SOL → 1500000000 lamports)
6

Get User Positions

Fetches all LP positions owned by the protocol wallet (uses first position)
7

Calculate Liquidity Amount

Calculates the liquidity amount based on token amounts and current pool state
8

Build Transaction

Creates a transaction that:
  • Transfers tokens from manager wallet
  • Adds liquidity to the pool position
  • Creates any needed token accounts
9

Handle Native SOL

If Token B is native SOL, uses SystemProgram.transfer instead of SPL token transfer
10

Generate Security Hash

Creates a security hash for tamper detection during confirmation
11

Generate Request ID

Creates a unique request ID for tracking this deposit request
12

Return Unsigned Transaction

Returns the Base58 encoded transaction for manager wallet signing

Liquidity Calculation

The liquidity amount is calculated based on:
  • Current pool price
  • Pool price range
  • Token amounts being deposited
  • Token metadata (decimals, transfer fees, etc.)
The calculation ensures optimal liquidity provision based on the current pool state.
First position only: This endpoint deposits to the first position in the pool. If multiple positions exist, deposits go to the first position.

Native SOL Handling

Special handling for wrapped SOL (wSOL):When Token B is the native SOL mint (So11111111111111111111111111111111111111112):
  1. The manager wallet transfers native SOL to the LP owner
  2. Meteora automatically wraps SOL during the add liquidity operation
  3. No intermediate token account is needed for Token B
  4. The deposit flow uses SystemProgram.transfer for the initial transfer

Request ID

The response includes a requestId:
  • Format: Random 16-byte hex string for identifying the request
  • Validity: Must be used within 10 minutes
  • Required: Must be provided to /damm/deposit/confirm
  • One-time use: Cannot be reused after confirmation

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

Manager authorization required:
  • Only the configured manager wallet can sign and confirm deposits
  • Tokens are transferred from manager wallet to LP owner, then added to pool
  • LP owner’s signature is added automatically by the API
  • Transaction hash validation prevents tampering during confirmation
  • This ensures only authorized deposits to the pool

Next Steps

After receiving the unsigned transaction:
  1. Deserialize the transaction using @solana/web3.js
  2. Sign the transaction with your manager wallet
  3. Submit the signed transaction to /damm/deposit/confirm
Important: Do not modify the transaction after signing. The confirmation endpoint validates the transaction hash to detect any tampering.

Request Expiration

Deposit requests expire after a period of time:
  • Validity: You must call /damm/deposit/confirm within 10 minutes
  • After expiration: You’ll need to create a new deposit request

Token Balance Requirements

Manager wallet must have sufficient balance:
  • Token A balance >= tokenAAmount (in UI units)
  • Token B balance >= tokenBAmount (in UI units)
  • SOL balance for transaction fees
If balances are insufficient, the transaction will fail during submission.