Skip to main content

createWrapperProvideLiquidityClassicInstruction

Provides liquidity to a CLMM market using both base assets and PT tokens. This instruction mints SY from the supplied base asset and combines it with user-supplied PT tokens to deposit liquidity into the specified tick range. This is useful when the caller already holds PT and wants to pair it with freshly minted SY.

Usage

import { createWrapperProvideLiquidityClassicInstruction } from "@exponent-labs/exponent-sdk/client/clmm";
import { PublicKey, SystemProgram } from "@solana/web3.js";

const ix = createWrapperProvideLiquidityClassicInstruction({
  depositor: depositorKeypair.publicKey,
  market: new PublicKey("market..."),
  ticks: new PublicKey("ticks..."),
  tokenPtEscrow: new PublicKey("tokenPtEscrow..."),
  tokenSyEscrow: new PublicKey("tokenSyEscrow..."),
  tokenSyDepositor: new PublicKey("tokenSyDepositor..."),
  tokenPtDepositor: new PublicKey("tokenPtDepositor..."),
  tokenProgram: new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
  marketAddressLookupTable: new PublicKey("lookupTable..."),
  syProgram: new PublicKey("syProgram..."),
  lpPosition: new PublicKey("lpPosition..."),
  systemProgram: SystemProgram.programId,
  rent: new PublicKey("SysvarRent111111111111111111111111111111111"),
  eventAuthority: new PublicKey("eventAuthority..."),
  program: new PublicKey("program..."),
  lowerTick: 0,
  upperTick: 100,
  amountBase: 1_000_000n,
  amountPt: 500_000n,
  minLpOut: 900_000n,
  mintSyAccountsUntil: 3,
});

Accounts

NameTypeSignerWritableDescription
depositorPublicKeyYesYesWallet providing liquidity
marketPublicKeyNoYesThe CLMM market account
ticksPublicKeyNoYesThe market tick array account
tokenPtEscrowPublicKeyNoYesMarket PT escrow account
tokenSyEscrowPublicKeyNoYesMarket SY escrow account
tokenSyDepositorPublicKeyNoYesDepositor’s SY token account
tokenPtDepositorPublicKeyNoYesDepositor’s PT token account
tokenProgramPublicKeyNoNoSPL Token program
marketAddressLookupTablePublicKeyNoNoMarket address lookup table
syProgramPublicKeyNoNoSY program
lpPositionPublicKeyNoYesLP position account
systemProgramPublicKeyNoNoSystem program
rentPublicKeyNoNoRent sysvar
eventAuthorityPublicKeyNoNoEvent authority PDA
programPublicKeyNoNoCLMM program ID

Args

NameTypeDescription
lowerTicku32The lower tick boundary for the liquidity position
upperTicku32The upper tick boundary for the liquidity position
amountBaseu64The amount of base asset to provide
amountPtu64The amount of PT tokens to provide
minLpOutu64The minimum amount of LP tokens to receive
mintSyAccountsUntilu8The number of CPI remaining accounts used for SY minting

Returns

TransactionInstruction — a transaction instruction ready to be added to a transaction.