> ## Documentation Index
> Fetch the complete documentation index at: https://docs.exponent.finance/llms.txt
> Use this file to discover all available pages before exploring further.

# Vault Testing (via SDK)

> Validate your vault setup by running a test flow

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

<Steps>
  <Step title="Deposit Liquidity">
    Deposit supported tokens into the vault and receive LP tokens representing your proportional share.

    ```typescript theme={null}
    // 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]);
    ```
  </Step>

  <Step title="Queue a Withdrawal">
    Lock your LP tokens and create a withdrawal request. Save the returned withdrawal address for the final step.

    ```typescript theme={null}
    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;
    ```
  </Step>

  <Step title="Execute Withdrawal">
    Once the vault manager has filled the withdrawal request, execute it to receive the underlying tokens.

    ```typescript theme={null}
    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]);
    ```
  </Step>
</Steps>

## Reading State

You can also inspect vault state without sending transactions:

```typescript theme={null}
// 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();
```
