@0dotxyz/p0-ts-sdk 2.2.1 → 2.2.2

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.
@@ -0,0 +1,371 @@
1
+ import * as _solana_web3_js from '@solana/web3.js';
2
+ import { PublicKey, AccountMeta } from '@solana/web3.js';
3
+ import BN from 'bn.js';
4
+ import { M as MarginfiProgram, _ as BankConfigCompactRaw, k as BankConfigOptRaw } from './types-ZvnTjjh4.cjs';
5
+ import '@coral-xyz/anchor';
6
+ import 'bignumber.js';
7
+ import './dto-rate-model.types-AQ40wS-P.cjs';
8
+
9
+ declare function makeInitMarginfiAccountIx(mfProgram: MarginfiProgram, accounts: {
10
+ marginfiGroup: PublicKey;
11
+ marginfiAccount: PublicKey;
12
+ authority: PublicKey;
13
+ feePayer: PublicKey;
14
+ }): Promise<_solana_web3_js.TransactionInstruction>;
15
+ declare function makeInitMarginfiAccountPdaIx(mfProgram: MarginfiProgram, accounts: {
16
+ marginfiGroup: PublicKey;
17
+ marginfiAccount: PublicKey;
18
+ authority: PublicKey;
19
+ feePayer: PublicKey;
20
+ }, args: {
21
+ accountIndex: number;
22
+ thirdPartyId?: number;
23
+ }): Promise<_solana_web3_js.TransactionInstruction>;
24
+ declare function makeJuplendDepositIx(mfProgram: MarginfiProgram, accounts: {
25
+ marginfiAccount: PublicKey;
26
+ bank: PublicKey;
27
+ signerTokenAccount: PublicKey;
28
+ lendingAdmin: PublicKey;
29
+ supplyTokenReservesLiquidity: PublicKey;
30
+ lendingSupplyPositionOnLiquidity: PublicKey;
31
+ rateModel: PublicKey;
32
+ vault: PublicKey;
33
+ liquidity: PublicKey;
34
+ liquidityProgram: PublicKey;
35
+ rewardsRateModel: PublicKey;
36
+ tokenProgram: PublicKey;
37
+ group?: PublicKey;
38
+ authority?: PublicKey;
39
+ liquidityVault?: PublicKey;
40
+ fTokenMint?: PublicKey;
41
+ integrationAcc1?: PublicKey;
42
+ integrationAcc2?: PublicKey;
43
+ mint?: PublicKey;
44
+ }, args: {
45
+ amount: BN;
46
+ }, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
47
+ declare function makeJuplendWithdrawIx(mfProgram: MarginfiProgram, accounts: {
48
+ marginfiAccount: PublicKey;
49
+ bank: PublicKey;
50
+ destinationTokenAccount: PublicKey;
51
+ lendingAdmin: PublicKey;
52
+ supplyTokenReservesLiquidity: PublicKey;
53
+ lendingSupplyPositionOnLiquidity: PublicKey;
54
+ rateModel: PublicKey;
55
+ vault: PublicKey;
56
+ claimAccount: PublicKey;
57
+ liquidity: PublicKey;
58
+ liquidityProgram: PublicKey;
59
+ rewardsRateModel: PublicKey;
60
+ tokenProgram: PublicKey;
61
+ group?: PublicKey;
62
+ authority?: PublicKey;
63
+ mint?: PublicKey;
64
+ integrationAcc1?: PublicKey;
65
+ fTokenMint?: PublicKey;
66
+ integrationAcc2?: PublicKey;
67
+ integrationAcc3?: PublicKey;
68
+ }, args: {
69
+ amount: BN;
70
+ withdrawAll?: boolean | null;
71
+ }, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
72
+ declare function makeKaminoDepositIx(mfProgram: MarginfiProgram, accounts: {
73
+ marginfiAccount: PublicKey;
74
+ bank: PublicKey;
75
+ signerTokenAccount: PublicKey;
76
+ lendingMarket: PublicKey;
77
+ lendingMarketAuthority: PublicKey;
78
+ reserveLiquiditySupply: PublicKey;
79
+ reserveCollateralMint: PublicKey;
80
+ reserveDestinationDepositCollateral: PublicKey;
81
+ liquidityTokenProgram: PublicKey;
82
+ obligationFarmUserState: PublicKey | null;
83
+ reserveFarmState: PublicKey | null;
84
+ group?: PublicKey;
85
+ authority?: PublicKey;
86
+ liquidityVault?: PublicKey;
87
+ integrationAcc1?: PublicKey;
88
+ integrationAcc2?: PublicKey;
89
+ mint?: PublicKey;
90
+ }, args: {
91
+ amount: BN;
92
+ }, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
93
+ /**
94
+ * Create a Drift deposit instruction
95
+ * Deposits tokens into a Drift spot market through a marginfi bank account
96
+ *
97
+ * @param mfProgram - The marginfi program instance
98
+ * @param accounts - Required and optional accounts for the instruction
99
+ * @param accounts.marginfiAccount - The marginfi account depositing funds
100
+ * @param accounts.bank - The marginfi bank account for the asset
101
+ * @param accounts.signerTokenAccount - The signer's token account (source of funds)
102
+ * @param accounts.driftState - The Drift program state account
103
+ * @param accounts.driftSpotMarketVault - The Drift spot market vault receiving tokens
104
+ * @param accounts.tokenProgram - The SPL token program
105
+ * @param accounts.driftOracle - (Optional) Oracle account for the asset
106
+ * @param args - Instruction arguments
107
+ * @param args.amount - Amount to deposit in native token decimals
108
+ */
109
+ declare function makeDriftDepositIx(mfProgram: MarginfiProgram, accounts: {
110
+ marginfiAccount: PublicKey;
111
+ bank: PublicKey;
112
+ signerTokenAccount: PublicKey;
113
+ driftState: PublicKey;
114
+ driftSpotMarketVault: PublicKey;
115
+ tokenProgram: PublicKey;
116
+ driftOracle: PublicKey | null;
117
+ group?: PublicKey;
118
+ authority?: PublicKey;
119
+ liquidityVault?: PublicKey;
120
+ integrationAcc2?: PublicKey;
121
+ integrationAcc3?: PublicKey;
122
+ integrationAcc1?: PublicKey;
123
+ mint?: PublicKey;
124
+ driftProgram?: PublicKey;
125
+ systemProgram?: PublicKey;
126
+ }, args: {
127
+ amount: BN;
128
+ }): Promise<_solana_web3_js.TransactionInstruction>;
129
+ declare function makeDepositIx(mfProgram: MarginfiProgram, accounts: {
130
+ marginfiAccount: PublicKey;
131
+ signerTokenAccount: PublicKey;
132
+ bank: PublicKey;
133
+ tokenProgram: PublicKey;
134
+ group?: PublicKey;
135
+ authority?: PublicKey;
136
+ liquidityVault?: PublicKey;
137
+ }, args: {
138
+ amount: BN;
139
+ depositUpToLimit?: boolean;
140
+ }, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
141
+ declare function makeRepayIx(mfProgram: MarginfiProgram, accounts: {
142
+ marginfiAccount: PublicKey;
143
+ signerTokenAccount: PublicKey;
144
+ bank: PublicKey;
145
+ tokenProgram: PublicKey;
146
+ group?: PublicKey;
147
+ authority?: PublicKey;
148
+ liquidityVault?: PublicKey;
149
+ }, args: {
150
+ amount: BN;
151
+ repayAll?: boolean;
152
+ }, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
153
+ declare function makeDriftWithdrawIx(mfProgram: MarginfiProgram, accounts: {
154
+ marginfiAccount: PublicKey;
155
+ bank: PublicKey;
156
+ destinationTokenAccount: PublicKey;
157
+ driftState: PublicKey;
158
+ driftSigner: PublicKey;
159
+ driftSpotMarketVault: PublicKey;
160
+ tokenProgram: PublicKey;
161
+ driftOracle: PublicKey | null;
162
+ driftRewardOracle: PublicKey | null;
163
+ driftRewardSpotMarket: PublicKey | null;
164
+ driftRewardMint: PublicKey | null;
165
+ driftRewardOracle2: PublicKey | null;
166
+ driftRewardSpotMarket2: PublicKey | null;
167
+ driftRewardMint2: PublicKey | null;
168
+ group?: PublicKey;
169
+ authority?: PublicKey;
170
+ }, args: {
171
+ amount: BN;
172
+ withdrawAll: boolean;
173
+ }, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
174
+ declare function makeKaminoWithdrawIx(mfProgram: MarginfiProgram, accounts: {
175
+ marginfiAccount: PublicKey;
176
+ bank: PublicKey;
177
+ destinationTokenAccount: PublicKey;
178
+ lendingMarket: PublicKey;
179
+ mint: PublicKey;
180
+ lendingMarketAuthority: PublicKey;
181
+ reserveLiquiditySupply: PublicKey;
182
+ reserveCollateralMint: PublicKey;
183
+ reserveSourceCollateral: PublicKey;
184
+ liquidityTokenProgram: PublicKey;
185
+ obligationFarmUserState: PublicKey | null;
186
+ reserveFarmState: PublicKey | null;
187
+ group?: PublicKey;
188
+ authority?: PublicKey;
189
+ }, args: {
190
+ amount: BN;
191
+ isFinalWithdrawal: boolean;
192
+ }, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
193
+ declare function makeWithdrawIx(mfProgram: MarginfiProgram, accounts: {
194
+ marginfiAccount: PublicKey;
195
+ bank: PublicKey;
196
+ destinationTokenAccount: PublicKey;
197
+ tokenProgram: PublicKey;
198
+ group?: PublicKey;
199
+ authority?: PublicKey;
200
+ }, args: {
201
+ amount: BN;
202
+ withdrawAll?: boolean;
203
+ }, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
204
+ declare function makeBorrowIx(mfProgram: MarginfiProgram, accounts: {
205
+ marginfiAccount: PublicKey;
206
+ bank: PublicKey;
207
+ destinationTokenAccount: PublicKey;
208
+ tokenProgram: PublicKey;
209
+ group?: PublicKey;
210
+ authority?: PublicKey;
211
+ }, args: {
212
+ amount: BN;
213
+ }, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
214
+ declare function makeLendingAccountLiquidateIx(mfiProgram: MarginfiProgram, accounts: {
215
+ assetBank: PublicKey;
216
+ liabBank: PublicKey;
217
+ liquidatorMarginfiAccount: PublicKey;
218
+ liquidateeMarginfiAccount: PublicKey;
219
+ tokenProgram: PublicKey;
220
+ group?: PublicKey;
221
+ authority?: PublicKey;
222
+ }, args: {
223
+ assetAmount: BN;
224
+ liquidateeAccounts: number;
225
+ liquidatorAccounts: number;
226
+ }, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
227
+ declare function makeLendingAccountClearEmissionsIx(mfiProgram: MarginfiProgram, accounts: {
228
+ marginfiAccount: PublicKey;
229
+ bank: PublicKey;
230
+ }): Promise<_solana_web3_js.TransactionInstruction>;
231
+ declare function makePoolConfigureBankIx(mfiProgram: MarginfiProgram, accounts: {
232
+ bank: PublicKey;
233
+ group?: PublicKey;
234
+ admin?: PublicKey;
235
+ }, args: {
236
+ bankConfigOpt: BankConfigOptRaw;
237
+ }): Promise<_solana_web3_js.TransactionInstruction>;
238
+ declare function makeBeginFlashLoanIx(mfiProgram: MarginfiProgram, accounts: {
239
+ marginfiAccount: PublicKey;
240
+ authority?: PublicKey;
241
+ ixsSysvar?: PublicKey;
242
+ }, args: {
243
+ endIndex: BN;
244
+ }): Promise<_solana_web3_js.TransactionInstruction>;
245
+ declare function makeEndFlashLoanIx(mfiProgram: MarginfiProgram, accounts: {
246
+ marginfiAccount: PublicKey;
247
+ authority?: PublicKey;
248
+ }, remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
249
+ declare function makeAccountTransferToNewAccountIx(mfProgram: MarginfiProgram, accounts: {
250
+ oldMarginfiAccount: PublicKey;
251
+ newMarginfiAccount: PublicKey;
252
+ newAuthority: PublicKey;
253
+ feePayer: PublicKey;
254
+ group?: PublicKey;
255
+ authority?: PublicKey;
256
+ }): Promise<_solana_web3_js.TransactionInstruction>;
257
+ declare function makeGroupInitIx(mfProgram: MarginfiProgram, accounts: {
258
+ marginfiGroup: PublicKey;
259
+ admin: PublicKey;
260
+ }): Promise<_solana_web3_js.TransactionInstruction>;
261
+ /**
262
+ * Configure the oracle for a bank
263
+ * @param mfProgram The marginfi program
264
+ * @param accounts The accounts required for this instruction
265
+ * @param args The oracle setup index and feed id
266
+ * @param remainingAccounts The remaining accounts required for this instruction, should include the feed oracle key
267
+ */
268
+ declare function makeLendingPoolConfigureBankOracleIx(mfProgram: MarginfiProgram, accounts: {
269
+ bank: PublicKey;
270
+ group?: PublicKey;
271
+ admin?: PublicKey;
272
+ }, args: {
273
+ /**
274
+ * The oracle setup index, see {@link serializeOracleSetupToIndex}
275
+ */
276
+ setup: number;
277
+ /**
278
+ * The oracle feed id
279
+ */
280
+ feedId: PublicKey;
281
+ },
282
+ /**
283
+ * The remaining accounts required for this instruction, should include the feed oracle key (non writable & signable)
284
+ */
285
+ remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
286
+ /**
287
+ * Creates an instruction to add a permissionless staked bank to a lending pool.
288
+ * @param mfProgram - The marginfi program instance
289
+ * @param accounts - The accounts required for this instruction
290
+ * @param remainingAccounts - The remaining accounts required for this instruction, including pythOracle, solPool and bankMint
291
+ * @param args - Optional arguments for this instruction
292
+ */
293
+ declare function makePoolAddPermissionlessStakedBankIx(mfProgram: MarginfiProgram, accounts: {
294
+ stakedSettings: PublicKey;
295
+ feePayer: PublicKey;
296
+ bankMint: PublicKey;
297
+ solPool: PublicKey;
298
+ stakePool: PublicKey;
299
+ marginfiGroup?: PublicKey;
300
+ /**
301
+ * The token program to use for this instruction, defaults to the SPL token program
302
+ */
303
+ tokenProgram?: PublicKey;
304
+ },
305
+ /**
306
+ * The remaining accounts required for this instruction. Should include:
307
+ * - pythOracle: The pyth oracle key (non writable & non signer)
308
+ * - solPool: The sol pool key (non writable & non signer)
309
+ * - bankMint: The bank mint key (non writable & non signer)
310
+ */
311
+ remainingAccounts: AccountMeta[] | undefined, args: {
312
+ /**
313
+ * The seed to use for the bank account. Defaults to 0 (new BN(0)).
314
+ * If the seed is not specified, the seed is set to 0, and the bank account
315
+ * will be created at the address {@link findPoolAddress} with the default
316
+ * bump.
317
+ */
318
+ seed?: BN;
319
+ }): Promise<_solana_web3_js.TransactionInstruction>;
320
+ declare function makePoolAddBankIx(mfProgram: MarginfiProgram, accounts: {
321
+ marginfiGroup: PublicKey;
322
+ feePayer: PublicKey;
323
+ bankMint: PublicKey;
324
+ bank: PublicKey;
325
+ tokenProgram: PublicKey;
326
+ admin?: PublicKey;
327
+ globalFeeWallet?: PublicKey;
328
+ }, args: {
329
+ bankConfig: BankConfigCompactRaw;
330
+ }): Promise<_solana_web3_js.TransactionInstruction>;
331
+ declare function makeCloseAccountIx(mfProgram: MarginfiProgram, accounts: {
332
+ marginfiAccount: PublicKey;
333
+ feePayer: PublicKey;
334
+ authority?: PublicKey;
335
+ }): Promise<_solana_web3_js.TransactionInstruction>;
336
+ declare function makePulseHealthIx(mfProgram: MarginfiProgram, accounts: {
337
+ marginfiAccount: PublicKey;
338
+ },
339
+ /**
340
+ * The remaining accounts required for this instruction. Should include:
341
+ * - For each balance the user has, pass bank and oracle: <bank1, oracle1, bank2, oracle2>
342
+ */
343
+ remainingAccounts?: AccountMeta[]): Promise<_solana_web3_js.TransactionInstruction>;
344
+ declare const instructions: {
345
+ makeDepositIx: typeof makeDepositIx;
346
+ makeJuplendDepositIx: typeof makeJuplendDepositIx;
347
+ makeDriftDepositIx: typeof makeDriftDepositIx;
348
+ makeKaminoDepositIx: typeof makeKaminoDepositIx;
349
+ makeRepayIx: typeof makeRepayIx;
350
+ makeWithdrawIx: typeof makeWithdrawIx;
351
+ makeJuplendWithdrawIx: typeof makeJuplendWithdrawIx;
352
+ makeDriftWithdrawIx: typeof makeDriftWithdrawIx;
353
+ makeKaminoWithdrawIx: typeof makeKaminoWithdrawIx;
354
+ makeBorrowIx: typeof makeBorrowIx;
355
+ makeInitMarginfiAccountIx: typeof makeInitMarginfiAccountIx;
356
+ makeInitMarginfiAccountPdaIx: typeof makeInitMarginfiAccountPdaIx;
357
+ makeLendingAccountLiquidateIx: typeof makeLendingAccountLiquidateIx;
358
+ makeLendingAccountClearEmissionsIx: typeof makeLendingAccountClearEmissionsIx;
359
+ makePoolAddBankIx: typeof makePoolAddBankIx;
360
+ makePoolConfigureBankIx: typeof makePoolConfigureBankIx;
361
+ makeBeginFlashLoanIx: typeof makeBeginFlashLoanIx;
362
+ makeEndFlashLoanIx: typeof makeEndFlashLoanIx;
363
+ makeAccountTransferToNewAccountIx: typeof makeAccountTransferToNewAccountIx;
364
+ makeGroupInitIx: typeof makeGroupInitIx;
365
+ makeCloseAccountIx: typeof makeCloseAccountIx;
366
+ makePoolAddPermissionlessStakedBankIx: typeof makePoolAddPermissionlessStakedBankIx;
367
+ makeLendingPoolConfigureBankOracleIx: typeof makeLendingPoolConfigureBankOracleIx;
368
+ makePulseHealthIx: typeof makePulseHealthIx;
369
+ };
370
+
371
+ export { instructions as default };