@sonarwatch/portfolio-plugins 0.14.63 → 0.14.65

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.
Files changed (313) hide show
  1. package/CHANGELOG.md +21 -13
  2. package/package.json +4 -1
  3. package/src/plugins/01/constants.d.ts +1 -0
  4. package/src/plugins/01/helpers.d.ts +1 -0
  5. package/src/plugins/01/struct.d.ts +1 -0
  6. package/src/plugins/accessprotocol/constants.d.ts +1 -0
  7. package/src/plugins/accessprotocol/filters.d.ts +1 -0
  8. package/src/plugins/accessprotocol/structs.d.ts +1 -0
  9. package/src/plugins/adrastea/constants.d.ts +1 -0
  10. package/src/plugins/adrastea/structs.d.ts +1 -0
  11. package/src/plugins/adrena/constants.d.ts +1 -0
  12. package/src/plugins/adrena/filters.d.ts +1 -0
  13. package/src/plugins/adrena/helpers.d.ts +1 -0
  14. package/src/plugins/adrena/structs.d.ts +1 -0
  15. package/src/plugins/allbridge/constants.d.ts +1 -0
  16. package/src/plugins/allbridge/helpers.d.ts +1 -0
  17. package/src/plugins/armada-staking/constants.d.ts +1 -0
  18. package/src/plugins/armada-staking/filters.d.ts +1 -0
  19. package/src/plugins/armada-staking/structs.d.ts +1 -0
  20. package/src/plugins/atrix/constants.d.ts +1 -0
  21. package/src/plugins/atrix/structs.d.ts +1 -0
  22. package/src/plugins/aurory/constants.d.ts +1 -0
  23. package/src/plugins/aurory/helpers.d.ts +1 -0
  24. package/src/plugins/banx/constants.d.ts +1 -0
  25. package/src/plugins/banx/filters.d.ts +1 -0
  26. package/src/plugins/banx/structs.d.ts +1 -0
  27. package/src/plugins/bonfida/constants.d.ts +1 -0
  28. package/src/plugins/bonfida/filters.d.ts +1 -0
  29. package/src/plugins/bonfida/structs.d.ts +1 -0
  30. package/src/plugins/bonkrewards/constants.d.ts +1 -0
  31. package/src/plugins/bonkrewards/filters.d.ts +1 -0
  32. package/src/plugins/bonkrewards/structs.d.ts +1 -0
  33. package/src/plugins/bskt/constants.d.ts +1 -0
  34. package/src/plugins/bskt/filters.d.ts +1 -0
  35. package/src/plugins/bskt/structs.d.ts +1 -0
  36. package/src/plugins/citrus/constants.d.ts +1 -0
  37. package/src/plugins/citrus/filters.d.ts +1 -0
  38. package/src/plugins/clone/constants.d.ts +1 -0
  39. package/src/plugins/clone/helpers.d.ts +1 -0
  40. package/src/plugins/clone/structs.d.ts +1 -0
  41. package/src/plugins/cropper/constants.d.ts +1 -0
  42. package/src/plugins/cyberfrogs/constants.d.ts +1 -0
  43. package/src/plugins/cyberfrogs/structs.d.ts +1 -0
  44. package/src/plugins/daos/constants.d.ts +1 -0
  45. package/src/plugins/daos/helpers.d.ts +1 -0
  46. package/src/plugins/daos/structs/realms.d.ts +1 -0
  47. package/src/plugins/daos/types.d.ts +1 -0
  48. package/src/plugins/debridge/constants.d.ts +1 -0
  49. package/src/plugins/doubleup/structs.d.ts +1 -0
  50. package/src/plugins/drift/constants.d.ts +1 -0
  51. package/src/plugins/drift/depositsFetcher.d.ts +3 -0
  52. package/src/plugins/drift/depositsFetcher.js +41 -95
  53. package/src/plugins/drift/depositsFetcher.js.map +1 -1
  54. package/src/plugins/drift/filters.d.ts +1 -0
  55. package/src/plugins/drift/helpers.d.ts +1 -0
  56. package/src/plugins/drift/perpHelpers/constants.d.ts +1 -0
  57. package/src/plugins/drift/struct.d.ts +1 -0
  58. package/src/plugins/drift-market-maker-vault/constants.d.ts +1 -0
  59. package/src/plugins/drift-market-maker-vault/depositsFetcher.js +10 -2
  60. package/src/plugins/drift-market-maker-vault/depositsFetcher.js.map +1 -1
  61. package/src/plugins/drift-market-maker-vault/filters.d.ts +1 -1
  62. package/src/plugins/drift-market-maker-vault/filters.js +1 -4
  63. package/src/plugins/drift-market-maker-vault/filters.js.map +1 -1
  64. package/src/plugins/drift-market-maker-vault/helpers.d.ts +1 -0
  65. package/src/plugins/drift-market-maker-vault/helpers.js +38 -0
  66. package/src/plugins/drift-market-maker-vault/helpers.js.map +1 -0
  67. package/src/plugins/drift-market-maker-vault/structs.d.ts +1 -0
  68. package/src/plugins/drift-market-maker-vault/types.d.ts +2 -3
  69. package/src/plugins/drift-market-maker-vault/vaultsJob.js +20 -14
  70. package/src/plugins/drift-market-maker-vault/vaultsJob.js.map +1 -1
  71. package/src/plugins/elemental/filters.d.ts +1 -0
  72. package/src/plugins/elemental/helpers.d.ts +1 -0
  73. package/src/plugins/elemental/structs.d.ts +1 -0
  74. package/src/plugins/famousfoxfederation/constants.d.ts +1 -0
  75. package/src/plugins/flash/constants.d.ts +1 -0
  76. package/src/plugins/flash/filters.d.ts +1 -0
  77. package/src/plugins/flash/helpers.d.ts +1 -0
  78. package/src/plugins/flash/structs.d.ts +1 -0
  79. package/src/plugins/fluxbeam/structs.d.ts +1 -0
  80. package/src/plugins/foo/structs.d.ts +1 -0
  81. package/src/plugins/francium/constants.d.ts +1 -0
  82. package/src/plugins/francium/helpers.d.ts +1 -0
  83. package/src/plugins/francium/structs.d.ts +1 -0
  84. package/src/plugins/francium/tokens.d.ts +1 -0
  85. package/src/plugins/francium/types.d.ts +1 -0
  86. package/src/plugins/futarchy/constants.d.ts +1 -0
  87. package/src/plugins/futarchy/structs.d.ts +1 -0
  88. package/src/plugins/genesysgo/constants.d.ts +1 -0
  89. package/src/plugins/goosefx/constants.d.ts +1 -0
  90. package/src/plugins/goosefx/filters.d.ts +1 -0
  91. package/src/plugins/goosefx/structs.d.ts +1 -0
  92. package/src/plugins/grass/constants.d.ts +1 -0
  93. package/src/plugins/grass/helpers.d.ts +1 -0
  94. package/src/plugins/grass/structs.d.ts +1 -0
  95. package/src/plugins/hawksight/helper.d.ts +1 -0
  96. package/src/plugins/hedgehog/constants.d.ts +1 -0
  97. package/src/plugins/hedgehog/structs.d.ts +1 -0
  98. package/src/plugins/hxro/constants.d.ts +1 -0
  99. package/src/plugins/hxro/structs.d.ts +1 -0
  100. package/src/plugins/jito/structs.d.ts +1 -0
  101. package/src/plugins/joule/structs.d.ts +1 -0
  102. package/src/plugins/jupiter/exchange/constants.d.ts +1 -0
  103. package/src/plugins/jupiter/exchange/filters.d.ts +1 -0
  104. package/src/plugins/jupiter/exchange/structs.d.ts +1 -0
  105. package/src/plugins/jupiter/filters.d.ts +1 -0
  106. package/src/plugins/jupiter/helpers.d.ts +1 -0
  107. package/src/plugins/jupiter/launchpad/constants.d.ts +1 -0
  108. package/src/plugins/jupiter/launchpad/structs.d.ts +1 -0
  109. package/src/plugins/kamino/constants.d.ts +1 -0
  110. package/src/plugins/kamino/filters.d.ts +1 -0
  111. package/src/plugins/kamino/helpers/pdas.d.ts +1 -0
  112. package/src/plugins/kamino/structs/klend.d.ts +1 -0
  113. package/src/plugins/kamino/structs/vaults.d.ts +1 -0
  114. package/src/plugins/lifinity/constants.d.ts +1 -0
  115. package/src/plugins/lifinity/filters.d.ts +1 -0
  116. package/src/plugins/lifinity/structs.d.ts +1 -0
  117. package/src/plugins/loopscale/constants.d.ts +1 -0
  118. package/src/plugins/loopscale/filters.d.ts +1 -0
  119. package/src/plugins/loopscale/helpers.d.ts +1 -0
  120. package/src/plugins/loopscale/structs.d.ts +1 -0
  121. package/src/plugins/loverflow/constants.d.ts +1 -0
  122. package/src/plugins/loverflow/helpers.d.ts +1 -0
  123. package/src/plugins/loverflow/structs.d.ts +1 -0
  124. package/src/plugins/lulo/constants.d.ts +1 -0
  125. package/src/plugins/lulo/struct.d.ts +1 -0
  126. package/src/plugins/magiceden/constants.d.ts +1 -0
  127. package/src/plugins/magiceden/helpers.d.ts +1 -0
  128. package/src/plugins/magiceden/structs.d.ts +1 -0
  129. package/src/plugins/mango/constants.d.ts +1 -0
  130. package/src/plugins/mango/filters.d.ts +1 -0
  131. package/src/plugins/mango/struct.d.ts +1 -0
  132. package/src/plugins/marginfi/constants.d.ts +1 -0
  133. package/src/plugins/marginfi/filters.d.ts +1 -0
  134. package/src/plugins/marginfi/structs/Bank.d.ts +1 -0
  135. package/src/plugins/marginfi/structs/MarginfiAccount.d.ts +1 -0
  136. package/src/plugins/marinade/constants.d.ts +1 -0
  137. package/src/plugins/marinade/filters.d.ts +1 -0
  138. package/src/plugins/marinade/helpers.d.ts +1 -0
  139. package/src/plugins/marinade/structs.d.ts +1 -0
  140. package/src/plugins/meso/structs.d.ts +1 -0
  141. package/src/plugins/metaplex/constants.d.ts +1 -0
  142. package/src/plugins/metaplex/helpers.d.ts +1 -0
  143. package/src/plugins/meteora/constants.d.ts +1 -0
  144. package/src/plugins/meteora/dlmmHelper.d.ts +1 -0
  145. package/src/plugins/meteora/filters.d.ts +1 -0
  146. package/src/plugins/meteora/helpers.d.ts +1 -0
  147. package/src/plugins/meteora/struct.d.ts +1 -0
  148. package/src/plugins/meteora/types.d.ts +1 -0
  149. package/src/plugins/moonwalk/constants.d.ts +1 -0
  150. package/src/plugins/moonwalk/structs.d.ts +1 -0
  151. package/src/plugins/native-stake/solana/constants.d.ts +1 -0
  152. package/src/plugins/native-stake/solana/filters.d.ts +1 -0
  153. package/src/plugins/native-stake/solana/structs.d.ts +1 -0
  154. package/src/plugins/nosana/constants.d.ts +1 -0
  155. package/src/plugins/nosana/helpers.d.ts +1 -0
  156. package/src/plugins/nosana/structs.d.ts +1 -0
  157. package/src/plugins/nxfinance/constants.d.ts +1 -0
  158. package/src/plugins/orca/constants.d.ts +1 -0
  159. package/src/plugins/orca/filters.d.ts +1 -0
  160. package/src/plugins/orca/getWhirlpoolPositions.d.ts +1 -0
  161. package/src/plugins/orca/getWhirlpoolsJob.d.ts +1 -0
  162. package/src/plugins/orca/structs/oldLiquidities.d.ts +1 -0
  163. package/src/plugins/orca/structs/whirlpool.d.ts +1 -0
  164. package/src/plugins/orders/clobs-solana/filters.d.ts +1 -0
  165. package/src/plugins/orders/clobs-solana/structs.d.ts +1 -0
  166. package/src/plugins/parcl/constants.d.ts +1 -0
  167. package/src/plugins/parcl/filters.d.ts +1 -0
  168. package/src/plugins/parcl/helpers.d.ts +1 -0
  169. package/src/plugins/parcl/structs.d.ts +1 -0
  170. package/src/plugins/phoenix/constants.d.ts +1 -0
  171. package/src/plugins/phoenix/helpers/misc.d.ts +1 -0
  172. package/src/plugins/phoenix/structs/marketHeader.d.ts +1 -0
  173. package/src/plugins/phoenix/structs/misc.d.ts +1 -0
  174. package/src/plugins/phoenix/structs/seat.d.ts +1 -0
  175. package/src/plugins/picasso/constants.d.ts +1 -0
  176. package/src/plugins/picasso/helpers.d.ts +1 -0
  177. package/src/plugins/port/constants.d.ts +1 -0
  178. package/src/plugins/port/filters.d.ts +1 -0
  179. package/src/plugins/port/structs.d.ts +1 -0
  180. package/src/plugins/pyth/constants.d.ts +1 -0
  181. package/src/plugins/pyth/structs.d.ts +1 -0
  182. package/src/plugins/quarry/constants.d.ts +1 -0
  183. package/src/plugins/quarry/filters.d.ts +1 -0
  184. package/src/plugins/quarry/helpers.d.ts +1 -0
  185. package/src/plugins/quarry/types.d.ts +1 -0
  186. package/src/plugins/rain/constants.d.ts +1 -0
  187. package/src/plugins/rain/filters.d.ts +1 -0
  188. package/src/plugins/rain/helpers.d.ts +1 -0
  189. package/src/plugins/rain/structs/loan.d.ts +1 -0
  190. package/src/plugins/rain/structs/pool.d.ts +1 -0
  191. package/src/plugins/raydium/constants.d.ts +1 -0
  192. package/src/plugins/raydium/farmsJob.d.ts +1 -0
  193. package/src/plugins/raydium/filters.d.ts +1 -0
  194. package/src/plugins/raydium/helpers.d.ts +3 -2
  195. package/src/plugins/raydium/structs/amms.d.ts +1 -0
  196. package/src/plugins/raydium/structs/clmms.d.ts +1 -0
  197. package/src/plugins/raydium/structs/cpmm.d.ts +1 -0
  198. package/src/plugins/raydium/structs/farms.d.ts +1 -0
  199. package/src/plugins/raydium/structs/openOrders.d.ts +1 -0
  200. package/src/plugins/raydium/structs/staking.d.ts +1 -0
  201. package/src/plugins/raydium/types.d.ts +1 -0
  202. package/src/plugins/sandglass/constants.d.ts +1 -0
  203. package/src/plugins/sandglass/filters.d.ts +1 -0
  204. package/src/plugins/sandglass/structs.d.ts +1 -0
  205. package/src/plugins/save/constants.d.ts +1 -0
  206. package/src/plugins/save/structs.d.ts +1 -0
  207. package/src/plugins/save/types.d.ts +1 -0
  208. package/src/plugins/sharky/constants.d.ts +1 -0
  209. package/src/plugins/sharky/filters.d.ts +1 -0
  210. package/src/plugins/solayer/constants.d.ts +1 -0
  211. package/src/plugins/solayer/structs.d.ts +1 -0
  212. package/src/plugins/spdr/constants.d.ts +1 -0
  213. package/src/plugins/spdr/structs.d.ts +1 -0
  214. package/src/plugins/stabble/filters.d.ts +1 -0
  215. package/src/plugins/staratlas/constants.d.ts +1 -0
  216. package/src/plugins/staratlas/helpers.d.ts +1 -0
  217. package/src/plugins/staratlas/structs.d.ts +1 -0
  218. package/src/plugins/streamflow/constants.d.ts +1 -0
  219. package/src/plugins/streamflow/filters.d.ts +1 -0
  220. package/src/plugins/streamflow/structs.d.ts +1 -0
  221. package/src/plugins/suilend/airdropFetcher.d.ts +1 -0
  222. package/src/plugins/suilend/airdropFetcher.js +66 -34
  223. package/src/plugins/suilend/airdropFetcher.js.map +1 -1
  224. package/src/plugins/suilend/burnEventsJob.d.ts +3 -0
  225. package/src/plugins/suilend/burnEventsJob.js +68 -0
  226. package/src/plugins/suilend/burnEventsJob.js.map +1 -0
  227. package/src/plugins/suilend/constants.d.ts +2 -1
  228. package/src/plugins/suilend/constants.js +5 -4
  229. package/src/plugins/suilend/constants.js.map +1 -1
  230. package/src/plugins/suilend/index.js +2 -1
  231. package/src/plugins/suilend/index.js.map +1 -1
  232. package/src/plugins/suilend/types.d.ts +23 -0
  233. package/src/plugins/switchboard/helpers/getSwitchboardOnDemandPrice.d.ts +1 -0
  234. package/src/plugins/switchboard/helpers/getSwitchboardOnDemandPrices.d.ts +1 -0
  235. package/src/plugins/switchboard/helpers/getSwitchboardPrice.d.ts +1 -0
  236. package/src/plugins/switchboard/helpers/getSwitchboardPrices.d.ts +1 -0
  237. package/src/plugins/switchboard/structs.d.ts +1 -0
  238. package/src/plugins/symmetry/constants.d.ts +1 -0
  239. package/src/plugins/symmetry/filters.d.ts +1 -0
  240. package/src/plugins/symmetry/structs.d.ts +1 -0
  241. package/src/plugins/tensor/constants.d.ts +1 -0
  242. package/src/plugins/tensor/filters.d.ts +1 -0
  243. package/src/plugins/tensor/helpers.d.ts +1 -0
  244. package/src/plugins/tensor/struct.d.ts +1 -0
  245. package/src/plugins/texture/constants.d.ts +1 -0
  246. package/src/plugins/texture/structs.d.ts +1 -0
  247. package/src/plugins/tulip/constants.d.ts +1 -0
  248. package/src/plugins/tulip/structs.d.ts +1 -0
  249. package/src/plugins/uxd/constants.d.ts +1 -0
  250. package/src/plugins/uxd/structs.d.ts +1 -0
  251. package/src/plugins/vaultka/constants.d.ts +1 -0
  252. package/src/plugins/vaultka/structs.d.ts +1 -0
  253. package/src/plugins/whalesmarket/constants.d.ts +1 -0
  254. package/src/plugins/whalesmarket/depositFetcher.js +3 -1
  255. package/src/plugins/whalesmarket/depositFetcher.js.map +1 -1
  256. package/src/plugins/whalesmarket/structs.d.ts +1 -0
  257. package/src/plugins/wormhole/constants.d.ts +1 -0
  258. package/src/plugins/wormhole/helpers.d.ts +1 -0
  259. package/src/plugins/wormhole/structs.d.ts +1 -0
  260. package/src/plugins/zelo/constants.d.ts +1 -0
  261. package/src/plugins/zelo/structs.d.ts +1 -0
  262. package/src/plugins/zeta/constants.d.ts +1 -0
  263. package/src/plugins/zeta/helpers.d.ts +1 -0
  264. package/src/plugins/zeta/structs.d.ts +1 -0
  265. package/src/utils/clients/types.d.ts +1 -0
  266. package/src/utils/elementbuilder/AssetBuilder.d.ts +4 -11
  267. package/src/utils/elementbuilder/AssetBuilder.js +0 -34
  268. package/src/utils/elementbuilder/AssetBuilder.js.map +1 -1
  269. package/src/utils/elementbuilder/AssetGenericBuilder.d.ts +10 -0
  270. package/src/utils/elementbuilder/AssetGenericBuilder.js +49 -0
  271. package/src/utils/elementbuilder/AssetGenericBuilder.js.map +1 -0
  272. package/src/utils/elementbuilder/AssetTokenBuilder.d.ts +15 -0
  273. package/src/utils/elementbuilder/AssetTokenBuilder.js +46 -0
  274. package/src/utils/elementbuilder/AssetTokenBuilder.js.map +1 -0
  275. package/src/utils/elementbuilder/ConcentratedLiquidityParams.d.ts +1 -0
  276. package/src/utils/elementbuilder/ElementBorrowlendBuilder.d.ts +11 -6
  277. package/src/utils/elementbuilder/ElementBorrowlendBuilder.js +24 -10
  278. package/src/utils/elementbuilder/ElementBorrowlendBuilder.js.map +1 -1
  279. package/src/utils/elementbuilder/ElementMultipleBuilder.d.ts +5 -3
  280. package/src/utils/elementbuilder/ElementMultipleBuilder.js +7 -3
  281. package/src/utils/elementbuilder/ElementMultipleBuilder.js.map +1 -1
  282. package/src/utils/elementbuilder/LiquidityBuilder.d.ts +6 -6
  283. package/src/utils/elementbuilder/LiquidityBuilder.js +3 -3
  284. package/src/utils/elementbuilder/LiquidityBuilder.js.map +1 -1
  285. package/src/utils/elementbuilder/PortfolioAssetGenericParams.d.ts +12 -0
  286. package/src/utils/elementbuilder/PortfolioAssetGenericParams.js +3 -0
  287. package/src/utils/elementbuilder/PortfolioAssetGenericParams.js.map +1 -0
  288. package/src/utils/elementbuilder/{PortfolioAssetParams.d.ts → PortfolioAssetTokenParams.d.ts} +2 -1
  289. package/src/utils/elementbuilder/{PortfolioAssetParams.js → PortfolioAssetTokenParams.js} +1 -1
  290. package/src/utils/elementbuilder/PortfolioAssetTokenParams.js.map +1 -0
  291. package/src/utils/solana/constants.d.ts +1 -0
  292. package/src/utils/solana/fetchTokenSupplyAndDecimals.d.ts +1 -0
  293. package/src/utils/solana/filters.d.ts +1 -0
  294. package/src/utils/solana/getAutoParsedMultipleAccountsInfo.d.ts +1 -0
  295. package/src/utils/solana/getAutoParsedProgramAccounts.d.ts +1 -0
  296. package/src/utils/solana/getDecimals.d.ts +1 -0
  297. package/src/utils/solana/getMultipleAccountsInfoSafe.d.ts +1 -0
  298. package/src/utils/solana/getMultipleDecimals.d.ts +1 -0
  299. package/src/utils/solana/getMultipleDecimalsAsMap.d.ts +1 -0
  300. package/src/utils/solana/getParsedAccountInfo.d.ts +1 -0
  301. package/src/utils/solana/getParsedMultipleAccountsInfo.d.ts +1 -0
  302. package/src/utils/solana/getParsedProgramAccounts.d.ts +1 -0
  303. package/src/utils/solana/getProgramAccounts.d.ts +1 -0
  304. package/src/utils/solana/getSupply.d.ts +1 -0
  305. package/src/utils/solana/jupiter/deriveClaimStatus.d.ts +1 -0
  306. package/src/utils/solana/jupiter/deriveClaimStatuses.d.ts +1 -0
  307. package/src/utils/solana/jupiter/getMerkleDistributorPda.d.ts +1 -0
  308. package/src/utils/solana/pyth/helpers.d.ts +1 -0
  309. package/src/utils/solana/pyth/structs.d.ts +1 -0
  310. package/src/utils/solana/pyth/structsOld.d.ts +1 -0
  311. package/src/utils/solana/structs.d.ts +1 -0
  312. package/src/utils/solana/types.d.ts +1 -0
  313. package/src/utils/elementbuilder/PortfolioAssetParams.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,22 +2,30 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
