Skip to main content

The following pattern shows the state reads that are useful before routing a user into a tranche or accepting tranching LP tokens in another protocol.
tranchingFromNumber only converts Exponent Tranching Number fixed-point values. It does not divide token amounts by mint decimals. Balance, NAV, and transaction amount displays usually also need the SY, base, and LP mint decimals.

Transaction Builders

A transaction can then be built with the instruction that matches the user’s input and desired output: Output protection is normally represented by these guard fields:

Integration Sequence

Most integrations follow this sequence:
  1. TranchingMarket.load(...) creates the market context.
  2. market.reload() refreshes the SDK’s local account state before pricing or transaction construction.
  3. market.lpMint(trancheSide) identifies the selected LP mint.
  4. getSrLpPriceNetAsset() or getJrLpPriceNetAsset() provides the effective-NAV price input.
  5. state.marketState, state.statusFlags, utilization, and recovery timestamps describe the current lifecycle and risk state.
  6. Capacity Helpers provide remaining Senior or Junior room.
  7. APY and Protection helpers can show expected Senior/Junior return and Senior drawdown protection.
  8. SDK instruction builders construct the deposit or withdrawal transaction, with minLpOut, minAmountOut, or minBaseOut as output guards.
  9. Lending integrations usually treat FixedTermRecovery as a Senior redemption lock and apply conservative collateral factors to Junior LP because Junior absorbs first losses.

Read Functions

SDK getters for market state, LP prices, capacity, APY, and token accounts.

TypeScript Instructions

SDK builders for deposits, withdrawals, and wrappers.