@sonarwatch/portfolio-plugins 0.11.205 → 0.11.207

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.205",
3
+ "version": "0.11.207",
4
4
  "type": "commonjs",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
@@ -41,7 +41,7 @@
41
41
  "web3-v1": "npm:web3@^1.5.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@sonarwatch/portfolio-core": "0.11.205"
44
+ "@sonarwatch/portfolio-core": "0.11.207"
45
45
  },
46
46
  "main": "./src/index.js",
47
47
  "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;
@@ -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;
@@ -11,4 +11,4 @@ export declare const preMarketPriceKey = "premarketPrice";
11
11
  export declare const airdropUrl = "https://airdrop.drift.trade/eligibility/";
12
12
  export declare const distributorPid = "E7HtfkEMhmn9uwL7EFNydcXBWy5WCYN1vFmKKjipEH1x";
13
13
  export declare const driftDecimals = 6;
14
- export declare const driftMint: undefined;
14
+ export declare const driftMint = "DriFtupJYLTosbwoN8koMbEYSx54aFAVLddWsbksjwg7";
@@ -19,5 +19,5 @@ exports.preMarketPriceKey = 'premarketPrice';
19
19
  exports.airdropUrl = 'https://airdrop.drift.trade/eligibility/';
20
20
  exports.distributorPid = 'E7HtfkEMhmn9uwL7EFNydcXBWy5WCYN1vFmKKjipEH1x';
21
21
  exports.driftDecimals = 6;
22
- exports.driftMint = undefined;
22
+ exports.driftMint = 'DriFtupJYLTosbwoN8koMbEYSx54aFAVLddWsbksjwg7';
23
23
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,YAAY,GAAG,OAAO,CAAC;AACvB,QAAA,aAAa,GAAG,6CAA6C,CAAC;AAC9D,QAAA,eAAe,GAAG,0BAA0B,CAAC;AAC7C,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,oBAAY;IAClB,KAAK,EAAE,qBAAa;IACpB,WAAW,EAAE,OAAO;IACpB,OAAO,EAAE,uBAAe;CACzB,CAAC;AACW,QAAA,iBAAiB,GAAG,GAAG,kBAAU,cAAc,CAAC;AAEhD,QAAA,YAAY,GAAG,IAAI,mBAAS,CACvC,6CAA6C,CAC9C,CAAC;AAEW,QAAA,iBAAiB,GAAG,gBAAgB,CAAC;AAErC,QAAA,UAAU,GAAG,0CAA0C,CAAC;AACxD,QAAA,cAAc,GAAG,8CAA8C,CAAC;AAChE,QAAA,aAAa,GAAG,CAAC,CAAC;AAClB,QAAA,SAAS,GAAG,SAAS,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,YAAY,GAAG,OAAO,CAAC;AACvB,QAAA,aAAa,GAAG,6CAA6C,CAAC;AAC9D,QAAA,eAAe,GAAG,0BAA0B,CAAC;AAC7C,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,oBAAY;IAClB,KAAK,EAAE,qBAAa;IACpB,WAAW,EAAE,OAAO;IACpB,OAAO,EAAE,uBAAe;CACzB,CAAC;AACW,QAAA,iBAAiB,GAAG,GAAG,kBAAU,cAAc,CAAC;AAEhD,QAAA,YAAY,GAAG,IAAI,mBAAS,CACvC,6CAA6C,CAC9C,CAAC;AAEW,QAAA,iBAAiB,GAAG,gBAAgB,CAAC;AAErC,QAAA,UAAU,GAAG,0CAA0C,CAAC;AACxD,QAAA,cAAc,GAAG,8CAA8C,CAAC;AAChE,QAAA,aAAa,GAAG,CAAC,CAAC;AAClB,QAAA,SAAS,GAAG,8CAA8C,CAAC"}
@@ -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,a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AAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACtD,IAAI,EAAE;gBACJ,WAAW;aACZ;SACF;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,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
+ };
@@ -54,30 +54,30 @@ function sushiV3PairToUniV2(pair) {
54
54
  }
