POST
/
api
/
algebra
/
interactions
/
add
curl --request POST \
  --url https://public-beam-backend-mainnet.codemelt.codes/api/algebra/interactions/add \
  --header 'Content-Type: application/json' \
  --data '{
  "amountA": 123,
  "amountB": 123,
  "tokenAId": 123,
  "tokenBId": 123,
  "tickLower": 123,
  "tickUpper": 123,
  "networkName": "<string>",
  "recipient": "<string>",
  "creationTick": 123
}'
{
  "message": "<string>",
  "data": null,
  "status": "<any>"
}

Add Liquidity

This endpoint provides functionality for adding liquidity to Algebra pools. It supports both single-token and balanced liquidity provision.

Data Update Frequency

The position data updates follow our standard update cycles:

Real-time Updates (5-second intervals)

  • Position Value
  • Current Price Range
  • Unclaimed Fees

Hourly Updates

  • APR Calculations
  • Fee Generation Statistics

Using the SDK

import api, { IConnection } from "codemelt-retro-api-sdk"
import { AlgebraAddLiquidityDTO } from 'codemelt-retro-api-sdk/structures/AlgebraAddLiquidityDTO'

const connection: IConnection = {
  host: '<enter your host url here>',
  headers: {
    'x-api-key': '<enter your api key here>'
  }
}

const networkName = 'Zeta Mainnet'
const input: AlgebraAddLiquidityDTO = {
  amountA: Number(firstTokenAmount),
  amountB: Number(secondTokenAmount),
  tokenAId: tokenA.id,
  tokenBId: tokenB.id,
  tickLower: tickLower,
  tickUpper: tickUpper,
  networkName: networkName,
  recipient: signer.address,
  //this is used only for pool creations, otherwise any number is good
  creationTick: tickCurrent
}

const resp = await api.functional.api.algebra.interactions.add.addLiqudity(
  connection,
  input
)

Security Considerations

  1. Slippage Protection

    • Default slippage tolerance for non-meme pools is 2%
    • Default slippage tolerance for meme pools is 10%
  2. Price Range

    • Tick ranges must be within valid bounds (-887272 to 887272)
    • Tick ranges must be in valid tick spacing. Default tick spacing is 60
    • Wider ranges provide more stable returns but less capital efficiency
    • Narrower ranges provide higher capital efficiency but require more active management

Best Practices

  1. Position Sizing

    • Balance token amounts according to current price
    • Account for price impact in larger positions
  2. Range Selection

    • Analyze historical price data for range selection
    • Consider volatility when setting price ranges
    • Account for gas costs of range adjustments

Body

application/json
amountA
number
required
amountB
number
required
tokenAId
number
required
tokenBId
number
required
tickLower
number
required
tickUpper
number
required
networkName
string
required
recipient
string
required
creationTick
number
required

Response

201 - application/json
message
string
required
data
null
required
status
any
required