@sonarwatch/portfolio-plugins 0.12.169 → 0.12.171

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +1 -1
  3. package/src/Cache.d.ts +2 -1
  4. package/src/Cache.js +3 -3
  5. package/src/Cache.js.map +1 -1
  6. package/src/TokenPriceMap.d.ts +8 -0
  7. package/src/TokenPriceMap.js +21 -0
  8. package/src/TokenPriceMap.js.map +1 -0
  9. package/src/index.js +16 -0
  10. package/src/index.js.map +1 -1
  11. package/src/plugins/adrastea/constants.d.ts +9 -0
  12. package/src/plugins/adrastea/constants.js +19 -0
  13. package/src/plugins/adrastea/constants.js.map +1 -0
  14. package/src/plugins/adrastea/index.d.ts +6 -0
  15. package/src/plugins/adrastea/index.js +13 -0
  16. package/src/plugins/adrastea/index.js.map +1 -0
  17. package/src/plugins/adrastea/positionsFetcher.js +61 -0
  18. package/src/plugins/adrastea/positionsFetcher.js.map +1 -0
  19. package/src/plugins/adrastea/positionsJob.d.ts +3 -0
  20. package/src/plugins/adrastea/positionsJob.js +53 -0
  21. package/src/plugins/adrastea/positionsJob.js.map +1 -0
  22. package/src/plugins/adrastea/structs.d.ts +45 -0
  23. package/src/plugins/adrastea/structs.js +44 -0
  24. package/src/plugins/adrastea/structs.js.map +1 -0
  25. package/src/plugins/adrastea/types.d.ts +4 -0
  26. package/src/plugins/adrastea/types.js +3 -0
  27. package/src/plugins/adrastea/types.js.map +1 -0
  28. package/src/plugins/banx/stakingFetcher.js +11 -15
  29. package/src/plugins/banx/stakingFetcher.js.map +1 -1
  30. package/src/plugins/bluemove/constants.d.ts +7 -0
  31. package/src/plugins/bluemove/constants.js +17 -0
  32. package/src/plugins/bluemove/constants.js.map +1 -0
  33. package/src/plugins/bluemove/index.d.ts +6 -0
  34. package/src/plugins/bluemove/index.js +12 -0
  35. package/src/plugins/bluemove/index.js.map +1 -0
  36. package/src/plugins/bluemove/poolsJob.d.ts +3 -0
  37. package/src/plugins/bluemove/poolsJob.js +97 -0
  38. package/src/plugins/bluemove/poolsJob.js.map +1 -0
  39. package/src/plugins/bluemove/types.d.ts +21 -0
  40. package/src/plugins/bluemove/types.js +3 -0
  41. package/src/plugins/bluemove/types.js.map +1 -0
  42. package/src/plugins/cetus/clmmsFetcher.js +3 -3
  43. package/src/plugins/cetus/clmmsFetcher.js.map +1 -1
  44. package/src/plugins/cetus/constants.d.ts +4 -0
  45. package/src/plugins/cetus/constants.js +5 -1
  46. package/src/plugins/cetus/constants.js.map +1 -1
  47. package/src/plugins/cetus/dcaFetcher.js +77 -0
  48. package/src/plugins/cetus/dcaFetcher.js.map +1 -0
  49. package/src/plugins/cetus/farmsFetcher.js +2 -4
  50. package/src/plugins/cetus/farmsFetcher.js.map +1 -1
  51. package/src/plugins/cetus/index.js +8 -1
  52. package/src/plugins/cetus/index.js.map +1 -1
  53. package/src/plugins/cetus/limitFetcher.d.ts +3 -0
  54. package/src/plugins/cetus/limitFetcher.js +66 -0
  55. package/src/plugins/cetus/limitFetcher.js.map +1 -0
  56. package/src/plugins/cetus/types.d.ts +32 -0
  57. package/src/plugins/deepbook/constants.d.ts +3 -0
  58. package/src/plugins/deepbook/constants.js +4 -1
  59. package/src/plugins/deepbook/constants.js.map +1 -1
  60. package/src/plugins/deepbook/helpers.d.ts +4 -0
  61. package/src/plugins/deepbook/helpers.js +142 -0
  62. package/src/plugins/deepbook/helpers.js.map +1 -0
  63. package/src/plugins/deepbook/index.js +7 -2
  64. package/src/plugins/deepbook/index.js.map +1 -1
  65. package/src/plugins/deepbook/ordersFetcher.d.ts +3 -0
  66. package/src/plugins/deepbook/ordersFetcher.js +74 -0
  67. package/src/plugins/deepbook/ordersFetcher.js.map +1 -0
  68. package/src/plugins/deepbook/poolsJob.d.ts +3 -0
  69. package/src/plugins/deepbook/poolsJob.js +30 -0
  70. package/src/plugins/deepbook/poolsJob.js.map +1 -0
  71. package/src/plugins/deepbook/types.d.ts +12 -0
  72. package/src/plugins/deepbook/types.js +3 -0
  73. package/src/plugins/deepbook/types.js.map +1 -0
  74. package/src/plugins/flowx/stakingPoolFetcher.js +1 -1
  75. package/src/plugins/flowx/stakingPoolFetcher.js.map +1 -1
  76. package/src/plugins/flowx/stakingPoolV3Fetcher.js +1 -1
  77. package/src/plugins/flowx/stakingPoolV3Fetcher.js.map +1 -1
  78. package/src/plugins/foo/constants.d.ts +1 -1
  79. package/src/plugins/foo/constants.js +2 -2
  80. package/src/plugins/foo/constants.js.map +1 -1
  81. package/src/plugins/foo/index.js +2 -2
  82. package/src/plugins/foo/index.js.map +1 -1
  83. package/src/plugins/foo/marketsJob.js +3 -3
  84. package/src/plugins/foo/marketsJob.js.map +1 -1
  85. package/src/plugins/foo/positionsEthereumFetcher.d.ts +3 -0
  86. package/src/plugins/foo/positionsEthereumFetcher.js +33 -0
  87. package/src/plugins/foo/positionsEthereumFetcher.js.map +1 -0
  88. package/src/plugins/foo/positionsSolanaFetcher.js +10 -26
  89. package/src/plugins/foo/positionsSolanaFetcher.js.map +1 -1
  90. package/src/plugins/foo/positionsSuiFetcher.d.ts +3 -0
  91. package/src/plugins/foo/positionsSuiFetcher.js +46 -0
  92. package/src/plugins/foo/positionsSuiFetcher.js.map +1 -0
  93. package/src/plugins/foo/types.d.ts +5 -0
  94. package/src/plugins/foo/types.js +3 -0
  95. package/src/plugins/foo/types.js.map +1 -0
  96. package/src/plugins/francium/constants.d.ts +19 -0
  97. package/src/plugins/francium/constants.js +839 -0
  98. package/src/plugins/francium/constants.js.map +1 -0
  99. package/src/plugins/francium/helpers.d.ts +14 -0
  100. package/src/plugins/francium/helpers.js +85 -0
  101. package/src/plugins/francium/helpers.js.map +1 -0
  102. package/src/plugins/francium/index.d.ts +6 -0
  103. package/src/plugins/francium/index.js +13 -0
  104. package/src/plugins/francium/index.js.map +1 -0
  105. package/src/plugins/francium/lendingFetcher.d.ts +3 -0
  106. package/src/plugins/francium/lendingFetcher.js +70 -0
  107. package/src/plugins/francium/lendingFetcher.js.map +1 -0
  108. package/src/plugins/francium/lendingPoolJob.d.ts +3 -0
  109. package/src/plugins/francium/lendingPoolJob.js +49 -0
  110. package/src/plugins/francium/lendingPoolJob.js.map +1 -0
  111. package/src/plugins/francium/structs.d.ts +59 -0
  112. package/src/plugins/francium/structs.js +49 -0
  113. package/src/plugins/francium/structs.js.map +1 -0
  114. package/src/plugins/francium/tokens.d.ts +9 -0
  115. package/src/plugins/francium/tokens.js +524 -0
  116. package/src/plugins/francium/tokens.js.map +1 -0
  117. package/src/plugins/francium/types.d.ts +16 -0
  118. package/src/plugins/francium/types.js +3 -0
  119. package/src/plugins/francium/types.js.map +1 -0
  120. package/src/plugins/kamino/lendsFetcher.js +64 -167
  121. package/src/plugins/kamino/lendsFetcher.js.map +1 -1
  122. package/src/plugins/kriya/farmsFetcher.js +23 -48
  123. package/src/plugins/kriya/farmsFetcher.js.map +1 -1
  124. package/src/plugins/kriya/leverageVaultsFetcher.js +5 -5
  125. package/src/plugins/kriya/leverageVaultsFetcher.js.map +1 -1
  126. package/src/plugins/meteora/dlmmPositionsFetcher.js +5 -4
  127. package/src/plugins/meteora/dlmmPositionsFetcher.js.map +1 -1
  128. package/src/plugins/meteora/farmsFetcher.js +19 -68
  129. package/src/plugins/meteora/farmsFetcher.js.map +1 -1
  130. package/src/plugins/nxfinance/positionsFetcher.js +32 -80
  131. package/src/plugins/nxfinance/positionsFetcher.js.map +1 -1
  132. package/src/plugins/quarry/positionsFetcher.js +1 -1
  133. package/src/plugins/quarry/positionsFetcher.js.map +1 -1
  134. package/src/plugins/raydium/farmsFetcher.js +30 -74
  135. package/src/plugins/raydium/farmsFetcher.js.map +1 -1
  136. package/src/plugins/raydium/getRaydiumCLMMPositions.js +4 -4
  137. package/src/plugins/raydium/getRaydiumCLMMPositions.js.map +1 -1
  138. package/src/plugins/raydium/helpers.d.ts +3 -2
  139. package/src/plugins/raydium/helpers.js +5 -7
  140. package/src/plugins/raydium/helpers.js.map +1 -1
  141. package/src/plugins/raydium/index.js +1 -2
  142. package/src/plugins/raydium/index.js.map +1 -1
  143. package/src/plugins/raydium/lpTokensJob.js +1 -1
  144. package/src/plugins/raydium/lpTokensJob.js.map +1 -1
  145. package/src/plugins/stabble/constants.d.ts +8 -0
  146. package/src/plugins/stabble/constants.js +27 -0
  147. package/src/plugins/stabble/constants.js.map +1 -0
  148. package/src/plugins/stabble/filters.d.ts +3 -0
  149. package/src/plugins/stabble/filters.js +20 -0
  150. package/src/plugins/stabble/filters.js.map +1 -0
  151. package/src/plugins/stabble/index.d.ts +6 -0
  152. package/src/plugins/stabble/index.js +12 -0
  153. package/src/plugins/stabble/index.js.map +1 -0
  154. package/src/plugins/stabble/poolsJob.d.ts +3 -0
  155. package/src/plugins/stabble/poolsJob.js +84 -0
  156. package/src/plugins/stabble/poolsJob.js.map +1 -0
  157. package/src/plugins/stabble/stableIdl.d.ts +40 -0
  158. package/src/plugins/stabble/stableIdl.js +104 -0
  159. package/src/plugins/stabble/stableIdl.js.map +1 -0
  160. package/src/plugins/stabble/types.d.ts +40 -0
  161. package/src/plugins/stabble/types.js +3 -0
  162. package/src/plugins/stabble/types.js.map +1 -0
  163. package/src/plugins/stabble/weightedIdl.d.ts +40 -0
  164. package/src/plugins/stabble/weightedIdl.js +96 -0
  165. package/src/plugins/stabble/weightedIdl.js.map +1 -0
  166. package/src/utils/bitcoin/getBalance.js +1 -0
  167. package/src/utils/bitcoin/getBalance.js.map +1 -1
  168. package/src/utils/elementbuilder/AssetBuilder.d.ts +11 -0
  169. package/src/utils/elementbuilder/AssetBuilder.js +28 -0
  170. package/src/utils/elementbuilder/AssetBuilder.js.map +1 -0
  171. package/src/utils/elementbuilder/ElementBorrowlendBuilder.d.ts +27 -0
  172. package/src/utils/elementbuilder/ElementBorrowlendBuilder.js +110 -0
  173. package/src/utils/elementbuilder/ElementBorrowlendBuilder.js.map +1 -0
  174. package/src/utils/elementbuilder/ElementBuilder.d.ts +12 -0
  175. package/src/utils/elementbuilder/ElementBuilder.js +13 -0
  176. package/src/utils/elementbuilder/ElementBuilder.js.map +1 -0
  177. package/src/utils/elementbuilder/ElementLiquidityBuilder.d.ts +12 -0
  178. package/src/utils/elementbuilder/ElementLiquidityBuilder.js +42 -0
  179. package/src/utils/elementbuilder/ElementLiquidityBuilder.js.map +1 -0
  180. package/src/utils/elementbuilder/ElementMultipleBuilder.d.ts +13 -0
  181. package/src/utils/elementbuilder/ElementMultipleBuilder.js +40 -0
  182. package/src/utils/elementbuilder/ElementMultipleBuilder.js.map +1 -0
  183. package/src/utils/elementbuilder/ElementParams.d.ts +7 -0
  184. package/src/utils/elementbuilder/ElementParams.js +3 -0
  185. package/src/utils/elementbuilder/ElementParams.js.map +1 -0
  186. package/src/utils/elementbuilder/ElementRegistry.d.ts +17 -0
  187. package/src/utils/elementbuilder/ElementRegistry.js +49 -0
  188. package/src/utils/elementbuilder/ElementRegistry.js.map +1 -0
  189. package/src/utils/elementbuilder/LiquidityBuilder.d.ts +15 -0
  190. package/src/utils/elementbuilder/LiquidityBuilder.js +52 -0
  191. package/src/utils/elementbuilder/LiquidityBuilder.js.map +1 -0
  192. package/src/utils/elementbuilder/PortfolioAssetParams.d.ts +7 -0
  193. package/src/utils/elementbuilder/PortfolioAssetParams.js +3 -0
  194. package/src/utils/elementbuilder/PortfolioAssetParams.js.map +1 -0
  195. package/src/plugins/foo/positionsFetcher.js +0 -49
  196. package/src/plugins/foo/positionsFetcher.js.map +0 -1
  197. package/src/plugins/raydium/stakingFetcher.js +0 -50
  198. package/src/plugins/raydium/stakingFetcher.js.map +0 -1
  199. /package/src/plugins/{foo → adrastea}/positionsFetcher.d.ts +0 -0
  200. /package/src/plugins/{raydium/stakingFetcher.d.ts → cetus/dcaFetcher.d.ts} +0 -0
