@defisaver/positions-sdk 0.0.21 → 0.0.22

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 (58) hide show
  1. package/README.md +63 -63
  2. package/cjs/aaveV2/index.js +1 -3
  3. package/cjs/aaveV3/index.js +12 -14
  4. package/cjs/morphoAaveV3/index.js +1 -3
  5. package/cjs/spark/index.js +1 -3
  6. package/esm/aaveV2/index.js +2 -4
  7. package/esm/aaveV3/index.js +2 -4
  8. package/esm/morphoAaveV3/index.js +1 -3
  9. package/esm/spark/index.js +2 -4
  10. package/package.json +40 -40
  11. package/src/aaveV2/index.ts +226 -231
  12. package/src/aaveV3/index.ts +561 -565
  13. package/src/assets/index.ts +60 -60
  14. package/src/chickenBonds/index.ts +123 -123
  15. package/src/compoundV2/index.ts +219 -219
  16. package/src/compoundV3/index.ts +275 -275
  17. package/src/config/contracts.js +673 -673
  18. package/src/constants/index.ts +3 -3
  19. package/src/contracts.ts +100 -100
  20. package/src/curveUsd/index.ts +228 -228
  21. package/src/exchange/index.ts +17 -17
  22. package/src/helpers/aaveHelpers/index.ts +134 -134
  23. package/src/helpers/chickenBondsHelpers/index.ts +23 -23
  24. package/src/helpers/compoundHelpers/index.ts +181 -181
  25. package/src/helpers/curveUsdHelpers/index.ts +32 -32
  26. package/src/helpers/index.ts +5 -5
  27. package/src/helpers/makerHelpers/index.ts +94 -94
  28. package/src/helpers/sparkHelpers/index.ts +106 -106
  29. package/src/index.ts +40 -40
  30. package/src/liquity/index.ts +116 -116
  31. package/src/maker/index.ts +101 -101
  32. package/src/markets/aave/index.ts +80 -80
  33. package/src/markets/aave/marketAssets.ts +32 -32
  34. package/src/markets/compound/index.ts +141 -141
  35. package/src/markets/compound/marketsAssets.ts +46 -46
  36. package/src/markets/curveUsd/index.ts +69 -69
  37. package/src/markets/index.ts +3 -3
  38. package/src/markets/spark/index.ts +29 -29
  39. package/src/markets/spark/marketAssets.ts +9 -9
  40. package/src/moneymarket/moneymarketCommonService.ts +75 -75
  41. package/src/morpho/markets.ts +39 -39
  42. package/src/morphoAaveV2/index.ts +255 -255
  43. package/src/morphoAaveV3/index.ts +619 -624
  44. package/src/multicall/index.ts +22 -22
  45. package/src/services/dsrService.ts +15 -15
  46. package/src/services/priceService.ts +21 -21
  47. package/src/services/utils.ts +34 -34
  48. package/src/spark/index.ts +421 -425
  49. package/src/staking/staking.ts +167 -167
  50. package/src/types/aave.ts +256 -256
  51. package/src/types/chickenBonds.ts +45 -45
  52. package/src/types/common.ts +83 -83
  53. package/src/types/compound.ts +128 -128
  54. package/src/types/curveUsd.ts +112 -112
  55. package/src/types/index.ts +6 -6
  56. package/src/types/liquity.ts +30 -30
  57. package/src/types/maker.ts +50 -50
  58. package/src/types/spark.ts +106 -106
