@sonarwatch/portfolio-plugins 0.14.40 → 0.14.41

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.14.41](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.40...plugins-0.14.41) (2024-11-21)
6
+
7
+
8
+
5
9
  ## [0.14.40](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.39...plugins-0.14.40) (2024-11-21)
6
10
 
7
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.14.40",
3
+ "version": "0.14.41",
4
4
  "type": "commonjs",
5
5
  "types": "./src/index.d.ts",
6
6
  "peerDependencies": {
@@ -48,7 +48,8 @@ function getJupiterPrices(mints, vsMint) {
48
48
  const prices = new Map();
49
49
  for (const priceData of pricesData) {
50
50
  for (const [, value] of Object.entries(priceData)) {
51
- prices.set(value.id, value.price);
51
+ if (value)
52
+ prices.set(value.id, value.price);
52
53
  }
53
54
  }
54
55
  return prices;
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA4C;AAC5C,kDAA6C;AAC7C,+DAGoC;AAEpC,qDAAoE;AAEpE,SAAgB,UAAU,CAAC,KAAa;IACtC,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;QACrB,wBAAY,CAAC,OAAO,EAAE;QACtB,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE;KAC/B,EACD,yBAAa,CACd,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AATD,gCASC;AAED,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,SAAsB,gBAAgB,CAAC,K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B;IAC3D,MAAM,WAAW,GAAqC,IAAI,GAAG,EAAE,CAAC;IAChE,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO;YAAE,SAAS;QAErC,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;QAC/B,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QACtC,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC;QAC/B,MAAM,aAAa,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAClC,CAAC;aAAM,CAAC;YACN,aAAa,CAAC,IAAI,CAAC,MAAM,IAAI,WAAW,CAAC;YACzC,aAAa,CAAC,KAAK,GAAG,IAAA,+BAAc,EAAC,CAAC,UAAU,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;YACxE,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;AAC1C,CAAC;AAnBD,0CAmBC"}
@@ -17,6 +17,7 @@ const constants_2 = require("../tokens/constants");
17
17
  const getMultipleDecimalsAsMap_1 = require("../../utils/solana/getMultipleDecimalsAsMap");
18
18
  const clients_1 = require("../../utils/clients");
19
19
  const constants_3 = require("../sanctum/constants");
20
+ const solana_1 = require("../../utils/solana");
20
21
  const mints = [
21
22
  'xLfNTYy76B8Tiix3hA51Jyvc1kMSFV4sPdR7szTZsRu', // xLifinity
22
23
  'DdFPRnccQqLD4zCHrBqdY95D6hvw6PLWp9DEXj1fLCL9', // Wrapped USDC (Allbridge from Ethereum)
@@ -43,9 +44,12 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
43
44
  networkId: portfolio_core_1.NetworkId.solana,
44
45
  });
45
46
  const connection = (0, clients_1.getClientSolana)();
46
- const solTokenPrice = yield cache.getTokenPrice(vsToken, portfolio_core_1.NetworkId.solana);
47
- if (!solTokenPrice)
47
+ // const solTokenPrice = await cache.getTokenPrice(vsToken, NetworkId.solana);
48
+ const solSources = yield (0, helpers_1.getJupiterPrices)([new web3_js_1.PublicKey(vsToken)], new web3_js_1.PublicKey(solana_1.usdcSolanaMint));
49
+ const solPrice = solSources.get(vsToken);
50
+ if (!solPrice)
48
51
  return;
52
+ const solTokenPrice = { price: solPrice };
49
53
  const mintsPk = mints.map((m) => new web3_js_1.PublicKey(m));
50
54
  if (sanctumMints)
51
55
  mintsPk.push(...sanctumMints.map((m) => new web3_js_1.PublicKey(m)));
@@ -64,7 +68,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
64
68
  timestamp: Date.now(),
65
69
  price: solTokenPrice.price * price,
66
70
  platformId: constants_2.walletTokensPlatform.id,
67
- weight: 0.1,
71
+ weight: 0.8,
68
72
  };
69
73
  sources.push(source);
70
74
  });
@@ -73,7 +77,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
73
77
  const job = {
74
78
  id: `${constants_1.platformId}-pricing`,
75
79
  executor,
76
- label: 'coingecko',
80
+ label: 'realtime',
77
81
  };
78
82
  exports.default = job;
79
83
  //# sourceMappingURL=pricingJob.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pricingJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/pricingJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAIoC;AACpC,6CAA4C;AAG5C,oDAAkD;AAClD,uCAA6C;AAC7C,mDAA2D;AAC3D,0FAAuF;AACvF,iDAAsD;AACtD,oDAAgF;AAEhF,MAAM,KAAK,GAAG;IACZ,6CAA6C,EAAE,YAAY;IAC3D,8CAA8C,EAAE,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AS,CAAC,OAAO,CAAC,CAAC,CAAC;IACvE,MAAM,WAAW,GAAG,MAAM,IAAA,mDAAwB,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACxE,MAAM,OAAO,GAAuB,EAAE,CAAC;IACvC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC7B,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,QAAQ;YAAE,OAAO;QACtB,MAAM,MAAM,GAAqB;YAC/B,OAAO,EAAE,IAAI;YACb,QAAQ;YACR,EAAE,EAAE,aAAa;YACjB,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,KAAK,EAAE,aAAa,CAAC,KAAK,GAAG,KAAK;YAClC,UAAU,EAAE,gCAAoB,CAAC,EAAE;YACnC,MAAM,EAAE,GAAG;SACZ,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IACH,MAAM,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,WAAW;CACnB,CAAC;AACF,kBAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"pricingJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/pricingJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAIoC;AACpC,6CAA4C;AAG5C,oDAAkD;AAClD,uCAA6C;AAC7C,mDAA2D;AAC3D,0FAAuF;AACvF,iDAAsD;AACtD,oDAAgF;AAChF,+CAAoD;AAEpD,MAAM,KAAK,GAAG;IACZ,6CAA6C,EAAE,YAAY;IAC3D,8CAA8C,EAAE,yCAAyC;IACzF,6C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