@defisaver/positions-sdk 0.0.166-dev → 0.0.166-dev-liquity-v2

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 (156) hide show
  1. package/.mocharc.json +4 -4
  2. package/.nvmrc +1 -1
  3. package/README.md +69 -69
  4. package/cjs/config/contracts.d.ts +3 -32
  5. package/cjs/config/contracts.js +3 -3
  6. package/cjs/contracts.d.ts +1 -1
  7. package/cjs/contracts.js +2 -2
  8. package/cjs/helpers/index.d.ts +1 -1
  9. package/cjs/helpers/index.js +2 -2
  10. package/cjs/helpers/liquityV2Helpers/index.d.ts +12 -0
  11. package/cjs/helpers/liquityV2Helpers/index.js +53 -0
  12. package/cjs/index.d.ts +2 -2
  13. package/cjs/index.js +3 -3
  14. package/cjs/liquityV2/index.d.ts +10 -0
  15. package/cjs/liquityV2/index.js +94 -0
  16. package/cjs/markets/compound/marketsAssets.js +3 -3
  17. package/cjs/markets/index.d.ts +1 -1
  18. package/cjs/markets/index.js +3 -3
  19. package/cjs/markets/liquityV2/index.d.ts +8 -0
  20. package/cjs/markets/liquityV2/index.js +34 -0
  21. package/cjs/markets/morphoBlue/index.d.ts +4 -0
  22. package/cjs/markets/morphoBlue/index.js +36 -1
  23. package/cjs/markets/spark/marketAssets.js +1 -1
  24. package/cjs/services/utils.d.ts +0 -2
  25. package/cjs/services/utils.js +1 -4
  26. package/cjs/staking/staking.d.ts +1 -0
  27. package/cjs/staking/staking.js +31 -2
  28. package/cjs/types/contracts/generated/LiquityV2View.d.ts +222 -0
  29. package/cjs/types/contracts/generated/index.d.ts +1 -1
  30. package/cjs/types/index.d.ts +1 -1
  31. package/cjs/types/index.js +1 -1
  32. package/cjs/types/liquityV2.d.ts +73 -0
  33. package/cjs/types/liquityV2.js +8 -0
  34. package/cjs/types/morphoBlue.d.ts +3 -1
  35. package/cjs/types/morphoBlue.js +2 -0
  36. package/esm/config/contracts.d.ts +3 -32
  37. package/esm/config/contracts.js +3 -3
  38. package/esm/contracts.d.ts +1 -1
  39. package/esm/contracts.js +1 -1
  40. package/esm/helpers/index.d.ts +1 -1
  41. package/esm/helpers/index.js +1 -1
  42. package/esm/helpers/liquityV2Helpers/index.d.ts +12 -0
  43. package/esm/helpers/liquityV2Helpers/index.js +45 -0
  44. package/esm/index.d.ts +2 -2
  45. package/esm/index.js +2 -2
  46. package/esm/liquityV2/index.d.ts +10 -0
  47. package/esm/liquityV2/index.js +86 -0
  48. package/esm/markets/compound/marketsAssets.js +3 -3
  49. package/esm/markets/index.d.ts +1 -1
  50. package/esm/markets/index.js +1 -1
  51. package/esm/markets/liquityV2/index.d.ts +8 -0
  52. package/esm/markets/liquityV2/index.js +28 -0
  53. package/esm/markets/morphoBlue/index.d.ts +4 -0
  54. package/esm/markets/morphoBlue/index.js +33 -0
  55. package/esm/markets/spark/marketAssets.js +1 -1
  56. package/esm/services/utils.d.ts +0 -2
  57. package/esm/services/utils.js +0 -2
  58. package/esm/staking/staking.d.ts +1 -0
  59. package/esm/staking/staking.js +29 -1
  60. package/esm/types/contracts/generated/LiquityV2View.d.ts +222 -0
  61. package/esm/types/contracts/generated/index.d.ts +1 -1
  62. package/esm/types/index.d.ts +1 -1
  63. package/esm/types/index.js +1 -1
  64. package/esm/types/liquityV2.d.ts +73 -0
  65. package/esm/types/liquityV2.js +5 -0
  66. package/esm/types/morphoBlue.d.ts +3 -1
  67. package/esm/types/morphoBlue.js +2 -0
  68. package/package.json +49 -44
  69. package/src/aaveV2/index.ts +227 -227
  70. package/src/aaveV3/index.ts +590 -590
  71. package/src/assets/index.ts +60 -60
  72. package/src/chickenBonds/index.ts +123 -123
  73. package/src/compoundV2/index.ts +219 -219
  74. package/src/compoundV3/index.ts +281 -281
  75. package/src/config/contracts.js +1040 -1040
  76. package/src/constants/index.ts +6 -6
  77. package/src/contracts.ts +130 -130
  78. package/src/curveUsd/index.ts +229 -229
  79. package/src/exchange/index.ts +17 -17
  80. package/src/helpers/aaveHelpers/index.ts +194 -194
  81. package/src/helpers/chickenBondsHelpers/index.ts +23 -23
  82. package/src/helpers/compoundHelpers/index.ts +246 -246
  83. package/src/helpers/curveUsdHelpers/index.ts +40 -40
  84. package/src/helpers/index.ts +9 -9
  85. package/src/helpers/liquityV2Helpers/index.ts +69 -0
  86. package/src/helpers/llamaLendHelpers/index.ts +53 -53
  87. package/src/helpers/makerHelpers/index.ts +94 -94
  88. package/src/helpers/morphoBlueHelpers/index.ts +115 -115
  89. package/src/helpers/sparkHelpers/index.ts +150 -150
  90. package/src/index.ts +48 -48
  91. package/src/liquity/index.ts +116 -116
  92. package/src/liquityV2/index.ts +111 -0
  93. package/src/llamaLend/index.ts +275 -275
  94. package/src/maker/index.ts +117 -117
  95. package/src/markets/aave/index.ts +152 -152
  96. package/src/markets/aave/marketAssets.ts +46 -46
  97. package/src/markets/compound/index.ts +173 -173
  98. package/src/markets/compound/marketsAssets.ts +64 -64
  99. package/src/markets/curveUsd/index.ts +69 -69
  100. package/src/markets/index.ts +23 -24
  101. package/src/markets/liquityV2/index.ts +31 -0
  102. package/src/markets/llamaLend/contractAddresses.ts +141 -141
  103. package/src/markets/llamaLend/index.ts +235 -235
  104. package/src/markets/morphoBlue/index.ts +728 -691
  105. package/src/markets/spark/index.ts +29 -29
  106. package/src/markets/spark/marketAssets.ts +10 -10
  107. package/src/moneymarket/moneymarketCommonService.ts +80 -80
  108. package/src/morphoAaveV2/index.ts +256 -256
  109. package/src/morphoAaveV3/index.ts +630 -630
  110. package/src/morphoBlue/index.ts +171 -171
  111. package/src/multicall/index.ts +22 -22
  112. package/src/services/dsrService.ts +15 -15
  113. package/src/services/priceService.ts +21 -21
  114. package/src/services/utils.ts +54 -57
  115. package/src/setup.ts +8 -8
  116. package/src/spark/index.ts +424 -424
  117. package/src/staking/staking.ts +218 -189
  118. package/src/types/aave.ts +262 -262
  119. package/src/types/chickenBonds.ts +45 -45
  120. package/src/types/common.ts +84 -84
  121. package/src/types/compound.ts +129 -129
  122. package/src/types/contracts/generated/LiquityV2View.ts +280 -0
  123. package/src/types/contracts/generated/index.ts +1 -1
  124. package/src/types/curveUsd.ts +118 -118
  125. package/src/types/index.ts +10 -10
  126. package/src/types/liquity.ts +30 -30
  127. package/src/types/liquityV2.ts +79 -0
  128. package/src/types/llamaLend.ts +155 -155
  129. package/src/types/maker.ts +50 -50
  130. package/src/types/morphoBlue.ts +146 -144
  131. package/src/types/spark.ts +127 -127
  132. package/cjs/eulerV2/index.d.ts +0 -40
  133. package/cjs/eulerV2/index.js +0 -207
  134. package/cjs/helpers/eulerHelpers/index.d.ts +0 -27
  135. package/cjs/helpers/eulerHelpers/index.js +0 -232
  136. package/cjs/markets/euler/index.d.ts +0 -10
  137. package/cjs/markets/euler/index.js +0 -41
  138. package/cjs/types/contracts/generated/EulerV2View.d.ts +0 -333
  139. package/cjs/types/euler.d.ts +0 -148
  140. package/cjs/types/euler.js +0 -15
  141. package/esm/eulerV2/index.d.ts +0 -40
  142. package/esm/eulerV2/index.js +0 -199
  143. package/esm/helpers/eulerHelpers/index.d.ts +0 -27
  144. package/esm/helpers/eulerHelpers/index.js +0 -219
  145. package/esm/markets/euler/index.d.ts +0 -10
  146. package/esm/markets/euler/index.js +0 -34
  147. package/esm/types/contracts/generated/EulerV2View.d.ts +0 -333
  148. package/esm/types/euler.d.ts +0 -148
  149. package/esm/types/euler.js +0 -12
  150. package/src/eulerV2/index.ts +0 -286
  151. package/src/helpers/eulerHelpers/index.ts +0 -231
  152. package/src/markets/euler/index.ts +0 -38
  153. package/src/types/contracts/generated/EulerV2View.ts +0 -434
  154. package/src/types/euler.ts +0 -171
  155. /package/cjs/types/contracts/generated/{EulerV2View.js → LiquityV2View.js} +0 -0
  156. /package/esm/types/contracts/generated/{EulerV2View.js → LiquityV2View.js} +0 -0