@@ -8,18 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
13
  const constants_1 = require("./constants");
17
14
  const clients_1 = require("../../utils/clients");
18
15
  const solana_1 = require("../../utils/solana");
19
16
  const struct_1 = require("./struct");
20
- const tokenPriceToAssetTokens_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetTokens"));
21
- const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
22
17
  const helpers_1 = require("./helpers");
18
+ const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
23
19
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
24
20
  const client = (0, clients_1.getClientSolana)();
25
21
  const farms = yield cache.getItem(constants_1.farmsKey, {
@@ -36,78 +32,33 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
36
32
  });
37
33
  const farmingAccountsAddresses = (0, helpers_1.getStakingAccounts)(owner, farmsMint);
38
34
  const farmingAccounts = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, struct_1.farmAccountStruct, farmingAccountsAddresses);
39
- const neededMints = farmingAccounts
40
- .map((fA, i) => {
41
- if (!fA)
42
- return [];
43
- const farm = farms.at(i);
44
- if (!farm)
45
- return [];
46
- return [farm.stakingMint, farm.rewardAMint, farm.rewardBMint];
47
- })
48
- .flat();
49
- const tokenPrices = yield cache.getTokenPricesAsMap(neededMints, portfolio_core_1.NetworkId.solana);
50
- const liquidities = [];
35
+ const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
36
+ const element = elementRegistry.addElementLiquidity({
37
+ label: 'Farming',
38
+ });
51
39
  for (const farmingAccount of farmingAccounts) {
52
40
  if (!farmingAccount)
53
41
  continue;
54
- const rewardAssets = [];
55
- const assets = [];
56
42
  const { balanceStaked, rewardAPerTokenPending, rewardBPerTokenPending } = farmingAccount;
57
43
  const farmInfo = farmsById.get(farmingAccount.pool.toString());
58
44
  if (!farmInfo)
59
45
  continue;
60
46
  const { stakingMint, rewardAMint, rewardBMint } = farmInfo;
61
- const [poolTokenPrice, rewardATokenPrice, rewardBTokenPrice] = [
62
- tokenPrices.get(stakingMint),
63
- tokenPrices.get(rewardAMint),
64
- tokenPrices.get(rewardBMint),
65
- ];
66
- if (!poolTokenPrice)
67
- continue;
68
- const amount = balanceStaked.dividedBy(Math.pow(10, poolTokenPrice.decimals));
69
- assets.push(...(0, tokenPriceToAssetTokens_1.default)(poolTokenPrice.address, amount.toNumber(), portfolio_core_1.NetworkId.solana, poolTokenPrice));
70
- if (rewardAPerTokenPending.isGreaterThan(0) && rewardATokenPrice) {
71
- const rewardAmount = rewardAPerTokenPending
72
- .dividedBy(Math.pow(10, rewardATokenPrice.decimals))
73
- .toNumber();
74
- rewardAssets.push((0, tokenPriceToAssetToken_1.default)(rewardAMint, rewardAmount, portfolio_core_1.NetworkId.solana, rewardATokenPrice));
75
- }
76
- if (rewardBPerTokenPending.isGreaterThan(0) && rewardBTokenPrice) {
77
- const rewardAmount = rewardBPerTokenPending
78
- .dividedBy(Math.pow(10, rewardBTokenPrice.decimals))
79
- .toNumber();
80
- rewardAssets.push((0, tokenPriceToAssetToken_1.default)(rewardBMint, rewardAmount, portfolio_core_1.NetworkId.solana, rewardBTokenPrice));
81
- }
82
- const assetsValue = (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value));
83
- const rewardAssetsValue = (0, portfolio_core_1.getUsdValueSum)(rewardAssets.map((r) => r.value));
84
- const value = (0, portfolio_core_1.getUsdValueSum)([assetsValue, rewardAssetsValue]);
85
- if (value === 0)
86
- continue;
87
- const liquidity = {
88
- value,
89
- assets,
90
- assetsValue,
91
- rewardAssets,
92
- rewardAssetsValue,
93
- yields: [],
94
- };
95
- liquidities.push(liquidity);
47
+ const liquidity = element.addLiquidity();
48
+ liquidity.addAsset({
49
+ address: stakingMint,
50
+ amount: balanceStaked,
51
+ });
52
+ liquidity.addRewardAsset({
53
+ address: rewardAMint,
54
+ amount: rewardAPerTokenPending,
55
+ });
56
+ liquidity.addRewardAsset({
57
+ address: rewardBMint,
58
+ amount: rewardBPerTokenPending,
59
+ });
96
60
  }