- ## [0.14.63](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.62...plugins-0.14.63) (2024-12-11)
6
-
7
-
8
-
9
- ## [0.14.62](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.61...plugins-0.14.62) (2024-12-10)
10
-
11
-
12
-
13
- ## [0.14.61](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.60...plugins-0.14.61) (2024-12-09)
14
-
15
-
16
-
17
- ## [0.14.60](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.59...plugins-0.14.60) (2024-12-09)
5
+ ## [0.14.65](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.64...plugins-0.14.65) (2024-12-13)
18
6
 
19
7
 
20
8
 
9
+ ## [0.14.64](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.63...plugins-0.14.64) (2024-12-12)
10
+
11
+
12
+
13
+ ## [0.14.63](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.62...plugins-0.14.63) (2024-12-11)
14
+
15
+
16
+
17
+ ## [0.14.62](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.61...plugins-0.14.62) (2024-12-10)
18
+
19
+
20
+
21
+ ## [0.14.61](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.60...plugins-0.14.61) (2024-12-09)
22
+
23
+
24
+
25
+ ## [0.14.60](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.59...plugins-0.14.60) (2024-12-09)
26
+
27
+
28
+
21
29
  ## [0.14.59](https://github.com/sonarwatch/portfolio/compare/plugins-0.14.58...plugins-0.14.59) (2024-12-05)
