@jup-ag/lend 0.2.0-beta.2 → 0.2.0-beta.3
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/borrow/index.d.mts +91 -24
- package/dist/borrow/index.d.ts +91 -24
- package/dist/borrow/index.mjs +5 -4
- package/dist/dex/index.mjs +1 -1
- package/dist/earn/index.d.mts +23 -14
- package/dist/earn/index.d.ts +23 -14
- package/dist/earn/index.mjs +48 -2215
- package/dist/flashloan/index.d.mts +0 -1
- package/dist/flashloan/index.d.ts +0 -1
- package/dist/flashloan/index.mjs +6 -111
- package/dist/index.mjs +1 -1
- package/dist/refinance/index.d.mts +1 -2
- package/dist/refinance/index.d.ts +1 -2
- package/dist/refinance/index.mjs +3 -2
- package/dist/shared/lend.B80NmXTG.mjs +2184 -0
- package/dist/shared/{lend.siYu8A-9.mjs → lend.CS-bkwRq.mjs} +30 -8
- package/dist/shared/{lend.DcHJFKzT.mjs → lend.CVtn-ehf.mjs} +235 -449
- package/dist/shared/{lend.BT41yQVJ.d.mts → lend.CdoFqRFx.d.mts} +168 -474
- package/dist/shared/{lend.BT41yQVJ.d.ts → lend.CdoFqRFx.d.ts} +168 -474
- package/package.json +1 -1
package/dist/borrow/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as Vaults, L as LiquidateParams } from '../shared/lend.
|
|
2
|
-
export { C as ConnectionParams, I as InitPositionIxParams, a as LiquidateContextParams, O as OperateContextParams, b as OperateParams, g as getInitPositionContext, c as getInitPositionIx, d as getLiquidateContext, e as getLiquidateIx, f as getOperateContext, h as getOperateIx } from '../shared/lend.
|
|
1
|
+
import { V as Vaults, L as LiquidateParams } from '../shared/lend.CdoFqRFx.mjs';
|
|
2
|
+
export { C as ConnectionParams, I as InitPositionIxParams, a as LiquidateContextParams, O as OperateContextParams, b as OperateParams, g as getInitPositionContext, c as getInitPositionIx, d as getLiquidateContext, e as getLiquidateIx, f as getOperateContext, h as getOperateIx } from '../shared/lend.CdoFqRFx.mjs';
|
|
3
3
|
import { Program } from '@coral-xyz/anchor';
|
|
4
4
|
import BN__default from 'bn.js';
|
|
5
5
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
@@ -18,6 +18,12 @@ type GetCurrentPositionStateParams = {
|
|
|
18
18
|
position: PositionData;
|
|
19
19
|
program: Program<Vaults>;
|
|
20
20
|
market: "main" | "ethena";
|
|
21
|
+
/**
|
|
22
|
+
* Borrow-token mint decimals (from vaultMetadata.borrowMintDecimals). Only used
|
|
23
|
+
* on the post-liquidation path to compute the dust-absorb threshold. When omitted
|
|
24
|
+
* it is fetched lazily; pass it to avoid an extra RPC when already available.
|
|
25
|
+
*/
|
|
26
|
+
borrowMintDecimals?: number;
|
|
21
27
|
};
|
|
22
28
|
declare const getVaultsProgram: ({ connection, signer, market, }: {
|
|
23
29
|
connection: Connection;
|
|
@@ -30,6 +36,28 @@ declare const MIN_I128: BN__default;
|
|
|
30
36
|
declare const MAX_REPAY_AMOUNT: BN__default;
|
|
31
37
|
/** Use as `colAmount` in getOperateIx to withdraw all collateral (subject to LTV). */
|
|
32
38
|
declare const MAX_WITHDRAW_AMOUNT: BN__default;
|
|
39
|
+
declare function getMinimumDebt(decimals: number): BN__default;
|
|
40
|
+
type LiquidatedDustReconciliation = {
|
|
41
|
+
tick: number;
|
|
42
|
+
colRaw: BN__default;
|
|
43
|
+
debtRaw: BN__default;
|
|
44
|
+
dustDebtRaw: BN__default;
|
|
45
|
+
/** True when the program would absorb & wipe the position to a supply-only COLD position. */
|
|
46
|
+
isWiped: boolean;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* - case 1: finalDebtRaw < dustDebtRaw -> absorb & wipe
|
|
50
|
+
* - case 2: finalDebtRaw < LIQUIDATED_POSITION_DEBT_MULTIPLIER
|
|
51
|
+
* * get_minimum_debt(decimals) -> absorb & wipe (NEW)
|
|
52
|
+
* - else: keep collateral; net debt = finalDebtRaw - dustDebtRaw
|
|
53
|
+
*/
|
|
54
|
+
declare function reconcileLiquidatedDust({ finalTick, finalColRaw, finalDebtRaw, dustDebtRaw, borrowMintDecimals, }: {
|
|
55
|
+
finalTick: number;
|
|
56
|
+
finalColRaw: BN__default;
|
|
57
|
+
finalDebtRaw: BN__default;
|
|
58
|
+
dustDebtRaw: BN__default;
|
|
59
|
+
borrowMintDecimals: number;
|
|
60
|
+
}): LiquidatedDustReconciliation;
|
|
33
61
|
declare const getAccountOwner: (account: PublicKey, connection: Connection) => Promise<PublicKey>;
|
|
34
62
|
declare const getCurrentPosition: ({ vaultId, positionId, connection, market, }: GetCurrentPositionParams) => Promise<{
|
|
35
63
|
tick: number;
|
|
@@ -42,7 +70,7 @@ declare const getCurrentPosition: ({ vaultId, positionId, connection, market, }:
|
|
|
42
70
|
userLiquidationStatus: boolean;
|
|
43
71
|
postLiquidationBranchId: number;
|
|
44
72
|
}>;
|
|
45
|
-
declare const getCurrentPositionState: ({ vaultId, position, program, market, }: GetCurrentPositionStateParams) => Promise<{
|
|
73
|
+
declare const getCurrentPositionState: ({ vaultId, position, program, market, borrowMintDecimals, }: GetCurrentPositionStateParams) => Promise<{
|
|
46
74
|
tick: number;
|
|
47
75
|
tickId: number;
|
|
48
76
|
colRaw: BN__default;
|
|
@@ -91,85 +119,104 @@ declare function getOracleSources({ connection, signer, oracle, }: {
|
|
|
91
119
|
multiplier: BN__default;
|
|
92
120
|
divisor: BN__default;
|
|
93
121
|
sourceType: ({
|
|
94
|
-
|
|
122
|
+
stakePool?: undefined;
|
|
95
123
|
msolPool?: undefined;
|
|
96
124
|
redstone?: undefined;
|
|
97
125
|
chainlink?: undefined;
|
|
98
126
|
singlePool?: undefined;
|
|
99
127
|
jupLend?: undefined;
|
|
100
128
|
chainlinkDataStreams?: undefined;
|
|
129
|
+
pstPool?: undefined;
|
|
101
130
|
} & {
|
|
102
|
-
|
|
131
|
+
pyth: Record<string, never>;
|
|
103
132
|
}) | ({
|
|
104
|
-
|
|
133
|
+
pyth?: undefined;
|
|
105
134
|
msolPool?: undefined;
|
|
106
135
|
redstone?: undefined;
|
|
107
136
|
chainlink?: undefined;
|
|
108
137
|
singlePool?: undefined;
|
|
109
138
|
jupLend?: undefined;
|
|
110
139
|
chainlinkDataStreams?: undefined;
|
|
140
|
+
pstPool?: undefined;
|
|
111
141
|
} & {
|
|
112
|
-
|
|
142
|
+
stakePool: Record<string, never>;
|
|
113
143
|
}) | ({
|
|
114
|
-
stakePool?: undefined;
|
|
115
144
|
pyth?: undefined;
|
|
145
|
+
stakePool?: undefined;
|
|
116
146
|
redstone?: undefined;
|
|
117
147
|
chainlink?: undefined;
|
|
118
148
|
singlePool?: undefined;
|
|
119
149
|
jupLend?: undefined;
|
|
120
150
|
chainlinkDataStreams?: undefined;
|
|
151
|
+
pstPool?: undefined;
|
|
121
152
|
} & {
|
|
122
153
|
msolPool: Record<string, never>;
|
|
123
154
|
}) | ({
|
|
124
|
-
stakePool?: undefined;
|
|
125
155
|
pyth?: undefined;
|
|
156
|
+
stakePool?: undefined;
|
|
126
157
|
msolPool?: undefined;
|
|
127
158
|
chainlink?: undefined;
|
|
128
159
|
singlePool?: undefined;
|
|
129
160
|
jupLend?: undefined;
|
|
130
161
|
chainlinkDataStreams?: undefined;
|
|
162
|
+
pstPool?: undefined;
|
|
131
163
|
} & {
|
|
132
164
|
redstone: Record<string, never>;
|
|
133
165
|
}) | ({
|
|
134
|
-
stakePool?: undefined;
|
|
135
166
|
pyth?: undefined;
|
|
167
|
+
stakePool?: undefined;
|
|
136
168
|
msolPool?: undefined;
|
|
137
169
|
redstone?: undefined;
|
|
138
170
|
singlePool?: undefined;
|
|
139
171
|
jupLend?: undefined;
|
|
140
172
|
chainlinkDataStreams?: undefined;
|
|
173
|
+
pstPool?: undefined;
|
|
141
174
|
} & {
|
|
142
175
|
chainlink: Record<string, never>;
|
|
143
176
|
}) | ({
|
|
144
|
-
stakePool?: undefined;
|
|
145
177
|
pyth?: undefined;
|
|
178
|
+
stakePool?: undefined;
|
|
146
179
|
msolPool?: undefined;
|
|
147
180
|
redstone?: undefined;
|
|
148
181
|
chainlink?: undefined;
|
|
149
182
|
jupLend?: undefined;
|
|
150
183
|
chainlinkDataStreams?: undefined;
|
|
184
|
+
pstPool?: undefined;
|
|
151
185
|
} & {
|
|
152
186
|
singlePool: Record<string, never>;
|
|
153
187
|
}) | ({
|
|
154
|
-
stakePool?: undefined;
|
|
155
188
|
pyth?: undefined;
|
|
189
|
+
stakePool?: undefined;
|
|
156
190
|
msolPool?: undefined;
|
|
157
191
|
redstone?: undefined;
|
|
158
192
|
chainlink?: undefined;
|
|
159
193
|
singlePool?: undefined;
|
|
160
194
|
chainlinkDataStreams?: undefined;
|
|
195
|
+
pstPool?: undefined;
|
|
161
196
|
} & {
|
|
162
197
|
jupLend: Record<string, never>;
|
|
163
198
|
}) | ({
|
|
164
|
-
stakePool?: undefined;
|
|
165
199
|
pyth?: undefined;
|
|
200
|
+
stakePool?: undefined;
|
|
166
201
|
msolPool?: undefined;
|
|
167
202
|
redstone?: undefined;
|
|
168
203
|
chainlink?: undefined;
|
|
169
204
|
singlePool?: undefined;
|
|
170
205
|
jupLend?: undefined;
|
|
206
|
+
pstPool?: undefined;
|
|
171
207
|
} & {
|
|
172
208
|
chainlinkDataStreams: Record<string, never>;
|
|
209
|
+
}) | ({
|
|
210
|
+
pyth?: undefined;
|
|
211
|
+
stakePool?: undefined;
|
|
212
|
+
msolPool?: undefined;
|
|
213
|
+
redstone?: undefined;
|
|
214
|
+
chainlink?: undefined;
|
|
215
|
+
singlePool?: undefined;
|
|
216
|
+
jupLend?: undefined;
|
|
217
|
+
chainlinkDataStreams?: undefined;
|
|
218
|
+
} & {
|
|
219
|
+
pstPool: Record<string, never>;
|
|
173
220
|
});
|
|
174
221
|
}[]>;
|
|
175
222
|
declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
@@ -185,85 +232,104 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
185
232
|
multiplier: BN__default;
|
|
186
233
|
divisor: BN__default;
|
|
187
234
|
sourceType: ({
|
|
188
|
-
|
|
235
|
+
stakePool?: undefined;
|
|
189
236
|
msolPool?: undefined;
|
|
190
237
|
redstone?: undefined;
|
|
191
238
|
chainlink?: undefined;
|
|
192
239
|
singlePool?: undefined;
|
|
193
240
|
jupLend?: undefined;
|
|
194
241
|
chainlinkDataStreams?: undefined;
|
|
242
|
+
pstPool?: undefined;
|
|
195
243
|
} & {
|
|
196
|
-
|
|
244
|
+
pyth: Record<string, never>;
|
|
197
245
|
}) | ({
|
|
198
|
-
|
|
246
|
+
pyth?: undefined;
|
|
199
247
|
msolPool?: undefined;
|
|
200
248
|
redstone?: undefined;
|
|
201
249
|
chainlink?: undefined;
|
|
202
250
|
singlePool?: undefined;
|
|
203
251
|
jupLend?: undefined;
|
|
204
252
|
chainlinkDataStreams?: undefined;
|
|
253
|
+
pstPool?: undefined;
|
|
205
254
|
} & {
|
|
206
|
-
|
|
255
|
+
stakePool: Record<string, never>;
|
|
207
256
|
}) | ({
|
|
208
|
-
stakePool?: undefined;
|
|
209
257
|
pyth?: undefined;
|
|
258
|
+
stakePool?: undefined;
|
|
210
259
|
redstone?: undefined;
|
|
211
260
|
chainlink?: undefined;
|
|
212
261
|
singlePool?: undefined;
|
|
213
262
|
jupLend?: undefined;
|
|
214
263
|
chainlinkDataStreams?: undefined;
|
|
264
|
+
pstPool?: undefined;
|
|
215
265
|
} & {
|
|
216
266
|
msolPool: Record<string, never>;
|
|
217
267
|
}) | ({
|
|
218
|
-
stakePool?: undefined;
|
|
219
268
|
pyth?: undefined;
|
|
269
|
+
stakePool?: undefined;
|
|
220
270
|
msolPool?: undefined;
|
|
221
271
|
chainlink?: undefined;
|
|
222
272
|
singlePool?: undefined;
|
|
223
273
|
jupLend?: undefined;
|
|
224
274
|
chainlinkDataStreams?: undefined;
|
|
275
|
+
pstPool?: undefined;
|
|
225
276
|
} & {
|
|
226
277
|
redstone: Record<string, never>;
|
|
227
278
|
}) | ({
|
|
228
|
-
stakePool?: undefined;
|
|
229
279
|
pyth?: undefined;
|
|
280
|
+
stakePool?: undefined;
|
|
230
281
|
msolPool?: undefined;
|
|
231
282
|
redstone?: undefined;
|
|
232
283
|
singlePool?: undefined;
|
|
233
284
|
jupLend?: undefined;
|
|
234
285
|
chainlinkDataStreams?: undefined;
|
|
286
|
+
pstPool?: undefined;
|
|
235
287
|
} & {
|
|
236
288
|
chainlink: Record<string, never>;
|
|
237
289
|
}) | ({
|
|
238
|
-
stakePool?: undefined;
|
|
239
290
|
pyth?: undefined;
|
|
291
|
+
stakePool?: undefined;
|
|
240
292
|
msolPool?: undefined;
|
|
241
293
|
redstone?: undefined;
|
|
242
294
|
chainlink?: undefined;
|
|
243
295
|
jupLend?: undefined;
|
|
244
296
|
chainlinkDataStreams?: undefined;
|
|
297
|
+
pstPool?: undefined;
|
|
245
298
|
} & {
|
|
246
299
|
singlePool: Record<string, never>;
|
|
247
300
|
}) | ({
|
|
248
|
-
stakePool?: undefined;
|
|
249
301
|
pyth?: undefined;
|
|
302
|
+
stakePool?: undefined;
|
|
250
303
|
msolPool?: undefined;
|
|
251
304
|
redstone?: undefined;
|
|
252
305
|
chainlink?: undefined;
|
|
253
306
|
singlePool?: undefined;
|
|
254
307
|
chainlinkDataStreams?: undefined;
|
|
308
|
+
pstPool?: undefined;
|
|
255
309
|
} & {
|
|
256
310
|
jupLend: Record<string, never>;
|
|
257
311
|
}) | ({
|
|
258
|
-
stakePool?: undefined;
|
|
259
312
|
pyth?: undefined;
|
|
313
|
+
stakePool?: undefined;
|
|
260
314
|
msolPool?: undefined;
|
|
261
315
|
redstone?: undefined;
|
|
262
316
|
chainlink?: undefined;
|
|
263
317
|
singlePool?: undefined;
|
|
264
318
|
jupLend?: undefined;
|
|
319
|
+
pstPool?: undefined;
|
|
265
320
|
} & {
|
|
266
321
|
chainlinkDataStreams: Record<string, never>;
|
|
322
|
+
}) | ({
|
|
323
|
+
pyth?: undefined;
|
|
324
|
+
stakePool?: undefined;
|
|
325
|
+
msolPool?: undefined;
|
|
326
|
+
redstone?: undefined;
|
|
327
|
+
chainlink?: undefined;
|
|
328
|
+
singlePool?: undefined;
|
|
329
|
+
jupLend?: undefined;
|
|
330
|
+
chainlinkDataStreams?: undefined;
|
|
331
|
+
} & {
|
|
332
|
+
pstPool: Record<string, never>;
|
|
267
333
|
});
|
|
268
334
|
}[];
|
|
269
335
|
}>;
|
|
@@ -315,4 +381,5 @@ declare const getAllLiquidations: (params: Omit<LiquidateParams, "debtAmount" |
|
|
|
315
381
|
}[];
|
|
316
382
|
}[]>;
|
|
317
383
|
|
|
318
|
-
export { INIT_TICK, LiquidateParams, MAX_REPAY_AMOUNT, MAX_TICK, MAX_WITHDRAW_AMOUNT, MIN_I128, MIN_TICK, TICKS_PER_TICK_HAS_DEBT, TICK_HAS_DEBT_ARRAY_SIZE, TICK_HAS_DEBT_CHILDREN_SIZE, TICK_HAS_DEBT_CHILDREN_SIZE_IN_BITS, TOTAL_INDICES_NEEDED, ZERO_TICK_SCALED_RATIO, findNextTickWithDebt, getAccountOwner, getAllLiquidations, getCurrentPosition, getCurrentPositionState, getFinalPosition, getFirstTickForIndex, getLiquidations, getLiquidityProgramId, getOracleSources, getRatioAtTick, getTickAtRatio, getTickIndices, getVaultsProgram, loadRelevantBranches, loadRelevantBranchesForLiquidate, loadRelevantTicksHasDebtArrays, loadRelevantTicksHasDebtArraysLiquidate, readOraclePrice, readTickHasDebtArray, simulateLiquidate };
|
|
384
|
+
export { INIT_TICK, LiquidateParams, MAX_REPAY_AMOUNT, MAX_TICK, MAX_WITHDRAW_AMOUNT, MIN_I128, MIN_TICK, TICKS_PER_TICK_HAS_DEBT, TICK_HAS_DEBT_ARRAY_SIZE, TICK_HAS_DEBT_CHILDREN_SIZE, TICK_HAS_DEBT_CHILDREN_SIZE_IN_BITS, TOTAL_INDICES_NEEDED, ZERO_TICK_SCALED_RATIO, findNextTickWithDebt, getAccountOwner, getAllLiquidations, getCurrentPosition, getCurrentPositionState, getFinalPosition, getFirstTickForIndex, getLiquidations, getLiquidityProgramId, getMinimumDebt, getOracleSources, getRatioAtTick, getTickAtRatio, getTickIndices, getVaultsProgram, loadRelevantBranches, loadRelevantBranchesForLiquidate, loadRelevantTicksHasDebtArrays, loadRelevantTicksHasDebtArraysLiquidate, readOraclePrice, readTickHasDebtArray, reconcileLiquidatedDust, simulateLiquidate };
|
|
385
|
+
export type { LiquidatedDustReconciliation };
|
package/dist/borrow/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as Vaults, L as LiquidateParams } from '../shared/lend.
|
|
2
|
-
export { C as ConnectionParams, I as InitPositionIxParams, a as LiquidateContextParams, O as OperateContextParams, b as OperateParams, g as getInitPositionContext, c as getInitPositionIx, d as getLiquidateContext, e as getLiquidateIx, f as getOperateContext, h as getOperateIx } from '../shared/lend.
|
|
1
|
+
import { V as Vaults, L as LiquidateParams } from '../shared/lend.CdoFqRFx.js';
|
|
2
|
+
export { C as ConnectionParams, I as InitPositionIxParams, a as LiquidateContextParams, O as OperateContextParams, b as OperateParams, g as getInitPositionContext, c as getInitPositionIx, d as getLiquidateContext, e as getLiquidateIx, f as getOperateContext, h as getOperateIx } from '../shared/lend.CdoFqRFx.js';
|
|
3
3
|
import { Program } from '@coral-xyz/anchor';
|
|
4
4
|
import BN__default from 'bn.js';
|
|
5
5
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
@@ -18,6 +18,12 @@ type GetCurrentPositionStateParams = {
|
|
|
18
18
|
position: PositionData;
|
|
19
19
|
program: Program<Vaults>;
|
|
20
20
|
market: "main" | "ethena";
|
|
21
|
+
/**
|
|
22
|
+
* Borrow-token mint decimals (from vaultMetadata.borrowMintDecimals). Only used
|
|
23
|
+
* on the post-liquidation path to compute the dust-absorb threshold. When omitted
|
|
24
|
+
* it is fetched lazily; pass it to avoid an extra RPC when already available.
|
|
25
|
+
*/
|
|
26
|
+
borrowMintDecimals?: number;
|
|
21
27
|
};
|
|
22
28
|
declare const getVaultsProgram: ({ connection, signer, market, }: {
|
|
23
29
|
connection: Connection;
|
|
@@ -30,6 +36,28 @@ declare const MIN_I128: BN__default;
|
|
|
30
36
|
declare const MAX_REPAY_AMOUNT: BN__default;
|
|
31
37
|
/** Use as `colAmount` in getOperateIx to withdraw all collateral (subject to LTV). */
|
|
32
38
|
declare const MAX_WITHDRAW_AMOUNT: BN__default;
|
|
39
|
+
declare function getMinimumDebt(decimals: number): BN__default;
|
|
40
|
+
type LiquidatedDustReconciliation = {
|
|
41
|
+
tick: number;
|
|
42
|
+
colRaw: BN__default;
|
|
43
|
+
debtRaw: BN__default;
|
|
44
|
+
dustDebtRaw: BN__default;
|
|
45
|
+
/** True when the program would absorb & wipe the position to a supply-only COLD position. */
|
|
46
|
+
isWiped: boolean;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* - case 1: finalDebtRaw < dustDebtRaw -> absorb & wipe
|
|
50
|
+
* - case 2: finalDebtRaw < LIQUIDATED_POSITION_DEBT_MULTIPLIER
|
|
51
|
+
* * get_minimum_debt(decimals) -> absorb & wipe (NEW)
|
|
52
|
+
* - else: keep collateral; net debt = finalDebtRaw - dustDebtRaw
|
|
53
|
+
*/
|
|
54
|
+
declare function reconcileLiquidatedDust({ finalTick, finalColRaw, finalDebtRaw, dustDebtRaw, borrowMintDecimals, }: {
|
|
55
|
+
finalTick: number;
|
|
56
|
+
finalColRaw: BN__default;
|
|
57
|
+
finalDebtRaw: BN__default;
|
|
58
|
+
dustDebtRaw: BN__default;
|
|
59
|
+
borrowMintDecimals: number;
|
|
60
|
+
}): LiquidatedDustReconciliation;
|
|
33
61
|
declare const getAccountOwner: (account: PublicKey, connection: Connection) => Promise<PublicKey>;
|
|
34
62
|
declare const getCurrentPosition: ({ vaultId, positionId, connection, market, }: GetCurrentPositionParams) => Promise<{
|
|
35
63
|
tick: number;
|
|
@@ -42,7 +70,7 @@ declare const getCurrentPosition: ({ vaultId, positionId, connection, market, }:
|
|
|
42
70
|
userLiquidationStatus: boolean;
|
|
43
71
|
postLiquidationBranchId: number;
|
|
44
72
|
}>;
|
|
45
|
-
declare const getCurrentPositionState: ({ vaultId, position, program, market, }: GetCurrentPositionStateParams) => Promise<{
|
|
73
|
+
declare const getCurrentPositionState: ({ vaultId, position, program, market, borrowMintDecimals, }: GetCurrentPositionStateParams) => Promise<{
|
|
46
74
|
tick: number;
|
|
47
75
|
tickId: number;
|
|
48
76
|
colRaw: BN__default;
|
|
@@ -91,85 +119,104 @@ declare function getOracleSources({ connection, signer, oracle, }: {
|
|
|
91
119
|
multiplier: BN__default;
|
|
92
120
|
divisor: BN__default;
|
|
93
121
|
sourceType: ({
|
|
94
|
-
|
|
122
|
+
stakePool?: undefined;
|
|
95
123
|
msolPool?: undefined;
|
|
96
124
|
redstone?: undefined;
|
|
97
125
|
chainlink?: undefined;
|
|
98
126
|
singlePool?: undefined;
|
|
99
127
|
jupLend?: undefined;
|
|
100
128
|
chainlinkDataStreams?: undefined;
|
|
129
|
+
pstPool?: undefined;
|
|
101
130
|
} & {
|
|
102
|
-
|
|
131
|
+
pyth: Record<string, never>;
|
|
103
132
|
}) | ({
|
|
104
|
-
|
|
133
|
+
pyth?: undefined;
|
|
105
134
|
msolPool?: undefined;
|
|
106
135
|
redstone?: undefined;
|
|
107
136
|
chainlink?: undefined;
|
|
108
137
|
singlePool?: undefined;
|
|
109
138
|
jupLend?: undefined;
|
|
110
139
|
chainlinkDataStreams?: undefined;
|
|
140
|
+
pstPool?: undefined;
|
|
111
141
|
} & {
|
|
112
|
-
|
|
142
|
+
stakePool: Record<string, never>;
|
|
113
143
|
}) | ({
|
|
114
|
-
stakePool?: undefined;
|
|
115
144
|
pyth?: undefined;
|
|
145
|
+
stakePool?: undefined;
|
|
116
146
|
redstone?: undefined;
|
|
117
147
|
chainlink?: undefined;
|
|
118
148
|
singlePool?: undefined;
|
|
119
149
|
jupLend?: undefined;
|
|
120
150
|
chainlinkDataStreams?: undefined;
|
|
151
|
+
pstPool?: undefined;
|
|
121
152
|
} & {
|
|
122
153
|
msolPool: Record<string, never>;
|
|
123
154
|
}) | ({
|
|
124
|
-
stakePool?: undefined;
|
|
125
155
|
pyth?: undefined;
|
|
156
|
+
stakePool?: undefined;
|
|
126
157
|
msolPool?: undefined;
|
|
127
158
|
chainlink?: undefined;
|
|
128
159
|
singlePool?: undefined;
|
|
129
160
|
jupLend?: undefined;
|
|
130
161
|
chainlinkDataStreams?: undefined;
|
|
162
|
+
pstPool?: undefined;
|
|
131
163
|
} & {
|
|
132
164
|
redstone: Record<string, never>;
|
|
133
165
|
}) | ({
|
|
134
|
-
stakePool?: undefined;
|
|
135
166
|
pyth?: undefined;
|
|
167
|
+
stakePool?: undefined;
|
|
136
168
|
msolPool?: undefined;
|
|
137
169
|
redstone?: undefined;
|
|
138
170
|
singlePool?: undefined;
|
|
139
171
|
jupLend?: undefined;
|
|
140
172
|
chainlinkDataStreams?: undefined;
|
|
173
|
+
pstPool?: undefined;
|
|
141
174
|
} & {
|
|
142
175
|
chainlink: Record<string, never>;
|
|
143
176
|
}) | ({
|
|
144
|
-
stakePool?: undefined;
|
|
145
177
|
pyth?: undefined;
|
|
178
|
+
stakePool?: undefined;
|
|
146
179
|
msolPool?: undefined;
|
|
147
180
|
redstone?: undefined;
|
|
148
181
|
chainlink?: undefined;
|
|
149
182
|
jupLend?: undefined;
|
|
150
183
|
chainlinkDataStreams?: undefined;
|
|
184
|
+
pstPool?: undefined;
|
|
151
185
|
} & {
|
|
152
186
|
singlePool: Record<string, never>;
|
|
153
187
|
}) | ({
|
|
154
|
-
stakePool?: undefined;
|
|
155
188
|
pyth?: undefined;
|
|
189
|
+
stakePool?: undefined;
|
|
156
190
|
msolPool?: undefined;
|
|
157
191
|
redstone?: undefined;
|
|
158
192
|
chainlink?: undefined;
|
|
159
193
|
singlePool?: undefined;
|
|
160
194
|
chainlinkDataStreams?: undefined;
|
|
195
|
+
pstPool?: undefined;
|
|
161
196
|
} & {
|
|
162
197
|
jupLend: Record<string, never>;
|
|
163
198
|
}) | ({
|
|
164
|
-
stakePool?: undefined;
|
|
165
199
|
pyth?: undefined;
|
|
200
|
+
stakePool?: undefined;
|
|
166
201
|
msolPool?: undefined;
|
|
167
202
|
redstone?: undefined;
|
|
168
203
|
chainlink?: undefined;
|
|
169
204
|
singlePool?: undefined;
|
|
170
205
|
jupLend?: undefined;
|
|
206
|
+
pstPool?: undefined;
|
|
171
207
|
} & {
|
|
172
208
|
chainlinkDataStreams: Record<string, never>;
|
|
209
|
+
}) | ({
|
|
210
|
+
pyth?: undefined;
|
|
211
|
+
stakePool?: undefined;
|
|
212
|
+
msolPool?: undefined;
|
|
213
|
+
redstone?: undefined;
|
|
214
|
+
chainlink?: undefined;
|
|
215
|
+
singlePool?: undefined;
|
|
216
|
+
jupLend?: undefined;
|
|
217
|
+
chainlinkDataStreams?: undefined;
|
|
218
|
+
} & {
|
|
219
|
+
pstPool: Record<string, never>;
|
|
173
220
|
});
|
|
174
221
|
}[]>;
|
|
175
222
|
declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
@@ -185,85 +232,104 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
185
232
|
multiplier: BN__default;
|
|
186
233
|
divisor: BN__default;
|
|
187
234
|
sourceType: ({
|
|
188
|
-
|
|
235
|
+
stakePool?: undefined;
|
|
189
236
|
msolPool?: undefined;
|
|
190
237
|
redstone?: undefined;
|
|
191
238
|
chainlink?: undefined;
|
|
192
239
|
singlePool?: undefined;
|
|
193
240
|
jupLend?: undefined;
|
|
194
241
|
chainlinkDataStreams?: undefined;
|
|
242
|
+
pstPool?: undefined;
|
|
195
243
|
} & {
|
|
196
|
-
|
|
244
|
+
pyth: Record<string, never>;
|
|
197
245
|
}) | ({
|
|
198
|
-
|
|
246
|
+
pyth?: undefined;
|
|
199
247
|
msolPool?: undefined;
|
|
200
248
|
redstone?: undefined;
|
|
201
249
|
chainlink?: undefined;
|
|
202
250
|
singlePool?: undefined;
|
|
203
251
|
jupLend?: undefined;
|
|
204
252
|
chainlinkDataStreams?: undefined;
|
|
253
|
+
pstPool?: undefined;
|
|
205
254
|
} & {
|
|
206
|
-
|
|
255
|
+
stakePool: Record<string, never>;
|
|
207
256
|
}) | ({
|
|
208
|
-
stakePool?: undefined;
|
|
209
257
|
pyth?: undefined;
|
|
258
|
+
stakePool?: undefined;
|
|
210
259
|
redstone?: undefined;
|
|
211
260
|
chainlink?: undefined;
|
|
212
261
|
singlePool?: undefined;
|
|
213
262
|
jupLend?: undefined;
|
|
214
263
|
chainlinkDataStreams?: undefined;
|
|
264
|
+
pstPool?: undefined;
|
|
215
265
|
} & {
|
|
216
266
|
msolPool: Record<string, never>;
|
|
217
267
|
}) | ({
|
|
218
|
-
stakePool?: undefined;
|
|
219
268
|
pyth?: undefined;
|
|
269
|
+
stakePool?: undefined;
|
|
220
270
|
msolPool?: undefined;
|
|
221
271
|
chainlink?: undefined;
|
|
222
272
|
singlePool?: undefined;
|
|
223
273
|
jupLend?: undefined;
|
|
224
274
|
chainlinkDataStreams?: undefined;
|
|
275
|
+
pstPool?: undefined;
|
|
225
276
|
} & {
|
|
226
277
|
redstone: Record<string, never>;
|
|
227
278
|
}) | ({
|
|
228
|
-
stakePool?: undefined;
|
|
229
279
|
pyth?: undefined;
|
|
280
|
+
stakePool?: undefined;
|
|
230
281
|
msolPool?: undefined;
|
|
231
282
|
redstone?: undefined;
|
|
232
283
|
singlePool?: undefined;
|
|
233
284
|
jupLend?: undefined;
|
|
234
285
|
chainlinkDataStreams?: undefined;
|
|
286
|
+
pstPool?: undefined;
|
|
235
287
|
} & {
|
|
236
288
|
chainlink: Record<string, never>;
|
|
237
289
|
}) | ({
|
|
238
|
-
stakePool?: undefined;
|
|
239
290
|
pyth?: undefined;
|
|
291
|
+
stakePool?: undefined;
|
|
240
292
|
msolPool?: undefined;
|
|
241
293
|
redstone?: undefined;
|
|
242
294
|
chainlink?: undefined;
|
|
243
295
|
jupLend?: undefined;
|
|
244
296
|
chainlinkDataStreams?: undefined;
|
|
297
|
+
pstPool?: undefined;
|
|
245
298
|
} & {
|
|
246
299
|
singlePool: Record<string, never>;
|
|
247
300
|
}) | ({
|
|
248
|
-
stakePool?: undefined;
|
|
249
301
|
pyth?: undefined;
|
|
302
|
+
stakePool?: undefined;
|
|
250
303
|
msolPool?: undefined;
|
|
251
304
|
redstone?: undefined;
|
|
252
305
|
chainlink?: undefined;
|
|
253
306
|
singlePool?: undefined;
|
|
254
307
|
chainlinkDataStreams?: undefined;
|
|
308
|
+
pstPool?: undefined;
|
|
255
309
|
} & {
|
|
256
310
|
jupLend: Record<string, never>;
|
|
257
311
|
}) | ({
|
|
258
|
-
stakePool?: undefined;
|
|
259
312
|
pyth?: undefined;
|
|
313
|
+
stakePool?: undefined;
|
|
260
314
|
msolPool?: undefined;
|
|
261
315
|
redstone?: undefined;
|
|
262
316
|
chainlink?: undefined;
|
|
263
317
|
singlePool?: undefined;
|
|
264
318
|
jupLend?: undefined;
|
|
319
|
+
pstPool?: undefined;
|
|
265
320
|
} & {
|
|
266
321
|
chainlinkDataStreams: Record<string, never>;
|
|
322
|
+
}) | ({
|
|
323
|
+
pyth?: undefined;
|
|
324
|
+
stakePool?: undefined;
|
|
325
|
+
msolPool?: undefined;
|
|
326
|
+
redstone?: undefined;
|
|
327
|
+
chainlink?: undefined;
|
|
328
|
+
singlePool?: undefined;
|
|
329
|
+
jupLend?: undefined;
|
|
330
|
+
chainlinkDataStreams?: undefined;
|
|
331
|
+
} & {
|
|
332
|
+
pstPool: Record<string, never>;
|
|
267
333
|
});
|
|
268
334
|
}[];
|
|
269
335
|
}>;
|
|
@@ -315,4 +381,5 @@ declare const getAllLiquidations: (params: Omit<LiquidateParams, "debtAmount" |
|
|
|
315
381
|
}[];
|
|
316
382
|
}[]>;
|
|
317
383
|
|
|
318
|
-
export { INIT_TICK, LiquidateParams, MAX_REPAY_AMOUNT, MAX_TICK, MAX_WITHDRAW_AMOUNT, MIN_I128, MIN_TICK, TICKS_PER_TICK_HAS_DEBT, TICK_HAS_DEBT_ARRAY_SIZE, TICK_HAS_DEBT_CHILDREN_SIZE, TICK_HAS_DEBT_CHILDREN_SIZE_IN_BITS, TOTAL_INDICES_NEEDED, ZERO_TICK_SCALED_RATIO, findNextTickWithDebt, getAccountOwner, getAllLiquidations, getCurrentPosition, getCurrentPositionState, getFinalPosition, getFirstTickForIndex, getLiquidations, getLiquidityProgramId, getOracleSources, getRatioAtTick, getTickAtRatio, getTickIndices, getVaultsProgram, loadRelevantBranches, loadRelevantBranchesForLiquidate, loadRelevantTicksHasDebtArrays, loadRelevantTicksHasDebtArraysLiquidate, readOraclePrice, readTickHasDebtArray, simulateLiquidate };
|
|
384
|
+
export { INIT_TICK, LiquidateParams, MAX_REPAY_AMOUNT, MAX_TICK, MAX_WITHDRAW_AMOUNT, MIN_I128, MIN_TICK, TICKS_PER_TICK_HAS_DEBT, TICK_HAS_DEBT_ARRAY_SIZE, TICK_HAS_DEBT_CHILDREN_SIZE, TICK_HAS_DEBT_CHILDREN_SIZE_IN_BITS, TOTAL_INDICES_NEEDED, ZERO_TICK_SCALED_RATIO, findNextTickWithDebt, getAccountOwner, getAllLiquidations, getCurrentPosition, getCurrentPositionState, getFinalPosition, getFirstTickForIndex, getLiquidations, getLiquidityProgramId, getMinimumDebt, getOracleSources, getRatioAtTick, getTickAtRatio, getTickIndices, getVaultsProgram, loadRelevantBranches, loadRelevantBranchesForLiquidate, loadRelevantTicksHasDebtArrays, loadRelevantTicksHasDebtArraysLiquidate, readOraclePrice, readTickHasDebtArray, reconcileLiquidatedDust, simulateLiquidate };
|
|
385
|
+
export type { LiquidatedDustReconciliation };
|
package/dist/borrow/index.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { g as getLiquidateIx } from '../shared/lend.
|
|
2
|
-
export { a as getInitPositionContext, b as getInitPositionIx, c as getLiquidateContext, d as getOperateContext, e as getOperateIx } from '../shared/lend.
|
|
3
|
-
import { g as getVaultsProgram } from '../shared/lend.
|
|
4
|
-
export { I as INIT_TICK, M as MAX_REPAY_AMOUNT, a as MAX_TICK, b as MAX_WITHDRAW_AMOUNT, c as MIN_I128, d as MIN_TICK, T as TICKS_PER_TICK_HAS_DEBT, e as TICK_HAS_DEBT_ARRAY_SIZE, f as TICK_HAS_DEBT_CHILDREN_SIZE, h as TICK_HAS_DEBT_CHILDREN_SIZE_IN_BITS, i as TOTAL_INDICES_NEEDED, Z as ZERO_TICK_SCALED_RATIO, j as findNextTickWithDebt, k as getAccountOwner, l as getCurrentPosition, m as getCurrentPositionState, n as getFinalPosition, o as getFirstTickForIndex, p as getLiquidityProgramId, q as
|
|
1
|
+
import { g as getLiquidateIx } from '../shared/lend.CS-bkwRq.mjs';
|
|
2
|
+
export { a as getInitPositionContext, b as getInitPositionIx, c as getLiquidateContext, d as getOperateContext, e as getOperateIx } from '../shared/lend.CS-bkwRq.mjs';
|
|
3
|
+
import { g as getVaultsProgram } from '../shared/lend.CVtn-ehf.mjs';
|
|
4
|
+
export { I as INIT_TICK, M as MAX_REPAY_AMOUNT, a as MAX_TICK, b as MAX_WITHDRAW_AMOUNT, c as MIN_I128, d as MIN_TICK, T as TICKS_PER_TICK_HAS_DEBT, e as TICK_HAS_DEBT_ARRAY_SIZE, f as TICK_HAS_DEBT_CHILDREN_SIZE, h as TICK_HAS_DEBT_CHILDREN_SIZE_IN_BITS, i as TOTAL_INDICES_NEEDED, Z as ZERO_TICK_SCALED_RATIO, j as findNextTickWithDebt, k as getAccountOwner, l as getCurrentPosition, m as getCurrentPositionState, n as getFinalPosition, o as getFirstTickForIndex, p as getLiquidityProgramId, q as getMinimumDebt, r as getOracleSources, s as getRatioAtTick, t as getTickAtRatio, u as getTickIndices, v as loadRelevantBranches, w as loadRelevantBranchesForLiquidate, x as loadRelevantTicksHasDebtArrays, y as loadRelevantTicksHasDebtArraysLiquidate, z as readOraclePrice, A as readTickHasDebtArray, B as reconcileLiquidatedDust } from '../shared/lend.CVtn-ehf.mjs';
|
|
5
5
|
import { PublicKey, TransactionMessage, ComputeBudgetProgram, VersionedTransaction } from '@solana/web3.js';
|
|
6
6
|
import BN from 'bn.js';
|
|
7
7
|
import { g as getVaultAdmin } from '../shared/lend.a53XYkl5.mjs';
|
|
8
8
|
import '@coral-xyz/anchor';
|
|
9
9
|
import '@solana/spl-token';
|
|
10
|
+
import '../shared/lend.B80NmXTG.mjs';
|
|
10
11
|
import '../shared/lend.C3XdrR6R.mjs';
|
|
11
12
|
|
|
12
13
|
const simulateLiquidate = async (params) => {
|
package/dist/dex/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { Program } from '@coral-xyz/anchor';
|
|
3
3
|
import { getAssociatedTokenAddressSync, ASSOCIATED_TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
|
4
|
-
import {
|
|
4
|
+
import { r as getOracleSources } from '../shared/lend.CVtn-ehf.mjs';
|
|
5
5
|
import { g as getLiquidityProgramId, a as getLiquidity, b as getUserBorrowPosition, c as getUserSupplyPosition, d as getRateModel, e as getReserve } from '../shared/lend.C3XdrR6R.mjs';
|
|
6
6
|
import { g as getDex, a as getDexMetadata } from '../shared/lend.s0kjiHy3.mjs';
|
|
7
7
|
import 'bn.js';
|