@sonarwatch/portfolio-plugins 0.11.168 → 0.11.170

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.11.170](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.169...plugins-0.11.170) (2024-04-08)
6
+
7
+
8
+
9
+ ## [0.11.169](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.168...plugins-0.11.169) (2024-04-08)
10
+
11
+
12
+
5
13
  ## [0.11.168](https://github.com/sonarwatch/portfolio/compare/plugins-0.11.167...plugins-0.11.168) (2024-04-08)
6
14
 
7
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.11.168",
3
+ "version": "0.11.170",
4
4
  "type": "commonjs",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
@@ -41,7 +41,7 @@
41
41
  "web3-v1": "npm:web3@^1.5.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@sonarwatch/portfolio-core": "0.11.168"
44
+ "@sonarwatch/portfolio-core": "0.11.170"
45
45
  },
46
46
  "main": "./src/index.js",
47
47
  "types": "./src/index.d.ts"
@@ -13,8 +13,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
- const spl_name_service_1 = require("@bonfida/spl-name-service");
17
- const js_1 = require("@metaplex-foundation/js");
18
16
  const web3_js_1 = require("@solana/web3.js");
19
17
  const constants_1 = require("./constants");
20
18
  const clients_1 = require("../../utils/clients");
@@ -27,17 +25,20 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
27
25
  // Trying to get https://solscan.io/account/4g5zooignaoVrS6NdUWEcNLxZmJGN9UJBAGtrUiBwieF
28
26
  const pda = (0, helpers_1.getPoolPda)(new web3_js_1.PublicKey(owner));
29
27
  const poolAccount = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, pool_1.poolStruct, pda);
30
- const tokenPriceById = yield cache.getTokenPricesAsMap([spl_name_service_1.USDC_MINT.toString(), js_1.WRAPPED_SOL_MINT.toString()], portfolio_core_1.NetworkId.solana);
31
28
  if (!poolAccount || poolAccount.totalAmount.isZero())
32
29
  return [];
33
- const usdcTokenPrice = tokenPriceById.get(spl_name_service_1.USDC_MINT.toString());
30
+ const tokenPrice = yield cache.getTokenPrice(poolAccount.currency.toString(), portfolio_core_1.NetworkId.solana);
31
+ if (!tokenPrice)
32
+ return [];
34
33
  const borrowedAssets = [];
35
34
  const borrowedYields = [];
36
35
  const suppliedAssets = [];
37
36
  const suppliedYields = [];
38
37
  const rewardAssets = [];
39
- const amount = poolAccount.totalAmount.dividedBy(Math.pow(10, 6)).toNumber();
40
- suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(spl_name_service_1.USDC_MINT.toString(), amount, portfolio_core_1.NetworkId.solana, usdcTokenPrice));
38
+ const amount = poolAccount.totalAmount
39
+ .dividedBy(Math.pow(10, tokenPrice.decimals))
40
+ .toNumber();
41
+ suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPrice.address, amount, portfolio_core_1.NetworkId.solana, tokenPrice));
41
42
  if (suppliedAssets.length === 0 && borrowedAssets.length === 0)
42
43
  return [];
43
44
  const { borrowedValue, healthRatio, rewardValue, suppliedValue, value } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets);
@@ -1 +1 @@
1
- {"version":3,"file":"poolsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/rain/poolsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,gEAAsD;AACtD,gDAA2D;AAC3D,6CAA4C;AAG5C,2CAAyC;AACzC,iDAAsD;AACtD,yCAA4C;AAC5C,qGAA6E;AAC7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IAE1E,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,GACrE,IAAA,wCAAuB,EAAC,cAAc,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;IAExE,OAAO;QACL;YACE,IAAI,EAAE,qCAAoB,CAAC,UAAU;YACrC,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,SAAS;YAChB,KAAK;YACL,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,eAAe,EAAE,IAAI;gBACrB,WAAW;gBACX,WAAW;gBACX,YAAY;gBACZ,KAAK;aACN;SACF;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"poolsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/rain/poolsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,6CAA4C;AAG5C,2CAAyC;AACzC,iDAAsD;AACtD,yCAA4C;AAC5C,qGAA6E;AAC7E,uCAAuC;AACvC,kFAA+E;AAE/E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,wFAAwF;IAExF,MAAM,GAAG,GAAG,IAAA,oBAAU,EAAC,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAE7C,MAAM,WAAW,GAAG,MAAM,IAAA,2CAAoB,EAAC,MAAM,EAAE,iBAAU,EAAE,GAAG,CAAC,CAAC;IACxE,IAAI,CAAC,WAAW,I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