@defisaver/positions-sdk 0.0.99 → 0.0.100

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 (71) hide show
  1. package/README.md +63 -63
  2. package/cjs/config/contracts.d.ts +316 -14
  3. package/cjs/config/contracts.js +34 -12
  4. package/cjs/maker/index.js +1 -1
  5. package/cjs/types/contracts/generated/AaveV3View.d.ts +29 -2
  6. package/cjs/types/contracts/generated/SparkView.d.ts +29 -2
  7. package/esm/config/contracts.d.ts +316 -14
  8. package/esm/config/contracts.js +34 -12
  9. package/esm/maker/index.js +1 -1
  10. package/esm/types/contracts/generated/AaveV3View.d.ts +29 -2
  11. package/esm/types/contracts/generated/SparkView.d.ts +29 -2
  12. package/package.json +41 -40
  13. package/src/aaveV2/index.ts +227 -227
  14. package/src/aaveV3/index.ts +558 -558
  15. package/src/assets/index.ts +60 -60
  16. package/src/chickenBonds/index.ts +123 -123
  17. package/src/compoundV2/index.ts +219 -219
  18. package/src/compoundV3/index.ts +266 -266
  19. package/src/config/contracts.js +871 -848
  20. package/src/constants/index.ts +5 -5
  21. package/src/contracts.ts +128 -128
  22. package/src/curveUsd/index.ts +229 -229
  23. package/src/exchange/index.ts +17 -17
  24. package/src/helpers/aaveHelpers/index.ts +134 -134
  25. package/src/helpers/chickenBondsHelpers/index.ts +23 -23
  26. package/src/helpers/compoundHelpers/index.ts +181 -181
  27. package/src/helpers/curveUsdHelpers/index.ts +40 -40
  28. package/src/helpers/index.ts +7 -7
  29. package/src/helpers/llamaLendHelpers/index.ts +45 -45
  30. package/src/helpers/makerHelpers/index.ts +94 -94
  31. package/src/helpers/morphoBlueHelpers/index.ts +117 -117
  32. package/src/helpers/sparkHelpers/index.ts +106 -106
  33. package/src/index.ts +46 -46
  34. package/src/liquity/index.ts +116 -116
  35. package/src/llamaLend/index.ts +268 -268
  36. package/src/maker/index.ts +117 -117
  37. package/src/markets/aave/index.ts +80 -80
  38. package/src/markets/aave/marketAssets.ts +24 -24
  39. package/src/markets/compound/index.ts +142 -142
  40. package/src/markets/compound/marketsAssets.ts +50 -50
  41. package/src/markets/curveUsd/index.ts +69 -69
  42. package/src/markets/index.ts +5 -5
  43. package/src/markets/llamaLend/contractAddresses.ts +95 -95
  44. package/src/markets/llamaLend/index.ts +150 -150
  45. package/src/markets/morphoBlue/index.ts +611 -611
  46. package/src/markets/spark/index.ts +29 -29
  47. package/src/markets/spark/marketAssets.ts +10 -10
  48. package/src/moneymarket/moneymarketCommonService.ts +76 -76
  49. package/src/morphoAaveV2/index.ts +256 -256
  50. package/src/morphoAaveV3/index.ts +612 -612
  51. package/src/morphoBlue/index.ts +171 -171
  52. package/src/multicall/index.ts +22 -22
  53. package/src/services/dsrService.ts +15 -15
  54. package/src/services/priceService.ts +21 -21
  55. package/src/services/utils.ts +51 -51
  56. package/src/setup.ts +8 -8
  57. package/src/spark/index.ts +424 -424
  58. package/src/staking/staking.ts +187 -187
  59. package/src/types/aave.ts +256 -256
  60. package/src/types/chickenBonds.ts +45 -45
  61. package/src/types/common.ts +84 -84
  62. package/src/types/compound.ts +128 -128
  63. package/src/types/contracts/generated/AaveV3View.ts +43 -3
  64. package/src/types/contracts/generated/SparkView.ts +43 -3
  65. package/src/types/curveUsd.ts +118 -118
  66. package/src/types/index.ts +8 -8
  67. package/src/types/liquity.ts +30 -30
  68. package/src/types/llamaLend.ts +143 -143
  69. package/src/types/maker.ts +50 -50
  70. package/src/types/morphoBlue.ts +139 -139
  71. package/src/types/spark.ts +106 -106