22
30
 
23
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.14.63",
3
+ "version": "0.14.65",
4
4
  "type": "commonjs",
5
5
  "types": "./src/index.d.ts",
6
6
  "peerDependencies": {
@@ -12,6 +12,8 @@
12
12
  "@aptos-labs/ts-sdk": "^1.19.0",
13
13
  "@bonfida/spl-name-service": "^1.0.10",
14
14
  "@cosmjs/cosmwasm-stargate": "^0.31.1",
15
+ "@drift-labs/sdk": "^2.104.0-beta.13",
16
+ "@drift-labs/vaults-sdk": "^0.2.7",
15
17
  "@ethersproject/bignumber": "^5.7.0",
16
18
  "@ethersproject/constants": "^5.7.0",
17
19
  "@ethersproject/providers": "^5.7.2",
@@ -22,6 +24,7 @@
22
24
  "@mysten/bcs": "^0.11.1",
23
25
  "@mysten/sui": "^1.12.0",
24
26
  "@onsol/tldparser": "^0.6.1",
27
+ "@project-serum/anchor": "^0.26.0",
25
28
  "@sei-js/core": "^3.0.1",
26
29
  "@sei-js/proto": "^3.0.1",
27
30
  "@solana/web3.js": "^1.91.8",
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  import { Contract, Platform, Service, ServiceConfig } from '@sonarwatch/portfolio-core';
3
4
  export declare const platformId = "01";
@@ -1,2 +1,3 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  export declare function getPda(owner: PublicKey): PublicKey;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
3
  import { PublicKey } from '@solana/web3.js';
3
4
  import { BeetStruct } from '@metaplex-foundation/beet';
4
5
  import { WrappedI80F48 } from '../marginfi/structs/common';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  import { Platform } from '@sonarwatch/portfolio-core';
3
4
  export declare const platformId = "accessprotocol";
@@ -1,2 +1,3 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { GetProgramAccountsFilter } from '@solana/web3.js';
2
3
  export declare const stakeAccountStructFilter: (owner: string) => GetProgramAccountsFilter[];
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { BeetStruct } from '@metaplex-foundation/beet';
2
3
  import { PublicKey } from '@solana/web3.js';
3
4
  import BigNumber from 'bignumber.js';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { Platform } from '@sonarwatch/portfolio-core';
2
3
  import { PublicKey } from '@solana/web3.js';
3
4
  export declare const platformId = "adrastea";
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
3
  import { BeetStruct, FixableBeetStruct } from '@metaplex-foundation/beet';
3
4
  import { PublicKey } from '@solana/web3.js';
4
5
  import BigNumber from 'bignumber.js';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { Platform } from '@sonarwatch/portfolio-core';
2
3
  import { PublicKey } from '@solana/web3.js';
3
4
  export declare const platformId = "adrena";
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { GetProgramAccountsFilter } from '@solana/web3.js';
2
3
  export declare const positionFilter: (owner: string) => GetProgramAccountsFilter[];
3
4
  export declare const custodiesFilters: GetProgramAccountsFilter[];
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  export declare function getStakingPda(stakedTokenMint: PublicKey): PublicKey;
3
4
  export declare function getUserStakingPda(owner: PublicKey, stakingPda: PublicKey): PublicKey;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
3
  import { BeetStruct, FixableBeetStruct } from '@metaplex-foundation/beet';
3
4
  import { PublicKey } from '@solana/web3.js';
4
5
  import BigNumber from 'bignumber.js';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { Platform } from '@sonarwatch/portfolio-core';
2
3
  import { PublicKey } from '@solana/web3.js';
3
4
  import { IdlItem } from '@solanafm/explorer-kit-idls';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import BigNumber from 'bignumber.js';
2
3
  import { PublicKey } from '@solana/web3.js';
3
4
  import { Pools } from './types';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  import { Platform } from '@sonarwatch/portfolio-core';
3
4
  export declare const platformId = "armada-staking-program";
@@ -1,2 +1,3 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { GetProgramAccountsFilter } from '@solana/web3.js';
2
3
  export declare const stakeFilters: (owner: string) => GetProgramAccountsFilter[];
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
3
  import { BeetStruct } from '@metaplex-foundation/beet';
3
4
  import { PublicKey } from '@solana/web3.js';
4
5
  import BigNumber from 'bignumber.js';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  import { Platform } from '@sonarwatch/portfolio-core';
3
4
  export declare const platformId = "atrix";
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
3
  import { BeetStruct } from '@metaplex-foundation/beet';
3
4
  import { PublicKey } from '@solana/web3.js';
4
5
  import BigNumber from 'bignumber.js';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  import { Platform } from '@sonarwatch/portfolio-core';
3
4
  export declare const platformId = "aurory";
@@ -1,2 +1,3 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  export declare function getStakingAccountAddress(owner: string): PublicKey;
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  import { Platform } from '@sonarwatch/portfolio-core';
3
4
  import { IdlItem } from '@solanafm/explorer-kit-idls';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { GetProgramAccountsFilter } from '@solana/web3.js';
2
3
  export declare const stakeFilters: (owner: string) => GetProgramAccountsFilter[];
3
4
  export declare const loanFiltersA: (owner: string) => GetProgramAccountsFilter[];
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
3
  import { BeetStruct } from '@metaplex-foundation/beet';
3
4
  import { PublicKey } from '@solana/web3.js';
4
5
  import BigNumber from 'bignumber.js';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  import { Platform } from '@sonarwatch/portfolio-core';
3
4
  export declare const platformId = "bonfida";
@@ -1,2 +1,3 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { GetProgramAccountsFilter } from '@solana/web3.js';
2
3
  export declare const claimFilters: (owner: string) => GetProgramAccountsFilter[];
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
3
  import { BeetStruct } from '@metaplex-foundation/beet';
3
4
  import { PublicKey } from '@solana/web3.js';
4
5
  import BigNumber from 'bignumber.js';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  import { Platform } from '@sonarwatch/portfolio-core';
3
4
  export declare const platformId = "bonkrewards";
@@ -1,2 +1,3 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { GetProgramAccountsFilter } from '@solana/web3.js';
2
3
  export declare const stakeDepositReceiptFilter: (owner: string) => GetProgramAccountsFilter[];
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
3
  import { BeetStruct } from '@metaplex-foundation/beet';
3
4
  import { PublicKey } from '@solana/web3.js';
4
5
  import BigNumber from 'bignumber.js';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  import { Platform } from '@sonarwatch/portfolio-core';
3
4
  export declare const platformId = "bskt";
@@ -1,2 +1,3 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { GetProgramAccountsFilter } from '@solana/web3.js';
2
3
  export declare const vestingAccountFilter: (owner: string) => GetProgramAccountsFilter[];
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
3
  import { BeetStruct } from '@metaplex-foundation/beet';
3
4
  import { PublicKey } from '@solana/web3.js';
4
5
  import BigNumber from 'bignumber.js';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { Platform } from '@sonarwatch/portfolio-core';
2
3
  import { PublicKey } from '@solana/web3.js';
3
4
  import { IdlItem } from '@solanafm/explorer-kit-idls';
@@ -1,2 +1,3 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { GetProgramAccountsFilter } from '@solana/web3.js';
2
3
  export declare function getLoanFilters(owner: string): [GetProgramAccountsFilter[], GetProgramAccountsFilter[]];
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  import { Platform } from '@sonarwatch/portfolio-core';
3
4
  export declare const platformId = "clone";
@@ -1,2 +1,3 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  export declare function getUserAccount(owner: string): PublicKey;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
3
  import { BeetStruct, FixableBeetStruct } from '@metaplex-foundation/beet';
3
4
  import BigNumber from 'bignumber.js';
4
5
  import { PublicKey } from '@solana/web3.js';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  import { Platform } from '@sonarwatch/portfolio-core';
3
4
  export declare const platformId = "cropper";
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  import { Platform } from '@sonarwatch/portfolio-core';
3
4
  export declare const platformId = "cyberfrogs";
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
3
  import { BeetStruct } from '@metaplex-foundation/beet';
3
4
  import { PublicKey } from '@solana/web3.js';
4
5
  import BigNumber from 'bignumber.js';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  import { Platform } from '@sonarwatch/portfolio-core';
3
4
  import { VSRInfos } from './types';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PortfolioAssetCollectible, PortfolioElement } from '@sonarwatch/portfolio-core';
