@defisaver/positions-sdk 2.1.11 → 2.1.13

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 (97) hide show
  1. package/.mocharc.json +4 -4
  2. package/.nvmrc +1 -1
  3. package/README.md +64 -64
  4. package/cjs/aaveV3/index.js +1 -1
  5. package/cjs/contracts.d.ts +100947 -134653
  6. package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
  7. package/cjs/markets/aave/marketAssets.js +1 -1
  8. package/cjs/services/viem.d.ts +2 -3254
  9. package/cjs/staking/staking.d.ts +1 -1
  10. package/cjs/staking/staking.js +17 -14
  11. package/esm/aaveV3/index.js +1 -1
  12. package/esm/contracts.d.ts +100947 -134653
  13. package/esm/helpers/morphoBlueHelpers/index.js +66 -66
  14. package/esm/markets/aave/marketAssets.js +1 -1
  15. package/esm/services/viem.d.ts +2 -3254
  16. package/esm/staking/staking.d.ts +1 -1
  17. package/esm/staking/staking.js +17 -14
  18. package/package.json +47 -47
  19. package/src/aaveV2/index.ts +240 -240
  20. package/src/aaveV3/index.ts +614 -614
  21. package/src/aaveV3/merit.ts +97 -97
  22. package/src/aaveV3/merkl.ts +74 -74
  23. package/src/claiming/aaveV3.ts +154 -154
  24. package/src/claiming/compV3.ts +22 -22
  25. package/src/claiming/index.ts +12 -12
  26. package/src/claiming/king.ts +66 -66
  27. package/src/claiming/morphoBlue.ts +118 -118
  28. package/src/claiming/spark.ts +225 -225
  29. package/src/compoundV2/index.ts +244 -244
  30. package/src/compoundV3/index.ts +274 -274
  31. package/src/config/contracts.ts +1251 -1251
  32. package/src/constants/index.ts +10 -10
  33. package/src/contracts.ts +120 -120
  34. package/src/curveUsd/index.ts +254 -254
  35. package/src/eulerV2/index.ts +324 -324
  36. package/src/exchange/index.ts +25 -25
  37. package/src/fluid/index.ts +1668 -1668
  38. package/src/helpers/aaveHelpers/index.ts +187 -187
  39. package/src/helpers/compoundHelpers/index.ts +283 -283
  40. package/src/helpers/curveUsdHelpers/index.ts +40 -40
  41. package/src/helpers/eulerHelpers/index.ts +222 -222
  42. package/src/helpers/fluidHelpers/index.ts +326 -326
  43. package/src/helpers/index.ts +10 -10
  44. package/src/helpers/liquityV2Helpers/index.ts +82 -82
  45. package/src/helpers/llamaLendHelpers/index.ts +53 -53
  46. package/src/helpers/makerHelpers/index.ts +52 -52
  47. package/src/helpers/morphoBlueHelpers/index.ts +396 -396
  48. package/src/helpers/sparkHelpers/index.ts +158 -158
  49. package/src/index.ts +47 -47
  50. package/src/liquity/index.ts +159 -159
  51. package/src/liquityV2/index.ts +657 -657
  52. package/src/llamaLend/index.ts +305 -305
  53. package/src/maker/index.ts +223 -223
  54. package/src/markets/aave/index.ts +116 -116
  55. package/src/markets/aave/marketAssets.ts +54 -54
  56. package/src/markets/compound/index.ts +238 -238
  57. package/src/markets/compound/marketsAssets.ts +97 -97
  58. package/src/markets/curveUsd/index.ts +69 -69
  59. package/src/markets/euler/index.ts +26 -26
  60. package/src/markets/fluid/index.ts +2460 -2460
  61. package/src/markets/index.ts +25 -25
  62. package/src/markets/liquityV2/index.ts +102 -102
  63. package/src/markets/llamaLend/contractAddresses.ts +141 -141
  64. package/src/markets/llamaLend/index.ts +235 -235
  65. package/src/markets/morphoBlue/index.ts +895 -895
  66. package/src/markets/spark/index.ts +29 -29
  67. package/src/markets/spark/marketAssets.ts +12 -12
  68. package/src/moneymarket/moneymarketCommonService.ts +80 -80
  69. package/src/morphoBlue/index.ts +274 -274
  70. package/src/portfolio/index.ts +570 -570
  71. package/src/services/priceService.ts +159 -159
  72. package/src/services/utils.ts +115 -115
  73. package/src/services/viem.ts +34 -34
  74. package/src/setup.ts +8 -8
  75. package/src/spark/index.ts +456 -456
  76. package/src/staking/eligibility.ts +53 -53
  77. package/src/staking/index.ts +1 -1
  78. package/src/staking/staking.ts +177 -172
  79. package/src/types/aave.ts +189 -189
  80. package/src/types/claiming.ts +109 -109
  81. package/src/types/common.ts +107 -107
  82. package/src/types/compound.ts +136 -136
  83. package/src/types/curveUsd.ts +123 -123
  84. package/src/types/euler.ts +175 -175
  85. package/src/types/fluid.ts +452 -452
  86. package/src/types/index.ts +13 -13
  87. package/src/types/liquity.ts +30 -30
  88. package/src/types/liquityV2.ts +126 -126
  89. package/src/types/llamaLend.ts +159 -159
  90. package/src/types/maker.ts +63 -63
  91. package/src/types/merit.ts +1 -1
  92. package/src/types/merkl.ts +70 -70
  93. package/src/types/morphoBlue.ts +194 -194
  94. package/src/types/portfolio.ts +60 -60
  95. package/src/types/spark.ts +133 -133
  96. package/src/umbrella/index.ts +69 -69
  97. package/src/umbrella/umbrellaUtils.ts +29 -29
