@sonarwatch/portfolio-plugins 0.11.149 → 0.11.151

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. package/CHANGELOG.md +1331 -1323
  2. package/README.md +3 -3
  3. package/package.json +2 -2
  4. package/src/index.js +8 -12
  5. package/src/index.js.map +1 -1
  6. package/src/plugins/armada-staking/constants.js.map +1 -0
  7. package/src/plugins/armada-staking/filters.js.map +1 -0
  8. package/src/plugins/{spl-staking → armada-staking}/index.js +7 -1
  9. package/src/plugins/armada-staking/index.js.map +1 -0
  10. package/src/plugins/armada-staking/poolsJob.js.map +1 -0
  11. package/src/plugins/armada-staking/stakingFetcher.js.map +1 -0
  12. package/src/plugins/armada-staking/structs.js.map +1 -0
  13. package/src/plugins/armada-staking/types.js.map +1 -0
  14. package/src/plugins/balancer/helpers/pools.js +21 -21
  15. package/src/plugins/{realms → daos}/constants.d.ts +4 -2
  16. package/src/plugins/{realms → daos}/constants.js +10 -3
  17. package/src/plugins/daos/constants.js.map +1 -0
  18. package/src/plugins/daos/filters.js.map +1 -0
  19. package/src/plugins/daos/helpers.d.ts +10 -0
  20. package/src/plugins/{realms → daos}/helpers.js +21 -29
  21. package/src/plugins/daos/helpers.js.map +1 -0
  22. package/src/plugins/daos/index.js +13 -0
  23. package/src/plugins/daos/index.js.map +1 -0
  24. package/src/plugins/{realms/depositsFetcher.js → daos/realmsDepositsFetcher.js} +1 -1
  25. package/src/plugins/daos/realmsDepositsFetcher.js.map +1 -0
  26. package/src/plugins/{realms/programsJob.js → daos/realmsProgramsJob.js} +4 -4
  27. package/src/plugins/daos/realmsProgramsJob.js.map +1 -0
  28. package/src/plugins/daos/structs/realms.js.map +1 -0
  29. package/src/plugins/{realms → daos}/types.d.ts +1 -1
  30. package/src/plugins/daos/types.js.map +1 -0
  31. package/src/plugins/flexlend/depositsFetcher.js +63 -4
  32. package/src/plugins/flexlend/depositsFetcher.js.map +1 -1
  33. package/src/plugins/flexlend/struct.d.ts +18 -0
  34. package/src/plugins/flexlend/struct.js +18 -0
  35. package/src/plugins/flexlend/struct.js.map +1 -0
  36. package/src/plugins/hawksight/positionsFetcher.js +31 -13
  37. package/src/plugins/hawksight/positionsFetcher.js.map +1 -1
  38. package/src/plugins/meteora/poolsJob.js +25 -3
  39. package/src/plugins/meteora/poolsJob.js.map +1 -1
  40. package/src/plugins/orca/getWhirlpoolPositions.d.ts +2 -3
  41. package/src/plugins/orca/getWhirlpoolPositions.js +2 -14
  42. package/src/plugins/orca/getWhirlpoolPositions.js.map +1 -1
  43. package/src/plugins/orca/helpers.d.ts +2 -2
  44. package/src/plugins/orca/helpers.js +1 -1
  45. package/src/plugins/orca/helpers.js.map +1 -1
  46. package/src/plugins/raydium/getRaydiumCLMMPositions.d.ts +2 -3
  47. package/src/plugins/raydium/getRaydiumCLMMPositions.js +3 -3
  48. package/src/plugins/raydium/getRaydiumCLMMPositions.js.map +1 -1
  49. package/src/plugins/raydium/helpers.d.ts +2 -2
  50. package/src/plugins/raydium/helpers.js +6 -1
  51. package/src/plugins/raydium/helpers.js.map +1 -1
  52. package/src/plugins/solend/constants.d.ts +1 -0
  53. package/src/plugins/solend/constants.js +2 -1
  54. package/src/plugins/solend/constants.js.map +1 -1
  55. package/src/plugins/solend/helpers.d.ts +6 -0
  56. package/src/plugins/solend/helpers.js +132 -1
  57. package/src/plugins/solend/helpers.js.map +1 -1
  58. package/src/plugins/solend/marketsJob.js +6 -0
  59. package/src/plugins/solend/marketsJob.js.map +1 -1
  60. package/src/plugins/solend/obligationsFetcher.js +27 -156
  61. package/src/plugins/solend/obligationsFetcher.js.map +1 -1
  62. package/src/plugins/solend/reservesJob.js +15 -6
  63. package/src/plugins/solend/reservesJob.js.map +1 -1
  64. package/src/plugins/solend/types.d.ts +1 -1
  65. package/src/plugins/suilend/obligationsFetcher.js +2 -0
  66. package/src/plugins/suilend/obligationsFetcher.js.map +1 -1
  67. package/src/plugins/sushiswap/helpers.js +24 -24
  68. package/src/plugins/tokens/fetchers/solana-nfts-underlyings.js +26 -15
  69. package/src/plugins/tokens/fetchers/solana-nfts-underlyings.js.map +1 -1
  70. package/src/plugins/tokens/fetchers/solana.js +3 -1
  71. package/src/plugins/tokens/fetchers/solana.js.map +1 -1
  72. package/src/plugins/uniswap-v2/helpers.js +22 -22
  73. package/src/utils/sei/constants.js +8 -8
  74. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
  75. package/src/utils/solana/das/getAssetsByOwnerDas.d.ts +2 -2
  76. package/src/utils/solana/das/getAssetsByOwnerDas.js +3 -9
  77. package/src/utils/solana/das/getAssetsByOwnerDas.js.map +1 -1
  78. package/src/utils/solana/das/getDisplayOptions.d.ts +2 -0
  79. package/src/utils/solana/das/getDisplayOptions.js +16 -0
  80. package/src/utils/solana/das/getDisplayOptions.js.map +1 -0
  81. package/src/utils/solana/das/types.d.ts +8 -0
  82. package/src/plugins/phoenix/constants.d.ts +0 -7
  83. package/src/plugins/phoenix/constants.js +0 -17
  84. package/src/plugins/phoenix/constants.js.map +0 -1
  85. package/src/plugins/phoenix/helpers.d.ts +0 -6
  86. package/src/plugins/phoenix/helpers.js +0 -46
  87. package/src/plugins/phoenix/helpers.js.map +0 -1
  88. package/src/plugins/phoenix/helpers2.d.ts +0 -0
  89. package/src/plugins/phoenix/helpers2.js +0 -179
  90. package/src/plugins/phoenix/helpers2.js.map +0 -1
  91. package/src/plugins/phoenix/index.js +0 -10
  92. package/src/plugins/phoenix/index.js.map +0 -1
  93. package/src/plugins/phoenix/marketsJob.js +0 -39
  94. package/src/plugins/phoenix/marketsJob.js.map +0 -1
  95. package/src/plugins/phoenix/positionsFetcher.js +0 -64
  96. package/src/plugins/phoenix/positionsFetcher.js.map +0 -1
  97. package/src/plugins/phoenix/structs.d.ts +0 -67
  98. package/src/plugins/phoenix/structs.js +0 -82
  99. package/src/plugins/phoenix/structs.js.map +0 -1
  100. package/src/plugins/phoenix/types.d.ts +0 -29
  101. package/src/plugins/phoenix/types.js.map +0 -1
  102. package/src/plugins/realms/constants.js.map +0 -1
  103. package/src/plugins/realms/depositsFetcher.d.ts +0 -3
  104. package/src/plugins/realms/depositsFetcher.js.map +0 -1
  105. package/src/plugins/realms/filters.js.map +0 -1
  106. package/src/plugins/realms/helpers.d.ts +0 -11
  107. package/src/plugins/realms/helpers.js.map +0 -1
  108. package/src/plugins/realms/index.js +0 -13
  109. package/src/plugins/realms/index.js.map +0 -1
  110. package/src/plugins/realms/programsJob.d.ts +0 -3
  111. package/src/plugins/realms/programsJob.js.map +0 -1
  112. package/src/plugins/realms/structs/realms.js.map +0 -1
  113. package/src/plugins/realms/types.js.map +0 -1
  114. package/src/plugins/spl-staking/constants.js.map +0 -1
  115. package/src/plugins/spl-staking/filters.js.map +0 -1
  116. package/src/plugins/spl-staking/index.d.ts +0 -6
  117. package/src/plugins/spl-staking/index.js.map +0 -1
  118. package/src/plugins/spl-staking/poolsJob.js.map +0 -1
  119. package/src/plugins/spl-staking/stakingFetcher.js.map +0 -1
  120. package/src/plugins/spl-staking/structs.js.map +0 -1
  121. package/src/plugins/spl-staking/types.js +0 -3
  122. package/src/plugins/spl-staking/types.js.map +0 -1
  123. /package/src/plugins/{spl-staking → armada-staking}/constants.d.ts +0 -0
  124. /package/src/plugins/{spl-staking → armada-staking}/constants.js +0 -0
  125. /package/src/plugins/{spl-staking → armada-staking}/filters.d.ts +0 -0
  126. /package/src/plugins/{spl-staking → armada-staking}/filters.js +0 -0
  127. /package/src/plugins/{phoenix → armada-staking}/index.d.ts +0 -0
  128. /package/src/plugins/{spl-staking → armada-staking}/poolsJob.d.ts +0 -0
  129. /package/src/plugins/{spl-staking → armada-staking}/poolsJob.js +0 -0
  130. /package/src/plugins/{spl-staking → armada-staking}/stakingFetcher.d.ts +0 -0
  131. /package/src/plugins/{spl-staking → armada-staking}/stakingFetcher.js +0 -0
  132. /package/src/plugins/{spl-staking → armada-staking}/structs.d.ts +0 -0
  133. /package/src/plugins/{spl-staking → armada-staking}/structs.js +0 -0
  134. /package/src/plugins/{spl-staking → armada-staking}/types.d.ts +0 -0
  135. /package/src/plugins/{phoenix → armada-staking}/types.js +0 -0
  136. /package/src/plugins/{realms → daos}/filters.d.ts +0 -0
  137. /package/src/plugins/{realms → daos}/filters.js +0 -0
  138. /package/src/plugins/{realms → daos}/index.d.ts +0 -0
  139. /package/src/plugins/{phoenix/positionsFetcher.d.ts → daos/realmsDepositsFetcher.d.ts} +0 -0
  140. /package/src/plugins/{phoenix/marketsJob.d.ts → daos/realmsProgramsJob.d.ts} +0 -0
  141. /package/src/plugins/{realms → daos}/structs/realms.d.ts +0 -0
  142. /package/src/plugins/{realms → daos}/structs/realms.js +0 -0
  143. /package/src/plugins/{realms → daos}/types.js +0 -0
