@sonarwatch/portfolio-plugins 0.11.222 → 0.11.223

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.222",
3
+ "version": "0.11.223",
4
4
  "type": "commonjs",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
@@ -42,7 +42,7 @@
42
42
  "web3-v1": "npm:web3@^1.5.0"
43
43
  },
44
44
  "peerDependencies": {
45
- "@sonarwatch/portfolio-core": "0.11.222"
45
+ "@sonarwatch/portfolio-core": "0.11.223"
46
46
  },
47
47
  "main": "./src/index.js",
48
48
  "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;
@@ -16,6 +16,9 @@ const solana_1 = require("../../utils/solana");
16
16
  const structs_1 = require("./structs");
17
17
  const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
18
18
  const client = (0, clients_1.getClientSolana)();
19
+ const usdcTokenPrice = yield cache.getTokenPrice(constants_1.usdcMint, portfolio_core_1.NetworkId.solana);
20
+ if (!usdcTokenPrice)
21
+ return;
19
22
  const accounts = yield (0, solana_1.getParsedProgramAccounts)(client, structs_1.swapStruct, constants_1.ammPid, [
20
23
  {
21
24
  dataSize: structs_1.swapStruct.byteSize,
@@ -23,8 +26,20 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
23
26
  ]);
24
27
  if (accounts.length === 0)
25
28
  return;
29
+ // Markets
30
+ const marketAddresses = accounts.map((a) => a.market);
31
+ const marketAccounts = (yield (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.marketStruct, marketAddresses)).filter((a) => a !== null);
32
+ const marketAccountsMap = new Map();
33
+ marketAccounts.forEach((a) => {
34
+ marketAccountsMap.set(a.pubkey.toString(), a);
35
+ });
36
+ // Token Swap
26
37
  const tokenSwapAddresses = accounts.map((a) => a.underlyingSwap);
27
38
  const tokenSwapAccounts = (yield (0, solana_1.getParsedMultipleAccountsInfo)(client, structs_1.tokenSwapStruct, tokenSwapAddresses)).filter((a) => a !== null);
39
+ const tokenSwapAccountsMap = new Map();
40
+ tokenSwapAccounts.forEach((a) => {
41
+ tokenSwapAccountsMap.set(a.pubkey.toString(), a);
42
+ });
28
43
  // Token accounts
29
44
  const tokenAccountAddresses = tokenSwapAccounts
30
45
  .map((a) => [a.tokenAccountA, a.tokenAccountB])
@@ -47,41 +62,51 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
47
62
  return;
48
63
  mintAccountsMap.set(a.pubkey.toString(), a);
49
64
  });
50
- const tokenPrices = yield cache.getTokenPricesAsMap(tokenSwapAccounts.map((a) => a.tokenPool.toString()), portfolio_core_1.NetworkId.solana);
51
65
  const sources = [];
