Skip to main content
Walk through the basic vault lifecycle: deposit tokens, receive LP shares, and queue and execute a withdrawal before taking user deposits.
1

Deposit Liquidity

Deposit supported tokens into the vault and receive LP tokens representing your proportional share.
// The mint of the token you want to deposit (must be a token entry in the vault)
const tokenMint = new PublicKey("...");

const ixs = await vault.ixsDepositLiquidity({
  depositor: wallet.publicKey,
  mint: tokenMint,
  tokenAmountIn: 1_000_000_000n,
  minLpOut: 0n,
});

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

Queue a Withdrawal

Lock your LP tokens and create a withdrawal request. Save the returned withdrawal address for the final step.
const { ix, withdrawalKeypair } = vault.ixQueueWithdrawal({
  depositor: wallet.publicKey,
  lpAmount: 500_000_000n,
});

// The withdrawalKeypair must be included as a signer
const tx = new Transaction().add(ix);
await sendAndConfirmTransaction(connection, tx, [wallet, withdrawalKeypair]);

// Save this address for the next step
const withdrawalAddress = withdrawalKeypair.publicKey;
3

Execute Withdrawal

Once the vault manager has filled the withdrawal request, execute it to receive the underlying tokens.
import { getAssociatedTokenAddressSync } from "@solana/spl-token";
import { ExponentVaultsPDA } from "@exponent-labs/exponent-vaults-pda";

// Token account pairs: vault escrow → your wallet ATA
// One pair per token in the vault
const pda = new ExponentVaultsPDA();
const tokenAccountPairs = vault.state.tokenEntries.map((entry) => ({
  tokenSrc: pda.tokenEntryEscrow({
    vault: vaultAddress,
    mint: entry.mint,
  })[0],
  tokenDst: getAssociatedTokenAddressSync(entry.mint, wallet.publicKey),
}));

const ix = vault.ixExecuteWithdrawal({
  owner: wallet.publicKey,
  withdrawalAccount: withdrawalAddress,
  tokenAccountPairs,
});

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

Reading State

You can also inspect vault state without sending transactions:
// AUM from vault financials
const aumInBase = vault.state.financials.aumInBase;
const aumInPositions = vault.state.financials.aumInBaseInPositions;

// All token entries
const entries = vault.state.tokenEntries;

// Vault LP mint address
const lpMint = vault.mintLp;

// LP token supply (async RPC call)
const lpSupply = await vault.fetchLpTokenSupply();