@@ -1,84 +1,84 @@
1
- // General
2
- export type EthAddress = string;
3
- export type Blockish = number | 'latest';
4
- export type AssetSymbol = string;
5
- export type Amount = string | number;
6
-
7
- export enum NetworkNumber {
8
- Eth = 1,
9
- Opt = 10,
10
- Arb = 42161,
11
- Base = 8453,
12
- }
13
- export type Networkish = string | NetworkNumber;
14
-
15
- // Common
16
- export interface MMAssetData {
17
- symbol: string,
18
- supplyRate: string,
19
- borrowRate: string,
20
- price: string,
21
- collateralFactor: string,
22
- underlyingTokenAddress: string,
23
- marketLiquidity: string,
24
- utilization: string,
25
- borrowCap: string,
26
- totalSupply: string,
27
- canBeBorrowed: boolean,
28
- canBeSupplied: boolean,
29
- totalBorrow: string,
30
- incentiveBorrowApy?: string,
31
- incentiveBorrowToken?: string,
32
- incentiveSupplyApy?: string,
33
- incentiveSupplyToken?: string,
34
- borrowRateP2P?: string,
35
- supplyRateP2P?: string,
36
- }
37
-
38
- export interface MMAssetsData {
39
- [token: string]: MMAssetData,
40
- }
41
- export interface MMMarketData {
42
- assetsData: MMAssetData[],
43
- }
44
- export interface MMUsedAsset {
45
- symbol: string,
46
- supplied: string,
47
- suppliedUsd: string,
48
- isSupplied: boolean,
49
- borrowed: string,
50
- borrowedUsd: string,
51
- isBorrowed: boolean,
52
- debt?: string,
53
- supplyRate?: string,
54
- borrowRate?: string,
55
- discountedBorrowRate?: string,
56
- stableBorrowRate?: string,
57
- interestMode?: string,
58
- collateral?: boolean,
59
- }
60
- export interface MMUsedAssets {
61
- [token: string]: MMUsedAsset,
62
- }
63
- export interface MMUsedAssetWStableB extends MMUsedAsset {
64
- stableBorrowRate: string,
65
- borrowedStable: string,
66
- borrowedVariable: string,
67
- borrowedUsdStable: string,
68
- borrowedUsdVariable: string,
69
- interestMode: string,
70
- }
71
- export interface MMPositionData {
72
- usedAssets: any,
73
- netApy: string,
74
- lastUpdated: number,
75
- // ...
76
- }
77
-
78
- export type Balances = Record<AssetSymbol, Amount>;
79
- export interface PositionBalances {
80
- collateral?: Balances,
81
- debt?: Balances,
82
- selling?: Balances,
83
- deposited?: Balances,
84
- }
1
+ // General
2
+ export type EthAddress = string;
3
+ export type Blockish = number | 'latest';
4
+ export type AssetSymbol = string;
5
+ export type Amount = string | number;
6
+
7
+ export enum NetworkNumber {
8
+ Eth = 1,
9
+ Opt = 10,
10
+ Arb = 42161,
11
+ Base = 8453,
12
+ }
13
+ export type Networkish = string | NetworkNumber;
14
+
15
+ // Common
16
+ export interface MMAssetData {
17
+ symbol: string,
18
+ supplyRate: string,
19
+ borrowRate: string,
20
+ price: string,
21
+ collateralFactor: string,
22
+ underlyingTokenAddress: string,
23
+ marketLiquidity: string,
24
+ utilization: string,
25
+ borrowCap: string,
26
+ totalSupply: string,
27
+ canBeBorrowed: boolean,
28
+ canBeSupplied: boolean,
29
+ totalBorrow: string,
30
+ incentiveBorrowApy?: string,
31
+ incentiveBorrowToken?: string,
32
+ incentiveSupplyApy?: string,
33
+ incentiveSupplyToken?: string,
34
+ borrowRateP2P?: string,
35
+ supplyRateP2P?: string,
36
+ }
37
+
38
+ export interface MMAssetsData {
39
+ [token: string]: MMAssetData,
40
+ }
41
+ export interface MMMarketData {
42
+ assetsData: MMAssetData[],
43
+ }
44
+ export interface MMUsedAsset {
45
+ symbol: string,
46
+ supplied: string,
47
+ suppliedUsd: string,
48
+ isSupplied: boolean,
49
+ borrowed: string,
50
+ borrowedUsd: string,
51
+ isBorrowed: boolean,
52
+ debt?: string,
53
+ supplyRate?: string,
54
+ borrowRate?: string,
55
+ discountedBorrowRate?: string,
56
+ stableBorrowRate?: string,
57
+ interestMode?: string,
58
+ collateral?: boolean,
59
+ }
60
+ export interface MMUsedAssets {
61
+ [token: string]: MMUsedAsset,
62
+ }
63
+ export interface MMUsedAssetWStableB extends MMUsedAsset {
64
+ stableBorrowRate: string,
65
+ borrowedStable: string,
66
+ borrowedVariable: string,
67
+ borrowedUsdStable: string,
68
+ borrowedUsdVariable: string,
69
+ interestMode: string,
70
+ }
71
+ export interface MMPositionData {
72
+ usedAssets: any,
73
+ netApy: string,
74
+ lastUpdated: number,
75
+ // ...
76
+ }
77
+
78
+ export type Balances = Record<AssetSymbol, Amount>;
79
+ export interface PositionBalances {
80
+ collateral?: Balances,
81
+ debt?: Balances,
82
+ selling?: Balances,
83
+ deposited?: Balances,
84
+ }
@@ -1,130 +1,130 @@
1
- import {
2
- MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber,
3
- } from './common';
4
-
5
- export enum CompoundVersions {
6
- 'CompoundV2' = 'v2',
7
- 'CompoundV3USDC' = 'v3-USDC',
8
- 'CompoundV3USDCe' = 'v3-USDC.e',
9
- 'CompoundV3ETH' = 'v3-ETH',
10
- 'CompoundV3USDbC' = 'v3-USDbC',
11
- 'CompoundV3USDT' = 'v3-USDT',
12
- }
13
-
14
- export interface CompoundBulkerOptions {
15
- supply: number | string,
16
- withdraw: number | string,
17
- }
18
-
19
- export interface CompoundMarketData {
20
- chainIds: NetworkNumber[],
21
- label: string,
22
- shortLabel: string,
23
- value: CompoundVersions,
24
- baseAsset: string,
25
- collAssets: readonly string[],
26
- baseMarket: string,
27
- baseMarketAddress: string,
28
- secondLabel: string,
29
- bulkerName: string,
30
- bulkerAddress: string,
31
- bulkerOptions: CompoundBulkerOptions,
32
- // icon: Function,
33
- }
34
-
35
- export interface CompoundUsedAsset extends MMUsedAsset {
36
- collateral: boolean,
37
- limit?: string,
38
- }
39
-
40
- export interface CompoundV2UsedAsset extends CompoundUsedAsset {
41
- }
42
- export interface CompoundV3UsedAsset extends CompoundUsedAsset {
43
- }
44
-
45
- export interface CompoundUsedAssets<T> {
46
- [token: string]: T,
47
- }
48
-
49
- export type CompoundV2UsedAssets = CompoundUsedAssets<CompoundV2UsedAsset>;
50
- export type CompoundV3UsedAssets = CompoundUsedAssets<CompoundV3UsedAsset>;
51
-
52
- export interface CompoundAssetData extends MMAssetData {
53
- supplyCapAlternative?: string,
54
- totalSupplyAlternative?: string,
55
- priceAlternative?: string,
56
- sortIndex?: number,
57
- }
58
-
59
- export interface CompoundV2AssetData extends CompoundAssetData {
60
- }
61
- export interface CompoundV3AssetData extends CompoundAssetData {
62
- borrowCollateralFactor: string,
63
- liquidateCollateralFactor: string,
64
- minDebt: string,
65
- liquidationRatio: string,
66
- supplyCap: string,
67
- priceInBaseAsset: string,
68
- }
69
-
70
- export interface CompoundAssetsData<T> {
71
- [token: string]: T
72
- }
73
- export type CompoundV2AssetsData = CompoundAssetsData<CompoundV2AssetData>;
74
- export type CompoundV3AssetsData = CompoundAssetsData<CompoundV3AssetData>;
75
-
76
- export type CompoundMarketsData<T> = { assetsData: T };
77
- export type CompoundV2MarketsData = CompoundMarketsData<CompoundV2AssetsData>;
78
- export type CompoundV3MarketsData = CompoundMarketsData<CompoundV3AssetsData>;
79
-
80
- export interface BaseAdditionalAssetData {
81
- totalBorrow: string,
82
- utilization: string,
83
- marketLiquidity: string,
84
- rewardSupplySpeed: string,
85
- rewardBorrowSpeed: string,
86
- minDebt: string,
87
- isBase: boolean,
88
- }
89
-
90
- export interface CompoundAggregatedPositionData {
91
- suppliedUsd: string,
92
- suppliedCollateralUsd: string,
93
- borrowedUsd: string,
94
- borrowLimitUsd: string,
95
- liquidationLimitUsd: string,
96
- leftToBorrowUsd: string,
97
- ratio: string,
98
- collRatio: string,
99
- netApy: string,
100
- incentiveUsd: string,
101
- totalInterestUsd: string,
102
- liqRatio: string,
103
- liqPercent: string,
104
- leveragedType: string,
105
- leveragedAsset?: string,
106
- leveragedLsdAssetRatio?: string,
107
- liquidationPrice?: string,
108
- minRatio: string,
109
- debtTooLow: boolean,
110
- minDebt: string,
111
- }
112
-
113
- export interface CompoundPositionData extends MMPositionData {
114
- ratio: string,
115
- minRatio: string,
116
- borrowedUsd: string,
117
- borrowLimitUsd: string,
118
- incentiveUsd: string,
119
- totalInterestUsd: string,
120
- isSubscribedToAutomation?: boolean,
121
- automationResubscribeRequired?: boolean,
122
- }
123
-
124
- export interface CompoundV2PositionData extends CompoundPositionData {
125
- usedAssets: CompoundV2UsedAssets,
126
- }
127
-
128
- export interface CompoundV3PositionData extends CompoundPositionData {
129
- usedAssets: CompoundV3UsedAssets,
1
+ import {
2
+ MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber,
3
+ } from './common';
4
+
5
+ export enum CompoundVersions {
6
+ 'CompoundV2' = 'v2',
7
+ 'CompoundV3USDC' = 'v3-USDC',
8
+ 'CompoundV3USDCe' = 'v3-USDC.e',
9
+ 'CompoundV3ETH' = 'v3-ETH',
10
+ 'CompoundV3USDbC' = 'v3-USDbC',
11
+ 'CompoundV3USDT' = 'v3-USDT',
12
+ }
13
+
14
+ export interface CompoundBulkerOptions {
15
+ supply: number | string,
16
+ withdraw: number | string,
17
+ }
18
+
19
+ export interface CompoundMarketData {
20
+ chainIds: NetworkNumber[],
21
+ label: string,
22
+ shortLabel: string,
23
+ value: CompoundVersions,
24
+ baseAsset: string,
25
+ collAssets: readonly string[],
26
+ baseMarket: string,
27
+ baseMarketAddress: string,
28
+ secondLabel: string,
29
+ bulkerName: string,
30
+ bulkerAddress: string,
31
+ bulkerOptions: CompoundBulkerOptions,
32
+ // icon: Function,
33
+ }
34
+
35
+ export interface CompoundUsedAsset extends MMUsedAsset {
36
+ collateral: boolean,
37
+ limit?: string,
38
+ }
39
+
40
+ export interface CompoundV2UsedAsset extends CompoundUsedAsset {
41
+ }
42
+ export interface CompoundV3UsedAsset extends CompoundUsedAsset {
43
+ }
44
+
45
+ export interface CompoundUsedAssets<T> {
46
+ [token: string]: T,
47
+ }
48
+
49
+ export type CompoundV2UsedAssets = CompoundUsedAssets<CompoundV2UsedAsset>;
50
+ export type CompoundV3UsedAssets = CompoundUsedAssets<CompoundV3UsedAsset>;
51
+
52
+ export interface CompoundAssetData extends MMAssetData {
53
+ supplyCapAlternative?: string,
54
+ totalSupplyAlternative?: string,
55
+ priceAlternative?: string,
56
+ sortIndex?: number,
57
+ }
58
+
59
+ export interface CompoundV2AssetData extends CompoundAssetData {
60
+ }
61
+ export interface CompoundV3AssetData extends CompoundAssetData {
62
+ borrowCollateralFactor: string,
63
+ liquidateCollateralFactor: string,
64
+ minDebt: string,
65
+ liquidationRatio: string,
66
+ supplyCap: string,
67
+ priceInBaseAsset: string,
68
+ }
69
+
70
+ export interface CompoundAssetsData<T> {
71
+ [token: string]: T
72
+ }
73
+ export type CompoundV2AssetsData = CompoundAssetsData<CompoundV2AssetData>;
74
+ export type CompoundV3AssetsData = CompoundAssetsData<CompoundV3AssetData>;
75
+
76
+ export type CompoundMarketsData<T> = { assetsData: T };
77
+ export type CompoundV2MarketsData = CompoundMarketsData<CompoundV2AssetsData>;
78
+ export type CompoundV3MarketsData = CompoundMarketsData<CompoundV3AssetsData>;
79
+
80
+ export interface BaseAdditionalAssetData {
81
+ totalBorrow: string,
82
+ utilization: string,
83
+ marketLiquidity: string,
84
+ rewardSupplySpeed: string,
85
+ rewardBorrowSpeed: string,
86
+ minDebt: string,
87
+ isBase: boolean,
88
+ }
89
+
90
+ export interface CompoundAggregatedPositionData {
91
+ suppliedUsd: string,
92
+ suppliedCollateralUsd: string,
93
+ borrowedUsd: string,
94
+ borrowLimitUsd: string,
95
+ liquidationLimitUsd: string,
96
+ leftToBorrowUsd: string,
97
+ ratio: string,
98
+ collRatio: string,
99
+ netApy: string,
100
+ incentiveUsd: string,
101
+ totalInterestUsd: string,
102
+ liqRatio: string,
103
+ liqPercent: string,
104
+ leveragedType: string,
105
+ leveragedAsset?: string,
106
+ leveragedLsdAssetRatio?: string,
107
+ liquidationPrice?: string,
108
+ minRatio: string,
109
+ debtTooLow: boolean,
110
+ minDebt: string,
111
+ }
112
+
113
+ export interface CompoundPositionData extends MMPositionData {
114
+ ratio: string,
115
+ minRatio: string,
116
+ borrowedUsd: string,
117
+ borrowLimitUsd: string,
118
+ incentiveUsd: string,
119
+ totalInterestUsd: string,
120
+ isSubscribedToAutomation?: boolean,
121
+ automationResubscribeRequired?: boolean,
122
+ }
123
+
124
+ export interface CompoundV2PositionData extends CompoundPositionData {
125
+ usedAssets: CompoundV2UsedAssets,
126
+ }
127
+
128
+ export interface CompoundV3PositionData extends CompoundPositionData {
129
+ usedAssets: CompoundV3UsedAssets,
130
130
  }