Skip to main content

createWrapperCollectInterestInstruction

Builds a raw instruction that collects accrued interest from a yield position and unwraps the SY to the base asset in a single atomic operation.

Usage

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

const ix = createWrapperCollectInterestInstruction(
  {
    claimer: wallet.publicKey,
    authority: vaultAuthority,
    vault: vaultAddress,
    addressLookupTable: vaultLookupTable,
    escrowSy: vaultEscrowSy,
    syProgram: syProgramId,
    tokenProgram: TOKEN_PROGRAM_ID,
    yieldPosition: userYieldPositionPda,
    tokenSyDst: userSyTokenAccount,
    treasurySyTokenAccount: treasurySyAccount,
    eventAuthority: eventAuthorityPda,
    program: EXPONENT_CORE_PROGRAM_ID,
  },
  {
    redeemSyAccountsLength: 0,
  }
);

Accounts

NameTypeSignerWritableDescription
claimerPublicKeyYesYesThe user collecting interest
authorityPublicKeyNoYesVault authority PDA
vaultPublicKeyNoYesVault account
addressLookupTablePublicKeyNoNoVault address lookup table
escrowSyPublicKeyNoYesVault SY escrow account
syProgramPublicKeyNoNoSY program
tokenProgramPublicKeyNoNoSPL Token program
yieldPositionPublicKeyNoYesUser’s yield position PDA
tokenSyDstPublicKeyNoYesDestination SY token account
treasurySyTokenAccountPublicKeyNoYesTreasury SY token account (fees)
eventAuthorityPublicKeyNoNoEvent authority PDA
programPublicKeyNoNoExponent Core program

Args

NameTypeDescription
redeemSyAccountsLengthnumberNumber of remaining accounts for SY redemption CPI

Returns

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