@sonarwatch/portfolio-plugins 0.14.151 → 0.14.153

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 (184) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +1 -1
  3. package/src/plugins/allbridge/constants.d.ts +0 -6
  4. package/src/plugins/allbridge/constants.js +1 -9
  5. package/src/plugins/allbridge/constants.js.map +1 -1
  6. package/src/plugins/allbridge/helpers.d.ts +1 -1
  7. package/src/plugins/allbridge/helpers.js +1 -3
  8. package/src/plugins/allbridge/helpers.js.map +1 -1
  9. package/src/plugins/allbridge/positionsFetcher.js +2 -1
  10. package/src/plugins/allbridge/positionsFetcher.js.map +1 -1
  11. package/src/plugins/allbridge/structs.d.ts +13 -0
  12. package/src/plugins/allbridge/structs.js +14 -0
  13. package/src/plugins/allbridge/structs.js.map +1 -0
  14. package/src/plugins/allbridge/types.d.ts +0 -6
  15. package/src/plugins/bonfida/constants.js +1 -1
  16. package/src/plugins/bonfida/constants.js.map +1 -1
  17. package/src/plugins/divvy/constants.d.ts +0 -2
  18. package/src/plugins/divvy/constants.js +1 -7
  19. package/src/plugins/divvy/constants.js.map +1 -1
  20. package/src/plugins/divvy/houseJob.js +6 -3
  21. package/src/plugins/divvy/houseJob.js.map +1 -1
  22. package/src/plugins/divvy/housePoolFetcher.js +9 -11
  23. package/src/plugins/divvy/housePoolFetcher.js.map +1 -1
  24. package/src/plugins/divvy/stakingFetcher.js +7 -12
  25. package/src/plugins/divvy/stakingFetcher.js.map +1 -1
  26. package/src/plugins/divvy/structs.d.ts +57 -0
  27. package/src/plugins/divvy/structs.js +57 -0
  28. package/src/plugins/divvy/structs.js.map +1 -0
  29. package/src/plugins/drift/spotMarketsJob.js +0 -1
  30. package/src/plugins/drift/spotMarketsJob.js.map +1 -1
  31. package/src/plugins/elemental/constants.d.ts +4 -2
  32. package/src/plugins/elemental/constants.js +3 -7
  33. package/src/plugins/elemental/constants.js.map +1 -1
  34. package/src/plugins/elemental/filters.d.ts +0 -1
  35. package/src/plugins/elemental/filters.js +1 -6
  36. package/src/plugins/elemental/filters.js.map +1 -1
  37. package/src/plugins/elemental/helpers.js +2 -2
  38. package/src/plugins/elemental/helpers.js.map +1 -1
  39. package/src/plugins/elemental/poolsJob.js +4 -4
  40. package/src/plugins/elemental/poolsJob.js.map +1 -1
  41. package/src/plugins/ensofi/constants.d.ts +4 -2
  42. package/src/plugins/ensofi/constants.js +3 -7
  43. package/src/plugins/ensofi/constants.js.map +1 -1
  44. package/src/plugins/ensofi/idl.d.ts +149 -6
  45. package/src/plugins/ensofi/idl.js +1074 -61
  46. package/src/plugins/ensofi/idl.js.map +1 -1
  47. package/src/plugins/ensofi/index.js +2 -1
  48. package/src/plugins/ensofi/index.js.map +1 -1
  49. package/src/plugins/ensofi/solanaLoansFetcher.js +23 -37
  50. package/src/plugins/ensofi/solanaLoansFetcher.js.map +1 -1
  51. package/src/plugins/ensofi/solanaLoansJob.d.ts +3 -0
  52. package/src/plugins/ensofi/solanaLoansJob.js +63 -0
  53. package/src/plugins/ensofi/solanaLoansJob.js.map +1 -0
  54. package/src/plugins/ensofi/structs.d.ts +58 -0
  55. package/src/plugins/ensofi/structs.js +60 -0
  56. package/src/plugins/ensofi/structs.js.map +1 -0
  57. package/src/plugins/jupiter/governance/constants.js +3 -3
  58. package/src/plugins/jupiter/governance/constants.js.map +1 -1
  59. package/src/plugins/jupiter/launchpad/constants.d.ts +1 -0
  60. package/src/plugins/jupiter/launchpad/constants.js +8 -7
  61. package/src/plugins/jupiter/launchpad/constants.js.map +1 -1
  62. package/src/plugins/jupiter/pricingJob.js +2 -1
  63. package/src/plugins/jupiter/pricingJob.js.map +1 -1
  64. package/src/plugins/kamino/reservesJob.js +35 -0
  65. package/src/plugins/kamino/reservesJob.js.map +1 -1
  66. package/src/plugins/loopscale/constants.d.ts +2 -3
  67. package/src/plugins/loopscale/constants.js +3 -4
  68. package/src/plugins/loopscale/constants.js.map +1 -1
  69. package/src/plugins/loopscale/helpers.d.ts +6 -33
  70. package/src/plugins/loopscale/helpers.js +39 -142
  71. package/src/plugins/loopscale/helpers.js.map +1 -1
  72. package/src/plugins/loopscale/index.js +10 -3
  73. package/src/plugins/loopscale/index.js.map +1 -1
  74. package/src/plugins/loopscale/lendFetcher.js +57 -0
  75. package/src/plugins/loopscale/lendFetcher.js.map +1 -0
  76. package/src/plugins/loopscale/lendVaultsFetcher.d.ts +6 -0
  77. package/src/plugins/loopscale/lendVaultsFetcher.js +68 -0
  78. package/src/plugins/loopscale/lendVaultsFetcher.js.map +1 -0
  79. package/src/plugins/loopscale/loansFetcher.d.ts +3 -0
  80. package/src/plugins/loopscale/loansFetcher.js +79 -0
  81. package/src/plugins/loopscale/loansFetcher.js.map +1 -0
  82. package/src/plugins/loopscale/structs.d.ts +116 -86
  83. package/src/plugins/loopscale/structs.js +101 -79
  84. package/src/plugins/loopscale/structs.js.map +1 -1
  85. package/src/plugins/loopscale/types.d.ts +6 -0
  86. package/src/plugins/loopscale/types.js.map +1 -0
  87. package/src/plugins/loopscale/vaultsJob.d.ts +3 -0
  88. package/src/plugins/loopscale/vaultsJob.js +121 -0
  89. package/src/plugins/loopscale/vaultsJob.js.map +1 -0
  90. package/src/plugins/lulo/depositsFetcher.js +9 -29
  91. package/src/plugins/lulo/depositsFetcher.js.map +1 -1
  92. package/src/plugins/marginfi/banksJob.js +6 -2
  93. package/src/plugins/marginfi/banksJob.js.map +1 -1
  94. package/src/plugins/marginfi/constants.d.ts +5 -3
  95. package/src/plugins/marginfi/constants.js +8 -7
  96. package/src/plugins/marginfi/constants.js.map +1 -1
  97. package/src/plugins/marginfi/depositsFetcher.js +50 -27
  98. package/src/plugins/marginfi/depositsFetcher.js.map +1 -1
  99. package/src/plugins/marginfi/getMarginFiAccounts.d.ts +6 -0
  100. package/src/plugins/marginfi/getMarginFiAccounts.js +44 -0
  101. package/src/plugins/marginfi/getMarginFiAccounts.js.map +1 -0
  102. package/src/plugins/marginfi/helpers.d.ts +0 -5
  103. package/src/plugins/marginfi/helpers.js +1 -81
  104. package/src/plugins/marginfi/helpers.js.map +1 -1
  105. package/src/plugins/marginfi/structs/MarginfiAccount.d.ts +5 -0
  106. package/src/plugins/marginfi/structs/MarginfiAccount.js.map +1 -1
  107. package/src/plugins/orca/getWhirlpoolPositions.js +7 -7
  108. package/src/plugins/orca/getWhirlpoolPositions.js.map +1 -1
  109. package/src/plugins/orca/types.d.ts +2 -0
  110. package/src/plugins/picasso/constants.d.ts +0 -2
  111. package/src/plugins/picasso/constants.js +1 -7
  112. package/src/plugins/picasso/constants.js.map +1 -1
  113. package/src/plugins/picasso/helpers.js +7 -4
  114. package/src/plugins/picasso/helpers.js.map +1 -1
  115. package/src/plugins/picasso/structs.d.ts +39 -0
  116. package/src/plugins/picasso/structs.js +37 -0
  117. package/src/plugins/picasso/structs.js.map +1 -0
  118. package/src/plugins/picasso/unstakingNftsJob.js +2 -1
  119. package/src/plugins/picasso/unstakingNftsJob.js.map +1 -1
  120. package/src/plugins/picasso/unstakingPositionsFetcher.js +4 -4
  121. package/src/plugins/picasso/unstakingPositionsFetcher.js.map +1 -1
  122. package/src/plugins/raydium/ammV2ApiJob.js +24 -0
  123. package/src/plugins/raydium/ammV2ApiJob.js.map +1 -1
  124. package/src/plugins/raydium/constants.d.ts +1 -0
  125. package/src/plugins/raydium/constants.js +2 -1
  126. package/src/plugins/raydium/constants.js.map +1 -1
  127. package/src/plugins/raydium/getRaydiumCLMMPositions.js +9 -5
  128. package/src/plugins/raydium/getRaydiumCLMMPositions.js.map +1 -1
  129. package/src/plugins/raydium/types.d.ts +14 -4
  130. package/src/plugins/sanctum/s1AirdropFetcher.js +2 -2
  131. package/src/plugins/sanctum/s1AirdropFetcher.js.map +1 -1
  132. package/src/plugins/sharky/collectionsJob.js +8 -9
  133. package/src/plugins/sharky/collectionsJob.js.map +1 -1
  134. package/src/plugins/sharky/constants.d.ts +0 -2
  135. package/src/plugins/sharky/constants.js +1 -7
  136. package/src/plugins/sharky/constants.js.map +1 -1
  137. package/src/plugins/sharky/loansFetcher.js +25 -19
  138. package/src/plugins/sharky/loansFetcher.js.map +1 -1
  139. package/src/plugins/sharky/structs.d.ts +96 -0
  140. package/src/plugins/sharky/structs.js +103 -0
  141. package/src/plugins/sharky/structs.js.map +1 -0
  142. package/src/plugins/sharky/types.d.ts +0 -15
  143. package/src/plugins/sharky/types.js +0 -8
  144. package/src/plugins/sharky/types.js.map +1 -1
  145. package/src/plugins/stabble/constants.d.ts +0 -3
  146. package/src/plugins/stabble/constants.js +1 -13
  147. package/src/plugins/stabble/constants.js.map +1 -1
  148. package/src/plugins/stabble/poolsJob.js +14 -9
  149. package/src/plugins/stabble/poolsJob.js.map +1 -1
  150. package/src/plugins/stabble/structs.d.ts +43 -0
  151. package/src/plugins/stabble/structs.js +42 -0
  152. package/src/plugins/stabble/structs.js.map +1 -0
  153. package/src/plugins/suilend/helpers.js +2 -0
  154. package/src/plugins/suilend/helpers.js.map +1 -1
  155. package/src/utils/misc/getLendingMarketAprs.d.ts +3 -1
  156. package/src/utils/misc/getLendingMarketAprs.js +24 -1
  157. package/src/utils/misc/getLendingMarketAprs.js.map +1 -1
  158. package/src/utils/solana/beets/ParsedGpa.d.ts +1 -0
  159. package/src/utils/solana/beets/ParsedGpa.js +9 -0
  160. package/src/utils/solana/beets/ParsedGpa.js.map +1 -1
  161. package/src/plugins/divvy/types.d.ts +0 -28
  162. package/src/plugins/divvy/types.js.map +0 -1
  163. package/src/plugins/loopscale/filters.d.ts +0 -9
  164. package/src/plugins/loopscale/filters.js +0 -62
  165. package/src/plugins/loopscale/filters.js.map +0 -1
  166. package/src/plugins/loopscale/positionsFetcher.js +0 -119
  167. package/src/plugins/loopscale/positionsFetcher.js.map +0 -1
  168. package/src/plugins/marginfi/filters.d.ts +0 -5
  169. package/src/plugins/marginfi/filters.js +0 -45
  170. package/src/plugins/marginfi/filters.js.map +0 -1
  171. package/src/plugins/picasso/types.d.ts +0 -17
  172. package/src/plugins/picasso/types.js +0 -3
  173. package/src/plugins/picasso/types.js.map +0 -1
  174. package/src/plugins/sharky/filters.d.ts +0 -8
  175. package/src/plugins/sharky/filters.js +0 -43
  176. package/src/plugins/sharky/filters.js.map +0 -1
  177. package/src/plugins/stabble/filters.d.ts +0 -5
  178. package/src/plugins/stabble/filters.js +0 -20
  179. package/src/plugins/stabble/filters.js.map +0 -1
  180. package/src/plugins/stabble/types.d.ts +0 -40
  181. package/src/plugins/stabble/types.js +0 -3
  182. package/src/plugins/stabble/types.js.map +0 -1
  183. /package/src/plugins/loopscale/{positionsFetcher.d.ts → lendFetcher.d.ts} +0 -0
  184. /package/src/plugins/{divvy → loopscale}/types.js +0 -0
