@defisaver/positions-sdk 1.0.12 → 1.0.13-dev-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.
Files changed (38) hide show
  1. package/cjs/config/contracts.d.ts +61 -21
  2. package/cjs/config/contracts.js +9 -1
  3. package/cjs/contracts.d.ts +1 -0
  4. package/cjs/contracts.js +2 -1
  5. package/cjs/liquityV2/index.js +17 -6
  6. package/cjs/markets/aave/marketAssets.js +1 -1
  7. package/cjs/markets/liquityV2/index.d.ts +6 -0
  8. package/cjs/markets/liquityV2/index.js +51 -4
  9. package/cjs/types/contracts/generated/LiquityV2LegacyView.d.ts +386 -0
  10. package/cjs/types/contracts/generated/LiquityV2LegacyView.js +5 -0
  11. package/cjs/types/contracts/generated/LiquityV2View.d.ts +4 -0
  12. package/cjs/types/contracts/generated/index.d.ts +1 -0
  13. package/cjs/types/liquityV2.d.ts +6 -1
  14. package/cjs/types/liquityV2.js +4 -0
  15. package/esm/config/contracts.d.ts +61 -21
  16. package/esm/config/contracts.js +9 -1
  17. package/esm/contracts.d.ts +1 -0
  18. package/esm/contracts.js +1 -0
  19. package/esm/liquityV2/index.js +18 -7
  20. package/esm/markets/aave/marketAssets.js +1 -1
  21. package/esm/markets/liquityV2/index.d.ts +6 -0
  22. package/esm/markets/liquityV2/index.js +46 -2
  23. package/esm/types/contracts/generated/LiquityV2LegacyView.d.ts +386 -0
  24. package/esm/types/contracts/generated/LiquityV2LegacyView.js +4 -0
  25. package/esm/types/contracts/generated/LiquityV2View.d.ts +4 -0
  26. package/esm/types/contracts/generated/index.d.ts +1 -0
  27. package/esm/types/liquityV2.d.ts +6 -1
  28. package/esm/types/liquityV2.js +4 -0
  29. package/package.json +3 -3
  30. package/src/config/contracts.js +9 -1
  31. package/src/contracts.ts +2 -0
  32. package/src/liquityV2/index.ts +20 -7
  33. package/src/markets/aave/marketAssets.ts +1 -1
  34. package/src/markets/liquityV2/index.ts +50 -2
  35. package/src/types/contracts/generated/LiquityV2LegacyView.ts +486 -0
  36. package/src/types/contracts/generated/LiquityV2View.ts +4 -0
  37. package/src/types/contracts/generated/index.ts +1 -0
  38. package/src/types/liquityV2.ts +6 -0
