@sonarwatch/portfolio-plugins 0.14.33 → 0.14.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +1 -1
  3. package/src/index.js +4 -0
  4. package/src/index.js.map +1 -1
  5. package/src/plugins/alphafi/positionsFetcher.js +1 -1
  6. package/src/plugins/alphafi/positionsFetcher.js.map +1 -1
  7. package/src/plugins/cetus/vaultsJob.js +1 -0
  8. package/src/plugins/cetus/vaultsJob.js.map +1 -1
  9. package/src/plugins/ensofi/constants.d.ts +10 -0
  10. package/src/plugins/ensofi/constants.js +24 -0
  11. package/src/plugins/ensofi/constants.js.map +1 -0
  12. package/src/plugins/ensofi/idl.d.ts +103 -0
  13. package/src/plugins/ensofi/idl.js +900 -0
  14. package/src/plugins/ensofi/idl.js.map +1 -0
  15. package/src/plugins/ensofi/index.d.ts +6 -0
  16. package/src/plugins/ensofi/index.js +14 -0
  17. package/src/plugins/ensofi/index.js.map +1 -0
  18. package/src/plugins/ensofi/solanaLoansFetcher.d.ts +3 -0
  19. package/src/plugins/ensofi/solanaLoansFetcher.js +116 -0
  20. package/src/plugins/ensofi/solanaLoansFetcher.js.map +1 -0
  21. package/src/plugins/ensofi/suiLoansFetcher.d.ts +3 -0
  22. package/src/plugins/ensofi/suiLoansFetcher.js +111 -0
  23. package/src/plugins/ensofi/suiLoansFetcher.js.map +1 -0
  24. package/src/plugins/ensofi/suiLoansJob.d.ts +3 -0
  25. package/src/plugins/ensofi/suiLoansJob.js +47 -0
  26. package/src/plugins/ensofi/suiLoansJob.js.map +1 -0
  27. package/src/plugins/ensofi/types.d.ts +71 -0
  28. package/src/plugins/ensofi/types.js +3 -0
  29. package/src/plugins/ensofi/types.js.map +1 -0
  30. package/src/plugins/flash/helpers.d.ts +1 -1
  31. package/src/plugins/flash/helpers.js +2 -2
  32. package/src/plugins/flash/helpers.js.map +1 -1
  33. package/src/plugins/flash/poolJob.js +25 -5
  34. package/src/plugins/flash/poolJob.js.map +1 -1
  35. package/src/plugins/flash/structs.d.ts +4 -0
  36. package/src/plugins/flash/structs.js +4 -0
  37. package/src/plugins/flash/structs.js.map +1 -1
  38. package/src/plugins/flash/types.d.ts +1 -0
  39. package/src/plugins/haedal/vaultFetcher.js +1 -2
  40. package/src/plugins/haedal/vaultFetcher.js.map +1 -1
  41. package/src/plugins/kai/vaultsJob.js +1 -2
  42. package/src/plugins/kai/vaultsJob.js.map +1 -1
  43. package/src/plugins/kriya/vaultsFetcher.js +1 -2
  44. package/src/plugins/kriya/vaultsFetcher.js.map +1 -1
  45. package/src/plugins/mole/depositsFetcher.js +1 -1
  46. package/src/plugins/mole/depositsFetcher.js.map +1 -1
  47. package/src/plugins/thala/farmingPoolsFetcher.js +14 -50
  48. package/src/plugins/thala/farmingPoolsFetcher.js.map +1 -1
  49. package/src/plugins/tokens/fetchers/sui.js +3 -3
  50. package/src/plugins/tokens/fetchers/sui.js.map +1 -1
  51. package/src/plugins/tokens/helpers.d.ts +3 -2
  52. package/src/plugins/tokens/helpers.js +5 -4
  53. package/src/plugins/tokens/helpers.js.map +1 -1
  54. package/src/plugins/turbos/clmmVaultFetcher.js +1 -2
  55. package/src/plugins/turbos/clmmVaultFetcher.js.map +1 -1
  56. package/src/plugins/typus/safuFetcher.js +2 -2
  57. package/src/plugins/typus/safuFetcher.js.map +1 -1
  58. package/src/plugins/typus/vaultsFetcher.js +1 -1
  59. package/src/plugins/typus/vaultsFetcher.js.map +1 -1
  60. package/src/plugins/whalesmarket/depositFetcher.js +0 -1
  61. package/src/plugins/whalesmarket/depositFetcher.js.map +1 -1
  62. package/src/utils/elementbuilder/AssetBuilder.d.ts +2 -1
  63. package/src/utils/elementbuilder/AssetBuilder.js +14 -2
  64. package/src/utils/elementbuilder/AssetBuilder.js.map +1 -1
  65. package/src/utils/elementbuilder/LiquidityBuilder.js +2 -1
  66. package/src/utils/elementbuilder/LiquidityBuilder.js.map +1 -1
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AssetBuilder = void 0;
7
7
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
8
  const tokenPriceToAssetToken_1 = __importDefault(require("../misc/tokenPriceToAssetToken"));