@@ -11,38 +11,61 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
13
13
  const constants_1 = require("./constants");
14
- const MarginfiAccount_1 = require("./structs/MarginfiAccount");
15
14
  const helpers_1 = require("./helpers");
16
- const filters_1 = require("./filters");
17
- const solana_1 = require("../../utils/solana");
18
- const clients_1 = require("../../utils/clients");
15
+ const ElementRegistry_1 = require("../../utils/elementbuilder/ElementRegistry");
16
+ const getMarginFiAccounts_1 = require("./getMarginFiAccounts");
19
17
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
20
- const client = (0, clients_1.getClientSolana)();
21
- const accounts = yield (0, solana_1.getParsedProgramAccounts)(client, MarginfiAccount_1.marginfiAccountStruct, constants_1.MarginfiProgram, (0, filters_1.accountsFilter)(owner));
22
- if (accounts.length === 0)
18
+ const marginFiAccounts = yield (0, getMarginFiAccounts_1.getMarginFiAccounts)(owner, cache);
19
+ if (!marginFiAccounts)
23
20
  return [];
24
- const banksInfo = yield cache.getItem(constants_1.banksKey, {
25
- prefix: constants_1.platformId,
26
- networkId: portfolio_core_1.NetworkId.solana,
27
- });
28
- if (!banksInfo)
29
- throw new Error('Banks not cached');
30
- const banksInfoByAddress = new Map();
31
- const tokensAddresses = new Set();
32
- banksInfo.forEach((bankInfo) => {
33
- if (!bankInfo)
21
+ const elementRegistry = new ElementRegistry_1.ElementRegistry(portfolio_core_1.NetworkId.solana, constants_1.platformId);
22
+ marginFiAccounts.forEach((marginfiAccount) => {
23
+ if (!marginfiAccount)
24
+ return;
25
+ const { balances } = marginfiAccount;
26
+ if (!balances || balances.length === 0)
34
27
  return;
35
- banksInfoByAddress.set(bankInfo.pubkey.toString(), bankInfo);
36
- tokensAddresses.add(bankInfo.mint.toString());
28
+ balances.forEach((balance) => {
29
+ if (!balance)
30
+ return;
31
+ const element = elementRegistry.addElementBorrowlend({
32
+ label: 'Lending',
33
+ ref: marginfiAccount.pubkey.toString(),
34
+ link: 'https://app.marginfi.com/portfolio',
35
+ });
36
+ if (!balance.assetShares.value.isZero()) {
37
+ const suppliedAmount = (0, helpers_1.wrappedI80F48toBigNumber)(balance.assetShares)
38
+ .times(balance.bank.dividedAssetShareValue)
39
+ .toNumber();
40
+ element.addSuppliedAsset({
41
+ address: balance.bank.mint,
42
+ amount: suppliedAmount,
43
+ alreadyShifted: true,
44
+ sourceRefs: [
45
+ { name: 'Lending Market', address: balance.bankPk.toString() },
46
+ ],
47
+ });
48
+ element.addSuppliedLtv(balance.bank.suppliedLtv);
49
+ element.addSuppliedYield(balance.bank.suppliedYields);
50
+ }
51
+ if (!balance.liabilityShares.value.isZero()) {
52
+ const borrowedAmount = (0, helpers_1.wrappedI80F48toBigNumber)(balance.liabilityShares)
53
+ .times(balance.bank.dividedLiabilityShareValue)
54
+ .toNumber();
55
+ element.addBorrowedAsset({
56
+ address: balance.bank.mint,
57
+ amount: borrowedAmount,
58
+ alreadyShifted: true,
59
+ sourceRefs: [
60
+ { name: 'Lending Market', address: balance.bankPk.toString() },
61
+ ],
62
+ });
63
+ element.addBorrowedWeight(balance.bank.borrowedWeight);
64
+ element.addBorrowedYield(balance.bank.borrowedYields);
65
+ }
66
+ });
37
67
  });
38
- const tokenPriceById = yield cache.getTokenPricesAsMap(Array.from(tokensAddresses), portfolio_core_1.NetworkId.solana);
39
- const elements = [];
40
- for (const account of accounts) {
41
- const element = (0, helpers_1.getElementFromAccount)(account, banksInfoByAddress, tokenPriceById);
42
- if (element)
43
- elements.push(element);
44
- }
45
- return elements;
68
+ return elementRegistry.getElements(cache);
46
69
  });
