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
| Parameter | Type | Required | Description |
|---|
user | PublicKey | Yes | Wallet depositing into the market |
trancheSide | TrancheSide | Yes | TrancheSide.Senior or TrancheSide.Junior |
amountBase | bigint | Yes | Base asset amount to deposit, in raw base-token units |
minLpOut | bigint | No | Minimum selected-tranche LP shares to receive, in raw LP units. Defaults to 0n |
setupPayer | PublicKey | No | Payer for associated token account setup. Defaults to user |
tokenBaseSrc | PublicKey | No | Base token source account. Defaults to the user’s base ATA |
tokenSySrc | PublicKey | No | Temporary/user SY token account. Defaults to the user’s SY ATA |
tokenLpDst | PublicKey | No | Destination LP token account. Defaults to the selected LP ATA |
tokenProgram | PublicKey | No | SPL 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.