Skip to main content

createUnstakeVoteInstruction

Builds a raw instruction to reclaim LP tokens that were previously staked for voting on a governance proposal. Can only be called after the proposal has been finalized. The original voter receives their staked LP tokens back from the escrow.

Usage

import { createUnstakeVoteInstruction } from "@exponent-labs/exponent-sdk/client/vaults";
import { PublicKey } from "@solana/web3.js";
import { TOKEN_PROGRAM_ID } from "@solana/spl-token";

const ix = createUnstakeVoteInstruction({
  voter: voterKeypair.publicKey,
  vault: vaultAddress,
  proposal: proposalAddress,
  voteAccount: voteAccountAddress,
  tokenLpDst: voterLpTokenAccount,
  tokenLpEscrow: proposalLpEscrow,
  mintLp: lpMintAddress,
  tokenProgram: TOKEN_PROGRAM_ID,
});

Accounts

NameSignerWritableDescription
voterYesYesThe original voter reclaiming their LP tokens
vaultNoNoVault account associated with the proposal
proposalNoNoFinalized proposal
voteAccountNoYesPer-voter account tracking their vote
tokenLpDstNoYesVoter’s LP token account (destination)
tokenLpEscrowNoYesEscrow account holding staked LP tokens
mintLpNoNoLP token mint
tokenProgramNoNoSPL Token program

Returns

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