@defisaver/positions-sdk 0.0.46 → 0.0.47

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.
@@ -24,7 +24,7 @@ const aave_1 = require("../markets/aave");
24
24
  const aaveHelpers_1 = require("../helpers/aaveHelpers");
25
25
  const priceService_1 = require("../services/priceService");
26
26
  const getAaveV2MarketsData = (web3, network, selectedMarket, mainnetWeb3) => __awaiter(void 0, void 0, void 0, function* () {
27
- const ethPrice = yield (0, priceService_1.getEthPrice)(mainnetWeb3);
27
+ const ethPrice = yield (0, priceService_1.getEthPrice)(web3);
28
28
  const _addresses = selectedMarket.assets.map(a => (0, tokens_1.getAssetInfo)((0, utils_1.ethToWeth)(a)).address);
29
29
  const loanInfoContract = (0, contracts_1.AaveLoanInfoV2Contract)(web3, network);
30
30
  const marketAddress = selectedMarket.providerAddress;
package/cjs/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import './setup';
1
2
  import * as aaveV3 from './aaveV3';
2
3
  import * as morphoAaveV3 from './morphoAaveV3';
3
4
  import * as aaveV2 from './aaveV2';
package/cjs/index.js CHANGED
@@ -27,6 +27,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.morphoBlue = exports.helpers = exports.markets = exports.moneymarket = exports.multicall = exports.staking = exports.exchange = exports.chickenBonds = exports.maker = exports.liquity = exports.curveUsd = exports.spark = exports.compoundV3 = exports.compoundV2 = exports.morphoAaveV3 = exports.morphoAaveV2 = exports.aaveV3 = exports.aaveV2 = void 0;
30
+ require("./setup");
30
31
  const aaveV3 = __importStar(require("./aaveV3"));
31
32
  exports.aaveV3 = aaveV3;
32
33
  const morphoAaveV3 = __importStar(require("./morphoAaveV3"));
@@ -24,7 +24,7 @@ const aaveV3_1 = require("../aaveV3");
24
24
  const aaveHelpers_1 = require("../helpers/aaveHelpers");
25
25
  const priceService_1 = require("../services/priceService");
26
26
  const getMorphoAaveV2MarketsData = (web3, network, mainnetWeb3) => __awaiter(void 0, void 0, void 0, function* () {
27
- const ethPrice = yield (0, priceService_1.getEthPrice)(mainnetWeb3);
27
+ const ethPrice = yield (0, priceService_1.getEthPrice)(web3);
28
28
  const morphoAaveV2ViewContract = (0, contracts_1.MorphoAaveV2ViewContract)(web3, network);
29
29
  const [contractData, morphoRewardsRes] = yield Promise.allSettled([
30
30
  morphoAaveV2ViewContract.methods.getAllMarketsInfo().call(),
package/cjs/setup.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/cjs/setup.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const decimal_js_1 = __importDefault(require("decimal.js"));
7
+ decimal_js_1.default.set({
8
+ rounding: decimal_js_1.default.ROUND_DOWN,
9
+ toExpPos: 9e15,
10
+ toExpNeg: -9e15,
11
+ precision: 50,
12
+ });
@@ -18,7 +18,7 @@ import { AAVE_V2 } from '../markets/aave';
18
18
  import { aaveAnyGetAggregatedPositionData } from '../helpers/aaveHelpers';
19
19
  import { getEthPrice } from '../services/priceService';
20
20
  export const getAaveV2MarketsData = (web3, network, selectedMarket, mainnetWeb3) => __awaiter(void 0, void 0, void 0, function* () {
21
- const ethPrice = yield getEthPrice(mainnetWeb3);
21
+ const ethPrice = yield getEthPrice(web3);
22
22
  const _addresses = selectedMarket.assets.map(a => getAssetInfo(ethToWeth(a)).address);
23
23
  const loanInfoContract = AaveLoanInfoV2Contract(web3, network);
24
24
  const marketAddress = selectedMarket.providerAddress;
package/esm/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import './setup';
1
2
  import * as aaveV3 from './aaveV3';
2
3
  import * as morphoAaveV3 from './morphoAaveV3';
3
4
  import * as aaveV2 from './aaveV2';
package/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import './setup';
1
2
  import * as aaveV3 from './aaveV3';
2
3
  import * as morphoAaveV3 from './morphoAaveV3';
3
4
  import * as aaveV2 from './aaveV2';
@@ -18,7 +18,7 @@ import { EMPTY_AAVE_DATA } from '../aaveV3';
18
18
  import { aaveAnyGetAggregatedPositionData } from '../helpers/aaveHelpers';
19
19
  import { getEthPrice } from '../services/priceService';
20
20
  export const getMorphoAaveV2MarketsData = (web3, network, mainnetWeb3) => __awaiter(void 0, void 0, void 0, function* () {
21
- const ethPrice = yield getEthPrice(mainnetWeb3);
21
+ const ethPrice = yield getEthPrice(web3);
22
22
  const morphoAaveV2ViewContract = MorphoAaveV2ViewContract(web3, network);
23
23
  const [contractData, morphoRewardsRes] = yield Promise.allSettled([
24
24
  morphoAaveV2ViewContract.methods.getAllMarketsInfo().call(),
package/esm/setup.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/esm/setup.js ADDED
@@ -0,0 +1,7 @@
1
+ import Decimal from 'decimal.js';
2
+ Decimal.set({
3
+ rounding: Decimal.ROUND_DOWN,
4
+ toExpPos: 9e15,
5
+ toExpNeg: -9e15,
6
+ precision: 50,
7
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/positions-sdk",
3
- "version": "0.0.46",
3
+ "version": "0.0.47",
4
4
  "description": "",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -17,7 +17,7 @@ import { aaveAnyGetAggregatedPositionData } from '../helpers/aaveHelpers';
17
17
  import { getEthPrice } from '../services/priceService';
18
18
 
19
19
  export const getAaveV2MarketsData = async (web3: Web3, network: NetworkNumber, selectedMarket: AaveMarketInfo, mainnetWeb3: Web3) => {
20
- const ethPrice = await getEthPrice(mainnetWeb3);
20
+ const ethPrice = await getEthPrice(web3);
21
21
  const _addresses = selectedMarket.assets.map(a => getAssetInfo(ethToWeth(a)).address);
22
22
  const loanInfoContract = AaveLoanInfoV2Contract(web3, network);
23
23
  const marketAddress = selectedMarket.providerAddress;
@@ -224,4 +224,4 @@ export const getAaveV2FullPositionData = async (web3: Web3, network: NetworkNumb
224
224
  const marketData = await getAaveV2MarketsData(web3, network, market, mainnetWeb3);
225
225
  const positionData = await getAaveV2AccountData(web3, network, address, marketData.assetsData, market);
226
226
  return positionData;
227
- };
227
+ };
package/src/index.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import './setup';
2
+
1
3
  import * as aaveV3 from './aaveV3';
2
4
  import * as morphoAaveV3 from './morphoAaveV3';
3
5
  import * as aaveV2 from './aaveV2';
@@ -17,7 +17,7 @@ import { aaveAnyGetAggregatedPositionData } from '../helpers/aaveHelpers';
17
17
  import { getEthPrice } from '../services/priceService';
18
18
 
19
19
  export const getMorphoAaveV2MarketsData = async (web3: Web3, network: NetworkNumber, mainnetWeb3: Web3): Promise<MorphoAaveV2MarketData> => {
20
- const ethPrice = await getEthPrice(mainnetWeb3);
20
+ const ethPrice = await getEthPrice(web3);
21
21
  const morphoAaveV2ViewContract = MorphoAaveV2ViewContract(web3, network);
22
22
 
23
23
  const [contractData, morphoRewardsRes] = await Promise.allSettled([
@@ -253,4 +253,4 @@ export const getMorphoAaveV2FullPositionData = async (web3: Web3, network: Netwo
253
253
  const marketData = await getMorphoAaveV2MarketsData(web3, network, mainnetWeb3);
254
254
  const positionData = await getMorphoAaveV2AccountData(web3, network, address, marketData.assetsData);
255
255
  return positionData;
256
- };
256
+ };
package/src/setup.ts ADDED
@@ -0,0 +1,8 @@
1
+ import Decimal from 'decimal.js';
2
+
3
+ Decimal.set({
4
+ rounding: Decimal.ROUND_DOWN,
5
+ toExpPos: 9e15,
6
+ toExpNeg: -9e15,
7
+ precision: 50,
8
+ });