package/.mocharc.json CHANGED
@@ -1,4 +1,4 @@
1
- {
2
- "require": "ts-node/register",
3
- "extension": ["ts"]
4
- }
1
+ {
2
+ "require": "ts-node/register",
3
+ "extension": ["ts"]
4
+ }
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- v20.17.0
1
+ v20.17.0
package/README.md CHANGED
@@ -1,64 +1,64 @@
1
- # DeFi Saver Positions SDK
2
-
3
- Supported protocols:
4
- - [Maker](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/maker)
5
- - [Spark](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/spark)
6
- - [CrvUSD](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/curveUsd)
7
- - [Aave V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/aaveV2)
8
- - [Aave V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/aaveV3)
9
- - [Compound V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/compoundV2)
10
- - [Compound V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/compoundV3)
11
- - [Liquity](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/liquity)
12
-
13
- ## Setup
14
- Supported Node version is v10.
15
-
16
- - run `npm install` (first time)
17
- - run `npm run build`
18
-
19
- `build` command will generate contracts and build ejs and esm folders
20
-
21
- ## How to use
22
- [All available imports](https://github.com/defisaver/defisaver-positions-sdk/blob/main/src/index.ts)
23
-
24
- This is a Compound V3 example, and every other protocol is similar
25
- ```js
26
- import { compoundV3 } from '@defisaver/positions-sdk';
27
-
28
-
29
- // every protocol has market data and user data getters
30
- const {
31
- getCompoundV3MarketsData,
32
- getCompoundV3AccountData,
33
- } = compoundV3;
34
-
35
- const provider = 'Your RPC provider';
36
-
37
- const user = '0x123...';
38
-
39
- const { assetsData } = await getCompoundV3MarketsData(
40
- provider, // rpc for the network you are using (note: can be tenderly or any other testnet rpc)
41
- 1, // network
42
- selectedMarket, // market object like in /src/markets/compound/index.ts
43
- provider, // this must be mainnet rpc - used for getting prices onchain and calculating apys
44
- );
45
-
46
- const userData = await getCompoundV3AccountData(
47
- provider,
48
- 1, // network
49
- userAddress, // EOA or DSProxy
50
- '', // proxy address of the user, or just empty string if checking for EOA
51
- {
52
- selectedMarket, // market object as in /src/markets/compound/index.ts
53
- assetsData,
54
- }
55
- );
56
- ```
57
-
58
- More examples found [here](https://github.com/defisaver/defisaver-positions-sdk/tree/main/tests)
59
-
60
- ## Testing
61
-
62
- `npm run test` - Run all tests
63
-
64
- `npm run test-single --name=your_test_name` - Run single test for specified name e.g. for MyTest.js test name is MyTest
1
+ # DeFi Saver Positions SDK
2
+
3
+ Supported protocols:
4
+ - [Maker](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/maker)
5
+ - [Spark](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/spark)
6
+ - [CrvUSD](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/curveUsd)
7
+ - [Aave V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/aaveV2)
8
+ - [Aave V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/aaveV3)
9
+ - [Compound V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/compoundV2)
10
+ - [Compound V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/compoundV3)
11
+ - [Liquity](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/liquity)
12
+
13
+ ## Setup
14
+ Supported Node version is v10.
15
+
16
+ - run `npm install` (first time)
17
+ - run `npm run build`
18
+
19
+ `build` command will generate contracts and build ejs and esm folders
20
+
21
+ ## How to use
22
+ [All available imports](https://github.com/defisaver/defisaver-positions-sdk/blob/main/src/index.ts)
23
+
24
+ This is a Compound V3 example, and every other protocol is similar
25
+ ```js
26
+ import { compoundV3 } from '@defisaver/positions-sdk';
27
+
28
+
29
+ // every protocol has market data and user data getters
30
+ const {
31
+ getCompoundV3MarketsData,
32
+ getCompoundV3AccountData,
33
+ } = compoundV3;
34
+
35
+ const provider = 'Your RPC provider';
36
+
37
+ const user = '0x123...';
38
+
39
+ const { assetsData } = await getCompoundV3MarketsData(
40
+ provider, // rpc for the network you are using (note: can be tenderly or any other testnet rpc)
41
+ 1, // network
42
+ selectedMarket, // market object like in /src/markets/compound/index.ts
43
+ provider, // this must be mainnet rpc - used for getting prices onchain and calculating apys
44
+ );
45
+
46
+ const userData = await getCompoundV3AccountData(
47
+ provider,
48
+ 1, // network
49
+ userAddress, // EOA or DSProxy
50
+ '', // proxy address of the user, or just empty string if checking for EOA
51
+ {
52
+ selectedMarket, // market object as in /src/markets/compound/index.ts
53
+ assetsData,
54
+ }
55
+ );
56
+ ```
57
+
58
+ More examples found [here](https://github.com/defisaver/defisaver-positions-sdk/tree/main/tests)
59
+
60
+ ## Testing
61
+
62
+ `npm run test` - Run all tests
63
+
64
+ `npm run test-single --name=your_test_name` - Run single test for specified name e.g. for MyTest.js test name is MyTest
@@ -166,7 +166,7 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
166
166
  const rewardForMarket = rewardInfo === null || rewardInfo === void 0 ? void 0 : rewardInfo[_market.underlyingTokenAddress];
167
167
  const isStakingAsset = staking_1.STAKING_ASSETS.includes(_market.symbol);
168
168
  if (isStakingAsset) {
169
- const yieldApy = yield (0, staking_1.getStakingApy)(_market.symbol);
169
+ const yieldApy = yield (0, staking_1.getStakingApy)(_market.symbol, network);
170
170
  _market.supplyIncentives.push({
171
171
  apy: yieldApy,
172
172
  token: _market.symbol,