@jup-ag/lend 0.2.0-beta.1 → 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 +162 -4
- package/dist/borrow/index.d.ts +162 -4
- package/dist/borrow/index.mjs +6 -3
- package/dist/dex/index.d.mts +247 -8
- package/dist/dex/index.d.ts +247 -8
- package/dist/dex/index.mjs +356 -27
- 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.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +3 -3
- package/dist/refinance/index.d.mts +1 -2
- package/dist/refinance/index.d.ts +1 -2
- package/dist/refinance/index.mjs +4 -2
- package/dist/shared/lend.B80NmXTG.mjs +2184 -0
- package/dist/shared/lend.CS-bkwRq.mjs +867 -0
- package/dist/shared/{lend.CTcB5yyK.mjs → lend.CVtn-ehf.mjs} +300 -1332
- 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/dist/shared/{lend.ByiEG4eI.mjs → lend.a53XYkl5.mjs} +1 -1
- package/dist/shared/lend.s0kjiHy3.mjs +29 -0
- package/package.json +1 -1
- package/dist/shared/lend.BC5Y1398.mjs +0 -18
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;
|
|
@@ -81,6 +109,116 @@ declare function loadRelevantTicksHasDebtArraysLiquidate(vaultId: number, topTic
|
|
|
81
109
|
}[];
|
|
82
110
|
}[]>;
|
|
83
111
|
declare function loadRelevantBranchesForLiquidate(vaultId: number, vaultState: any, program: Program<Vaults>, market: "main" | "ethena"): Promise<any[]>;
|
|
112
|
+
declare function getOracleSources({ connection, signer, oracle, }: {
|
|
113
|
+
connection: Connection;
|
|
114
|
+
signer?: PublicKey;
|
|
115
|
+
oracle: PublicKey;
|
|
116
|
+
}): Promise<{
|
|
117
|
+
source: PublicKey;
|
|
118
|
+
invert: boolean;
|
|
119
|
+
multiplier: BN__default;
|
|
120
|
+
divisor: BN__default;
|
|
121
|
+
sourceType: ({
|
|
122
|
+
stakePool?: undefined;
|
|
123
|
+
msolPool?: undefined;
|
|
124
|
+
redstone?: undefined;
|
|
125
|
+
chainlink?: undefined;
|
|
126
|
+
singlePool?: undefined;
|
|
127
|
+
jupLend?: undefined;
|
|
128
|
+
chainlinkDataStreams?: undefined;
|
|
129
|
+
pstPool?: undefined;
|
|
130
|
+
} & {
|
|
131
|
+
pyth: Record<string, never>;
|
|
132
|
+
}) | ({
|
|
133
|
+
pyth?: undefined;
|
|
134
|
+
msolPool?: undefined;
|
|
135
|
+
redstone?: undefined;
|
|
136
|
+
chainlink?: undefined;
|
|
137
|
+
singlePool?: undefined;
|
|
138
|
+
jupLend?: undefined;
|
|
139
|
+
chainlinkDataStreams?: undefined;
|
|
140
|
+
pstPool?: undefined;
|
|
141
|
+
} & {
|
|
142
|
+
stakePool: Record<string, never>;
|
|
143
|
+
}) | ({
|
|
144
|
+
pyth?: undefined;
|
|
145
|
+
stakePool?: undefined;
|
|
146
|
+
redstone?: undefined;
|
|
147
|
+
chainlink?: undefined;
|
|
148
|
+
singlePool?: undefined;
|
|
149
|
+
jupLend?: undefined;
|
|
150
|
+
chainlinkDataStreams?: undefined;
|
|
151
|
+
pstPool?: undefined;
|
|
152
|
+
} & {
|
|
153
|
+
msolPool: Record<string, never>;
|
|
154
|
+
}) | ({
|
|
155
|
+
pyth?: undefined;
|
|
156
|
+
stakePool?: undefined;
|
|
157
|
+
msolPool?: undefined;
|
|
158
|
+
chainlink?: undefined;
|
|
159
|
+
singlePool?: undefined;
|
|
160
|
+
jupLend?: undefined;
|
|
161
|
+
chainlinkDataStreams?: undefined;
|
|
162
|
+
pstPool?: undefined;
|
|
163
|
+
} & {
|
|
164
|
+
redstone: Record<string, never>;
|
|
165
|
+
}) | ({
|
|
166
|
+
pyth?: undefined;
|
|
167
|
+
stakePool?: undefined;
|
|
168
|
+
msolPool?: undefined;
|
|
169
|
+
redstone?: undefined;
|
|
170
|
+
singlePool?: undefined;
|
|
171
|
+
jupLend?: undefined;
|
|
172
|
+
chainlinkDataStreams?: undefined;
|
|
173
|
+
pstPool?: undefined;
|
|
174
|
+
} & {
|
|
175
|
+
chainlink: Record<string, never>;
|
|
176
|
+
}) | ({
|
|
177
|
+
pyth?: undefined;
|
|
178
|
+
stakePool?: undefined;
|
|
179
|
+
msolPool?: undefined;
|
|
180
|
+
redstone?: undefined;
|
|
181
|
+
chainlink?: undefined;
|
|
182
|
+
jupLend?: undefined;
|
|
183
|
+
chainlinkDataStreams?: undefined;
|
|
184
|
+
pstPool?: undefined;
|
|
185
|
+
} & {
|
|
186
|
+
singlePool: Record<string, never>;
|
|
187
|
+
}) | ({
|
|
188
|
+
pyth?: undefined;
|
|
189
|
+
stakePool?: undefined;
|
|
190
|
+
msolPool?: undefined;
|
|
191
|
+
redstone?: undefined;
|
|
192
|
+
chainlink?: undefined;
|
|
193
|
+
singlePool?: undefined;
|
|
194
|
+
chainlinkDataStreams?: undefined;
|
|
195
|
+
pstPool?: undefined;
|
|
196
|
+
} & {
|
|
197
|
+
jupLend: Record<string, never>;
|
|
198
|
+
}) | ({
|
|
199
|
+
pyth?: undefined;
|
|
200
|
+
stakePool?: undefined;
|
|
201
|
+
msolPool?: undefined;
|
|
202
|
+
redstone?: undefined;
|
|
203
|
+
chainlink?: undefined;
|
|
204
|
+
singlePool?: undefined;
|
|
205
|
+
jupLend?: undefined;
|
|
206
|
+
pstPool?: undefined;
|
|
207
|
+
} & {
|
|
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>;
|
|
220
|
+
});
|
|
221
|
+
}[]>;
|
|
84
222
|
declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
85
223
|
connection: Connection;
|
|
86
224
|
signer?: PublicKey;
|
|
@@ -101,6 +239,7 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
101
239
|
singlePool?: undefined;
|
|
102
240
|
jupLend?: undefined;
|
|
103
241
|
chainlinkDataStreams?: undefined;
|
|
242
|
+
pstPool?: undefined;
|
|
104
243
|
} & {
|
|
105
244
|
pyth: Record<string, never>;
|
|
106
245
|
}) | ({
|
|
@@ -111,6 +250,7 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
111
250
|
singlePool?: undefined;
|
|
112
251
|
jupLend?: undefined;
|
|
113
252
|
chainlinkDataStreams?: undefined;
|
|
253
|
+
pstPool?: undefined;
|
|
114
254
|
} & {
|
|
115
255
|
stakePool: Record<string, never>;
|
|
116
256
|
}) | ({
|
|
@@ -121,6 +261,7 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
121
261
|
singlePool?: undefined;
|
|
122
262
|
jupLend?: undefined;
|
|
123
263
|
chainlinkDataStreams?: undefined;
|
|
264
|
+
pstPool?: undefined;
|
|
124
265
|
} & {
|
|
125
266
|
msolPool: Record<string, never>;
|
|
126
267
|
}) | ({
|
|
@@ -131,6 +272,7 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
131
272
|
singlePool?: undefined;
|
|
132
273
|
jupLend?: undefined;
|
|
133
274
|
chainlinkDataStreams?: undefined;
|
|
275
|
+
pstPool?: undefined;
|
|
134
276
|
} & {
|
|
135
277
|
redstone: Record<string, never>;
|
|
136
278
|
}) | ({
|
|
@@ -141,6 +283,7 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
141
283
|
singlePool?: undefined;
|
|
142
284
|
jupLend?: undefined;
|
|
143
285
|
chainlinkDataStreams?: undefined;
|
|
286
|
+
pstPool?: undefined;
|
|
144
287
|
} & {
|
|
145
288
|
chainlink: Record<string, never>;
|
|
146
289
|
}) | ({
|
|
@@ -151,6 +294,7 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
151
294
|
chainlink?: undefined;
|
|
152
295
|
jupLend?: undefined;
|
|
153
296
|
chainlinkDataStreams?: undefined;
|
|
297
|
+
pstPool?: undefined;
|
|
154
298
|
} & {
|
|
155
299
|
singlePool: Record<string, never>;
|
|
156
300
|
}) | ({
|
|
@@ -161,6 +305,7 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
161
305
|
chainlink?: undefined;
|
|
162
306
|
singlePool?: undefined;
|
|
163
307
|
chainlinkDataStreams?: undefined;
|
|
308
|
+
pstPool?: undefined;
|
|
164
309
|
} & {
|
|
165
310
|
jupLend: Record<string, never>;
|
|
166
311
|
}) | ({
|
|
@@ -171,8 +316,20 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
171
316
|
chainlink?: undefined;
|
|
172
317
|
singlePool?: undefined;
|
|
173
318
|
jupLend?: undefined;
|
|
319
|
+
pstPool?: undefined;
|
|
174
320
|
} & {
|
|
175
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>;
|
|
176
333
|
});
|
|
177
334
|
}[];
|
|
178
335
|
}>;
|
|
@@ -224,4 +381,5 @@ declare const getAllLiquidations: (params: Omit<LiquidateParams, "debtAmount" |
|
|
|
224
381
|
}[];
|
|
225
382
|
}[]>;
|
|
226
383
|
|
|
227
|
-
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, 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;
|
|
@@ -81,6 +109,116 @@ declare function loadRelevantTicksHasDebtArraysLiquidate(vaultId: number, topTic
|
|
|
81
109
|
}[];
|
|
82
110
|
}[]>;
|
|
83
111
|
declare function loadRelevantBranchesForLiquidate(vaultId: number, vaultState: any, program: Program<Vaults>, market: "main" | "ethena"): Promise<any[]>;
|
|
112
|
+
declare function getOracleSources({ connection, signer, oracle, }: {
|
|
113
|
+
connection: Connection;
|
|
114
|
+
signer?: PublicKey;
|
|
115
|
+
oracle: PublicKey;
|
|
116
|
+
}): Promise<{
|
|
117
|
+
source: PublicKey;
|
|
118
|
+
invert: boolean;
|
|
119
|
+
multiplier: BN__default;
|
|
120
|
+
divisor: BN__default;
|
|
121
|
+
sourceType: ({
|
|
122
|
+
stakePool?: undefined;
|
|
123
|
+
msolPool?: undefined;
|
|
124
|
+
redstone?: undefined;
|
|
125
|
+
chainlink?: undefined;
|
|
126
|
+
singlePool?: undefined;
|
|
127
|
+
jupLend?: undefined;
|
|
128
|
+
chainlinkDataStreams?: undefined;
|
|
129
|
+
pstPool?: undefined;
|
|
130
|
+
} & {
|
|
131
|
+
pyth: Record<string, never>;
|
|
132
|
+
}) | ({
|
|
133
|
+
pyth?: undefined;
|
|
134
|
+
msolPool?: undefined;
|
|
135
|
+
redstone?: undefined;
|
|
136
|
+
chainlink?: undefined;
|
|
137
|
+
singlePool?: undefined;
|
|
138
|
+
jupLend?: undefined;
|
|
139
|
+
chainlinkDataStreams?: undefined;
|
|
140
|
+
pstPool?: undefined;
|
|
141
|
+
} & {
|
|
142
|
+
stakePool: Record<string, never>;
|
|
143
|
+
}) | ({
|
|
144
|
+
pyth?: undefined;
|
|
145
|
+
stakePool?: undefined;
|
|
146
|
+
redstone?: undefined;
|
|
147
|
+
chainlink?: undefined;
|
|
148
|
+
singlePool?: undefined;
|
|
149
|
+
jupLend?: undefined;
|
|
150
|
+
chainlinkDataStreams?: undefined;
|
|
151
|
+
pstPool?: undefined;
|
|
152
|
+
} & {
|
|
153
|
+
msolPool: Record<string, never>;
|
|
154
|
+
}) | ({
|
|
155
|
+
pyth?: undefined;
|
|
156
|
+
stakePool?: undefined;
|
|
157
|
+
msolPool?: undefined;
|
|
158
|
+
chainlink?: undefined;
|
|
159
|
+
singlePool?: undefined;
|
|
160
|
+
jupLend?: undefined;
|
|
161
|
+
chainlinkDataStreams?: undefined;
|
|
162
|
+
pstPool?: undefined;
|
|
163
|
+
} & {
|
|
164
|
+
redstone: Record<string, never>;
|
|
165
|
+
}) | ({
|
|
166
|
+
pyth?: undefined;
|
|
167
|
+
stakePool?: undefined;
|
|
168
|
+
msolPool?: undefined;
|
|
169
|
+
redstone?: undefined;
|
|
170
|
+
singlePool?: undefined;
|
|
171
|
+
jupLend?: undefined;
|
|
172
|
+
chainlinkDataStreams?: undefined;
|
|
173
|
+
pstPool?: undefined;
|
|
174
|
+
} & {
|
|
175
|
+
chainlink: Record<string, never>;
|
|
176
|
+
}) | ({
|
|
177
|
+
pyth?: undefined;
|
|
178
|
+
stakePool?: undefined;
|
|
179
|
+
msolPool?: undefined;
|
|
180
|
+
redstone?: undefined;
|
|
181
|
+
chainlink?: undefined;
|
|
182
|
+
jupLend?: undefined;
|
|
183
|
+
chainlinkDataStreams?: undefined;
|
|
184
|
+
pstPool?: undefined;
|
|
185
|
+
} & {
|
|
186
|
+
singlePool: Record<string, never>;
|
|
187
|
+
}) | ({
|
|
188
|
+
pyth?: undefined;
|
|
189
|
+
stakePool?: undefined;
|
|
190
|
+
msolPool?: undefined;
|
|
191
|
+
redstone?: undefined;
|
|
192
|
+
chainlink?: undefined;
|
|
193
|
+
singlePool?: undefined;
|
|
194
|
+
chainlinkDataStreams?: undefined;
|
|
195
|
+
pstPool?: undefined;
|
|
196
|
+
} & {
|
|
197
|
+
jupLend: Record<string, never>;
|
|
198
|
+
}) | ({
|
|
199
|
+
pyth?: undefined;
|
|
200
|
+
stakePool?: undefined;
|
|
201
|
+
msolPool?: undefined;
|
|
202
|
+
redstone?: undefined;
|
|
203
|
+
chainlink?: undefined;
|
|
204
|
+
singlePool?: undefined;
|
|
205
|
+
jupLend?: undefined;
|
|
206
|
+
pstPool?: undefined;
|
|
207
|
+
} & {
|
|
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>;
|
|
220
|
+
});
|
|
221
|
+
}[]>;
|
|
84
222
|
declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
85
223
|
connection: Connection;
|
|
86
224
|
signer?: PublicKey;
|
|
@@ -101,6 +239,7 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
101
239
|
singlePool?: undefined;
|
|
102
240
|
jupLend?: undefined;
|
|
103
241
|
chainlinkDataStreams?: undefined;
|
|
242
|
+
pstPool?: undefined;
|
|
104
243
|
} & {
|
|
105
244
|
pyth: Record<string, never>;
|
|
106
245
|
}) | ({
|
|
@@ -111,6 +250,7 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
111
250
|
singlePool?: undefined;
|
|
112
251
|
jupLend?: undefined;
|
|
113
252
|
chainlinkDataStreams?: undefined;
|
|
253
|
+
pstPool?: undefined;
|
|
114
254
|
} & {
|
|
115
255
|
stakePool: Record<string, never>;
|
|
116
256
|
}) | ({
|
|
@@ -121,6 +261,7 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
121
261
|
singlePool?: undefined;
|
|
122
262
|
jupLend?: undefined;
|
|
123
263
|
chainlinkDataStreams?: undefined;
|
|
264
|
+
pstPool?: undefined;
|
|
124
265
|
} & {
|
|
125
266
|
msolPool: Record<string, never>;
|
|
126
267
|
}) | ({
|
|
@@ -131,6 +272,7 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
131
272
|
singlePool?: undefined;
|
|
132
273
|
jupLend?: undefined;
|
|
133
274
|
chainlinkDataStreams?: undefined;
|
|
275
|
+
pstPool?: undefined;
|
|
134
276
|
} & {
|
|
135
277
|
redstone: Record<string, never>;
|
|
136
278
|
}) | ({
|
|
@@ -141,6 +283,7 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
141
283
|
singlePool?: undefined;
|
|
142
284
|
jupLend?: undefined;
|
|
143
285
|
chainlinkDataStreams?: undefined;
|
|
286
|
+
pstPool?: undefined;
|
|
144
287
|
} & {
|
|
145
288
|
chainlink: Record<string, never>;
|
|
146
289
|
}) | ({
|
|
@@ -151,6 +294,7 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
151
294
|
chainlink?: undefined;
|
|
152
295
|
jupLend?: undefined;
|
|
153
296
|
chainlinkDataStreams?: undefined;
|
|
297
|
+
pstPool?: undefined;
|
|
154
298
|
} & {
|
|
155
299
|
singlePool: Record<string, never>;
|
|
156
300
|
}) | ({
|
|
@@ -161,6 +305,7 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
161
305
|
chainlink?: undefined;
|
|
162
306
|
singlePool?: undefined;
|
|
163
307
|
chainlinkDataStreams?: undefined;
|
|
308
|
+
pstPool?: undefined;
|
|
164
309
|
} & {
|
|
165
310
|
jupLend: Record<string, never>;
|
|
166
311
|
}) | ({
|
|
@@ -171,8 +316,20 @@ declare function readOraclePrice({ connection, signer, oracle, }: {
|
|
|
171
316
|
chainlink?: undefined;
|
|
172
317
|
singlePool?: undefined;
|
|
173
318
|
jupLend?: undefined;
|
|
319
|
+
pstPool?: undefined;
|
|
174
320
|
} & {
|
|
175
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>;
|
|
176
333
|
});
|
|
177
334
|
}[];
|
|
178
335
|
}>;
|
|
@@ -224,4 +381,5 @@ declare const getAllLiquidations: (params: Omit<LiquidateParams, "debtAmount" |
|
|
|
224
381
|
}[];
|
|
225
382
|
}[]>;
|
|
226
383
|
|
|
227
|
-
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, 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,10 +1,13 @@
|
|
|
1
|
-
import { g as
|
|
2
|
-
export {
|
|
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';
|
|
3
5
|
import { PublicKey, TransactionMessage, ComputeBudgetProgram, VersionedTransaction } from '@solana/web3.js';
|
|
4
6
|
import BN from 'bn.js';
|
|
5
|
-
import { g as getVaultAdmin } from '../shared/lend.
|
|
7
|
+
import { g as getVaultAdmin } from '../shared/lend.a53XYkl5.mjs';
|
|
6
8
|
import '@coral-xyz/anchor';
|
|
7
9
|
import '@solana/spl-token';
|
|
10
|
+
import '../shared/lend.B80NmXTG.mjs';
|
|
8
11
|
import '../shared/lend.C3XdrR6R.mjs';
|
|
9
12
|
|
|
10
13
|
const simulateLiquidate = async (params) => {
|