@sonarwatch/portfolio-plugins 0.12.19 → 0.12.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. package/CHANGELOG.md +1774 -1766
  2. package/README.md +3 -3
  3. package/package.json +1 -1
  4. package/src/index.js +4 -0
  5. package/src/index.js.map +1 -1
  6. package/src/plugins/balancer/helpers/pools.js +21 -21
  7. package/src/plugins/bluefin/bankFetcher.d.ts +3 -0
  8. package/src/plugins/bluefin/bankFetcher.js +66 -0
  9. package/src/plugins/bluefin/bankFetcher.js.map +1 -0
  10. package/src/plugins/bluefin/constants.d.ts +8 -0
  11. package/src/plugins/bluefin/constants.js +18 -0
  12. package/src/plugins/bluefin/constants.js.map +1 -0
  13. package/src/plugins/bluefin/index.d.ts +6 -0
  14. package/src/plugins/bluefin/index.js +16 -0
  15. package/src/plugins/bluefin/index.js.map +1 -0
  16. package/src/plugins/bluefin/perpsJob.d.ts +3 -0
  17. package/src/plugins/bluefin/perpsJob.js +41 -0
  18. package/src/plugins/bluefin/perpsJob.js.map +1 -0
  19. package/src/plugins/bluefin/poolFetcher.d.ts +3 -0
  20. package/src/plugins/bluefin/poolFetcher.js +72 -0
  21. package/src/plugins/bluefin/poolFetcher.js.map +1 -0
  22. package/src/plugins/bluefin/poolJob.d.ts +3 -0
  23. package/src/plugins/bluefin/poolJob.js +33 -0
  24. package/src/plugins/bluefin/poolJob.js.map +1 -0
  25. package/src/plugins/bluefin/positionFetcher.d.ts +3 -0
  26. package/src/plugins/bluefin/positionFetcher.js +133 -0
  27. package/src/plugins/bluefin/positionFetcher.js.map +1 -0
  28. package/src/plugins/bluefin/types.d.ts +88 -0
  29. package/src/plugins/bluefin/types.js +3 -0
  30. package/src/plugins/bluefin/types.js.map +1 -0
  31. package/src/plugins/jupiter/pricingJob.js +3 -0
  32. package/src/plugins/jupiter/pricingJob.js.map +1 -1
  33. package/src/plugins/sushiswap/helpers.js +24 -24
  34. package/src/plugins/uniswap-v2/helpers.js +22 -22
  35. package/src/plugins/x-staking-solana/constants.js +1 -1
  36. package/src/plugins/x-staking-solana/constants.js.map +1 -1
  37. package/src/utils/misc/getLpUnderlyingTokenSource.js +2 -1
  38. package/src/utils/misc/getLpUnderlyingTokenSource.js.map +1 -1
  39. package/src/utils/sei/constants.js +8 -8
  40. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
  41. package/src/utils/solana/constants.d.ts +4 -2
  42. package/src/utils/solana/constants.js +5 -3
  43. package/src/utils/solana/constants.js.map +1 -1
  44. package/src/utils/solana/index.d.ts +0 -1
  45. package/src/utils/solana/index.js +0 -1
  46. package/src/utils/solana/index.js.map +1 -1
  47. package/src/utils/sui/constants.d.ts +1 -0
  48. package/src/utils/sui/constants.js +2 -1
  49. package/src/utils/sui/constants.js.map +1 -1
  50. package/src/utils/solana/getTokenAccountsByOwner.d.ts +0 -2
  51. package/src/utils/solana/getTokenAccountsByOwner.js +0 -33
  52. package/src/utils/solana/getTokenAccountsByOwner.js.map +0 -1
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.12.19",
3
+ "version": "0.12.21",
4
4
  "type": "commonjs",
5
5
  "types": "./src/index.d.ts",
