@sonarwatch/portfolio-plugins 0.11.91 → 0.11.93

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. package/CHANGELOG.md +1095 -1087
  2. package/README.md +3 -3
  3. package/package.json +2 -2
  4. package/src/index.js +12 -0
  5. package/src/index.js.map +1 -1
  6. package/src/plugins/balancer/helpers/pools.js +21 -21
  7. package/src/plugins/bskt/constants.d.ts +7 -0
  8. package/src/plugins/bskt/constants.js +17 -0
  9. package/src/plugins/bskt/constants.js.map +1 -0
  10. package/src/plugins/bskt/filters.d.ts +2 -0
  11. package/src/plugins/bskt/filters.js +14 -0
  12. package/src/plugins/bskt/filters.js.map +1 -0
  13. package/src/plugins/bskt/index.d.ts +6 -0
  14. package/src/plugins/bskt/index.js +12 -0
  15. package/src/plugins/bskt/index.js.map +1 -0
  16. package/src/plugins/bskt/structs.d.ts +13 -0
  17. package/src/plugins/bskt/structs.js +15 -0
  18. package/src/plugins/bskt/structs.js.map +1 -0
  19. package/src/plugins/bskt/types.d.ts +4 -0
  20. package/src/plugins/bskt/types.js +3 -0
  21. package/src/plugins/bskt/types.js.map +1 -0
  22. package/src/plugins/bskt/vestingFetcher.d.ts +3 -0
  23. package/src/plugins/bskt/vestingFetcher.js +114 -0
  24. package/src/plugins/bskt/vestingFetcher.js.map +1 -0
  25. package/src/plugins/flowmatic/constants.d.ts +6 -0
  26. package/src/plugins/flowmatic/constants.js +16 -0
  27. package/src/plugins/flowmatic/constants.js.map +1 -0
  28. package/src/plugins/flowmatic/filters.d.ts +2 -0
  29. package/src/plugins/flowmatic/filters.js +14 -0
  30. package/src/plugins/flowmatic/filters.js.map +1 -0
  31. package/src/plugins/flowmatic/index.d.ts +6 -0
  32. package/src/plugins/flowmatic/index.js +12 -0
  33. package/src/plugins/flowmatic/index.js.map +1 -0
  34. package/src/plugins/flowmatic/stakingFetcher.d.ts +3 -0
  35. package/src/plugins/flowmatic/stakingFetcher.js +53 -0
  36. package/src/plugins/flowmatic/stakingFetcher.js.map +1 -0
  37. package/src/plugins/flowmatic/structs.d.ts +16 -0
  38. package/src/plugins/flowmatic/structs.js +18 -0
  39. package/src/plugins/flowmatic/structs.js.map +1 -0
  40. package/src/plugins/genesysgo/constants.d.ts +7 -0
  41. package/src/plugins/genesysgo/constants.js +18 -0
  42. package/src/plugins/genesysgo/constants.js.map +1 -0
  43. package/src/plugins/genesysgo/index.d.ts +6 -0
  44. package/src/plugins/genesysgo/index.js +12 -0
  45. package/src/plugins/genesysgo/index.js.map +1 -0
  46. package/src/plugins/genesysgo/stakingFetcher.d.ts +3 -0
  47. package/src/plugins/genesysgo/stakingFetcher.js +51 -0
  48. package/src/plugins/genesysgo/stakingFetcher.js.map +1 -0
  49. package/src/plugins/kamino/farmsFetcher.js +14 -5
  50. package/src/plugins/kamino/farmsFetcher.js.map +1 -1
  51. package/src/plugins/kamino/farmsJob.js +3 -5
  52. package/src/plugins/kamino/farmsJob.js.map +1 -1
  53. package/src/plugins/sushiswap/helpers.js +24 -24
  54. package/src/plugins/uniswap-v2/helpers.js +22 -22
  55. package/src/utils/sei/constants.js +8 -8
  56. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
