import { createCollectInterestInstruction, amount } from "@exponent-labs/exponent-sdk/client/core";
import { PublicKey } from "@solana/web3.js";
// Collect all accrued interest
const ix = createCollectInterestInstruction(
{
owner: wallet.publicKey,
yieldPosition: userYieldPositionPda,
vault: vaultAddress,
tokenSyDst: userSyTokenAccount,
escrowSy: vaultEscrowSy,
authority: vaultAuthority,
tokenProgram: TOKEN_PROGRAM_ID,
syProgram: syProgramId,
treasurySyTokenAccount: treasurySyAccount,
addressLookupTable: vaultLookupTable,
eventAuthority: eventAuthorityPda,
program: EXPONENT_CORE_PROGRAM_ID,
},
{
amount: amount("All"),
}
);
// Collect a specific amount
const ixPartial = createCollectInterestInstruction(
{ /* ...same accounts... */ },
{
amount: amount("Some", [500_000n]),
}
);