@sonarwatch/portfolio-plugins 0.11.77 → 0.11.79

Sign up to get free protection for your applications and to get access to all the features.
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.77",
3
+ "version": "0.11.79",
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.77"
44
+ "@sonarwatch/portfolio-core": "0.11.79"
45
45
  },
46
46
  "main": "./src/index.js",
47
47
  "types": "./src/index.d.ts"
@@ -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;
@@ -23,27 +23,52 @@ const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo"
23
23
  const thirtyDays = 30 * 1000 * 60 * 60 * 24;
24
24
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
25
25
  const client = (0, clients_1.getClientSolana)();
26
- const lpAccount = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, structs_1.lpAccountStruct, (0, helpers_1.getLpAccountPda)(owner));
27
- if (!lpAccount)
28
- return [];
29
- if (lpAccount && lpAccount.liquidity.isZero())
30
- return [];
26
+ const oldLpAccount = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, structs_1.lpAccountStruct, (0, helpers_1.getOldLpAccountPda)(owner));
27
+ let id = 0;
28
+ const lpPositions = [];
29
+ let parsedAccount;
30
+ do {
31
+ const accountPubKeys = (0, helpers_1.getLpPositionsPdas)(owner, id, id + 10);
32
+ parsedAccount = yield (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.lpPositionStruct, accountPubKeys);
33
+ lpPositions.push(...parsedAccount);
34
+ id += 10;
35
+ } while (parsedAccount[parsedAccount.length]);
31
36
  const usdcTokenPrice = yield cache.getTokenPrice(solana_1.usdcSolanaMint, portfolio_core_1.NetworkId.solana);
32
- const unlockStartedAt = new Date(lpAccount.lastAddLiquidityTimestamp.times(1000).toNumber());
33
- const unlockingAt = new Date(unlockStartedAt.getTime() + thirtyDays);
34
- const asset = Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(solana_1.usdcSolanaMint, lpAccount.liquidity.dividedBy(Math.pow(10, 6)).toNumber(), portfolio_core_1.NetworkId.solana, usdcTokenPrice)), { attributes: {
35
- lockedUntil: unlockingAt.getTime(),
36
- } });
37
- return [
38
- {
37
+ const elements = [];
38
+ if (oldLpAccount && !oldLpAccount.liquidity.isZero()) {
39
+ const unlockStartedAt = new Date(oldLpAccount.lastAddLiquidityTimestamp.times(1000).toNumber());
40
+ const unlockingAt = new Date(unlockStartedAt.getTime() + thirtyDays);
41
+ const asset = Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(solana_1.usdcSolanaMint, oldLpAccount.liquidity.dividedBy(Math.pow(10, 6)).toNumber(), portfolio_core_1.NetworkId.solana, usdcTokenPrice)), { attributes: {
42
+ lockedUntil: unlockingAt.getTime(),
43
+ tags: ['depreciated'],
44
+ } });
45
+ elements.push({
39
46
  type: portfolio_core_1.PortfolioElementType.multiple,
40
47
  label: 'Deposit',
41
48
  networkId: portfolio_core_1.NetworkId.solana,
42
49
  platformId: constants_1.platformId,
43
50
  data: { assets: [asset] },
44
51
  value: asset.value,
45
- },
46
- ];
52
+ });
53
+ }
54
+ for (const lpPosition of lpPositions) {
55
+ if (lpPosition && !lpPosition.liquidity.isZero()) {
56
+ const unlockStartedAt = new Date(lpPosition.maturity.times(1000).toNumber());
57
+ const unlockingAt = new Date(unlockStartedAt.getTime() + thirtyDays);
58
+ const asset = Object.assign(Object.assign({}, (0, tokenPriceToAssetToken_1.default)(solana_1.usdcSolanaMint, lpPosition.liquidity.dividedBy(Math.pow(10, 6)).toNumber(), portfolio_core_1.NetworkId.solana, usdcTokenPrice)), { attributes: {
59
+ lockedUntil: unlockingAt.getTime(),
60
+ } });
61
+ elements.push({
62
+ type: portfolio_core_1.PortfolioElementType.multiple,
63
+ label: 'Deposit',
64
+ networkId: portfolio_core_1.NetworkId.solana,
65
+ platformId: constants_1.platformId,
66
+ data: { assets: [asset] },
67
+ value: asset.value,
68
+ });
69
+ }
70
+ }
71
+ return elements;
47
72
  });
