@0dotxyz/p0-ts-sdk 2.6.0 → 2.6.1
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 +4117 -2718
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +704 -68
- package/dist/index.d.ts +704 -68
- package/dist/index.js +4096 -2717
- package/dist/index.js.map +1 -1
- package/dist/vendor.cjs +1 -0
- package/dist/vendor.cjs.map +1 -1
- package/dist/vendor.js +1 -0
- package/dist/vendor.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -139,12 +139,17 @@ declare function isFlashloan(tx: SolanaTransaction): boolean;
|
|
|
139
139
|
declare function makeVersionedTransaction(blockhash: Blockhash, transaction: Transaction, payer: PublicKey, addressLookupTables?: AddressLookupTableAccount[]): Promise<VersionedTransaction>;
|
|
140
140
|
/**
|
|
141
141
|
* Splits your instructions into as many VersionedTransactions as needed
|
|
142
|
-
* so that none exceed MAX_TX_SIZE
|
|
142
|
+
* so that none exceed MAX_TX_SIZE (minus `sizeMargin`, if given) nor
|
|
143
|
+
* `maxAccountLocks` account locks (if given).
|
|
143
144
|
*/
|
|
144
145
|
declare function splitInstructionsToFitTransactions(mandatoryIxs: TransactionInstruction[], ixs: TransactionInstruction[], opts: {
|
|
145
146
|
blockhash: string;
|
|
146
147
|
payerKey: PublicKey;
|
|
147
148
|
luts: AddressLookupTableAccount[];
|
|
149
|
+
/** Bytes reserved below MAX_TX_SIZE, e.g. for compute-budget ixs appended at send time. */
|
|
150
|
+
sizeMargin?: number;
|
|
151
|
+
/** Also cap the total account locks per transaction (e.g. MAX_ACCOUNT_LOCKS). */
|
|
152
|
+
maxAccountLocks?: number;
|
|
148
153
|
}): VersionedTransaction[];
|
|
149
154
|
/**
|
|
150
155
|
* Enhances a given transaction with additional metadata.
|
|
@@ -927,9 +932,24 @@ interface SwapProviderConfig {
|
|
|
927
932
|
}
|
|
928
933
|
interface SwapOpts {
|
|
929
934
|
swapConfig?: SwapProviderConfig;
|
|
935
|
+
/**
|
|
936
|
+
* Pin an exact, caller-reviewed swap route instead of running the swap engine.
|
|
937
|
+
*
|
|
938
|
+
* The caller owns ATA setup for the route, the route's input amount MUST equal the flow's swap
|
|
939
|
+
* input (e.g. the loop's borrow amount), and the route MUST pay out to the flow's destination
|
|
940
|
+
* token account. `quoteResponse.otherAmountThreshold` (guaranteed min-out, native units) sizes
|
|
941
|
+
* the follow-up amount — e.g. the loop's deposit byte-patch — exactly like an engine-selected
|
|
942
|
+
* route would. For dynamic caller-controlled routing (inspect/veto routes at build time),
|
|
943
|
+
* prefer `swapEngineRunner`.
|
|
944
|
+
*
|
|
945
|
+
* Note: the bridged `makeBridged*Tx` fallbacks are disabled when a pinned route is supplied —
|
|
946
|
+
* a pinned route belongs to the direct pair and cannot be spliced into SDK-composed legs.
|
|
947
|
+
*/
|
|
930
948
|
swapIxs?: {
|
|
931
949
|
instructions: TransactionInstruction[];
|
|
932
950
|
lookupTables: AddressLookupTableAccount[];
|
|
951
|
+
/** The pinned route's quote; `otherAmountThreshold` must be the route's min-out (native). */
|
|
952
|
+
quoteResponse: SwapQuoteResult;
|
|
933
953
|
};
|
|
934
954
|
}
|
|
935
955
|
interface SwapQuoteResult {
|
|
@@ -1218,6 +1238,94 @@ interface MakeFlashLoanTxParams {
|
|
|
1218
1238
|
isSync?: boolean;
|
|
1219
1239
|
signers?: Signer[];
|
|
1220
1240
|
}
|
|
1241
|
+
type TransferPositionSide = "collateral" | "debt";
|
|
1242
|
+
interface MakeTransferPositionsTxParams {
|
|
1243
|
+
program: MarginfiProgram;
|
|
1244
|
+
connection: Connection;
|
|
1245
|
+
/** Source account A (positions move out of this account). */
|
|
1246
|
+
marginfiAccount: MarginfiAccountType;
|
|
1247
|
+
/** Banks whose A-positions to move; the side is inferred from A's balance. */
|
|
1248
|
+
bankAddresses: PublicKey[];
|
|
1249
|
+
/** Destination account B. Omit to create a fresh account inside the flashloan tx. */
|
|
1250
|
+
destinationAccount?: MarginfiAccountType;
|
|
1251
|
+
/** Only used when `destinationAccount` is omitted. */
|
|
1252
|
+
createDestinationOpts?: {
|
|
1253
|
+
accountIndex?: number;
|
|
1254
|
+
thirdPartyId?: number;
|
|
1255
|
+
};
|
|
1256
|
+
bankMap: Map<string, BankType>;
|
|
1257
|
+
oraclePrices: Map<string, OraclePrice>;
|
|
1258
|
+
bankMetadataMap: BankIntegrationMetadataMap;
|
|
1259
|
+
assetShareValueMultiplierByBank: Map<string, BigNumber>;
|
|
1260
|
+
/** Token program per transferred bank (base58 bank address → token program id). */
|
|
1261
|
+
tokenProgramsByBank: Map<string, PublicKey>;
|
|
1262
|
+
addressLookupTableAccounts?: AddressLookupTableAccount[];
|
|
1263
|
+
/** Head-room added to each borrow over the estimated debt for interest accrual. Default 10 bps. */
|
|
1264
|
+
borrowPaddingBps?: number;
|
|
1265
|
+
/** Max positions per transfer; a larger selection is rejected. Default 5. */
|
|
1266
|
+
maxPositions?: number;
|
|
1267
|
+
/** Whether the group USD rate limiter is enabled (adds an oracle to each withdraw). Default false. */
|
|
1268
|
+
groupRateLimiterEnabled?: boolean;
|
|
1269
|
+
crossbarUrl?: string;
|
|
1270
|
+
overrideInferAccounts?: {
|
|
1271
|
+
group?: PublicKey;
|
|
1272
|
+
authority?: PublicKey;
|
|
1273
|
+
};
|
|
1274
|
+
}
|
|
1275
|
+
interface TransferPositionsResult {
|
|
1276
|
+
/** Ordered for execution: [setup/crank txs…, flashloan tx]. */
|
|
1277
|
+
transactions: ExtendedV0Transaction[];
|
|
1278
|
+
/** Index of the flashloan tx in `transactions`. */
|
|
1279
|
+
actionTxIndex: number;
|
|
1280
|
+
/** The destination account (passed-in, or the projected account created in the tx). */
|
|
1281
|
+
destinationAccount: MarginfiAccountType;
|
|
1282
|
+
/** Whether all transactions must land atomically in one bundle. */
|
|
1283
|
+
mustBeAtomicBundle: boolean;
|
|
1284
|
+
}
|
|
1285
|
+
interface MakeBulkWithdrawTxParams {
|
|
1286
|
+
program: MarginfiProgram;
|
|
1287
|
+
connection: Connection;
|
|
1288
|
+
marginfiAccount: MarginfiAccountType;
|
|
1289
|
+
/** Banks whose FULL positions to withdraw, in execution order. */
|
|
1290
|
+
bankAddresses: PublicKey[];
|
|
1291
|
+
bankMap: Map<string, BankType>;
|
|
1292
|
+
oraclePrices: Map<string, OraclePrice>;
|
|
1293
|
+
bankMetadataMap: BankIntegrationMetadataMap;
|
|
1294
|
+
assetShareValueMultiplierByBank: Map<string, BigNumber>;
|
|
1295
|
+
/** Token program per withdrawn bank (base58 bank address → token program id). */
|
|
1296
|
+
tokenProgramsByBank: Map<string, PublicKey>;
|
|
1297
|
+
/** Whether the group USD rate limiter is enabled (adds an oracle to each withdraw). Default false. */
|
|
1298
|
+
groupRateLimiterEnabled?: boolean;
|
|
1299
|
+
luts: AddressLookupTableAccount[];
|
|
1300
|
+
crossbarUrl?: string;
|
|
1301
|
+
overrideInferAccounts?: {
|
|
1302
|
+
group?: PublicKey;
|
|
1303
|
+
authority?: PublicKey;
|
|
1304
|
+
};
|
|
1305
|
+
}
|
|
1306
|
+
interface MakeBulkRepayTxParams {
|
|
1307
|
+
program: MarginfiProgram;
|
|
1308
|
+
connection: Connection;
|
|
1309
|
+
marginfiAccount: MarginfiAccountType;
|
|
1310
|
+
/** Banks whose FULL debts to repay from the wallet. */
|
|
1311
|
+
bankAddresses: PublicKey[];
|
|
1312
|
+
bankMap: Map<string, BankType>;
|
|
1313
|
+
/** Token program per repaid bank (base58 bank address → token program id). */
|
|
1314
|
+
tokenProgramsByBank: Map<string, PublicKey>;
|
|
1315
|
+
addressLookupTableAccounts?: AddressLookupTableAccount[];
|
|
1316
|
+
overrideInferAccounts?: {
|
|
1317
|
+
group?: PublicKey;
|
|
1318
|
+
authority?: PublicKey;
|
|
1319
|
+
};
|
|
1320
|
+
}
|
|
1321
|
+
interface BulkLendTxsResult {
|
|
1322
|
+
/** Ordered for execution: [setup/crank txs…, action txs…]. */
|
|
1323
|
+
transactions: ExtendedV0Transaction[];
|
|
1324
|
+
/** Index of the first action tx in `transactions`. */
|
|
1325
|
+
actionTxIndex: number;
|
|
1326
|
+
/** Whether all transactions must land atomically in one bundle. */
|
|
1327
|
+
mustBeAtomicBundle: boolean;
|
|
1328
|
+
}
|
|
1221
1329
|
interface MakeLoopTxParams {
|
|
1222
1330
|
program: MarginfiProgram;
|
|
1223
1331
|
marginfiAccount: MarginfiAccountType;
|
|
@@ -1251,6 +1359,11 @@ interface MakeLoopTxParams {
|
|
|
1251
1359
|
* Optional override for how the swap engine runs. Defaults to the in-process
|
|
1252
1360
|
* `runSwapEngine`; the app injects a runner that forwards to `/api/tx/swap-engine`
|
|
1253
1361
|
* so the multi-provider fan-out happens server-side.
|
|
1362
|
+
*
|
|
1363
|
+
* Also the seam for caller-controlled routing: wrap the default runner to inspect, veto, or
|
|
1364
|
+
* replace the selected route before it's spliced into the flashloan (see
|
|
1365
|
+
* `examples/16c-loop-pinned-route.ts`). For a fully static, pre-reviewed route use
|
|
1366
|
+
* `swapOpts.swapIxs` instead.
|
|
1254
1367
|
*/
|
|
1255
1368
|
swapEngineRunner?: SwapEngineRunner;
|
|
1256
1369
|
}
|
|
@@ -2497,7 +2610,7 @@ declare function computeTotalOutstandingEmissions(balance: BalanceType, bank: Ba
|
|
|
2497
2610
|
* - Including all active banks (excluding any in the exclusion list)
|
|
2498
2611
|
* - Reserving inactive slots for mandatory banks that aren't currently active
|
|
2499
2612
|
*
|
|
2500
|
-
* @param
|
|
2613
|
+
* @param account - The marginfi account whose balances are evaluated
|
|
2501
2614
|
* @param banksMap - Map of bank addresses to bank data
|
|
2502
2615
|
* @param mandatoryBanks - Banks that must be included (e.g., for pending transactions)
|
|
2503
2616
|
* @param excludedBanks - Banks to exclude from health checks
|
|
@@ -2505,15 +2618,20 @@ declare function computeTotalOutstandingEmissions(balance: BalanceType, bank: Ba
|
|
|
2505
2618
|
*
|
|
2506
2619
|
* @example
|
|
2507
2620
|
* ```typescript
|
|
2508
|
-
* const healthCheckBanks = computeHealthCheckAccounts(
|
|
2509
|
-
* account
|
|
2621
|
+
* const healthCheckBanks = computeHealthCheckAccounts({
|
|
2622
|
+
* account,
|
|
2510
2623
|
* banksMap,
|
|
2511
|
-
* [newBankToDeposit], //
|
|
2512
|
-
* [closingBank] //
|
|
2513
|
-
* );
|
|
2624
|
+
* mandatoryBanks: [newBankToDeposit], // Not active yet but will be
|
|
2625
|
+
* excludedBanks: [closingBank], // Being closed in this transaction
|
|
2626
|
+
* });
|
|
2514
2627
|
* ```
|
|
2515
2628
|
*/
|
|
2516
|
-
declare function computeHealthCheckAccounts(
|
|
2629
|
+
declare function computeHealthCheckAccounts({ account, banksMap, mandatoryBanks, excludedBanks, }: {
|
|
2630
|
+
account: MarginfiAccountType;
|
|
2631
|
+
banksMap: Map<string, BankType>;
|
|
2632
|
+
mandatoryBanks?: PublicKey[];
|
|
2633
|
+
excludedBanks?: PublicKey[];
|
|
2634
|
+
}): BankType[];
|
|
2517
2635
|
/**
|
|
2518
2636
|
* Converts bank objects to health check account metas (public keys).
|
|
2519
2637
|
*
|
|
@@ -2535,14 +2653,17 @@ declare function computeHealthCheckAccounts(balances: BalanceType[], banksMap: M
|
|
|
2535
2653
|
*
|
|
2536
2654
|
* @example
|
|
2537
2655
|
* ```typescript
|
|
2538
|
-
* const healthAccounts = computeHealthAccountMetas(
|
|
2539
|
-
* [usdcBank, solBank, kaminoUsdcBank],
|
|
2540
|
-
*
|
|
2541
|
-
* );
|
|
2656
|
+
* const healthAccounts = computeHealthAccountMetas({
|
|
2657
|
+
* banksToInclude: [usdcBank, solBank, kaminoUsdcBank],
|
|
2658
|
+
* });
|
|
2542
2659
|
* // Returns: [bank1, oracle1, bank2, oracle2, bank3, oracle3, kaminoReserve3, ...]
|
|
2543
2660
|
* ```
|
|
2544
2661
|
*/
|
|
2545
|
-
declare function computeHealthAccountMetas(banksToInclude
|
|
2662
|
+
declare function computeHealthAccountMetas({ banksToInclude, enableSorting, trailingBanks, }: {
|
|
2663
|
+
banksToInclude: BankType[];
|
|
2664
|
+
enableSorting?: boolean;
|
|
2665
|
+
trailingBanks?: BankType[];
|
|
2666
|
+
}): PublicKey[];
|
|
2546
2667
|
/**
|
|
2547
2668
|
* Projects which banks will be active after a series of instructions execute.
|
|
2548
2669
|
*
|
|
@@ -2551,7 +2672,8 @@ declare function computeHealthAccountMetas(banksToInclude: BankType[], enableSor
|
|
|
2551
2672
|
* health check account inclusion by predicting which banks are relevant.
|
|
2552
2673
|
*
|
|
2553
2674
|
* **Note**: This does NOT simulate Cross-Program Invocations (CPI). Only direct
|
|
2554
|
-
* marginfi instructions are considered.
|
|
2675
|
+
* marginfi instructions are considered. Instructions operating on a different
|
|
2676
|
+
* marginfi account than `account` are ignored.
|
|
2555
2677
|
*
|
|
2556
2678
|
* Supported instructions:
|
|
2557
2679
|
* - Deposits: `lendingAccountDeposit`, `kaminoDeposit`, `driftDeposit`, `solendDeposit`
|
|
@@ -2559,22 +2681,26 @@ declare function computeHealthAccountMetas(banksToInclude: BankType[], enableSor
|
|
|
2559
2681
|
* - Repays: `lendingAccountRepay`
|
|
2560
2682
|
* - Withdrawals: `lendingAccountWithdraw`, `kaminoWithdraw`, `driftWithdraw`, `solendWithdraw`
|
|
2561
2683
|
*
|
|
2562
|
-
* @param
|
|
2684
|
+
* @param account - The marginfi account whose balances are projected
|
|
2563
2685
|
* @param instructions - Instructions to simulate
|
|
2564
2686
|
* @param program - Marginfi program for instruction decoding
|
|
2565
2687
|
* @returns Array of bank public keys that will be active after instruction execution
|
|
2566
2688
|
*
|
|
2567
2689
|
* @example
|
|
2568
2690
|
* ```typescript
|
|
2569
|
-
* const projectedBanks = computeProjectedActiveBanksNoCpi(
|
|
2570
|
-
* account
|
|
2571
|
-
* [depositIx, borrowIx],
|
|
2572
|
-
* marginfiProgram
|
|
2573
|
-
* );
|
|
2691
|
+
* const projectedBanks = computeProjectedActiveBanksNoCpi({
|
|
2692
|
+
* account,
|
|
2693
|
+
* instructions: [depositIx, borrowIx],
|
|
2694
|
+
* program: marginfiProgram,
|
|
2695
|
+
* });
|
|
2574
2696
|
* // Use projectedBanks for health check account selection
|
|
2575
2697
|
* ```
|
|
2576
2698
|
*/
|
|
2577
|
-
declare function computeProjectedActiveBanksNoCpi(
|
|
2699
|
+
declare function computeProjectedActiveBanksNoCpi({ account, instructions, program, }: {
|
|
2700
|
+
account: MarginfiAccountType;
|
|
2701
|
+
instructions: TransactionInstruction[];
|
|
2702
|
+
program: MarginfiProgram;
|
|
2703
|
+
}): PublicKey[];
|
|
2578
2704
|
/**
|
|
2579
2705
|
* Computes projected balances after applying a series of instructions.
|
|
2580
2706
|
*
|
|
@@ -2583,12 +2709,13 @@ declare function computeProjectedActiveBanksNoCpi(balances: BalanceType[], instr
|
|
|
2583
2709
|
* than `computeProjectedActiveBanksNoCpi` which only tracks active banks.
|
|
2584
2710
|
*
|
|
2585
2711
|
* **Note**: This does NOT simulate Cross-Program Invocations (CPI). Only direct
|
|
2586
|
-
* marginfi instructions are considered.
|
|
2712
|
+
* marginfi instructions are considered. Instructions operating on a different
|
|
2713
|
+
* marginfi account than `account` are ignored.
|
|
2587
2714
|
*
|
|
2588
2715
|
* **Integrated Protocols**: For Kamino/Drift deposits, the `assetShareValueMultiplierByBank`
|
|
2589
2716
|
* is used to convert cToken amounts to actual asset quantities before computing shares.
|
|
2590
2717
|
*
|
|
2591
|
-
* @param
|
|
2718
|
+
* @param account - The marginfi account whose balances are projected
|
|
2592
2719
|
* @param instructions - Instructions to simulate
|
|
2593
2720
|
* @param program - Marginfi program for instruction decoding
|
|
2594
2721
|
* @param banksMap - Map of bank addresses to bank data (needed for share value conversion)
|
|
@@ -2600,18 +2727,24 @@ declare function computeProjectedActiveBanksNoCpi(balances: BalanceType[], instr
|
|
|
2600
2727
|
*
|
|
2601
2728
|
* @example
|
|
2602
2729
|
* ```typescript
|
|
2603
|
-
* const result = computeProjectedActiveBalancesNoCpi(
|
|
2604
|
-
* account
|
|
2605
|
-
* [depositIx, borrowIx],
|
|
2606
|
-
* marginfiProgram,
|
|
2730
|
+
* const result = computeProjectedActiveBalancesNoCpi({
|
|
2731
|
+
* account,
|
|
2732
|
+
* instructions: [depositIx, borrowIx],
|
|
2733
|
+
* program: marginfiProgram,
|
|
2607
2734
|
* banksMap,
|
|
2608
|
-
*
|
|
2609
|
-
* );
|
|
2735
|
+
* assetShareValueMultiplierByBank,
|
|
2736
|
+
* });
|
|
2610
2737
|
* console.log(`Projected ${result.projectedBalances.length} balances`);
|
|
2611
2738
|
* console.log(`Impacted ${result.impactedAssetsBanks.length} asset banks`);
|
|
2612
2739
|
* ```
|
|
2613
2740
|
*/
|
|
2614
|
-
declare function computeProjectedActiveBalancesNoCpi(
|
|
2741
|
+
declare function computeProjectedActiveBalancesNoCpi({ account, instructions, program, banksMap, assetShareValueMultiplierByBank, }: {
|
|
2742
|
+
account: MarginfiAccountType;
|
|
2743
|
+
instructions: TransactionInstruction[];
|
|
2744
|
+
program: MarginfiProgram;
|
|
2745
|
+
banksMap: Map<string, BankType>;
|
|
2746
|
+
assetShareValueMultiplierByBank: Map<string, BigNumber$1>;
|
|
2747
|
+
}): {
|
|
2615
2748
|
projectedBalances: BalanceType[];
|
|
2616
2749
|
impactedAssetsBanks: string[];
|
|
2617
2750
|
impactedLiabilityBanks: string[];
|
|
@@ -2858,6 +2991,28 @@ declare const getTitanExactOutEstimate: (params: GetTitanExactOutEstimateParams)
|
|
|
2858
2991
|
quoteResult: SwapQuoteResult;
|
|
2859
2992
|
}>;
|
|
2860
2993
|
|
|
2994
|
+
/** The canonical shape a resolved pinned route yields — mirrors an engine-selected route. */
|
|
2995
|
+
interface ResolvedPinnedSwapRoute {
|
|
2996
|
+
swapInstructions: TransactionInstruction[];
|
|
2997
|
+
setupInstructions: TransactionInstruction[];
|
|
2998
|
+
lookupTables: AddressLookupTableAccount[];
|
|
2999
|
+
quoteResponse: SwapQuoteResult;
|
|
3000
|
+
/** The route's guaranteed min-out (native) — what sizes the follow-up amount (deposit patch). */
|
|
3001
|
+
outputAmountNative: BN;
|
|
3002
|
+
}
|
|
3003
|
+
/**
|
|
3004
|
+
* Resolve a caller-pinned swap route (`swapOpts.swapIxs`) into the engine-result shape, validating
|
|
3005
|
+
* the quote so a pinned route can never silently size a zero follow-up amount:
|
|
3006
|
+
*
|
|
3007
|
+
* - `otherAmountThreshold` (min-out) must be a positive integer — it becomes the loop's deposit
|
|
3008
|
+
* byte-patch, exactly like an engine-selected route's min-out.
|
|
3009
|
+
* - `inAmount` must equal the flow's swap input (e.g. the loop's borrow, native units) — a
|
|
3010
|
+
* mismatch means the route was quoted for a different size than the flow will actually swap.
|
|
3011
|
+
*
|
|
3012
|
+
* Throws plain `Error`s (not `TransactionBuildingError`) so caller-input mistakes are never
|
|
3013
|
+
* classified as decomposable swap failures (which would wrongly engage the bridged fallback).
|
|
3014
|
+
*/
|
|
3015
|
+
declare function resolvePinnedSwapRoute(swapIxs: NonNullable<SwapOpts["swapIxs"]>, expectedInAmountNative: BN | number): ResolvedPinnedSwapRoute;
|
|
2861
3016
|
type GetSwapIxsForFlashloanParams = {
|
|
2862
3017
|
inputMint: string;
|
|
2863
3018
|
outputMint: string;
|
|
@@ -2938,11 +3093,7 @@ interface FlashloanSwapConstraints {
|
|
|
2938
3093
|
*/
|
|
2939
3094
|
declare function computeFlashLoanNonSwapBudget({ program, marginfiAccount, ixs, bankMap, addressLookupTableAccounts, }: {
|
|
2940
3095
|
program: MarginfiProgram;
|
|
2941
|
-
marginfiAccount:
|
|
2942
|
-
address: PublicKey;
|
|
2943
|
-
authority: PublicKey;
|
|
2944
|
-
balances: BalanceType[];
|
|
2945
|
-
};
|
|
3096
|
+
marginfiAccount: MarginfiAccountType;
|
|
2946
3097
|
ixs: TransactionInstruction[];
|
|
2947
3098
|
bankMap: Map<string, BankType>;
|
|
2948
3099
|
addressLookupTableAccounts: AddressLookupTableAccount[];
|
|
@@ -3028,47 +3179,146 @@ declare function isDepositIx(ix: TransactionInstruction): boolean;
|
|
|
3028
3179
|
declare function patchDepositAmount(ix: TransactionInstruction, amountNative: BN): void;
|
|
3029
3180
|
|
|
3030
3181
|
/**
|
|
3031
|
-
*
|
|
3032
|
-
*
|
|
3033
|
-
*
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
*
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
*
|
|
3041
|
-
*
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3182
|
+
* Bridge-token candidate filtering for bridged (double-hop) swaps.
|
|
3183
|
+
*
|
|
3184
|
+
* A **bridge token** is NOT a cross-chain bridge: it is the high-liquidity intermediate token
|
|
3185
|
+
* (e.g. USDC or wSOL) that a swap `A → C` is routed *through* — as `A → bridge` + `bridge → C` in
|
|
3186
|
+
* one atomic bundle — when the direct swap can't fit a single transaction or has no route. This
|
|
3187
|
+
* module owns the mechanical filtering of bridge-token candidates; ordering (product policy) and
|
|
3188
|
+
* the one-call builders live in `bridge-routing.utils.ts` and the `makeBridged*Tx` actions.
|
|
3189
|
+
*/
|
|
3190
|
+
/**
|
|
3191
|
+
* The side of the marginfi account the bridge token sits on while the bridged bundle executes:
|
|
3192
|
+
* - `deposit` — the bridge token is held as *collateral* (a collateral-swap deposits it between
|
|
3193
|
+
* the two legs: withdraw source → deposit bridge, then withdraw bridge → deposit destination).
|
|
3194
|
+
* - `borrow` — the bridge token is held as *debt* (a debt-swap or loop borrows it in the first
|
|
3195
|
+
* leg and repays it exactly in the second).
|
|
3196
|
+
*/
|
|
3197
|
+
type BridgeTokenSide = "deposit" | "borrow";
|
|
3198
|
+
/**
|
|
3199
|
+
* Whether routing through `bridgeBankPk` as the bridge token would conflict with a position the
|
|
3200
|
+
* account already holds on that bank. marginfi forbids holding an asset and a liability on the
|
|
3201
|
+
* same bank, so the conflict is always *opposite-side*: a deposit-side bridge conflicts with an
|
|
3202
|
+
* existing liability there, a borrow-side bridge with an existing asset. Same-side positions are
|
|
3203
|
+
* fine (partial-withdraw / exact-repay handle them).
|
|
3204
|
+
*/
|
|
3205
|
+
declare function accountConflictsWithBridgeBank(marginfiAccount: MarginfiAccountType, bridgeBankPk: PublicKey, bridgeTokenSide: BridgeTokenSide): boolean;
|
|
3206
|
+
interface ResolveBridgeCandidateBanksParams {
|
|
3207
|
+
/** Candidate bridge-token mints, highest priority first (product policy — see
|
|
3208
|
+
* `bridge-routing.utils.ts` for the default ordering and the per-call override). */
|
|
3209
|
+
prioritizedBridgeCandidateMints: PublicKey[];
|
|
3210
|
+
/** Banks to resolve the candidate mints against — typically all banks in the marginfi group. */
|
|
3211
|
+
groupBanks: BankType[];
|
|
3212
|
+
/** The account the bridged legs run against (for the conflict check). */
|
|
3050
3213
|
marginfiAccount: MarginfiAccountType;
|
|
3051
|
-
/** Which side the bridge is
|
|
3052
|
-
|
|
3214
|
+
/** Which side the bridge token is held on — picks the standard-bank filter and the conflict
|
|
3215
|
+
* rule. */
|
|
3216
|
+
bridgeTokenSide: BridgeTokenSide;
|
|
3053
3217
|
}
|
|
3054
3218
|
/**
|
|
3055
|
-
* Resolve
|
|
3056
|
-
* those safe to route through and those
|
|
3219
|
+
* Resolve prioritized bridge-token candidate *mints* into candidate *banks*, partitioned into
|
|
3220
|
+
* those safe to route through and those blocked by an existing account position.
|
|
3057
3221
|
*
|
|
3058
3222
|
* For each mint (deduped, in priority order) it picks the standard bank that fits the side
|
|
3059
3223
|
* ({@link isStandardBorrowable} for `borrow`, {@link isStandardDepositable} for `deposit`) — this
|
|
3060
3224
|
* skips integration wrappers (`6200`) and `ReduceOnly` banks (`6017`) — then splits by
|
|
3061
|
-
* {@link
|
|
3062
|
-
* this owns only the mechanical filtering.
|
|
3225
|
+
* {@link accountConflictsWithBridgeBank}. The caller supplies the prioritized mint list (product
|
|
3226
|
+
* policy); this owns only the mechanical filtering.
|
|
3063
3227
|
*
|
|
3064
|
-
* @returns `
|
|
3065
|
-
* opposite-side position — useful for
|
|
3228
|
+
* @returns `usableBridgeBanks` (safe to route through, in priority order) and
|
|
3229
|
+
* `conflictingBridgeBanks` (resolvable but blocked by an opposite-side position — useful for
|
|
3230
|
+
* surfacing a "close that position" message).
|
|
3066
3231
|
*/
|
|
3067
|
-
declare function
|
|
3068
|
-
|
|
3069
|
-
|
|
3232
|
+
declare function resolveBridgeCandidateBanks(params: ResolveBridgeCandidateBanksParams): {
|
|
3233
|
+
usableBridgeBanks: BankType[];
|
|
3234
|
+
conflictingBridgeBanks: BankType[];
|
|
3070
3235
|
};
|
|
3071
3236
|
|
|
3237
|
+
/**
|
|
3238
|
+
* Shared support for the bridged (double-hop) one-call builders.
|
|
3239
|
+
*
|
|
3240
|
+
* A **bridge token** is NOT a cross-chain bridge: it is the high-liquidity intermediate token
|
|
3241
|
+
* (e.g. USDC or wSOL) a swap is routed *through*. When a direct collateral-swap / debt-swap /
|
|
3242
|
+
* loop `A → C` can't be built — the swap doesn't fit one tx (size / account-locks) or has no
|
|
3243
|
+
* route — it can still succeed decomposed into `A → bridge` + `bridge → C`, submitted as ONE
|
|
3244
|
+
* atomic Jito bundle. The per-flow builders live next to their direct builders
|
|
3245
|
+
* (`makeBridgedLoopTx` in `../actions/loop.ts`, `makeBridgedSwapCollateralTx` in
|
|
3246
|
+
* `../actions/swap-collateral.ts`, `makeBridgedSwapDebtTx` in `../actions/swap-debt.ts`); this
|
|
3247
|
+
* module owns the flow-agnostic routing support: candidate ordering/selection, the
|
|
3248
|
+
* candidate-iteration loop (abort / skip-on-failure / conflict surfacing), token-program
|
|
3249
|
+
* resolution, and the shared leg context.
|
|
3250
|
+
*
|
|
3251
|
+
* Candidate *ordering* is product policy: it defaults to {@link DEFAULT_BRIDGE_MINTS} and can be
|
|
3252
|
+
* overridden per call via {@link BridgeOpts.bridgeCandidateMints} (e.g. a correlation-aware
|
|
3253
|
+
* ordering). Candidate *filtering* (standard-bank resolution, opposite-side conflicts) is
|
|
3254
|
+
* mechanical and lives in {@link resolveBridgeCandidateBanks}.
|
|
3255
|
+
*/
|
|
3256
|
+
/** Default bridge-token candidates, most-liquid first. */
|
|
3257
|
+
declare const DEFAULT_BRIDGE_MINTS: PublicKey[];
|
|
3258
|
+
/** Per-call knobs for the bridged fallback of the `makeBridged*Tx` builders. */
|
|
3259
|
+
interface BridgeOpts {
|
|
3260
|
+
/**
|
|
3261
|
+
* Candidate bridge-token mints, highest priority first. Defaults to
|
|
3262
|
+
* {@link DEFAULT_BRIDGE_MINTS} (USDC, wSOL, USDT). Source/destination mints are always skipped.
|
|
3263
|
+
*/
|
|
3264
|
+
bridgeCandidateMints?: PublicKey[];
|
|
3265
|
+
/** Known token programs by mint (base58) — skips the per-mint RPC owner lookup. */
|
|
3266
|
+
tokenProgramByMint?: Map<string, PublicKey>;
|
|
3267
|
+
/** Override the bundle-size ceiling (see `composeBridgedSwap`). */
|
|
3268
|
+
maxBundleTxs?: number;
|
|
3269
|
+
abortSignal?: AbortSignal;
|
|
3270
|
+
}
|
|
3271
|
+
/** Result of a `makeBridged*Tx` builder — the direct build's result, or the bridged bundle. */
|
|
3272
|
+
interface BridgedTxResult {
|
|
3273
|
+
transactions: SolanaTransaction[];
|
|
3274
|
+
/** Index of the tx that completes the action (the direct action tx, or the bundle's last leg). */
|
|
3275
|
+
actionTxIndex: number;
|
|
3276
|
+
quoteResponse: SwapQuoteResult | undefined;
|
|
3277
|
+
/** The bridge token's mint — set only when the bridged double-hop path was used. */
|
|
3278
|
+
bridgeMint?: PublicKey;
|
|
3279
|
+
/** true → send as ONE atomic Jito bundle (bridged legs are one operation / integration
|
|
3280
|
+
* refreshes go stale within a slot); false → sequential sends are safe (cranked oracles
|
|
3281
|
+
* allow ≥ ~1 min staleness). */
|
|
3282
|
+
mustBeAtomicBundle: boolean;
|
|
3283
|
+
}
|
|
3284
|
+
/** A mint's token program: the cache (seedable by the caller), else the mint account's owner. */
|
|
3285
|
+
declare function resolveTokenProgramForMint(mint: PublicKey, connection: Connection, tokenProgramCacheByMint: Map<string, PublicKey>): Promise<PublicKey>;
|
|
3286
|
+
/**
|
|
3287
|
+
* Bridge-token candidate banks for routing `source → bridge → destination`, in priority order,
|
|
3288
|
+
* partitioned into usable and conflict-blocked. Source/destination mints are excluded from the
|
|
3289
|
+
* candidates (a token can't bridge itself).
|
|
3290
|
+
*/
|
|
3291
|
+
declare function selectSwapBridges(args: {
|
|
3292
|
+
sourceMint: PublicKey;
|
|
3293
|
+
destinationMint: PublicKey;
|
|
3294
|
+
bankMap: Map<string, BankType>;
|
|
3295
|
+
marginfiAccount: MarginfiAccountType;
|
|
3296
|
+
bridgeTokenSide: BridgeTokenSide;
|
|
3297
|
+
bridgeCandidateMints?: PublicKey[];
|
|
3298
|
+
}): {
|
|
3299
|
+
usableBridgeBanks: BankType[];
|
|
3300
|
+
conflictingBridgeBanks: BankType[];
|
|
3301
|
+
};
|
|
3302
|
+
/**
|
|
3303
|
+
* Try each usable bridge-token candidate in priority order until one composes a bundle. A
|
|
3304
|
+
* `buildBundleThroughBridge` that returns null or throws (build failure) moves on to the next
|
|
3305
|
+
* candidate; abort errors always propagate. When NO candidate is usable but some were dropped
|
|
3306
|
+
* solely for an existing opposite-side position, throws
|
|
3307
|
+
* `TransactionBuildingError.bridgeConflict` (the caller-facing "close that position" signal);
|
|
3308
|
+
* otherwise resolves null and the caller rethrows the direct build's error.
|
|
3309
|
+
*/
|
|
3310
|
+
declare function tryBridgeCandidates(args: {
|
|
3311
|
+
usableBridgeBanks: BankType[];
|
|
3312
|
+
conflictingBridgeBanks: BankType[];
|
|
3313
|
+
bridgeTokenSide: BridgeTokenSide;
|
|
3314
|
+
abortSignal?: AbortSignal;
|
|
3315
|
+
/** Build the two-leg bundle through one candidate bank; null = didn't work, try the next. */
|
|
3316
|
+
buildBundleThroughBridge: (bridgeBank: BankType) => Promise<BridgedTxResult | null>;
|
|
3317
|
+
}): Promise<BridgedTxResult | null>;
|
|
3318
|
+
/** The flow context shared verbatim by both legs of every bridged build. */
|
|
3319
|
+
type SharedBridgeLegContext = Pick<MakeSwapDebtTxParams, "program" | "marginfiAccount" | "connection" | "bankMap" | "oraclePrices" | "bankMetadataMap" | "assetShareValueMultiplierByBank" | "swapOpts" | "addressLookupTableAccounts" | "overrideInferAccounts" | "crossbarUrl" | "swapEngineRunner">;
|
|
3320
|
+
declare function sharedBridgeLegContext(params: SharedBridgeLegContext): SharedBridgeLegContext;
|
|
3321
|
+
|
|
3072
3322
|
/**
|
|
3073
3323
|
* Creates an instruction to close a Marginfi account.
|
|
3074
3324
|
*
|
|
@@ -3166,7 +3416,7 @@ declare function makeCreateAccountIxWithProjection(props: {
|
|
|
3166
3416
|
declare function makeCreateMarginfiAccountTx(program: MarginfiProgram, authority: PublicKey, groupAddress: PublicKey, addressLookupTables: AddressLookupTableAccount[], accountIndex: number, thirdPartyId?: number): Promise<SolanaTransaction>;
|
|
3167
3417
|
declare function makeCreateMarginfiAccountIx(program: MarginfiProgram, authority: PublicKey, groupAddress: PublicKey, accountIndex: number, thirdPartyId?: number): Promise<TransactionInstruction>;
|
|
3168
3418
|
declare function makeSetupIx({ connection, authority, tokens }: MakeSetupIxParams): Promise<TransactionInstruction[]>;
|
|
3169
|
-
declare function makePulseHealthIx(program: MarginfiProgram,
|
|
3419
|
+
declare function makePulseHealthIx(program: MarginfiProgram, marginfiAccount: MarginfiAccountType, banks: Map<string, BankType>, mandatoryBanks: PublicKey[], excludedBanks: PublicKey[]): Promise<{
|
|
3170
3420
|
instructions: TransactionInstruction[];
|
|
3171
3421
|
keys: never[];
|
|
3172
3422
|
}>;
|
|
@@ -3426,7 +3676,23 @@ declare function makeLoopTx(params: MakeLoopTxParams): Promise<{
|
|
|
3426
3676
|
transactions: ExtendedV0Transaction[];
|
|
3427
3677
|
actionTxIndex: number;
|
|
3428
3678
|
quoteResponse: SwapQuoteResult | undefined;
|
|
3679
|
+
/** true → send as ONE atomic Jito bundle (integration refreshes go stale within a slot);
|
|
3680
|
+
* false → sequential sends are safe (cranked oracles allow ≥ ~1 min staleness). */
|
|
3681
|
+
mustBeAtomicBundle: boolean;
|
|
3429
3682
|
}>;
|
|
3683
|
+
interface MakeBridgedLoopTxParams extends MakeLoopTxParams {
|
|
3684
|
+
bridgeOpts?: BridgeOpts;
|
|
3685
|
+
}
|
|
3686
|
+
/**
|
|
3687
|
+
* {@link makeLoopTx} with a transparent bridged fallback: if the direct loop's borrow→deposit swap
|
|
3688
|
+
* can't fit one tx or has no route, loop P borrowing a value-equivalent amount of a bridge token,
|
|
3689
|
+
* then debt-swap the bridge debt → X, as one atomic bundle.
|
|
3690
|
+
*
|
|
3691
|
+
* Intended for existing accounts — a fresh account's loop has a minimal footprint and fits the
|
|
3692
|
+
* direct path, so callers creating the account in the same flow should call {@link makeLoopTx}
|
|
3693
|
+
* directly.
|
|
3694
|
+
*/
|
|
3695
|
+
declare function makeBridgedLoopTx(params: MakeBridgedLoopTxParams): Promise<BridgedTxResult>;
|
|
3430
3696
|
|
|
3431
3697
|
/**
|
|
3432
3698
|
* Creates a repay instruction for repaying borrowed assets to a Marginfi bank.
|
|
@@ -3486,6 +3752,7 @@ declare function makeRepayWithCollatTx(params: MakeRepayWithCollatTxParams): Pro
|
|
|
3486
3752
|
transactions: ExtendedV0Transaction[];
|
|
3487
3753
|
swapQuote: SwapQuoteResult | undefined;
|
|
3488
3754
|
amountToRepay: number;
|
|
3755
|
+
mustBeAtomicBundle: boolean;
|
|
3489
3756
|
}>;
|
|
3490
3757
|
|
|
3491
3758
|
declare function makeBeginFlashLoanIx(program: MarginfiProgram, marginfiAccountPk: PublicKey, endIndex: number, authority?: PublicKey, isSync?: boolean): Promise<InstructionsWrapper>;
|
|
@@ -3515,7 +3782,19 @@ declare function makeSwapCollateralTx(params: MakeSwapCollateralTxParams): Promi
|
|
|
3515
3782
|
transactions: ExtendedV0Transaction[];
|
|
3516
3783
|
actionTxIndex: number;
|
|
3517
3784
|
quoteResponse: SwapQuoteResult | undefined;
|
|
3785
|
+
/** true → send as ONE atomic Jito bundle (integration refreshes go stale within a slot);
|
|
3786
|
+
* false → sequential sends are safe (cranked oracles allow ≥ ~1 min staleness). */
|
|
3787
|
+
mustBeAtomicBundle: boolean;
|
|
3518
3788
|
}>;
|
|
3789
|
+
interface MakeBridgedSwapCollateralTxParams extends MakeSwapCollateralTxParams {
|
|
3790
|
+
bridgeOpts?: BridgeOpts;
|
|
3791
|
+
}
|
|
3792
|
+
/**
|
|
3793
|
+
* {@link makeSwapCollateralTx} with a transparent bridged fallback: if the direct swap `A → C`
|
|
3794
|
+
* can't fit one tx or has no route, decompose it into `A → bridge` + `bridge → C` through a
|
|
3795
|
+
* high-liquidity bridge collateral, composed into one atomic bundle.
|
|
3796
|
+
*/
|
|
3797
|
+
declare function makeBridgedSwapCollateralTx(params: MakeBridgedSwapCollateralTxParams): Promise<BridgedTxResult>;
|
|
3519
3798
|
|
|
3520
3799
|
/**
|
|
3521
3800
|
* Creates transactions to swap one debt position to another using a flash loan.
|
|
@@ -3540,7 +3819,21 @@ declare function makeSwapDebtTx(params: MakeSwapDebtTxParams): Promise<{
|
|
|
3540
3819
|
transactions: ExtendedV0Transaction[];
|
|
3541
3820
|
actionTxIndex: number;
|
|
3542
3821
|
quoteResponse: SwapQuoteResult | undefined;
|
|
3822
|
+
/** true → send as ONE atomic Jito bundle (integration refreshes go stale within a slot);
|
|
3823
|
+
* false → sequential sends are safe (cranked oracles allow ≥ ~1 min staleness). */
|
|
3824
|
+
mustBeAtomicBundle: boolean;
|
|
3543
3825
|
}>;
|
|
3826
|
+
interface MakeBridgedSwapDebtTxParams extends MakeSwapDebtTxParams {
|
|
3827
|
+
bridgeOpts?: BridgeOpts;
|
|
3828
|
+
}
|
|
3829
|
+
/**
|
|
3830
|
+
* {@link makeSwapDebtTx} with a transparent bridged fallback: if the direct debt swap `A → C`
|
|
3831
|
+
* (repay A by borrowing C) can't fit one tx or has no route, decompose it into `A → bridge` +
|
|
3832
|
+
* `bridge → C` through a borrowable bridge debt, as one atomic bundle. The first leg repays A by
|
|
3833
|
+
* borrowing the bridge; the second leg repays exactly the bridge the first leg borrowed and
|
|
3834
|
+
* borrows C.
|
|
3835
|
+
*/
|
|
3836
|
+
declare function makeBridgedSwapDebtTx(params: MakeBridgedSwapDebtTxParams): Promise<BridgedTxResult>;
|
|
3544
3837
|
|
|
3545
3838
|
/**
|
|
3546
3839
|
* Roll a matured Exponent PT collateral position into its next-maturity PT, so the **full
|
|
@@ -3622,6 +3915,108 @@ declare function mergeBridgeQuotesLoop(firstLeg: SwapQuoteResult, secondLeg: Swa
|
|
|
3622
3915
|
*/
|
|
3623
3916
|
declare function composeBridgedSwap(params: ComposeBridgedSwapParams): Promise<ComposeBridgedSwapResult | null>;
|
|
3624
3917
|
|
|
3918
|
+
interface ClassifiedPosition {
|
|
3919
|
+
bankAddress: PublicKey;
|
|
3920
|
+
side: TransferPositionSide;
|
|
3921
|
+
/** UI amount of the position (collateral: withdrawn from A / deposited to B; debt: repaid on A). */
|
|
3922
|
+
uiAmount: BigNumber;
|
|
3923
|
+
bank: BankType;
|
|
3924
|
+
tokenProgram: PublicKey;
|
|
3925
|
+
}
|
|
3926
|
+
/**
|
|
3927
|
+
* Validate the selection, infer each position's side, and resolve its UI amount. Correctness of the
|
|
3928
|
+
* transfer itself (both accounts staying healthy) is enforced on-chain by the flashloan's end health
|
|
3929
|
+
* check on A and each borrow's health check on B — so no client-side health/USD math is needed.
|
|
3930
|
+
*/
|
|
3931
|
+
declare function classifyAndValidate(params: MakeTransferPositionsTxParams): ClassifiedPosition[];
|
|
3932
|
+
interface BuildContext {
|
|
3933
|
+
program: MarginfiProgram;
|
|
3934
|
+
accountA: MarginfiAccountType;
|
|
3935
|
+
accountB: MarginfiAccountType;
|
|
3936
|
+
bankMap: Map<string, BankType>;
|
|
3937
|
+
bankMetadataMap: BankIntegrationMetadataMap;
|
|
3938
|
+
assetShareValueMultiplierByBank: Map<string, BigNumber>;
|
|
3939
|
+
borrowPaddingBps: number;
|
|
3940
|
+
groupRateLimiterEnabled: boolean;
|
|
3941
|
+
overrideInferAccounts?: {
|
|
3942
|
+
group?: PublicKey;
|
|
3943
|
+
authority?: PublicKey;
|
|
3944
|
+
};
|
|
3945
|
+
/** Banks the destination account already holds before the transfer starts. */
|
|
3946
|
+
destPreexistingBanks: BankType[];
|
|
3947
|
+
}
|
|
3948
|
+
/**
|
|
3949
|
+
* Build one collateral position's withdraw-from-A + deposit-into-B instructions, dispatching to the
|
|
3950
|
+
* right builder for the bank's asset tag. This is the single place that defines which banks the
|
|
3951
|
+
* action supports: `DEFAULT`/`SOL`/`STAKED` use the standard withdraw/deposit; `KAMINO`/`JUPLEND`
|
|
3952
|
+
* use their dedicated builders (which lock the integration's reserve/vault accounts and, for Kamino,
|
|
3953
|
+
* convert the underlying UI amount to cToken units); anything else throws
|
|
3954
|
+
* `TRANSFER_POSITIONS_UNSUPPORTED_BANK`. The reserve/rate state each integration builder needs is
|
|
3955
|
+
* read from `bankMetadataMap`; the on-chain refresh those reads depend on is emitted separately in
|
|
3956
|
+
* `buildIntegrationRefreshIxs`.
|
|
3957
|
+
*
|
|
3958
|
+
* `observationBanksOverride` controls the withdraw leg's health pack (empty while A is flashloaned
|
|
3959
|
+
* with the group limiter off; the withdrawn bank's oracle when it is on). The deposit leg runs no
|
|
3960
|
+
* health check, so it needs none.
|
|
3961
|
+
*/
|
|
3962
|
+
declare function buildCollateralLegIxs(ctx: BuildContext, position: ClassifiedPosition, isSync: boolean, observationBanksOverride: ReturnType<typeof computeHealthAccountMetas>): Promise<{
|
|
3963
|
+
withdrawIxs: TransactionInstruction[];
|
|
3964
|
+
depositIxs: TransactionInstruction[];
|
|
3965
|
+
}>;
|
|
3966
|
+
/**
|
|
3967
|
+
* Atomically move a selected set of positions from account A to account B in a single flashloan.
|
|
3968
|
+
* Per position: collateral → `withdraw(A)` + `deposit(B)`; debt → `borrow(B)` + `repay(A)`. Returns
|
|
3969
|
+
* unsigned transactions ordered for sequential execution (setup/refresh + crank first, then the
|
|
3970
|
+
* flashloan); the caller signs and sends them.
|
|
3971
|
+
*
|
|
3972
|
+
* The whole transfer must fit one v0 transaction — the selection is capped at `maxPositions`
|
|
3973
|
+
* (default 5), and the built flashloan is size-checked, throwing `TRANSFER_POSITIONS_UNSPLITTABLE`
|
|
3974
|
+
* if it still overflows (possible with several integration positions). Transfer larger sets in
|
|
3975
|
+
* batches. Correctness (both accounts staying healthy) is enforced on-chain: `endFL(A)` checks A's
|
|
3976
|
+
* remainder and each `borrow(B)` checks B — no client-side health prediction.
|
|
3977
|
+
*
|
|
3978
|
+
* Supported asset tags: `DEFAULT`/`SOL`/`STAKED` on either leg, and the collateral-only integrations
|
|
3979
|
+
* `KAMINO`/`JUPLEND` on the collateral leg (dedicated builders + a preceding reserve/rate refresh).
|
|
3980
|
+
* `DRIFT`/`SOLEND` are rejected.
|
|
3981
|
+
*
|
|
3982
|
+
* Runtime notes:
|
|
3983
|
+
* - Each borrow-before-repay transiently spikes the debt bank's rate-limit window; a bank near its
|
|
3984
|
+
* cap can revert with `BankHourly/DailyRateLimitExceeded`. The whole flashloan reverts atomically,
|
|
3985
|
+
* so this is safe and retryable — treat it as such.
|
|
3986
|
+
* - Integration (Kamino/JupLend) reserve/rate refresh rides in the prelude transaction and requires
|
|
3987
|
+
* `bankMetadataMap` to carry fresh `kaminoStates`/`jupLendStates`.
|
|
3988
|
+
* - All transactions share one blockhash; execute them in order within its validity window. When
|
|
3989
|
+
* `mustBeAtomicBundle` is true, they must also land atomically in one bundle.
|
|
3990
|
+
* - Dust (borrow padding minus accrued interest; withdraw-all/cToken-conversion excess) remains in
|
|
3991
|
+
* the wallet ATAs.
|
|
3992
|
+
*/
|
|
3993
|
+
declare function makeTransferPositionsTx(params: MakeTransferPositionsTxParams): Promise<TransferPositionsResult>;
|
|
3994
|
+
|
|
3995
|
+
/**
|
|
3996
|
+
* Withdraw the FULL position of every given bank, packing as many withdraws
|
|
3997
|
+
* per transaction as fit the size/lock limits. Venue dispatch (Kamino /
|
|
3998
|
+
* JupLend / Drift / standard) and the per-instruction health packs live here:
|
|
3999
|
+
* each withdraw's remaining accounts exclude every bank already closed by the
|
|
4000
|
+
* withdraws before it — across the whole ordered batch — because the on-chain
|
|
4001
|
+
* health check runs against the account's live (shrinking) balance set.
|
|
4002
|
+
*
|
|
4003
|
+
* The returned transactions MUST land as one atomic Jito bundle (same slot,
|
|
4004
|
+
* sequential): the integration refreshes (Kamino reserves + obligations, rate
|
|
4005
|
+
* cranks) live in a single prelude tx rather than in each withdraw tx, and
|
|
4006
|
+
* Klend's slot-based staleness checks only stay satisfied when the withdraws
|
|
4007
|
+
* execute in the refresh's slot.
|
|
4008
|
+
*
|
|
4009
|
+
* Returns `[ATA setup txs…, crank tx?, refresh tx?, withdraw txs…]`;
|
|
4010
|
+
* `actionTxIndex` points at the first withdraw tx.
|
|
4011
|
+
*/
|
|
4012
|
+
declare function makeBulkWithdrawTx(params: MakeBulkWithdrawTxParams): Promise<BulkLendTxsResult>;
|
|
4013
|
+
/**
|
|
4014
|
+
* Repay the FULL debt of every given bank from the wallet, packing as many
|
|
4015
|
+
* repays per transaction as fit. Repays carry no health pack and need no
|
|
4016
|
+
* oracle cranks, so most batches are a single transaction.
|
|
4017
|
+
*/
|
|
4018
|
+
declare function makeBulkRepayTx(params: MakeBulkRepayTxParams): Promise<BulkLendTxsResult>;
|
|
4019
|
+
|
|
3625
4020
|
type MakeSmartCrankSwbFeedIxParams = {
|
|
3626
4021
|
marginfiAccount: MarginfiAccountType;
|
|
3627
4022
|
bankMap: Map<string, BankType>;
|
|
@@ -3642,6 +4037,25 @@ declare function makeSmartCrankSwbFeedIx(params: MakeSmartCrankSwbFeedIxParams):
|
|
|
3642
4037
|
instructions: TransactionInstruction[];
|
|
3643
4038
|
luts: AddressLookupTableAccount[];
|
|
3644
4039
|
}>;
|
|
4040
|
+
type MakeSmartCrankSwbFeedIxForAccountsParams = Omit<MakeSmartCrankSwbFeedIxParams, "marginfiAccount"> & {
|
|
4041
|
+
/**
|
|
4042
|
+
* Accounts targeted by instructions in the set. Each account is projected against
|
|
4043
|
+
* the instructions that operate on it (the projection filters by account), so the
|
|
4044
|
+
* same full instruction list serves every account. The first account's authority
|
|
4045
|
+
* pays the feed updates.
|
|
4046
|
+
*/
|
|
4047
|
+
marginfiAccounts: MarginfiAccountType[];
|
|
4048
|
+
};
|
|
4049
|
+
/**
|
|
4050
|
+
* Multi-account variant of {@link makeSmartCrankSwbFeedIx} for instruction sets that
|
|
4051
|
+
* span several marginfi accounts (e.g. transferring positions: the source is cranked
|
|
4052
|
+
* against its withdraws, the destination against its projected post-transfer
|
|
4053
|
+
* deposits). Overlapping feeds across accounts are cranked once.
|
|
4054
|
+
*/
|
|
4055
|
+
declare function makeSmartCrankSwbFeedIxForAccounts(params: MakeSmartCrankSwbFeedIxForAccountsParams): Promise<{
|
|
4056
|
+
instructions: TransactionInstruction[];
|
|
4057
|
+
luts: AddressLookupTableAccount[];
|
|
4058
|
+
}>;
|
|
3645
4059
|
declare const DEFAULT_CROSSBAR_URL = "https://crossbar.0.xyz";
|
|
3646
4060
|
declare const DEFAULT_FALLBACK_CROSSBAR_URL = "https://crossbar.switchboard.xyz";
|
|
3647
4061
|
declare function makeCrankSwbFeedIx(marginfiAccount: MarginfiAccountType, bankMap: Map<string, BankType>, newBanksPk: PublicKey[], provider: AnchorProvider, crossbarUrl?: string): Promise<{
|
|
@@ -3712,6 +4126,23 @@ declare function makeUpdateDriftMarketIxs(marginfiAccount: MarginfiAccountType,
|
|
|
3712
4126
|
*/
|
|
3713
4127
|
declare function makeUpdateJupLendRateIxs(marginfiAccount: MarginfiAccountType, bankMap: Map<string, BankType>, banksToExclude: PublicKey[], bankMetadataMap: BankIntegrationMetadataMap): InstructionsWrapper;
|
|
3714
4128
|
|
|
4129
|
+
/**
|
|
4130
|
+
* Groups the per-integration refresh/update instructions (Kamino reserve refresh,
|
|
4131
|
+
* Drift spot market update, JupLend rate update) into a single wrapper.
|
|
4132
|
+
*
|
|
4133
|
+
* JupLend and Drift action instructions update their own bank via CPI, so the bank
|
|
4134
|
+
* being acted on is excluded from those updates. Kamino has no such CPI, so the
|
|
4135
|
+
* action bank must be explicitly included in the refresh set instead.
|
|
4136
|
+
*
|
|
4137
|
+
* @param marginfiAccount - The marginfi account containing active bank balances
|
|
4138
|
+
* @param bankMap - Map of bank addresses (base58) to bank instances
|
|
4139
|
+
* @param banksToExclude - Banks skipped for the JupLend/Drift updates (their CPI already updates them)
|
|
4140
|
+
* @param bankMetadataMap - Map containing Bank-specific metadata (integration states)
|
|
4141
|
+
* @param kaminoNewBanksPk - Banks to union into the Kamino refresh set, defaults to `banksToExclude`
|
|
4142
|
+
* @returns InstructionsWrapper with instructions ordered kamino -> drift -> juplend
|
|
4143
|
+
*/
|
|
4144
|
+
declare function makeRefreshIntegrationBanksIxs(marginfiAccount: MarginfiAccountType, bankMap: Map<string, BankType>, banksToExclude: PublicKey[], bankMetadataMap: BankIntegrationMetadataMap, kaminoNewBanksPk?: PublicKey[]): InstructionsWrapper;
|
|
4145
|
+
|
|
3715
4146
|
type ValidatorVoteAccountByBank = {
|
|
3716
4147
|
[address: string]: string;
|
|
3717
4148
|
};
|
|
@@ -4016,6 +4447,14 @@ declare function computeBankBorrowApy(bank: BankType): number;
|
|
|
4016
4447
|
*/
|
|
4017
4448
|
declare function computeBankMetrics(params: ComputeBankMetricsParams): BankMetrics;
|
|
4018
4449
|
|
|
4450
|
+
/**
|
|
4451
|
+
* Lookup-or-throw helpers for action-builder inputs. The optional `makeError`
|
|
4452
|
+
* lets callers throw their own typed error (e.g. a TransactionBuildingError
|
|
4453
|
+
* with user-facing copy) instead of a plain Error.
|
|
4454
|
+
*/
|
|
4455
|
+
declare function requireBank(bankMap: Map<string, BankType>, address: PublicKey, makeError?: (message: string) => Error): BankType;
|
|
4456
|
+
declare function requireTokenProgram(tokenProgramsByBank: Map<string, PublicKey>, address: PublicKey, makeError?: (message: string) => Error): PublicKey;
|
|
4457
|
+
|
|
4019
4458
|
/**
|
|
4020
4459
|
* Fee state cache - stores information from the global FeeState
|
|
4021
4460
|
* so the FeeState can be omitted on certain instructions
|
|
@@ -4745,7 +5184,11 @@ declare enum TransactionBuildingErrorCode {
|
|
|
4745
5184
|
DRIFT_STATE_NOT_FOUND = "DRIFT_STATE_NOT_FOUND",
|
|
4746
5185
|
JUPLEND_STATE_NOT_FOUND = "JUPLEND_STATE_NOT_FOUND",
|
|
4747
5186
|
SWITCHBOARD_FEED_UPDATE_FAILED = "SWITCHBOARD_FEED_UPDATE_FAILED",
|
|
4748
|
-
SWAP_QUOTE_FAILED = "SWAP_QUOTE_FAILED"
|
|
5187
|
+
SWAP_QUOTE_FAILED = "SWAP_QUOTE_FAILED",
|
|
5188
|
+
TRANSFER_POSITIONS_INVALID_SELECTION = "TRANSFER_POSITIONS_INVALID_SELECTION",
|
|
5189
|
+
TRANSFER_POSITIONS_UNSUPPORTED_BANK = "TRANSFER_POSITIONS_UNSUPPORTED_BANK",
|
|
5190
|
+
TRANSFER_POSITIONS_UNSPLITTABLE = "TRANSFER_POSITIONS_UNSPLITTABLE",
|
|
5191
|
+
BRIDGE_CONFLICT = "BRIDGE_CONFLICT"
|
|
4749
5192
|
}
|
|
4750
5193
|
/**
|
|
4751
5194
|
* Typed details for each error code
|
|
@@ -4805,6 +5248,30 @@ interface TransactionBuildingErrorDetails {
|
|
|
4805
5248
|
outputMint: string;
|
|
4806
5249
|
reason: string;
|
|
4807
5250
|
};
|
|
5251
|
+
[TransactionBuildingErrorCode.TRANSFER_POSITIONS_INVALID_SELECTION]: {
|
|
5252
|
+
reason: string;
|
|
5253
|
+
bankAddresses: string[];
|
|
5254
|
+
};
|
|
5255
|
+
[TransactionBuildingErrorCode.TRANSFER_POSITIONS_UNSUPPORTED_BANK]: {
|
|
5256
|
+
bankAddress: string;
|
|
5257
|
+
assetTag: number;
|
|
5258
|
+
bankSymbol?: string;
|
|
5259
|
+
};
|
|
5260
|
+
[TransactionBuildingErrorCode.TRANSFER_POSITIONS_UNSPLITTABLE]: {
|
|
5261
|
+
reason: string;
|
|
5262
|
+
sizeBytes?: number;
|
|
5263
|
+
accountCount?: number;
|
|
5264
|
+
};
|
|
5265
|
+
[TransactionBuildingErrorCode.BRIDGE_CONFLICT]: {
|
|
5266
|
+
/** Bridge-token candidate banks blocked by an existing opposite-side account position. */
|
|
5267
|
+
conflictingBanks: Array<{
|
|
5268
|
+
bankAddress: string;
|
|
5269
|
+
mint: string;
|
|
5270
|
+
symbol?: string;
|
|
5271
|
+
}>;
|
|
5272
|
+
/** Whether the bridge token would have been held as collateral ("deposit") or debt ("borrow"). */
|
|
5273
|
+
bridgeTokenSide: "deposit" | "borrow";
|
|
5274
|
+
};
|
|
4808
5275
|
}
|
|
4809
5276
|
/**
|
|
4810
5277
|
* Error thrown during transaction building in the SDK.
|
|
@@ -4852,6 +5319,32 @@ declare class TransactionBuildingError<T extends TransactionBuildingErrorCode =
|
|
|
4852
5319
|
* Failed to get a swap quote from any provider
|
|
4853
5320
|
*/
|
|
4854
5321
|
static swapQuoteFailed(provider: string, inputMint: string, outputMint: string, reason: string): TransactionBuildingError<TransactionBuildingErrorCode.SWAP_QUOTE_FAILED>;
|
|
5322
|
+
/**
|
|
5323
|
+
* The requested set of positions to transfer is invalid (inactive bank on the source,
|
|
5324
|
+
* destination overlap, capacity/slot conflict, group/authority mismatch, etc.).
|
|
5325
|
+
*/
|
|
5326
|
+
static transferPositionsInvalidSelection(reason: string, bankAddresses: string[]): TransactionBuildingError<TransactionBuildingErrorCode.TRANSFER_POSITIONS_INVALID_SELECTION>;
|
|
5327
|
+
/**
|
|
5328
|
+
* A selected position lives in a bank whose asset tag is not supported by transfer-positions
|
|
5329
|
+
* (v1 supports DEFAULT and STAKED only).
|
|
5330
|
+
*/
|
|
5331
|
+
static transferPositionsUnsupportedBank(bankAddress: string, assetTag: number, bankSymbol?: string): TransactionBuildingError<TransactionBuildingErrorCode.TRANSFER_POSITIONS_UNSUPPORTED_BANK>;
|
|
5332
|
+
/**
|
|
5333
|
+
* The built transfer transaction exceeds the v0 size / account-lock limits even at the position
|
|
5334
|
+
* cap (most likely several integration positions whose reserve accounts overflow the 64-lock cap).
|
|
5335
|
+
* Retry with fewer positions in the selection.
|
|
5336
|
+
*/
|
|
5337
|
+
static transferPositionsUnsplittable(reason: string, sizeBytes?: number, accountCount?: number): TransactionBuildingError<TransactionBuildingErrorCode.TRANSFER_POSITIONS_UNSPLITTABLE>;
|
|
5338
|
+
/**
|
|
5339
|
+
* A bridged (double-hop) swap could not route because every bridge-token candidate bank
|
|
5340
|
+
* conflicts with an existing opposite-side position on the account (marginfi forbids holding an
|
|
5341
|
+
* asset and a liability on the same bank).
|
|
5342
|
+
*/
|
|
5343
|
+
static bridgeConflict(conflictingBanks: Array<{
|
|
5344
|
+
bankAddress: string;
|
|
5345
|
+
mint: string;
|
|
5346
|
+
symbol?: string;
|
|
5347
|
+
}>, bridgeTokenSide: "deposit" | "borrow"): TransactionBuildingError<TransactionBuildingErrorCode.BRIDGE_CONFLICT>;
|
|
4855
5348
|
/**
|
|
4856
5349
|
* Generic escape hatch for custom errors
|
|
4857
5350
|
*/
|
|
@@ -4868,6 +5361,13 @@ declare class TransactionBuildingError<T extends TransactionBuildingErrorCode =
|
|
|
4868
5361
|
* (which would otherwise throw a raw serialization `RangeError`) as `SWAP_SIZE_EXCEEDED_LOOP`.
|
|
4869
5362
|
*/
|
|
4870
5363
|
declare function isDecomposableSwapError(e: unknown): e is TransactionBuildingError;
|
|
5364
|
+
/**
|
|
5365
|
+
* Whether a build failure is a bridged-swap conflict: the direct build failed AND every
|
|
5366
|
+
* bridge-token candidate was blocked by an existing opposite-side position on the account.
|
|
5367
|
+
* Narrows to the typed details (`conflictingBanks`, `bridgeTokenSide`) so callers can surface a
|
|
5368
|
+
* "close that position or pick a different pair" message.
|
|
5369
|
+
*/
|
|
5370
|
+
declare function isBridgeConflictError(e: unknown): e is TransactionBuildingError<TransactionBuildingErrorCode.BRIDGE_CONFLICT>;
|
|
4871
5371
|
|
|
4872
5372
|
declare const PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED: Buffer<ArrayBuffer>;
|
|
4873
5373
|
declare const PDA_BANK_INSURANCE_VAULT_AUTH_SEED: Buffer<ArrayBuffer>;
|
|
@@ -5051,6 +5551,7 @@ declare const PRIORITY_TX_SIZE: number;
|
|
|
5051
5551
|
declare const WSOL_MINT: PublicKey;
|
|
5052
5552
|
declare const LST_MINT: PublicKey;
|
|
5053
5553
|
declare const USDC_MINT: PublicKey;
|
|
5554
|
+
declare const USDT_MINT: PublicKey;
|
|
5054
5555
|
declare const USDC_DECIMALS = 6;
|
|
5055
5556
|
|
|
5056
5557
|
declare class Balance implements BalanceType {
|
|
@@ -5540,7 +6041,67 @@ declare class MarginfiAccount implements MarginfiAccountType {
|
|
|
5540
6041
|
transactions: ExtendedV0Transaction[];
|
|
5541
6042
|
actionTxIndex: number;
|
|
5542
6043
|
quoteResponse: SwapQuoteResult | undefined;
|
|
6044
|
+
/** true → send as ONE atomic Jito bundle (bridged legs / integration refreshes);
|
|
6045
|
+
* false → sequential sends are safe. */
|
|
6046
|
+
mustBeAtomicBundle: boolean;
|
|
5543
6047
|
}>;
|
|
6048
|
+
/**
|
|
6049
|
+
* Atomically move a selected set of positions from this account to a destination account
|
|
6050
|
+
* (same authority, same group) using flashloans, auto-splitting across transactions as needed.
|
|
6051
|
+
*
|
|
6052
|
+
* @see {@link makeTransferPositionsTx} for detailed implementation
|
|
6053
|
+
*/
|
|
6054
|
+
makeTransferPositionsTx(params: Omit<MakeTransferPositionsTxParams, "marginfiAccount">): Promise<TransferPositionsResult>;
|
|
6055
|
+
/**
|
|
6056
|
+
* Creates a loop transaction with a transparent bridged (double-hop) fallback.
|
|
6057
|
+
*
|
|
6058
|
+
* One call: tries the direct {@link makeLoopTx} first; if its borrow→deposit swap can't fit one
|
|
6059
|
+
* transaction (size / account-locks) or has no route, it loops the deposit asset against a
|
|
6060
|
+
* value-equivalent borrow of a high-liquidity bridge token, then debt-swaps the bridge debt to
|
|
6061
|
+
* the requested borrow asset — both legs composed into ONE atomic Jito bundle.
|
|
6062
|
+
*
|
|
6063
|
+
* Bridge candidates default to USDC → wSOL → USDT and can be reordered/overridden via
|
|
6064
|
+
* `params.bridgeOpts.bridgeCandidateMints`; `bridgeOpts` also accepts known token programs (skips RPC
|
|
6065
|
+
* lookups), a bundle-size ceiling, and an abort signal. `result.bridgeMint` is set only when the
|
|
6066
|
+
* bridged path was used.
|
|
6067
|
+
*
|
|
6068
|
+
* Intended for existing accounts — a fresh account's loop fits the direct path, so flows that
|
|
6069
|
+
* create the account in the same action should call {@link makeLoopTx} directly.
|
|
6070
|
+
*
|
|
6071
|
+
* @param params - Loop transaction parameters plus optional `bridgeOpts`
|
|
6072
|
+
* @returns Object containing transactions, action index, merged swap quote, and the bridge mint
|
|
6073
|
+
*
|
|
6074
|
+
* @see {@link makeBridgedLoopTx} for detailed implementation
|
|
6075
|
+
*/
|
|
6076
|
+
makeBridgedLoopTx(params: Omit<MakeBridgedLoopTxParams, "marginfiAccount">): Promise<BridgedTxResult>;
|
|
6077
|
+
/**
|
|
6078
|
+
* Creates a collateral-swap transaction with a transparent bridged (double-hop) fallback.
|
|
6079
|
+
*
|
|
6080
|
+
* One call: tries the direct {@link makeSwapCollateralTx} first; if the swap `A → C` can't fit
|
|
6081
|
+
* one transaction or has no route, it decomposes into `A → bridge` + `bridge → C` through a
|
|
6082
|
+
* high-liquidity bridge collateral, both legs composed into ONE atomic Jito bundle. See
|
|
6083
|
+
* {@link makeBridgedLoopTx} for the `bridgeOpts` knobs.
|
|
6084
|
+
*
|
|
6085
|
+
* @param params - Swap collateral transaction parameters plus optional `bridgeOpts`
|
|
6086
|
+
* @returns Object containing transactions, action index, merged swap quote, and the bridge mint
|
|
6087
|
+
*
|
|
6088
|
+
* @see {@link makeBridgedSwapCollateralTx} for detailed implementation
|
|
6089
|
+
*/
|
|
6090
|
+
makeBridgedSwapCollateralTx(params: Omit<MakeBridgedSwapCollateralTxParams, "marginfiAccount">): Promise<BridgedTxResult>;
|
|
6091
|
+
/**
|
|
6092
|
+
* Creates a debt-swap transaction with a transparent bridged (double-hop) fallback.
|
|
6093
|
+
*
|
|
6094
|
+
* One call: tries the direct {@link makeSwapDebtTx} first; if the swap `A → C` can't fit one
|
|
6095
|
+
* transaction or has no route, the first leg repays A by borrowing a bridge token and the second
|
|
6096
|
+
* leg repays exactly that bridge debt while borrowing C — both legs composed into ONE atomic
|
|
6097
|
+
* Jito bundle. See {@link makeBridgedLoopTx} for the `bridgeOpts` knobs.
|
|
6098
|
+
*
|
|
6099
|
+
* @param params - Swap debt transaction parameters plus optional `bridgeOpts`
|
|
6100
|
+
* @returns Object containing transactions, action index, merged swap quote, and the bridge mint
|
|
6101
|
+
*
|
|
6102
|
+
* @see {@link makeBridgedSwapDebtTx} for detailed implementation
|
|
6103
|
+
*/
|
|
6104
|
+
makeBridgedSwapDebtTx(params: Omit<MakeBridgedSwapDebtTxParams, "marginfiAccount">): Promise<BridgedTxResult>;
|
|
5544
6105
|
/**
|
|
5545
6106
|
* Creates a transaction to repay debt using collateral.
|
|
5546
6107
|
*
|
|
@@ -5573,6 +6134,9 @@ declare class MarginfiAccount implements MarginfiAccountType {
|
|
|
5573
6134
|
transactions: ExtendedV0Transaction[];
|
|
5574
6135
|
swapQuote: SwapQuoteResult | undefined;
|
|
5575
6136
|
amountToRepay: number;
|
|
6137
|
+
/** true → send as ONE atomic Jito bundle (bridged legs / integration refreshes);
|
|
6138
|
+
* false → sequential sends are safe. */
|
|
6139
|
+
mustBeAtomicBundle: boolean;
|
|
5576
6140
|
}>;
|
|
5577
6141
|
/**
|
|
5578
6142
|
* Creates a transaction to swap one collateral position to another using a flash loan.
|
|
@@ -5607,6 +6171,9 @@ declare class MarginfiAccount implements MarginfiAccountType {
|
|
|
5607
6171
|
transactions: ExtendedV0Transaction[];
|
|
5608
6172
|
actionTxIndex: number;
|
|
5609
6173
|
quoteResponse: SwapQuoteResult | undefined;
|
|
6174
|
+
/** true → send as ONE atomic Jito bundle (bridged legs / integration refreshes);
|
|
6175
|
+
* false → sequential sends are safe. */
|
|
6176
|
+
mustBeAtomicBundle: boolean;
|
|
5610
6177
|
}>;
|
|
5611
6178
|
/**
|
|
5612
6179
|
* Creates a transaction to roll a matured Exponent PT collateral position into its
|
|
@@ -5653,6 +6220,9 @@ declare class MarginfiAccount implements MarginfiAccountType {
|
|
|
5653
6220
|
transactions: ExtendedV0Transaction[];
|
|
5654
6221
|
actionTxIndex: number;
|
|
5655
6222
|
quoteResponse: SwapQuoteResult | undefined;
|
|
6223
|
+
/** true → send as ONE atomic Jito bundle (bridged legs / integration refreshes);
|
|
6224
|
+
* false → sequential sends are safe. */
|
|
6225
|
+
mustBeAtomicBundle: boolean;
|
|
5656
6226
|
}>;
|
|
5657
6227
|
/**
|
|
5658
6228
|
* Creates a deposit transaction.
|
|
@@ -6013,7 +6583,18 @@ declare class MarginfiAccountWrapper {
|
|
|
6013
6583
|
transactions: ExtendedV0Transaction[];
|
|
6014
6584
|
actionTxIndex: number;
|
|
6015
6585
|
quoteResponse: SwapQuoteResult | undefined;
|
|
6586
|
+
/** true → send as ONE atomic Jito bundle (bridged legs / integration refreshes);
|
|
6587
|
+
* false → sequential sends are safe. */
|
|
6588
|
+
mustBeAtomicBundle: boolean;
|
|
6016
6589
|
}>;
|
|
6590
|
+
/**
|
|
6591
|
+
* Atomically move a selected set of positions from this account to a destination account with
|
|
6592
|
+
* auto-injected client data.
|
|
6593
|
+
*
|
|
6594
|
+
* Auto-injects: program, connection, marginfiAccount, bankMap, oraclePrices, bankMetadataMap,
|
|
6595
|
+
* assetShareValueMultiplierByBank, addressLookupTables, tokenProgramsByBank, groupRateLimiterEnabled.
|
|
6596
|
+
*/
|
|
6597
|
+
makeTransferPositionsTx(params: Omit<MakeTransferPositionsTxParams, "program" | "connection" | "marginfiAccount" | "bankMap" | "oraclePrices" | "bankMetadataMap" | "assetShareValueMultiplierByBank" | "addressLookupTableAccounts" | "tokenProgramsByBank" | "groupRateLimiterEnabled">): Promise<TransferPositionsResult>;
|
|
6017
6598
|
/**
|
|
6018
6599
|
* Creates a repay with collateral transaction with auto-injected client data.
|
|
6019
6600
|
*
|
|
@@ -6025,6 +6606,9 @@ declare class MarginfiAccountWrapper {
|
|
|
6025
6606
|
transactions: ExtendedV0Transaction[];
|
|
6026
6607
|
swapQuote: SwapQuoteResult | undefined;
|
|
6027
6608
|
amountToRepay: number;
|
|
6609
|
+
/** true → send as ONE atomic Jito bundle (bridged legs / integration refreshes);
|
|
6610
|
+
* false → sequential sends are safe. */
|
|
6611
|
+
mustBeAtomicBundle: boolean;
|
|
6028
6612
|
}>;
|
|
6029
6613
|
/**
|
|
6030
6614
|
* Creates a swap collateral transaction with auto-injected client data.
|
|
@@ -6040,6 +6624,9 @@ declare class MarginfiAccountWrapper {
|
|
|
6040
6624
|
transactions: ExtendedV0Transaction[];
|
|
6041
6625
|
actionTxIndex: number;
|
|
6042
6626
|
quoteResponse: SwapQuoteResult | undefined;
|
|
6627
|
+
/** true → send as ONE atomic Jito bundle (bridged legs / integration refreshes);
|
|
6628
|
+
* false → sequential sends are safe. */
|
|
6629
|
+
mustBeAtomicBundle: boolean;
|
|
6043
6630
|
}>;
|
|
6044
6631
|
/**
|
|
6045
6632
|
* Rolls a matured Exponent PT collateral position into its next-maturity PT, with
|
|
@@ -6069,7 +6656,56 @@ declare class MarginfiAccountWrapper {
|
|
|
6069
6656
|
transactions: ExtendedV0Transaction[];
|
|
6070
6657
|
actionTxIndex: number;
|
|
6071
6658
|
quoteResponse: SwapQuoteResult | undefined;
|
|
6659
|
+
/** true → send as ONE atomic Jito bundle (bridged legs / integration refreshes);
|
|
6660
|
+
* false → sequential sends are safe. */
|
|
6661
|
+
mustBeAtomicBundle: boolean;
|
|
6072
6662
|
}>;
|
|
6663
|
+
/**
|
|
6664
|
+
* Creates a loop (leverage) transaction with a transparent bridged (double-hop) fallback and
|
|
6665
|
+
* auto-injected client data.
|
|
6666
|
+
*
|
|
6667
|
+
* One call: tries the direct {@link makeLoopTx} first; if its borrow→deposit swap can't fit one
|
|
6668
|
+
* transaction or has no route, it loops the deposit asset against a value-equivalent borrow of a
|
|
6669
|
+
* bridge token (USDC/wSOL/USDT by default, override via `bridgeOpts.bridgeCandidateMints`) and
|
|
6670
|
+
* debt-swaps that bridge debt to the requested borrow asset — one atomic Jito bundle.
|
|
6671
|
+
* `result.bridgeMint` is set only when the bridged path was used.
|
|
6672
|
+
*
|
|
6673
|
+
* Auto-injects: program, marginfiAccount, bankMap, oraclePrices, bankMetadataMap,
|
|
6674
|
+
* addressLookupTables, assetShareValueMultiplierByBank
|
|
6675
|
+
*
|
|
6676
|
+
* @param params - Loop parameters (user provides: connection, depositOpts, borrowOpts, swapOpts, bridgeOpts?, etc.)
|
|
6677
|
+
*/
|
|
6678
|
+
makeBridgedLoopTx(params: Omit<MakeBridgedLoopTxParams, "program" | "marginfiAccount" | "bankMap" | "oraclePrices" | "bankMetadataMap" | "addressLookupTableAccounts" | "assetShareValueMultiplierByBank">): Promise<BridgedTxResult>;
|
|
6679
|
+
/**
|
|
6680
|
+
* Creates a collateral-swap transaction with a transparent bridged (double-hop) fallback and
|
|
6681
|
+
* auto-injected client data.
|
|
6682
|
+
*
|
|
6683
|
+
* One call: tries the direct {@link makeSwapCollateralTx} first; if the swap `A → C` can't fit
|
|
6684
|
+
* one transaction or has no route, it decomposes into `A → bridge` + `bridge → C` through a
|
|
6685
|
+
* bridge token, composed as one atomic Jito bundle. `result.bridgeMint` is set only when the
|
|
6686
|
+
* bridged path was used.
|
|
6687
|
+
*
|
|
6688
|
+
* Auto-injects: program, marginfiAccount, bankMap, oraclePrices, bankMetadataMap,
|
|
6689
|
+
* addressLookupTables, assetShareValueMultiplierByBank
|
|
6690
|
+
*
|
|
6691
|
+
* @param params - Swap collateral parameters (user provides: connection, withdrawOpts, depositOpts, swapOpts, bridgeOpts?, etc.)
|
|
6692
|
+
*/
|
|
6693
|
+
makeBridgedSwapCollateralTx(params: Omit<MakeBridgedSwapCollateralTxParams, "program" | "marginfiAccount" | "bankMap" | "oraclePrices" | "bankMetadataMap" | "addressLookupTableAccounts" | "assetShareValueMultiplierByBank">): Promise<BridgedTxResult>;
|
|
6694
|
+
/**
|
|
6695
|
+
* Creates a debt-swap transaction with a transparent bridged (double-hop) fallback and
|
|
6696
|
+
* auto-injected client data.
|
|
6697
|
+
*
|
|
6698
|
+
* One call: tries the direct {@link makeSwapDebtTx} first; if the swap `A → C` can't fit one
|
|
6699
|
+
* transaction or has no route, the first leg repays A by borrowing a bridge token and the second
|
|
6700
|
+
* leg repays exactly that bridge debt while borrowing C — one atomic Jito bundle.
|
|
6701
|
+
* `result.bridgeMint` is set only when the bridged path was used.
|
|
6702
|
+
*
|
|
6703
|
+
* Auto-injects: program, marginfiAccount, bankMap, oraclePrices, bankMetadataMap,
|
|
6704
|
+
* addressLookupTables, assetShareValueMultiplierByBank
|
|
6705
|
+
*
|
|
6706
|
+
* @param params - Swap debt parameters (user provides: connection, repayOpts, borrowOpts, swapOpts, bridgeOpts?, etc.)
|
|
6707
|
+
*/
|
|
6708
|
+
makeBridgedSwapDebtTx(params: Omit<MakeBridgedSwapDebtTxParams, "program" | "marginfiAccount" | "bankMap" | "oraclePrices" | "bankMetadataMap" | "addressLookupTableAccounts" | "assetShareValueMultiplierByBank">): Promise<BridgedTxResult>;
|
|
6073
6709
|
/**
|
|
6074
6710
|
* Creates a deposit transaction with auto-injected client data.
|
|
6075
6711
|
*
|
|
@@ -6274,4 +6910,4 @@ declare class MarginfiAccountWrapper {
|
|
|
6274
6910
|
getClient(): Project0Client;
|
|
6275
6911
|
}
|
|
6276
6912
|
|
|
6277
|
-
export { ADDRESS_LOOKUP_TABLE_FOR_GROUP, ADDRESS_LOOKUP_TABLE_FOR_GROUP_NATIVE_STAKE, ADDRESS_LOOKUP_TABLE_FOR_SWAP, type AccountActiveBalanceForBank, AccountFlags, ActionEmodeImpact, ActiveEmodePair, type ActiveStakePoolMap, Amount, AssetTag, BUNDLE_TX_SIZE, Balance, type BalanceRaw, BalanceType, type BalanceTypeDto, Bank, type BankConfigDto, BankConfigFlag, BankConfigOpt, BankConfigOptRaw, BankConfigRaw, type BankConfigRawDto, BankConfigType, BankIntegrationMetadata, BankIntegrationMetadataDto, BankIntegrationMetadataMap, BankIntegrationMetadataMapDto, type BankMetrics, type BankRateLimiterDto, BankRateLimiterRaw, type BankRateLimiterRawDto, BankRateLimiterType, BankRaw, type BankRawDto, BankType, type BankTypeDto, BankVaultType, type BridgeSide, type BridgedSwapLeg, type ComposeBridgedSwapParams, type ComposeBridgedSwapResult, type ComputeAssetHealthComponentParams, type ComputeBalanceUsdValueParams, type ComputeBankMetricsParams, type ComputeFreeCollateralFromBalancesParams, type ComputeHealthCacheStatusParams, type ComputeHealthComponentsFromBalancesParams, type ComputeLiabilityHealthComponentParams, type ComputeLiquidationPriceForBankParams, type ComputeMaxBorrowForBankParams, type ComputeMaxWithdrawForBankParams, type ComputeNetApyParams, ConfigRaw, type CrankCombination, type CrankabilityResult, DEFAULT_CROSSBAR_URL, DEFAULT_FALLBACK_CROSSBAR_URL, DEFAULT_ORACLE_MAX_AGE, DEFAULT_REPAY_ALL_EXTRA_BUFFER_BPS, DISABLED_FLAG, type DriftBankInput, type DriftMetadata, type DriftStateByBank, type DriftStateJsonByBank, EMPTY_HEALTH_CACHE, type EmodeConfigRawDto, type EmodeEntryDto, EmodeEntryFlags, EmodeFlags, EmodeImpactStatus, EmodePair, type EmodeSettingsDto, EmodeSettingsRaw, type EmodeSettingsRawDto, EmodeSettingsType, EmodeTag, Environment, type ExactOutEstimateResult, type ExtendedTransaction, type ExtendedTransactionProperties, type ExtendedV0Transaction, FLASHLOAN_ENABLED_FLAG, type FeeStateCache, type FetchBankIntegrationMetadataOptions, type FetchDriftMetadataOptions, type FetchJupLendMetadataOptions, type FetchKaminoMetadataOptions, type FlashloanActionResult, type FlashloanBudgetIx, type FlashloanPrecheckResult, type FlashloanSwapConstraints, type GetBalanceUsdValueWithPriceBiasParams, type GetExactOutEstimateParams, type GetSwapIxsForFlashloanParams, type GetTitanExactOutEstimateParams, type GetTitanSwapIxsParams, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, type HealthCacheRaw, HealthCacheSimulationError, HealthCacheStatus, HealthCacheType, type HealthCacheTypeDto, type InstructionsWrapper, type IntegrationType, InterestRateConfig, type InterestRateConfigDto, InterestRateConfigRaw, JUPITER_V6_PROGRAM, JUP_SWAP_LUT_PROGRAM_AUTHORITY_INDEX, type JupLendBankInput, type JupLendMetadata, type JupLendStateByBank, type JupLendStateJsonByBank, type KaminoBankInput, type KaminoMetadata, type KaminoStateByBank, type KaminoStateJsonByBank, LST_MINT, type LoopFlashloanDescriptor, MARGINFI_PROGRAM, MARGINFI_PROGRAM_STAGING, MARGINFI_PROGRAM_STAGING_ALT, MARGINFI_SPONSORED_SHARD_ID, MAX_ACCOUNT_LOCKS, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, type MakeAccountTransferToNewAccountTxParams, type MakeBorrowIxOpts, type MakeBorrowIxParams, type MakeBorrowTxParams, type MakeCloseAccountIxParams, type MakeCloseAccountTxParams, type MakeDepositIxOpts, type MakeDepositIxParams, type MakeDepositTxParams, type MakeDriftDepositIxParams, type MakeDriftDepositTxParams, type MakeDriftWithdrawIxParams, type MakeDriftWithdrawTxParams, type MakeFlashLoanTxParams, type MakeJuplendDepositIxParams, type MakeJuplendDepositTxParams, type MakeJuplendWithdrawIxParams, type MakeJuplendWithdrawTxParams, type MakeKaminoDepositIxParams, type MakeKaminoDepositTxParams, type MakeKaminoWithdrawIxParams, type MakeKaminoWithdrawTxParams, type MakeLoopTxParams, type MakeMergeStakeAccountsTxParams, type MakeMintStakedLstIxParams, type MakeMintStakedLstTxParams, type MakeRedeemStakedLstIxParams, type MakeRedeemStakedLstTxParams, type MakeRepayIxOpts, type MakeRepayIxParams, type MakeRepayTxParams, type MakeRepayWithCollatTxParams, type MakeRollPtTxParams, type MakeSetupIxParams, type MakeSwapCollateralTxParams, type MakeSwapDebtTxParams, type MakeVaultCompleteWithdrawalIxParams, type MakeVaultCompleteWithdrawalTxParams, type MakeVaultDepositIxParams, type MakeVaultDepositTxParams, type MakeVaultDepositWithSwapTxParams, type MakeVaultWithdrawIxParams, type MakeVaultWithdrawTxParams, type MakeWithdrawIxOpts, type MakeWithdrawIxParams, type MakeWithdrawTxParams, MarginRequirementType, type MarginRequirementTypeRaw, MarginfiAccount, type MarginfiAccountRaw, MarginfiAccountType, type MarginfiAccountTypeDto, MarginfiAccountWrapper, MarginfiGroup, type MarginfiGroupRaw, type MarginfiGroupType, type MarginfiGroupTypeDto, MarginfiIdlType, MarginfiProgram, type MintAuthorityBalance, MintData, OperationalState, OperationalStateRaw, OraclePrice, OraclePriceDto, OracleSetup, OracleSetupRaw, type OracleSourceKey, PDA_BANK_EMISSIONS_AUTH_SEED, PDA_BANK_EMISSIONS_VAULT_SEED, PDA_BANK_FEE_STATE_SEED, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PDA_MARGINFI_ACCOUNT_SEED, PRIORITY_TX_SIZE, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, PYTH_SPONSORED_SHARD_ID, type PanicStateCache, PriceBias, PriceWithConfidence, Project0Client, Project0Config, Project0ConfigRaw, type ProviderSwapRoute, type PythOracleServiceOpts, type RateLimitWindowDto, type RateLimitWindowRawDto, type RatePointDto, type ResolveBridgeBanksParams, RiskTier, RiskTierRaw, type RollPtOpts, SINGLE_POOL_PROGRAM_ID, STAKED_ORACLE_DISABLED_FLAG, STAKED_ORACLE_USES_ONRAMP_FLAG, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWAP_ADAPTERS, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, type SerializedInstruction, type SerializedLut, type SerializedSwapEngineRequest, type SerializedSwapEngineResult, type SerializedTxFootprint, type SimulateAccountHealthCacheWithFallbackParams, type SimulationResultRaw, type SmartCrankParams, type SmartCrankResult, type SolanaTransaction, type StakeAccount, type StakePoolMevMap, type StakedBankMetadata, type SwapAdapter, type SwapApiConfig, type SwapCandidate, type SwapEngineRequest, type SwapEngineResult, type SwapEngineRunner, type SwapIxsResult, type SwapOpts, SwapProvider, type SwapProviderConfig, type SwapProviderEntry, type SwapQuoteResult, type SwbOracleAiDataByKey, type SwbOracleServiceOpts, TRANSFER_ACCOUNT_AUTHORITY_FLAG, type TitanQuoteParams, TransactionArenaKeyMap, type TransactionBuilderResult, TransactionBuildingError, TransactionBuildingErrorCode, type TransactionBuildingErrorDetails, TransactionConfigMap, TransactionType, type TxFootprint, TypedAmount, USDC_DECIMALS, USDC_MINT, type ValidatorRateData, type ValidatorStakeGroup, type ValidatorStakeGroupDto, WSOL_MINT, type WithdrawWindowCache, WrappedI80F48, ZERO_ORACLE_KEY, accountConflictsWithBridge, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRateLimiterRawToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkJupiterFeeAccount, checkMultipleOraclesCrankability, checkTitanFeeAccount, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, compileFlashloanPrecheck, composeBridgedSwap, composeRemainingAccounts, computeAccountValue, computeActiveEmodePairs, computeAssetHealthComponent, computeBalanceUsdValue, computeBankBorrowApy, computeBankBorrowCapRemaining, computeBankDepositCapRemaining, computeBankMetrics, computeBankPoolSize, computeBankSupplyApy, computeBankTotalBorrows, computeBankTotalBorrowsUsd, computeBankTotalDeposits, computeBankTotalDepositsUsd, computeBaseInterestRate, computeBorrowEstimateForRepay, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFlashLoanNonSwapBudget, computeFlashloanSwapConstraints, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeInterestRates, computeLiabilityHealthComponent, computeLiquidationPriceForBank, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computeQuantity, computeQuantityUi, computeRemainingCapacity, computeSmartCrank, computeStakedBankMultipliers, computeTotalOutstandingEmissions, computeUtilizationRate, computeV0TxSize, convertVoteAccCoeffsToBankCoeffs, createActiveEmodePairFromPairs, createEmptyBalance, decodeAccountRaw, decodeBankRaw, decodeInstruction, decompileV0Transaction, deriveBankEmissionsAuth, deriveBankEmissionsVault, deriveBankFeeVault, deriveBankFeeVaultAuthority, deriveBankInsuranceVault, deriveBankInsuranceVaultAuthority, deriveBankLiquidityVault, deriveBankLiquidityVaultAuthority, deriveFeeState, deriveMarginfiAccount, deserializeInstruction, deserializeLut, deserializeSwapEngineRequest, deserializeSwapEngineResult, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankMetadata, dtoToBankMetadataMap, dtoToBankRateLimiter, dtoToBankRateLimiterRaw, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToMarginfiAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, fetchBank, fetchBankIntegrationMetadata, fetchGammaLpVault, fetchGammaWithdrawReceipt, fetchMarginfiAccountActiveBalancesForBank, fetchMarginfiAccountAddresses, fetchMarginfiAccountAddressesHoldingBank, fetchMarginfiAccountData, fetchMultipleBanks, fetchNativeStakeAccounts, fetchOracleData, fetchProgramForMints, fetchPythOracleData, fetchPythOraclePricesFromAPI, fetchPythOraclePricesFromChain, fetchStakeAccount, fetchStakePoolActiveStates, fetchStakePoolMev, fetchSwbOracleAccountsFromAPI, fetchSwbOracleAccountsFromChain, fetchSwbOracleData, fetchSwbOraclePricesFromAPI, fetchSwbOraclePricesFromCrossbar, findRandomAvailableAccountIndex, freezeBankConfigIx, generateDummyAccount, getAccountKeys, getActiveAccountFlags, getActiveBalances, getActiveEmodeEntryFlags, getActiveEmodeFlags, getActiveHealthCacheFlags, getAssetQuantity, getAssetShares, getBalance, getBalanceUsdValueWithPriceBias, getBankVaultAuthority, getBankVaultSeeds, getBirdeyeFallbackPricesByFeedId, getBirdeyePricesForMints, getConfig, getDriftCTokenMultiplier, getDriftMetadata, getDriftStatesDto, getEmodePairs, getExactOutEstimate, getFallbackPricesByFeedId, getFallbackPricesForMints, getHealthCacheStatusDescription, getHealthSimulationTransactions, getJupLendFTokenMultiplier, getJupLendMetadata, getJupLendStatesDto, getJupiterReferralFeeAccount, getJupiterSwapIxsForFlashloan, getKaminoCTokenMultiplier, getKaminoMetadata, getKaminoStatesDto, getLiabilityQuantity, getLiabilityShares, getOracleSourceFromBank, getOracleSourceFromOracleSetup, getOracleSourceNameFromKey, getPrice, getPriceWithConfidence, getStakedBankMetadataMap, getSwapAdapter, getSwapIxsForFlashloan, getTitanExactOutEstimate, getTitanSwapIxsForFlashloan, getTotalAccountKeys, getTotalAssetQuantity, getTotalLiabilityQuantity, getTxSize, getValidatorVoteAccountByBank, getWritableAccountKeys, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, isDecomposableSwapError, isDepositIx, isFlashloan, isGroupRateLimiterEnabled, isStandardBorrowable, isStandardDepositable, isV0Tx, isWholePosition, makeAccountTransferToNewAccountTx, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx, makeBorrowIx, makeBorrowTx, makeBundleTipIx, makeCloseMarginfiAccountIx, makeCloseMarginfiAccountTx, makeCrankSwbFeedIx, makeCreateAccountIxWithProjection, makeCreateAccountTxWithProjection, makeCreateMarginfiAccountIx, makeCreateMarginfiAccountTx, makeDepositIx, makeDepositTx, makeDriftDepositIx, makeDriftDepositTx, makeDriftWithdrawIx, makeDriftWithdrawTx, makeEndFlashLoanIx, makeFlashLoanTx, makeJuplendDepositIx, makeJuplendDepositTx, makeJuplendWithdrawIx, makeJuplendWithdrawTx, makeKaminoDepositIx, makeKaminoDepositTx, makeKaminoWithdrawIx, makeKaminoWithdrawTx, makeLoopTx, makeMergeStakeAccountsTx, makeMintStakedLstIx, makeMintStakedLstTx, makePoolAddBankIx, makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx, makeRedeemStakedLstIx, makeRedeemStakedLstTx, makeRefreshKaminoBanksIxs, makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeRollPtTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSwapCollateralTx, makeSwapDebtTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateJupLendRateIxs, makeUpdateSwbFeedIx, makeVaultCompleteWithdrawalIx, makeVaultCompleteWithdrawalTx, makeVaultDepositIx, makeVaultDepositTx, makeVaultDepositWithSwapTx, makeVaultWithdrawIx, makeVaultWithdrawTx, makeVersionedTransaction, makeWithdrawIx, makeWithdrawTx, makeWrapSolIxs, mapBrokenFeedsToOraclePrices, mapJupiterQuoteToSwapQuoteResult, mapPythBanksToOraclePrices, mapSwbBanksToOraclePrices, marginfiAccountToDto, mergeBridgeQuotes, mergeBridgeQuotesDebt, mergeBridgeQuotesLoop, nativeToUi, oraclePriceToDto, parseBalanceRaw, parseBankConfigRaw, parseBankRateLimiterRaw, parseBankRaw, parseEmodeSettingsRaw, parseEmodeTag, parseHealthCacheRaw, parseMarginfiAccountRaw, parseOperationalState, parseOracleSetup, parseOraclePriceData as parsePriceInfo, parseRiskTier, parseRpcPythPriceData, parseSwbOraclePriceData, partitionBanksByCrankability, patchDepositAmount, resolveBridgeBanks, resolveVaultTokenProgram, runSwapEngine, selectLutsForAccountAction, selectLutsForBanks, serializeBankConfigOpt, serializeInstruction, serializeInterestRateConfig, serializeLut, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, serializeSwapEngineRequest, serializeSwapEngineResult, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, swapEngineProvidersFromOpts, swapEngineQuoteFieldsFromOpts, toBankConfigDto, toBankDto, toBankRateLimiterDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toJupiterConfig, toNumber, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };
|
|
6913
|
+
export { ADDRESS_LOOKUP_TABLE_FOR_GROUP, ADDRESS_LOOKUP_TABLE_FOR_GROUP_NATIVE_STAKE, ADDRESS_LOOKUP_TABLE_FOR_SWAP, type AccountActiveBalanceForBank, AccountFlags, ActionEmodeImpact, ActiveEmodePair, type ActiveStakePoolMap, Amount, AssetTag, BUNDLE_TX_SIZE, Balance, type BalanceRaw, BalanceType, type BalanceTypeDto, Bank, type BankConfigDto, BankConfigFlag, BankConfigOpt, BankConfigOptRaw, BankConfigRaw, type BankConfigRawDto, BankConfigType, BankIntegrationMetadata, BankIntegrationMetadataDto, BankIntegrationMetadataMap, BankIntegrationMetadataMapDto, type BankMetrics, type BankRateLimiterDto, BankRateLimiterRaw, type BankRateLimiterRawDto, BankRateLimiterType, BankRaw, type BankRawDto, BankType, type BankTypeDto, BankVaultType, type BridgeOpts, type BridgeTokenSide, type BridgedSwapLeg, type BridgedTxResult, type BuildContext, type BulkLendTxsResult, type ClassifiedPosition, type ComposeBridgedSwapParams, type ComposeBridgedSwapResult, type ComputeAssetHealthComponentParams, type ComputeBalanceUsdValueParams, type ComputeBankMetricsParams, type ComputeFreeCollateralFromBalancesParams, type ComputeHealthCacheStatusParams, type ComputeHealthComponentsFromBalancesParams, type ComputeLiabilityHealthComponentParams, type ComputeLiquidationPriceForBankParams, type ComputeMaxBorrowForBankParams, type ComputeMaxWithdrawForBankParams, type ComputeNetApyParams, ConfigRaw, type CrankCombination, type CrankabilityResult, DEFAULT_BRIDGE_MINTS, DEFAULT_CROSSBAR_URL, DEFAULT_FALLBACK_CROSSBAR_URL, DEFAULT_ORACLE_MAX_AGE, DEFAULT_REPAY_ALL_EXTRA_BUFFER_BPS, DISABLED_FLAG, type DriftBankInput, type DriftMetadata, type DriftStateByBank, type DriftStateJsonByBank, EMPTY_HEALTH_CACHE, type EmodeConfigRawDto, type EmodeEntryDto, EmodeEntryFlags, EmodeFlags, EmodeImpactStatus, EmodePair, type EmodeSettingsDto, EmodeSettingsRaw, type EmodeSettingsRawDto, EmodeSettingsType, EmodeTag, Environment, type ExactOutEstimateResult, type ExtendedTransaction, type ExtendedTransactionProperties, type ExtendedV0Transaction, FLASHLOAN_ENABLED_FLAG, type FeeStateCache, type FetchBankIntegrationMetadataOptions, type FetchDriftMetadataOptions, type FetchJupLendMetadataOptions, type FetchKaminoMetadataOptions, type FlashloanActionResult, type FlashloanBudgetIx, type FlashloanPrecheckResult, type FlashloanSwapConstraints, type GetBalanceUsdValueWithPriceBiasParams, type GetExactOutEstimateParams, type GetSwapIxsForFlashloanParams, type GetTitanExactOutEstimateParams, type GetTitanSwapIxsParams, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, type HealthCacheRaw, HealthCacheSimulationError, HealthCacheStatus, HealthCacheType, type HealthCacheTypeDto, type InstructionsWrapper, type IntegrationType, InterestRateConfig, type InterestRateConfigDto, InterestRateConfigRaw, JUPITER_V6_PROGRAM, JUP_SWAP_LUT_PROGRAM_AUTHORITY_INDEX, type JupLendBankInput, type JupLendMetadata, type JupLendStateByBank, type JupLendStateJsonByBank, type KaminoBankInput, type KaminoMetadata, type KaminoStateByBank, type KaminoStateJsonByBank, LST_MINT, type LoopFlashloanDescriptor, MARGINFI_PROGRAM, MARGINFI_PROGRAM_STAGING, MARGINFI_PROGRAM_STAGING_ALT, MARGINFI_SPONSORED_SHARD_ID, MAX_ACCOUNT_LOCKS, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, type MakeAccountTransferToNewAccountTxParams, type MakeBorrowIxOpts, type MakeBorrowIxParams, type MakeBorrowTxParams, type MakeBridgedLoopTxParams, type MakeBridgedSwapCollateralTxParams, type MakeBridgedSwapDebtTxParams, type MakeBulkRepayTxParams, type MakeBulkWithdrawTxParams, type MakeCloseAccountIxParams, type MakeCloseAccountTxParams, type MakeDepositIxOpts, type MakeDepositIxParams, type MakeDepositTxParams, type MakeDriftDepositIxParams, type MakeDriftDepositTxParams, type MakeDriftWithdrawIxParams, type MakeDriftWithdrawTxParams, type MakeFlashLoanTxParams, type MakeJuplendDepositIxParams, type MakeJuplendDepositTxParams, type MakeJuplendWithdrawIxParams, type MakeJuplendWithdrawTxParams, type MakeKaminoDepositIxParams, type MakeKaminoDepositTxParams, type MakeKaminoWithdrawIxParams, type MakeKaminoWithdrawTxParams, type MakeLoopTxParams, type MakeMergeStakeAccountsTxParams, type MakeMintStakedLstIxParams, type MakeMintStakedLstTxParams, type MakeRedeemStakedLstIxParams, type MakeRedeemStakedLstTxParams, type MakeRepayIxOpts, type MakeRepayIxParams, type MakeRepayTxParams, type MakeRepayWithCollatTxParams, type MakeRollPtTxParams, type MakeSetupIxParams, type MakeSwapCollateralTxParams, type MakeSwapDebtTxParams, type MakeTransferPositionsTxParams, type MakeVaultCompleteWithdrawalIxParams, type MakeVaultCompleteWithdrawalTxParams, type MakeVaultDepositIxParams, type MakeVaultDepositTxParams, type MakeVaultDepositWithSwapTxParams, type MakeVaultWithdrawIxParams, type MakeVaultWithdrawTxParams, type MakeWithdrawIxOpts, type MakeWithdrawIxParams, type MakeWithdrawTxParams, MarginRequirementType, type MarginRequirementTypeRaw, MarginfiAccount, type MarginfiAccountRaw, MarginfiAccountType, type MarginfiAccountTypeDto, MarginfiAccountWrapper, MarginfiGroup, type MarginfiGroupRaw, type MarginfiGroupType, type MarginfiGroupTypeDto, MarginfiIdlType, MarginfiProgram, type MintAuthorityBalance, MintData, OperationalState, OperationalStateRaw, OraclePrice, OraclePriceDto, OracleSetup, OracleSetupRaw, type OracleSourceKey, PDA_BANK_EMISSIONS_AUTH_SEED, PDA_BANK_EMISSIONS_VAULT_SEED, PDA_BANK_FEE_STATE_SEED, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PDA_MARGINFI_ACCOUNT_SEED, PRIORITY_TX_SIZE, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, PYTH_SPONSORED_SHARD_ID, type PanicStateCache, PriceBias, PriceWithConfidence, Project0Client, Project0Config, Project0ConfigRaw, type ProviderSwapRoute, type PythOracleServiceOpts, type RateLimitWindowDto, type RateLimitWindowRawDto, type RatePointDto, type ResolveBridgeCandidateBanksParams, type ResolvedPinnedSwapRoute, RiskTier, RiskTierRaw, type RollPtOpts, SINGLE_POOL_PROGRAM_ID, STAKED_ORACLE_DISABLED_FLAG, STAKED_ORACLE_USES_ONRAMP_FLAG, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWAP_ADAPTERS, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, type SerializedInstruction, type SerializedLut, type SerializedSwapEngineRequest, type SerializedSwapEngineResult, type SerializedTxFootprint, type SharedBridgeLegContext, type SimulateAccountHealthCacheWithFallbackParams, type SimulationResultRaw, type SmartCrankParams, type SmartCrankResult, type SolanaTransaction, type StakeAccount, type StakePoolMevMap, type StakedBankMetadata, type SwapAdapter, type SwapApiConfig, type SwapCandidate, type SwapEngineRequest, type SwapEngineResult, type SwapEngineRunner, type SwapIxsResult, type SwapOpts, SwapProvider, type SwapProviderConfig, type SwapProviderEntry, type SwapQuoteResult, type SwbOracleAiDataByKey, type SwbOracleServiceOpts, TRANSFER_ACCOUNT_AUTHORITY_FLAG, type TitanQuoteParams, TransactionArenaKeyMap, type TransactionBuilderResult, TransactionBuildingError, TransactionBuildingErrorCode, type TransactionBuildingErrorDetails, TransactionConfigMap, TransactionType, type TransferPositionSide, type TransferPositionsResult, type TxFootprint, TypedAmount, USDC_DECIMALS, USDC_MINT, USDT_MINT, type ValidatorRateData, type ValidatorStakeGroup, type ValidatorStakeGroupDto, WSOL_MINT, type WithdrawWindowCache, WrappedI80F48, ZERO_ORACLE_KEY, accountConflictsWithBridgeBank, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRateLimiterRawToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, buildCollateralLegIxs, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkJupiterFeeAccount, checkMultipleOraclesCrankability, checkTitanFeeAccount, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, classifyAndValidate, compileFlashloanPrecheck, composeBridgedSwap, composeRemainingAccounts, computeAccountValue, computeActiveEmodePairs, computeAssetHealthComponent, computeBalanceUsdValue, computeBankBorrowApy, computeBankBorrowCapRemaining, computeBankDepositCapRemaining, computeBankMetrics, computeBankPoolSize, computeBankSupplyApy, computeBankTotalBorrows, computeBankTotalBorrowsUsd, computeBankTotalDeposits, computeBankTotalDepositsUsd, computeBaseInterestRate, computeBorrowEstimateForRepay, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFlashLoanNonSwapBudget, computeFlashloanSwapConstraints, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeInterestRates, computeLiabilityHealthComponent, computeLiquidationPriceForBank, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computeQuantity, computeQuantityUi, computeRemainingCapacity, computeSmartCrank, computeStakedBankMultipliers, computeTotalOutstandingEmissions, computeUtilizationRate, computeV0TxSize, convertVoteAccCoeffsToBankCoeffs, createActiveEmodePairFromPairs, createEmptyBalance, decodeAccountRaw, decodeBankRaw, decodeInstruction, decompileV0Transaction, deriveBankEmissionsAuth, deriveBankEmissionsVault, deriveBankFeeVault, deriveBankFeeVaultAuthority, deriveBankInsuranceVault, deriveBankInsuranceVaultAuthority, deriveBankLiquidityVault, deriveBankLiquidityVaultAuthority, deriveFeeState, deriveMarginfiAccount, deserializeInstruction, deserializeLut, deserializeSwapEngineRequest, deserializeSwapEngineResult, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankMetadata, dtoToBankMetadataMap, dtoToBankRateLimiter, dtoToBankRateLimiterRaw, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToMarginfiAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, fetchBank, fetchBankIntegrationMetadata, fetchGammaLpVault, fetchGammaWithdrawReceipt, fetchMarginfiAccountActiveBalancesForBank, fetchMarginfiAccountAddresses, fetchMarginfiAccountAddressesHoldingBank, fetchMarginfiAccountData, fetchMultipleBanks, fetchNativeStakeAccounts, fetchOracleData, fetchProgramForMints, fetchPythOracleData, fetchPythOraclePricesFromAPI, fetchPythOraclePricesFromChain, fetchStakeAccount, fetchStakePoolActiveStates, fetchStakePoolMev, fetchSwbOracleAccountsFromAPI, fetchSwbOracleAccountsFromChain, fetchSwbOracleData, fetchSwbOraclePricesFromAPI, fetchSwbOraclePricesFromCrossbar, findRandomAvailableAccountIndex, freezeBankConfigIx, generateDummyAccount, getAccountKeys, getActiveAccountFlags, getActiveBalances, getActiveEmodeEntryFlags, getActiveEmodeFlags, getActiveHealthCacheFlags, getAssetQuantity, getAssetShares, getBalance, getBalanceUsdValueWithPriceBias, getBankVaultAuthority, getBankVaultSeeds, getBirdeyeFallbackPricesByFeedId, getBirdeyePricesForMints, getConfig, getDriftCTokenMultiplier, getDriftMetadata, getDriftStatesDto, getEmodePairs, getExactOutEstimate, getFallbackPricesByFeedId, getFallbackPricesForMints, getHealthCacheStatusDescription, getHealthSimulationTransactions, getJupLendFTokenMultiplier, getJupLendMetadata, getJupLendStatesDto, getJupiterReferralFeeAccount, getJupiterSwapIxsForFlashloan, getKaminoCTokenMultiplier, getKaminoMetadata, getKaminoStatesDto, getLiabilityQuantity, getLiabilityShares, getOracleSourceFromBank, getOracleSourceFromOracleSetup, getOracleSourceNameFromKey, getPrice, getPriceWithConfidence, getStakedBankMetadataMap, getSwapAdapter, getSwapIxsForFlashloan, getTitanExactOutEstimate, getTitanSwapIxsForFlashloan, getTotalAccountKeys, getTotalAssetQuantity, getTotalLiabilityQuantity, getTxSize, getValidatorVoteAccountByBank, getWritableAccountKeys, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, isBridgeConflictError, isDecomposableSwapError, isDepositIx, isFlashloan, isGroupRateLimiterEnabled, isStandardBorrowable, isStandardDepositable, isV0Tx, isWholePosition, makeAccountTransferToNewAccountTx, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx, makeBorrowIx, makeBorrowTx, makeBridgedLoopTx, makeBridgedSwapCollateralTx, makeBridgedSwapDebtTx, makeBulkRepayTx, makeBulkWithdrawTx, makeBundleTipIx, makeCloseMarginfiAccountIx, makeCloseMarginfiAccountTx, makeCrankSwbFeedIx, makeCreateAccountIxWithProjection, makeCreateAccountTxWithProjection, makeCreateMarginfiAccountIx, makeCreateMarginfiAccountTx, makeDepositIx, makeDepositTx, makeDriftDepositIx, makeDriftDepositTx, makeDriftWithdrawIx, makeDriftWithdrawTx, makeEndFlashLoanIx, makeFlashLoanTx, makeJuplendDepositIx, makeJuplendDepositTx, makeJuplendWithdrawIx, makeJuplendWithdrawTx, makeKaminoDepositIx, makeKaminoDepositTx, makeKaminoWithdrawIx, makeKaminoWithdrawTx, makeLoopTx, makeMergeStakeAccountsTx, makeMintStakedLstIx, makeMintStakedLstTx, makePoolAddBankIx, makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx, makeRedeemStakedLstIx, makeRedeemStakedLstTx, makeRefreshIntegrationBanksIxs, makeRefreshKaminoBanksIxs, makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeRollPtTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSmartCrankSwbFeedIxForAccounts, makeSwapCollateralTx, makeSwapDebtTx, makeTransferPositionsTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateJupLendRateIxs, makeUpdateSwbFeedIx, makeVaultCompleteWithdrawalIx, makeVaultCompleteWithdrawalTx, makeVaultDepositIx, makeVaultDepositTx, makeVaultDepositWithSwapTx, makeVaultWithdrawIx, makeVaultWithdrawTx, makeVersionedTransaction, makeWithdrawIx, makeWithdrawTx, makeWrapSolIxs, mapBrokenFeedsToOraclePrices, mapJupiterQuoteToSwapQuoteResult, mapPythBanksToOraclePrices, mapSwbBanksToOraclePrices, marginfiAccountToDto, mergeBridgeQuotes, mergeBridgeQuotesDebt, mergeBridgeQuotesLoop, nativeToUi, oraclePriceToDto, parseBalanceRaw, parseBankConfigRaw, parseBankRateLimiterRaw, parseBankRaw, parseEmodeSettingsRaw, parseEmodeTag, parseHealthCacheRaw, parseMarginfiAccountRaw, parseOperationalState, parseOracleSetup, parseOraclePriceData as parsePriceInfo, parseRiskTier, parseRpcPythPriceData, parseSwbOraclePriceData, partitionBanksByCrankability, patchDepositAmount, requireBank, requireTokenProgram, resolveBridgeCandidateBanks, resolvePinnedSwapRoute, resolveTokenProgramForMint, resolveVaultTokenProgram, runSwapEngine, selectLutsForAccountAction, selectLutsForBanks, selectSwapBridges, serializeBankConfigOpt, serializeInstruction, serializeInterestRateConfig, serializeLut, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, serializeSwapEngineRequest, serializeSwapEngineResult, sharedBridgeLegContext, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, swapEngineProvidersFromOpts, swapEngineQuoteFieldsFromOpts, toBankConfigDto, toBankDto, toBankRateLimiterDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toJupiterConfig, toNumber, tryBridgeCandidates, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };
|