Skip to main content

createFillWithdrawalInstruction

Fills a depositor’s queued withdrawal request with underlying tokens. This is a manager-only operation — the vault manager specifies which token and how much to allocate to the pending withdrawal. There is no high-level class method for this instruction; use the raw instruction builder directly. LP tokens are burned during this step. After a withdrawal is filled, the depositor can call Execute Withdrawal to receive their tokens.

Usage

import { createFillWithdrawalInstruction } from "@exponent-labs/exponent-sdk/client/vaults";

const ix = createFillWithdrawalInstruction(
  {
    manager: wallet.publicKey,
    vault: vaultAddress,
    exponentPrices: exponentPricesPda,
    withdrawalAccount: withdrawalAccountAddress,
    mintLp: vaultMintLp,
  },
  {
    mint: usdcMint, // Token to fill with (null for SOL)
    amount: 1_000_000n, // Amount of the token to fill
  },
);

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

Accounts

NameSignerWritableDescription
managerYesNoVault manager wallet
vaultNoYesThe vault account
exponentPricesNoNoExponentPrices PDA for AUM validation
withdrawalAccountNoYesThe depositor’s withdrawal account to fill
mintLpNoYesThe vault’s LP token mint

Args

NameTypeDescription
mint`PublicKeynull`The token mint to fill with. null for SOL
amountu64Amount of the token to allocate to this withdrawal

Returns

TransactionInstruction — a transaction instruction ready to be added to a transaction.
A withdrawal may be partially filled across multiple calls with different tokens. The depositor can execute the withdrawal once all fills are complete and the lock period has passed.