@@ -0,0 +1,12 @@
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 stakingFetcher_1 = __importDefault(require("./stakingFetcher"));
9
+ exports.platforms = [constants_1.platform];
10
+ exports.jobs = [];
11
+ exports.fetchers = [stakingFetcher_1.default];
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/genesysgo/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc,CAAC,wBAAc,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,51 @@
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 constants_1 = require("./constants");
17
+ const clients_1 = require("../../utils/clients");
18
+ const solana_1 = require("../../utils/solana");
19
+ const vaults_1 = require("../kamino/structs/vaults");
20
+ const filters_1 = require("../kamino/filters");
21
+ const tokenPriceToAssetTokens_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetTokens"));
22
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
23
+ const client = (0, clients_1.getClientSolana)();
24
+ const userStateAccounts = yield (0, solana_1.getParsedProgramAccounts)(client, vaults_1.userStateStruct, constants_1.programId, (0, filters_1.userStateFilter)(owner));
25
+ const tokenPrice = yield cache.getTokenPrice(constants_1.shadowMint, portfolio_core_1.NetworkId.solana);
26
+ const assets = [];
27
+ for (const userState of userStateAccounts) {
28
+ const amount = userState.activeStakeScaled
29
+ .dividedBy(Math.pow(10, 18))
30
+ .dividedBy(Math.pow(10, constants_1.shadowDecimals))
31
+ .toNumber();
32
+ assets.push(...(0, tokenPriceToAssetTokens_1.default)(constants_1.shadowMint, amount, portfolio_core_1.NetworkId.solana, tokenPrice));
33
+ }
34
+ return [
35
+ {
36
+ type: portfolio_core_1.PortfolioElementType.multiple,
37
+ label: 'Staked',
38
+ networkId: portfolio_core_1.NetworkId.solana,
39
+ platformId: constants_1.platformId,
40
+ data: { assets },
41
+ value: (0, portfolio_core_1.getUsdValueSum)(assets.map((asset) => asset.value)),
42
+ },
43
+ ];
44
+ });
45
+ const fetcher = {
46
+ id: `${constants_1.platformId}-staking`,
47
+ networkId: portfolio_core_1.NetworkId.solana,
48
+ executor,
49
+ };
50
+ exports.default = fetcher;
51
+ //# sourceMappingURL=stakingFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stakingFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/genesysgo/stakingFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AAGpC,2CAAgF;AAChF,iDAAsD;AACtD,+CAA8D;AAC9D,qDAA2D;AAC3D,+CAAoD;AACpD,uGAA+E;AAE/E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,iBAAiB,GAAG,MAAM,IAAA,iCAAwB,EACtD,MAAM,EACN,wBAAe,EACf,qBAAS,EACT,IAAA,yBAAe,EAAC,KAAK,CAAC,CACvB,CAAC;IAEF,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,sBAAU,EAAE,0BAAS,CAAC,MAAM,CAAC,CAAC;IAE3E,MAAM,MAAM,GAAqB,EAAE,CAAC;IACpC,KAAK,MAAM,SAAS,IAAI,iBAAiB,EAAE,CAAC;QAC1C,MAAM,MAAM,GAAG,SAAS,CAAC,iBAAiB;aACvC,SAAS,CAAC,SAAA,EAAE,EAAI,EAAE,CAAA,CAAC;aACnB,SAAS,CAAC,SAAA,EAAE,EAAI,0BAAc,CAAA,CAAC;aAC/B,QAAQ,EAAE,CAAC;QAEd,MAAM,CAAC,IAAI,CACT,GAAG,IAAA,iCAAuB,EACxB,sBAAU,EACV,MAAM,EACN,0BAAS,CAAC,MAAM,EAChB,UAAU,CACX,CACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL;YACE,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,KAAK,EAAE,QAAQ;YACf,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,IAAI,EAAE,EAAE,MAAM,EAAE;YAChB,KAAK,EAAE,IAAA,+BAAc,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,UAAU;IAC3B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -18,7 +18,7 @@ const clients_1 = require("../../utils/clients");
18
18
  const solana_1 = require("../../utils/solana");
19
19
  const vaults_1 = require("./structs/vaults");
20
20
  const filters_1 = require("./filters");
21
- const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
21
+ const tokenPriceToAssetTokens_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetTokens"));
22
22
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
23
23
  const client = (0, clients_1.getClientSolana)();
24
24
  const userStates = yield (0, solana_1.getParsedProgramAccounts)(client, vaults_1.userStateStruct, constants_1.farmProgramId, (0, filters_1.userStateFilter)(owner));
@@ -32,21 +32,30 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
32
32
  return [];
33
33
  const farmById = new Map();
34
34
  farmsInfo.forEach((farmInfo) => farmById.set(farmInfo.pubkey, farmInfo));
35
+ const mints = new Set();
36
+ farmsInfo.forEach((farm) => {
37
+ mints.add(farm.mint);
38
+ farm.rewardsMints.forEach((reward) => mints.add(reward));
39
+ });
40
+ const tokenPrices = yield cache.getTokenPrices(Array.from(mints), portfolio_core_1.NetworkId.solana);
41
+ const tokenPriceById = new Map();
42
+ tokenPrices.forEach((tP) => tP ? tokenPriceById.set(tP.address, tP) : undefined);
35
43
  const liquidities = [];
