@sonarwatch/portfolio-plugins 0.15.49 → 0.15.50

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.15.49",
3
+ "version": "0.15.50",
4
4
  "type": "commonjs",
5
5
  "types": "./src/index.d.ts",
6
6
  "peerDependencies": {
package/src/Job.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { NetworkIdType } from '@sonarwatch/portfolio-core';
2
2
  import { Cache } from './Cache';
3
3
  export type JobExecutor = (cache: Cache) => Promise<void>;
4
- export type JobLabel = 'realtime' | 'normal' | 'slow' | 'coingecko' | 'evm' | NetworkIdType;
4
+ export type JobLabel = 'realtime' | 'normal' | 'slow' | 'dbc' | 'coingecko' | 'evm' | NetworkIdType;
5
5
  export type Job = {
6
6
  id: string;
7
7
  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;
@@ -1,5 +1,7 @@
1
1
  /// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
2
2
  /// <reference types="jito-ts/node_modules/@solana/web3.js" />
3
3
  import { PublicKey } from '@solana/web3.js';
4
+ import { Cache } from '../../Cache';
4
5
  import { DatapiAsset } from './types';
6
+ export declare function setJupiterPrices(mints: PublicKey[], cache: Cache): Promise<void>;
5
7
  export declare function getJupiterPrices(mints: PublicKey[]): Promise<Map<string, DatapiAsset>>;
@@ -12,11 +12,36 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getJupiterPrices = void 0;
15
+ exports.getJupiterPrices = exports.setJupiterPrices = void 0;
16
16
  const axios_1 = __importDefault(require("axios"));
17
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
17
18
  const constants_1 = require("./constants");
18
19
  const maxIdsPerRequest = 50;
19
20
  const jupDatapiAssetsUrl = 'https://datapi.jup.ag/v1/assets';
21
+ function setJupiterPrices(mints, cache) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const assets = yield getJupiterPrices(mints);
24
+ const sources = [];
25
+ assets.forEach((asset, mint) => {
26
+ const source = {
27
+ address: mint,
28
+ decimals: asset.decimals,
29
+ id: portfolio_core_1.jupiterSourceId,
30
+ networkId: portfolio_core_1.NetworkId.solana,
31
+ timestamp: Date.now(),
32
+ price: asset.usdPrice,
33
+ priceChange24h: asset.priceChange24h
34
+ ? asset.priceChange24h / 100
35
+ : undefined,
36
+ platformId: portfolio_core_1.walletTokensPlatformId,
37
+ weight: 1,
38
+ };
39
+ sources.push(source);
40
+ });
41
+ yield cache.setTokenPriceSources(sources);
42
+ });
43
+ }
44
+ exports.setJupiterPrices = setJupiterPrices;
20
45
  function getJupiterPrices(mints) {
21
46
  return __awaiter(this, void 0, void 0, function* () {
22
47
  let res;
@@ -1 +1 @@
1
- {"version":3,"file":"getJupiterPrices.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/getJupiterPrices.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kDAA6C;AAE7C,2CAAuE;AAEvE,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,kBAAkB,GAAG,iCAAiC,CAAC;AAE7D,SAAsB,gBAAgB,CAAC,KAAkB;;QACvD,IAAI,GAAG,CAAC;QACR,MAAM,UAAU,GAAG,EAAE,CAAC;QACtB,IAAI,QAAQ,CAAC;QACb,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,GAAG,GAAG,gBAAgB,CAAC;QAC3B,MAAM,QAAQ,GAAG,GAAG,kBAAkB,EAAE,CAAC;QAEzC,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QAEjE,GAAG,CAAC;YACF,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YAEzC,IAAI,OAAO,GAAG,EAAE,CAAC;YACjB,IAAI,8BAAkB,IAAI,gCAAoB;gBAC5C,OAAO,GAAG;oBACR,CAAC,8BAAkB,CAAC,EAAE,gCAAoB;iBAC3C,CAAC;YAEJ,GAAG,GAAG,MAAM,eAAK,CAAC,GAAG,CACnB,QAAQ,EACR;gBACE,MAAM,EAAE;oBACN,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ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CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;iBACjD;gBACD,OAAO;aACR,CACF,CAAC;YAEF,KAAK,GAAG,GAAG,CAAC;YACZ,GAAG,IAAI,gBAAgB,CAAC;YACxB,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC,QAAQ,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;QAEhC,MAAM,MAAM,GAA6B,IAAI,GAAG,EAAE,CAAC;QACnD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;gBAClD,IAAI,KAAK,CAAC,QAAQ;oBAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AA1CD,4CA0CC"}
@@ -12,8 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
13
13
  const web3_js_1 = require("@solana/web3.js");
14
14
  const constants_1 = require("./exchange/constants");
15
- const getMultipleDecimalsAsMap_1 = require("../../utils/solana/getMultipleDecimalsAsMap");
16
- const clients_1 = require("../../utils/clients");
17
15
  const constants_2 = require("./constants");
18
16
  const constants_3 = require("../sanctum/constants");
19
17
  const getJupiterPrices_1 = require("./getJupiterPrices");
@@ -29,7 +27,6 @@ const mints = [
29
27
  constants_4.lfntyMint,
30
28
  ];
31
29
  const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
32
- const connection = (0, clients_1.getClientSolana)();
33
30
  const [verifiedTokens, sanctumMints] = yield Promise.all([
34
31
  cache.getItem(constants_2.verifiedTokensCacheKey, {
35
32
  prefix: constants_1.platformId,
@@ -47,34 +44,9 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
47
44
  const mintsPk = new Set([
48
45
  ...mints.map((m) => new web3_js_1.PublicKey(m)),
49
46
  ...(sanctumMints || []).map((a) => new web3_js_1.PublicKey(a)),
47
+ ...(verifiedTokens || []).map((token) => new web3_js_1.PublicKey(token.address)),
50
48
  ]);
51
- const decimalsMap = yield (0, getMultipleDecimalsAsMap_1.getMultipleDecimalsAsMap)(connection, [...mintsPk]);
52
- (verifiedTokens || []).forEach((token) => {
53
- mintsPk.add(new web3_js_1.PublicKey(token.address));
54
- decimalsMap.set(token.address, Number(token.decimals));
55
- });
56
- const assets = yield (0, getJupiterPrices_1.getJupiterPrices)([...mintsPk]);
57
- const sources = [];
58
- assets.forEach((asset, mint) => {
59
- const decimals = decimalsMap.get(mint);
60
- if (!decimals)
61
- return;
62
- const source = {
63
- address: mint,
64
- decimals,
65
- id: portfolio_core_1.jupiterSourceId,
66
- networkId: portfolio_core_1.NetworkId.solana,
67
- timestamp: Date.now(),
68
- price: asset.usdPrice,
69
- priceChange24h: asset.priceChange24h
70
- ? asset.priceChange24h / 100
71
- : undefined,
72
- platformId: portfolio_core_1.walletTokensPlatformId,
73
- weight: 1,
74
- };
75
- sources.push(source);
76
- });
77
- yield cache.setTokenPriceSources(sources);
49
+ yield (0, getJupiterPrices_1.setJupiterPrices)([...mintsPk], cache);
78
50
  });
79
51
  const job = {
80
52
  id: `${constants_1.platformId}-pricing`,
@@ -1 +1 @@
1
- {"version":3,"file":"pricingJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/jupiter/pricingJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAKoC;AACpC,6CAA4C;AAG5C,oDAAkD;AAClD,0FAAuF;AACvF,iDAAsD;AAEtD,2CAAqD;AACrD,oDAAgF;AAChF,yDAAsD;AACtD,qDAA8D;AAE9D,MAAM,KAAK,GAAG;IACZ,8CAA8C,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CAAC;QACpD,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,mBAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KACvE,CAAC,CAAC;IAEH,MAAM,IAAA,mCAAgB,EAAC,CAAC,GAAG,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC,CAAA,CAAC;AACF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,MAAM,EAAE,CAAC,UAAU,CAAC;CACrB,CAAC;AACF,kBAAe,GAAG,CAAC"}
@@ -13,3 +13,4 @@ export declare const dlmmProgramId: PublicKey;
13
13
  export declare const dlmmVaultProgramId: PublicKey;
14
14
  export declare const stakeForFeeProgramId: PublicKey;
15
15
  export declare const cpammProgramId: PublicKey;
16
+ export declare const dbcProgramId: PublicKey;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cpammProgramId = exports.stakeForFeeProgramId = exports.dlmmVaultProgramId = exports.dlmmProgramId = exports.farmProgramId = exports.poolsProgramId = exports.vaultsProgramId = exports.feeVaultsKey = exports.dlmmVaultsKey = exports.farmsKey = exports.prefixVaults = exports.platformId = void 0;
3
+ exports.dbcProgramId = exports.cpammProgramId = exports.stakeForFeeProgramId = exports.dlmmVaultProgramId = exports.dlmmProgramId = exports.farmProgramId = exports.poolsProgramId = exports.vaultsProgramId = exports.feeVaultsKey = exports.dlmmVaultsKey = exports.farmsKey = exports.prefixVaults = exports.platformId = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
5
  exports.platformId = 'meteora';
6
6
  exports.prefixVaults = `${exports.platformId}-vaults`;
@@ -14,4 +14,5 @@ exports.dlmmProgramId = new web3_js_1.PublicKey('LBUZKhRxPF3XUpBCjp4YzTKgLccjZhT
14
14
  exports.dlmmVaultProgramId = new web3_js_1.PublicKey('vaU6kP7iNEGkbmPkLmZfGwiGxd4Mob24QQCie5R9kd2');
15
15
  exports.stakeForFeeProgramId = new web3_js_1.PublicKey('FEESngU3neckdwib9X3KWqdL7Mjmqk9XNp3uh5JbP4KP');
16
16
  exports.cpammProgramId = new web3_js_1.PublicKey('cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG');
17
+ exports.dbcProgramId = new web3_js_1.PublicKey('dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN');
17
18
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/meteora/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAE/B,QAAA,UAAU,GAAG,SAAS,CAAC;AAEvB,QAAA,YAAY,GAAG,GAAG,kBAAU,SAAS,CAAC;AACtC,QAAA,QAAQ,GAAG,OAAO,CAAC;AACnB,QAAA,aAAa,GAAG,eAAe,CAAC;AAChC,QAAA,YAAY,GAAG,YAAY,CAAC;AAE5B,QAAA,eAAe,GAAG,IAAI,mBAAS,CAC1C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,6CAA6C,CAC9C,CAAC;AAEW,QAAA,kBAAkB,GAAG,IAAI,mBAAS,CAC7C,6CAA6C,CAC9C,CAAC;AAEW,QAAA,oBAAoB,GAAG,IAAI,mBAAS,CAC/C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,6CAA6C,CAC9C,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/meteora/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAE/B,QAAA,UAAU,GAAG,SAAS,CAAC;AAEvB,QAAA,YAAY,GAAG,GAAG,kBAAU,SAAS,CAAC;AACtC,QAAA,QAAQ,GAAG,OAAO,CAAC;AACnB,QAAA,aAAa,GAAG,eAAe,CAAC;AAChC,QAAA,YAAY,GAAG,YAAY,CAAC;AAE5B,QAAA,eAAe,GAAG,IAAI,mBAAS,CAC1C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,8CAA8C,CAC/C,CAAC;AAEW,QAAA,aAAa,GAAG,IAAI,mBAAS,CACxC,6CAA6C,CAC9C,CAAC;AAEW,QAAA,kBAAkB,GAAG,IAAI,mBAAS,CAC7C,6CAA6C,CAC9C,CAAC;AAEW,QAAA,oBAAoB,GAAG,IAAI,mBAAS,CAC/C,8CAA8C,CAC/C,CAAC;AAEW,QAAA,cAAc,GAAG,IAAI,mBAAS,CACzC,6CAA6C,CAC9C,CAAC;AAEW,QAAA,YAAY,GAAG,IAAI,mBAAS,CACvC,6CAA6C,CAC9C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Job } from '../../../Job';
2
+ declare const job: Job;
3
+ export default job;
@@ -0,0 +1,35 @@
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 clients_1 = require("../../../utils/clients");
14
+ const constants_1 = require("../constants");
15
+ const structs_1 = require("./structs");
16
+ const getJupiterPrices_1 = require("../../jupiter/getJupiterPrices");
17
+ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
18
+ const client = (0, clients_1.getClientSolana)();
19
+ const accounts = yield client.getProgramAccounts(constants_1.dbcProgramId, {
20
+ filters: [{ memcmp: { offset: 0, bytes: 'cmrfVvtHrjd' } }],
21
+ dataSlice: { offset: 0, length: 168 },
22
+ });
23
+ const mintsPk = accounts.map((account) => {
24
+ const virtualPool = structs_1.virtualPoolStruct.deserialize(account.account.data)[0];
25
+ return virtualPool.base_mint;
26
+ });
27
+ yield (0, getJupiterPrices_1.setJupiterPrices)(mintsPk, cache);
28
+ });
29
+ const job = {
30
+ id: `${constants_1.platformId}-dbc`,
31
+ executor,
32
+ labels: [portfolio_core_1.NetworkId.solana, 'dbc'],
33
+ };
34
+ exports.default = job;
35
+ //# sourceMappingURL=dbcJob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dbcJob.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/meteora/dbc/dbcJob.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AAGvD,oDAAyD;AACzD,4CAAwD;AACxD,uCAA8C;AAC9C,qEAAkE;AAElE,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,wBAAY,EAAE;QAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,CAAC;QAC1D,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE;KACtC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACvC,MAAM,WAAW,GAAG,2BAAiB,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3E,OAAO,WAAW,CAAC,SAAS,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,MAAM,IAAA,mCAAgB,EAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACzC,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,MAAM;IACvB,QAAQ;IACR,MAAM,EAAE,CAAC,0BAAS,CAAC,MAAM,EAAE,KAAK,CAAC;CAClC,CAAC;AACF,kBAAe,GAAG,CAAC"}
@@ -0,0 +1,23 @@
1
+ /// <reference types="@drift-labs/sdk/node_modules/@solana/web3.js" />
2
+ /// <reference types="jito-ts/node_modules/@solana/web3.js" />
3
+ import { PublicKey } from '@solana/web3.js';
4
+ import BigNumber from 'bignumber.js';
5
+ import { FixableBeetStruct } from '@metaplex-foundation/beet';
6
+ export type VolatilityTracker = {
7
+ last_update_timestamp: BigNumber;
8
+ padding: number[];
9
+ sqrt_price_reference: BigNumber;
10
+ volatility_accumulator: BigNumber;
11
+ volatility_reference: BigNumber;
12
+ };
13
+ export declare const volatilityTrackerStruct: FixableBeetStruct<VolatilityTracker, Partial<VolatilityTracker>>;
14
+ export type VirtualPool = {
15
+ accountDiscriminator: number[];
16
+ volatility_tracker: VolatilityTracker;
17
+ config: PublicKey;
18
+ creator: PublicKey;
19
+ base_mint: PublicKey;
20
+ base_vault: PublicKey;
21
+ quote_vault: PublicKey;
22
+ };
23
+ export declare const virtualPoolStruct: FixableBeetStruct<VirtualPool, Partial<VirtualPool>>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.virtualPoolStruct = exports.volatilityTrackerStruct = void 0;
4
+ const beet_1 = require("@metaplex-foundation/beet");
5
+ const beet_solana_1 = require("@metaplex-foundation/beet-solana");
6
+ const solana_1 = require("../../../utils/solana");
7
+ exports.volatilityTrackerStruct = new beet_1.FixableBeetStruct([
8
+ ['last_update_timestamp', solana_1.u64],
9
+ ['padding', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 8)],
10
+ ['sqrt_price_reference', solana_1.u128],
11
+ ['volatility_accumulator', solana_1.u128],
12
+ ['volatility_reference', solana_1.u128],
13
+ ], (args) => args);
14
+ exports.virtualPoolStruct = new beet_1.FixableBeetStruct([
15
+ ['accountDiscriminator', (0, beet_1.uniformFixedSizeArray)(beet_1.u8, 8)],
16
+ ['volatility_tracker', exports.volatilityTrackerStruct],
17
+ ['config', beet_solana_1.publicKey],
18
+ ['creator', beet_solana_1.publicKey],
19
+ ['base_mint', beet_solana_1.publicKey],
20
+ ['base_vault', beet_solana_1.publicKey],
21
+ ['quote_vault', beet_solana_1.publicKey],
22
+ ], (args) => args);
23
+ //# sourceMappingURL=structs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structs.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/meteora/dbc/structs.ts"],"names":[],"mappings":";;;AAEA,oDAImC;AACnC,kEAA6D;AAC7D,kDAAkD;AAUrC,QAAA,uBAAuB,GAAG,IAAI,wBAAiB,CAC1D;IACE,CAAC,uBAAuB,EAAE,YAAG,CAAC;IAC9B,CAAC,SAAS,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC,sBAAsB,EAAE,aAAI,CAAC;IAC9B,CAAC,wBAAwB,EAAE,aAAI,CAAC;IAChC,CAAC,sBAAsB,EAAE,aAAI,CAAC;CAC/B,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAyB,CACpC,CAAC;AAYW,QAAA,iBAAiB,GAAG,IAAI,wBAAiB,CACpD;IACE,CAAC,sBAAsB,EAAE,IAAA,4BAAqB,EAAC,SAAE,EAAE,CAAC,CAAC,CAAC;IACtD,CAAC,oBAAoB,EAAE,+BAAuB,CAAC;IAC/C,CAAC,QAAQ,EAAE,uBAAS,CAAC;IACrB,CAAC,SAAS,EAAE,uBAAS,CAAC;IACtB,CAAC,WAAW,EAAE,uBAAS,CAAC;IACxB,CAAC,YAAY,EAAE,uBAAS,CAAC;IACzB,CAAC,aAAa,EAAE,uBAAS,CAAC;CAC3B,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAmB,CAC9B,CAAC"}
@@ -16,6 +16,7 @@ const stakeForFeeFetcher_1 = __importDefault(require("./stake2earn/stakeForFeeFe
16
16
  const stakeForFeeVaultsJob_1 = __importDefault(require("./stake2earn/stakeForFeeVaultsJob"));
17
17
  const cpammV2Job_1 = __importDefault(require("./cpamm/cpammV2Job"));
18
18
  const dlmmJob_1 = __importDefault(require("./dlmm/dlmmJob"));
19
+ const dbcJob_1 = __importDefault(require("./dbc/dbcJob"));
19
20
  exports.jobs = [
20
21
  vaultsJob_1.default,
21
22
  poolsJob_1.default,
@@ -25,6 +26,7 @@ exports.jobs = [
25
26
  dlmmVaultsJob_1.default,
26
27
  stakeForFeeVaultsJob_1.default,
27
28
  cpammV2Job_1.default,
29
+ dbcJob_1.default,
28
30
  ];
29
31
  exports.fetchers = [
30
32
  farmsFetcher_1.default,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/meteora/index.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAoC;AACpC,gEAAwC;AACxC,8FAAsE;AACtE,gEAAwC;AACxC,yEAAiD;AAGjD,wEAAgD;AAChD,uFAA8D;AAC9D,iFAAyD;AACzD,yFAAiE;AACjE,6FAAqE;AACrE,oEAA2C;AAC3C,6DAAqC;AAExB,QAAA,IAAI,GAAU;IACzB,mBAAS;IACT,kBAAQ;IACR,kBAAQ;IACR,4BAAkB;IAClB,iBAAO;IACP,uBAAa;IACb,8BAAoB;IACpB,oBAAS;CACV,CAAC;AACW,QAAA,QAAQ,GAAc;IACjC,sBAAY;IACZ,8BAAmB;IACnB,2BAAiB;IACjB,4BAAkB;CACnB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/meteora/index.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAoC;AACpC,gEAAwC;AACxC,8FAAsE;AACtE,gEAAwC;AACxC,yEAAiD;AAGjD,wEAAgD;AAChD,uFAA8D;AAC9D,iFAAyD;AACzD,yFAAiE;AACjE,6FAAqE;AACrE,oEAA2C;AAC3C,6DAAqC;AACrC,0DAAkC;AAErB,QAAA,IAAI,GAAU;IACzB,mBAAS;IACT,kBAAQ;IACR,kBAAQ;IACR,4BAAkB;IAClB,iBAAO;IACP,uBAAa;IACb,8BAAoB;IACpB,oBAAS;IACT,gBAAM;CACP,CAAC;AACW,QAAA,QAAQ,GAAc;IACjC,sBAAY;IACZ,8BAAmB;IACnB,2BAAiB;IACjB,4BAAkB;CACnB,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;
@@ -41,20 +41,20 @@ const getMultipleAccountsInfoSafe_1 = require("../../utils/solana/getMultipleAcc
41
41
  const helpers_1 = require("./helpers");
42
42
  const AirdropFetcher_1 = require("../../AirdropFetcher");
43
43
  const getClaimTransactions_1 = require("../../utils/solana/jupiter/getClaimTransactions");
44
- const query = (0, graphql_request_1.gql) `
45
- query GetAirdropFinalFrontend($authority: String!) {
46
- getAirdropFinalFrontend(authority: $authority) {
47
- authority
48
- community_allocation
49
- eligibility
50
- main_allocation
51
- og_allocation
52
- s1_allocation
53
- s2_allocation
54
- total_allocation
55
- __typename
56
- }
57
- }
44
+ const query = (0, graphql_request_1.gql) `
45
+ query GetAirdropFinalFrontend($authority: String!) {
46
+ getAirdropFinalFrontend(authority: $authority) {
47
+ authority
48
+ community_allocation
49
+ eligibility
50
+ main_allocation
51
+ og_allocation
52
+ s1_allocation
53
+ s2_allocation
54
+ total_allocation
55
+ __typename
56
+ }
57
+ }
58
58
  `;
59
59
  const executor = (owner) => __awaiter(void 0, void 0, void 0, function* () {
60
60
  const res = yield (0, graphql_request_1.default)(constants_1.graphqlApi, query, {
@@ -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;