@defisaver/positions-sdk 2.1.30 → 2.1.31-syrup-dev

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 (105) hide show
  1. package/.mocharc.json +4 -4
  2. package/.nvmrc +1 -1
  3. package/CLAUDE.md +32 -0
  4. package/README.md +64 -64
  5. package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
  6. package/cjs/markets/aave/marketAssets.js +2 -2
  7. package/cjs/savings/morphoVaults/index.js +17 -17
  8. package/esm/helpers/morphoBlueHelpers/index.js +66 -66
  9. package/esm/markets/aave/marketAssets.js +2 -2
  10. package/esm/savings/morphoVaults/index.js +17 -17
  11. package/package.json +48 -48
  12. package/src/aaveV2/index.ts +240 -240
  13. package/src/aaveV3/index.ts +614 -614
  14. package/src/aaveV3/merit.ts +97 -97
  15. package/src/aaveV3/merkl.ts +74 -74
  16. package/src/claiming/aaveV3.ts +154 -154
  17. package/src/claiming/compV3.ts +22 -22
  18. package/src/claiming/ethena.ts +61 -61
  19. package/src/claiming/index.ts +12 -12
  20. package/src/claiming/king.ts +66 -66
  21. package/src/claiming/morphoBlue.ts +118 -118
  22. package/src/claiming/spark.ts +225 -225
  23. package/src/compoundV2/index.ts +244 -244
  24. package/src/compoundV3/index.ts +274 -274
  25. package/src/config/contracts.ts +1284 -1284
  26. package/src/constants/index.ts +10 -10
  27. package/src/contracts.ts +160 -160
  28. package/src/curveUsd/index.ts +254 -254
  29. package/src/eulerV2/index.ts +324 -324
  30. package/src/exchange/index.ts +25 -25
  31. package/src/fluid/index.ts +1800 -1800
  32. package/src/helpers/aaveHelpers/index.ts +187 -187
  33. package/src/helpers/compoundHelpers/index.ts +283 -283
  34. package/src/helpers/curveUsdHelpers/index.ts +40 -40
  35. package/src/helpers/eulerHelpers/index.ts +222 -222
  36. package/src/helpers/fluidHelpers/index.ts +326 -326
  37. package/src/helpers/index.ts +10 -10
  38. package/src/helpers/liquityV2Helpers/index.ts +82 -82
  39. package/src/helpers/llamaLendHelpers/index.ts +53 -53
  40. package/src/helpers/makerHelpers/index.ts +52 -52
  41. package/src/helpers/morphoBlueHelpers/index.ts +396 -396
  42. package/src/helpers/sparkHelpers/index.ts +158 -158
  43. package/src/index.ts +49 -49
  44. package/src/liquity/index.ts +159 -159
  45. package/src/liquityV2/index.ts +703 -703
  46. package/src/llamaLend/index.ts +305 -305
  47. package/src/maker/index.ts +223 -223
  48. package/src/markets/aave/index.ts +118 -118
  49. package/src/markets/aave/marketAssets.ts +54 -54
  50. package/src/markets/compound/index.ts +243 -243
  51. package/src/markets/compound/marketsAssets.ts +97 -97
  52. package/src/markets/curveUsd/index.ts +69 -69
  53. package/src/markets/euler/index.ts +26 -26
  54. package/src/markets/fluid/index.ts +2900 -2900
  55. package/src/markets/index.ts +25 -25
  56. package/src/markets/liquityV2/index.ts +102 -102
  57. package/src/markets/llamaLend/contractAddresses.ts +141 -141
  58. package/src/markets/llamaLend/index.ts +235 -235
  59. package/src/markets/morphoBlue/index.ts +971 -971
  60. package/src/markets/spark/index.ts +29 -29
  61. package/src/markets/spark/marketAssets.ts +12 -12
  62. package/src/moneymarket/moneymarketCommonService.ts +85 -85
  63. package/src/morphoBlue/index.ts +274 -274
  64. package/src/portfolio/index.ts +598 -598
  65. package/src/savings/index.ts +55 -55
  66. package/src/savings/makerDsr/index.ts +53 -53
  67. package/src/savings/makerDsr/options.ts +9 -9
  68. package/src/savings/morphoVaults/index.ts +80 -80
  69. package/src/savings/morphoVaults/options.ts +203 -203
  70. package/src/savings/sparkSavingsVaults/index.ts +60 -60
  71. package/src/savings/sparkSavingsVaults/options.ts +35 -35
  72. package/src/savings/yearnVaults/index.ts +73 -73
  73. package/src/savings/yearnVaults/options.ts +32 -32
  74. package/src/services/priceService.ts +278 -278
  75. package/src/services/utils.ts +115 -115
  76. package/src/services/viem.ts +34 -34
  77. package/src/setup.ts +8 -8
  78. package/src/spark/index.ts +456 -456
  79. package/src/staking/eligibility.ts +53 -53
  80. package/src/staking/index.ts +1 -1
  81. package/src/staking/staking.ts +186 -186
  82. package/src/types/aave.ts +196 -196
  83. package/src/types/claiming.ts +114 -114
  84. package/src/types/common.ts +107 -107
  85. package/src/types/compound.ts +144 -144
  86. package/src/types/curveUsd.ts +123 -123
  87. package/src/types/euler.ts +175 -175
  88. package/src/types/fluid.ts +483 -483
  89. package/src/types/index.ts +14 -14
  90. package/src/types/liquity.ts +30 -30
  91. package/src/types/liquityV2.ts +126 -126
  92. package/src/types/llamaLend.ts +159 -159
  93. package/src/types/maker.ts +63 -63
  94. package/src/types/merit.ts +1 -1
  95. package/src/types/merkl.ts +70 -70
  96. package/src/types/morphoBlue.ts +200 -200
  97. package/src/types/portfolio.ts +60 -60
  98. package/src/types/savings/index.ts +19 -19
  99. package/src/types/savings/makerDsr.ts +13 -13
  100. package/src/types/savings/morphoVaults.ts +33 -33
  101. package/src/types/savings/sparkSavingsVaults.ts +15 -15
  102. package/src/types/savings/yearnVaults.ts +14 -14
  103. package/src/types/spark.ts +133 -133
  104. package/src/umbrella/index.ts +69 -69
  105. package/src/umbrella/umbrellaUtils.ts +29 -29