36
44
  for (const userState of userStates) {
37
45
  const rewardAssets = [];
38
46
  const assets = [];
47
+ if (userState.activeStakeScaled.isZero())
48
+ continue;
39
49
  const farm = farmById.get(userState.farmState.toString());
40
50
  if (!farm)
41
51
  continue;
42
- if (userState.activeStakeScaled.isZero())
43
- continue;
44
- const { price, decimals } = farm;
52
+ const tokenPrice = tokenPriceById.get(farm.mint);
53
+ const { decimals } = farm;
45
54
  const amount = userState.activeStakeScaled
46
55
  .dividedBy(Math.pow(10, 18))
47
56
  .dividedBy(Math.pow(10, decimals))
48
57
  .toNumber();
49
- assets.push((0, tokenPriceToAssetToken_1.default)(farm.mint, amount, portfolio_core_1.NetworkId.solana, undefined, price));
58
+ assets.push(...(0, tokenPriceToAssetTokens_1.default)(farm.mint, amount, portfolio_core_1.NetworkId.solana, tokenPrice));
50
59
  // for (let i = 0; i < farm.rewardsMints.length; i++) {
51
60
  // const rewardMint = farm.rewardsMints[i];
52
61
  // if (rewardMint === '11111111111111111111111111111111') continue;
@@ -1 +1 @@
1
- {"version":3,"file":"farmsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kamino/farmsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AAGpC,2CAAkE;AAClE,iDAAsD;AACtD,+CAA8D;AAC9D,6CAAmD;AACnD,uCAA4C;AAE5C,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CA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AAC,SAAS;YACpC,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,IAAA,+BAAc,EAAC,WAAW,CAAC,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,QAAQ;IACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -8,9 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
13
  const clients_1 = require("../../utils/clients");
@@ -18,11 +15,12 @@ const solana_1 = require("../../utils/solana");
18
15
  const filters_1 = require("../../utils/solana/filters");
19
16
  const constants_1 = require("./constants");
20
17
  const vaults_1 = require("./structs/vaults");
21
- const getTokensPricesMap_1 = __importDefault(require("../../utils/misc/getTokensPricesMap"));
22
18
  const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
23
19
  const client = (0, clients_1.getClientSolana)();
24
20
  const farms = yield (0, solana_1.getParsedProgramAccounts)(client, vaults_1.farmStateStruct, constants_1.farmProgramId, (0, filters_1.dataSizeFilter)(8336));
25
- const tokenPriceById = yield (0, getTokensPricesMap_1.default)(farms.map((farm) => farm.token.mint.toString()), portfolio_core_1.NetworkId.solana, cache);
21
+ const tokenPrices = yield cache.getTokenPrices(farms.map((farm) => farm.token.mint.toString()), portfolio_core_1.NetworkId.solana);
22
+ const tokenPriceById = new Map();
23
+ tokenPrices.forEach((tP) => tP ? tokenPriceById.set(tP.address, tP) : undefined);
26
24
  const farmsInfo = [];
27
25
  farms.forEach((farm) => {
28
26
  if (farm.token.mint.toString() === '11111111111111111111111111111111')
@@ -1 +1 @@
1
- {"version":3,"file":"farmsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/kamino/farmsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AAGvD,iDAAsD;AACtD,+CAA8D;AAC9D,wDAA4D;AAC5D,2CAAkE;AAClE,6CAAmD;AAEnD,6FAAoE;AAEpE,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,KAAK,GAAG,MAAM,IAAA,iCAAwB,EAC1C,MAAM,EACN,wBAAe,EACf,yBAAa,EACb,IAAA,wBAAc,EAAC,IAAI,CAAC,CACrB,CAAC;IAEF,MAAM,cAAc,GAAG,MAAM,IAAA,4BAAiB,EAC5C,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,EAC/C,0BAAS,CAAC,MAAM,EAChB,KAAK,CACN,CAAC;IAEF,MAAM,SAAS,GAAe,EAAE,CAAC;IACjC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,kCAAkC;YACnE,OAAO;QACT,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACnE,IAAI,CAAC,WAAW;YAAE,OAAO;QAEzB,MAAM,QAAQ,GAAa;YACzB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;YAC9B,IAAI,EAAE,IAAI,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qB,CAAC,QAAQ,EAAE;SACpD,CAAC;QACF,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,MAAM,KAAK,CAAC,OAAO,CAAC,oBAAQ,EAAE,SAAS,EAAE;QACvC,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,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;