48
73
  const fetcher = {
49
74
  id: `${constants_1.platformId}-deposits`,
@@ -1 +1 @@
1
- {"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAA6E;AAG7E,2CAAyC;AACzC,iDAAsD;AACtD,+CAAoD;AACpD,uCAA4C;AAC5C,qGAA6E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AM,EAAE,CAAC,KAAK,CAAC,EAAE;YACzB,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AAGpC,2CAAyC;AACzC,iDAAsD;AACtD,+CAG4B;AAC5B,uCAA8D;AAC9D,qGAA6E;AAC7E,uCAAmE;AACnE,kFAA+E;AAE/E,MAAM,UAAU,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE5C,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,YAAY,GAAG,MAAM,IAAA,2CAAoB,EAC7C,MAAM,EACN,yBAAe,EACf,IAAA,4BAAkB,EAAC,KAAK,CAAC,CAC1B,CAAC;IAEF,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,IAAI,aAAa,CAAC;IAClB,GAAG,CAAC;QACF,MAAM,cAAc,GAAG,IAAA,4BAAkB,EAAC,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9D,aAAa,GAAG,MAAM,IAAA,sCAA6B,EACjD,MAAM,EACN,0BAAgB,EAChB,cAAc,CACf,CAAC;QACF,WAAW,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;QACnC,EAAE,IAAI,EAAE,CAAC;IACX,CAAC,QAAQ,aAAa,CAAC,a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CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAC3C,CAAC;YACF,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC;YACrE,MAAM,KAAK,mCACN,IAAA,gCAAsB,EACvB,uBAAc,EACd,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,SAAA,EAAE,EAAI,CAAC,CAAA,CAAC,CAAC,QAAQ,EAAE,EAClD,0BAAS,CAAC,MAAM,EAChB,cAAc,CACf,KACD,UAAU,EAAE;oBACV,WAAW,EAAE,WAAW,CAAC,OAAO,EAAE;iBACnC,GACF,CAAC;YACF,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,qCAAoB,CAAC,QAAQ;gBACnC,KAAK,EAAE,SAAS;gBAChB,SAAS,EAAE,0BAAS,CAAC,MAAM;gBAC3B,UAAU,EAAV,sBAAU;gBACV,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE;gBACzB,KAAK,EAAE,KAAK,CAAC,KAAK;aACnB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -1,2 +1,3 @@
1
1
  import { GetProgramAccountsFilter } from '@solana/web3.js';
2
2
  export declare const lpAccountFilter: (owner: string) => GetProgramAccountsFilter[];
3
+ export declare const lpPositionFilter: (owner: string) => GetProgramAccountsFilter[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lpAccountFilter = void 0;
3
+ exports.lpPositionFilter = exports.lpAccountFilter = void 0;
4
4
  const structs_1 = require("./structs");
5
5
  const lpAccountFilter = (owner) => [
6
6
  {
@@ -14,4 +14,16 @@ const lpAccountFilter = (owner) => [
14
14
  },
15
15
  ];
16
16
  exports.lpAccountFilter = lpAccountFilter;
17
+ const lpPositionFilter = (owner) => [
18
+ {
19
+ memcmp: {
20
+ offset: 72,
21
+ bytes: owner,
22
+ },
23
+ },
24
+ {
25
+ dataSize: structs_1.lpPositionStruct.byteSize,
26
+ },
27
+ ];
28
+ exports.lpPositionFilter = lpPositionFilter;
17
29
  //# sourceMappingURL=filters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/filters.ts"],"names":[],"mappings":";;;AACA,uCAA4C;AAErC,MAAM,eAAe,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC5E;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,yBAAe,CAAC,QAAQ;KACnC;CACF,CAAC;AAVW,QAAA,eAAe,mBAU1B"}
1
+ {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/filters.ts"],"names":[],"mappings":";;;AACA,uCAA8D;AAEvD,MAAM,eAAe,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC5E;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,yBAAe,CAAC,QAAQ;KACnC;CACF,CAAC;AAVW,QAAA,eAAe,mBAU1B;AAEK,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC7E;QACE,MAAM,EAAE;YACN,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,KAAK;SACb;KACF;IACD;QACE,QAAQ,EAAE,0BAAgB,CAAC,QAAQ;KACpC;CACF,CAAC;AAVW,QAAA,gBAAgB,oBAU3B"}
@@ -1,2 +1,3 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
- export declare function getLpAccountPda(owner: string): PublicKey;
2
+ export declare function getOldLpAccountPda(owner: string): PublicKey;
3
+ export declare function getLpPositionsPdas(owner: string, start: number, end: number): PublicKey[];
@@ -1,14 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getLpAccountPda = void 0;
3
+ exports.getLpPositionsPdas = exports.getOldLpAccountPda = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
+ const bn_js_1 = require("bn.js");
5
6
  const constants_1 = require("./constants");
6
- function getLpAccountPda(owner) {
7
+ function getOldLpAccountPda(owner) {
7
8
  return web3_js_1.PublicKey.findProgramAddressSync([
8
9
  Buffer.from('lp_account', 'utf-8'),
9
10
  new web3_js_1.PublicKey('82dGS7Jt4Km8ZgwZVRsJ2V6vPXEhVdgDaMP7cqPGG1TW').toBuffer(),
10
11
  new web3_js_1.PublicKey(owner).toBuffer(),
11
12
  ], constants_1.programId)[0];
12
13
  }
13
- exports.getLpAccountPda = getLpAccountPda;
14
+ exports.getOldLpAccountPda = getOldLpAccountPda;
15
+ function getLpPositionsPdas(owner, start, end) {
16
+ const keys = [];
17
+ for (let i = start; i < end; i++) {
18
+ keys.push(web3_js_1.PublicKey.findProgramAddressSync([
19
+ Buffer.from('lp_position', 'utf-8'),
20
+ new web3_js_1.PublicKey('82dGS7Jt4Km8ZgwZVRsJ2V6vPXEhVdgDaMP7cqPGG1TW').toBuffer(),
21
+ new web3_js_1.PublicKey(owner).toBuffer(),
22
+ new bn_js_1.BN(i).toArrayLike(Buffer, 'le', 8),
23
+ ], constants_1.programId)[0]);
24
+ }
25
+ return keys;
26
+ }
27
+ exports.getLpPositionsPdas = getLpPositionsPdas;
14
28
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/helpers.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,2CAAwC;AAExC,SAAgB,eAAe,CAAC,KAAa;IAC3C,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC;QAClC,IAAI,mBAAS,CAAC,8CAA8C,CAAC,CAAC,QAAQ,EAAE;QACxE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;KAChC,EACD,qBAAS,CACV,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AATD,0CASC"}
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/helpers.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,iCAA2B;AAC3B,2CAAwC;AAExC,SAAgB,kBAAkB,CAAC,KAAa;IAC9C,OAAO,mBAAS,CAAC,sBAAsB,CACrC;QACE,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC;QAClC,IAAI,mBAAS,CAAC,8CAA8C,CAAC,CAAC,QAAQ,EAAE;QACxE,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;KAChC,EACD,qBAAS,CACV,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AATD,gDASC;AAED,SAAgB,kBAAkB,CAChC,KAAa,EACb,KAAa,EACb,GAAW;IAEX,MAAM,IAAI,GAAgB,EAAE,CAAC;IAC7B,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI,CACP,mBAAS,CAAC,sBAAsB,CAC9B;YACE,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC;YACnC,IAAI,mBAAS,CACX,8CAA8C,CAC/C,CAAC,QAAQ,EAAE;YACZ,IAAI,mBAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;YAC/B,IAAI,UAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;SACvC,EACD,qBAAS,CACV,CAAC,CAAC,CAAC,CACL,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAtBD,gDAsBC"}
@@ -14,3 +14,15 @@ export type LpAccount = {
14
14
  padding: number[];
15
15
  };
16
16
  export declare const lpAccountStruct: BeetStruct<LpAccount, Partial<LpAccount>>;
17
+ export type LpPosition = {
18
+ buffer: Buffer;
19
+ id: BigNumber;
20
+ liquidity: BigNumber;
21
+ shares: BigNumber;
22
+ maturity: BigNumber;
23
+ exchange: PublicKey;
24
+ owner: PublicKey;
25
+ bump: number;
26
+ padding: number[];
27
+ };
28
+ export declare const lpPositionStruct: BeetStruct<LpPosition, Partial<LpPosition>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lpAccountStruct = void 0;
3
+ exports.lpPositionStruct = exports.lpAccountStruct = void 0;
4
4
  const beet_1 = require("@metaplex-foundation/beet");
5
5
  const beet_solana_1 = require("@metaplex-foundation/beet-solana");
6
6
  const solana_1 = require("../../utils/solana");
@@ -15,4 +15,15 @@ exports.lpAccountStruct = new beet_1.BeetStruct([
15
15
  ['bump', beet_1.u8],
16
16
  ['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 7)],
17
17
  ], (args) => args);
18
+ exports.lpPositionStruct = new beet_1.BeetStruct([
19
+ ['buffer', (0, solana_1.blob)(8)],
20
+ ['id', solana_1.u64],
21
+ ['liquidity', solana_1.u64],
22
+ ['shares', solana_1.u64],
23
+ ['maturity', solana_1.u64],
24
+ ['exchange', beet_solana_1.publicKey],
25
+ ['owner', beet_solana_1.publicKey],
26
+ ['bump', beet_1.u8],
27
+ ['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 7)],
28
+ ], (args) => args);
18
29
  //# sourceMappingURL=structs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/structs.ts"],"names":[],"mappings":";;;AAAA,oDAImC;AACnC,kEAA6D;AAG7D,+CAA+C;AAclC,QAAA,eAAe,GAAG,IAAI,iBAAU,CAC3C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,WAAW,EAAE,YAAG,CAAC;IAClB,CAAC,QAAQ,EAAE,YAAG,CAAC;IACf,CAAC,2BAA2B,EAAE,YAAG,CAAC;IAClC,CAAC,UAAU,EAAE,uBAAS,CAAC;IACvB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,UAAU,EAAE,uBAAS,CAAC;IACvB,CAAC,MAAM,EAAE,SAAE,CAAC;IACZ,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;CAC1C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAiB,CAC5B,CAAC"}
1
+ {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/structs.ts"],"names":[],"mappings":";;;AAAA,oDAImC;AACnC,kEAA6D;AAG7D,+CAA+C;AAclC,QAAA,eAAe,GAAG,IAAI,iBAAU,CAC3C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,WAAW,EAAE,YAAG,CAAC;IAClB,CAAC,QAAQ,EAAE,YAAG,CAAC;IACf,CAAC,2BAA2B,EAAE,YAAG,CAAC;IAClC,CAAC,UAAU,EAAE,uBAAS,CAAC;IACvB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,UAAU,EAAE,uBAAS,CAAC;IACvB,CAAC,MAAM,EAAE,SAAE,CAAC;IACZ,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;CAC1C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAiB,CAC5B,CAAC;AAcW,QAAA,gBAAgB,GAAG,IAAI,iBAAU,CAC5C;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,IAAI,EAAE,YAAG,CAAC;IACX,CAAC,WAAW,EAAE,YAAG,CAAC;IAClB,CAAC,QAAQ,EAAE,YAAG,CAAC;IACf,CAAC,UAAU,EAAE,YAAG,CAAC;IACjB,CAAC,UAAU,EAAE,uBAAS,CAAC;IACvB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,MAAM,EAAE,SAAE,CAAC;IACZ,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;CAC1C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAkB,CAC7B,CAAC"}
@@ -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;