9
+ const tokenPriceToAssetTokens_1 = __importDefault(require("../misc/tokenPriceToAssetTokens"));
9
10
  class AssetBuilder {
10
11
  constructor(params) {
11
12
  this.address = params.address.toString();
@@ -13,9 +14,20 @@ class AssetBuilder {
13
14
  this.attributes = params.attributes || {};
14
15
  this.alreadyShifted = params.alreadyShifted || false;
15
16
  }
16
- get(networkId, tokenPrices, keepIfZero) {
17
+ getUnderlyings(networkId, tokenPrices) {
17
18
  let amount = new bignumber_js_1.default(this.amount);
18
- if (!keepIfZero && amount.isZero())
19
+ if (amount.isZero())
20
+ return [];
21
+ const tokenPrice = tokenPrices.get(this.address);
22
+ if (!tokenPrice)
23
+ return [];
24
+ if (!this.alreadyShifted)
25
+ amount = amount.dividedBy(Math.pow(10, tokenPrice.decimals));
26
+ return (0, tokenPriceToAssetTokens_1.default)(tokenPrice.address, amount.toNumber(), networkId, tokenPrice, undefined, this.attributes);
27
+ }
28
+ get(networkId, tokenPrices) {
29
+ let amount = new bignumber_js_1.default(this.amount);
30
+ if (amount.isZero())
19
31
  return null;
20
32
  const tokenPrice = tokenPrices.get(this.address);
21
33
  if (!tokenPrice)
@@ -1 +1 @@
1
- {"version":3,"file":"AssetBuilder.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/AssetBuilder.ts"],"names":[],"mappings":";;;;;;AAKA,gEAAqC;AAErC,4FAAoE;AAGpE,MAAa,YAAY;IAMvB,YAAY,MAA4B;QACtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;QAC1C,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,KAAK,CAAC;IACvD,CAAC;IAED,GAAG,CACD,SAAwB,EACxB,WAA0B,EAC1B,UAAoB;QAEpB,IAAI,MAAM,GAAG,IAAI,sBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE;YAAE,OAAO,IAAI,CAAC;QAChD,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjD,IAAI,CAAC,UAAU;YAAE,OAAO,IAAI,CAAC;QAE7B,IAAI,CAAC,IAAI,CAAC,cAAc;YACtB,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,SAAA,EAAE,EAAI,UAAU,CAAC,QAAQ,CAAA,CAAC,CAAC;QAEvD,OAAO,IAAA,gCAAsB,EAC3B,UAAU,CAAC,OAAO,EAClB,MAAM,CAAC,QAAQ,EAAE,EACjB,SAAS,EACT,UAAU,EACV,SAAS,EACT,IAAI,CAAC,UAAU,CAChB,CAAC;IACJ,CAAC;CACF;AAnCD,oCAmCC"}
1
+ {"version":3,"file":"AssetBuilder.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/AssetBuilder.ts"],"names":[],"mappings":";;;;;;AAKA,gEAAqC;AAErC,4FAAoE;AAEpE,8FAAsE;AAEtE,MAAa,YAAY;IAMvB,YAAY,MAA4B;QACtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;QAC1C,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,KAAK,CAAC;IACvD,CAAC;IAED,cAAc,CACZ,SAAwB,EACxB,WAA0B;QAE1B,IAAI,M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
29
29
  const assets = this.assets
30
- .map((a) => a.get(networkId, tokenPrices, true))
30
+ .map((a) => a.getUnderlyings(networkId, tokenPrices))
31
+ .flat()
31
32
  .filter((a) => a !== null);
32
33
  const rewardAssets = this.rewardAssets
33
34
  .map((a) => a.get(networkId, tokenPrices))
@@ -1 +1 @@
1
- {"version":3,"file":"LiquidityBuilder.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/elementbuilder/LiquidityBuilder.ts"],"names":[],"mappings":";;;AAAA,+DAMoC;AAEpC,iDAA8C;AAI9C,MAAa,gBAAgB;IAM3B,YAAY,MAAwB;QAClC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,QAAQ,CAAC,MAA4B;QACnC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,2BAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,cAAc,CAAC,MAA4B;QACzC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,2BAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,QAAQ,CAAC,MAAa;QACpB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,KAAK;QACH,OAAO;YACL,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YACpC,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;SAC3C,CAAC;IACJ,CAAC;IAED,GAAG,CACD,SAAwB,EACxB,WAA0B;QAE1B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM;aACv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