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

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,19 @@ 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 `wrapper_merge` (redeem PT underlying **base**
1258
+ * token, e.g. bulkSOL in one ix, post-maturity, no slippage)
1259
+ * 2. swap base new PT via the multi-provider swap engine (the same one the loop/collateral
1260
+ * swaps use a normal token is swappable, the un-swappable SY is never exposed)
1261
1261
  * 3. deposit the new PT.
1262
1262
  *
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`).
1263
+ * Structurally identical to {@link MakeSwapCollateralTxParams} with a `wrapper_merge` leg in
1264
+ * front: it takes the same `swapOpts` (base new PT) plus a thin `rollOpts` (the matured
1265
+ * Exponent market/vault + the underlying base token). The swap is liquidity-bounded by the
1266
+ * new PT's market depth.
1271
1267
  */
1272
1268
  interface MakeRollPtTxParams {
1273
1269
  program: MarginfiProgram;
@@ -1289,7 +1285,9 @@ interface MakeRollPtTxParams {
1289
1285
  depositBank: BankType;
1290
1286
  tokenProgram: PublicKey;
1291
1287
  };
1292
- /** Exponent merge + buy-leg config (the roll's analog of swap-collateral's `swapOpts`). */
1288
+ /** Swap config for the base → new-PT leg (same as swap-collateral's `swapOpts`). */
1289
+ swapOpts: SwapOpts;
1290
+ /** Exponent `wrapper_merge` (redeem) config for the matured PT. */
1293
1291
  rollOpts: RollPtOpts;
1294
1292
  addressLookupTableAccounts?: AddressLookupTableAccount[];
1295
1293
  overrideInferAccounts?: {
@@ -1297,53 +1295,32 @@ interface MakeRollPtTxParams {
1297
1295
  authority?: PublicKey;
1298
1296
  };
1299
1297
  crossbarUrl?: string;
1298
+ /** See `MakeLoopTxParams.swapEngineRunner`. */
1299
+ swapEngineRunner?: SwapEngineRunner;
1300
1300
  }
1301
1301
  /**
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).
1302
+ * Exponent redeem config for {@link makeRollPtTx}. `makeRollPtTx` resolves the matured vault's
1303
+ * `wrapper_merge` accounts internally from these addresses — the caller never assembles
1304
+ * Exponent accounts/ixs. The buy leg is the swap engine (`swapOpts`), not part of this.
1308
1305
  */
1309
1306
  interface RollPtOpts {
1310
- /** The matured PT's Exponent `MarketTwo` — used to resolve `merge` (one of market/vault required). */
1307
+ /** The matured PT's Exponent `MarketTwo` — its `vault` is read (one of market/vault required). */
1311
1308
  maturedMarket?: PublicKey;
1312
1309
  /** …or the matured vault directly. */
1313
1310
  maturedVault?: PublicKey;
1314
1311
  /**
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).
1312
+ * The vault's underlying **base** token (e.g. bulkSOL)the token `wrapper_merge` redeems
1313
+ * the SY into and the swap leg consumes. Required: it isn't stored on the vault.
1317
1314
  */
1318
- successorVault?: PublicKey;
1319
- /** …or the successor market (its vault is read). */
1320
- successorMarket?: PublicKey;
1315
+ baseMint: PublicKey;
1316
+ /** Token program for the base mint (defaults to the classic Token program). */
1317
+ baseTokenProgram?: PublicKey;
1321
1318
  /**
1322
1319
  * 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
1320
+ * `wrapper_merge` + swap flashloan back under the tx size limit
1324
1321
  * (see `examples/create-pt-roll-lut.ts`).
1325
1322
  */
1326
1323
  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
1324
  }
1348
1325
  interface MakeSwapDebtTxParams {
1349
1326
  program: MarginfiProgram;
@@ -3391,15 +3368,17 @@ declare function makeSwapDebtTx(params: MakeSwapDebtTxParams): Promise<{
3391
3368
  }>;
3392
3369
 
3393
3370
  /**
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:
3371
+ * Roll a matured Exponent PT collateral position into its next-maturity PT, so the **full
3372
+ * deposit ends up as new PT** (no leftover), in one flash-loan-wrapped bundle:
3396
3373
  *
3397
- * withdraw PT_old → Exponent `merge` (PT_old → SY) SY → PT_new buy → deposit PT_new
3374
+ * withdraw PT_old → Exponent `wrapper_merge` (PT_old → underlying base, e.g. bulkSOL)
3375
+ * → swap-engine (base → PT_new, Titan/Jupiter) → deposit PT_new
3398
3376
  *
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`.
3377
+ * Structurally `makeSwapCollateralTx` with a `wrapper_merge` leg in front: the matured PT is
3378
+ * redeemed to a normal, swappable base token (never the un-swappable SY), then the existing
3379
+ * multi-provider swap engine buys the new PT. The caller passes the matured Exponent
3380
+ * market/vault + base token (`rollOpts`) and the swap config (`swapOpts`); everything Exponent
3381
+ * is resolved internally. The buy is bounded by the new PT's market depth.
3403
3382
  */