47
70
  const fetcher = {
48
71
  id: `${constants_1.platformId}-deposits`,
@@ -1 +1 @@
1
- {"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marginfi/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAyE;AACzE,2CAAoE;AACpE,+DAAkE;AAClE,uCAAkD;AAClD,uCAA2C;AAE3C,+CAA6E;AAC7E,iDAAsD;AAItD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAwB,EAC7C,MAAM,EACN,uCAAqB,EACrB,2BAAe,EACf,IAAA,wBAAc,EAAC,KAAK,CAAC,CACtB,CAAC;IACF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,OAAO,CAA4B,oBAAQ,EAAE;QACzE,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IACH,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAEpD,MAAM,kBAAkB,GAA0B,IAAI,GAAG,EAAE,CAAC;IAC5D,MAAM,eAAe,GAAgB,IAAI,GAAG,EAAE,CAAC;IAC/C,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC7B,IAAI,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AC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;gBAC5C,MAAM,cAAc,GAAG,IAAA,kCAAwB,EAAC,OAAO,CAAC,eAAe,CAAC;qBACrE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,CAAC;qBAC9C,QAAQ,EAAE,CAAC;gBAEd,OAAO,CAAC,gBAAgB,CAAC;oBACvB,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI;oBAC1B,MAAM,EAAE,cAAc;oBACtB,cAAc,EAAE,IAAI;oBACpB,UAAU,EAAE;wBACV,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE;qBAC/D;iBACF,CAAC,CAAC;gBAEH,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;gBACvD,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YACxD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { BalanceWithBank, MarginfiAccount } from './structs/MarginfiAccount';
2
+ import { Cache } from '../../Cache';
3
+ import { ParsedAccount } from '../../utils/solana';
4
+ export declare const getMarginFiAccounts: (authority: string, cache: Cache) => Promise<((ParsedAccount<MarginfiAccount> & {
5
+ balances: (BalanceWithBank | null)[];
6
+ }) | null)[]>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getMarginFiAccounts = void 0;
13
+ const clients_1 = require("../../utils/clients");
14
+ const ParsedGpa_1 = require("../../utils/solana/beets/ParsedGpa");
15
+ const MarginfiAccount_1 = require("./structs/MarginfiAccount");
16
+ const constants_1 = require("./constants");
17
+ const getMarginFiAccounts = (authority, cache) => __awaiter(void 0, void 0, void 0, function* () {
18
+ const client = (0, clients_1.getClientSolana)();
19
+ const accounts = yield ParsedGpa_1.ParsedGpa.build(client, MarginfiAccount_1.marginfiAccountStruct, constants_1.marginfiProgramId)
20
+ .addRawFilter(0, 'CKkRR4La3xu')
21
+ .addRawFilter(8, constants_1.MarginfiAccountAddress)
22
+ .addRawFilter(40, authority)
23
+ .run();
24
+ if (accounts.length === 0)
25
+ return [];
26
+ const banksInfoByAddress = yield constants_1.marginFiBanksMemo.getItem(cache);
27
+ if (!banksInfoByAddress)
28
+ throw new Error('MarginFi banks not cached');
29
+ return accounts.map((marginfiAccount) => {
30
+ const { balances } = marginfiAccount.lendingAccount;
31
+ if (!balances || balances.length === 0)
32
+ return null;
33
+ return Object.assign(Object.assign({}, marginfiAccount), { balances: balances.map((balance) => {
34
+ if (balance.bankPk.toString() === '11111111111111111111111111111111')
35
+ return null;
36
+ const bank = banksInfoByAddress.get(balance.bankPk.toString());
37
+ if (!bank)
38
+ return null;
39
+ return Object.assign(Object.assign({}, balance), { bank });
40
+ }) });
41
+ });
42
+ });
43
+ exports.getMarginFiAccounts = getMarginFiAccounts;
44
+ //# sourceMappingURL=getMarginFiAccounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getMarginFiAccounts.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marginfi/getMarginFiAccounts.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAAsD;AACtD,kEAA+D;AAC/D,+DAImC;AACnC,2CAIqB;AAId,MAAM,mBAAmB,GAAG,CACjC,SAAiB,EACjB,KAAY,EAQZ,EAAE;IACF,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,QAAQ,GAAG,MAAM,qBAAS,CAAC,KAAK,CACpC,MAAM,EACN,uCAAqB,EACrB,6BAAiB,CAClB;SACE,YAAY,CAAC,CAAC,EAAE,aAAa,CAAC;SAC9B,YAAY,CAAC,CAAC,EAAE,kCAAsB,CAAC;SACvC,YAAY,CAAC,EAAE,EAAE,SAAS,CAAC;SAC3B,GAAG,EAAE,CAAC;IAET,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,kBAAkB,GAAG,MAAM,6BAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClE,IAAI,CAAC,kBAAkB;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAEtE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,eAAe,EAAE,EAAE;QACtC,MAAM,EAAE,QAAQ,EAAE,GAAG,eAAe,CAAC,cAAc,CAAC;QACpD,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAEpD,uCACK,eAAe,KAClB,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;gBACjC,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,kCAAkC;oBAClE,OAAO,IAAI,CAAC;gBAEd,MAAM,IAAI,GAAG,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAC/D,IAAI,CAAC,IAAI;oBAAE,OAAO,IAAI,CAAC;gBAEvB,OAAO,gCACF,OAAO,KACV,IAAI,GACc,CAAC;YACvB,CAAC,CAAC,IACF;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AA/CW,QAAA,mBAAmB,uBA+C9B"}
@@ -1,9 +1,5 @@
1
1
  import BigNumber from 'bignumber.js';
2
- import { PortfolioElement, TokenPrice } from '@sonarwatch/portfolio-core';
3
2
  import { Bank } from './structs/Bank';
4
- import { MarginfiAccount } from './structs/MarginfiAccount';
5
- import { BankInfo } from './types';
6
- import { ParsedAccount } from '../../utils/solana';
7
3
  export declare function wrappedI80F48toBigNumber({ value }: {
8
4
  value: BigNumber;
9
5
  }, scaleDecimal?: number): BigNumber;
@@ -11,4 +7,3 @@ export declare function computeInterestRates(bank: Bank): {
11
7
  lendingApr: number;
12
8
  borrowingApr: number;
13
9
  };
14
- export declare function getElementFromAccount(marginfiAccount: ParsedAccount<MarginfiAccount>, banksInfoByAddress: Map<string, BankInfo>, tokenPriceById: Map<string, TokenPrice>): PortfolioElement | null;
@@ -3,12 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getElementFromAccount = exports.computeInterestRates = exports.wrappedI80F48toBigNumber = void 0;
6
+ exports.computeInterestRates = exports.wrappedI80F48toBigNumber = void 0;
7
7
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
8
  const decimal_js_1 = __importDefault(require("decimal.js"));
9
- const portfolio_core_1 = require("@sonarwatch/portfolio-core");
10
- const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
11
- const constants_1 = require("./constants");
12
9
  function wrappedI80F48toBigNumber({ value }, scaleDecimal = 0) {
13
10
  if (!value)
14
11
  return new bignumber_js_1.default(0);
@@ -61,81 +58,4 @@ function computeInterestRates(bank) {
61
58
  return { lendingApr, borrowingApr };
62
59
  }
63
60
  exports.computeInterestRates = computeInterestRates;
64
- function getElementFromAccount(marginfiAccount, banksInfoByAddress, tokenPriceById) {
65
- const { balances } = marginfiAccount.lendingAccount;
66
- if (!balances || balances.length === 0)
67
- return null;
68
- const borrowedAssets = [];
69
- const borrowedYields = [];
70
- const suppliedAssets = [];
71
- const suppliedYields = [];
72
- const rewardAssets = [];
73
- const suppliedLtvs = [];
74
- const borrowedWeights = [];
75
- let name;
76
- for (let index = 0; index < balances.length; index += 1) {
77
- const balance = balances[index];
78
- if (balance.bankPk.toString() === '11111111111111111111111111111111')
79
- continue;
80
- const bankInfo = banksInfoByAddress.get(balance.bankPk.toString());
81
- if (!bankInfo)
82
- continue;
83
- const tokenPrice = tokenPriceById.get(bankInfo.mint.toString());
84
- if (!balance.assetShares.value.isZero()) {
85
- suppliedLtvs.push(bankInfo.suppliedLtv);
86
- const suppliedAmount = wrappedI80F48toBigNumber(balance.assetShares)
87
- .times(bankInfo.dividedAssetShareValue)
88
- .toNumber();
89
- // If one of the deposited asset is a stake collateral, show it inside the element name
90
- if ((tokenPrice === null || tokenPrice === void 0 ? void 0 : tokenPrice.elementName) === 'Stake Collateral')
91
- name = 'Stake Collateral';
92
- suppliedAssets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(bankInfo.mint.toString(), suppliedAmount, portfolio_core_1.NetworkId.solana, tokenPrice)), { sourceRefs: [
93
- { name: 'Lending Market', address: balance.bankPk.toString() },
94
- ] }));
95
- suppliedYields.push(bankInfo.suppliedYields);
96
- }
97
- if (!balance.liabilityShares.value.isZero()) {
98
- borrowedWeights.push(bankInfo.borrowedWeight);
99
- const borrowedAmount = wrappedI80F48toBigNumber(balance.liabilityShares)
100
- .times(bankInfo.dividedLiabilityShareValue)
101
- .toNumber();
102
- borrowedAssets.push(Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(bankInfo.mint.toString(), borrowedAmount, portfolio_core_1.NetworkId.solana, tokenPrice)), { sourceRefs: [
103
- { name: 'Lending Market', address: balance.bankPk.toString() },
104
- ] }));
105
- borrowedYields.push(bankInfo.borrowedYields);
106
- }
107
- }
108
- if (suppliedAssets.length === 0 && borrowedAssets.length === 0)
109
- return null;
110
- const { borrowedValue, healthRatio, suppliedValue, value, rewardValue } = (0, portfolio_core_1.getElementLendingValues)({
111
- suppliedAssets,
112
- borrowedAssets,
113
- rewardAssets,
114
- suppliedLtvs,
115
- borrowedWeights,
116
- });
117
- return {
118
- type: portfolio_core_1.PortfolioElementType.borrowlend,
119
- networkId: portfolio_core_1.NetworkId.solana,
120
- platformId: constants_1.platformId,
121
- label: 'Lending',
122
- value,
123
- data: {
124
- borrowedAssets,
125
- borrowedValue,
126
- borrowedYields,
127
- suppliedAssets,
128
- suppliedValue,
129
- suppliedYields,
130
- healthRatio,
131
- rewardAssets,
132
- rewardValue,
133
- value,
134
- ref: marginfiAccount.pubkey.toString(),
135
- link: 'https://app.marginfi.com/portfolio',
136
- },
137
- name,
138
- };
139
- }
140
- exports.getElementFromAccount = getElementFromAccount;
141
61
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marginfi/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AACrC,4DAAiC;AACjC,+DAQoC;AAIpC,qGAA6E;AAC7E,2CAAyC;AAGzC,SAAgB,wBAAwB,CACtC,EAAE,KAAK,EAAwB,EAC/B,YAAY,GAAG,CAAC;IAEhB,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC;IAEpC,MAAM,OAAO,GAAG,IAAI,oBAAO,CACzB,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,GAAG,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C;IAED,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAE5E,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,GACrE,IAAA,wCAAuB,EAAC;QACtB,cAAc;QACd,cAAc;QACd,YAAY;QACZ,YAAY;QACZ,eAAe;KAChB,CAAC,CAAC;IAEL,OAAO;QACL,IAAI,EAAE,qCAAoB,CAAC,UAAU;QACrC,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,UAAU,EAAV,sBAAU;QACV,KAAK,EAAE,SAAS;QAChB,KAAK;QACL,IAAI,EAAE;YACJ,cAAc;YACd,aAAa;YACb,cAAc;YACd,cAAc;YACd,aAAa;YACb,cAAc;YACd,WAAW;YACX,YAAY;YACZ,WAAW;YACX,KAAK;YACL,GAAG,EAAE,eAAe,CAAC,MAAM,CAAC,QAAQ,EAAE;YACtC,IAAI,EAAE,oCAAoC;SAC3C;QACD,IAAI;KACL,CAAC;AACJ,CAAC;AAvGD,sDAuGC"}
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/marginfi/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AACrC,4DAAiC;AAGjC,SAAgB,wBAAwB,CACtC,EAAE,KAAK,EAAwB,EAC/B,YAAY,GAAG,CAAC;IAEhB,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC;IAEpC,MAAM,OAAO,GAAG,IAAI,oBAAO,CACzB,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CACnE,CAAC,SAAS,CAAC,SAAA,EAAE,EAAI,YAAY,CAAA,CAAC,CAAC;I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_modules/@solana/web3.js" />
4
4
  import { BeetStruct, FixableBeetStruct } from '@metaplex-foundation/beet';