@@ -23,7 +23,7 @@ export const getMakerAccountBalances = (web3, network, block, addressMapping, cd
23
23
  }
24
24
  const viewContract = McdViewContract(web3, network, block);
25
25
  let ilk;
26
- const needsIlk = new Dec(block).lt(14410792) && new Dec(block).gte(14384301);
26
+ const needsIlk = block !== 'latest' && new Dec(block).lt(14410792) && new Dec(block).gte(14384301);
27
27
  if (needsIlk) {
28
28
  ilk = (yield viewContract.methods.getUrnAndIlk(managerAddress, cdpId).call({}, block)).ilk;
29
29
  }
@@ -10,6 +10,30 @@ export interface EventOptions {
10
10
  topics?: string[];
11
11
  }
12
12
  export declare namespace AaveV3View {
13
+ type LiquidityChangeParamsStruct = [string, number | string | BN, number | string | BN] | {
14
+ reserveAddress: string;
15
+ liquidityAdded: number | string | BN;
16
+ liquidityTaken: number | string | BN;
17
+ };
18
+ type LiquidityChangeParamsStructOutputArray = [string, string, string];
19
+ type LiquidityChangeParamsStructOutputStruct = {
20
+ reserveAddress: string;
21
+ liquidityAdded: string;
22
+ liquidityTaken: string;
23
+ };
24
+ type LiquidityChangeParamsStructOutput = LiquidityChangeParamsStructOutputArray & LiquidityChangeParamsStructOutputStruct;
25
+ type EstimatedRatesStruct = [string, number | string | BN, number | string | BN] | {
26
+ reserveAddress: string;
27
+ supplyRate: number | string | BN;
28
+ variableBorrowRate: number | string | BN;
29
+ };
30
+ type EstimatedRatesStructOutputArray = [string, string, string];
31
+ type EstimatedRatesStructOutputStruct = {
32
+ reserveAddress: string;
33
+ supplyRate: string;
34
+ variableBorrowRate: string;
35
+ };
36
+ type EstimatedRatesStructOutput = EstimatedRatesStructOutputArray & EstimatedRatesStructOutputStruct;
13
37
  type TokenInfoFullStruct = [
14
38
  string,
15
39
  string,
@@ -159,6 +183,7 @@ export declare namespace AaveV3View {
159
183
  number | string | BN,
160
184
  number | string | BN,
161
185
  string[],
186
+ boolean[],
162
187
  string[],
163
188
  number | string | BN[],
164
189
  number | string | BN[],
@@ -173,6 +198,7 @@ export declare namespace AaveV3View {
173
198
  ratio: number | string | BN;
174
199
  eMode: number | string | BN;
175
200
  collAddr: string[];
201
+ enabledAsColl: boolean[];
176
202
  borrowAddr: string[];
177
203
  collAmounts: number | string | BN[];
178
204
  borrowStableAmounts: number | string | BN[];
@@ -188,6 +214,7 @@ export declare namespace AaveV3View {
188
214
  string,
189
215
  string,
190
216
  string[],
217
+ boolean[],
191
218
  string[],
192
219
  string[],
193
220
  string[],
@@ -203,6 +230,7 @@ export declare namespace AaveV3View {
203
230
  ratio: string;
204
231
  eMode: string;
205
232
  collAddr: string[];
233
+ enabledAsColl: boolean[];
206
234
  borrowAddr: string[];
207
235
  collAmounts: string[];
208
236
  borrowStableAmounts: string[];
@@ -276,8 +304,7 @@ export interface AaveV3View extends BaseContract {
276
304
  clone(): AaveV3View;
277
305
  methods: {
278
306
  AAVE_REFERRAL_CODE(): NonPayableTransactionObject<string>;
279
- STABLE_ID(): NonPayableTransactionObject<string>;
280
- VARIABLE_ID(): NonPayableTransactionObject<string>;
307
+ getApyAfterValuesEstimation(_market: string, _reserveParams: AaveV3View.LiquidityChangeParamsStruct[]): NonPayableTransactionObject<AaveV3View.EstimatedRatesStructOutput[]>;
281
308
  getAssetPrice(_market: string, _tokenAddr: string): NonPayableTransactionObject<string>;
282
309
  getCollFactors(_market: string, _tokens: string[]): NonPayableTransactionObject<string[]>;
283
310
  getEModeCollateralFactor(emodeCategory: number | string | BN, lendingPool: string): NonPayableTransactionObject<string>;
@@ -10,6 +10,30 @@ export interface EventOptions {
10
10
  topics?: string[];
11
11
  }
12
12
  export declare namespace SparkView {
13
+ type LiquidityChangeParamsStruct = [string, number | string | BN, number | string | BN] | {
14
+ reserveAddress: string;
15
+ liquidityAdded: number | string | BN;
16
+ liquidityTaken: number | string | BN;
17
+ };
18
+ type LiquidityChangeParamsStructOutputArray = [string, string, string];
19
+ type LiquidityChangeParamsStructOutputStruct = {
20
+ reserveAddress: string;
21
+ liquidityAdded: string;
22
+ liquidityTaken: string;
23
+ };
24
+ type LiquidityChangeParamsStructOutput = LiquidityChangeParamsStructOutputArray & LiquidityChangeParamsStructOutputStruct;
25
+ type EstimatedRatesStruct = [string, number | string | BN, number | string | BN] | {
26
+ reserveAddress: string;
27
+ supplyRate: number | string | BN;
28
+ variableBorrowRate: number | string | BN;
29
+ };
30
+ type EstimatedRatesStructOutputArray = [string, string, string];
31
+ type EstimatedRatesStructOutputStruct = {
32
+ reserveAddress: string;
33
+ supplyRate: string;
34
+ variableBorrowRate: string;
35
+ };
36
+ type EstimatedRatesStructOutput = EstimatedRatesStructOutputArray & EstimatedRatesStructOutputStruct;
13
37
  type TokenInfoFullStruct = [
14
38
  string,
15
39
  string,
@@ -159,6 +183,7 @@ export declare namespace SparkView {
159
183
  number | string | BN,
160
184
  number | string | BN,
161
185
  string[],
186
+ boolean[],
162
187
  string[],
163
188
  number | string | BN[],
164
189
  number | string | BN[],
@@ -173,6 +198,7 @@ export declare namespace SparkView {
173
198
  ratio: number | string | BN;
174
199
  eMode: number | string | BN;
175
200
  collAddr: string[];
201
+ enabledAsColl: boolean[];
176
202
  borrowAddr: string[];
177
203
  collAmounts: number | string | BN[];
178
204
  borrowStableAmounts: number | string | BN[];
@@ -188,6 +214,7 @@ export declare namespace SparkView {
188
214
  string,
189
215
  string,
190
216
  string[],
217
+ boolean[],
191
218
  string[],
192
219
  string[],
193
220
  string[],
@@ -203,6 +230,7 @@ export declare namespace SparkView {
203
230
  ratio: string;
204
231
  eMode: string;
205
232
  collAddr: string[];
233
+ enabledAsColl: boolean[];
206
234
  borrowAddr: string[];
207
235
  collAmounts: string[];
208
236
  borrowStableAmounts: string[];
@@ -276,8 +304,7 @@ export interface SparkView extends BaseContract {
276
304
  clone(): SparkView;
277
305
  methods: {
278
306
  SPARK_REFERRAL_CODE(): NonPayableTransactionObject<string>;
279
- STABLE_ID(): NonPayableTransactionObject<string>;
280
- VARIABLE_ID(): NonPayableTransactionObject<string>;
307
+ getApyAfterValuesEstimation(_market: string, _reserveParams: SparkView.LiquidityChangeParamsStruct[]): NonPayableTransactionObject<SparkView.EstimatedRatesStructOutput[]>;
281
308
  getAssetPrice(_market: string, _tokenAddr: string): NonPayableTransactionObject<string>;
282
309
  getCollFactors(_market: string, _tokens: string[]): NonPayableTransactionObject<string[]>;
283
310
  getEModeCollateralFactor(emodeCategory: number | string | BN, lendingPool: string): NonPayableTransactionObject<string>;
package/package.json CHANGED
@@ -1,40 +1,41 @@
1
- {
2
- "name": "@defisaver/positions-sdk",
3
- "version": "0.0.99",
4
- "description": "",
5
- "main": "./cjs/index.js",
6
- "module": "./esm/index.js",
7
- "types": "./esm/index.d.ts",
8
- "scripts": {
9
- "build:esm": "rm -rf esm && tsc -p tsconfig.json",
10
- "build:cjs": "rm -rf cjs && tsc -p tsconfig.cjs.json",
11
- "build": "npm run generate-contracts && npm run build:cjs && npm run build:esm",
12
- "dev": "npm run generate-contracts && tsc -p tsconfig.cjs.json --watch",
13
- "lint": "eslint src/ --fix",
14
- "generate-contracts": "node scripts/generateContracts.js",
15
- "test": "mocha tests/*",
16
- "build-test": "npm run build && mocha tests/*"
17
- },
18
- "keywords": [],
19
- "author": "",
20
- "license": "ISC",
21
- "dependencies": {
22
- "@defisaver/tokens": "^1.5.26",
23
- "@ethersproject/bignumber": "^5.7.0",
24
- "@morpho-org/morpho-aave-v3-sdk": "^1.5.3",
25
- "decimal.js": "^10.4.3"
26
- },
27
- "devDependencies": {
28
- "@defisaver/eslint-config": "^1.0.1",
29
- "chai": "^4.3.8",
30
- "dotenv": "^16.3.1",
31
- "eslint": "^8.49.0",
32
- "mocha": "^10.2.0",
33
- "typechain": "^8.3.1",
34
- "typechain-target-web3-v1-3mihai3": "^6.0.2",
35
- "typescript": "^5.2.2"
36
- },
37
- "peerDependencies": {
38
- "web3": "^1.10.2"
39
- }
40
- }
1
+ {
2
+ "name": "@defisaver/positions-sdk",
3
+ "version": "0.0.100",
4
+ "description": "",
5
+ "main": "./cjs/index.js",
6
+ "module": "./esm/index.js",
7
+ "types": "./esm/index.d.ts",
8
+ "scripts": {
9
+ "build:esm": "rm -rf esm && tsc -p tsconfig.json",
10
+ "build:cjs": "rm -rf cjs && tsc -p tsconfig.cjs.json",
11
+ "build": "npm run generate-contracts && npm run build:cjs && npm run build:esm",
12
+ "dev": "npm run generate-contracts && tsc -p tsconfig.cjs.json --watch",
13
+ "lint": "eslint src/ --fix",
14
+ "generate-contracts": "node scripts/generateContracts.js",
15
+ "test": "mocha tests/*",
16
+ "test:debugger": "mocha --inspect-brk tests/*",
17
+ "build-test": "npm run build && mocha tests/*"
18
+ },
19
+ "keywords": [],
20
+ "author": "",
21
+ "license": "ISC",
22
+ "dependencies": {
23
+ "@defisaver/tokens": "^1.5.27",
24
+ "@ethersproject/bignumber": "^5.7.0",
25
+ "@morpho-org/morpho-aave-v3-sdk": "^1.5.3",
26
+ "decimal.js": "^10.4.3"
27
+ },
28
+ "devDependencies": {
29
+ "@defisaver/eslint-config": "^1.0.1",
30
+ "chai": "^4.3.8",
31
+ "dotenv": "^16.3.1",
32
+ "eslint": "^8.49.0",
33
+ "mocha": "^10.2.0",
34
+ "typechain": "^8.3.1",
35
+ "typechain-target-web3-v1-3mihai3": "^6.0.2",
36
+ "typescript": "^5.2.2"
37
+ },
38
+ "peerDependencies": {
39
+ "web3": "^1.10.2"
40
+ }
41
+ }