@@ -0,0 +1,486 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ import type BN from "bn.js";
6
+ import type { ContractOptions } from "web3-eth-contract";
7
+ import type { EventLog } from "web3-core";
8
+ import type { EventEmitter } from "events";
9
+ import type {
10
+ Callback,
11
+ PayableTransactionObject,
12
+ NonPayableTransactionObject,
13
+ BlockType,
14
+ ContractEventLog,
15
+ BaseContract,
16
+ } from "./types";
17
+
18
+ export interface EventOptions {
19
+ filter?: object;
20
+ fromBlock?: BlockType;
21
+ topics?: string[];
22
+ }
23
+
24
+ export declare namespace IBorrowerOperations {
25
+ export type InterestBatchManagerStruct =
26
+ | [number | string | BN, number | string | BN, number | string | BN]
27
+ | {
28
+ minInterestRate: number | string | BN;
29
+ maxInterestRate: number | string | BN;
30
+ minInterestRateChangePeriod: number | string | BN;
31
+ };
32
+
33
+ export type InterestBatchManagerStructOutputArray = [string, string, string];
34
+ export type InterestBatchManagerStructOutputStruct = {
35
+ minInterestRate: string;
36
+ maxInterestRate: string;
37
+ minInterestRateChangePeriod: string;
38
+ };
39
+ export type InterestBatchManagerStructOutput =
40
+ InterestBatchManagerStructOutputArray &
41
+ InterestBatchManagerStructOutputStruct;
42
+ }
43
+
44
+ export declare namespace ITroveManager {
45
+ export type LatestBatchDataStruct =
46
+ | [
47
+ number | string | BN,
48
+ number | string | BN,
49
+ number | string | BN,
50
+ number | string | BN,
51
+ number | string | BN,
52
+ number | string | BN,
53
+ number | string | BN,
54
+ number | string | BN,
55
+ number | string | BN,
56
+ number | string | BN,
57
+ number | string | BN
58
+ ]
59
+ | {
60
+ entireDebtWithoutRedistribution: number | string | BN;
61
+ entireCollWithoutRedistribution: number | string | BN;
62
+ accruedInterest: number | string | BN;
63
+ recordedDebt: number | string | BN;
64
+ annualInterestRate: number | string | BN;
65
+ weightedRecordedDebt: number | string | BN;
66
+ annualManagementFee: number | string | BN;
67
+ accruedManagementFee: number | string | BN;
68
+ weightedRecordedBatchManagementFee: number | string | BN;
69
+ lastDebtUpdateTime: number | string | BN;
70
+ lastInterestRateAdjTime: number | string | BN;
71
+ };
72
+
73
+ export type LatestBatchDataStructOutputArray = [
74
+ string,
75
+ string,
76
+ string,
77
+ string,
78
+ string,
79
+ string,
80
+ string,
81
+ string,
82
+ string,
83
+ string,
84
+ string
85
+ ];
86
+ export type LatestBatchDataStructOutputStruct = {
87
+ entireDebtWithoutRedistribution: string;
88
+ entireCollWithoutRedistribution: string;
89
+ accruedInterest: string;
90
+ recordedDebt: string;
91
+ annualInterestRate: string;
92
+ weightedRecordedDebt: string;
93
+ annualManagementFee: string;
94
+ accruedManagementFee: string;
95
+ weightedRecordedBatchManagementFee: string;
96
+ lastDebtUpdateTime: string;
97
+ lastInterestRateAdjTime: string;
98
+ };
99
+ export type LatestBatchDataStructOutput = LatestBatchDataStructOutputArray &
100
+ LatestBatchDataStructOutputStruct;
101
+ }
102
+
103
+ export declare namespace LiquityV2View {
104
+ export type MarketDataStruct =
105
+ | [
106
+ string,
107
+ number | string | BN,
108
+ number | string | BN,
109
+ number | string | BN,
110
+ number | string | BN,
111
+ number | string | BN,
112
+ number | string | BN,
113
+ number | string | BN,
114
+ string,
115
+ string,
116
+ string,
117
+ string,
118
+ string,
119
+ string,
120
+ string,
121
+ string,
122
+ string,
123
+ string,
124
+ number | string | BN,
125
+ boolean,
126
+ number | string | BN
127
+ ]
128
+ | {
129
+ market: string;
130
+ CCR: number | string | BN;
131
+ MCR: number | string | BN;
132
+ SCR: number | string | BN;
133
+ LIQUIDATION_PENALTY_SP: number | string | BN;
134
+ LIQUIDATION_PENALTY_REDISTRIBUTION: number | string | BN;
135
+ entireSystemColl: number | string | BN;
136
+ entireSystemDebt: number | string | BN;
137
+ collToken: string;
138
+ troveNFT: string;
139
+ borrowerOperations: string;
140
+ troveManager: string;
141
+ stabilityPool: string;
142
+ sortedTroves: string;
143
+ collSurplusPool: string;
144
+ activePool: string;
145
+ hintHelpers: string;
146
+ priceFeed: string;
147
+ collPrice: number | string | BN;
148
+ isShutDown: boolean;
149
+ boldDepositInSp: number | string | BN;
150
+ };
151
+
152
+ export type MarketDataStructOutputArray = [
153
+ string,
154
+ string,
155
+ string,
156
+ string,
157
+ string,
158
+ string,
159
+ string,
160
+ string,
161
+ string,
162
+ string,
163
+ string,
164
+ string,
165
+ string,
166
+ string,
167
+ string,
168
+ string,
169
+ string,
170
+ string,
171
+ string,
172
+ boolean,
173
+ string
174
+ ];
175
+ export type MarketDataStructOutputStruct = {
176
+ market: string;
177
+ CCR: string;
178
+ MCR: string;
179
+ SCR: string;
180
+ LIQUIDATION_PENALTY_SP: string;
181
+ LIQUIDATION_PENALTY_REDISTRIBUTION: string;
182
+ entireSystemColl: string;
183
+ entireSystemDebt: string;
184
+ collToken: string;
185
+ troveNFT: string;
186
+ borrowerOperations: string;
187
+ troveManager: string;
188
+ stabilityPool: string;
189
+ sortedTroves: string;
190
+ collSurplusPool: string;
191
+ activePool: string;
192
+ hintHelpers: string;
193
+ priceFeed: string;
194
+ collPrice: string;
195
+ isShutDown: boolean;
196
+ boldDepositInSp: string;
197
+ };
198
+ export type MarketDataStructOutput = MarketDataStructOutputArray &
199
+ MarketDataStructOutputStruct;
200
+
201
+ export type TroveDataStruct =
202
+ | [
203
+ number | string | BN,
204
+ string,
205
+ string,
206
+ number | string | BN,
207
+ number | string | BN,
208
+ number | string | BN,
209
+ number | string | BN,
210
+ number | string | BN,
211
+ number | string | BN,
212
+ string,
213
+ number | string | BN,
214
+ number | string | BN
215
+ ]
216
+ | {
217
+ troveId: number | string | BN;
218
+ owner: string;
219
+ collToken: string;
220
+ status: number | string | BN;
221
+ collAmount: number | string | BN;
222
+ debtAmount: number | string | BN;
223
+ collPrice: number | string | BN;
224
+ TCRatio: number | string | BN;
225
+ annualInterestRate: number | string | BN;
226
+ interestBatchManager: string;
227
+ batchDebtShares: number | string | BN;
228
+ lastInterestRateAdjTime: number | string | BN;
229
+ };
230
+
231
+ export type TroveDataStructOutputArray = [
232
+ string,
233
+ string,
234
+ string,
235
+ string,
236
+ string,
237
+ string,
238
+ string,
239
+ string,
240
+ string,
241
+ string,
242
+ string,
243
+ string
244
+ ];
245
+ export type TroveDataStructOutputStruct = {
246
+ troveId: string;
247
+ owner: string;
248
+ collToken: string;
249
+ status: string;
250
+ collAmount: string;
251
+ debtAmount: string;
252
+ collPrice: string;
253
+ TCRatio: string;
254
+ annualInterestRate: string;
255
+ interestBatchManager: string;
256
+ batchDebtShares: string;
257
+ lastInterestRateAdjTime: string;
258
+ };
259
+ export type TroveDataStructOutput = TroveDataStructOutputArray &
260
+ TroveDataStructOutputStruct;
261
+
262
+ export type ExistingTroveStruct =
263
+ | [number | string | BN, boolean]
264
+ | { troveId: number | string | BN; ownedByUser: boolean };
265
+
266
+ export type ExistingTroveStructOutputArray = [string, boolean];
267
+ export type ExistingTroveStructOutputStruct = {
268
+ troveId: string;
269
+ ownedByUser: boolean;
270
+ };
271
+ export type ExistingTroveStructOutput = ExistingTroveStructOutputArray &
272
+ ExistingTroveStructOutputStruct;
273
+ }
274
+
275
+ export declare namespace IMultiTroveGetter {
276
+ export type CombinedTroveDataStruct =
277
+ | [
278
+ number | string | BN,
279
+ number | string | BN,
280
+ number | string | BN,
281
+ number | string | BN,
282
+ number | string | BN,
283
+ number | string | BN,
284
+ number | string | BN,
285
+ string,
286
+ number | string | BN,
287
+ number | string | BN,
288
+ number | string | BN,
289
+ number | string | BN
290
+ ]
291
+ | {
292
+ id: number | string | BN;
293
+ debt: number | string | BN;
294
+ coll: number | string | BN;
295
+ stake: number | string | BN;
296
+ annualInterestRate: number | string | BN;
297
+ lastDebtUpdateTime: number | string | BN;
298
+ lastInterestRateAdjTime: number | string | BN;
299
+ interestBatchManager: string;
300
+ batchDebtShares: number | string | BN;
301
+ batchCollShares: number | string | BN;
302
+ snapshotETH: number | string | BN;
303
+ snapshotBoldDebt: number | string | BN;
304
+ };
305
+
306
+ export type CombinedTroveDataStructOutputArray = [
307
+ string,
308
+ string,
309
+ string,
310
+ string,
311
+ string,
312
+ string,
313
+ string,
314
+ string,
315
+ string,
316
+ string,
317
+ string,
318
+ string
319
+ ];
320
+ export type CombinedTroveDataStructOutputStruct = {
321
+ id: string;
322
+ debt: string;
323
+ coll: string;
324
+ stake: string;
325
+ annualInterestRate: string;
326
+ lastDebtUpdateTime: string;
327
+ lastInterestRateAdjTime: string;
328
+ interestBatchManager: string;
329
+ batchDebtShares: string;
330
+ batchCollShares: string;
331
+ snapshotETH: string;
332
+ snapshotBoldDebt: string;
333
+ };
334
+ export type CombinedTroveDataStructOutput =
335
+ CombinedTroveDataStructOutputArray & CombinedTroveDataStructOutputStruct;
336
+ }
337
+
338
+ export interface LiquityV2LegacyView extends BaseContract {
339
+ constructor(
340
+ jsonInterface: any[],
341
+ address?: string,
342
+ options?: ContractOptions
343
+ ): LiquityV2LegacyView;
344
+ clone(): LiquityV2LegacyView;
345
+ methods: {
346
+ findInsertPosition(
347
+ _market: string,
348
+ _interestRate: number | string | BN,
349
+ _prevId: number | string | BN,
350
+ _nextId: number | string | BN
351
+ ): NonPayableTransactionObject<
352
+ [string, string] & { prevId: string; nextId: string }
353
+ >;
354
+
355
+ getApproxHint(
356
+ _market: string,
357
+ _collIndex: number | string | BN,
358
+ _interestRate: number | string | BN,
359
+ _numTrials: number | string | BN,
360
+ _inputRandomSeed: number | string | BN
361
+ ): NonPayableTransactionObject<
362
+ [string, string, string] & {
363
+ hintId: string;
364
+ diff: string;
365
+ latestRandomSeed: string;
366
+ }
367
+ >;
368
+
369
+ getBatchManagerInfo(
370
+ _market: string,
371
+ _manager: string
372
+ ): NonPayableTransactionObject<
373
+ [
374
+ IBorrowerOperations.InterestBatchManagerStructOutput,
375
+ ITroveManager.LatestBatchDataStructOutput
376
+ ] & {
377
+ managerData: IBorrowerOperations.InterestBatchManagerStructOutput;
378
+ batchData: ITroveManager.LatestBatchDataStructOutput;
379
+ }
380
+ >;
381
+
382
+ getDebtInFront(
383
+ _market: string,
384
+ _troveId: number | string | BN,
385
+ _acc: number | string | BN,
386
+ _iterations: number | string | BN
387
+ ): NonPayableTransactionObject<
388
+ [string, string] & { next: string; debt: string }
389
+ >;
390
+
391
+ getDebtInFrontByInterestRate(
392
+ _market: string,
393
+ _troveId: number | string | BN,
394
+ _acc: number | string | BN,
395
+ _iterations: number | string | BN,
396
+ _targetIR: number | string | BN
397
+ ): NonPayableTransactionObject<
398
+ [string, string] & { next: string; debt: string }
399
+ >;
400
+
401
+ getDebtInFrontByTroveNum(
402
+ _market: string,
403
+ _numTroves: number | string | BN
404
+ ): NonPayableTransactionObject<string>;
405
+
406
+ getDepositorInfo(
407
+ _market: string,
408
+ _depositor: string
409
+ ): NonPayableTransactionObject<
410
+ [string, string, string] & {
411
+ compoundedBOLD: string;
412
+ collGain: string;
413
+ boldGain: string;
414
+ }
415
+ >;
416
+
417
+ getInsertPosition(
418
+ _market: string,
419
+ _collIndex: number | string | BN,
420
+ _interestRate: number | string | BN,
421
+ _numTrials: number | string | BN,
422
+ _inputRandomSeed: number | string | BN
423
+ ): NonPayableTransactionObject<
424
+ [string, string] & { prevId: string; nextId: string }
425
+ >;
426
+
427
+ getMarketData(
428
+ _market: string
429
+ ): NonPayableTransactionObject<LiquityV2View.MarketDataStructOutput>;
430
+
431
+ getMultipleSortedTroves(
432
+ _market: string,
433
+ _startIdx: number | string | BN,
434
+ _count: number | string | BN
435
+ ): NonPayableTransactionObject<
436
+ IMultiTroveGetter.CombinedTroveDataStructOutput[]
437
+ >;
438
+
439
+ getNumOfTrovesInFrontOfTrove(
440
+ _market: string,
441
+ _troveId: number | string | BN,
442
+ _iterations: number | string | BN
443
+ ): NonPayableTransactionObject<
444
+ [string, string] & { next: string; numTroves: string }
445
+ >;
446
+
447
+ getTroveInfo(
448
+ _market: string,
449
+ _troveId: number | string | BN
450
+ ): NonPayableTransactionObject<LiquityV2View.TroveDataStructOutput>;
451
+
452
+ getTrovePosition(
453
+ _market: string,
454
+ _collIndex: number | string | BN,
455
+ _troveId: number | string | BN,
456
+ _numTrials: number | string | BN,
457
+ _inputRandomSeed: number | string | BN
458
+ ): NonPayableTransactionObject<
459
+ [string, string] & { prevId: string; nextId: string }
460
+ >;
461
+
462
+ getUserTroves(
463
+ _user: string,
464
+ _market: string,
465
+ _startIndex: number | string | BN,
466
+ _endIndex: number | string | BN
467
+ ): NonPayableTransactionObject<
468
+ [LiquityV2View.ExistingTroveStructOutput[], string] & {
469
+ troves: LiquityV2View.ExistingTroveStructOutput[];
470
+ nextFreeTroveIndex: string;
471
+ }
472
+ >;
473
+
474
+ isShutDown(_market: string): NonPayableTransactionObject<boolean>;
475
+
476
+ predictAdjustTroveUpfrontFee(
477
+ _market: string,
478
+ _collIndex: number | string | BN,
479
+ _troveId: number | string | BN,
480
+ _debtIncrease: number | string | BN
481
+ ): NonPayableTransactionObject<string>;
482
+ };
483
+ events: {
484
+ allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
485
+ };
486
+ }
@@ -111,6 +111,7 @@ export declare namespace LiquityV2View {
111
111
  number | string | BN,
112
112
  number | string | BN,
113
113
  number | string | BN,
114
+ number | string | BN,
114
115
  string,
115
116
  string,
116
117
  string,
@@ -130,6 +131,7 @@ export declare namespace LiquityV2View {
130
131
  CCR: number | string | BN;
131
132
  MCR: number | string | BN;
132
133
  SCR: number | string | BN;
134
+ BCR: number | string | BN;
133
135
  LIQUIDATION_PENALTY_SP: number | string | BN;
134
136
  LIQUIDATION_PENALTY_REDISTRIBUTION: number | string | BN;
135
137
  entireSystemColl: number | string | BN;
@@ -169,6 +171,7 @@ export declare namespace LiquityV2View {
169
171
  string,
170
172
  string,
171
173
  string,
174
+ string,
172
175
  boolean,
173
176
  string
174
177
  ];
@@ -177,6 +180,7 @@ export declare namespace LiquityV2View {
177
180
  CCR: string;
178
181
  MCR: string;
179
182
  SCR: string;
183
+ BCR: string;
180
184
  LIQUIDATION_PENALTY_SP: string;
181
185
  LIQUIDATION_PENALTY_REDISTRIBUTION: string;
182
186
  entireSystemColl: string;
@@ -41,6 +41,7 @@ export type { LendingPoolAddressesProvider } from "./LendingPoolAddressesProvide
41
41
  export type { Lido } from "./Lido";
42
42
  export type { LiquityActivePool } from "./LiquityActivePool";
43
43
  export type { LiquityV2CollSurplusPool } from "./LiquityV2CollSurplusPool";
44
+ export type { LiquityV2LegacyView } from "./LiquityV2LegacyView";
44
45
  export type { LiquityV2StabilityPool } from "./LiquityV2StabilityPool";
45
46
  export type { LiquityV2TroveNFT } from "./LiquityV2TroveNFT";
46
47
  export type { LiquityV2View } from "./LiquityV2View";
@@ -4,6 +4,10 @@ export enum LiquityV2Versions {
4
4
  LiquityV2Eth = 'liquityv2eth',
5
5
  LiquityV2WstEth = 'liquityv2wsteth',
6
6
  LiquityV2REth = 'liquityv2reth',
7
+ // Legacy
8
+ LiquityV2EthLegacy = 'liquityv2ethlegacy',
9
+ LiquityV2WstEthLegacy = 'liquityv2wstethlegacy',
10
+ LiquityV2REthLegacy = 'liquityv2rethlegacy',
7
11
  }
8
12
 
9
13
  export enum LIQUITY_V2_TROVE_STATUS_ENUM {
@@ -32,6 +36,7 @@ export interface LiquityV2MarketInfo {
32
36
  collateralToken: string,
33
37
  marketAddress: string,
34
38
  protocolName: string,
39
+ isLegacy: boolean,
35
40
  }
36
41
 
37
42
  export interface LiquityV2AssetData {
@@ -54,6 +59,7 @@ export interface InnerLiquityV2MarketData {
54
59
  minCollRatio: string,
55
60
  totalCollRatio: string,
56
61
  criticalCollRatio: string,
62
+ batchCollRatio: string,
57
63
  isUnderCollateralized: boolean,
58
64
  hintHelperAddress: EthAddress,
59
65
  troveNFTAddress: EthAddress,