@defisaver/positions-sdk 0.0.7 → 0.0.8
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.
- package/cjs/aaveV3/index.js +0 -2
- package/esm/aaveV3/index.js +2 -4
- package/package.json +1 -1
- package/src/aaveV3/index.ts +15 -4
- package/yarn-error.log +0 -64
package/cjs/aaveV3/index.js
CHANGED
|
@@ -169,8 +169,6 @@ function getAaveV3MarketData(web3, network, market, defaultWeb3) {
|
|
|
169
169
|
/* eslint-disable no-param-reassign */
|
|
170
170
|
const rewardForMarket = rewardInfo === null || rewardInfo === void 0 ? void 0 : rewardInfo[_market.underlyingTokenAddress];
|
|
171
171
|
if (['wstETH', 'cbETH', 'rETH', 'sDAI'].includes(_market.symbol)) {
|
|
172
|
-
if (!(0, utils_1.isLayer2Network)(network) && _market.symbol === 'cbETH')
|
|
173
|
-
return;
|
|
174
172
|
_market.incentiveSupplyApy = yield (0, staking_1.getStakingApy)(_market.symbol, defaultWeb3);
|
|
175
173
|
_market.incentiveSupplyToken = _market.symbol;
|
|
176
174
|
}
|
package/esm/aaveV3/index.js
CHANGED
|
@@ -9,14 +9,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import Dec from 'decimal.js';
|
|
11
11
|
import { assetAmountInEth, assetAmountInWei, getAssetInfo } from '@defisaver/tokens';
|
|
12
|
-
import { AaveIncentiveDataProviderV3Contract, AaveV3ViewContract,
|
|
12
|
+
import { AaveIncentiveDataProviderV3Contract, AaveV3ViewContract, getConfigContractAbi, getConfigContractAddress, GhoTokenContract, } from '../contracts';
|
|
13
13
|
import { addToObjectIf, ethToWeth, getAbiItem, isLayer2Network, wethToEth, } from '../services/utils';
|
|
14
14
|
import { NetworkNumber, } from '../types/common';
|
|
15
15
|
import { calculateNetApy, getStakingApy } from '../staking';
|
|
16
16
|
import { multicall } from '../multicall';
|
|
17
17
|
import { getAssetsBalances } from '../assets';
|
|
18
18
|
import { calculateBorrowingAssetLimit } from '../moneymarket';
|
|
19
|
-
import { aaveAnyGetAggregatedPositionData, aaveV3IsInIsolationMode, aaveV3IsInSiloedMode } from '../helpers/aaveHelpers';
|
|
19
|
+
import { aaveAnyGetAggregatedPositionData, aaveV3IsInIsolationMode, aaveV3IsInSiloedMode, } from '../helpers/aaveHelpers';
|
|
20
20
|
import { AAVE_V3 } from '../markets/aave';
|
|
21
21
|
export const test = (web3, network) => {
|
|
22
22
|
const contract = AaveV3ViewContract(web3, 1);
|
|
@@ -160,8 +160,6 @@ export function getAaveV3MarketData(web3, network, market, defaultWeb3) {
|
|
|
160
160
|
/* eslint-disable no-param-reassign */
|
|
161
161
|
const rewardForMarket = rewardInfo === null || rewardInfo === void 0 ? void 0 : rewardInfo[_market.underlyingTokenAddress];
|
|
162
162
|
if (['wstETH', 'cbETH', 'rETH', 'sDAI'].includes(_market.symbol)) {
|
|
163
|
-
if (!isLayer2Network(network) && _market.symbol === 'cbETH')
|
|
164
|
-
return;
|
|
165
163
|
_market.incentiveSupplyApy = yield getStakingApy(_market.symbol, defaultWeb3);
|
|
166
164
|
_market.incentiveSupplyToken = _market.symbol;
|
|
167
165
|
}
|
package/package.json
CHANGED
package/src/aaveV3/index.ts
CHANGED
|
@@ -4,15 +4,23 @@ import { assetAmountInEth, assetAmountInWei, getAssetInfo } from '@defisaver/tok
|
|
|
4
4
|
import {
|
|
5
5
|
AaveIncentiveDataProviderV3Contract,
|
|
6
6
|
AaveV3ViewContract,
|
|
7
|
-
GhoTokenContract,
|
|
8
7
|
getConfigContractAbi,
|
|
9
8
|
getConfigContractAddress,
|
|
9
|
+
GhoTokenContract,
|
|
10
10
|
} from '../contracts';
|
|
11
11
|
import {
|
|
12
12
|
addToObjectIf, ethToWeth, getAbiItem, isLayer2Network, wethToEth,
|
|
13
13
|
} from '../services/utils';
|
|
14
14
|
import {
|
|
15
|
-
AaveMarketInfo,
|
|
15
|
+
AaveMarketInfo,
|
|
16
|
+
AaveV3AssetData,
|
|
17
|
+
AaveV3AssetsData,
|
|
18
|
+
AaveV3IncentiveData,
|
|
19
|
+
AaveV3MarketData,
|
|
20
|
+
AaveV3PositionData,
|
|
21
|
+
AaveV3UsedAsset,
|
|
22
|
+
AaveV3UsedAssets,
|
|
23
|
+
EModeCategoryDataMapping,
|
|
16
24
|
} from '../types/aave';
|
|
17
25
|
import {
|
|
18
26
|
Blockish, EthAddress, NetworkNumber, PositionBalances,
|
|
@@ -22,7 +30,11 @@ import { multicall } from '../multicall';
|
|
|
22
30
|
import { IUiIncentiveDataProviderV3 } from '../types/contracts/generated/AaveUiIncentiveDataProviderV3';
|
|
23
31
|
import { getAssetsBalances } from '../assets';
|
|
24
32
|
import { calculateBorrowingAssetLimit } from '../moneymarket';
|
|
25
|
-
import {
|
|
33
|
+
import {
|
|
34
|
+
aaveAnyGetAggregatedPositionData,
|
|
35
|
+
aaveV3IsInIsolationMode,
|
|
36
|
+
aaveV3IsInSiloedMode,
|
|
37
|
+
} from '../helpers/aaveHelpers';
|
|
26
38
|
import { AAVE_V3 } from '../markets/aave';
|
|
27
39
|
|
|
28
40
|
export const test = (web3: Web3, network: NetworkNumber) => {
|
|
@@ -246,7 +258,6 @@ export async function getAaveV3MarketData(web3: Web3, network: NetworkNumber, ma
|
|
|
246
258
|
/* eslint-disable no-param-reassign */
|
|
247
259
|
const rewardForMarket: IUiIncentiveDataProviderV3.AggregatedReserveIncentiveDataStructOutput | undefined = rewardInfo?.[_market.underlyingTokenAddress as any];
|
|
248
260
|
if (['wstETH', 'cbETH', 'rETH', 'sDAI'].includes(_market.symbol)) {
|
|
249
|
-
if (!isLayer2Network(network) && _market.symbol === 'cbETH') return;
|
|
250
261
|
_market.incentiveSupplyApy = await getStakingApy(_market.symbol, defaultWeb3);
|
|
251
262
|
_market.incentiveSupplyToken = _market.symbol;
|
|
252
263
|
}
|
package/yarn-error.log
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
Arguments:
|
|
2
|
-
/Users/stefan/.nvm/versions/node/v14.19.0/bin/node /usr/local/Cellar/yarn/1.22.19/libexec/bin/yarn.js
|
|
3
|
-
|
|
4
|
-
PATH:
|
|
5
|
-
/Users/stefan/.nvm/versions/node/v14.19.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin:/Users/stefan/WebstormProjects/defisaver-positions-sdk/node_modules/.bin:/usr/local/go
|
|
6
|
-
|
|
7
|
-
Yarn version:
|
|
8
|
-
1.22.19
|
|
9
|
-
|
|
10
|
-
Node version:
|
|
11
|
-
14.19.0
|
|
12
|
-
|
|
13
|
-
Platform:
|
|
14
|
-
darwin x64
|
|
15
|
-
|
|
16
|
-
Trace:
|
|
17
|
-
Error: incorrect data check
|
|
18
|
-
at Zlib.zlibOnError [as onerror] (zlib.js:187:17)
|
|
19
|
-
|
|
20
|
-
npm manifest:
|
|
21
|
-
{
|
|
22
|
-
"name": "defisaver-positions-sdk",
|
|
23
|
-
"version": "0.0.1",
|
|
24
|
-
"description": "",
|
|
25
|
-
"main": "./cjs/index.js",
|
|
26
|
-
"module": "./esm/src/index.js",
|
|
27
|
-
"types": "./esm/src/index.d.ts",
|
|
28
|
-
"scripts": {
|
|
29
|
-
"build:esm": "rm -rf esm && tsc -p tsconfig.json",
|
|
30
|
-
"build:cjs": "rm -rf cjs && tsc -p tsconfig.cjs.json",
|
|
31
|
-
"build": "npm run build:cjs && npm run build:esm",
|
|
32
|
-
"dev": "tsc -p tsconfig.cjs.json --watch",
|
|
33
|
-
"lint": "eslint src/ --fix",
|
|
34
|
-
"generate-contracts": "node scripts/generateContracts.js",
|
|
35
|
-
"test": "mocha tests/*",
|
|
36
|
-
"build-test": "npm run build && mocha tests/*"
|
|
37
|
-
},
|
|
38
|
-
"keywords": [],
|
|
39
|
-
"author": "",
|
|
40
|
-
"license": "ISC",
|
|
41
|
-
"dependencies": {
|
|
42
|
-
"@defisaver/tokens": "^1.4.56",
|
|
43
|
-
"decimal.js": "^10.4.3"
|
|
44
|
-
},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"@defisaver/eslint-config": "^1.0.1",
|
|
47
|
-
"chai": "^4.3.8",
|
|
48
|
-
"dotenv": "^16.3.1",
|
|
49
|
-
"eslint": "^8.49.0",
|
|
50
|
-
"mocha": "^10.2.0",
|
|
51
|
-
"typechain": "^8.3.1",
|
|
52
|
-
"typechain-target-web3-v1-3mihai3": "^6.0.2",
|
|
53
|
-
"typescript": "^5.2.2"
|
|
54
|
-
},
|
|
55
|
-
"peerDependencies": {
|
|
56
|
-
"web3": "^1.10.2"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
yarn manifest:
|
|
61
|
-
No manifest
|
|
62
|
-
|
|
63
|
-
Lockfile:
|
|
64
|
-
No lockfile
|