97
- if (liquidities.length === 0)
98
- return [];
99
- return [
100
- {
101
- networkId: portfolio_core_1.NetworkId.solana,
102
- platformId: constants_1.platformId,
103
- type: portfolio_core_1.PortfolioElementType.liquidity,
104
- label: 'Farming',
105
- value: (0, portfolio_core_1.getUsdValueSum)(liquidities.map((l) => l.value)),
106
- data: {
107
- liquidities,
108
- },
109
- },
110
- ];
61
+ return elementRegistry.dump(cache);
111
62
  });
112
63
  const fetcher = {
113
64
  id: `${constants_1.platformId}-farms`,
@@ -1 +1 @@
1
- {"version":3,"file":"farmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/meteora/farmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AAGpC,2CAAmD;AACnD,iDAAsD;AACtD,+CAAmE;AACnE,qCAA6C;AAC7C,uGAA+E;AAE/E,qGAA6E;AAC7E,uCAA+C;AAE/C,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,OAAO,CAAkB,oBAAQ,EAAE;QAC3D,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IACH,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IAEtB,MAAM,SAAS,GAA+B,IAAI,GAAG,EAAE,CAAC;IACxD,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACj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C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAC/D,MAAM,iBAAiB,GAAG,IAAA,+BAAc,EAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAC3E,MAAM,KAAK,GAAG,IAAA,+BAAc,EAAC,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;QAC/D,IAAI,KAAK,KAAK,CAAC;YAAE,SAAS;QAE1B,MAAM,SAAS,GAAuB;YACpC,KAAK;YACL,MAAM;YACN,WAAW;YACX,YAAY;YACZ,iBAAiB;YACjB,MAAM,EAAE,EAAE;SACX,CAAC;QACF,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;IAED,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAExC,OAAO;QACL;YACE,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,qCAAoB,CAAC,SAAS;YACpC,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,IAAA,+BAAc,EAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACtD,IAAI,EAAE;gBACJ,WAAW;aACZ;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":"farmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/meteora/farmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,2CAAmD;AAC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AS,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC/D,IAAI,CAAC,QAAQ;YAAE,SAAS;QAExB,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,QAAQ,CAAC;QAE3D,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;QAEzC,SAAS,CAAC,QAAQ,CAAC;YACjB,OAAO,EAAE,WAAW;YACpB,MAAM,EAAE,aAAa;SACtB,CAAC,CAAC;QAEH,SAAS,CAAC,cAAc,CAAC;YACvB,OAAO,EAAE,WAAW;YACpB,MAAM,EAAE,sBAAsB;SAC/B,CAAC,CAAC;QAEH,SAAS,CAAC,cAAc,CAAC;YACvB,OAAO,EAAE,WAAW;YACpB,MAAM,EAAE,sBAAsB;SAC/B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrC,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"}
@@ -18,8 +18,8 @@ const bignumber_js_1 = __importDefault(require("bignumber.js"));
18
18
  const constants_1 = require("./constants");
19
19
  const clients_1 = require("../../utils/clients");
20
20
  const solana_1 = require("../../utils/solana");
21
- const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
22
21
  const helpers_1 = require("./helpers");
22
+ const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
23
23
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
24
24
  const connection = (0, clients_1.getClientSolana)();
25
25
  const marginAccountPublicKey = web3_js_1.PublicKey.findProgramAddressSync([
@@ -30,103 +30,55 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
30
30
  const marginAccount = (yield (0, solana_1.getAutoParsedMultipleAccountsInfo)(connection, constants_1.nxfinanceLeverageIdlItem, [marginAccountPublicKey]))[0];
31
31
  if (!marginAccount)
32
32
  return [];
33
- const elements = [];
34
33
  const mints = new Set();
35
- marginAccount.deposits.forEach((d) => mints.add((0, portfolio_core_1.formatTokenAddress)(d.tokenMint, portfolio_core_1.NetworkId.solana)));
36
- marginAccount.loans.forEach((l) => mints.add((0, portfolio_core_1.formatTokenAddress)(l.tokenMint, portfolio_core_1.NetworkId.solana)));
34
+ marginAccount.deposits.forEach((d) => mints.add(d.tokenMint));
35
+ marginAccount.loans.forEach((l) => mints.add(l.tokenMint));
37
36
  const marginPoolsPublicKeys = [...mints].map((mint) => web3_js_1.PublicKey.findProgramAddressSync([
38
37
  web3_js_1.PublicKey.findProgramAddressSync([constants_1.ID.toBuffer()], constants_1.leverageFiProgramID)[0].toBuffer(),
39
38
  new web3_js_1.PublicKey(mint).toBuffer(),
40
39
  ], constants_1.leverageFiProgramID)[0]);
41
- const [tokenPrices, marginPools] = yield Promise.all([
42
- cache.getTokenPricesAsMap([...mints], portfolio_core_1.NetworkId.solana),
43
- (0, solana_1.getAutoParsedMultipleAccountsInfo)(connection, constants_1.nxfinanceLeverageIdlItem, marginPoolsPublicKeys),
44
- ]);
45
- // assets for Lend
46
- const assets = [];
47
- // assets for Leverage
48
- const borrowedAssets = [];
49
- const borrowedYields = [];
50
- const suppliedAssets = [];
51
- const suppliedYields = [];
52
- const rewardAssets = [];
40
+ const marginPools = yield (0, solana_1.getAutoParsedMultipleAccountsInfo)(connection, constants_1.nxfinanceLeverageIdlItem, marginPoolsPublicKeys);
41
+ const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
42
+ const elementMultiple = elementRegistry.addElementMultiple({
43
+ label: 'Lending',
44
+ name: 'Fulcrum Lending Pool',
45
+ });
46
+ const elementBorrowlend = elementRegistry.addElementBorrowlend({
47
+ label: 'Leverage',
48
+ name: `JLP Leverage x${new bignumber_js_1.default(marginAccount.leverage)
49
+ .dividedBy(100)
50
+ .decimalPlaces(2)}`,
51
+ });
53
52
  marginAccount.deposits.forEach((deposit) => {
54
- const tokenPrice = tokenPrices.get((0, portfolio_core_1.formatTokenAddress)(deposit.tokenMint, portfolio_core_1.NetworkId.solana));
55
- if (!tokenPrice)
56
- return;
57
53
  const marginPool = marginPools.find((mp) => (mp === null || mp === void 0 ? void 0 : mp.tokenMint) === deposit.tokenMint);
58
54
  if (!marginPool)
59
55
  return;
60
56
  const supplyNoteRate = (0, helpers_1.getSupplyNoteRate)(marginPool);
61
- const amount = new bignumber_js_1.default(deposit.depositNote)
62
- .multipliedBy(supplyNoteRate)
63
- .dividedBy(Math.pow(10, tokenPrice.decimals))
64
- .toNumber();
65
- if (amount > 0) {
66
- const assetToken = (0, tokenPriceToAssetToken_1.default)(tokenPrice.address, amount, portfolio_core_1.NetworkId.solana, tokenPrice);
67
- if (constants_1.leverageVaultsMints.includes(deposit.tokenMint)) {
68
- suppliedAssets.push(assetToken);
69
- }
70
- else {
71
- assets.push(assetToken);
72
- }
57
+ const amount = new bignumber_js_1.default(deposit.depositNote).multipliedBy(supplyNoteRate);
58
+ const asset = {
59
+ address: deposit.tokenMint,
60
+ amount: amount,
61
+ };
62
+ if (constants_1.leverageVaultsMints.includes(deposit.tokenMint)) {
63
+ elementBorrowlend.addSuppliedAsset(asset);
64
+ }
65
+ else {
66
+ elementMultiple.addAsset(asset);
73
67
  }
74
68
  });
75
69
  marginAccount.loans.forEach((loan) => {
76
- const tokenPrice = tokenPrices.get((0, portfolio_core_1.formatTokenAddress)(loan.tokenMint, portfolio_core_1.NetworkId.solana));
77
- if (!tokenPrice)
78
- return;
79
70
  const marginPool = marginPools.find((mp) => (mp === null || mp === void 0 ? void 0 : mp.tokenMint) === loan.tokenMint);
80
71
  if (!marginPool)
81
72
  return;
73
+ if (loan.loanNote === '0')
74
+ return;
82
75
  const borrowNoteRate = (0, helpers_1.getBorrowNoteRate)(marginPool);
83
- borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPrice.address, new bignumber_js_1.default(loan.loanNote)
84
- .multipliedBy(borrowNoteRate)
85
- .dividedBy(Math.pow(10, tokenPrice.decimals))
86
- .toNumber(), portfolio_core_1.NetworkId.solana, tokenPrice));
87
- });
88
- if (assets.length > 0)
89
- elements.push({
90
- type: portfolio_core_1.PortfolioElementType.multiple,
91
- networkId: portfolio_core_1.NetworkId.solana,
92
- platformId: constants_1.platformId,
93
- label: 'Lending',
94
- name: 'Fulcrum Lending Pool',
95
- value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
96
- data: {
97
- assets,
98
- },
99
- });
100
- if (suppliedAssets.length > 0 || borrowedAssets.length > 0) {
101
- const { borrowedValue, suppliedValue, rewardValue } = (0, portfolio_core_1.getElementLendingValues)({
102
- suppliedAssets,
103
- borrowedAssets,
104
- rewardAssets,
76
+ elementBorrowlend.addBorrowedAsset({
77
+ address: loan.tokenMint,
78
+ amount: new bignumber_js_1.default(loan.loanNote).multipliedBy(borrowNoteRate),
105
79
  });
106
- elements.push({
107
- type: portfolio_core_1.PortfolioElementType.borrowlend,
108
- networkId: portfolio_core_1.NetworkId.solana,
109
- platformId: constants_1.platformId,
110
- label: 'Leverage',
111
- name: `JLP Leverage x${new bignumber_js_1.default(marginAccount.leverage)
112
- .dividedBy(100)
113
- .decimalPlaces(2)}`,
114
- value: suppliedValue,
115
- data: {
116
- borrowedAssets,
117
- borrowedValue,
118
- borrowedYields,
119
- suppliedAssets,
120
- suppliedValue,
121
- suppliedYields,
122
- rewardAssets,
123
- rewardValue,
124
- healthRatio: null,
125
- value: suppliedValue,
126
- },
127
- });
128
- }
129
- return elements;
80
+ });
81
+ return elementRegistry.dump(cache);
130
82
  });
