Skip to main content

TypeScript Tranching Instructions

These are the instruction builders provided by the TranchingMarket class. They handle market account resolution, return model storage, address lookup tables, SY CPI accounts, and base token conversion.
For low-level control, see the raw Codama-generated instructions if you want to work directly with generated instruction builders and resolve accounts manually.

Installation

npm install @exponent-labs/exponent-sdk @solana/web3.js
All high-level instructions are methods on the TranchingMarket class:
import { TranchingMarket } from "@exponent-labs/exponent-sdk";
import { TrancheSide } from "@exponent-labs/exponent-sdk/client/tranching";

const market = await TranchingMarket.load(connection, marketAddress, env);

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
});
Amounts are always raw token units. amountBase uses the base token’s smallest units, amountIn uses SY token units, and LP fields use the selected tranche LP mint units.

Instructions

Wrapper Deposit

Deposit base assets into the Senior or Junior tranche. The wrapper mints SY first and deposits it into the market atomically.

Wrapper Withdraw

Burn Senior or Junior LP shares, withdraw SY, and redeem SY back to the base asset in one flow.

Deposit SY

Deposit existing SY into Senior or Junior and receive tranche LP shares.

Withdraw SY

Burn tranche LP shares and receive SY without redeeming back to the base asset.