@@ -1,8 +1,17 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseDataflat = exports.getObligationSeed = exports.upperFirst = void 0;
6
+ exports.getElementsFromObligations = exports.parseDataflat = exports.getObligationSeed = exports.upperFirst = void 0;
4
7
  const beet_1 = require("@metaplex-foundation/beet");
8
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
9
+ const web3_js_1 = require("@solana/web3.js");
10
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
5
11
  const structs_1 = require("./structs");
12
+ const constants_1 = require("./constants");
13
+ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
14
+ const helpers_1 = require("../../utils/solana/pyth/helpers");
6
15
  const upperFirst = (string) => string ? string.charAt(0).toUpperCase() + string.slice(1) : '';
7
16
  exports.upperFirst = upperFirst;
8
17
  function getObligationSeed(marketAddress, accountId) {
@@ -27,4 +36,126 @@ const parseDataflat = (dataFlat, depositsLen, borrowsLen) => {
27
36
  };
28
37
  };
29
38
  exports.parseDataflat = parseDataflat;
39
+ function getElementsFromObligations(obligations, reserveByAddress, marketByAddress, tokenPriceByAddress, pythAccountByAddress) {
40
+ const elements = [];
41
+ for (let i = 0; i < obligations.length; i += 1) {
42
+ const obligation = obligations[i];
43
+ if (!obligation)
44
+ continue;
45
+ const market = marketByAddress.get(obligation.lendingMarket.toString());
46
+ if (!market)
47
+ continue;
48
+ const { depositsMap, borrowsMap } = (0, exports.parseDataflat)(obligation.dataFlat, obligation.depositsLen, obligation.borrowsLen);
49
+ if (depositsMap.size === 0 && borrowsMap.size === 0)
50
+ continue;
51
+ const borrowedAssets = [];
52
+ const borrowedYields = [];
53
+ const suppliedAssets = [];
54
+ const suppliedYields = [];
55
+ const rewardAssets = [];
56
+ const suppliedLtvs = [];
57
+ const borrowedWeights = [];
58
+ for (let j = 0; j < market.reserves.length; j += 1) {
59
+ const { address: reserveAddress } = market.reserves[j];
60
+ const reserveInfo = reserveByAddress.get(reserveAddress);
61
+ if (!reserveInfo)
62
+ continue;
63
+ const { reserve } = reserveInfo;
64
+ const { liquidity, collateral } = reserve;
65
+ const lMint = liquidity.mintPubkey;
66
+ const lTokenPrice = tokenPriceByAddress.get(lMint);
67
+ let price;
68
+ if (!lTokenPrice) {
69
+ const pythOracle = new web3_js_1.PublicKey(reserve.liquidity.pythOracle);
70
+ const pythAccount = pythAccountByAddress.get(pythOracle.toString());
71
+ const pythPrice = pythAccount
72
+ ? (0, helpers_1.parsePriceData)(pythAccount.data)
73
+ : undefined;
74
+ if (pythPrice)
75
+ price = pythPrice.price;
76
+ }
77
+ const decimals = liquidity.mintDecimals;
78
+ const reserveBorrowAmount = new bignumber_js_1.default(liquidity.borrowedAmountWads)
79
+ .dividedBy(Math.pow(10, (constants_1.wadsDecimal + decimals)))
80
+ .toNumber();
81
+ const reserveAvailableAmount = new bignumber_js_1.default(liquidity.availableAmount)
82
+ .dividedBy(Math.pow(10, decimals))
83
+ .toNumber();
84
+ const collateralSupply = new bignumber_js_1.default(collateral.mintTotalSupply)
85
+ .dividedBy(Math.pow(10, decimals))
86
+ .toNumber();
87
+ const reserveDepositAmount = reserveBorrowAmount + reserveAvailableAmount;
88
+ // Deposit
89
+ const deposit = depositsMap.get(reserveAddress);
90
+ if (deposit) {
91
+ if (!deposit.depositedAmount.isZero()) {
92
+ const suppliedAmount = deposit.depositedAmount
93
+ .div(Math.pow(10, decimals))
94
+ .times(reserveDepositAmount / collateralSupply)
95
+ .toNumber();
96
+ suppliedLtvs.push(reserve.config.liquidationThreshold / 100);
97
+ const apy = +reserveInfo.rates.supplyInterest / 100;
98
+ const cSuppliedYields = [
99
+ {
100
+ apr: (0, portfolio_core_1.apyToApr)(apy),
101
+ apy,
102
+ },
103
+ ];
104
+ suppliedYields.push(cSuppliedYields);
105
+ suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(lMint, suppliedAmount, portfolio_core_1.NetworkId.solana, lTokenPrice, price));
106
+ }
107
+ }
108
+ // Borrow
109
+ const borrow = borrowsMap.get(reserveAddress);
110
+ if (borrow) {
111
+ if (!borrow.borrowedAmountWads.isZero()) {
112
+ const borrowedAmount = borrow.borrowedAmountWads
113
+ .times(new bignumber_js_1.default(liquidity.cumulativeBorrowRateWads))
114
+ .div(borrow.cumulativeBorrowRateWads)
115
+ .dividedBy(new bignumber_js_1.default(Math.pow(10, (constants_1.wadsDecimal + decimals))))
116
+ .toNumber();
117
+ borrowedWeights.push(new bignumber_js_1.default(reserve.config.addedBorrowWeightBPS)
118
+ .dividedBy(Math.pow(10, 4))
119
+ .plus(1)
120
+ .toNumber());
121
+ const apy = +reserveInfo.rates.borrowInterest / 100;
122
+ const cBorrowedYields = [
123
+ {
124
+ apr: -(0, portfolio_core_1.apyToApr)(apy),
125
+ apy: -apy,
126
+ },
127
+ ];
128
+ borrowedYields.push(cBorrowedYields);
129
+ borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(lMint, borrowedAmount, portfolio_core_1.NetworkId.solana, lTokenPrice, price));
130
+ }
131
+ }
132
+ }
133
+ if (suppliedAssets.length === 0 && borrowedAssets.length === 0)
134
+ continue;
135
+ const { borrowedValue, suppliedValue, value, healthRatio, rewardValue } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets, suppliedLtvs, borrowedWeights);
136
+ elements.push({
137
+ type: portfolio_core_1.PortfolioElementType.borrowlend,
138
+ networkId: portfolio_core_1.NetworkId.solana,
139
+ platformId: constants_1.platformId,
140
+ label: 'Lending',
141
+ value,
142
+ name: market.name,
143
+ data: {
144
+ borrowedAssets,
145
+ borrowedValue,
146
+ borrowedYields,
147
+ suppliedAssets,
148
+ suppliedValue,
149
+ suppliedYields,
150
+ collateralRatio: null,
151
+ healthRatio,
152
+ rewardAssets,
153
+ rewardValue,
154
+ value,
155
+ },
156
+ });
157
+ }
158
+ return elements;
159
+ }
160
+ exports.getElementsFromObligations = getElementsFromObligations;
30
161
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/helpers.ts"],"names":[],"mappings":";;;AAAA,oDAAkE;AAClE,uCAGmB;AAEZ,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,EAAE,CAC3C,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AADpD,QAAA,UAAU,cAC0C;AAEjE,SAAgB,iBAAiB,CAAC,aAAqB,EAAE,SAAiB;IACxE,IAAI,SAAS,KAAK,CAAC;QAAE,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACvD,2EAA2E;IAC3E,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,UAAU,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACtE,CAAC;AAJD,8CAIC;AAEM,MAAM,aAAa,GAAG,CAC3B,QAAgB,EAChB,WAAmB,EACnB,U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E,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,eAAe,EAAE,IAAI;gBAErB,WAAW;gBACX,YAAY;gBACZ,WAAW;gBACX,KAAK;aACN;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AApKD,gEAoKC"}
@@ -19,12 +19,18 @@ const helpers_1 = require("./helpers");
19
19
  const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
