@sonarwatch/portfolio-plugins 0.11.206 → 0.11.208

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. package/CHANGELOG.md +1565 -1557
  2. package/README.md +3 -3
  3. package/package.json +3 -2
  4. package/src/Job.d.ts +1 -1
  5. package/src/index.js +4 -0
  6. package/src/index.js.map +1 -1
  7. package/src/plugins/balancer/helpers/pools.js +21 -21
  8. package/src/plugins/flowx/constants.d.ts +1 -0
  9. package/src/plugins/flowx/constants.js +2 -1
  10. package/src/plugins/flowx/constants.js.map +1 -1
  11. package/src/plugins/flowx/index.js +6 -1
  12. package/src/plugins/flowx/index.js.map +1 -1
  13. package/src/plugins/flowx/stakingPoolV3Fetcher.d.ts +3 -0
  14. package/src/plugins/flowx/stakingPoolV3Fetcher.js +100 -0
  15. package/src/plugins/flowx/stakingPoolV3Fetcher.js.map +1 -0
  16. package/src/plugins/flowx/types.d.ts +31 -0
  17. package/src/plugins/mole/constants.d.ts +12 -0
  18. package/src/plugins/mole/constants.js +25 -0
  19. package/src/plugins/mole/constants.js.map +1 -0
  20. package/src/plugins/mole/dataJob.d.ts +3 -0
  21. package/src/plugins/mole/dataJob.js +49 -0
  22. package/src/plugins/mole/dataJob.js.map +1 -0
  23. package/src/plugins/mole/depositsFetcher.d.ts +3 -0
  24. package/src/plugins/mole/depositsFetcher.js +133 -0
  25. package/src/plugins/mole/depositsFetcher.js.map +1 -0
  26. package/src/plugins/mole/farmsFetcher.d.ts +3 -0
  27. package/src/plugins/mole/farmsFetcher.js +132 -0
  28. package/src/plugins/mole/farmsFetcher.js.map +1 -0
  29. package/src/plugins/mole/farmsJob.d.ts +3 -0
  30. package/src/plugins/mole/farmsJob.js +52 -0
  31. package/src/plugins/mole/farmsJob.js.map +1 -0
  32. package/src/plugins/mole/helpers.d.ts +1 -0
  33. package/src/plugins/mole/helpers.js +15 -0
  34. package/src/plugins/mole/helpers.js.map +1 -0
  35. package/src/plugins/mole/index.d.ts +6 -0
  36. package/src/plugins/mole/index.js +15 -0
  37. package/src/plugins/mole/index.js.map +1 -0
  38. package/src/plugins/mole/types.d.ts +68 -0
  39. package/src/plugins/mole/types.js +3 -0
  40. package/src/plugins/mole/types.js.map +1 -0
  41. package/src/plugins/sushiswap/helpers.js +24 -24
  42. package/src/plugins/uniswap-v2/helpers.js +22 -22
  43. package/src/utils/sei/constants.js +8 -8
  44. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # @sonarwatch/portfolio-plugins
2
-
3
- This library is @sonarwatch/portfolio-plugins
1
+ # @sonarwatch/portfolio-plugins
2
+
3
+ This library is @sonarwatch/portfolio-plugins
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.11.206",
3
+ "version": "0.11.208",
4
4
  "type": "commonjs",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
@@ -19,6 +19,7 @@
19
19
  "@metaplex-foundation/beet-solana": "^0.4.0",
20
20
  "@metaplex-foundation/js": "^0.19.4",
21
21
  "@metaplex-foundation/umi-serializers-encodings": "^0.8.9",
22
+ "@mysten/bcs": "^0.11.1",
22
23
  "@mysten/sui.js": "^0.50.1",
23
24
  "@onsol/tldparser": "^0.6.1",
24
25
  "@sei-js/core": "^3.0.1",
@@ -41,7 +42,7 @@
41
42
  "web3-v1": "npm:web3@^1.5.0"
42
43
  },
43
44
  "peerDependencies": {
44
- "@sonarwatch/portfolio-core": "0.11.206"
45
+ "@sonarwatch/portfolio-core": "0.11.208"
45
46
  },
46
47
  "main": "./src/index.js",
47
48
  "types": "./src/index.d.ts"
package/src/Job.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Cache } from './Cache';
2
2
  export type JobExecutor = (cache: Cache) => Promise<void>;