@@ -1,31 +1,31 @@
1
- export enum LIQUITY_TROVE_STATUS_ENUM {
2
- nonExistent,
3
- active,
4
- closedByOwner,
5
- closedByLiquidation,
6
- closedByRedemption,
7
- }
8
-
9
- export const LIQUITY_STATUS_MAPPING = {
10
- nonExistent: 'Non existent',
11
- active: 'Active',
12
- closedByOwner: 'Closed',
13
- closedByLiquidation: 'Liquidated',
14
- closedByRedemption: 'Redeemed',
15
- };
16
-
17
- export interface LiquityTroveInfo {
18
- troveStatus: string,
19
- collateral: string,
20
- debtInAsset: string,
21
- TCRatio: string,
22
- recoveryMode: boolean,
23
- claimableCollateral: string,
24
- borrowingRateWithDecay: string,
25
- assetPrice: string,
26
- totalETH: string,
27
- totalLUSD: string,
28
- minCollateralRatio: number,
29
- priceForRecovery: string,
30
- debtInFront: string,
1
+ export enum LIQUITY_TROVE_STATUS_ENUM {
2
+ nonExistent,
3
+ active,
4
+ closedByOwner,
5
+ closedByLiquidation,
6
+ closedByRedemption,
7
+ }
8
+
9
+ export const LIQUITY_STATUS_MAPPING = {
10
+ nonExistent: 'Non existent',
11
+ active: 'Active',
12
+ closedByOwner: 'Closed',
13
+ closedByLiquidation: 'Liquidated',
14
+ closedByRedemption: 'Redeemed',
15
+ };
16
+
17
+ export interface LiquityTroveInfo {
18
+ troveStatus: string,
19
+ collateral: string,
20
+ debtInAsset: string,
21
+ TCRatio: string,
22
+ recoveryMode: boolean,
23
+ claimableCollateral: string,
24
+ borrowingRateWithDecay: string,
25
+ assetPrice: string,
26
+ totalETH: string,
27
+ totalLUSD: string,
28
+ minCollateralRatio: number,
29
+ priceForRecovery: string,
30
+ debtInFront: string,
31
31
  }
@@ -1,51 +1,51 @@
1
- import { EthAddress } from './common';
2
-
3
- export interface IlkInfo {
4
- ilkLabel: string;
5
- currentRate: string;
6
- futureRate: string;
7
- minDebt: string;
8
- globalDebtCeiling: string;
9
- globalDebtCurrent: string;
10
- assetPrice: string;
11
- liqRatio: string;
12
- liqPercent: number;
13
- stabilityFee: number;
14
- liquidationFee: string;
15
- creatableDebt: string;
16
- }
17
-
18
- export interface CdpData {
19
- owner: EthAddress,
20
- userAddress: EthAddress,
21
- id: string,
22
- urn: EthAddress,
23
- type: string,
24
- ilk: string,
25
- ilkLabel: string,
26
- asset: string,
27
- collateral: string,
28
- collateralUsd: string,
29
- futureDebt: string,
30
- debtDai: string,
31
- debtUsd: string,
32
- debtInAsset: string,
33
- debtAssetPrice: string,
34
- debtAssetMarketPrice: string,
35
- liquidationPrice: string,
36
- ratio: string,
37
- liqRatio: string,
38
- liqPercent: number,
39
- assetPrice: string,
40
- daiLabel: string,
41
- debtAsset: string,
42
- unclaimedCollateral: string,
43
- debtTooLow: boolean,
44
- minDebt: string,
45
- stabilityFee: number,
46
- creatableDebt: string,
47
- globalDebtCeiling: string,
48
- globalDebtCurrent: string,
49
- liquidationFee: string,
50
- lastUpdated: number,
1
+ import { EthAddress } from './common';
2
+
3
+ export interface IlkInfo {
4
+ ilkLabel: string;
5
+ currentRate: string;
6
+ futureRate: string;
7
+ minDebt: string;
8
+ globalDebtCeiling: string;
9
+ globalDebtCurrent: string;
10
+ assetPrice: string;
11
+ liqRatio: string;
12
+ liqPercent: number;
13
+ stabilityFee: number;
14
+ liquidationFee: string;
15
+ creatableDebt: string;
16
+ }
17
+
18
+ export interface CdpData {
19
+ owner: EthAddress,
20
+ userAddress: EthAddress,
21
+ id: string,
22
+ urn: EthAddress,
23
+ type: string,
24
+ ilk: string,
25
+ ilkLabel: string,
26
+ asset: string,
27
+ collateral: string,
28
+ collateralUsd: string,
29
+ futureDebt: string,
30
+ debtDai: string,
31
+ debtUsd: string,
32
+ debtInAsset: string,
33
+ debtAssetPrice: string,
34
+ debtAssetMarketPrice: string,
35
+ liquidationPrice: string,
36
+ ratio: string,
37
+ liqRatio: string,
38
+ liqPercent: number,
39
+ assetPrice: string,
40
+ daiLabel: string,
41
+ debtAsset: string,
42
+ unclaimedCollateral: string,
43
+ debtTooLow: boolean,
44
+ minDebt: string,
45
+ stabilityFee: number,
46
+ creatableDebt: string,
47
+ globalDebtCeiling: string,
48
+ globalDebtCurrent: string,
49
+ liquidationFee: string,
50
+ lastUpdated: number,
51
51
  }
@@ -1,107 +1,107 @@
1
- import { EModeCategoryData, EModeCategoryDataMapping } from './aave';
2
- import {
3
- MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber,
4
- } from './common';
5
-
6
- export enum SparkVersions {
7
- SparkV1 = 'v1default',
8
- }
9
-
10
- export interface SparkMarketData {
11
- chainIds: NetworkNumber[],
12
- label: string,
13
- shortLabel: string,
14
- url: string,
15
- value: SparkVersions,
16
- assets: readonly string[],
17
- provider: '' | 'SparkPoolAddressesProvider',
18
- providerAddress: string,
19
- lendingPool: 'SparkLendingPool',
20
- lendingPoolAddress: string,
21
- protocolData: '' | 'SparkProtocolDataProvider',
22
- protocolDataAddress: string
23
- subVersionLabel?: string
24
- // icon: Function,
25
- protocolName: string,
26
- disabled?: boolean,
27
- }
28
-
29
- export interface SparkAssetData extends MMAssetData {
30
- totalBorrowVar: string,
31
- sortIndex?: number,
32
- usageAsCollateralEnabled: boolean,
33
- isIsolated: boolean,
34
- eModeCategory: number,
35
- eModeCategoryData: EModeCategoryData,
36
- liquidationRatio: string,
37
- }
38
-
39
- export interface SparkAssetsData {
40
- [token: string]: SparkAssetData,
41
- }
42
-
43
- export type SparkMarketsData = { assetsData: SparkAssetsData };
44
-
45
- export interface SparkUsedAsset extends MMUsedAsset {
46
- stableBorrowRate: string,
47
- borrowedStable: string,
48
- borrowedVariable: string,
49
- borrowedUsdStable: string,
50
- borrowedUsdVariable: string,
51
- stableLimit: string,
52
- variableLimit: string,
53
- limit: string,
54
- eModeCategory: number,
55
- }
56
-
57
- export interface SparkUsedAssets {
58
- [token: string]: SparkUsedAsset,
59
- }
60
-
61
- export interface SparkHelperCommon {
62
- usedAssets: SparkUsedAssets,
63
- eModeCategory: number,
64
- eModeCategories?: object,
65
- assetsData: SparkAssetsData,
66
- selectedMarket?: SparkMarketData,
67
- network?: NetworkNumber,
68
- }
69
-
70
- export interface SparkAggregatedPositionData {
71
- suppliedUsd: string,
72
- suppliedCollateralUsd: string,
73
- borrowedUsd: string,
74
- borrowLimitUsd: string,
75
- liquidationLimitUsd: string,
76
- leftToBorrowUsd: string,
77
- ratio: string,
78
- collRatio: string,
79
- netApy: string,
80
- incentiveUsd: string,
81
- totalInterestUsd: string,
82
- liqRatio: string,
83
- liqPercent: string,
84
- leveragedType: string,
85
- leveragedAsset?: string,
86
- leveragedLsdAssetRatio?: string,
87
- liquidationPrice?: string,
88
- }
89
-
90
- export interface SparkPositionData extends MMPositionData {
91
- ratio: string,
92
- minRatio: string,
93
- collRatio: string,
94
- borrowedUsd: string,
95
- borrowLimitUsd: string,
96
- suppliedCollateralUsd: string,
97
- incentiveUsd: string,
98
- totalInterestUsd: string,
99
- isSubscribedToAutomation?: boolean,
100
- automationResubscribeRequired?: boolean,
101
- totalSupplied: string,
102
- usedAssets: SparkUsedAssets,
103
- eModeCategory: number,
104
- isInIsolationMode: boolean,
105
- isInSiloedMode: boolean,
106
- eModeCategories: { [key: number]: EModeCategoryDataMapping },
1
+ import { EModeCategoryData, EModeCategoryDataMapping } from './aave';
2
+ import {
3
+ MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber,
4
+ } from './common';
5
+
6
+ export enum SparkVersions {
7
+ SparkV1 = 'v1default',
8
+ }
9
+
10
+ export interface SparkMarketData {
11
+ chainIds: NetworkNumber[],
12
+ label: string,
13
+ shortLabel: string,
14
+ url: string,
15
+ value: SparkVersions,
16
+ assets: readonly string[],
17
+ provider: '' | 'SparkPoolAddressesProvider',
18
+ providerAddress: string,
19
+ lendingPool: 'SparkLendingPool',
20
+ lendingPoolAddress: string,
21
+ protocolData: '' | 'SparkProtocolDataProvider',
22
+ protocolDataAddress: string
23
+ subVersionLabel?: string
24
+ // icon: Function,
25
+ protocolName: string,
26
+ disabled?: boolean,
27
+ }
28
+
29
+ export interface SparkAssetData extends MMAssetData {
30
+ totalBorrowVar: string,
31
+ sortIndex?: number,
32
+ usageAsCollateralEnabled: boolean,
33
+ isIsolated: boolean,
34
+ eModeCategory: number,
35
+ eModeCategoryData: EModeCategoryData,
36
+ liquidationRatio: string,
37
+ }
38
+
39
+ export interface SparkAssetsData {
40
+ [token: string]: SparkAssetData,
41
+ }
42
+
43
+ export type SparkMarketsData = { assetsData: SparkAssetsData };
44
+
45
+ export interface SparkUsedAsset extends MMUsedAsset {
46
+ stableBorrowRate: string,
47
+ borrowedStable: string,
48
+ borrowedVariable: string,
49
+ borrowedUsdStable: string,
50
+ borrowedUsdVariable: string,
51
+ stableLimit: string,
52
+ variableLimit: string,
53
+ limit: string,
54
+ eModeCategory: number,
55
+ }
56
+
57
+ export interface SparkUsedAssets {
58
+ [token: string]: SparkUsedAsset,
59
+ }
60
+
61
+ export interface SparkHelperCommon {
62
+ usedAssets: SparkUsedAssets,
63
+ eModeCategory: number,
64
+ eModeCategories?: object,
65
+ assetsData: SparkAssetsData,
66
+ selectedMarket?: SparkMarketData,
67
+ network?: NetworkNumber,
68
+ }
69
+
70
+ export interface SparkAggregatedPositionData {
71
+ suppliedUsd: string,
72
+ suppliedCollateralUsd: string,
73
+ borrowedUsd: string,
74
+ borrowLimitUsd: string,
75
+ liquidationLimitUsd: string,
76
+ leftToBorrowUsd: string,
77
+ ratio: string,
78
+ collRatio: string,
79
+ netApy: string,
80
+ incentiveUsd: string,
81
+ totalInterestUsd: string,
82
+ liqRatio: string,
83
+ liqPercent: string,
84
+ leveragedType: string,
85
+ leveragedAsset?: string,
86
+ leveragedLsdAssetRatio?: string,
87
+ liquidationPrice?: string,
88
+ }
89
+
90
+ export interface SparkPositionData extends MMPositionData {
91
+ ratio: string,
92
+ minRatio: string,
93
+ collRatio: string,
94
+ borrowedUsd: string,
95
+ borrowLimitUsd: string,
96
+ suppliedCollateralUsd: string,
97
+ incentiveUsd: string,
98
+ totalInterestUsd: string,
99
+ isSubscribedToAutomation?: boolean,
100
+ automationResubscribeRequired?: boolean,
101
+ totalSupplied: string,
102
+ usedAssets: SparkUsedAssets,
103
+ eModeCategory: number,
104
+ isInIsolationMode: boolean,
105
+ isInSiloedMode: boolean,
106
+ eModeCategories: { [key: number]: EModeCategoryDataMapping },
107
107
  }