@defisaver/positions-sdk 2.1.4 → 2.1.5

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