Skip to main content

createExecuteWithdrawalInstruction

Builds a raw instruction to execute a previously queued and filled withdrawal. Transfers the underlying tokens to the depositor. LP tokens are burned during the vault manager’s fill_withdrawal step. The withdrawal account must have been filled before execution. Called by the withdrawal account owner.

Usage

import { createExecuteWithdrawalInstruction } from "@exponent-labs/exponent-sdk/client/vaults";
import { PublicKey } from "@solana/web3.js";

const ix = createExecuteWithdrawalInstruction(
  {
    vault: vaultAddress,
    exponentPrices: exponentPricesPda,
    owner: wallet.publicKey,
    withdrawalAccount: withdrawalAccountAddress,
    tokenLpEscrow: vaultLpEscrowAccount,
    feeTreasury: feeTreasuryAddress,
    mintLp: lpMintAddress,
    tokenProgram: TOKEN_PROGRAM_ID,
    systemProgram: SYSTEM_PROGRAM_ID,
    rent: SYSVAR_RENT_PUBKEY,
  },
  {
    tokenTransferAccountsUntil: 2,
  }
);

Accounts

NameSignerWritableDescription
vaultNoYesThe Strategy Vault account
exponentPricesNoNoGlobal ExponentPrices account for AUM calculations
ownerYesYesThe withdrawal account owner
withdrawalAccountNoYesThe withdrawal request account
tokenLpEscrowNoYesVault’s LP token escrow account
feeTreasuryNoYesFee treasury account for withdrawal fees
mintLpNoYesThe vault’s LP token mint
tokenProgramNoNoSPL Token program
systemProgramNoNoSystem program
rentNoNoRent sysvar

Args

NameTypeDescription
tokenTransferAccountsUntilnumberNumber of remaining accounts that are token transfer pairs (u8)

Returns

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