@defisaver/positions-sdk 2.0.1 → 2.0.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 (78) hide show
  1. package/.mocharc.json +4 -4
  2. package/.nvmrc +1 -1
  3. package/README.md +64 -64
  4. package/cjs/config/contracts.d.ts +1018 -16
  5. package/cjs/config/contracts.js +12 -4
  6. package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
  7. package/cjs/markets/aave/marketAssets.js +1 -1
  8. package/cjs/staking/staking.js +1 -1
  9. package/esm/config/contracts.d.ts +1018 -16
  10. package/esm/config/contracts.js +12 -4
  11. package/esm/helpers/morphoBlueHelpers/index.js +66 -66
  12. package/esm/markets/aave/marketAssets.js +1 -1
  13. package/esm/staking/staking.js +1 -1
  14. package/package.json +47 -47
  15. package/src/aaveV2/index.ts +236 -236
  16. package/src/aaveV3/index.ts +489 -489
  17. package/src/compoundV2/index.ts +240 -240
  18. package/src/compoundV3/index.ts +270 -270
  19. package/src/config/contracts.ts +1090 -1082
  20. package/src/constants/index.ts +6 -6
  21. package/src/contracts.ts +107 -107
  22. package/src/curveUsd/index.ts +250 -250
  23. package/src/eulerV2/index.ts +314 -314
  24. package/src/exchange/index.ts +25 -25
  25. package/src/fluid/index.ts +1568 -1568
  26. package/src/helpers/aaveHelpers/index.ts +170 -170
  27. package/src/helpers/compoundHelpers/index.ts +261 -261
  28. package/src/helpers/curveUsdHelpers/index.ts +40 -40
  29. package/src/helpers/eulerHelpers/index.ts +259 -259
  30. package/src/helpers/fluidHelpers/index.ts +324 -324
  31. package/src/helpers/index.ts +10 -10
  32. package/src/helpers/liquityV2Helpers/index.ts +80 -80
  33. package/src/helpers/llamaLendHelpers/index.ts +53 -53
  34. package/src/helpers/makerHelpers/index.ts +52 -52
  35. package/src/helpers/morphoBlueHelpers/index.ts +390 -390
  36. package/src/helpers/sparkHelpers/index.ts +155 -155
  37. package/src/index.ts +45 -45
  38. package/src/liquity/index.ts +104 -104
  39. package/src/liquityV2/index.ts +408 -408
  40. package/src/llamaLend/index.ts +296 -296
  41. package/src/maker/index.ts +223 -223
  42. package/src/markets/aave/index.ts +116 -116
  43. package/src/markets/aave/marketAssets.ts +44 -44
  44. package/src/markets/compound/index.ts +216 -216
  45. package/src/markets/compound/marketsAssets.ts +83 -83
  46. package/src/markets/curveUsd/index.ts +69 -69
  47. package/src/markets/euler/index.ts +26 -26
  48. package/src/markets/fluid/index.ts +2456 -2456
  49. package/src/markets/index.ts +25 -25
  50. package/src/markets/liquityV2/index.ts +102 -102
  51. package/src/markets/llamaLend/contractAddresses.ts +141 -141
  52. package/src/markets/llamaLend/index.ts +235 -235
  53. package/src/markets/morphoBlue/index.ts +895 -895
  54. package/src/markets/spark/index.ts +29 -29
  55. package/src/markets/spark/marketAssets.ts +10 -10
  56. package/src/moneymarket/moneymarketCommonService.ts +80 -80
  57. package/src/morphoBlue/index.ts +222 -222
  58. package/src/portfolio/index.ts +285 -285
  59. package/src/services/priceService.ts +159 -159
  60. package/src/services/utils.ts +63 -63
  61. package/src/services/viem.ts +30 -30
  62. package/src/setup.ts +8 -8
  63. package/src/spark/index.ts +456 -456
  64. package/src/staking/staking.ts +192 -192
  65. package/src/types/aave.ts +194 -194
  66. package/src/types/common.ts +87 -87
  67. package/src/types/compound.ts +136 -136
  68. package/src/types/curveUsd.ts +121 -121
  69. package/src/types/euler.ts +174 -174
  70. package/src/types/fluid.ts +450 -450
  71. package/src/types/index.ts +11 -11
  72. package/src/types/liquity.ts +30 -30
  73. package/src/types/liquityV2.ts +126 -126
  74. package/src/types/llamaLend.ts +157 -157
  75. package/src/types/maker.ts +63 -63
  76. package/src/types/morphoBlue.ts +194 -194
  77. package/src/types/portfolio.ts +60 -60
  78. package/src/types/spark.ts +137 -137
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