Skip to main content
The ixsDepositLiquidity method builds transaction instructions that deposit tokens into the vault and mint LP tokens to the depositor.

Usage

import { ExponentVault } from "@exponent-labs/exponent-sdk";
import { Connection, PublicKey, Transaction, sendAndConfirmTransaction } from "@solana/web3.js";
const connection = new Connection("https://api.mainnet-beta.solana.com");
const vault = await ExponentVault.load({ connection, address: vaultAddress });

const ixs = await vault.ixsDepositLiquidity({
  depositor: wallet.publicKey,
  mint: new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), // USDC
  tokenAmountIn: 100_000_000n,
  minLpOut: 0n,
});

const tx = new Transaction().add(...ixs);
const signature = await sendAndConfirmTransaction(connection, tx, [wallet]);

Required Parameters

ParameterTypeDescription
depositorPublicKeyThe depositor’s wallet public key
mintPublicKeyThe token mint to deposit. Must match a vault token entry
tokenAmountInbigint | numberAmount of tokens to deposit in native units
minLpOutbigint | numberMinimum LP tokens to receive. Set to 0 to accept any amount

Optional Parameters

ParameterTypeDescription
tokenSrcPublicKeySource token account. Defaults to the depositor’s ATA for mint
entryTokenVaultPublicKeyVault token escrow. Defaults to the Squads-controlled account defined in the token entry
tokenLpDstPublicKeyLP token destination. Defaults to the depositor’s ATA for the LP mint
tokenProgramPublicKeyToken program. Defaults to TOKEN_PROGRAM_ID
extraRemainingAccountsAccountMeta[]Additional accounts (e.g., Kamino obligation accounts)

Returns

Returns a Promise<TransactionInstruction[]> — an array of instructions that deposit tokens into the vault and mint LP tokens.

LP Token Calculation

The amount of LP tokens minted is proportional to the deposit relative to total vault AUM:
LP out = (token_amount_in_base × total_lp_supply) / total_aum_in_base
The minLpOut parameter protects against price movements between transaction construction and execution.
To estimate the exchange rate before depositing, read vault.state.financials for AUM and call vault.fetchLpTokenSupply() for the current LP supply.