3
- export type JobLabel = 'normal' | 'coingecko';
3
+ export type JobLabel = 'normal' | 'coingecko' | 'realtime';
4
4
  export type Job = {
5
5
  id: string;
6
6
  executor: JobExecutor;
package/src/index.js CHANGED
@@ -111,6 +111,7 @@ const sandglass_1 = require("./plugins/sandglass");
111
111
  const kriya_1 = require("./plugins/kriya");
112
112
  const haedal_1 = require("./plugins/haedal");
113
113
  const flowx_1 = require("./plugins/flowx");
114
+ const mole_1 = require("./plugins/mole");
114
115
  var constants_1 = require("./plugins/tokens/constants");
115
116
  Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get: function () { return constants_1.walletTokensPlatform; } });
116
117
  Object.defineProperty(exports, "walletNftsPlatform", { enumerable: true, get: function () { return constants_1.walletNftsPlatform; } });
@@ -215,6 +216,7 @@ exports.platforms = [
215
216
  ...sandglass_1.platforms,
216
217
  ...kriya_1.platforms,
217
218
  ...haedal_1.platforms,
219
+ ...mole_1.platforms,
218
220
  ];
219
221
  // JOBS //
220
222
  exports.jobs = [
@@ -302,6 +304,7 @@ exports.jobs = [
302
304
  ...kriya_1.jobs,
303
305
  ...haedal_1.jobs,
304
306
  ...flowx_1.jobs,
307
+ ...mole_1.jobs,
305
308
  ];
306
309
  // FETCHERS //
307
310
  exports.fetchers = [
@@ -391,6 +394,7 @@ exports.fetchers = [
391
394
  ...kriya_1.fetchers,
392
395
  ...haedal_1.fetchers,
393
396
  ...flowx_1.fetchers,
397
+ ...mole_1.fetchers,
394
398
  ];
395
399
  exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
396
400
  exports.airdropFetchers = [
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,wFAAqF;AACrF,sEAA8C;AAC9C,6CAI0B;AAC1B,yDAIgC;AAChC,uDAAgE;AAChE,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB,6CAI0B;AAC1B,+CAI2B;AAC3B,yCAIwB;AACxB,+CAI2B;AAC3B,2CAIyB;AACzB,6CAI0B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AAG,eAAY;IACf,GAAG,cAAW;IACd,GAAG,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,kBAAe;IAClB,GAAG,cAAW;IACd,GAAG,mBAAgB;IACnB,GAAG,eAAY;IACf,GAAG,iBAAc;IACjB,GAAG,eAAY;IACf,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,oBAAiB;IACpB,GAAG,gBAAa;IAChB,GAAG,iBAAc;IACjB,GAAG,gBAAa;CACjB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC;AAE/D,QAAA,eAAe,GAAqB;IAC/C,sBAAmB;IACnB,sBAAmB;CACpB,CAAC;AACW,QAAA,8BAA8B,GACzC,IAAA,uDAA0B,EAAC,uBAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,wFAAqF;AACrF,sEAA8C;AAC9C,6CAI0B;AAC1B,yDAIgC;AAChC,uDAAgE;AAChE,iDAG4B;AAC5B,iDAI4B;AAC5B,2CAGyB;AACzB,6CAI0B;AAC1B,+CAI2B;AAC3B,yCAIwB;AACxB,+CAI2B;AAC3B,2CAIyB;AACzB,6CAI0B;AAC1B,2CAIyB;AACzB,6CAG0B;AAC1B,6CAI0B;AAC1B,yCAIwB;AACxB,2DAGiC;AACjC,6CAI0B;AAC1B,2CAKyB;AACzB,2CAIyB;AACzB,qDAA6D;AAC7D,qEAIsC;AACtC,uDAI+B;AAC/B,mDAI6B;AAC7B,qDAG8B;AAC9B,uDAG+B;AAC/B,2CAIyB;AACzB,6CAI0B;AAC1B,6CAG0B;AAC1B,yCAIwB;AACxB,+CAI2B;AAC3B,uDAG+B;AAC/B,yCAGwB;AACxB,2CAIyB;AACzB,iDAI4B;AAC5B,iDAI4B;AAC5B,6CAI0B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gBAAa;IAChB,GAAG,eAAY;CAChB,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,uDAA0B,EAAC,gBAAQ,CAAC,CAAC;AAE/D,QAAA,eAAe,GAAqB;IAC/C,sBAAmB;IACnB,sBAAmB;CACpB,CAAC;AACW,QAAA,8BAA8B,GACzC,IAAA,uDAA0B,EAAC,uBAAe,CAAC,CAAC"}
@@ -36,27 +36,27 @@ exports.getBalancerPoolsV2 = void 0;
36
36
  const graphql_request_1 = __importStar(require("graphql-request"));
37
37
  function getBalancerPoolsV2(url) {
38
38
  return __awaiter(this, void 0, void 0, function* () {
39
- const query = (0, graphql_request_1.gql) `
40
- query pools {
41
- pools(
42
- first: 1000
43
- orderBy: totalLiquidity
44
- orderDirection: desc
45
- where: { totalLiquidity_gt: "500" }
46
- ) {
47
- id
48
- address
49
- symbol
50
- totalLiquidity
51
- totalShares
52
- tokens {
53
- balance
54
- decimals
55
- symbol
56
- address
57
- }
58
- }
59
- }
39
+ const query = (0, graphql_request_1.gql) `
40
+ query pools {
41
+ pools(
42
+ first: 1000
43
+ orderBy: totalLiquidity
44
+ orderDirection: desc
45
+ where: { totalLiquidity_gt: "500" }
46
+ ) {
47
+ id
48
+ address
49
+ symbol
50
+ totalLiquidity
51
+ totalShares
52
+ tokens {
53
+ balance
54
+ decimals
55
+ symbol
56
+ address
57
+ }
58
+ }
59
+ }
60
60
  `;
61
61
  const res = yield (0, graphql_request_1.default)(url, query);
62
62
  const pools = res.pools;
@@ -13,3 +13,4 @@ export declare const stakingParentObject = "0xa3d00f45134cc1949ab98c523c3114c1ae
13
13
  export declare const unstackStruct = "0x7d30f6c265b25255d33de0ed09eec5fb8747cf1a2622646fc8f594cce2180523::staking::UnstakeRecipient";
14
14
  export declare const poolsPrefix = "flowx-pools";
15
15
  export declare const poolsKey = "pools";
16
+ export declare const packageIdV3 = "0x25929e7f29e0a30eb4e692952ba1b5b65a3a4d65ab5f2a32e1ba3edcb587f26d";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.poolsKey = exports.poolsPrefix = exports.unstackStruct = exports.stakingParentObject = exports.poolsOwner = exports.pairsOwner = exports.factory = exports.packageId = exports.lpDecimals = exports.flxDecimals = exports.xflxMint = exports.flxMint = exports.platform = exports.platformId = void 0;
3
+ exports.packageIdV3 = exports.poolsKey = exports.poolsPrefix = exports.unstackStruct = exports.stakingParentObject = exports.poolsOwner = exports.pairsOwner = exports.factory = exports.packageId = exports.lpDecimals = exports.flxDecimals = exports.xflxMint = exports.flxMint = exports.platform = exports.platformId = void 0;
4
4
  exports.platformId = 'flowx';
5
5
  exports.platform = {
6
6
  id: exports.platformId,
@@ -22,4 +22,5 @@ exports.stakingParentObject = '0xa3d00f45134cc1949ab98c523c3114c1ae83a8d36f2f734
22
22
  exports.unstackStruct = '0x7d30f6c265b25255d33de0ed09eec5fb8747cf1a2622646fc8f594cce2180523::staking::UnstakeRecipient';
23
23
  exports.poolsPrefix = `${exports.platformId}-pools`;
24
24
  exports.poolsKey = 'pools';
25
+ exports.packageIdV3 = '0x25929e7f29e0a30eb4e692952ba1b5b65a3a4d65ab5f2a32e1ba3edcb587f26d';
25
26
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flowx/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,8CAA8C;IACrD,WAAW,EAAE,eAAe;IAC5B,OAAO,EAAE,uBAAuB;IAChC,OAAO,EAAE,mCAAmC;CAC7C,CAAC;AAEW,QAAA,OAAO,GAClB,8EAA8E,CAAC;AACpE,QAAA,QAAQ,GACnB,gFAAgF,CAAC;AACtE,QAAA,WAAW,GAAG,CAAC,CAAC;AAEhB,QAAA,UAAU,GAAG,CAAC,CAAC;AAEf,QAAA,SAAS,GACpB,oEAAoE,CAAC;AAC1D,QAAA,OAAO,GAClB,oEAAoE,CAAC;AAC1D,QAAA,UAAU,GACrB,oEAAoE,CAAC;AAC1D,QAAA,UAAU,GACrB,oEAAoE,CAAC;AAC1D,QAAA,mBAAmB,GAC9B,oEAAoE,CAAC;AAC1D,QAAA,aAAa,GACxB,+FAA+F,CAAC;AAErF,QAAA,WAAW,GAAG,GAAG,kBAAU,QAAQ,CAAC;AACpC,QAAA,QAAQ,GAAG,OAAO,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flowx/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,8CAA8C;IACrD,WAAW,EAAE,eAAe;IAC5B,OAAO,EAAE,uBAAuB;IAChC,OAAO,EAAE,mCAAmC;CAC7C,CAAC;AAEW,QAAA,OAAO,GAClB,8EAA8E,CAAC;AACpE,QAAA,QAAQ,GACnB,gFAAgF,CAAC;AACtE,QAAA,WAAW,GAAG,CAAC,CAAC;AAEhB,QAAA,UAAU,GAAG,CAAC,CAAC;AAEf,QAAA,SAAS,GACpB,oEAAoE,CAAC;AAC1D,QAAA,OAAO,GAClB,oEAAoE,CAAC;AAC1D,QAAA,UAAU,GACrB,oEAAoE,CAAC;AAC1D,QAAA,UAAU,GACrB,oEAAoE,CAAC;AAC1D,QAAA,mBAAmB,GAC9B,oEAAoE,CAAC;AAC1D,QAAA,aAAa,GACxB,+FAA+F,CAAC;AAErF,QAAA,WAAW,GAAG,GAAG,kBAAU,QAAQ,CAAC;AACpC,QAAA,QAAQ,GAAG,OAAO,CAAC;AAEnB,QAAA,WAAW,GACtB,oEAAoE,CAAC"}
@@ -9,7 +9,12 @@ const stakingFetcher_1 = __importDefault(require("./stakingFetcher"));
9
9
  const poolJob_1 = __importDefault(require("./poolJob"));
10
10
  const stakingPoolJob_1 = __importDefault(require("./stakingPoolJob"));
11
11
  const stakingPoolFetcher_1 = __importDefault(require("./stakingPoolFetcher"));
12
+ const stakingPoolV3Fetcher_1 = __importDefault(require("./stakingPoolV3Fetcher"));
12
13
  exports.platforms = [constants_1.platform];
13
14
  exports.jobs = [poolJob_1.default, stakingPoolJob_1.default];
14
- exports.fetchers = [stakingFetcher_1.default, stakingPoolFetcher_1.default];
15
+ exports.fetchers = [
16
+ stakingFetcher_1.default,
17
+ stakingPoolFetcher_1.default,
18
+ stakingPoolV3Fetcher_1.default,
19
+ ];
15
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flowx/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sEAA8C;AAC9C,wDAAgC;AAChC,sEAA8C;AAC9C,8EAAsD;AAEzC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,iBAAO,EAAE,wBAAc,CAAC,CAAC;AACxC,QAAA,QAAQ,GAAc,CAAC,wBAAc,EAAE,4BAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flowx/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sEAA8C;AAC9C,wDAAgC;AAChC,sEAA8C;AAC9C,8EAAsD;AACtD,kFAA0D;AAE7C,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,iBAAO,EAAE,wBAAc,CAAC,CAAC;AACxC,QAAA,QAAQ,GAAc;IACjC,wBAAc;IACd,4BAAkB;IAClB,8BAAoB;CACrB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,100 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
17
+ const constants_1 = require("./constants");
18
+ const clients_1 = require("../../utils/clients");
19
+ const getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
20
+ const tokenAmountFromLiquidity_1 = require("../../utils/clmm/tokenAmountFromLiquidity");
21
+ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
22
+ const multiGetObjects_1 = require("../../utils/sui/multiGetObjects");
23
+ const helpers_1 = require("../cetus/helpers");
24
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
25
+ const client = (0, clients_1.getClientSui)();
26
+ const positions = yield (0, getOwnedObjects_1.getOwnedObjects)(client, owner, {
27
+ filter: {
28
+ StructType: `${constants_1.packageIdV3}::position::Position`,
29
+ },
30
+ });
31
+ if (positions.length === 0)
32
+ return [];
33
+ const poolsIds = new Set();
34
+ const mints = new Set();
35
+ positions.forEach((position) => {
36
+ var _a, _b, _c, _d, _e, _f, _g, _h;
37
+ if ((_b = (_a = position === null || position === void 0 ? void 0 : position.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.coin_type_x.fields.name)
38
+ mints.add(position.data.content.fields.coin_type_x.fields.name);
39
+ if ((_d = (_c = position === null || position === void 0 ? void 0 : position.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.fields.coin_type_y.fields.name)
40
+ mints.add(position.data.content.fields.coin_type_y.fields.name);
41
+ if ((_f = (_e = position.data) === null || _e === void 0 ? void 0 : _e.content) === null || _f === void 0 ? void 0 : _f.fields.pool_id)
42
+ poolsIds.add((_h = (_g = position.data) === null || _g === void 0 ? void 0 : _g.content) === null || _h === void 0 ? void 0 : _h.fields.pool_id);
43
+ });
44
+ const [tokenPrices, pools] = yield Promise.all([
45
+ cache.getTokenPricesAsMap([...mints], portfolio_core_1.NetworkId.sui),
46
+ (0, multiGetObjects_1.multiGetObjects)(client, Array.from(poolsIds.values())),
47
+ ]);
48
+ const liquidities = [];
49
+ positions.forEach((position) => {
50
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
51
+ if (!((_b = (_a = position.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.liquidity))
52
+ return;
53
+ if (!((_d = (_c = position.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.fields.pool_id))
54
+ return;
55
+ const pool = pools.find((p) => { var _a, _b, _c; return ((_a = p.data) === null || _a === void 0 ? void 0 : _a.objectId) === ((_c = (_b = position.data) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.fields.pool_id); });
56
+ if (!((_f = (_e = pool === null || pool === void 0 ? void 0 : pool.data) === null || _e === void 0 ? void 0 : _e.content) === null || _f === void 0 ? void 0 : _f.fields))
57
+ return;
58
+ const tokenPriceX = tokenPrices.get((0, portfolio_core_1.formatMoveTokenAddress)(position.data.content.fields.coin_type_x.fields.name));
59
+ const tokenPriceY = tokenPrices.get((0, portfolio_core_1.formatMoveTokenAddress)(position.data.content.fields.coin_type_y.fields.name));
60
+ if (!tokenPriceX || !tokenPriceY)
61
+ return;
62
+ const tokenAmounts = (0, tokenAmountFromLiquidity_1.getTokenAmountsFromLiquidity)(new bignumber_js_1.default((_h = (_g = position.data) === null || _g === void 0 ? void 0 : _g.content) === null || _h === void 0 ? void 0 : _h.fields.liquidity), (0, helpers_1.asIntN)(BigInt((_k = (_j = pool === null || pool === void 0 ? void 0 : pool.data) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.fields.tick_index.fields.bits)), (0, helpers_1.asIntN)(BigInt((_m = (_l = position.data) === null || _l === void 0 ? void 0 : _l.content) === null || _m === void 0 ? void 0 : _m.fields.tick_lower_index.fields.bits)), (0, helpers_1.asIntN)(BigInt((_p = (_o = position.data) === null || _o === void 0 ? void 0 : _o.content) === null || _p === void 0 ? void 0 : _p.fields.tick_upper_index.fields.bits)), false);
63
+ const assetX = (0, tokenPriceToAssetToken_1.default)(tokenPriceX.address, tokenAmounts.tokenAmountA
64
+ .dividedBy(Math.pow(10, tokenPriceX.decimals))
65
+ .toNumber(), portfolio_core_1.NetworkId.sui, tokenPriceX);
66
+ const assetY = (0, tokenPriceToAssetToken_1.default)(tokenPriceY.address, tokenAmounts.tokenAmountB
67
+ .dividedBy(Math.pow(10, tokenPriceY.decimals))
68
+ .toNumber(), portfolio_core_1.NetworkId.sui, tokenPriceY);
69
+ const value = (0, portfolio_core_1.getUsdValueSum)([assetX.value, assetY.value]);
70
+ liquidities.push({
71
+ assets: [assetX, assetY],
72
+ assetsValue: value,
73
+ rewardAssets: [],
74
+ rewardAssetsValue: null,
75
+ value,
76
+ yields: [],
77
+ });
78
+ });
79
+ if (liquidities.length === 0)
80
+ return [];
81
+ return [
82
+ {
83
+ type: portfolio_core_1.PortfolioElementType.liquidity,
84
+ networkId: portfolio_core_1.NetworkId.sui,
85
+ platformId: constants_1.platformId,
86
+ label: 'LiquidityPool',
87
+ value: (0, portfolio_core_1.getUsdValueSum)(liquidities.map((a) => a.value)),
88
+ data: {
89
+ liquidities,
90
+ },
91
+ },
92
+ ];
93
+ });
94
+ const fetcher = {
95
+ id: `${constants_1.platformId}-staking-pool-v3`,
96
+ networkId: portfolio_core_1.NetworkId.sui,
97
+ executor,
98
+ };
99
+ exports.default = fetcher;
100
+ //# sourceMappingURL=stakingPoolV3Fetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stakingPoolV3Fetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/flowx/stakingPoolV3Fetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,gEAAqC;AAGrC,2CAAsD;AACtD,iDAAmD;AAEnD,qEAAkE;AAClE,wFAAyF;AACzF,qGAA6E;AAC7E,qEAAkE;AAClE,8CAA0C;AAE1C,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,SAAS,GAAG,MAAM,IAAA,iCAAe,EAAmB,MAAM,EAAE,KAAK,EAAE;QACvE,MAAM,EAAE;YACN,UAAU,EAAE,GAAG,uBAAW,sBAAsB;SACjD;KACF,CAAC,CAAC;IACH,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEtC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;;QAC7B,IAAI,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI;YACzD,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC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ACvB,EAAE,EAAE,GAAG,sBAAU,kBAAkB;IACnC,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -76,3 +76,34 @@ export type Pool = {
76
76
  lpToken: string;
77
77
  rewardToken: string;
78
78
  };
79
+ export type PositionV3Object = {
80
+ coin_type_x: {
81
+ fields: {
82
+ name: string;
83
+ };
84
+ };
85
+ coin_type_y: {
86
+ fields: {
87
+ name: string;
88
+ };
89
+ };
90
+ pool_id: string;
91
+ liquidity: string;
92
+ tick_lower_index: {
93
+ fields: {
94
+ bits: string;
95
+ };
96
+ };
97
+ tick_upper_index: {
98
+ fields: {
99
+ bits: string;
100
+ };
101
+ };
102
+ };
103
+ export type PoolV3 = {
104
+ tick_index: {
105
+ fields: {
106
+ bits: string;
107
+ };
108
+ };
109
+ };
@@ -0,0 +1,12 @@
1
+ import { Platform } from '@sonarwatch/portfolio-core';
2
+ export declare const platformId = "mole";
3
+ export declare const platform: Platform;
4
+ export declare const magicCoin = "0x5ffa69ee4ee14d899dcc750df92de12bad4bacf81efa1ae12ee76406804dda7f::vault::MagicCoin";
5
+ export declare const suiStackedParentId = "0x02acbf5d6e48bced367c43ca121da29c05fd9a207c0d8aa4552d553f189e6700";
6
+ export declare const usdcStackedParentId = "0x81b17a30ed130e0d1f400678f07cf07578e3ee31c7d208656d71cfd56ac0fe94";
7
+ export declare const suiIncentiveUserType = "0x2f73c04ded344fd4e2530ec8012a7cffdc17cbb049559f3196c030f58c3a0cdd::sui_incentive::User";
8
+ export declare const stackedSavingsParentIds: string[];
9
+ export declare const dataUrl = "https://app.mole.fi/api/SuiMainnet/data.json";
10
+ export declare const vaultsPrefix = "mole";
11
+ export declare const dataKey = "data";
12
+ export declare const positionsKey = "positions";
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.positionsKey = exports.dataKey = exports.vaultsPrefix = exports.dataUrl = exports.stackedSavingsParentIds = exports.suiIncentiveUserType = exports.usdcStackedParentId = exports.suiStackedParentId = exports.magicCoin = exports.platform = exports.platformId = void 0;
4
+ exports.platformId = 'mole';
5
+ exports.platform = {
6
+ id: exports.platformId,
7
+ name: 'Mole',
8
+ image: 'https://sonar.watch/img/platforms/mole.webp',
9
+ defiLlamaId: 'mole', // from https://defillama.com/docs/api
10
+ website: 'https://app.mole.fi/',
11
+ twitter: 'https://twitter.com/moledefi',
12
+ };
13
+ exports.magicCoin = '0x5ffa69ee4ee14d899dcc750df92de12bad4bacf81efa1ae12ee76406804dda7f::vault::MagicCoin';
14
+ exports.suiStackedParentId = '0x02acbf5d6e48bced367c43ca121da29c05fd9a207c0d8aa4552d553f189e6700';
15
+ exports.usdcStackedParentId = '0x81b17a30ed130e0d1f400678f07cf07578e3ee31c7d208656d71cfd56ac0fe94';
16
+ exports.suiIncentiveUserType = '0x2f73c04ded344fd4e2530ec8012a7cffdc17cbb049559f3196c030f58c3a0cdd::sui_incentive::User';
17
+ exports.stackedSavingsParentIds = [
18
+ exports.suiStackedParentId,
19
+ exports.usdcStackedParentId
20
+ ];
21
+ exports.dataUrl = `https://app.mole.fi/api/SuiMainnet/data.json`;
22
+ exports.vaultsPrefix = `${exports.platformId}`;
23
+ exports.dataKey = 'data';
24
+ exports.positionsKey = 'positions';
25
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mole/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,6CAA6C;IACpD,WAAW,EAAE,MAAM,EAAE,sCAAsC;IAC3D,OAAO,EAAE,sBAAsB;IAC/B,OAAO,EAAE,8BAA8B;CACxC,CAAC;AAEW,QAAA,SAAS,GAAG,sFAAsF,CAAC;AACnG,QAAA,kBAAkB,GAAG,oEAAoE,CAAC;AAC1F,QAAA,mBAAmB,GAAG,oEAAoE,CAAC;AAC3F,QAAA,oBAAoB,GAAG,yFAAyF,CAAC;AAEjH,QAAA,uBAAuB,GAAG;IACrC,0BAAkB;IAClB,2BAAmB;CACpB,CAAC;AAEW,QAAA,OAAO,GAAG,8CAA8C,CAAA;AAExD,QAAA,YAAY,GAAG,GAAG,kBAAU,EAAE,CAAC;AAC/B,QAAA,OAAO,GAAG,MAAM,CAAC;AACjB,QAAA,YAAY,GAAG,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Job } from '../../Job';
2
+ declare const job: Job;
3
+ export default job;
@@ -0,0 +1,49 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const axios_1 = __importDefault(require("axios"));
16
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
17
+ const constants_1 = require("./constants");
18
+ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
19
+ if (!process.env['PORTFOLIO_MOLE_API_KEY'])
20
+ throw Error('PORTFOLIO_MOLE_API_KEY is not defined');
21
+ const res = yield axios_1.default
22
+ .get(constants_1.dataUrl, {
23
+ timeout: 30000,
24
+ headers: {
25
+ key: process.env['PORTFOLIO_MOLE_API_KEY'],
26
+ },
27
+ })
28
+ .catch((err) => {
29
+ throw Error(`MOLE_API ERR: ${err}`);
30
+ });
31
+ if (!res) {
32
+ throw Error(`MOLE_API NO RESPONSE`);
33
+ }
34
+ const { data } = res;
35
+ if (!data || !data.vaults) {
36
+ throw Error(`MOLE_API MISSING DATA`);
37
+ }
38
+ yield cache.setItem(constants_1.dataKey, data, {
39
+ prefix: constants_1.vaultsPrefix,
40
+ networkId: portfolio_core_1.NetworkId.sui,
41
+ });
42
+ });
43
+ const job = {
44
+ id: `${constants_1.platformId}-data`,
45
+ executor,
46
+ label: 'normal',
47
+ };
48
+ exports.default = job;
49
+ //# sourceMappingURL=dataJob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mole/dataJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,+DAAuD;AAGvD,2CAAyE;AAGzE,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC;QACxC,MAAM,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAEvD,MAAM,GAAG,GAAG,MAAM,eAAK;SACpB,GAAG,CAAW,mBAAO,EAAE;QACtB,OAAO,EAAE,KAAK;QACd,OAAO,EAAE;YACP,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC;SAC3C;KACF,CAAC;SACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,MAAM,KAAK,CAAC,iBAAiB,GAAG,EAAE,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEL,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;IAErB,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,KAAK,CAAC,OAAO,CAAC,mBAAO,EAAE,IAAI,EAAE;QACjC,MAAM,EAAE,wBAAY;QACpB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,OAAO;IACxB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AAEF,kBAAe,GAAG,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,133 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
+ const constants_1 = require("./constants");
17
+ const clients_1 = require("../../utils/clients");
18
+ const aptos_1 = require("../../utils/aptos");
19
+ const tokenPriceToAssetTokens_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetTokens"));
20
+ const getDynamicFieldObject_1 = require("../../utils/sui/getDynamicFieldObject");
21
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
22
+ var _a, _b, _c, _d, _e, _f;
23
+ const client = (0, clients_1.getClientSui)();
24
+ const [data, coinsBalances, stackedSavings] = yield Promise.all([
25
+ cache.getItem(constants_1.dataKey, {
26
+ prefix: constants_1.vaultsPrefix,
27
+ networkId: portfolio_core_1.NetworkId.sui,
28
+ }),
29
+ client.getAllBalances({ owner }),
30
+ Promise.all(constants_1.stackedSavingsParentIds.map((stackedSavingsParentId) => (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
31
+ parentId: stackedSavingsParentId,
32
+ name: {
33
+ type: constants_1.suiIncentiveUserType,
34
+ value: { address: owner, is_object: false },
35
+ },
36
+ }))),
37
+ ]);
38
+ if (!data || !data.vaults) {
39
+ return [];
40
+ }
41
+ const vaultsMap = new Map();
42
+ data.vaults.forEach((vault) => {
43
+ if (!vault)
44
+ return;
45
+ vaultsMap.set((0, portfolio_core_1.formatMoveTokenAddress)(vault.baseToken), vault);
46
+ });
47
+ const coinsTypes = [];
48
+ const balances = [];
49
+ for (let i = 0; i < coinsBalances.length; i++) {
50
+ const coinBalance = coinsBalances[i];
51
+ const amountRaw = Number(coinBalance.totalBalance);
52
+ if (amountRaw === 0)
53
+ continue;
54
+ if (!coinBalance.coinType.includes(constants_1.magicCoin))
55
+ continue;
56
+ const { keys: parsedType } = (0, aptos_1.parseTypeString)(coinBalance.coinType);
57
+ if (!parsedType)
58
+ continue;
59
+ if (!coinsTypes.includes(parsedType[0].type))
60
+ coinsTypes.push(parsedType[0].type);
61
+ balances.push({
62
+ type: parsedType[0].type,
63
+ amountRaw,
64
+ });
65
+ }
66
+ for (let i = 0; i < stackedSavings.length; i++) {
67
+ const stackedSaving = stackedSavings[i];
68
+ if (!((_b = (_a = stackedSaving.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields))
69
+ continue;
70
+ const amountRaw = Number(stackedSaving.data.content.fields.value.fields.amount);
71
+ if (amountRaw === 0)
72
+ continue;
73
+ if (!((_d = (_c = stackedSaving.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.type.includes(constants_1.magicCoin)))
74
+ continue;
75
+ const parsedTypeString = (0, aptos_1.parseTypeString)((_f = (_e = stackedSaving.data) === null || _e === void 0 ? void 0 : _e.content) === null || _f === void 0 ? void 0 : _f.type);
76
+ if (!parsedTypeString.keys)
77
+ continue;
78
+ const { keys: parsedSubType } = (0, aptos_1.parseTypeString)(parsedTypeString.keys[1].type);
79
+ if (!parsedSubType)
80
+ continue;
81
+ const { keys: parsedSubSubType } = (0, aptos_1.parseTypeString)(parsedSubType[0].type);
82
+ if (!parsedSubSubType)
83
+ continue;
84
+ if (!coinsTypes.includes(parsedSubSubType[0].type))
85
+ coinsTypes.push(parsedSubSubType[0].type);
86
+ balances.push({
87
+ type: parsedSubSubType[0].type,
88
+ amountRaw,
89
+ });
90
+ }
91
+ const tokenPrices = yield cache.getTokenPricesAsMap(coinsTypes, portfolio_core_1.NetworkId.sui);
92
+ const liquidities = [];
93
+ for (let i = 0; i < balances.length; i++) {
94
+ const coinBalance = balances[i];
95
+ const tokenPrice = tokenPrices.get((0, portfolio_core_1.formatMoveTokenAddress)(coinBalance.type));
96
+ if (!tokenPrice)
97
+ continue;
98
+ const vault = vaultsMap.get((0, portfolio_core_1.formatMoveTokenAddress)(coinBalance.type));
99
+ if (!vault)
100
+ continue;
101
+ const assets = (0, tokenPriceToAssetTokens_1.default)(coinBalance.type, (Number(coinBalance.amountRaw) / Math.pow(10, tokenPrice.decimals)) *
102
+ vault.baseTokenPerIbToken, portfolio_core_1.NetworkId.sui, tokenPrice);
103
+ const assetsValue = (0, portfolio_core_1.getUsdValueSum)(assets.map((a) => a.value));
104
+ const value = assetsValue;
105
+ liquidities.push({
106
+ value,
107
+ assets,
108
+ assetsValue,
109
+ rewardAssets: [],
110
+ rewardAssetsValue: null,
111
+ yields: [],
112
+ });
113
+ }
114
+ if (liquidities.length === 0)
115
+ return [];
116
+ return [
117
+ {
118
+ type: 'liquidity',
119
+ data: { liquidities },
120
+ label: 'Staked',
121
+ networkId: portfolio_core_1.NetworkId.sui,
122
+ platformId: constants_1.platformId,
123
+ value: (0, portfolio_core_1.getUsdValueSum)(liquidities.map((liq) => liq.value)),
124
+ },
125
+ ];
126
+ });
127
+ const fetcher = {
128
+ id: `${constants_1.platformId}-deposits`,
129
+ networkId: portfolio_core_1.NetworkId.sui,
130
+ executor,
131
+ };
132
+ exports.default = fetcher;
133
+ //# sourceMappingURL=depositsFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/mole/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AAGpC,2CAOqB;AACrB,iDAAmD;AACnD,6CAAoD;AACpD,uGAA+E;AAE/E,iFAA8E;AAE9E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,cAAc,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC9D,KAAK,CAAC,OAAO,CAAsB,mBAAO,EAAE;YAC1C,MAAM,EAAE,wBAAY;YACpB,SAAS,EAAE,0BAAS,CAAC,GAAG;SACzB,CAAC;QACF,MAAM,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,CAAC;QAChC,OAAO,CAAC,GAAG,CACT,mCAAuB,CAAC,GAAG,CAAC,CAAC,sBAAsB,EAAE,EAAE,CACrD,IAAA,6CAAqB,EAAW,MAAM,EAAE;YACtC,QAAQ,EAAE,sBAAsB;YAChC,IAAI,EAAE;gBACJ,IAAI,EAAE,gCAAoB;gBAC1B,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE;aAC5C;SACF,CAAC,CACH,CACF;KACF,CAAC,CAAC;IAEH,IAAI,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