Skip to main content
The ixWrapperDeposit instruction deposits base assets into a tranching market. The wrapper mints SY from the base asset, deposits SY into the selected tranche, and mints tranche LP shares.

Usage

import { Transaction, sendAndConfirmTransaction } from "@solana/web3.js";
import { TrancheSide } from "@exponent-labs/exponent-sdk/client/tranching";

const { ixs, setupIxs } = await market.ixWrapperDeposit({
  user: wallet.publicKey,
  trancheSide: TrancheSide.Senior,
  amountBase: 1_000_000_000n, // raw base-token units
  minLpOut: 0n,               // raw Senior LP units; set above 0 for output protection
});

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

Parameters

ParameterTypeRequiredDescription
userPublicKeyYesWallet depositing into the market
trancheSideTrancheSideYesTrancheSide.Senior or TrancheSide.Junior
amountBasebigintYesBase asset amount to deposit, in raw base-token units
minLpOutbigintNoMinimum selected-tranche LP shares to receive, in raw LP units. Defaults to 0n
setupPayerPublicKeyNoPayer for associated token account setup. Defaults to user
tokenBaseSrcPublicKeyNoBase token source account. Defaults to the user’s base ATA
tokenSySrcPublicKeyNoTemporary/user SY token account. Defaults to the user’s SY ATA
tokenLpDstPublicKeyNoDestination LP token account. Defaults to the selected LP ATA
tokenProgramPublicKeyNoSPL Token program for SY and LP token accounts

Returns

Returns an object with:
  • ixs - Instructions that perform the SY mint, tranche deposit, and flavor-specific pre/post steps
  • setupIxs - Associated token account setup instructions for base, SY, and LP token accounts
Always include setupIxs before ixs in the transaction. The setup instructions are idempotent.
Deposits update market NAV before minting LP shares. Use minLpOut if the transaction depends on a specific output amount.