131
83
  const fetcher = {
132
84
  id: `${constants_1.platformId}-positions`,
@@ -1 +1 @@
1
- {"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../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,aAAa,CAAC,CAAC,CAAC,EAAE;YACrB,KAAK,EAAE,aAAa;YACpB,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,YAAY;gBACZ,WAAW;gBACX,WAAW,EAAE,IAAI;gBACjB,KAAK,EAAE,aAAa;aACrB;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/nxfinance/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,6CAA4C;AAC5C,gEAAqC;AAErC,2CAMqB;AAErB,iDAAsD;AACtD,+CAAuE;AAEvE,uCAAiE;AACjE,gFAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,UAAU,GAAG,IAAA,yBAAe,GAAE,CAAC;IAErC,MAAM,sBAAsB,GAAG,mBAAS,CAAC,sBAAsB,CAC7D;QACE,mBAAS,CAAC,sBAAsB,CAC9B,CAAC,cAAE,CAAC,QAAQ,EAAE,CAAC,EACf,+BAAmB,CACpB,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;QACf,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;QAC/B,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;KACvB,EACD,+BAAmB,CACpB,CAAC,CAAC,CAAC,CAAC;IAEL,MAAM,aAAa,GAAG,CACpB,MAAM,IAAA,0CAAiC,EACrC,UAAU,EACV,oCAAwB,EACxB,CAAC,sBAAsB,C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BAAiB,CAAC,gBAAgB,CAAC;YACjC,OAAO,EAAE,IAAI,CAAC,SAAS;YACvB,MAAM,EAAE,IAAI,sBAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,cAAc,CAAC;SAClE,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -50,7 +50,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
50
50
  mints.add(position.stakedTokenInfo.address);
51
51
  position.rewardsTokenInfo.forEach((rewardTokenInfo) => mints.add(rewardTokenInfo.address.toString()));
52
52
  });
