Skip to main content

ixCancelWithdrawal

Cancels a previously queued withdrawal and returns the escrowed LP tokens to the depositor. Can only be called by the owner of the withdrawal account, and only before the withdrawal has been fully filled by the vault manager.

Usage

const ix = vault.ixCancelWithdrawal({
  owner: wallet.publicKey,
  withdrawalAccount: withdrawalKeypair.publicKey,
});

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

Parameters

NameTypeRequiredDescription
ownerPublicKeyYesThe depositor who queued the withdrawal (must be signer)
withdrawalAccountPublicKeyYesThe withdrawal account to cancel
tokenLpDstPublicKeyNoDestination for returned LP tokens. Defaults to the owner’s ATA for the vault’s LP mint
tokenProgramPublicKeyNoSPL Token program. Defaults to TOKEN_PROGRAM_ID
tokenLpEscrowPublicKeyNoThe vault’s LP token escrow. Auto-derived from vault state

Returns

TransactionInstruction — a single instruction that cancels the withdrawal and returns LP tokens.
After cancellation, the withdrawal account is closed and its rent is returned to the owner. The LP tokens are transferred from the vault’s LP escrow back to the owner’s token account.