@0dotxyz/p0-ts-sdk 2.3.0-alpha.3 → 2.3.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1251,23 +1251,17 @@ interface MakeSwapCollateralTxParams {
1251
1251
  swapEngineRunner?: SwapEngineRunner;
1252
1252
  }
1253
1253
  /**
1254
- * Params for {@link makeRollPtTx} — rolling a matured Exponent PT collateral position
1255
- * into its next-maturity PT, entirely within Exponent (no unwrap, no external aggregator).
1256
- *
1257
- * SY is Exponent's internal unit of account and is maturity-independent (the same SY mint
1258
- * backs every maturity of an underlying), so the roll stays in SY end-to-end:
1259
- * 1. withdraw the old PT, then `merge` it into SY (Exponent, 1:1, no slippage)
1260
- * 2. buy the new PT with that SY on the successor maturity's venue
1254
+ * Params for {@link makeRollPtTx} — rolling a matured Exponent PT collateral position into
1255
+ * its next-maturity PT, so the **full deposit ends up as new PT** (no leftover), in one
1256
+ * flash-loan-wrapped bundle:
1257
+ * 1. withdraw the old PT, then Exponent `merge` (redeem PT SY, post-maturity, 1:1)
1258
+ * 2. buy the new PT with that SY directly on the successor's **CLMM** (`MarketThree`) PT/SY
1259
+ * pool via `trade_pt` no base-token round-trip, no external aggregator
1261
1260
  * 3. deposit the new PT.
1262
1261
  *
1263
- * The buy leg (step 2) is **venue-agnostic**: the caller supplies the SY→PT_new
1264
- * instructions via `rollOpts.buyInstructions` (+ any `buyLookupTables`). They may come from
1265
- * `strip` ({@link makeExponentStripIx}, *mints* PT unbounded), the legacy `MarketTwo`
1266
- * ({@link makeExponentTradePtIx}), the CLMM/orderbook, etc. The only requirements: the buy
1267
- * spends from the SY account the `merge` writes to (`mergeAccounts.sySrcDstAta`) and
1268
- * delivers ≥ `ptOutNative` of the deposit bank's PT mint to the owner's PT ATA.
1269
- *
1270
- * Mirrors {@link MakeSwapCollateralTxParams} (`rollOpts` is the roll's analog of `swapOpts`).
1262
+ * The buy is liquidity-bounded by the successor pool's depth. The SY PT price is quoted by
1263
+ * simulating the redeem + trade (reading the CLMM `TradePtEvent.amount_out`), so the deposit
1264
+ * is sized to the guaranteed minimum out.
1271
1265
  */