2
3
  import BigNumber from 'bignumber.js';
3
4
  import { PublicKey } from '@solana/web3.js';
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
3
  import { BeetStruct } from '@metaplex-foundation/beet';
3
4
  import { PublicKey } from '@solana/web3.js';
4
5
  import BigNumber from 'bignumber.js';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  import BigNumber from 'bignumber.js';
3
4
  export type VSRInfos = {
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
3
  import { Platform } from '@sonarwatch/portfolio-core';
3
4
  import { PublicKey } from '@solana/web3.js';
4
5
  import { AirdropStatics } from '../../AirdropFetcher';
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
3
  import { BeetStruct } from '@metaplex-foundation/beet';
3
4
  import { PublicKey } from '@solana/web3.js';
4
5
  import BigNumber from 'bignumber.js';
@@ -1,3 +1,4 @@
1
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  import { Platform } from '@sonarwatch/portfolio-core';
3
4
  import { AirdropStatics } from '../../AirdropFetcher';
@@ -1,3 +1,6 @@
1
1
  import { Fetcher } from '../../Fetcher';
2
+ import { SpotMarketEnhanced } from './types';
3
+ import { MemoizedCache } from '../../utils/misc/MemoizedCache';
4
+ export declare const spotMarketsMemo: MemoizedCache<SpotMarketEnhanced[], SpotMarketEnhanced[]>;
2
5
  declare const fetcher: Fetcher;
3
6
  export default fetcher;
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.spotMarketsMemo = void 0;
15
16
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
17
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
17
18
  const web3_js_1 = require("@solana/web3.js");
@@ -20,21 +21,23 @@ const struct_1 = require("./struct");
20
21
  const helpers_1 = require("./helpers");
21
22
  const solana_1 = require("../../utils/solana");
22
23
  const clients_1 = require("../../utils/clients");
23
- const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
24
24
  const position_1 = require("./perpHelpers/position");
25
25
  const constants_2 = require("./perpHelpers/constants");
26
26
  const types_1 = require("./perpHelpers/types");
27
27
  const getOraclePrice_1 = require("./perpHelpers/getOraclePrice");
28
28
  const getPerpMarket_1 = require("./perpHelpers/getPerpMarket");
29
29
  const getMintFromOracle_1 = require("./perpHelpers/getMintFromOracle");
30
+ const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
31
+ const MemoizedCache_1 = require("../../utils/misc/MemoizedCache");
32
+ exports.spotMarketsMemo = new MemoizedCache_1.MemoizedCache(constants_1.keySpotMarkets, {
33
+ prefix: constants_1.platformId,
34
+ networkId: portfolio_core_1.NetworkId.solana,
35
+ });
30
36
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
31
37
  const client = (0, clients_1.getClientSolana)();
32
- const spotMarketsItems = yield cache.getItem(constants_1.keySpotMarkets, {
33
- prefix: constants_1.platformId,
34
- networkId: portfolio_core_1.NetworkId.solana,
35
- });
38
+ const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
39
+ const spotMarketsItems = yield exports.spotMarketsMemo.getItem(cache);
36
40
  const spotMarketByIndex = new Map();
37
- const tokensMints = [];
38
41
  const insuranceFundStakeAccountsAddresses = [];
39
42
  const insuranceVaultsPkeys = [];
40
43
  for (const spotMarketItem of spotMarketsItems || []) {
@@ -42,23 +45,21 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
42
45
  (0, helpers_1.getUserInsuranceFundStakeAccountPublicKey)(constants_1.driftProgram, new web3_js_1.PublicKey(owner), spotMarketItem.marketIndex);
43
46
  insuranceVaultsPkeys.push(new web3_js_1.PublicKey(spotMarketItem.insuranceFund.vault));
44
47
  spotMarketByIndex.set(spotMarketItem.marketIndex, spotMarketItem);
45
- tokensMints.push(spotMarketItem.mint.toString());
46
48
  }
47
- const [insuranceAccounts, insuranceTokenAccounts, tokensPrices] = yield Promise.all([
49
+ const [insuranceAccounts, insuranceTokenAccounts] = yield Promise.all([
48
50
  (0, solana_1.getParsedMultipleAccountsInfo)(client, struct_1.insuranceFundStakeStruct, insuranceFundStakeAccountsAddresses),
49
51
  (0, solana_1.getParsedMultipleAccountsInfo)(client, solana_1.tokenAccountStruct, insuranceVaultsPkeys),
50
- cache.getTokenPrices(tokensMints, portfolio_core_1.NetworkId.solana),
51
52
  ]);
52
- const tokenPriceById = new Map();
53
- tokensPrices.forEach((tP) => (tP ? tokenPriceById.set(tP.address, tP) : []));
54
53
  const insuranceTokenAccountsById = new Map();
55
54
  insuranceTokenAccounts.forEach((acc) => {
56
55
  if (acc)
57
56
  insuranceTokenAccountsById.set(acc.pubkey.toString(), acc);
58
57
  });
59
58
  // Insurance
60
- const elements = [];
61
- const insuranceAssets = [];
59
+ const elementInsurance = elementRegistry.addElementMultiple({
60
+ label: 'Staked',
61
+ name: 'Insurance Fund',
62
+ });
62
63
  insuranceAccounts.forEach((account, i) => {
63
64
  if (!account || account.ifShares.isZero())
64
65
  return;
@@ -69,28 +70,13 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
69
70
  const vault = insuranceTokenAccountsById.get(insuranceFund.vault.toString());
70
71
  if (!vault)
71
72
  return;
72
- const tokenPrice = tokenPriceById.get(mint.toString());
73
- if (!tokenPrice)
74
- return;
75
- const sharesAmount = account.ifShares
76
- .dividedBy(insuranceFund.totalShares)
77
- .times(vault.amount.dividedBy(Math.pow(10, tokenPrice.decimals)))
78
- .toNumber();
79
- insuranceAssets.push((0, tokenPriceToAssetToken_1.default)(mint.toString(), sharesAmount, portfolio_core_1.NetworkId.solana, tokenPrice));
80
- });
81
- if (insuranceAssets.length > 0) {
82
- elements.push({
83
- networkId: portfolio_core_1.NetworkId.solana,
84
- label: 'Staked',
85
- name: 'Insurance Fund',
86
- platformId: constants_1.platformId,
87
- type: portfolio_core_1.PortfolioElementType.multiple,
88
- value: (0, portfolio_core_1.getUsdValueSum)(insuranceAssets.map((a) => a.value)),
89
- data: {
90
- assets: insuranceAssets,
91
- },
73
+ elementInsurance.addAsset({
74
+ address: mint,
75
+ amount: account.ifShares
76
+ .dividedBy(insuranceFund.totalShares)
77
+ .times(vault.amount),
92
78
  });
93
- }
79
+ });
94
80
  // Perps part
95
81
  let id = 0;
96
82
  const userAccounts = [];
@@ -102,7 +88,7 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
102
88
  id += 10;
103
89
  } while (parsedAccount[parsedAccount.length]);
104
90
  if (!userAccounts || userAccounts.length === 0)
105
- return elements;
91
+ return elementRegistry.getElements(cache);
106
92
  const perpMarketIndexesArr = yield cache.getItem(constants_1.perpMarketsIndexesKey, {
107
93
  prefix: constants_1.platformId,
108
94
  networkId: portfolio_core_1.NetworkId.solana,
@@ -115,13 +101,11 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
115
101
  for (const userAccount of userAccounts) {
116
102
  if (!userAccount)
117
103
  continue;
118
- const borrowedAssets = [];
119
- const borrowedYields = [];
120
- const suppliedAssets = [];
121
- const suppliedYields = [];
122
- const rewardAssets = [];
123
104
  const marketIndexRef = 0;
124
- const unsettledAssets = [];
105
+ const element = elementRegistry.addElementBorrowlend({
106
+ label: 'Lending',
107
+ name: (0, solana_1.u8ArrayToString)(userAccount.name),
108
+ });
125
109
  for (const perpPosition of userAccount.perpPositions) {
126
110
  if (perpPosition.baseAssetAmount.isZero())
127
111
  continue;
@@ -139,27 +123,21 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
139
123
  ? portfolio_core_1.LeverageSide.long
140
124
  : portfolio_core_1.LeverageSide.short;
141
125
  const mint = yield (0, getMintFromOracle_1.getMintFromOracle)(market.amm.oracle.toString(), cache);
142
- const asset = {
143
- type: portfolio_core_1.PortfolioAssetType.generic,
144
- networkId: portfolio_core_1.NetworkId.solana,
126
+ element.addUnsettledGenericAsset({
145
127
  value: pnl,
146
128
  name: (0, solana_1.u8ArrayToString)(market.name),
147
- data: {
148
- address: mint || undefined,
149
- },
129
+ address: mint || undefined,
150
130
  attributes: {
151
131
  tags: [side],
152
132
  },
153
- };
154
- unsettledAssets.push(asset);
133
+ });
155
134
  }
156
135
  // Each account has up to 8 SpotPositions
157
136
  for (const spotPosition of userAccount.spotPositions) {
158
137
  if (spotPosition.scaledBalance.isZero())
159
138
  continue;
160
- const countForBase = marketIndexRef === undefined ||
161
- spotPosition.marketIndex === marketIndexRef;
162
- const countForQuote = marketIndexRef === undefined || marketIndexRef === 0;
139
+ const countForBase = spotPosition.marketIndex === marketIndexRef;
140
+ const countForQuote = marketIndexRef === 0;
163
141
  if ((0, helpers_1.isSpotPositionAvailable)(spotPosition) ||
164
142
  (!countForBase && !countForQuote)) {
165
143
  continue;
@@ -167,9 +145,6 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
167
145
  const spotMarket = spotMarketByIndex.get(spotPosition.marketIndex);
168
146
  if (!spotMarket)
169
147
  continue;
170
- const tokenPrice = tokenPriceById.get(spotMarket.mint.toString());
171
- if (!tokenPrice || tokenPrice === null)
172
- continue;
173
148
  let tokenAmount = new bignumber_js_1.default(0);
174
149
  if (spotMarket.marketIndex !== 0 &&
175
150
  spotPosition.balanceType === struct_1.SpotBalanceType.Deposit) {
@@ -179,8 +154,11 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
179
154
  tokenAmount = (0, helpers_1.getSignedTokenAmount)((0, helpers_1.getTokenAmount)(spotPosition.scaledBalance, spotMarket, spotPosition.balanceType), spotPosition.balanceType);
180
155
  }
181
156
  if (spotPosition.balanceType === struct_1.SpotBalanceType.Deposit) {
182
- suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(spotMarket.mint.toString(), tokenAmount.div(Math.pow(10, tokenPrice.decimals)).toNumber(), portfolio_core_1.NetworkId.solana, tokenPrice));
183
- suppliedYields.push([
157
+ element.addSuppliedAsset({
158
+ address: spotMarket.mint,
159
+ amount: tokenAmount,
160
+ });
161
+ element.addSuppliedYield([
184
162
  {
185
163
  apr: spotMarket.depositApr,
186
164
  apy: (0, portfolio_core_1.aprToApy)(spotMarket.depositApr),
@@ -188,11 +166,11 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
188
166
  ]);
189
167
  }
190
168
  else if (spotPosition.balanceType === struct_1.SpotBalanceType.Borrow) {
191
- borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(spotMarket.mint.toString(), tokenAmount
192
- .div(Math.pow(10, tokenPrice.decimals))
193
- .abs()
194
- .toNumber(), portfolio_core_1.NetworkId.solana, tokenPrice));
195
- borrowedYields.push([
169
+ element.addBorrowedAsset({
170
+ address: spotMarket.mint,
171
+ amount: tokenAmount.abs(),
172
+ });
173
+ element.addSuppliedYield([
196
174
  {
197
175
  apr: -spotMarket.borrowApr,
198
176
  apy: -(0, portfolio_core_1.aprToApy)(spotMarket.borrowApr),
@@ -200,40 +178,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
200
178
  ]);
201
179
  }
202
180
  }
203
- if (suppliedAssets.length === 0 && borrowedAssets.length === 0)
204
- continue;
205
- const { borrowedValue, suppliedValue, value, healthRatio, rewardValue, unsettledValue, } = (0, portfolio_core_1.getElementLendingValues)({
206
- suppliedAssets,
207
- borrowedAssets,
208
- rewardAssets,
209
- unsettledAssets,
210
- });
211
- elements.push({
212
- type: portfolio_core_1.PortfolioElementType.borrowlend,
213
- networkId: portfolio_core_1.NetworkId.solana,
214
- platformId: constants_1.platformId,
215
- label: 'Lending',
216
- value,
217
- data: {
218
- borrowedAssets,
219
- borrowedValue,
220
- borrowedYields,
221
- suppliedAssets,
222
- suppliedValue,
223
- suppliedYields,
224
- rewardAssets,
225
- rewardValue,
226
- healthRatio,
227
- unsettled: {
228
- assets: unsettledAssets,
229
- value: unsettledValue,
230
- },
231
- value,
232
- },
233
- name: (0, solana_1.u8ArrayToString)(userAccount.name),
234
- });
235
181
  }
236
- return elements;
182
+ return elementRegistry.getElements(cache);
237
183
  });
238
184
  const fetcher = {
239
185
  id: `${constants_1.platformId}-deposits`,