52
- for (let i = 0; i < tokenSwapAccounts.length; i++) {
53
- const acc = tokenSwapAccounts[i];
54
- const poolMint = mintAccountsMap.get(acc.tokenPool.toString());
66
+ for (let i = 0; i < accounts.length; i++) {
67
+ const acc = accounts[i];
68
+ const tsAcc = tokenSwapAccountsMap.get(acc.underlyingSwap.toString());
69
+ const marketAcc = marketAccountsMap.get(acc.market.toString());
70
+ if (!marketAcc || !tsAcc)
71
+ continue;
72
+ const poolMint = mintAccountsMap.get(tsAcc.tokenPool.toString());
55
73
  if (!poolMint)
56
74
  continue;
57
- const mintA = mintAccountsMap.get(acc.mintA.toString());
58
- const mintB = mintAccountsMap.get(acc.mintB.toString());
75
+ const mintA = mintAccountsMap.get(tsAcc.mintA.toString());
76
+ const mintB = mintAccountsMap.get(tsAcc.mintB.toString());
59
77
  if (!mintA || !mintB)
60
78
  continue;
61
- const tokenAccountA = tokenAccountsMap.get(acc.tokenAccountA.toString());
62
- const tokenAccountB = tokenAccountsMap.get(acc.tokenAccountB.toString());
79
+ const tokenAccountA = tokenAccountsMap.get(tsAcc.tokenAccountA.toString());
80
+ const tokenAccountB = tokenAccountsMap.get(tsAcc.tokenAccountB.toString());
63
81
  if (!tokenAccountA || !tokenAccountB)
64
82
  continue;
65
83
  if (tokenAccountA.amount.isZero())
66
84
  continue;
67
85
  if (tokenAccountB.amount.isZero())
68
86
  continue;
69
- const tokenPrice = tokenPrices.get(acc.tokenPool.toString());
70
- if (!tokenPrice)
71
- continue;
72
- const totalAmount = tokenAccountA.amount.plus(tokenAccountB.amount);
73
- const priceA = totalAmount
74
- .plus(tokenAccountA.amount)
75
- .div(totalAmount)
76
- .minus(1)
77
- .times(tokenPrice === null || tokenPrice === void 0 ? void 0 : tokenPrice.price)
87
+ let shareA = tokenAccountB.amount
88
+ .div(tokenAccountA.amount.plus(tokenAccountB.amount))
89
+ .times(usdcTokenPrice.price)
78
90
  .toNumber();
79
- const priceB = totalAmount
80
- .plus(tokenAccountB.amount)
81
- .div(totalAmount)
82
- .minus(1)
83
- .times(tokenPrice === null || tokenPrice === void 0 ? void 0 : tokenPrice.price)
91
+ let shareB = tokenAccountA.amount
92
+ .div(tokenAccountA.amount.plus(tokenAccountB.amount))
93
+ .times(usdcTokenPrice.price)
84
94
  .toNumber();
95
+ if (marketAcc.outcome === structs_1.Outcome.Yes) {
96
+ shareA = 1;
97
+ shareB = 0;
98
+ }
99
+ if (marketAcc.outcome === structs_1.Outcome.No) {
100
+ shareA = 0;
101
+ shareB = 1;
102
+ }
103
+ if (marketAcc.outcome === structs_1.Outcome.Invalid) {
104
+ shareA = 0.5;
105
+ shareB = 0.5;
106
+ }
107
+ const liquidityNameA = mintA.pubkey.toString() === marketAcc.yesToken.toString()
108
+ ? 'Bet - YES'
109
+ : 'Bet - NO';
85
110
  const sourceA = {
86
111
  address: mintA.pubkey.toString(),
87
112
  decimals: mintA.decimals,
@@ -90,10 +115,22 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
90
115
  platformId: constants_1.platformId,
91
116
  timestamp: Date.now(),
92
117
  elementName: 'Hedgehog AMM',
93
- liquidityName: 'Bet - YES',
118
+ liquidityName: liquidityNameA,
94
119
  weight: 1,
95
- price: priceA,
120
+ price: shareA * usdcTokenPrice.price,
121
+ underlyings: [
122
+ {
123
+ address: constants_1.usdcMint,
124
+ amountPerLp: shareA,
125
+ decimals: constants_1.usdcDecimals,
126
+ networkId: portfolio_core_1.NetworkId.solana,
127
+ price: usdcTokenPrice.price,
128
+ },
129
+ ],
96
130
  };
131
+ const liquidityNameB = mintB.pubkey.toString() === marketAcc.yesToken.toString()
132
+ ? 'Bet - YES'
133
+ : 'Bet - NO';
97
134
  const sourceB = {
98
135
  address: mintB.pubkey.toString(),
99
136
  decimals: mintB.decimals,
@@ -102,9 +139,18 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
102
139
  platformId: constants_1.platformId,
103
140
  timestamp: Date.now(),
104
141
  elementName: 'Hedgehog AMM',
105
- liquidityName: 'Bet - YES',
142
+ liquidityName: liquidityNameB,
106
143
  weight: 1,
107
- price: priceB,
144
+ price: shareB * usdcTokenPrice.price,
145
+ underlyings: [
146
+ {
147
+ address: constants_1.usdcMint,
148
+ amountPerLp: shareB,
149
+ decimals: constants_1.usdcDecimals,
150
+ networkId: portfolio_core_1.NetworkId.solana,
151
+ price: usdcTokenPrice.price,
152
+ },
153
+ ],
108
154
  };
109
155
  sources.push(sourceA, sourceB);
110
156
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ammJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/hedgehog/ammJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAyE;AAGzE,2CAAiD;AACjD,iDAAsD;AACtD,+CAQ4B;AAC5B,uCAAmE;AAEnE,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAwB,EAAC,MAAM,EAAE,oBAAU,EAAE,kBAAM,EAAE;QAC1E;YACE,QAAQ,EAAE,oBAAU,CAAC,QAAQ;SAC9B;KACF,CAAC,CAAC;IACH,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAClC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IACjE,MAAM,iBAAiB,GAAG,CACxB,MAAM,IAAA,sCAA6B,EACjC,MAAM,EACN,yBAAe,EACf,kBAAkB,CACnB,CACF,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAA+B,CAAC;IAE1D,iBAAiB;IACjB,MAAM,qBAAqB,GAAG,iBAAiB;SAC5C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,aA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cAAc,CAAC,KAAK;YACpC,WAAW,EAAE;gBACX;oBACE,OAAO,EAAE,oBAAQ;oBACjB,WAAW,EAAE,MAAM;oBACnB,QAAQ,EAAE,wBAAY;oBACtB,SAAS,EAAE,0BAAS,CAAC,MAAM;oBAC3B,KAAK,EAAE,cAAc,CAAC,KAAK;iBAC5B;aACF;SACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,MAAM;IACvB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
@@ -4,3 +4,5 @@ export declare const platformId = "hedgehog";
4
4
  export declare const platform: Platform;
5
5
  export declare const ammPid: PublicKey;
6
6
  export declare const swapPid: PublicKey;
7
+ export declare const usdcMint = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
8
+ export declare const usdcDecimals = 6;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.swapPid = exports.ammPid = exports.platform = exports.platformId = void 0;
3
+ exports.usdcDecimals = exports.usdcMint = exports.swapPid = exports.ammPid = exports.platform = exports.platformId = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
5
  exports.platformId = 'hedgehog';
6
6
  exports.platform = {
@@ -13,4 +13,6 @@ exports.platform = {
13
13
  };
14
14
  exports.ammPid = new web3_js_1.PublicKey('Hr4whNgXr3yZsJvx3TVSwfsFgXuSEPB1xKmvgrtLhsrM');
15
15
  exports.swapPid = new web3_js_1.PublicKey('2ZznCMfx2XP43zaPw9R9wKnjXWiEeEexyhdBPv3UqDtD');
16
+ exports.usdcMint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v';
17
+ exports.usdcDecimals = 6;
16
18
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/hedgehog/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,iDAAiD;IACxD,OAAO,EAAE,0BAA0B;IACnC,OAAO,EAAE,oCAAoC;IAC7C,qEAAqE;CACtE,CAAC;AACW,QAAA,MAAM,GAAG,IAAI,mBAAS,CACjC,8CAA8C,CAC/C,CAAC;AACW,QAAA,OAAO,GAAG,IAAI,mBAAS,CAClC,8CAA8C,CAC/C,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/hedgehog/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,UAAU,CAAC;AACxB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,iDAAiD;IACxD,OAAO,EAAE,0BAA0B;IACnC,OAAO,EAAE,oCAAoC;IAC7C,qEAAqE;CACtE,CAAC;AACW,QAAA,MAAM,GAAG,IAAI,mBAAS,CACjC,8CAA8C,CAC/C,CAAC;AACW,QAAA,OAAO,GAAG,IAAI,mBAAS,CAClC,8CAA8C,CAC/C,CAAC;AACW,QAAA,QAAQ,GAAG,8CAA8C,CAAC;AAC1D,QAAA,YAAY,GAAG,CAAC,CAAC"}
@@ -2,15 +2,21 @@
2
2
  import { BeetStruct } from '@metaplex-foundation/beet';
3
3
  import { PublicKey } from '@solana/web3.js';
4
4
  import BigNumber from 'bignumber.js';
5
+ export declare enum Outcome {
6
+ Open = 0,
7
+ Yes = 1,
8
+ No = 2,
9
+ Invalid = 3
10
+ }
5
11
  export type Swap = {
6
12
  buffer: Buffer;
13
+ market: PublicKey;
7
14
  underlyingSwap: PublicKey;
8
15
  creator: PublicKey;
9
16
  fees: Buffer;
10
17
  index: BigNumber;
11
18
  volume: BigNumber;
12
19
  nonce: number;
13
- padding: Buffer;
14
20
  };
15
21
  export declare const swapStruct: BeetStruct<Swap, Partial<Swap>>;
16
22
  export type TokenSwap = {
@@ -19,11 +25,11 @@ export type TokenSwap = {
19
25
  isInitialized: number;
20
26
  bumpSeed: number;
21
27
  tokenProgramId: PublicKey;
22
- mintA: PublicKey;
23
- mintB: PublicKey;
24
- tokenPool: PublicKey;
25
28
  tokenAccountA: PublicKey;
26
29
  tokenAccountB: PublicKey;
30
+ tokenPool: PublicKey;
31
+ mintA: PublicKey;
32
+ mintB: PublicKey;
27
33
  feeAccount: PublicKey;
28
34
  tradeFeeNumerator: BigNumber;
29
35
  tradeFeeDenominator: BigNumber;
@@ -38,3 +44,30 @@ export type TokenSwap = {
38
44
  swapGuardian: PublicKey;
39
45
  };
40
46
  export declare const tokenSwapStruct: BeetStruct<TokenSwap, Partial<TokenSwap>>;
47
+ export type StoredRatio = {
48
+ numer: BigNumber;
49
+ denom: BigNumber;
50
+ };
51
+ export declare const storedRatioStruct: BeetStruct<StoredRatio, Partial<StoredRatio>>;
52
+ export type Market = {
53
+ buffer: Buffer;
54
+ creator: PublicKey;
55
+ yesToken: PublicKey;
56
+ noToken: PublicKey;
57
+ quoteToken: PublicKey;
58
+ marketCollateral: PublicKey;
59
+ feeAccount: PublicKey;
60
+ nonce: number;
61
+ expiryTs: BigNumber;
62
+ creationTs: BigNumber;
63
+ outcomeTs: BigNumber;
64
+ resolutionDelay: number;
65
+ index: BigNumber;
66
+ info: Buffer;
67
+ fees: Buffer;
68
+ outcome: Outcome;
69
+ flags: number;
70
+ redeemOracleForInvalid: PublicKey;
71
+ redeemRatioForInvalid: StoredRatio;
72
+ };
73
+ export declare const marketStruct: BeetStruct<Market, Partial<Market>>;
@@ -1,30 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tokenSwapStruct = exports.swapStruct = void 0;
3
+ exports.marketStruct = exports.storedRatioStruct = exports.tokenSwapStruct = exports.swapStruct = exports.Outcome = 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");
7
+ var Outcome;
8
+ (function (Outcome) {
9
+ Outcome[Outcome["Open"] = 0] = "Open";
10
+ Outcome[Outcome["Yes"] = 1] = "Yes";
11
+ Outcome[Outcome["No"] = 2] = "No";
12
+ Outcome[Outcome["Invalid"] = 3] = "Invalid";
13
+ })(Outcome || (exports.Outcome = Outcome = {}));
7
14
  exports.swapStruct = new beet_1.BeetStruct([
8
15
  ['buffer', (0, solana_1.blob)(8)],
16
+ ['market', beet_solana_1.publicKey],
9
17
  ['underlyingSwap', beet_solana_1.publicKey],
10
18
  ['creator', beet_solana_1.publicKey],
11
19
  ['fees', (0, solana_1.blob)(12)],
12
20
  ['index', solana_1.u64],
13
21
  ['volume', solana_1.u128],
14
22
  ['nonce', beet_1.u8],
15
- ['padding', (0, solana_1.blob)(32)],
16
23
  ], (args) => args);
17
24
  exports.tokenSwapStruct = new beet_1.BeetStruct([
18
- ['buffer', (0, solana_1.blob)(5)],
19
25
  ['version', beet_1.u8],
20
26
  ['isInitialized', beet_1.u8],
21
27
  ['bumpSeed', beet_1.u8],
22
28
  ['tokenProgramId', beet_solana_1.publicKey],
23
- ['mintA', beet_solana_1.publicKey],
24
- ['mintB', beet_solana_1.publicKey],
25
- ['tokenPool', beet_solana_1.publicKey],
26
29
  ['tokenAccountA', beet_solana_1.publicKey],
27
30
  ['tokenAccountB', beet_solana_1.publicKey],
31
+ ['tokenPool', beet_solana_1.publicKey],
32
+ ['mintA', beet_solana_1.publicKey],
33
+ ['mintB', beet_solana_1.publicKey],
28
34
  ['feeAccount', beet_solana_1.publicKey],
29
35
  ['tradeFeeNumerator', solana_1.u64],
30
36
  ['tradeFeeDenominator', solana_1.u64],
@@ -38,4 +44,29 @@ exports.tokenSwapStruct = new beet_1.BeetStruct([
38
44
  ['curveParameters', (0, solana_1.blob)(32)],
39
45
  ['swapGuardian', beet_solana_1.publicKey],
40
46
  ], (args) => args);
47
+ exports.storedRatioStruct = new beet_1.BeetStruct([
48
+ ['numer', solana_1.u64],
49
+ ['denom', solana_1.u128],
50
+ ], (args) => args);
51
+ exports.marketStruct = new beet_1.BeetStruct([
52
+ ['buffer', (0, solana_1.blob)(8)],
53
+ ['creator', beet_solana_1.publicKey],
54
+ ['yesToken', beet_solana_1.publicKey],
55
+ ['noToken', beet_solana_1.publicKey],
56
+ ['quoteToken', beet_solana_1.publicKey],
57
+ ['marketCollateral', beet_solana_1.publicKey],
58
+ ['feeAccount', beet_solana_1.publicKey],
59
+ ['nonce', beet_1.u8],
60
+ ['expiryTs', solana_1.u64],
61
+ ['creationTs', solana_1.u64],
62
+ ['outcomeTs', solana_1.u64],
63
+ ['resolutionDelay', beet_1.u32],
64
+ ['index', solana_1.u64],
65
+ ['info', (0, solana_1.blob)(402)],
66
+ ['fees', (0, solana_1.blob)(4)],
67
+ ['outcome', beet_1.u8],
68
+ ['flags', beet_1.u8],
69
+ ['redeemOracleForInvalid', beet_solana_1.publicKey],
70
+ ['redeemRatioForInvalid', exports.storedRatioStruct],
71
+ ], (args) => args);
41
72
  //# sourceMappingURL=structs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/hedgehog/structs.ts"],"names":[],"mappings":";;;AAAA,oDAA2D;AAC3D,kEAA6D;AAG7D,+CAAqD;AAaxC,QAAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,gBAAgB,EAAE,uBAAS,CA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,cAAc,EAAE,uBAAS,CAAC;CAC5B,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAiB,CAC5B,CAAC"}
1
+ {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/hedgehog/structs.ts"],"names":[],"mappings":";;;AAAA,oDAAgE;AAChE,kEAA6D;AAG7D,+CAAqD;AAErD,IAAY,OAKX;AALD,WAAY,OAAO;IACjB,qCAAI,CAAA;IACJ,mCAAG,CAAA;IACH,iCAAE,CAAA;IACF,2CAAO,CAAA;AACT,CAAC,EALW,OAAO,uBAAP,OAAO,QAKlB;AAaY,QAAA,UAAU,GAAG,IAAI,iBAAU,CACtC;IACE,CAAC,QAAQ,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACnB,CAAC,QAAQ,EAAE,uBAAS,CAAC;IACrB,CAAC,gBAAgB,EAAE,uBAAS,CAAC;IAC7B,CAAC,SAAS,EAAE,uBAAS,CAAC;IACtB,CAAC,MAAM,EAAE,IAAA,aAAI,EAAC,EAAE,CAAC,CAAC;IAClB,CAAC,OAAO,EAAE,YAAG,CAAC;IACd,CAAC,QAAQ,EAAE,aAAI,CAAC;IAChB,CAAC,OAAO,EAAE,SAAE,CAAC;CACd,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAY,CACvB,CAAC;AA2BW,QAAA,eAAe,GAAG,IAAI,iBAAU,CAC3C;IACE,CAAC,SAAS,EAAE,SAAE,CAAC;IACf,CAAC,eAAe,EAAE,SAAE,CAAC;IACrB,CAAC,UAAU,EAAE,SAAE,CAAC;IAChB,CAAC,gBAAgB,EAAE,uBAAS,CAAC;IAC7B,CAAC,eAAe,EAAE,uBAAS,CAAC;IAC5B,CAAC,eAAe,EAAE,uBAAS,CAAC;IAC5B,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,OAAO,EAAE,uBAAS,CAAC;IACpB,CAAC,YAAY,EAAE,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AO,EAAE,YAAG,CAAC;IACd,CAAC,MAAM,EAAE,IAAA,aAAI,EAAC,GAAG,CAAC,CAAC;IACnB,CAAC,MAAM,EAAE,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC;IACjB,CAAC,SAAS,EAAE,SAAE,CAAC;IACf,CAAC,OAAO,EAAE,SAAE,CAAC;IACb,CAAC,wBAAwB,EAAE,uBAAS,CAAC;IACrC,CAAC,uBAAuB,EAAE,yBAAiB,CAAC;CAC7C,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAc,CACzB,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;