1272
1266
  interface MakeRollPtTxParams {
1273
1267
  program: MarginfiProgram;
@@ -1289,7 +1283,7 @@ interface MakeRollPtTxParams {
1289
1283
  depositBank: BankType;
1290
1284
  tokenProgram: PublicKey;
1291
1285
  };
1292
- /** Exponent merge + buy-leg config (the roll's analog of swap-collateral's `swapOpts`). */
1286
+ /** Exponent redeem (`merge`) + successor-CLMM buy config for the matured PT. */
1293
1287
  rollOpts: RollPtOpts;
1294
1288
  addressLookupTableAccounts?: AddressLookupTableAccount[];
1295
1289
  overrideInferAccounts?: {
@@ -1299,51 +1293,27 @@ interface MakeRollPtTxParams {
1299
1293
  crossbarUrl?: string;
1300
1294
  }
1301
1295
  /**
1302
- * High-level Exponent config for {@link makeRollPtTx} the roll's analog of `swapOpts`.
1303
- *
1304
- * `makeRollPtTx` resolves the matured `merge` and (by default) builds the `strip` buy leg
1305
- * internally from these addresses, so the caller never assembles Exponent accounts/ixs.
1306
- * For a non-strip venue, supply a pre-built buy leg via {@link RollPtOpts.buy} (the analog
1307
- * of `makeLoopTx`'s `swapEngineRunner` override).
1296
+ * Exponent roll config for {@link makeRollPtTx}. `makeRollPtTx` resolves the matured vault's
1297
+ * `merge` accounts and the successor pool's CLMM `trade_pt` accounts internally from these
1298
+ * addresses the caller never assembles Exponent accounts/ixs.
1308
1299
  */
1309
1300
  interface RollPtOpts {
1310
- /** The matured PT's Exponent `MarketTwo` — used to resolve `merge` (one of market/vault required). */
1301
+ /** The matured PT's Exponent `MarketTwo` — its `vault` is read (one of market/vault required). */
1311
1302
  maturedMarket?: PublicKey;
1312
1303
  /** …or the matured vault directly. */
1313
1304
  maturedVault?: PublicKey;
1314
- /**
1315
- * The successor (active) vault to `strip` PT_new from — one of vault/market required for
1316
- * the default strip buy leg (ignored when {@link RollPtOpts.buy} is provided).
1317
- */
1318
- successorVault?: PublicKey;
1319
- /** …or the successor market (its vault is read). */
1320
- successorMarket?: PublicKey;
1305
+ /** The successor maturity's **CLMM** (`MarketThree`) pool — where the new PT trades (SY → PT). */
1306
+ successorMarket: PublicKey;
1307
+ /** Slippage tolerance (bps) for the SY PT CLMM swap. Defaults to 50. */
1308
+ slippageBps?: number;
1309
+ /** Token program for the shared SY mint (defaults to the classic Token program). */
1310
+ syTokenProgram?: PublicKey;
1321
1311
  /**
1322
1312
  * Optional dedicated PT-roll address lookup table (fetched internally) that compresses the
1323
- * strip flashloan's two SY-CPI account sets back under the tx size limit
1324
- * (see `examples/create-pt-roll-lut.ts`).
1313
+ * merge + CLMM-swap flashloan bytes (see `examples/create-pt-roll-lut.ts`). Account *locks*
1314
+ * are already bounded by the compact, fixed CLMM footprint.
1325
1315
  */
1326
1316
  lookupTable?: PublicKey;
1327
- /**
1328
- * Slippage/rounding buffer in basis points applied to the strip's SY-in and the minted-PT
1329
- * deposit floor, so on-chain merge rounding / SY-rate lag never short the strip. Default 10.
1330
- */
1331
- slippageBps?: number;
1332
- /**
1333
- * Escape hatch: a pre-built SY→PT_new buy leg (e.g. legacy `MarketTwo` `trade_pt`, CLMM)
1334
- * to use instead of the internal `strip`. When set, `successorVault`/`successorMarket` and
1335
- * the internal strip build are skipped. The buy must spend from the merge's SY account
1336
- * (`mergeAccounts.sySrcDstAta`) and deliver ≥ `ptOutNative` PT to the owner's PT ATA.
1337
- */
1338
- buy?: {
1339
- instructions: TransactionInstruction[];
1340
- /** ATA creates etc. — placed in the setup tx, not the flashloan. */
1341
- setupInstructions?: TransactionInstruction[];
1342
- /** LUTs the buy instructions reference. */
1343
- lookupTables?: AddressLookupTableAccount[];
1344
- /** Native PT the buy guarantees — the deposit amount (byte-patched). */
1345
- ptOutNative: bigint;
1346
- };
1347
1317
  }
1348
1318
  interface MakeSwapDebtTxParams {
1349
1319
  program: MarginfiProgram;
@@ -3391,15 +3361,19 @@ declare function makeSwapDebtTx(params: MakeSwapDebtTxParams): Promise<{
3391
3361
  }>;
3392
3362
 
3393
3363
  /**
3394
- * Roll a matured Exponent PT collateral position into its next-maturity PT, in one
3395
- * flash-loan-wrapped bundle entirely within Exponent, no unwrap, no external swap:
3364
+ * Roll a matured Exponent PT collateral position into its next-maturity PT, so the **full
3365
+ * deposit ends up as new PT** (no leftover), in one flash-loan-wrapped bundle:
3396
3366
  *
3397
- * withdraw PT_old → Exponent `merge` (PT_old → SY) → SY PT_new buy deposit PT_new
3367
+ * withdraw PT_old → Exponent `merge` (PT_old → SY) → CLMM `trade_pt` (SY → PT_new)
3368
+ * → deposit PT_new
3398
3369
  *
3399
- * The caller passes high-level config (`rollOpts`: the matured + successor markets); this
3400
- * resolves the `merge` and (by default) builds the `strip` buy leg internally the same
3401
- * way `makeLoopTx`/`makeSwapCollateralTx` internalize their swap. For a non-strip venue
3402
- * (e.g. legacy `MarketTwo` `trade_pt`), pass a pre-built buy leg via `rollOpts.buy`.
3370
+ * The matured PT is redeemed 1:1 to its SY, then the successor PT is bought **directly on its
3371
+ * CLMM (`MarketThree`) PT/SY pool** no base-token round-trip and no external aggregator. The
3372
+ * newer maturities (e.g. October bulkSOL) only list a CLMM pool (no `MarketTwo`, no order
3373
+ * book), and the CLMM uses a single `ticks` account, so the swap is a fixed, compact account
3374
+ * set regardless of trade size. The caller passes the matured Exponent market/vault + the
3375
+ * successor CLMM pool (`rollOpts`); everything Exponent is resolved internally. The buy is
3376
+ * bounded by the pool's depth.
3403
3377
  */
3404
3378
  declare function makeRollPtTx(params: MakeRollPtTxParams): Promise<{
3405
3379
  transactions: ExtendedV0Transaction[];
@@ -5223,9 +5197,10 @@ declare class MarginfiAccount implements MarginfiAccountType {
5223
5197
  /**
5224
5198
  * Creates a transaction to roll a matured Exponent PT collateral position into its
5225
5199
  * next-maturity PT, in one flash-loan-wrapped bundle
5226
- * (withdraw PT_old → merge → buy PT_new → deposit). See {@link makeRollPtTx}.
5200
+ * (withdraw PT_old → `wrapper_merge` to base swap-engine buy PT_new → deposit).
5201
+ * See {@link makeRollPtTx}.
5227
5202
  *
5228
- * @param params - Roll-PT parameters (`withdrawOpts`/`depositOpts`/`rollOpts`).
5203
+ * @param params - Roll-PT parameters (`withdrawOpts`/`depositOpts`/`swapOpts`/`rollOpts`).
5229
5204
  */
5230
5205
  makeRollPtTx(params: Omit<MakeRollPtTxParams, "marginfiAccount">): Promise<{
5231
5206
  transactions: ExtendedV0Transaction[];
@@ -5595,8 +5570,8 @@ declare class MarginfiAccountWrapper {
5595
5570
  }>;
5596
5571
  /**
5597
5572
  * Rolls a matured Exponent PT collateral position into its next-maturity PT, with
5598
- * auto-injected client data (withdraw PT_old → merge buy PT_new deposit, flash-loan
5599
- * wrapped). The buy leg is venue-agnostic supplied via `rollOpts.buyInstructions`.
5573
+ * auto-injected client data (withdraw PT_old → `wrapper_merge` to baseswap-engine buy
5574
+ * PT_new → deposit, flash-loan wrapped). The full deposit ends up as new PT.
5600
5575
  *
5601
5576
  * Auto-injects: program, marginfiAccount, bankMap, oraclePrices, bankMetadataMap, addressLookupTables
5602
5577
  *
package/dist/index.d.ts CHANGED
@@ -1251,23 +1251,17 @@ interface MakeSwapCollateralTxParams {
1251
1251
  swapEngineRunner?: SwapEngineRunner;
1252
1252
  }
1253
1253
  /**
1254
- * Params for {@link makeRollPtTx} — rolling a matured Exponent PT collateral position
1255
- * into its next-maturity PT, entirely within Exponent (no unwrap, no external aggregator).
1256
- *
1257
- * SY is Exponent's internal unit of account and is maturity-independent (the same SY mint
1258
- * backs every maturity of an underlying), so the roll stays in SY end-to-end:
1259
- * 1. withdraw the old PT, then `merge` it into SY (Exponent, 1:1, no slippage)
1260
- * 2. buy the new PT with that SY on the successor maturity's venue
1254
+ * Params for {@link makeRollPtTx} — rolling a matured Exponent PT collateral position into
1255
+ * its next-maturity PT, so the **full deposit ends up as new PT** (no leftover), in one
1256
+ * flash-loan-wrapped bundle:
1257
+ * 1. withdraw the old PT, then Exponent `merge` (redeem PT SY, post-maturity, 1:1)
1258
+ * 2. buy the new PT with that SY directly on the successor's **CLMM** (`MarketThree`) PT/SY
1259
+ * pool via `trade_pt` no base-token round-trip, no external aggregator
1261
1260
  * 3. deposit the new PT.
1262
1261
  *
1263
- * The buy leg (step 2) is **venue-agnostic**: the caller supplies the SY→PT_new
1264
- * instructions via `rollOpts.buyInstructions` (+ any `buyLookupTables`). They may come from
1265
- * `strip` ({@link makeExponentStripIx}, *mints* PT unbounded), the legacy `MarketTwo`
1266
- * ({@link makeExponentTradePtIx}), the CLMM/orderbook, etc. The only requirements: the buy
1267
- * spends from the SY account the `merge` writes to (`mergeAccounts.sySrcDstAta`) and
1268
- * delivers ≥ `ptOutNative` of the deposit bank's PT mint to the owner's PT ATA.
1269
- *
1270
- * Mirrors {@link MakeSwapCollateralTxParams} (`rollOpts` is the roll's analog of `swapOpts`).
1262
+ * The buy is liquidity-bounded by the successor pool's depth. The SY PT price is quoted by
1263
+ * simulating the redeem + trade (reading the CLMM `TradePtEvent.amount_out`), so the deposit
1264
+ * is sized to the guaranteed minimum out.
1271
1265
  */
1272
1266
  interface MakeRollPtTxParams {
1273
1267
  program: MarginfiProgram;
@@ -1289,7 +1283,7 @@ interface MakeRollPtTxParams {
1289
1283
  depositBank: BankType;
1290
1284
  tokenProgram: PublicKey;
1291
1285
  };
1292
- /** Exponent merge + buy-leg config (the roll's analog of swap-collateral's `swapOpts`). */
1286
+ /** Exponent redeem (`merge`) + successor-CLMM buy config for the matured PT. */
1293
1287
  rollOpts: RollPtOpts;
1294
1288
  addressLookupTableAccounts?: AddressLookupTableAccount[];
1295
1289
  overrideInferAccounts?: {
@@ -1299,51 +1293,27 @@ interface MakeRollPtTxParams {
1299
1293
  crossbarUrl?: string;
1300
1294
  }
1301
1295
  /**
1302
- * High-level Exponent config for {@link makeRollPtTx} the roll's analog of `swapOpts`.
1303
- *
1304
- * `makeRollPtTx` resolves the matured `merge` and (by default) builds the `strip` buy leg
1305
- * internally from these addresses, so the caller never assembles Exponent accounts/ixs.
1306
- * For a non-strip venue, supply a pre-built buy leg via {@link RollPtOpts.buy} (the analog
1307
- * of `makeLoopTx`'s `swapEngineRunner` override).
1296
+ * Exponent roll config for {@link makeRollPtTx}. `makeRollPtTx` resolves the matured vault's
1297
+ * `merge` accounts and the successor pool's CLMM `trade_pt` accounts internally from these
1298
+ * addresses the caller never assembles Exponent accounts/ixs.
1308
1299
  */
1309
1300
  interface RollPtOpts {
1310
- /** The matured PT's Exponent `MarketTwo` — used to resolve `merge` (one of market/vault required). */
1301
+ /** The matured PT's Exponent `MarketTwo` — its `vault` is read (one of market/vault required). */
1311
1302
  maturedMarket?: PublicKey;
1312
1303
  /** …or the matured vault directly. */
1313
1304
  maturedVault?: PublicKey;
1314
- /**
1315
- * The successor (active) vault to `strip` PT_new from — one of vault/market required for
1316
- * the default strip buy leg (ignored when {@link RollPtOpts.buy} is provided).
1317
- */
1318
- successorVault?: PublicKey;
1319
- /** …or the successor market (its vault is read). */
1320
- successorMarket?: PublicKey;
1305
+ /** The successor maturity's **CLMM** (`MarketThree`) pool — where the new PT trades (SY → PT). */
1306
+ successorMarket: PublicKey;
1307
+ /** Slippage tolerance (bps) for the SY PT CLMM swap. Defaults to 50. */
1308
+ slippageBps?: number;
1309
+ /** Token program for the shared SY mint (defaults to the classic Token program). */
1310
+ syTokenProgram?: PublicKey;
1321
1311
  /**
1322
1312
  * Optional dedicated PT-roll address lookup table (fetched internally) that compresses the
1323
- * strip flashloan's two SY-CPI account sets back under the tx size limit
1324
- * (see `examples/create-pt-roll-lut.ts`).
1313
+ * merge + CLMM-swap flashloan bytes (see `examples/create-pt-roll-lut.ts`). Account *locks*
1314
+ * are already bounded by the compact, fixed CLMM footprint.
1325
1315
  */
1326
1316
  lookupTable?: PublicKey;
1327
- /**
1328
- * Slippage/rounding buffer in basis points applied to the strip's SY-in and the minted-PT
1329
- * deposit floor, so on-chain merge rounding / SY-rate lag never short the strip. Default 10.
1330
- */
1331
- slippageBps?: number;
1332
- /**
1333
- * Escape hatch: a pre-built SY→PT_new buy leg (e.g. legacy `MarketTwo` `trade_pt`, CLMM)
1334
- * to use instead of the internal `strip`. When set, `successorVault`/`successorMarket` and
1335
- * the internal strip build are skipped. The buy must spend from the merge's SY account
1336
- * (`mergeAccounts.sySrcDstAta`) and deliver ≥ `ptOutNative` PT to the owner's PT ATA.
1337
- */
1338
- buy?: {
1339
- instructions: TransactionInstruction[];
1340
- /** ATA creates etc. — placed in the setup tx, not the flashloan. */
1341
- setupInstructions?: TransactionInstruction[];
1342
- /** LUTs the buy instructions reference. */
1343
- lookupTables?: AddressLookupTableAccount[];
1344
- /** Native PT the buy guarantees — the deposit amount (byte-patched). */
1345
- ptOutNative: bigint;
1346
- };
1347
1317
  }
1348
1318
  interface MakeSwapDebtTxParams {
1349
1319
  program: MarginfiProgram;
@@ -3391,15 +3361,19 @@ declare function makeSwapDebtTx(params: MakeSwapDebtTxParams): Promise<{
3391
3361
  }>;
3392
3362
 
3393
3363
  /**
3394
- * Roll a matured Exponent PT collateral position into its next-maturity PT, in one
3395
- * flash-loan-wrapped bundle entirely within Exponent, no unwrap, no external swap:
3364
+ * Roll a matured Exponent PT collateral position into its next-maturity PT, so the **full
3365
+ * deposit ends up as new PT** (no leftover), in one flash-loan-wrapped bundle:
3396
3366
  *
3397
- * withdraw PT_old → Exponent `merge` (PT_old → SY) → SY PT_new buy deposit PT_new
3367
+ * withdraw PT_old → Exponent `merge` (PT_old → SY) → CLMM `trade_pt` (SY → PT_new)
3368
+ * → deposit PT_new
3398
3369
  *
3399
- * The caller passes high-level config (`rollOpts`: the matured + successor markets); this
3400
- * resolves the `merge` and (by default) builds the `strip` buy leg internally the same
3401
- * way `makeLoopTx`/`makeSwapCollateralTx` internalize their swap. For a non-strip venue
3402
- * (e.g. legacy `MarketTwo` `trade_pt`), pass a pre-built buy leg via `rollOpts.buy`.
3370
+ * The matured PT is redeemed 1:1 to its SY, then the successor PT is bought **directly on its
3371
+ * CLMM (`MarketThree`) PT/SY pool** no base-token round-trip and no external aggregator. The
3372
+ * newer maturities (e.g. October bulkSOL) only list a CLMM pool (no `MarketTwo`, no order
3373
+ * book), and the CLMM uses a single `ticks` account, so the swap is a fixed, compact account
3374
+ * set regardless of trade size. The caller passes the matured Exponent market/vault + the
3375
+ * successor CLMM pool (`rollOpts`); everything Exponent is resolved internally. The buy is
3376
+ * bounded by the pool's depth.
3403
3377
  */
3404
3378
  declare function makeRollPtTx(params: MakeRollPtTxParams): Promise<{
3405
3379
  transactions: ExtendedV0Transaction[];
@@ -5223,9 +5197,10 @@ declare class MarginfiAccount implements MarginfiAccountType {
5223
5197
  /**
5224
5198
  * Creates a transaction to roll a matured Exponent PT collateral position into its
5225
5199
  * next-maturity PT, in one flash-loan-wrapped bundle
5226
- * (withdraw PT_old → merge → buy PT_new → deposit). See {@link makeRollPtTx}.
5200
+ * (withdraw PT_old → `wrapper_merge` to base swap-engine buy PT_new → deposit).
5201
+ * See {@link makeRollPtTx}.
5227
5202
  *
5228
- * @param params - Roll-PT parameters (`withdrawOpts`/`depositOpts`/`rollOpts`).
5203
+ * @param params - Roll-PT parameters (`withdrawOpts`/`depositOpts`/`swapOpts`/`rollOpts`).
5229
5204
  */
5230
5205
  makeRollPtTx(params: Omit<MakeRollPtTxParams, "marginfiAccount">): Promise<{
5231
5206
  transactions: ExtendedV0Transaction[];
@@ -5595,8 +5570,8 @@ declare class MarginfiAccountWrapper {
5595
5570
  }>;
5596
5571
  /**
5597
5572
  * Rolls a matured Exponent PT collateral position into its next-maturity PT, with
5598
- * auto-injected client data (withdraw PT_old → merge buy PT_new deposit, flash-loan
5599
- * wrapped). The buy leg is venue-agnostic supplied via `rollOpts.buyInstructions`.
5573
+ * auto-injected client data (withdraw PT_old → `wrapper_merge` to baseswap-engine buy
5574
+ * PT_new → deposit, flash-loan wrapped). The full deposit ends up as new PT.
5600
5575
  *
5601
5576
  * Auto-injects: program, marginfiAccount, bankMap, oraclePrices, bankMetadataMap, addressLookupTables
5602
5577
  *