6
6
  "peerDependencies": {
package/src/index.js CHANGED
@@ -120,6 +120,7 @@ const whalesmarket_1 = require("./plugins/whalesmarket");
120
120
  const futarchy_1 = require("./plugins/futarchy");
121
121
  const elixir_1 = require("./plugins/elixir");
122
122
  const moonwalk_1 = require("./plugins/moonwalk");
123
+ const bluefin_1 = require("./plugins/bluefin");
123
124
  var constants_1 = require("./plugins/tokens/constants");
124
125
  Object.defineProperty(exports, "walletTokensPlatform", { enumerable: true, get: function () { return constants_1.walletTokensPlatform; } });
125
126
  Object.defineProperty(exports, "walletNftsPlatform", { enumerable: true, get: function () { return constants_1.walletNftsPlatform; } });
@@ -233,6 +234,7 @@ exports.platforms = [
233
234
  ...futarchy_1.platforms,
234
235
  ...elixir_1.platforms,
235
236
  ...moonwalk_1.platforms,
237
+ ...bluefin_1.platforms,
236
238
  ];
237
239
  // JOBS //
238
240
  exports.jobs = [
@@ -329,6 +331,7 @@ exports.jobs = [
329
331
  ...futarchy_1.jobs,
330
332
  ...elixir_1.jobs,
331
333
  ...moonwalk_1.jobs,
334
+ ...bluefin_1.jobs,
332
335
  ];
333
336
  // FETCHERS //
334
337
  exports.fetchers = [
@@ -427,6 +430,7 @@ exports.fetchers = [
427
430
  ...futarchy_1.fetchers,
428
431
  ...elixir_1.fetchers,
429
432
  ...moonwalk_1.fetchers,
433
+ ...bluefin_1.fetchers,
430
434
  ];
431
435
  exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
432
436
  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;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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AAa;IAChB,GAAG,gBAAa;IAChB,GAAG,sBAAmB;IACtB,GAAG,yBAAsB;IACzB,GAAG,gBAAa;IAChB,GAAG,eAAY;IACf,GAAG,oBAAiB;IACpB,GAAG,iBAAc;IACjB,GAAG,2BAAsB;IACzB,GAAG,yBAAkB;IACrB,GAAG,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;IAChB,GAAG,gBAAa;IAChB,GAAG,eAAY;IACf,GAAG,kBAAe;IAClB,GAAG,kBAAe;IAClB,GAAG,mBAAgB;IACnB,GAAG,uBAAoB;IACvB,GAAG,mBAAgB;IACnB,GAAG,iBAAc;IACjB,GAAG,mBAAgB;CACpB,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,2CAIy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C,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;
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,66 @@
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 getObject_1 = require("../../utils/sui/getObject");
20
+ const getDynamicFieldObject_1 = require("../../utils/sui/getDynamicFieldObject");
21
+ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
22
+ const constants_2 = require("../../utils/sui/constants");
23
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
24
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
25
+ const client = (0, clients_1.getClientSui)();
26
+ const [bank, tokenPrice] = yield Promise.all([
27
+ (0, getObject_1.getObject)(client, constants_1.bankObjectId),
28
+ cache.getTokenPrice((0, portfolio_core_1.formatMoveTokenAddress)(constants_2.usdcSuiType), portfolio_core_1.NetworkId.sui),
29
+ ]);
30
+ if (!((_b = (_a = bank.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.accounts.fields.id.id) || !tokenPrice)
31
+ return [];
32
+ const account = yield (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
33
+ parentId: (_d = (_c = bank.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.fields.accounts.fields.id.id,
34
+ name: {
35
+ type: 'address',
36
+ value: owner,
37
+ },
38
+ });
39
+ if (!account)
40
+ return [];
41
+ const assets = [];
42
+ if (((_f = (_e = account.data) === null || _e === void 0 ? void 0 : _e.content) === null || _f === void 0 ? void 0 : _f.fields.value.fields.balance) &&
43
+ ((_h = (_g = account.data) === null || _g === void 0 ? void 0 : _g.content) === null || _h === void 0 ? void 0 : _h.fields.value.fields.balance) !== '0')
44
+ assets.push((0, tokenPriceToAssetToken_1.default)(constants_2.usdcSuiType, new bignumber_js_1.default((_k = (_j = account.data) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.fields.value.fields.balance)
45
+ .dividedBy(Math.pow(10, 9))
46
+ .toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice));
47
+ if (assets.length === 0)
48
+ return [];
49
+ return [
50
+ {
51
+ type: portfolio_core_1.PortfolioElementType.multiple,
52
+ label: 'Deposit',
53
+ networkId: portfolio_core_1.NetworkId.sui,
54
+ platformId: constants_1.platformId,
55
+ data: { assets },
56
+ value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
57
+ },
58
+ ];
59
+ });
60
+ const fetcher = {
61
+ id: `${constants_1.platformId}-bank`,
62
+ networkId: portfolio_core_1.NetworkId.sui,
63
+ executor,
64
+ };
65
+ exports.default = fetcher;
66
+ //# sourceMappingURL=bankFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bankFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluefin/bankFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,gEAAqC;AAGrC,2CAAuD;AACvD,iDAAmD;AACnD,yDAAsD;AACtD,iFAA8E;AAE9E,qGAA6E;AAC7E,yDAAwD;AAExD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC3C,IAAA,qBAAS,EAAO,MAAM,EAAE,wBAAY,CAAC;QACrC,KAAK,CAAC,aAAa,CAAC,IAAA,uCAAsB,EAAC,uBAAW,CAAC,EAAE,0BAAS,CAAC,GAAG,CAAC;KACxE,CAAC,CAAC;IAEH,IAAI,CAAC,CAAA,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE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,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC1D;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,OAAO;IACxB,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Platform } from '@sonarwatch/portfolio-core';
2
+ export declare const platformId = "bluefin";
3
+ export declare const platform: Platform;
4
+ export declare const aquaVault = "0x10d48e112b92c8af207c1850225284a7ca46bac1d935c4af4cf87ce29b121694";
5
+ export declare const bankObjectId = "0x39c65abefaee0a18ffa0e059a0074fcc9910216fa1a3550aa32c2e0ec1c03043";
6
+ export declare const poolKey = "pool";
7
+ export declare const perpetualIdsKey = "perpetualIdsKey";
8
+ export declare const metaUrl = "https://dapi.api.sui-prod.bluefin.io/meta";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.metaUrl = exports.perpetualIdsKey = exports.poolKey = exports.bankObjectId = exports.aquaVault = exports.platform = exports.platformId = void 0;
4
+ exports.platformId = 'bluefin';
5
+ exports.platform = {
6
+ id: exports.platformId,
7
+ name: 'Bluefin',
8
+ image: 'https://sonar.watch/img/platforms/bluefin.webp',
9
+ defiLlamaId: 'bluefin', // from https://defillama.com/docs/api
10
+ website: 'https://trade.bluefin.io/',
11
+ twitter: 'https://x.com/bluefinapp',
12
+ };
13
+ exports.aquaVault = '0x10d48e112b92c8af207c1850225284a7ca46bac1d935c4af4cf87ce29b121694';
14
+ exports.bankObjectId = '0x39c65abefaee0a18ffa0e059a0074fcc9910216fa1a3550aa32c2e0ec1c03043';
15
+ exports.poolKey = 'pool';
16
+ exports.perpetualIdsKey = 'perpetualIdsKey';
17
+ exports.metaUrl = 'https://dapi.api.sui-prod.bluefin.io/meta';
18
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluefin/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,gDAAgD;IACvD,WAAW,EAAE,SAAS,EAAE,sCAAsC;IAC9D,OAAO,EAAE,2BAA2B;IACpC,OAAO,EAAE,0BAA0B;CACpC,CAAC;AAEW,QAAA,SAAS,GACpB,oEAAoE,CAAC;AAE1D,QAAA,YAAY,GACvB,oEAAoE,CAAC;AAE1D,QAAA,OAAO,GAAG,MAAM,CAAC;AACjB,QAAA,eAAe,GAAG,iBAAiB,CAAC;AAEpC,QAAA,OAAO,GAAG,2CAA2C,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Platform } from '@sonarwatch/portfolio-core';
2
+ import { Fetcher } from '../../Fetcher';
3
+ import { Job } from '../../Job';
4
+ export declare const platforms: Platform[];
5
+ export declare const jobs: Job[];
6
+ export declare const fetchers: Fetcher[];
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fetchers = exports.jobs = exports.platforms = void 0;
7
+ const constants_1 = require("./constants");
8
+ const poolFetcher_1 = __importDefault(require("./poolFetcher"));
9
+ const poolJob_1 = __importDefault(require("./poolJob"));
10
+ const bankFetcher_1 = __importDefault(require("./bankFetcher"));
11
+ const positionFetcher_1 = __importDefault(require("./positionFetcher"));
12
+ const perpsJob_1 = __importDefault(require("./perpsJob"));
13
+ exports.platforms = [constants_1.platform];
14
+ exports.jobs = [poolJob_1.default, perpsJob_1.default];
15
+ exports.fetchers = [poolFetcher_1.default, bankFetcher_1.default, positionFetcher_1.default];
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluefin/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,gEAAwC;AACxC,wDAAgC;AAChC,gEAAwC;AACxC,wEAAgD;AAChD,0DAAkC;AAErB,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,iBAAO,EAAE,kBAAQ,CAAC,CAAC;AAClC,QAAA,QAAQ,GAAc,CAAC,qBAAW,EAAE,qBAAW,EAAE,yBAAe,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Job } from '../../Job';
2
+ declare const job: Job;
3
+ export default job;
@@ -0,0 +1,41 @@
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 axios_1 = __importDefault(require("axios"));
17
+ const constants_1 = require("./constants");
18
+ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
19
+ const res = yield axios_1.default
20
+ .get(constants_1.metaUrl, {
21
+ timeout: 3000,
22
+ })
23
+ .catch((err) => {
24
+ throw Error(`BLUEFIN_API ERR: ${err}`);
25
+ });
26
+ if (!res || !res.data) {
27
+ throw Error(`BLUEFIN_API NO RESPONSE`);
28
+ }
29
+ const perpIds = res.data.map((m) => m.perpetualAddress.id);
30
+ yield cache.setItem(constants_1.perpetualIdsKey, perpIds, {
31
+ prefix: constants_1.platformId,
32
+ networkId: portfolio_core_1.NetworkId.sui,
33
+ });
34
+ });
35
+ const job = {
36
+ id: `${constants_1.platformId}-perps`,
37
+ executor,
38
+ label: 'realtime',
39
+ };
40
+ exports.default = job;
41
+ //# sourceMappingURL=perpsJob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perpsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluefin/perpsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA0B;AAG1B,2CAAmE;AAGnE,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,GAAG,GAAG,MAAM,eAAK;SACpB,GAAG,CAAkB,mBAAO,EAAE;QAC7B,OAAO,EAAE,IAAI;KACd,CAAC;SACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,MAAM,KAAK,CAAC,oBAAoB,GAAG,EAAE,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEL,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QACtB,MAAM,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAC3D,MAAM,KAAK,CAAC,OAAO,CAAC,2BAAe,EAAE,OAAO,EAAE;QAC5C,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,QAAQ;IACR,KAAK,EAAE,UAAU;CAClB,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,72 @@
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 tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
19
+ const getDynamicFieldObject_1 = require("../../utils/sui/getDynamicFieldObject");
20
+ const clients_1 = require("../../utils/clients");
21
+ const constants_2 = require("../../utils/sui/constants");
22
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
23
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
24
+ const client = (0, clients_1.getClientSui)();
25
+ const [vault, tokenPrice] = yield Promise.all([
26
+ cache.getItem(constants_1.poolKey, {
27
+ prefix: constants_1.platformId,
28
+ networkId: portfolio_core_1.NetworkId.sui,
29
+ }),
30
+ cache.getTokenPrice((0, portfolio_core_1.formatMoveTokenAddress)(constants_2.usdcSuiType), portfolio_core_1.NetworkId.sui),
31
+ ]);
32
+ if (!vault || !tokenPrice)
33
+ return [];
34
+ const vaultAccount = yield (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
35
+ parentId: vault.users.fields.id.id,
36
+ name: {
37
+ type: 'address',
38
+ value: owner,
39
+ },
40
+ });
41
+ if (!((_b = (_a = vaultAccount.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields))
42
+ return [];
43
+ const assets = [];
44
+ if (((_d = (_c = vaultAccount.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.fields.value.fields.amount_locked) !== '0')
45
+ assets.push((0, tokenPriceToAssetToken_1.default)(constants_2.usdcSuiType, new bignumber_js_1.default((_f = (_e = vaultAccount.data) === null || _e === void 0 ? void 0 : _e.content) === null || _f === void 0 ? void 0 : _f.fields.value.fields.amount_locked)
46
+ .dividedBy(Math.pow(10, tokenPrice.decimals))
47
+ .toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice));
48
+ if (((_h = (_g = vaultAccount.data) === null || _g === void 0 ? void 0 : _g.content) === null || _h === void 0 ? void 0 : _h.fields.value.fields.pending_withdrawal) !== '0')
49
+ assets.push(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(constants_2.usdcSuiType, new bignumber_js_1.default((_k = (_j = vaultAccount.data) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.fields.value.fields.pending_withdrawal)
50
+ .dividedBy(Math.pow(10, tokenPrice.decimals))
51
+ .toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice)));
52
+ if (assets.length === 0)
53
+ return [];
54
+ return [
55
+ {
56
+ type: portfolio_core_1.PortfolioElementType.multiple,
57
+ label: 'LiquidityPool',
58
+ networkId: portfolio_core_1.NetworkId.sui,
59
+ platformId: constants_1.platformId,
60
+ data: { assets },
61
+ value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
62
+ name: vault.name,
63
+ },
64
+ ];
65
+ });
66
+ const fetcher = {
67
+ id: `${constants_1.platformId}-pool`,
68
+ networkId: portfolio_core_1.NetworkId.sui,
69
+ executor,
70
+ };
71
+ exports.default = fetcher;
72
+ //# sourceMappingURL=poolFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poolFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluefin/poolFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,gEAAqC;AAGrC,2CAAkD;AAElD,qGAA6E;AAC7E,iFAA8E;AAC9E,iDAAmD;AACnD,yDAAwD;AAExD,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC5C,KAAK,CAAC,OAAO,CAAQ,mBAAO,EAAE;YAC5B,MAAM,EAAE,sBAAU;YAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;SACzB,CAAC;QACF,KAAK,CAAC,aAAa,CAAC,IAAA,uCAAsB,EAAC,uBAAW,CAAC,EAAE,0BAAS,CAAC,GAAG,CAAC;KACxE,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,IAAI,CAAC,UAAU;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,YAAY,GAAG,MAAM,IAAA,6CAAqB,EAAe,MAAM,EAAE;QACrE,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;QAClC,IAAI,EAAE;YACJ,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,KAAK;SACb;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,CAAA,MAAA,MAAA,YAAY,CAAC,IAAI,0CAAE,OAAO,0CAAE,M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EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACzD,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,OAAO;IACxB,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Job } from '../../Job';
2
+ declare const job: Job;
3
+ export default job;
@@ -0,0 +1,33 @@
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
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
13
+ const constants_1 = require("./constants");
14
+ const getObject_1 = require("../../utils/sui/getObject");
15
+ const clients_1 = require("../../utils/clients");
16
+ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
17
+ var _a, _b, _c, _d;
18
+ const client = (0, clients_1.getClientSui)();
19
+ const vault = yield (0, getObject_1.getObject)(client, constants_1.aquaVault);
20
+ if (!((_b = (_a = vault.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields))
21
+ throw Error();
22
+ yield cache.setItem(constants_1.poolKey, (_d = (_c = vault.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.fields, {
23
+ prefix: constants_1.platformId,
24
+ networkId: portfolio_core_1.NetworkId.sui,
25
+ });
26
+ });
27
+ const job = {
28
+ id: `${constants_1.platformId}-pool`,
29
+ executor,
30
+ label: 'normal',
31
+ };
32
+ exports.default = job;
33
+ //# sourceMappingURL=poolJob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poolJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluefin/poolJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,2CAA6D;AAC7D,yDAAsD;AACtD,iDAAmD;AAGnD,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,MAAM,KAAK,GAAG,MAAM,IAAA,qBAAS,EAAQ,MAAM,EAAE,qBAAS,CAAC,CAAC;IAExD,IAAI,CAAC,CAAA,MAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAA;QAAE,MAAM,KAAK,EAAE,CAAC;IAEhD,MAAM,KAAK,CAAC,OAAO,CAAQ,mBAAO,EAAE,MAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,EAAE;QAC/D,MAAM,EAAE,sBAAU;QAClB,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 bignumber_js_1 = __importDefault(require("bignumber.js"));
17
+ const constants_1 = require("./constants");
18
+ const getDynamicFieldObject_1 = require("../../utils/sui/getDynamicFieldObject");
19
+ const clients_1 = require("../../utils/clients");
20
+ const multiGetObjects_1 = require("../../utils/sui/multiGetObjects");
21
+ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
22
+ const constants_2 = require("../../utils/sui/constants");
23
+ const perpsTtl = 20000;
24
+ const perps = new Map();
25
+ let lastPerpsUpdate = 0;
26
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
27
+ const client = (0, clients_1.getClientSui)();
28
+ // Refresh perps map
29
+ if (lastPerpsUpdate < Date.now() - perpsTtl) {
30
+ const perpIds = yield cache.getItem(constants_1.perpetualIdsKey, {
31
+ prefix: constants_1.platformId,
32
+ networkId: portfolio_core_1.NetworkId.sui,
33
+ });
34
+ if (perpIds) {
35
+ const perpetualsRes = yield (0, multiGetObjects_1.multiGetObjects)(client, perpIds);
36
+ perpetualsRes.forEach((p) => {
37
+ var _a, _b, _c, _d, _e;
38
+ if (((_a = p.data) === null || _a === void 0 ? void 0 : _a.objectId) && ((_c = (_b = p.data) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.fields))
39
+ perps.set(p.data.objectId, (_e = (_d = p.data) === null || _d === void 0 ? void 0 : _d.content) === null || _e === void 0 ? void 0 : _e.fields);
40
+ });
41
+ }
42
+ lastPerpsUpdate = Date.now();
43
+ }
44
+ const positions = yield Promise.all(Array.from(perps.values()).map((perp) => (0, getDynamicFieldObject_1.getDynamicFieldObject)(client, {
45
+ parentId: perp.positions.fields.id.id,
46
+ name: {
47
+ type: 'address',
48
+ value: owner,
49
+ },
50
+ })));
51
+ const tokenPrice = yield cache.getTokenPrice(constants_2.usdcSuiType, portfolio_core_1.NetworkId.sui);
52
+ if (!tokenPrice)
53
+ return [];
54
+ const elements = [];
55
+ positions.forEach((position) => {
56
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
57
+ if (position && position.error)
58
+ return;
59
+ if (!position || !((_d = (_c = (_b = (_a = position.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.fields.qPos))
60
+ return;
61
+ const perp = perps.get((_h = (_g = (_f = (_e = position.data) === null || _e === void 0 ? void 0 : _e.content) === null || _f === void 0 ? void 0 : _f.fields) === null || _g === void 0 ? void 0 : _g.value) === null || _h === void 0 ? void 0 : _h.fields.perpID);
62
+ if (!perp)
63
+ return;
64
+ const borrowedAssets = [];
65
+ const borrowedYields = [];
66
+ const suppliedAssets = [];
67
+ const suppliedYields = [];
68
+ const rewardAssets = [];
69
+ // Amount of margin/USDC user has locked into position.
70
+ const margin = new bignumber_js_1.default((_m = (_l = (_k = (_j = position.data) === null || _j === void 0 ? void 0 : _j.content) === null || _k === void 0 ? void 0 : _k.fields) === null || _l === void 0 ? void 0 : _l.value) === null || _m === void 0 ? void 0 : _m.fields.margin);
71
+ // position size in perp currency
72
+ const qPos = new bignumber_js_1.default((_r = (_q = (_p = (_o = position.data) === null || _o === void 0 ? void 0 : _o.content) === null || _p === void 0 ? void 0 : _p.fields) === null || _q === void 0 ? void 0 : _q.value) === null || _r === void 0 ? void 0 : _r.fields.qPos).dividedBy(Math.pow(10, 9));
73
+ // total cost of opening position in USDC
74
+ const oiOpen = new bignumber_js_1.default((_v = (_u = (_t = (_s = position.data) === null || _s === void 0 ? void 0 : _s.content) === null || _t === void 0 ? void 0 : _t.fields) === null || _u === void 0 ? void 0 : _u.value) === null || _v === void 0 ? void 0 : _v.fields.oiOpen);
75
+ const leverage = oiOpen.dividedBy(margin);
76
+ const oraclePrice = new bignumber_js_1.default(perp.priceOracle).dividedBy(Math.pow(10, 9));
77
+ const positionSizeUsd = qPos.multipliedBy(oraclePrice);
78
+ const avgEntryPrice = qPos.isGreaterThan(0)
79
+ ? oiOpen.dividedBy(qPos).dividedBy(Math.pow(10, 9))
80
+ : new bignumber_js_1.default(0);
81
+ let pnl;
82
+ if ((_z = (_y = (_x = (_w = position.data) === null || _w === void 0 ? void 0 : _w.content) === null || _x === void 0 ? void 0 : _x.fields) === null || _y === void 0 ? void 0 : _y.value) === null || _z === void 0 ? void 0 : _z.fields.isPosPositive) {
83
+ pnl = qPos.multipliedBy(oraclePrice.minus(avgEntryPrice));
84
+ }
85
+ else {
86
+ pnl = qPos.multipliedBy(avgEntryPrice.minus(oraclePrice));
87
+ }
88
+ if (positionSizeUsd.isPositive())
89
+ suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPrice.address, positionSizeUsd.toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice));
90
+ if (positionSizeUsd.times(leverage).isPositive())
91
+ borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPrice.address, positionSizeUsd.times(leverage).toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice));
92
+ if (!pnl.isZero())
93
+ rewardAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPrice.address, pnl.toNumber(), portfolio_core_1.NetworkId.sui, tokenPrice));
94
+ if (suppliedAssets.length === 0 &&
95
+ borrowedAssets.length === 0 &&
96
+ rewardAssets.length === 0)
97
+ return;
98
+ const { borrowedValue, suppliedValue, healthRatio, rewardValue } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets);
99
+ const value = positionSizeUsd.plus(pnl).toNumber();
100
+ const side = ((_3 = (_2 = (_1 = (_0 = position.data) === null || _0 === void 0 ? void 0 : _0.content) === null || _1 === void 0 ? void 0 : _1.fields) === null || _2 === void 0 ? void 0 : _2.value) === null || _3 === void 0 ? void 0 : _3.fields.isPosPositive)
101
+ ? 'Long'
102
+ : 'Short';
103
+ elements.push({
104
+ type: portfolio_core_1.PortfolioElementType.borrowlend,
105
+ networkId: portfolio_core_1.NetworkId.sui,
106
+ platformId: constants_1.platformId,
107
+ label: 'Leverage',
108
+ value,
109
+ name: `${perp.name} ${side} ${leverage.decimalPlaces(2)}x`,
110
+ data: {
111
+ borrowedAssets,
112
+ borrowedValue,
113
+ borrowedYields,
114
+ suppliedAssets,
115
+ suppliedValue,
116
+ suppliedYields,
117
+ collateralRatio: null,
118
+ rewardAssets,
119
+ rewardValue,
120
+ healthRatio,
121
+ value,
122
+ },
123
+ });
124
+ });
125
+ return elements;
126
+ });
127
+ const fetcher = {
128
+ id: `${constants_1.platformId}-position`,
129
+ networkId: portfolio_core_1.NetworkId.sui,
130
+ executor,
131
+ };
132
+ exports.default = fetcher;
133
+ //# sourceMappingURL=positionFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"positionFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/bluefin/positionFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AACpC,gEAAqC;AAGrC,2CAA0D;AAC1D,iFAA8E;AAC9E,iDAAmD;AAEnD,qEAAkE;AAClE,qGAA6E;AAC7E,yDAAwD;AAExD,MAAM,QAAQ,GAAG,KAAK,CAAC;AACvB,MAAM,KAAK,GAA6B,IAAI,GAAG,EAAE,CAAC;AAClD,IA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