20
20
  const marketsInfoRes = yield axios_1.default.get(constants_1.marketsEndpoint);
21
21
  const marketsInfo = marketsInfoRes.data;
22
+ const marketsEnhanced = [];
22
23
  for (const marketInfo of marketsInfo) {
24
+ marketsEnhanced.push(Object.assign(Object.assign({}, marketInfo), { name: (0, helpers_1.upperFirst)(marketInfo.name) }));
23
25
  yield cache.setItem(marketInfo.address, Object.assign(Object.assign({}, marketInfo), { name: (0, helpers_1.upperFirst)(marketInfo.name) }), {
24
26
  prefix: constants_1.marketsPrefix,
25
27
  networkId: portfolio_core_1.NetworkId.solana,
26
28
  });
27
29
  }
30
+ yield cache.setItem(constants_1.marketsKey, marketsEnhanced, {
31
+ prefix: constants_1.solendPlatform.id,
32
+ networkId: portfolio_core_1.NetworkId.solana,
33
+ });
28
34
  });
29
35
  const job = {
30
36
  id: `${constants_1.platformId}-markets`,
@@ -1 +1 @@
1
- {"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA6C;AAC7C,2CAIqB;AAErB,uCAAuC;AAIvC,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,cAAc,GAAgC,MAAM,eAAK,CAAC,GAAG,CACjE,2BAAe,CAChB,CAAC;IACF,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC;IACxC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,MAAM,KAAK,CAAC,OAAO,CACjB,UAAU,CAAC,OAAO,kCAEb,UAAU,KACb,IAAI,EAAE,IAAA,oBAAU,EAAC,UAAU,CAAC,IAAI,CAAC,KAEnC;YACE,MAAM,EAAN,yBAAM;YACN,SAAS,EAAE,0BAAS,CAAC,MAAM;SAC5B,CACF,CAAC;IACJ,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA6C;AAC7C,2CAMqB;AAErB,uCAAuC;AAIvC,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,cAAc,GAAgC,MAAM,eAAK,CAAC,GAAG,CACjE,2BAAe,CAChB,CAAC;IACF,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC;IACxC,MAAM,eAAe,GAAiB,EAAE,CAAC;IACzC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,eAAe,CAAC,IAAI,iCACf,UAAU,KACb,IAAI,EAAE,IAAA,oBAAU,EAAC,UAAU,CAAC,IAAI,CAAC,IACjC,CAAC;QACH,MAAM,KAAK,CAAC,OAAO,CACjB,UAAU,CAAC,OAAO,kCAEb,UAAU,KACb,IAAI,EAAE,IAAA,oBAAU,EAAC,UAAU,CAAC,IAAI,CAAC,KAEnC;YACE,MAAM,EAAN,yBAAM;YACN,SAAS,EAAE,0BAAS,CAAC,MAAM;SAC5B,CACF,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,CAAC,OAAO,CAAC,sBAAU,EAAE,eAAe,EAAE;QAC/C,MAAM,EAAE,0BAAc,CAAC,EAAE;QACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
@@ -8,39 +8,32 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
- const bignumber_js_1 = __importDefault(require("bignumber.js"));
17
13
  const web3_js_1 = require("@solana/web3.js");
18
14
  const constants_1 = require("./constants");
19
15
  const helpers_1 = require("./helpers");
20
16
  const solana_1 = require("../../utils/solana");
21
17
  const clients_1 = require("../../utils/clients");
22
18
  const structs_1 = require("./structs");
23
- const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
24
- const runInBatch_1 = __importDefault(require("../../utils/misc/runInBatch"));
25
- const constants_2 = require("../flexlend/constants");
26
- const helpers_2 = require("../../utils/solana/pyth/helpers");
19
+ const getMultipleAccountsInfoSafe_1 = require("../../utils/solana/getMultipleAccountsInfoSafe");
27
20
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
28
21
  const client = (0, clients_1.getClientSolana)();
29
22
  const obligationAddresses = [];
30
- const markets = yield cache.getAllItems({
31
- prefix: constants_1.marketsPrefix,
23
+ const markets = yield cache.getItem(constants_1.marketsKey, {
24
+ prefix: constants_1.platformId,
32
25
  networkId: portfolio_core_1.NetworkId.solana,
33
26
  });
34
- if (markets.length === 0)
27
+ if (!markets)
35
28
  return [];
36
29
  const marketsByAddress = new Map();
37
30
  markets.forEach((market) => {
38
31
  if (market)
39
32
  marketsByAddress.set(market.address.toString(), market);
40
33
  });
41
- for (const marketInfo of markets) {
34
+ yield marketsByAddress.forEach((marketInfo) => __awaiter(void 0, void 0, void 0, function* () {
42
35
  if (!marketInfo)
43
- continue;
36
+ return;
44
37
  const seeds = [
45
38
  (0, helpers_1.getObligationSeed)(marketInfo.address, 0),
46
39
  (0, helpers_1.getObligationSeed)(marketInfo.address, 1),
@@ -51,28 +44,25 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
51
44
  const obligationAddress = yield web3_js_1.PublicKey.createWithSeed(new web3_js_1.PublicKey(owner), seed, constants_1.pid);
52
45
  obligationAddresses.push(obligationAddress);
53
46
  }
54
- }
55
- // Flexlend, only support the main pool on Solend
56
- const marketSeed = constants_1.mainMarket.slice(0, 16);
57
- const ownerSeed = owner.slice(0, 16);
58
- const obligationSeed = ownerSeed + marketSeed;
59
- const oldFlexlendObligAddress = yield web3_js_1.PublicKey.createWithSeed(constants_2.AUTOMATION_PUBLIC_KEY, obligationSeed, constants_1.pid);
60
- const newFlexlendObligAddress = yield web3_js_1.PublicKey.createWithSeed(new web3_js_1.PublicKey(owner), obligationSeed, constants_1.pid);
61
- obligationAddresses.push(...[oldFlexlendObligAddress, newFlexlendObligAddress]);
62
- const obligations = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.obligationStruct, obligationAddresses);
63
- if (obligations.length === 0)
47
+ }));
48
+ const obligationsRaw = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.obligationStruct, obligationAddresses);
49
+ if (obligationsRaw.length === 0)
64
50
  return [];
51
+ const obligations = [];
65
52
  const reserveAddresses = new Set();
66
- obligations.forEach((obligation) => {
53
+ obligationsRaw.forEach((obligation) => {
67
54
  if (!obligation)
68
55
  return;
69
56
  const market = marketsByAddress.get(obligation.lendingMarket.toString());
70
57
  if (!market)
71
58
  return;
59
+ obligations.push(obligation);
72
60
  market.reserves.forEach((reserve) => {
73
61
  reserveAddresses.add(reserve.address);
74
62
  });
75
63
  });
64
+ if (obligations.length === 0)
65
+ return [];
76
66
  const reservesInfos = yield cache.getItems(Array.from(reserveAddresses), {
77
67
  prefix: constants_1.reservesPrefix,
78
68
  networkId: portfolio_core_1.NetworkId.solana,
@@ -80,144 +70,25 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
80
70
  if (!reservesInfos)
81
71
  return [];
82
72
  const reserveByAddress = new Map();
83
- reservesInfos.forEach((reserve) => {
84
- if (!reserve)
85
- return;
86
- reserveByAddress.set(reserve.pubkey, reserve);
87
- });
88
- const tokensAddresses = new Set();
73
+ const mints = new Set();
74
+ const pythAddresses = [];
89
75
  reservesInfos.forEach((reserveInfo) => {
90
76
  if (!reserveInfo)
91
77
  return;
92
- tokensAddresses.add(reserveInfo.reserve.liquidity.mintPubkey);
93
- });
94
- const tokenPriceResults = yield (0, runInBatch_1.default)([...tokensAddresses].map((mint) => () => cache.getTokenPrice(mint, portfolio_core_1.NetworkId.solana)));
95
- const tokenPrices = new Map();
96
- tokenPriceResults.forEach((r) => {
97
- if (r.status === 'rejected')
98
- return;
99
- if (!r.value)
100
- return;
101
- tokenPrices.set(r.value.address, r.value);
78
+ mints.add(reserveInfo.reserve.liquidity.mintPubkey);
79
+ reserveByAddress.set(reserveInfo.pubkey, reserveInfo);
80
+ pythAddresses.push(new web3_js_1.PublicKey(reserveInfo.reserve.liquidity.pythOracle));
102
81
  });
103
- const elements = [];
104
- for (let i = 0; i < obligations.length; i += 1) {
105
- const obligation = obligations[i];
106
- if (!obligation)
107
- continue;
108
- const market = marketsByAddress.get(obligation.lendingMarket.toString());
109
- if (!market)
110
- continue;
111
- const { depositsMap, borrowsMap } = (0, helpers_1.parseDataflat)(obligation.dataFlat, obligation.depositsLen, obligation.borrowsLen);
112
- if (depositsMap.size === 0 && borrowsMap.size === 0)
82
+ const tokenPriceByAddress = yield cache.getTokenPricesAsMap(Array.from(mints), portfolio_core_1.NetworkId.solana);
83
+ const pythAccounts = yield (0, getMultipleAccountsInfoSafe_1.getMultipleAccountsInfoSafe)(client, pythAddresses);
84
+ const pythAccByAddress = new Map();
85
+ for (let i = 0; i < pythAddresses.length; i++) {
86
+ const account = pythAccounts[i];
87
+ if (account === null)
113
88
  continue;
114
- const borrowedAssets = [];
115
- const borrowedYields = [];
116
- const suppliedAssets = [];
117
- const suppliedYields = [];
118
- const rewardAssets = [];
119
- const suppliedLtvs = [];
120
- const borrowedWeights = [];
121
- for (let j = 0; j < market.reserves.length; j += 1) {
122
- const { address: reserveAddress } = market.reserves[j];
123
- const reserveInfo = reserveByAddress.get(reserveAddress);
124
- if (!reserveInfo)
125
- continue;
126
- const { reserve } = reserveInfo;
127
- const { liquidity, collateral } = reserve;
128
- const lMint = liquidity.mintPubkey;
129
- const lTokenPrice = tokenPrices.get(lMint);
130
- let price;
131
- if (!lTokenPrice) {
132
- const pythOracle = new web3_js_1.PublicKey(reserve.liquidity.pythOracle);
133
- const pythAccount = yield client.getAccountInfo(pythOracle);
134
- const pythPrice = pythAccount
135
- ? (0, helpers_2.parsePriceData)(pythAccount.data)
136
- : undefined;
137
- if (pythPrice)
138
- price = pythPrice.price;
139
- }
140
- const decimals = liquidity.mintDecimals;
141
- const reserveBorrowAmount = new bignumber_js_1.default(liquidity.borrowedAmountWads)
142
- .dividedBy(Math.pow(10, (constants_1.wadsDecimal + decimals)))
143
- .toNumber();
144
- const reserveAvailableAmount = new bignumber_js_1.default(liquidity.availableAmount)
145
- .dividedBy(Math.pow(10, decimals))
146
- .toNumber();
147
- const collateralSupply = new bignumber_js_1.default(collateral.mintTotalSupply)
148
- .dividedBy(Math.pow(10, decimals))
149
- .toNumber();
150
- const reserveDepositAmount = reserveBorrowAmount + reserveAvailableAmount;
151
- // Deposit
152
- const deposit = depositsMap.get(reserveAddress);
153
- if (deposit) {
154
- if (!deposit.depositedAmount.isZero()) {
155
- const suppliedAmount = deposit.depositedAmount
156
- .div(Math.pow(10, decimals))
157
- .times(reserveDepositAmount / collateralSupply)
158
- .toNumber();
159
- suppliedLtvs.push(reserve.config.liquidationThreshold / 100);
160
- const apy = +reserveInfo.rates.supplyInterest / 100;
161
- const cSuppliedYields = [
162
- {
163
- apr: (0, portfolio_core_1.apyToApr)(apy),
164
- apy,
165
- },
166
- ];
167
- suppliedYields.push(cSuppliedYields);
168
- suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(lMint, suppliedAmount, portfolio_core_1.NetworkId.solana, lTokenPrice, price));
169
- }
170
- }
171
- // Borrow
172
- const borrow = borrowsMap.get(reserveAddress);
173
- if (borrow) {
174
- if (!borrow.borrowedAmountWads.isZero()) {
175
- const borrowedAmount = borrow.borrowedAmountWads
176
- .times(new bignumber_js_1.default(liquidity.cumulativeBorrowRateWads))
177
- .div(borrow.cumulativeBorrowRateWads)
178
- .dividedBy(new bignumber_js_1.default(Math.pow(10, (constants_1.wadsDecimal + decimals))))
179
- .toNumber();
180
- borrowedWeights.push(new bignumber_js_1.default(reserve.config.addedBorrowWeightBPS)
181
- .dividedBy(Math.pow(10, 4))
182
- .plus(1)
183
- .toNumber());
184
- const apy = +reserveInfo.rates.borrowInterest / 100;
185
- const cBorrowedYields = [
186
- {
187
- apr: -(0, portfolio_core_1.apyToApr)(apy),
188
- apy: -apy,
189
- },
190
- ];
191
- borrowedYields.push(cBorrowedYields);
192
- borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(lMint, borrowedAmount, portfolio_core_1.NetworkId.solana, lTokenPrice, price));
193
- }
194
- }
195
- }
196
- if (suppliedAssets.length === 0 && borrowedAssets.length === 0)
197
- continue;
198
- const { borrowedValue, suppliedValue, value, healthRatio, rewardValue } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets, suppliedLtvs, borrowedWeights);
199
- elements.push({
200
- type: portfolio_core_1.PortfolioElementType.borrowlend,
201
- networkId: portfolio_core_1.NetworkId.solana,
202
- platformId: constants_1.platformId,
203
- label: 'Lending',
204
- value,
205
- name: market.name,
206
- data: {
207
- borrowedAssets,
208
- borrowedValue,
209
- borrowedYields,
210
- suppliedAssets,
211
- suppliedValue,
212
- suppliedYields,
213
- collateralRatio: null,
214
- healthRatio,
215
- rewardAssets,
216
- rewardValue,
217
- value,
218
- },
219
- });
89
+ pythAccByAddress.set(pythAddresses[i].toString(), account);
220
90
  }
91
+ const elements = (0, helpers_1.getElementsFromObligations)(obligations, reserveByAddress, marketsByAddress, tokenPriceByAddress, pythAccByAddress);
221
92
  return elements;
222
93
  });
223
94
  const fetcher = {
@@ -1 +1 @@
1
- {"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DASoC;AACpC,gEAAqC;AACrC,6CAA4C;AAG5C,2CAOqB;AACrB,uCAA6D;AAE7D,+CAAmE;AACnE,iDAAsD;AACtD,uCAA6C;AAC7C,qGAA6E;AAC7E,6EAAqD;AACrD,qDAA8D;AAC9D,6DAAiE;AAEjE,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IACjC,MAAM,mBAAmB,GAAG,EAAE,CAAC;IAE/B,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,WAAW,CAAa;QAClD,MAAM,EAAE,yBAAa;QACrB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IACH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACpC,MAAM,gBAAgB,GAA4B,IAAI,GAAG,EAAE,CAAC;IAC5D,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACzB,IAAI,MAAM;YAAE,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,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cAAc,CAAC,IAAI,CACjB,IAAA,gCAAsB,EACpB,KAAK,EACL,cAAc,EACd,0BAAS,CAAC,MAAM,EAChB,WAAW,EACX,KAAK,CACN,CACF,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAEzE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,GACrE,IAAA,wCAAuB,EACrB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,eAAe,CAChB,CAAC;QAEJ,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,qCAAoB,CAAC,UAAU;YACrC,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,SAAS;YAChB,KAAK;YACL,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,eAAe,EAAE,IAAI;gBAErB,WAAW;gBACX,YAAY;gBACZ,WAAW;gBACX,KAAK;aACN;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,cAAc;IAC/B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAyE;AACzE,6CAAyD;AAGzD,2CAA0E;AAC1E,uCAA0E;AAE1E,+CAG4B;AAC5B,iDAAsD;AACtD,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C3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -22,20 +22,29 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
22
22
  });
23
23
  const reservesAddressesByMarket = markets.map((m) => m.reserves.map((r) => r.address));
24
24
  const promises = [];
25
+ const reservesInfosResponses = [];
26
+ const mints = new Set();
25
27
  for (let i = 0; i < reservesAddressesByMarket.length; i += 1) {
26
28
  const reservesAddresses = reservesAddressesByMarket[i];
27
- const poolName = markets[i].name;
28
29
  const reservesInfoRes = yield axios_1.default
29
30
  .get(`${constants_1.reserveEndpoint}${reservesAddresses.join(',')}`)
30
31
  .catch(() => {
31
32
  //
32
33
  });
34
+ reservesInfosResponses.push(reservesInfoRes);
35
+ if (!reservesInfoRes)
36
+ continue;
37
+ reservesInfoRes.data.results.forEach((res) => {
38
+ mints.add(res.reserve.liquidity.mintPubkey);
39
+ });
40
+ }
41
+ const tokenPriceById = yield cache.getTokenPricesAsMap(Array.from(mints), portfolio_core_1.NetworkId.solana);
42
+ for (let i = 0; i < reservesAddressesByMarket.length; i += 1) {
43
+ const reservesAddresses = reservesAddressesByMarket[i];
44
+ const poolName = markets[i].name;
45
+ const reservesInfoRes = reservesInfosResponses[i];
33
46
  if (!reservesInfoRes)
34
47
  continue;
35
- const mints = reservesInfoRes.data.results.map((res) => res.reserve.liquidity.mintPubkey);
36
- const tokensPrices = yield cache.getTokenPrices(mints, portfolio_core_1.NetworkId.solana);
37
- const tokenPriceById = new Map();
38
- tokensPrices.forEach((tokenPrice) => tokenPrice ? tokenPriceById.set(tokenPrice.address, tokenPrice) : []);
39
48
  for (let j = 0; j < reservesInfoRes.data.results.length; j += 1) {
40
49
  const reserveInfo = reservesInfoRes.data.results[j];
41
50
  const reserveAddress = reservesAddresses[j];
@@ -47,7 +56,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
47
56
  const { liquidity, collateral } = reserve;
48
57
  const { mintPubkey } = liquidity;
49
58
  const decimals = liquidity.mintDecimals;
50
- const cTokenExchangeRate = new bignumber_js_1.default(reserve.cTokenExchangeRate);
59
+ const cTokenExchangeRate = new bignumber_js_1.default(reserveInfo.cTokenExchangeRate);
51
60
  const tokenAddress = reserveInfo.reserve.collateral.mintPubkey;
52
61
  const borrowApy = +reserveInfo.rates.borrowInterest / 100;
53
62
  const depositApy = +reserveInfo.rates.supplyInterest / 100;
@@ -1 +1 @@
1
- {"version":3,"file":"reservesJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/reservesJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA6C;AAC7C,+DAMoC;AACpC,gEAAqC;AACrC,2CAMqB;AAKrB,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,WAAW,CAAa;QAClD,MAAM,EAAE,yBAAa;KACtB,CAAC,CAAC;IACH,MAAM,yBAAyB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAClD,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CACjC,CAAC;IAEF,MAAM,QAAQ,GAAG,EAAE,CAAC;IACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,yBAAyB,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7D,MAAM,iBAAiB,GAAG,yBAAyB,CAAC,CAAC,CAAC,CAAC;QACvD,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACjC,MAAM,eAAe,GACnB,MAAM,eAAK;aACR,GAAG,CAAC,GAAG,2BAAe,GAAG,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;aACvD,KAAK,CAAC,GAAG,EAAE;YACV,EAAE;QACJ,CAAC,CAAC,CAAC;QACP,IAAI,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IAAI,YAAY,EAAE,EAAE,IAAI,EAAE;gBACvD,MAAM,EAAE,sCAAqB;gBAC7B,SAAS,EAAE,0BAAS,CAAC,MAAM;aAC5B,CAAC,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IACD,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
@@ -37,6 +37,7 @@ export interface ReserveInfo {
37
37
  reserve: ReserveData;
38
38
  rates: RatesInfo;
39
39
  rewards: RewardInfo[];
40
+ cTokenExchangeRate: string;
40
41
  }
41
42
  export type ReserveInfoExtended = ReserveInfo & {
42
43
  pubkey: string;
@@ -80,7 +81,6 @@ export interface ReserveData {
80
81
  borrowedAmountWads: string;
81
82
  addedBorrowWeightBPS: string;
82
83
  };
83
- cTokenExchangeRate: string;
84
84
  }
85
85
  export interface RatesInfo {
86
86
  supplyInterest: string;
@@ -140,6 +140,8 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
140
140
  for (const userRewardManager of userRewardManagers) {
141
141
  const share = new bignumber_js_1.default(userRewardManager.fields.share);
142
142
  for (const userReward of userRewardManager.fields.rewards) {
143
+ if (!userReward)
144
+ continue;
143
145
  const poolReward = poolRewardById.get(userReward.fields.pool_reward_id);
144
146
  if (!poolReward)
145
147
  continue;
@@ -1 +1 @@
1
- {"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suilend/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAQoC;AACpC,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAmD;AACnD,qEAAkE;AAOlE,qEAAkE;AAClE,qGAA6E;AAC7E,uCAAgE;AAChE,mDAAkD;AAElD,MAAM,QA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AAC;IAEZ,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,GACrE,IAAA,wCAAuB,EACrB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,eAAe,CAChB,CAAC;IAEJ,MAAM,OAAO,GAAqB;QAChC,IAAI,EAAE,qCAAoB,CAAC,UAAU;QACrC,SAAS,EAAE,0BAAS,CAAC,GAAG;QACxB,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,eAAe,EAAE,IAAI;YACrB,WAAW;YACX,YAAY;YACZ,WAAW;YACX,KAAK;SACN;KACF,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,cAAc;IAC/B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"obligationsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suilend/obligationsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAQoC;AACpC,gEAAqC;AAGrC,2CAKqB;AACrB,iDAAmD;AACnD,qEAAkE;AAOlE,qEAAkE;AAClE,qGAA6E;AAC7E,uCAAgE;AAChE,mDAAkD;AAElD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,oBAAoB,GAAG,MAAM,IAAA,iCAAe,EAChD,MAAM,EACN,KAAK,EACL;QACE,MAAM,EAAE,EAAE,OAAO,EAAE,qBAAS,EAAE;KAC/B,CACF,CAAC;IACF,IAAI,o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