@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.cjs +6344 -375
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -63
- package/dist/index.d.ts +38 -63
- package/dist/index.js +6344 -375
- package/dist/index.js.map +1 -1
- package/dist/vendor.cjs +6423 -284
- package/dist/vendor.cjs.map +1 -1
- package/dist/vendor.d.cts +1014 -110
- package/dist/vendor.d.ts +1014 -110
- package/dist/vendor.js +6413 -285
- package/dist/vendor.js.map +1 -1
- package/package.json +1 -1
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
|
-
*
|
|
1256
|
-
*
|
|
1257
|
-
*
|
|
1258
|
-
*
|
|
1259
|
-
*
|
|
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
|
|
1264
|
-
*
|
|
1265
|
-
*
|
|
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 +
|
|
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
|
-
*
|
|
1303
|
-
*
|
|
1304
|
-
*
|
|
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` —
|
|
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
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
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
|
-
*
|
|
1324
|
-
*
|
|
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,
|
|
3395
|
-
*
|
|
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) →
|
|
3367
|
+
* withdraw PT_old → Exponent `merge` (PT_old → SY) → CLMM `trade_pt` (SY → PT_new)
|
|
3368
|
+
* → deposit PT_new
|
|
3398
3369
|
*
|
|
3399
|
-
* The
|
|
3400
|
-
*
|
|
3401
|
-
*
|
|
3402
|
-
*
|
|
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 →
|
|
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 →
|
|
5599
|
-
* wrapped). The
|
|
5573
|
+
* auto-injected client data (withdraw PT_old → `wrapper_merge` to base → swap-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
|
-
*
|
|
1256
|
-
*
|
|
1257
|
-
*
|
|
1258
|
-
*
|
|
1259
|
-
*
|
|
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
|
|
1264
|
-
*
|
|
1265
|
-
*
|
|
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 +
|
|
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
|
-
*
|
|
1303
|
-
*
|
|
1304
|
-
*
|
|
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` —
|
|
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
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
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
|
-
*
|
|
1324
|
-
*
|
|
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,
|
|
3395
|
-
*
|
|
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) →
|
|
3367
|
+
* withdraw PT_old → Exponent `merge` (PT_old → SY) → CLMM `trade_pt` (SY → PT_new)
|
|
3368
|
+
* → deposit PT_new
|
|
3398
3369
|
*
|
|
3399
|
-
* The
|
|
3400
|
-
*
|
|
3401
|
-
*
|
|
3402
|
-
*
|
|
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 →
|
|
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 →
|
|
5599
|
-
* wrapped). The
|
|
5573
|
+
* auto-injected client data (withdraw PT_old → `wrapper_merge` to base → swap-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
|
*
|