3404
3383
  declare function makeRollPtTx(params: MakeRollPtTxParams): Promise<{
3405
3384
  transactions: ExtendedV0Transaction[];
@@ -5223,9 +5202,10 @@ declare class MarginfiAccount implements MarginfiAccountType {
5223
5202
  /**
5224
5203
  * Creates a transaction to roll a matured Exponent PT collateral position into its
5225
5204
  * next-maturity PT, in one flash-loan-wrapped bundle
5226
- * (withdraw PT_old → merge → buy PT_new → deposit). See {@link makeRollPtTx}.
5205
+ * (withdraw PT_old → `wrapper_merge` to base swap-engine buy PT_new → deposit).
5206
+ * See {@link makeRollPtTx}.
5227
5207
  *
5228
- * @param params - Roll-PT parameters (`withdrawOpts`/`depositOpts`/`rollOpts`).
5208
+ * @param params - Roll-PT parameters (`withdrawOpts`/`depositOpts`/`swapOpts`/`rollOpts`).
5229
5209
  */
5230
5210
  makeRollPtTx(params: Omit<MakeRollPtTxParams, "marginfiAccount">): Promise<{
5231
5211
  transactions: ExtendedV0Transaction[];
@@ -5595,12 +5575,12 @@ declare class MarginfiAccountWrapper {
5595
5575
  }>;
5596
5576
  /**
5597
5577
  * 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`.
5578
+ * auto-injected client data (withdraw PT_old → `wrapper_merge` to baseswap-engine buy
5579
+ * PT_new → deposit, flash-loan wrapped). The full deposit ends up as new PT.
5600
5580
  *
5601
5581
  * Auto-injects: program, marginfiAccount, bankMap, oraclePrices, bankMetadataMap, addressLookupTables
5602
5582
  *
5603
- * @param params - Roll-PT parameters (user provides: connection, withdrawOpts, depositOpts, rollOpts, etc.)
5583
+ * @param params - Roll-PT parameters (user provides: connection, withdrawOpts, depositOpts, swapOpts, rollOpts, etc.)
5604
5584
  */
5605
5585
  makeRollPtTx(params: Omit<MakeRollPtTxParams, "program" | "marginfiAccount" | "bankMap" | "oraclePrices" | "bankMetadataMap" | "addressLookupTableAccounts">): Promise<{
5606
5586
  transactions: ExtendedV0Transaction[];
package/dist/index.d.ts CHANGED
@@ -1251,23 +1251,19 @@ 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 `wrapper_merge` (redeem PT underlying **base**
1258
+ * token, e.g. bulkSOL in one ix, post-maturity, no slippage)
1259
+ * 2. swap base new PT via the multi-provider swap engine (the same one the loop/collateral
1260
+ * swaps use a normal token is swappable, the un-swappable SY is never exposed)
1261
1261
  * 3. deposit the new PT.
1262
1262
  *
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`).
1263
+ * Structurally identical to {@link MakeSwapCollateralTxParams} with a `wrapper_merge` leg in
1264
+ * front: it takes the same `swapOpts` (base new PT) plus a thin `rollOpts` (the matured
1265
+ * Exponent market/vault + the underlying base token). The swap is liquidity-bounded by the
1266
+ * new PT's market depth.
1271
1267
  */
1272
1268
  interface MakeRollPtTxParams {
1273
1269
  program: MarginfiProgram;
@@ -1289,7 +1285,9 @@ interface MakeRollPtTxParams {
1289
1285
  depositBank: BankType;
1290
1286
  tokenProgram: PublicKey;
1291
1287
  };
1292
- /** Exponent merge + buy-leg config (the roll's analog of swap-collateral's `swapOpts`). */
1288
+ /** Swap config for the base → new-PT leg (same as swap-collateral's `swapOpts`). */
1289
+ swapOpts: SwapOpts;
1290
+ /** Exponent `wrapper_merge` (redeem) config for the matured PT. */
1293
1291
  rollOpts: RollPtOpts;
1294
1292
  addressLookupTableAccounts?: AddressLookupTableAccount[];
1295
1293
  overrideInferAccounts?: {
@@ -1297,53 +1295,32 @@ interface MakeRollPtTxParams {
1297
1295
  authority?: PublicKey;
1298
1296
  };
1299
1297
  crossbarUrl?: string;
1298
+ /** See `MakeLoopTxParams.swapEngineRunner`. */
1299
+ swapEngineRunner?: SwapEngineRunner;
1300
1300
  }
1301
1301
  /**
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).
1302
+ * Exponent redeem config for {@link makeRollPtTx}. `makeRollPtTx` resolves the matured vault's
1303
+ * `wrapper_merge` accounts internally from these addresses — the caller never assembles
1304
+ * Exponent accounts/ixs. The buy leg is the swap engine (`swapOpts`), not part of this.
1308
1305
  */
1309
1306
  interface RollPtOpts {
1310
- /** The matured PT's Exponent `MarketTwo` — used to resolve `merge` (one of market/vault required). */
1307
+ /** The matured PT's Exponent `MarketTwo` — its `vault` is read (one of market/vault required). */
1311
1308
  maturedMarket?: PublicKey;
1312
1309
  /** …or the matured vault directly. */
1313
1310
  maturedVault?: PublicKey;
1314
1311
  /**
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).
1312
+ * The vault's underlying **base** token (e.g. bulkSOL)the token `wrapper_merge` redeems
1313
+ * the SY into and the swap leg consumes. Required: it isn't stored on the vault.
1317
1314
  */
1318
- successorVault?: PublicKey;
1319
- /** …or the successor market (its vault is read). */
1320
- successorMarket?: PublicKey;
1315
+ baseMint: PublicKey;
1316
+ /** Token program for the base mint (defaults to the classic Token program). */
1317
+ baseTokenProgram?: PublicKey;
1321
1318
  /**
1322
1319
  * 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
1320
+ * `wrapper_merge` + swap flashloan back under the tx size limit
1324
1321
  * (see `examples/create-pt-roll-lut.ts`).
1325
1322
  */
1326
1323
  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
1324
  }
1348
1325
  interface MakeSwapDebtTxParams {
1349
1326
  program: MarginfiProgram;
@@ -3391,15 +3368,17 @@ declare function makeSwapDebtTx(params: MakeSwapDebtTxParams): Promise<{
3391
3368
  }>;
3392
3369
 
3393
3370
  /**
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:
3371
+ * Roll a matured Exponent PT collateral position into its next-maturity PT, so the **full
3372
+ * deposit ends up as new PT** (no leftover), in one flash-loan-wrapped bundle:
3396
3373
  *
3397
- * withdraw PT_old → Exponent `merge` (PT_old → SY) SY → PT_new buy → deposit PT_new
3374
+ * withdraw PT_old → Exponent `wrapper_merge` (PT_old → underlying base, e.g. bulkSOL)
3375
+ * → swap-engine (base → PT_new, Titan/Jupiter) → deposit PT_new
3398
3376
  *
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`.
3377
+ * Structurally `makeSwapCollateralTx` with a `wrapper_merge` leg in front: the matured PT is
3378
+ * redeemed to a normal, swappable base token (never the un-swappable SY), then the existing
3379
+ * multi-provider swap engine buys the new PT. The caller passes the matured Exponent
3380
+ * market/vault + base token (`rollOpts`) and the swap config (`swapOpts`); everything Exponent
3381
+ * is resolved internally. The buy is bounded by the new PT's market depth.
3403
3382
  */
3404
3383
  declare function makeRollPtTx(params: MakeRollPtTxParams): Promise<{
3405
3384
  transactions: ExtendedV0Transaction[];
@@ -5223,9 +5202,10 @@ declare class MarginfiAccount implements MarginfiAccountType {
5223
5202
  /**
5224
5203
  * Creates a transaction to roll a matured Exponent PT collateral position into its
5225
5204
  * next-maturity PT, in one flash-loan-wrapped bundle
5226
- * (withdraw PT_old → merge → buy PT_new → deposit). See {@link makeRollPtTx}.
5205
+ * (withdraw PT_old → `wrapper_merge` to base swap-engine buy PT_new → deposit).
5206
+ * See {@link makeRollPtTx}.
5227
5207
  *
5228
- * @param params - Roll-PT parameters (`withdrawOpts`/`depositOpts`/`rollOpts`).
5208
+ * @param params - Roll-PT parameters (`withdrawOpts`/`depositOpts`/`swapOpts`/`rollOpts`).
5229
5209
  */
5230
5210
  makeRollPtTx(params: Omit<MakeRollPtTxParams, "marginfiAccount">): Promise<{
5231
5211
  transactions: ExtendedV0Transaction[];
@@ -5595,12 +5575,12 @@ declare class MarginfiAccountWrapper {
5595
5575
  }>;
5596
5576
  /**
5597
5577
  * 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`.
5578
+ * auto-injected client data (withdraw PT_old → `wrapper_merge` to baseswap-engine buy
5579
+ * PT_new → deposit, flash-loan wrapped). The full deposit ends up as new PT.
5600
5580
  *
5601
5581
  * Auto-injects: program, marginfiAccount, bankMap, oraclePrices, bankMetadataMap, addressLookupTables
5602
5582
  *
5603
- * @param params - Roll-PT parameters (user provides: connection, withdrawOpts, depositOpts, rollOpts, etc.)
5583
+ * @param params - Roll-PT parameters (user provides: connection, withdrawOpts, depositOpts, swapOpts, rollOpts, etc.)
5604
5584
  */
5605
5585
  makeRollPtTx(params: Omit<MakeRollPtTxParams, "program" | "marginfiAccount" | "bankMap" | "oraclePrices" | "bankMetadataMap" | "addressLookupTableAccounts">): Promise<{
5606
5586
  transactions: ExtendedV0Transaction[];