55
55
  function getV3PairsAddresses(url, length = 300) {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
- const query = (0, graphql_request_1.gql) `
58
- {
59
- pools(
60
- orderBy: totalValueLockedUSD
61
- first: ${length}
62
- orderDirection: desc
63
- where: { volumeUSD_not: "0", liquidity_not: "0" }
64
- ) {
65
- id
66
- token0Price
67
- token1Price
68
- liquidity
69
- token0 {
70
- id
71
- totalSupply
72
- decimals
73
- }
74
- token1 {
75
- id
76
- totalSupply
77
- decimals
78
- }
79
- }
80
- }
57
+ const query = (0, graphql_request_1.gql) `
58
+ {
59
+ pools(
60
+ orderBy: totalValueLockedUSD
61
+ first: ${length}
62
+ orderDirection: desc
63
+ where: { volumeUSD_not: "0", liquidity_not: "0" }
64
+ ) {
65
+ id
66
+ token0Price
67
+ token1Price
68
+ liquidity
69
+ token0 {
70
+ id
71
+ totalSupply
72
+ decimals
73
+ }
74
+ token1 {
75
+ id
76
+ totalSupply
77
+ decimals
78
+ }
79
+ }
80
+ }
81
81
  `;
82
82
  const res = yield (0, graphql_request_1.default)(url, query);
83
83
  const pools = res.pools;
@@ -40,28 +40,28 @@ function getPairKey(version) {
40
40
  exports.getPairKey = getPairKey;
41
41
  function getPairsV2FromTheGraph(url, length = 300) {
42
42
  return __awaiter(this, void 0, void 0, function* () {
43
- const query = (0, graphql_request_1.gql) `
44
- {
45
- pairs(
46
- orderBy: reserveUSD
47
- first: ${length}
48
- orderDirection: desc
49
- where: { trackedReserveETH_not: "0" }
50
- ) {
51
- id
52
- reserve0
53
- reserve1
54
- totalSupply
55
- token0 {
56
- id
57
- decimals
58
- }
59
- token1 {
60
- id
61
- decimals
62
- }
63
- }
64
- }
43
+ const query = (0, graphql_request_1.gql) `
44
+ {
45
+ pairs(
46
+ orderBy: reserveUSD
47
+ first: ${length}
48
+ orderDirection: desc
49
+ where: { trackedReserveETH_not: "0" }
50
+ ) {
51
+ id
52
+ reserve0
53
+ reserve1
54
+ totalSupply
55
+ token0 {
56
+ id
57
+ decimals
58
+ }
59
+ token1 {
60
+ id
61
+ decimals
62
+ }
63
+ }
64
+ }
65
65
  `;
66
66
  const res = yield (0, graphql_request_1.default)(url, query);
67
67
  const pairs = res.pairs;
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.poolQueryMsg = exports.minterQueryMsg = exports.tokenInfoQueryMsg = exports.infoQueryMsg = void 0;
4
- exports.infoQueryMsg = JSON.parse(`{
5
- "info": {}
4
+ exports.infoQueryMsg = JSON.parse(`{
5
+ "info": {}
6
6
  }`);
7
- exports.tokenInfoQueryMsg = JSON.parse(`{
8
- "token_info": {}
7
+ exports.tokenInfoQueryMsg = JSON.parse(`{
8
+ "token_info": {}
9
9
  }`);
10
- exports.minterQueryMsg = JSON.parse(`{
11
- "minter": {}
10
+ exports.minterQueryMsg = JSON.parse(`{
11
+ "minter": {}
12
12
  }`);
13
- exports.poolQueryMsg = JSON.parse(`{
14
- "pool": {}
13
+ exports.poolQueryMsg = JSON.parse(`{
14
+ "pool": {}
15
15
  }`);
16
16
  //# sourceMappingURL=constants.js.map
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  function getQueryBalanceByOwner(owner) {
4
- return JSON.parse(`{
5
- "balance": {
6
- "address": "${owner}"
7
- }
4
+ return JSON.parse(`{
5
+ "balance": {
6
+ "address": "${owner}"
7
+ }
8
8
  }`);
9
9
  }
10
10
  exports.default = getQueryBalanceByOwner;