53
- const tokenPrices = yield cache.getTokenPricesAsMap([...mints], portfolio_core_1.NetworkId.solana);
53
+ const tokenPrices = yield cache.getTokenPricesAsMap(mints, portfolio_core_1.NetworkId.solana);
54
54
  const elements = [];
55
55
  positions.forEach((position) => {
56
56
  const { rewardsTokenInfo, rewardsBalance, primaryRewarder, stakedBalance, stakedTokenInfo, } = position;
@@ -1 +1 @@
1
- {"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/quarry/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,gEAAqC;AACrC,6CAA4C;AAE5C,2CAOqB;AACrB,qDAAyE;AACzE,kDAAmE;AAEnE,iDAAsD;AACtD,+CAI4B;AAQ5B,kEAA+D;AAC/D,qGAA6E;AAC7E,uGAA+E;AAC/E,uCAA4D;AAC5D,6DAA0D;AAE1D,MAAM,aAAa,GAAG,IAAI,6BAAa,CAAa,6BAAiB,EAAE;IACrE,MAAM,EAAE,sBAAU;IACl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CAAC,CAAC,CAAC;QAC3E,MAAM,KAAK,GAAG,WAAW,CAAC;QAE1B,IAAI,iBAAiB,CAAC;QAEtB,QAAQ,eAAe,CAAC,IAAI,EAAE,CAAC;YAC7B,KAAK,OAAO;gBACV,iBAAiB,GAAG,sBAAkB,CAAC;gBACvC,MAAM;YACR,KAAK,OAAO;gBACV,iBAAiB,GAAG,sBAAe,CAAC;gBACpC,MAAM;YACR;gBACE,iBAAiB,GAAG,sBAAU,CAAC;QACnC,CAAC;QAED,QAAQ,CAAC,IAAI,CAAC;YACZ,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,KAAK,EAAE,SAAS;YAChB,UAAU,EAAE,iBAAiB;YAC7B,IAAI,EAAE,qCAAoB,CAAC,SAAS;YACpC,KAAK;YACL,IAAI,EACF,iBAAiB,KAAK,sBAAU,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAQ,CAAC,IAAI;YACzE,IAAI,EAAE;gBACJ,WAAW,EAAE;oBACX;wBACE,MAAM;wBACN,WAAW;wBACX,YAAY;wBACZ,iBAAiB;wBACjB,KAAK;wBACL,MAAM,EAAE,EAAE;qBACX;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/quarry/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,gEAAqC;AACrC,6CAA4C;AAE5C,2CAOqB;AACrB,qDAAyE;AACzE,kDAAmE;AAEnE,iDAAsD;AACtD,+CAI4B;AAQ5B,kEAA+D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AAC,CAAC,CAAC;QAC/D,MAAM,iBAAiB,GAAG,IAAA,+BAAc,EAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAC3E,MAAM,KAAK,GAAG,WAAW,CAAC;QAE1B,IAAI,iBAAiB,CAAC;QAEtB,QAAQ,eAAe,CAAC,IAAI,EAAE,CAAC;YAC7B,KAAK,OAAO;gBACV,iBAAiB,GAAG,sBAAkB,CAAC;gBACvC,MAAM;YACR,KAAK,OAAO;gBACV,iBAAiB,GAAG,sBAAe,CAAC;gBACpC,MAAM;YACR;gBACE,iBAAiB,GAAG,sBAAU,CAAC;QACnC,CAAC;QAED,QAAQ,CAAC,IAAI,CAAC;YACZ,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,KAAK,EAAE,SAAS;YAChB,UAAU,EAAE,iBAAiB;YAC7B,IAAI,EAAE,qCAAoB,CAAC,SAAS;YACpC,KAAK;YACL,IAAI,EACF,iBAAiB,KAAK,sBAAU,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAQ,CAAC,IAAI;YACzE,IAAI,EAAE;gBACJ,WAAW,EAAE;oBACX;wBACE,MAAM;wBACN,WAAW;wBACX,YAAY;wBACZ,iBAAiB;wBACjB,KAAK;wBACL,MAAM,EAAE,EAAE;qBACX;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -8,9 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
13
  const constants_1 = require("./constants");
@@ -18,7 +15,7 @@ const clients_1 = require("../../utils/clients");
18
15
  const helpers_1 = require("./helpers");
19
16
  const solana_1 = require("../../utils/solana");
20
17
  const farmsJob_1 = require("./farmsJob");
21
- const tokenPriceToAssetTokens_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetTokens"));
18
+ const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
22
19
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
23
20
  const client = (0, clients_1.getClientSolana)();
24
21
  const userFarmAccountsPromises = farmsJob_1.userFarmConfigs.map((userFarmConfig) => (0, solana_1.getParsedProgramAccounts)(client, userFarmConfig.struct, userFarmConfig.programId, userFarmConfig.filters(owner)));
@@ -33,15 +30,14 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
33
30
  farmsInfo.forEach((farmInfo) => farmInfo
34
31
  ? farmsInfoMap.set(farmInfo.account.pubkey.toString(), farmInfo)
35
32
  : undefined);
33
+ const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
36
34
  const rayStakingPubkey = (0, helpers_1.getStakePubKey)(owner).toString();
37
- const liquiditiesWithoutRewards = [];
38
- const elementsWithRewards = [];
35
+ const uniqueElementForFarmsWithoutRewards = elementRegistry.addElementLiquidity({
36
+ label: 'Farming',
37
+ });
38
+ const liquidityOfUniqueElement = uniqueElementForFarmsWithoutRewards.addLiquidity();
39
39
  for (let i = 0; i < userFarmAccounts.length; i += 1) {
40
- const rewardAssets = [];
41
- const assets = [];
42
40
  const userFarmAccount = userFarmAccounts[i];
43
- if (userFarmAccount.pubkey.toString() === rayStakingPubkey)
44
- continue;
45
41
  const farmInfo = farmsInfoMap.get(userFarmAccount.poolId.toString());
46
42
  if (!farmInfo)
47
43
  continue;
@@ -49,81 +45,41 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
49
45
  if (!lpTokenPrice)
50
46
  continue;
51
47
  const farmAccount = farmInfo.account;
52
- // LP staked on Farm
53
- const amount = userFarmAccount.depositBalance
54
- .div(Math.pow(10, farmInfo.lpToken.decimals))
55
- .toNumber();
56
- if (amount > 0) {
57
- const underlyingAssets = (0, tokenPriceToAssetTokens_1.default)(lpTokenPrice.address, amount, portfolio_core_1.NetworkId.solana, lpTokenPrice);
58
- assets.push(...underlyingAssets);
59
- }
48
+ const element = elementRegistry.addElementLiquidity({
49
+ label: userFarmAccount.pubkey.toString() === rayStakingPubkey
50
+ ? 'Staked'
51
+ : 'Farming',
52
+ });
53
+ const liquidity = element.addLiquidity();
60
54
  // Farm pending reward A
61
55
  if (farmInfo.rewardTokenA) {
62
- const assetTokenA = (0, helpers_1.getPendingAssetToken)(userFarmAccount.depositBalance, userFarmAccount.rewardDebt, farmAccount.perShare, farmInfo.rewardTokenA, farmInfo.d);
63
- if (assetTokenA.data.amount > 0) {
64
- rewardAssets.push(assetTokenA);
65
- }
56
+ liquidity.addRewardAsset((0, helpers_1.getPendingAssetParams)(userFarmAccount.depositBalance, userFarmAccount.rewardDebt, farmAccount.perShare, farmInfo.rewardTokenA, farmInfo.d));
66
57
  }
67
58
  // Farm pending reward B
68
59
  if (farmInfo.rewardTokenB &&
69
60
  farmAccount.perShareB &&
70
61
  userFarmAccount.rewardDebtB) {
71
- const assetTokenB = (0, helpers_1.getPendingAssetToken)(userFarmAccount.depositBalance, userFarmAccount.rewardDebtB, farmAccount.perShareB, farmInfo.rewardTokenB, farmInfo.d);
72
- if (assetTokenB.data.amount > 0) {
73
- rewardAssets.push(assetTokenB);
74
- }
62
+ liquidity.addRewardAsset((0, helpers_1.getPendingAssetParams)(userFarmAccount.depositBalance, userFarmAccount.rewardDebtB, farmAccount.perShareB, farmInfo.rewardTokenB, farmInfo.d));
75
63
  }
76
- const assetsValue = (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value));
77
- const rewardAssetsValue = (0, portfolio_core_1.getUsdValueSum)(rewardAssets.map((r) => r.value));
78
- const value = (0, portfolio_core_1.getUsdValueSum)([assetsValue, rewardAssetsValue]);
79
- if (value === 0)
80
- continue;
81
- if (rewardAssets.length === 0) {
82
- liquiditiesWithoutRewards.push({
83
- assets,
84
- assetsValue,
85
- rewardAssets: [],
86
- rewardAssetsValue: null,
87
- value: assetsValue,
88
- yields: [],
64
+ // LP staked on Farm
65
+ const amount = userFarmAccount.depositBalance.div(Math.pow(10, farmInfo.lpToken.decimals));
66
+ if (liquidity.rewardAssets.length > 0 ||
67
+ userFarmAccount.pubkey.toString() === rayStakingPubkey) {
68
+ liquidity.addAsset({
69
+ address: lpTokenPrice.address,
70
+ amount,
71
+ alreadyShifted: true,
72
+ });
73
+ }
74
+ else {
75
+ liquidityOfUniqueElement.addAsset({
76
+ address: lpTokenPrice.address,
77
+ amount,
78
+ alreadyShifted: true,
89
79
  });
90
- continue;
91
80
  }
92
- const liquidityWithRewards = {
93
- value,
94
- assets,
95
- assetsValue,
96
- rewardAssets,
97
- rewardAssetsValue,
98
- yields: [],
99
- };
100
- elementsWithRewards.push({
101
- networkId: portfolio_core_1.NetworkId.solana,
102
- platformId: constants_1.platformId,
103
- type: portfolio_core_1.PortfolioElementType.liquidity,
104
- label: 'Farming',
105
- value: liquidityWithRewards.value,
106
- data: {
107
- liquidities: [liquidityWithRewards],
108
- },
109
- });
110
81
  }
111
- if (liquiditiesWithoutRewards.length === 0 &&
112
- elementsWithRewards.length === 0)
113
- return [];
114
- return [
115
- ...elementsWithRewards,
116
- {
117
- networkId: portfolio_core_1.NetworkId.solana,
118
- platformId: constants_1.platformId,
119
- type: portfolio_core_1.PortfolioElementType.liquidity,
120
- label: 'Farming',
121
- value: (0, portfolio_core_1.getUsdValueSum)(liquiditiesWithoutRewards.map((l) => l.value)),
122
- data: {
123
- liquidities: liquiditiesWithoutRewards,
124
- },
125
- },
126
- ];
82
+ return elementRegistry.dump(cache);
127
83
  });
128
84
  const fetcher = {
129
85
  id: `${constants_1.platformId}-farms`,
@@ -1 +1 @@
1
- {"version":3,"file":"farmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/farmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AAGpC,2CAAyC;AACzC,iDAAsD;AACtD,uCAAiE;AACjE,+CAA6E;AAC7E,yCAA6C;AAE7C,uGAA+E;AAG/E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,wBAAwB,GAAG,0BAAe,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE,CACtE,IAAA,iCAAwB,EACtB,MAAM,EACN,cAAc,CAAC,MAAM,EACrB,cAAc,CAAC,SAAS,EACxB,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,CAC9B,CACF,CAAC;IACF,MAAM,gBAAgB,GAAG,CAAC,MAAM,OAAO,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC;SAC1E,IAAI,CAAC,CAAC,CAAC;SACP,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SACpE,IAAI,EAAE,CAAC;IAEV,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE7C,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,QAAQ,CACpC,gBAAgB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EACpD,EAA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;aAAM,CAAC;YACN,wBAAwB,CAAC,QAAQ,CAAC;gBAChC,OAAO,EAAE,YAAY,CAAC,OAAO;gBAC7B,MAAM;gBACN,cAAc,EAAE,IAAI;aACrB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrC,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"}
@@ -94,10 +94,9 @@ function getRaydiumCLMMPositions(cache, nfts) {
94
94
  assetTokenB.value === null ||
95
95
  assetTokenA.value === null)
96
96
  continue;
97
- if (tokenAmountA.isZero())
98
- assetTokenA.attributes.tags = ['Out Of Range'];
99
- if (tokenAmountB.isZero())
100
- assetTokenB.attributes.tags = ['Out Of Range'];
97
+ const tags = [];
98
+ if (tokenAmountA.isZero() || tokenAmountB.isZero())
99
+ tags.push('Out Of Range');
101
100
  const rewardAssets = [];
102
101
  const feesAndRewardsBalances = (0, helpers_1.getFeesAndRewardsBalance)(personalPositionInfo, poolStateInfo, tickArrays[index]);
103
102
  if (feesAndRewardsBalances) {
@@ -146,6 +145,7 @@ function getRaydiumCLMMPositions(cache, nfts) {
146
145
  data: {
147
146
  liquidities,
148
147
  },
148
+ tags,
149
149
  });
150
150
  }
151
151
  return elements;
@@ -1 +1 @@
1
- {"version":3,"file":"getRaydiumCLMMPositions.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/getRaydiumCLMMPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAQoC;AACpC,6CAA4C;AAC5C,2CAAyD;AACzD,qGAA6E;AAC7E,+CAAmE;AACnE,iDAAsD;AACtD,2CAIyB;AAEzB,wFAAyF;AACzF,uCAA0E;AAE1E,SAAsB,uBAAuB,CAC3C,KA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C3E,MAAM,KAAK,GAAG,IAAA,+BAAc,EAC1B,CAAC,GAAG,MAAM,EAAE,GAAG,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CACjD,CAAC;YAEF,IAAI,CAAC,KAAK;gBAAE,SAAS;YAErB,MAAM,WAAW,GAAG;gBAClB;oBACE,MAAM;oBACN,WAAW;oBACX,YAAY;oBACZ,iBAAiB;oBACjB,KAAK;oBACL,MAAM,EAAE,EAAE;iBACX;aACF,CAAC;YAEF,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,qCAAoB,CAAC,SAAS;gBACpC,SAAS,EAAE,0BAAS,CAAC,MAAM;gBAC3B,UAAU,EAAV,sBAAU;gBACV,KAAK,EAAE,eAAe;gBACtB,IAAI,EAAE,cAAc;gBACpB,KAAK,EAAE,IAAA,+BAAc,EAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;gBACtD,IAAI,EAAE;oBACJ,WAAW;iBACZ;aACF,CAAC,CAAC;QACL,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CAAA;AA9ND,0DA8NC"}
1
+ {"version":3,"file":"getRaydiumCLMMPositions.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/raydium/getRaydiumCLMMPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAQoC;AACpC,6CAA4C;AAC5C,2CAAyD;AACzD,qGAA6E;AAC7E,+CAAmE;AACnE,iDAAsD;AACtD,2CAIyB;AAEzB,wFAAyF;AACzF,uCAA0E;AAE1E,SAAsB,uBAAuB,CAC3C,KAAY,EACZ,IAAiC;;QAEjC,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;QAEjC,MAAM,uBAAuB,GAAgB,EAAE,CAAC;QAChD,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EA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B,MAAM,WAAW,GAAG;gBAClB;oBACE,MAAM;oBACN,WAAW;oBACX,YAAY;oBACZ,iBAAiB;oBACjB,KAAK;oBACL,MAAM,EAAE,EAAE;iBACX;aACF,CAAC;YAEF,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,qCAAoB,CAAC,SAAS;gBACpC,SAAS,EAAE,0BAAS,CAAC,MAAM;gBAC3B,UAAU,EAAV,sBAAU;gBACV,KAAK,EAAE,eAAe;gBACtB,IAAI,EAAE,cAAc;gBACpB,KAAK,EAAE,IAAA,+BAAc,EAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;gBACtD,IAAI,EAAE;oBACJ,WAAW;iBACZ;gBACD,IAAI;aACL,CAAC,CAAC;QACL,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CAAA;AAhOD,0DAgOC"}
@@ -1,9 +1,10 @@
1
1
  import BigNumber from 'bignumber.js';
2
2
  import BN from 'bn.js';
3
- import { PortfolioAssetCollectible, PortfolioAssetToken, TokenPrice, Yield } from '@sonarwatch/portfolio-core';
3
+ import { PortfolioAssetCollectible, TokenPrice, Yield } from '@sonarwatch/portfolio-core';
4
4
  import { PublicKey } from '@solana/web3.js';
5
5
  import { PersonalPositionState, PoolState, TickArrayState } from './structs/clmms';
6
6
  import { ParsedAccount } from '../../utils/solana';
7
+ import { PortfolioAssetParams } from '../../utils/elementbuilder/PortfolioAssetParams';
7
8
  export declare function isARaydiumPosition(nft: PortfolioAssetCollectible): boolean;
8
9
  export declare function raydiumTickToPriceX64(tick: number): BN;
9
10
  export declare function getRaydiumTokenAmountsFromLiquidity(sqrtPriceCurrentX64: BigNumber, sqrtPriceX64A: BigNumber, sqrtPriceX64B: BigNumber, liquidity: BigNumber, roundUp: boolean): {
@@ -12,7 +13,7 @@ export declare function getRaydiumTokenAmountsFromLiquidity(sqrtPriceCurrentX64:
12
13
  };
13
14
  export declare function getStakePubKey(owner: string): PublicKey;
14
15
  export declare function getFarmYield(rewardToken: TokenPrice, rewardPerBlock: BigNumber, tvl: number, slotsPerSec?: number): Yield;
15
- export declare function getPendingAssetToken(depositBalance: BigNumber, rewardDebt: BigNumber, perShare: BigNumber, rewardToken: TokenPrice, multiplier: number | BigNumber): PortfolioAssetToken;
16
+ export declare function getPendingAssetParams(depositBalance: BigNumber, rewardDebt: BigNumber, perShare: BigNumber, rewardToken: TokenPrice, multiplier: number | BigNumber): PortfolioAssetParams;
16
17
  export declare const getTickArrayAddress: (programId: string, poolId: string, tickNumber: number, tickSpacing: number) => PublicKey;
17
18
  export declare const getFeesAndRewardsBalance: (personalPositionInfo: ParsedAccount<PersonalPositionState>, poolStateInfo: ParsedAccount<PoolState>, tickArrays: (ParsedAccount<TickArrayState> | null)[]) => {
18
19
  tokenFeeAmountA: BigNumber;