@@ -1,107 +1,107 @@
1
- export enum IncentiveKind {
2
- Staking = 'staking',
3
- Reward = 'reward',
4
- }
5
-
6
- export enum IncentiveEligibilityId {
7
- AaveV3EthenaLiquidLeverage = '0x7361e6f04060154e0268a8402b073cbf97e11ae3BORROW_BL',
8
- AaveV3ArbitrumEthSupply = '0x5d16261c6715a653248269861bbacf68a9774cde',
9
- AaveV3ArbitrumETHLSBorrow = '0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351',
10
- AaveV3EthenaLiquidLeveragePlasma = '0x67264783f1e9a2af8627a235853057a6fc975bd2BORROW_BL',
11
- }
12
-
13
- export interface IncentiveData {
14
- token: string,
15
- apy: string,
16
- incentiveKind?: IncentiveKind;
17
- description?: string;
18
- eligibilityId?: IncentiveEligibilityId;
19
- }
20
-
21
- // General
22
- export type EthAddress = HexString;
23
- export type Blockish = number | 'latest';
24
- export type AssetSymbol = string;
25
- export type Amount = string | number;
26
-
27
- export enum NetworkNumber {
28
- Eth = 1,
29
- Opt = 10,
30
- Arb = 42161,
31
- Base = 8453,
32
- Linea = 59144,
33
- Plasma = 9745,
34
- }
35
- export type Networkish = string | NetworkNumber;
36
-
37
- // Common
38
- export interface MMAssetData {
39
- symbol: string,
40
- supplyRate: string,
41
- borrowRate: string,
42
- price: string,
43
- collateralFactor: string,
44
- underlyingTokenAddress: string,
45
- marketLiquidity: string,
46
- utilization: string,
47
- borrowCap: string,
48
- totalSupply: string,
49
- canBeBorrowed: boolean,
50
- canBeSupplied: boolean,
51
- totalBorrow: string,
52
- borrowRateP2P?: string,
53
- supplyRateP2P?: string,
54
- supplyIncentives: IncentiveData[];
55
- borrowIncentives: IncentiveData[];
56
- }
57
-
58
- export interface MMAssetsData {
59
- [token: string]: MMAssetData,
60
- }
61
- export interface MMMarketData {
62
- assetsData: MMAssetData[],
63
- }
64
- export interface MMUsedAsset {
65
- symbol: string,
66
- supplied: string,
67
- suppliedUsd: string,
68
- isSupplied: boolean,
69
- borrowed: string,
70
- borrowedUsd: string,
71
- isBorrowed: boolean,
72
- stableBorrowRate?: string,
73
- debt?: string,
74
- supplyRate?: string,
75
- borrowRate?: string,
76
- interestMode?: string,
77
- collateral?: boolean,
78
- }
79
- export interface MMUsedAssets {
80
- [token: string]: MMUsedAsset,
81
- }
82
- export interface MMUsedAssetWStableB extends MMUsedAsset {
83
- stableBorrowRate: string,
84
- borrowedStable: string,
85
- borrowedVariable: string,
86
- borrowedUsdStable: string,
87
- borrowedUsdVariable: string,
88
- interestMode: string,
89
- }
90
- export interface MMPositionData {
91
- usedAssets: any,
92
- netApy: string,
93
- lastUpdated: number,
94
- // ...
95
- }
96
-
97
- export type Balances = Record<AssetSymbol, Amount>;
98
- export interface PositionBalances {
99
- collateral?: Balances,
100
- debt?: Balances,
101
- selling?: Balances,
102
- deposited?: Balances,
103
- }
104
-
105
- export type EthereumProvider = { request(...args: any): Promise<any> }; // TODO
106
-
107
- export type HexString = `0x${string}`;
1
+ export enum IncentiveKind {
2
+ Staking = 'staking',
3
+ Reward = 'reward',
4
+ }
5
+
6
+ export enum IncentiveEligibilityId {
7
+ AaveV3EthenaLiquidLeverage = '0x7361e6f04060154e0268a8402b073cbf97e11ae3BORROW_BL',
8
+ AaveV3ArbitrumEthSupply = '0x5d16261c6715a653248269861bbacf68a9774cde',
9
+ AaveV3ArbitrumETHLSBorrow = '0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351',
10
+ AaveV3EthenaLiquidLeveragePlasma = '0x67264783f1e9a2af8627a235853057a6fc975bd2BORROW_BL',
11
+ }
12
+
13
+ export interface IncentiveData {
14
+ token: string,
15
+ apy: string,
16
+ incentiveKind?: IncentiveKind;
17
+ description?: string;
18
+ eligibilityId?: IncentiveEligibilityId;
19
+ }
20
+
21
+ // General
22
+ export type EthAddress = HexString;
23
+ export type Blockish = number | 'latest';
24
+ export type AssetSymbol = string;
25
+ export type Amount = string | number;
26
+
27
+ export enum NetworkNumber {
28
+ Eth = 1,
29
+ Opt = 10,
30
+ Arb = 42161,
31
+ Base = 8453,
32
+ Linea = 59144,
33
+ Plasma = 9745,
34
+ }
35
+ export type Networkish = string | NetworkNumber;
36
+
37
+ // Common
38
+ export interface MMAssetData {
39
+ symbol: string,
40
+ supplyRate: string,
41
+ borrowRate: string,
42
+ price: string,
43
+ collateralFactor: string,
44
+ underlyingTokenAddress: string,
45
+ marketLiquidity: string,
46
+ utilization: string,
47
+ borrowCap: string,
48
+ totalSupply: string,
49
+ canBeBorrowed: boolean,
50
+ canBeSupplied: boolean,
51
+ totalBorrow: string,
52
+ borrowRateP2P?: string,
53
+ supplyRateP2P?: string,
54
+ supplyIncentives: IncentiveData[];
55
+ borrowIncentives: IncentiveData[];
56
+ }
57
+
58
+ export interface MMAssetsData {
59
+ [token: string]: MMAssetData,
60
+ }
61
+ export interface MMMarketData {
62
+ assetsData: MMAssetData[],
63
+ }
64
+ export interface MMUsedAsset {
65
+ symbol: string,
66
+ supplied: string,
67
+ suppliedUsd: string,
68
+ isSupplied: boolean,
69
+ borrowed: string,
70
+ borrowedUsd: string,
71
+ isBorrowed: boolean,
72
+ stableBorrowRate?: string,
73
+ debt?: string,
74
+ supplyRate?: string,
75
+ borrowRate?: string,
76
+ interestMode?: string,
77
+ collateral?: boolean,
78
+ }
79
+ export interface MMUsedAssets {
80
+ [token: string]: MMUsedAsset,
81
+ }
82
+ export interface MMUsedAssetWStableB extends MMUsedAsset {
83
+ stableBorrowRate: string,
84
+ borrowedStable: string,
85
+ borrowedVariable: string,
86
+ borrowedUsdStable: string,
87
+ borrowedUsdVariable: string,
88
+ interestMode: string,
89
+ }
90
+ export interface MMPositionData {
91
+ usedAssets: any,
92
+ netApy: string,
93
+ lastUpdated: number,
94
+ // ...
95
+ }
96
+
97
+ export type Balances = Record<AssetSymbol, Amount>;
98
+ export interface PositionBalances {
99
+ collateral?: Balances,
100
+ debt?: Balances,
101
+ selling?: Balances,
102
+ deposited?: Balances,
103
+ }
104
+
105
+ export type EthereumProvider = { request(...args: any): Promise<any> }; // TODO
106
+
107
+ export type HexString = `0x${string}`;
@@ -1,145 +1,145 @@
1
- import {
2
- EthAddress,
3
- MMAssetData,
4
- MMPositionData,
5
- MMUsedAsset,
6
- NetworkNumber,
7
- } from './common';
8
-
9
- export enum CompoundVersions {
10
- 'CompoundV2' = 'v2',
11
- 'CompoundV3USDC' = 'v3-USDC',
12
- 'CompoundV3USDCe' = 'v3-USDC.e',
13
- 'CompoundV3ETH' = 'v3-ETH',
14
- 'CompoundV3USDbC' = 'v3-USDbC',
15
- 'CompoundV3USDT' = 'v3-USDT',
16
- 'CompoundV3USDS' = 'v3-USDS',
17
- 'CompoundV3wstETH' = 'v3-wstETH',
18
- }
19
-
20
- export enum CompoundVersionType {
21
- V2 = 'v2',
22
- V3 = 'v3',
23
- }
24
-
25
- export interface CompoundBulkerOptions {
26
- supply: number | string,
27
- withdraw: number | string,
28
- }
29
-
30
- export interface CompoundMarketData {
31
- chainIds: NetworkNumber[],
32
- label: string,
33
- shortLabel: string,
34
- value: CompoundVersions,
35
- baseAsset: string,
36
- collAssets: readonly string[],
37
- baseMarket: string,
38
- baseMarketAddress: EthAddress,
39
- secondLabel: string,
40
- bulkerName: string,
41
- bulkerAddress: EthAddress,
42
- bulkerOptions: CompoundBulkerOptions,
43
- // icon: Function,
44
- }
45
-
46
- export interface CompoundUsedAsset extends MMUsedAsset {
47
- collateral: boolean,
48
- limit?: string,
49
- }
50
-
51
- export interface CompoundV2UsedAsset extends CompoundUsedAsset {
52
- }
53
- export interface CompoundV3UsedAsset extends CompoundUsedAsset {
54
- }
55
-
56
- export interface CompoundUsedAssets<T> {
57
- [token: string]: T,
58
- }
59
-
60
- export type CompoundV2UsedAssets = CompoundUsedAssets<CompoundV2UsedAsset>;
61
- export type CompoundV3UsedAssets = CompoundUsedAssets<CompoundV3UsedAsset>;
62
-
63
- export interface CompoundAssetData extends MMAssetData {
64
- supplyCapAlternative?: string,
65
- totalSupplyAlternative?: string,
66
- sortIndex?: number,
67
- }
68
-
69
- export interface CompoundV2AssetData extends CompoundAssetData {
70
- }
71
- export interface CompoundV3AssetData extends CompoundAssetData {
72
- borrowCollateralFactor: string,
73
- liquidateCollateralFactor: string,
74
- liquidationFactor: string,
75
- minDebt: string,
76
- supplyReserved: string,
77
- liquidationRatio: string,
78
- supplyCap: string,
79
- priceInBaseAsset: string,
80
- }
81
-
82
- export interface CompoundAssetsData<T> {
83
- [token: string]: T
84
- }
85
- export type CompoundV2AssetsData = CompoundAssetsData<CompoundV2AssetData>;
86
- export type CompoundV3AssetsData = CompoundAssetsData<CompoundV3AssetData>;
87
-
88
- export type CompoundMarketsData<T> = { assetsData: T };
89
- export type CompoundV2MarketsData = CompoundMarketsData<CompoundV2AssetsData>;
90
- export type CompoundV3MarketsData = CompoundMarketsData<CompoundV3AssetsData>;
91
-
92
- export interface BaseAdditionalAssetData {
93
- totalBorrow: string,
94
- utilization: string,
95
- marketLiquidity: string,
96
- rewardSupplySpeed: string,
97
- rewardBorrowSpeed: string,
98
- minDebt: string,
99
- isBase: boolean,
100
- }
101
-
102
- export interface CompoundAggregatedPositionData {
103
- suppliedUsd: string,
104
- suppliedCollateralUsd: string,
105
- borrowedUsd: string,
106
- borrowLimitUsd: string,
107
- liquidationLimitUsd: string,
108
- leftToBorrowUsd: string,
109
- ratio: string,
110
- collRatio: string,
111
- netApy: string,
112
- incentiveUsd: string,
113
- totalInterestUsd: string,
114
- liqRatio: string,
115
- liqPercent: string,
116
- leveragedType: string,
117
- leveragedAsset?: string,
118
- leveragedLsdAssetRatio?: string,
119
- liquidationPrice?: string,
120
- minRatio: string,
121
- debtTooLow: boolean,
122
- minDebt: string,
123
- minCollRatio: string,
124
- collLiquidationRatio: string,
125
- }
126
-
127
- export interface CompoundPositionData extends MMPositionData {
128
- ratio: string,
129
- minRatio: string,
130
- suppliedUsd: string,
131
- borrowedUsd: string,
132
- borrowLimitUsd: string,
133
- incentiveUsd: string,
134
- totalInterestUsd: string,
135
- isSubscribedToAutomation?: boolean,
136
- automationResubscribeRequired?: boolean,
137
- }
138
-
139
- export interface CompoundV2PositionData extends CompoundPositionData {
140
- usedAssets: CompoundV2UsedAssets,
141
- }
142
-
143
- export interface CompoundV3PositionData extends CompoundPositionData {
144
- usedAssets: CompoundV3UsedAssets,
1
+ import {
2
+ EthAddress,
3
+ MMAssetData,
4
+ MMPositionData,
5
+ MMUsedAsset,
6
+ NetworkNumber,
7
+ } from './common';
8
+
9
+ export enum CompoundVersions {
10
+ 'CompoundV2' = 'v2',
11
+ 'CompoundV3USDC' = 'v3-USDC',
12
+ 'CompoundV3USDCe' = 'v3-USDC.e',
13
+ 'CompoundV3ETH' = 'v3-ETH',
14
+ 'CompoundV3USDbC' = 'v3-USDbC',
15
+ 'CompoundV3USDT' = 'v3-USDT',
16
+ 'CompoundV3USDS' = 'v3-USDS',
17
+ 'CompoundV3wstETH' = 'v3-wstETH',
18
+ }
19
+
20
+ export enum CompoundVersionType {
21
+ V2 = 'v2',
22
+ V3 = 'v3',
23
+ }
24
+
25
+ export interface CompoundBulkerOptions {
26
+ supply: number | string,
27
+ withdraw: number | string,
28
+ }
29
+
30
+ export interface CompoundMarketData {
31
+ chainIds: NetworkNumber[],
32
+ label: string,
33
+ shortLabel: string,
34
+ value: CompoundVersions,
35
+ baseAsset: string,
36
+ collAssets: readonly string[],
37
+ baseMarket: string,
38
+ baseMarketAddress: EthAddress,
39
+ secondLabel: string,
40
+ bulkerName: string,
41
+ bulkerAddress: EthAddress,
42
+ bulkerOptions: CompoundBulkerOptions,
43
+ // icon: Function,
44
+ }
45
+
46
+ export interface CompoundUsedAsset extends MMUsedAsset {
47
+ collateral: boolean,
48
+ limit?: string,
49
+ }
50
+
51
+ export interface CompoundV2UsedAsset extends CompoundUsedAsset {
52
+ }
53
+ export interface CompoundV3UsedAsset extends CompoundUsedAsset {
54
+ }
55
+
56
+ export interface CompoundUsedAssets<T> {
57
+ [token: string]: T,
58
+ }
59
+
60
+ export type CompoundV2UsedAssets = CompoundUsedAssets<CompoundV2UsedAsset>;
61
+ export type CompoundV3UsedAssets = CompoundUsedAssets<CompoundV3UsedAsset>;
62
+
63
+ export interface CompoundAssetData extends MMAssetData {
64
+ supplyCapAlternative?: string,
65
+ totalSupplyAlternative?: string,
66
+ sortIndex?: number,
67
+ }
68
+
69
+ export interface CompoundV2AssetData extends CompoundAssetData {
70
+ }
71
+ export interface CompoundV3AssetData extends CompoundAssetData {
72
+ borrowCollateralFactor: string,
73
+ liquidateCollateralFactor: string,
74
+ liquidationFactor: string,
75
+ minDebt: string,
76
+ supplyReserved: string,
77
+ liquidationRatio: string,
78
+ supplyCap: string,
79
+ priceInBaseAsset: string,
80
+ }
81
+
82
+ export interface CompoundAssetsData<T> {
83
+ [token: string]: T
84
+ }
85
+ export type CompoundV2AssetsData = CompoundAssetsData<CompoundV2AssetData>;
86
+ export type CompoundV3AssetsData = CompoundAssetsData<CompoundV3AssetData>;
87
+
88
+ export type CompoundMarketsData<T> = { assetsData: T };
89
+ export type CompoundV2MarketsData = CompoundMarketsData<CompoundV2AssetsData>;
90
+ export type CompoundV3MarketsData = CompoundMarketsData<CompoundV3AssetsData>;
91
+
92
+ export interface BaseAdditionalAssetData {
93
+ totalBorrow: string,
94
+ utilization: string,
95
+ marketLiquidity: string,
96
+ rewardSupplySpeed: string,
97
+ rewardBorrowSpeed: string,
98
+ minDebt: string,
99
+ isBase: boolean,
100
+ }
101
+
102
+ export interface CompoundAggregatedPositionData {
103
+ suppliedUsd: string,
104
+ suppliedCollateralUsd: string,
105
+ borrowedUsd: string,
106
+ borrowLimitUsd: string,
107
+ liquidationLimitUsd: string,
108
+ leftToBorrowUsd: string,
109
+ ratio: string,
110
+ collRatio: string,
111
+ netApy: string,
112
+ incentiveUsd: string,
113
+ totalInterestUsd: string,
114
+ liqRatio: string,
115
+ liqPercent: string,
116
+ leveragedType: string,
117
+ leveragedAsset?: string,
118
+ leveragedLsdAssetRatio?: string,
119
+ liquidationPrice?: string,
120
+ minRatio: string,
121
+ debtTooLow: boolean,
122
+ minDebt: string,
123
+ minCollRatio: string,
124
+ collLiquidationRatio: string,
125
+ }
126
+
127
+ export interface CompoundPositionData extends MMPositionData {
128
+ ratio: string,
129
+ minRatio: string,
130
+ suppliedUsd: string,
131
+ borrowedUsd: string,
132
+ borrowLimitUsd: string,
133
+ incentiveUsd: string,
134
+ totalInterestUsd: string,
135
+ isSubscribedToAutomation?: boolean,
136
+ automationResubscribeRequired?: boolean,
137
+ }
138
+
139
+ export interface CompoundV2PositionData extends CompoundPositionData {
140
+ usedAssets: CompoundV2UsedAssets,
141
+ }
142
+
143
+ export interface CompoundV3PositionData extends CompoundPositionData {
144
+ usedAssets: CompoundV3UsedAssets,
145
145
  }