5
5
  import { PublicKey } from '@solana/web3.js';
6
+ import { ParsedAccount } from '../../../utils/solana';
6
7
  import { WrappedI80F48 } from './common';
8
+ import { BankInfo } from '../types';
7
9
  export type Balance = {
8
10
  active: number;
9
11
  bankPk: PublicKey;
@@ -12,6 +14,9 @@ export type Balance = {
12
14
  liabilityShares: WrappedI80F48;
13
15
  padding: Buffer[];
14
16
  };
17
+ export type BalanceWithBank = Balance & {
18
+ bank: ParsedAccount<BankInfo>;
19
+ };
15
20
  export declare const balanceStruct: BeetStruct<Balance, Partial<Balance>>;
16
21
  export type LendingAccount = {
17
22
  balances: Balance[];
@@ -1 +1 @@
1
- {"version":3,"file":"MarginfiAccount.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/marginfi/structs/MarginfiAccount.ts"],"names":[],"mappings":";;;AAAA,oDAKmC;AACnC,kEAA6D;AAE7D,kDAA6C;AAC7C,qCAA8D;AAWjD,QAAA,aAAa,GAAG,IAAI,iBAAU,CACzC;IACE,CAAC,QAAQ,EAAE,SAAE,CAAC;IACd,CAAC,QAAQ,EAAE,uBAAS,CAAC;IACrB,CAAC,QAAQ,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;IACxC,CAAC,aAAa,EAAE,4BAAmB,CAAC;IACpC,CAAC,iBAAiB,EAAE,4BAAmB,CAAC;IACxC,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,IAAA,aAAI,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAC/C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAe,CAC1B,CAAC;AAOW,QAAA,oBAAoB,GAAG,IAAI,wBAAiB,CACvD;IACE,CAAC,UAAU,EAAE,IAAA,4BAAqB,EAAC,qBAAa,EAAE,EAAE,CAAC,CAAC;IACtD,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,IAAA,aAAI,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAC/C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAsB,CACjC,CAAC;AAUW,QAAA,qBAAqB,GAAG,IAAI,wBAAiB,CACxD;IACE,CAAC,UAAU,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACrB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,gBAAgB,EAAE,4BAAoB,CAAC;IACxC,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,IAAA,aAAI,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;CAChD,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAuB,CAClC,CAAC"}
1
+ {"version":3,"file":"MarginfiAccount.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/marginfi/structs/MarginfiAccount.ts"],"names":[],"mappings":";;;AAAA,oDAKmC;AACnC,kEAA6D;AAE7D,kDAA4D;AAC5D,qCAA8D;AAcjD,QAAA,aAAa,GAAG,IAAI,iBAAU,CACzC;IACE,CAAC,QAAQ,EAAE,SAAE,CAAC;IACd,CAAC,QAAQ,EAAE,uBAAS,CAAC;IACrB,CAAC,QAAQ,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;IACxC,CAAC,aAAa,EAAE,4BAAmB,CAAC;IACpC,CAAC,iBAAiB,EAAE,4BAAmB,CAAC;IACxC,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,IAAA,aAAI,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAC/C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAe,CAC1B,CAAC;AAOW,QAAA,oBAAoB,GAAG,IAAI,wBAAiB,CACvD;IACE,CAAC,UAAU,EAAE,IAAA,4BAAqB,EAAC,qBAAa,EAAE,EAAE,CAAC,CAAC;IACtD,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,IAAA,aAAI,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAC/C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAsB,CACjC,CAAC;AAUW,QAAA,qBAAqB,GAAG,IAAI,wBAAiB,CACxD;IACE,CAAC,UAAU,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACrB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,gBAAgB,EAAE,4BAAoB,CAAC;IACxC,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,IAAA,aAAI,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;CAChD,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAuB,CAClC,CAAC"}
@@ -77,13 +77,6 @@ function getOrcaNftFetcher(platformId, programId) {
77
77
  continue;
78
78
  const element = elementRegistry.addElementConcentratedLiquidity({
79
79
  link: 'https://www.orca.so/portfolio',
80
- ref: positionInfo.pubkey.toString(),
81
- sourceRefs: [
82
- {
83
- name: 'Pool',
84
- address: whirlpoolInfo.pubkey.toString(),
85
- },
86
- ],
87
80
  });
88
81
  const liquidity = element.setLiquidity({
89
82
  addressA: whirlpoolInfo.tokenMintA,
@@ -97,6 +90,13 @@ function getOrcaNftFetcher(platformId, programId) {
97
90
  feeRate: (Number(whirlpoolInfo.feeRate) / 10000) *
98
91
  (1 - whirlpoolInfo.protocolFeeRate / 10000),
99
92
  swapVolume24h: (_a = allWhirlpoolsStats.find((p) => (p === null || p === void 0 ? void 0 : p.address) === positionInfo.whirlpool.toString())) === null || _a === void 0 ? void 0 : _a.stats['24h'].volume,
93
+ ref: positionInfo.pubkey.toString(),
94
+ sourceRefs: [
95
+ {
96
+ name: 'Pool',
97
+ address: whirlpoolInfo.pubkey.toString(),
98
+ },
99
+ ],
100
100
  });
101
101
  const feesAndRewards = (0, helpers_fees_1.calcFeesAndRewards)(whirlpoolInfo, positionInfo, tickArrays);
102
102
  if (feesAndRewards) {
@@ -1 +1 @@
1
- {"version":3,"file":"getWhirlpoolPositions.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/getWhirlpoolPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAIoC;AACpC,6CAA4C;AAC5C,2CAIqB;AACrB,iDAAsD;AACtD,+CAG4B;AAE5B,mDAAgE;AAEhE,iDAAwE;AACxE,gFAA6E;AAGhE,QAAA,qBAAqB,GAAG,iBAAiB,CACpD,sBAAc,EACd,4BAAgB,CACjB,CAAC;AAEF,SAAgB,iBAAiB,CAC/B,UAAkB,EAClB,SAAoB;IAEpB,OAAO,CACL,KAAY,EACZ,IAAiC,EACJ,EAAE;;QAC/B,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;QACjC,MAAM,uBAAuB,GAAgB,EAAE,CAAC;QAEhD,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,MAAM,OAAO,GAAG,IAAI,mBAAS,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEhD,MAAM,YAAY,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;YAEnE,MAAM,CAAC,cAAc,CAAC,GAAG,mBAAS,CAAC,sBAAsB,CACvD,YAAY,EACZ,SAAS,CACV,CAAC;YACF,uBAAuB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QACH,IAAI,uBAAuB,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QAEpD,MAAM,aAAa,GAAG,MAAM,IAAA,sCAA6B,EACvD,MAAM,EACN,0BAAc,EACd,uBAAuB,CACxB,CAAC;QACF,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;YAAE,OAA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YACL,CAAC;QACH,CAAC;QAED,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC,CAAA,CAAC;AACJ,CAAC;AA9ID,8CA8IC"}
1
+ {"version":3,"file":"getWhirlpoolPositions.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/orca/getWhirlpoolPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAIoC;AACpC,6CAA4C;AAC5C,2CAIqB;AACrB,iDAAsD;AACtD,+CAG4B;AAE5B,mDAAgE;AAEhE,iDAAwE;AACxE,gFAA6E;AAGhE,QAAA,qBAAqB,GAAG,iBAAiB,CACpD,sBAAc,EACd,4BAAgB,CACjB,CAAC;AAEF,SAAgB,iBAAiB,CAC/B,UAAkB,EAClB,SAAoB;IAEpB,OAAO,CACL,KAAY,EACZ,IAAiC,EACJ,EAAE;;QAC/B,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;QACjC,MAAM,uBAAuB,GAAgB,EAAE,CAAC;QAEhD,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,MAAM,OAAO,GAAG,IAAI,mBAAS,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEhD,MAAM,YAAY,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;YAEnE,MAAM,CAAC,cAAc,CAAC,GAAG,mBAAS,CAAC,sBAAsB,CACvD,YAAY,EACZ,SAAS,CACV,CAAC;YACF,uBAAuB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QACH,IAAI,uBAAuB,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QAEpD,MAAM,aAAa,GAAG,MAAM,IAAA,sCAA6B,EACvD,MAAM,EACN,0BAAc,EACd,uBAAuB,CACxB,CAAC;QACF,IAAI,CAA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C1C,MAAM,EAAE,cAAc,CAAC,WAAW;iBACnC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC,CAAA,CAAC;AACJ,CAAC;AA9ID,8CA8IC"}
@@ -7,4 +7,6 @@ export type WhirlpoolStat = {
7
7
  };
8
8
  };
9
9
  tvlUsdc: string;
10
+ apr?: string;
11
+ feeRate?: number;
10
12
  };
@@ -1,7 +1,6 @@
1
1
  /// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
2
2
  /// <reference types="jito-ts/node_modules/@solana/web3.js" />
3
3
  import { Platform } from '@sonarwatch/portfolio-core';
4
- import { IdlItem } from '@solanafm/explorer-kit-idls';
5
4
  import { PublicKey } from '@solana/web3.js';
6
5
  export declare const platformId = "picasso";
7
6
  export declare const platform: Platform;
@@ -9,4 +8,3 @@ export declare const unstakingNftsCacheKey = "unstaking-nfts";
9
8
  export declare const unstakingNftsCachePrefix = "picasso";
10
9
  export declare const restakingProgramId: PublicKey;
11
10
  export declare const unstakingOwner = "BoNnRkatYrN7ckA9oAU4e7cHYfwKPgLEuzkKg4LWaHeH";
12
- export declare const restakingIdlItem: IdlItem;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.restakingIdlItem = exports.unstakingOwner = exports.restakingProgramId = exports.unstakingNftsCachePrefix = exports.unstakingNftsCacheKey = exports.platform = exports.platformId = void 0;
3
+ exports.unstakingOwner = exports.restakingProgramId = exports.unstakingNftsCachePrefix = exports.unstakingNftsCacheKey = exports.platform = exports.platformId = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
- const idl_1 = require("./idl");
6
5
  exports.platformId = 'picasso';
7
6
  exports.platform = {
8
7
  id: exports.platformId,
@@ -23,9 +22,4 @@ exports.unstakingNftsCacheKey = `unstaking-nfts`;
23
22
  exports.unstakingNftsCachePrefix = `${exports.platformId}`;
24
23
  exports.restakingProgramId = new web3_js_1.PublicKey('8n3FHwYxFgQCQc2FNFkwDUf9mcqupxXcCvgfHbApMLv3');
25
24
  exports.unstakingOwner = 'BoNnRkatYrN7ckA9oAU4e7cHYfwKPgLEuzkKg4LWaHeH';
26
- exports.restakingIdlItem = {
27
- programId: exports.restakingProgramId.toString(),
28
- idl: idl_1.restakingIdl,
29
- idlType: 'anchor',
30
- };
31
25
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/picasso/constants.ts"],"names":[],"mappings":";;;AAEA,6CAA4C;AAC5C,+BAAqC;AAExB,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EACH,6EAA6E;IAC/E,OAAO,EAAE,6CAA6C;IACtD,OAAO,EAAE,+BAA+B;IACxC,4EAA4E;IAC5E,OAAO,EAAE,uCAAuC;IAChD,QAAQ,EAAE,6BAA6B;IACvC,MAAM,EAAE,iCAAiC;IACzC,aAAa,EAAE,+BAA+B;IAC9C,MAAM,EAAE,qCAAqC;IAC7C,MAAM,EAAE,CAAC,8CAA8C,CAAC;IACxD,WAAW,EACT,iIAAiI;CACpI,CAAC;AAEW,QAAA,qBAAqB,GAAG,gBAAgB,CAAC;AACzC,QAAA,wBAAwB,GAAG,GAAG,kBAAU,EAAE,CAAC;AAE3C,QAAA,kBAAkB,GAAG,IAAI,mBAAS,CAC7C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,8CAA8C,CAAC;AAEhE,QAAA,gBAAgB,GAAG;IAC9B,SAAS,EAAE,0BAAkB,CAAC,QAAQ,EAAE;IACxC,GAAG,EAAE,kBAAY;IACjB,OAAO,EAAE,QAAQ;CACP,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/picasso/constants.ts"],"names":[],"mappings":";;;AACA,6CAA4C;AAE/B,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EACH,6EAA6E;IAC/E,OAAO,EAAE,6CAA6C;IACtD,OAAO,EAAE,+BAA+B;IACxC,4EAA4E;IAC5E,OAAO,EAAE,uCAAuC;IAChD,QAAQ,EAAE,6BAA6B;IACvC,MAAM,EAAE,iCAAiC;IACzC,aAAa,EAAE,+BAA+B;IAC9C,MAAM,EAAE,qCAAqC;IAC7C,MAAM,EAAE,CAAC,8CAA8C,CAAC;IACxD,WAAW,EACT,iIAAiI;CACpI,CAAC;AAEW,QAAA,qBAAqB,GAAG,gBAAgB,CAAC;AACzC,QAAA,wBAAwB,GAAG,GAAG,kBAAU,EAAE,CAAC;AAE3C,QAAA,kBAAkB,GAAG,IAAI,mBAAS,CAC7C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,8CAA8C,CAAC"}
@@ -20,6 +20,7 @@ const constants_1 = require("./constants");
20
20
  const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
21
21
  const solana_1 = require("../../utils/solana");
22
22
  const clients_1 = require("../../utils/clients");
23
+ const structs_1 = require("./structs");
23
24
  const getPositionPublicKey = (ei) => {
24
25
  const [vaultParamsPDA] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('vault_params', 'utf-8'), ei.toBuffer()], constants_1.restakingProgramId);
25
26
  return vaultParamsPDA;
@@ -30,22 +31,24 @@ exports.isPicassoPosition = isPicassoPosition;
30
31
  function getPicassoElementsFromNFTs(cache, nfts) {
31
32
  return __awaiter(this, void 0, void 0, function* () {
32
33
  const connection = (0, clients_1.getClientSolana)();
33
- const vaults = yield (0, solana_1.getAutoParsedMultipleAccountsInfo)(connection, constants_1.restakingIdlItem, nfts.map((asset) => (0, exports.getPositionPublicKey)(new web3_js_1.PublicKey(asset.data.address))));
34
+ const vaults = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.vaultStruct, nfts.map((asset) => (0, exports.getPositionPublicKey)(new web3_js_1.PublicKey(asset.data.address))));
34
35
  const heliusAssetsPositions = nfts.filter((item, i) => vaults[i]);
35
36
  if (heliusAssetsPositions.length === 0)
36
37
  return [];
37
38
  const tokenMints = [
38
- ...new Set(heliusAssetsPositions.map((item, i) => { var _a; return (_a = vaults[i]) === null || _a === void 0 ? void 0 : _a.stakeMint; }).flat()),
39
+ ...new Set(heliusAssetsPositions
40
+ .map((item, i) => { var _a; return (_a = vaults[i]) === null || _a === void 0 ? void 0 : _a.stakeMint.toString(); })
41
+ .flat()),
39
42
  ].filter((s) => s !== null);
40
43
  const tokenPrices = yield cache.getTokenPricesAsMap(tokenMints, portfolio_core_1.NetworkId.solana);
41
44
  const assets = [];
42
45
  heliusAssetsPositions.forEach((item, i) => {
43
46
  const vault = vaults[i];
44
47
  if (vault) {
45
- const tokenPrice = tokenPrices.get(vault.stakeMint);
48
+ const tokenPrice = tokenPrices.get(vault.stakeMint.toString());
46
49
  if (!tokenPrice)
47
50
  return;
48
- assets.push((0, tokenPriceToAssetToken_1.default)(vault.stakeMint, new bignumber_js_1.default(vault.stakeAmount)
51
+ assets.push((0, tokenPriceToAssetToken_1.default)(vault.stakeMint.toString(), new bignumber_js_1.default(vault.stakeAmount)
49
52
  .dividedBy(Math.pow(10, tokenPrice.decimals))
50
53
  .toNumber(), portfolio_core_1.NetworkId.solana, tokenPrice));
51
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/picasso/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA4C;AAC5C,+DAQoC;AACpC,gEAAqC;AAErC,2CAA+E;AAC/E,qGAA6E;AAC7E,+CAAuE;AAEvE,iDAAsD;AAE/C,MAAM,oBAAoB,GAAG,C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AC,CAAC,CAAC,KAAK,CAAC,CAAC;YACjD,IAAI,EAAE;gBACJ,MAAM;aACP;SACF,CAAC;QACF,OAAO,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;CAAA;AA9DD,gEA8DC"}
@@ -0,0 +1,39 @@
1
+ /// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
3
+ import { PublicKey } from '@solana/web3.js';
4
+ import BigNumber from 'bignumber.js';
5
+ import { BeetStruct, DataEnumKeyAsKind, FixableBeetStruct, COption } from '@metaplex-foundation/beet';
6
+ type ServiceRecord = {
7
+ GuestChain: {
8
+ validator: PublicKey;
9
+ };
10
+ };
11
+ type Service = DataEnumKeyAsKind<ServiceRecord>;
12
+ export type WithdrawalRequestParams = {
13
+ timestampInSec: BigNumber;
14
+ owner: PublicKey;
15
+ tokenAccount: PublicKey;
16
+ };
17
+ export declare const withdrawalRequestParamsStruct: BeetStruct<WithdrawalRequestParams, Partial<WithdrawalRequestParams>>;
18
+ export type Vault = {
19
+ accountDiscriminator: number[];
20
+ stakeTimestampSec: BigNumber;
21
+ service: COption<Service>;
22
+ stakeAmount: BigNumber;
23
+ stakeMint: PublicKey;
24
+ lastReceivedRewardsHeight: BigNumber;
25
+ withdrawalRequest: COption<WithdrawalRequestParams>;
26
+ };
27
+ export declare const vaultStruct: FixableBeetStruct<Vault, Partial<Vault>>;
28
+ export type StakingParams = {
29
+ accountDiscriminator: number[];
30
+ admin: PublicKey;
31
+ whitelistedTokens: PublicKey[];
32
+ guestChainProgramId?: PublicKey;
33
+ rewardsTokenMint: PublicKey;
34
+ stakingCap: BigNumber;
35
+ totalDepositedAmount: BigNumber;
36
+ newAdminProposal?: PublicKey;
37
+ };
38
+ export declare const stakingParamsStruct: BeetStruct<StakingParams, Partial<StakingParams>>;
39
+ export {};
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stakingParamsStruct = exports.vaultStruct = exports.withdrawalRequestParamsStruct = void 0;
4
+ const beet_1 = require("@metaplex-foundation/beet");
5
+ const beet_solana_1 = require("@metaplex-foundation/beet-solana");
6
+ const solana_1 = require("../../utils/solana");
7
+ const serviceStruct = (0, beet_1.dataEnum)([
8
+ [
9
+ 'GuestChain',
10
+ new beet_1.FixableBeetArgsStruct([['validator', beet_solana_1.publicKey]], 'ServiceRecord["GuestChain"]'),
11
+ ],
12
+ ]);
13
+ exports.withdrawalRequestParamsStruct = new beet_1.BeetStruct([
14
+ ['timestampInSec', solana_1.u64],
15
+ ['owner', beet_solana_1.publicKey],
16
+ ['tokenAccount', beet_solana_1.publicKey],
17
+ ], (args) => args);
18
+ exports.vaultStruct = new beet_1.FixableBeetStruct([
19
+ ['accountDiscriminator', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 8)],
20
+ ['stakeTimestampSec', solana_1.i64],
21
+ ['service', (0, beet_1.coption)(serviceStruct)],
22
+ ['stakeAmount', solana_1.u64],
23
+ ['stakeMint', beet_solana_1.publicKey],
24
+ ['lastReceivedRewardsHeight', solana_1.u64],
25
+ ['withdrawalRequest', (0, beet_1.coption)(exports.withdrawalRequestParamsStruct)],
26
+ ], (args) => args);
27
+ exports.stakingParamsStruct = new beet_1.BeetStruct([
28
+ ['accountDiscriminator', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 8)],
29
+ ['admin', beet_solana_1.publicKey],
30
+ ['whitelistedTokens', (0, beet_1.uniformFixedSizeArray)(beet_solana_1.publicKey, 10)], // Adjust size if needed
31
+ ['guestChainProgramId', beet_solana_1.publicKey],
32
+ ['rewardsTokenMint', beet_solana_1.publicKey],
33
+ ['stakingCap', solana_1.u128],
34
+ ['totalDepositedAmount', solana_1.u128],
35
+ ['newAdminProposal', beet_solana_1.publicKey],
36
+ ], (args) => args);
37
+ //# sourceMappingURL=structs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/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C;IAClC,CAAC,kBAAkB,EAAE,uBAAS,CAAC;IAC/B,CAAC,YAAY,EAAE,aAAI,CAAC;IACpB,CAAC,sBAAsB,EAAE,aAAI,CAAC;IAC9B,CAAC,kBAAkB,EAAE,uBAAS,CAAC;CAChC,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAqB,CAChC,CAAC"}
@@ -21,6 +21,7 @@ const heliusAssetToAssetCollectible_1 = require("../../utils/solana/das/heliusAs
21
21
  const clients_1 = require("../../utils/clients");
22
22
  const solana_1 = require("../../utils/solana");
23
23
  const helpers_1 = require("./helpers");
24
+ const structs_1 = require("./structs");
24
25
  const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
25
26
  var _a;
26
27
  const dasEndpoint = (0, getSolanaDasEndpoint_1.default)();
@@ -45,7 +46,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
45
46
  nfts.push(nft);
46
47
  }
47
48
  const connection = (0, clients_1.getClientSolana)();
48
- const vaults = yield (0, solana_1.getAutoParsedMultipleAccountsInfo)(connection, constants_1.restakingIdlItem, nfts.map((asset) => (0, helpers_1.getPositionPublicKey)(new web3_js_1.PublicKey(asset.data.address)))).then((vs) => vs.filter((v) => v !== null));
49
+ const vaults = yield (0, solana_1.getParsedMultipleAccountsInfo)(connection, structs_1.vaultStruct, nfts.map((asset) => (0, helpers_1.getPositionPublicKey)(new web3_js_1.PublicKey(asset.data.address)))).then((vs) => vs.filter((v) => v !== null));
49
50
  yield cache.setItem(constants_1.unstakingNftsCacheKey, vaults, {
50
51
  prefix: constants_1.unstakingNftsCachePrefix,
51
52
  networkId: portfolio_core_1.NetworkId.solana,
@@ -1 +1 @@
1
- {"version":3,"file":"unstakingNftsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/picasso/unstakingNftsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAGoC;AACpC,6CAA4C;AAG5C,2CAMqB;AACrB,oGAA4E;AAE5E,oFAAiF;A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,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;IAE7C,MAAM,KAAK,CAAC,OAAO,CAAC,iCAAqB,EAAE,MAAM,EAAE;QACjD,MAAM,EAAE,oCAAwB;QAChC,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,iBAAiB;IAClC,QAAQ;IACR,MAAM,EAAE,CAAC,QAAQ,CAAC;CACnB,CAAC;AACF,kBAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"unstakingNftsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/picasso/unstakingNftsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAGoC;AACpC,6CAA4C;AAG5C,2CAKqB;AACrB,oGAA4E;AAE5E,oFAAiF;AACjF,wGAAqG;AACrG,iDAAsD;AACtD,+CAAmE;AACnE,uCAAoE;AACpE,uCAAwC;AAExC,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;;IACnD,MAAM,WAAW,GAAG,IAAA,8BAAoB,GAAE,CAAC;IAC3C,MAAM,cAAc,GAAmB;QACrC,sBAAsB,EAAE,IAAI;QAC5B,yBAAyB,EAAE,IAAI;QAC/B,eAAe,EAAE,KAAK;QACtB,iBAAiB,EAAE,KAAK;QACxB,cAAc,EAAE,KAAK;QACrB,YAAY,EAAE,IAAI;KACnB,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,IAAA,yCAAmB,EACtC,WAAW,EACX,0BAAc,EACd,cAAc,CACf,CAAC;IAEF,MAAM,IAAI,GAAgC,EAAE,CAAC;IAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,MAA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