@sonarwatch/portfolio-plugins 0.11.119 → 0.11.120
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1199 -1195
- package/README.md +3 -3
- package/package.json +2 -2
- package/src/plugins/abex/constants.d.ts +2 -0
- package/src/plugins/abex/constants.js +3 -1
- package/src/plugins/abex/constants.js.map +1 -1
- package/src/plugins/abex/marketsJob.js +13 -4
- package/src/plugins/abex/marketsJob.js.map +1 -1
- package/src/plugins/abex/positionsFetcher.js +32 -7
- package/src/plugins/abex/positionsFetcher.js.map +1 -1
- package/src/plugins/abex/types.d.ts +13 -0
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/sushiswap/helpers.js +24 -24
- package/src/plugins/uniswap-v2/helpers.js +22 -22
- package/src/utils/sei/constants.js +8 -8
- package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
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.
|
3
|
+
"version": "0.11.120",
|
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.
|
44
|
+
"@sonarwatch/portfolio-core": "0.11.120"
|
45
45
|
},
|
46
46
|
"main": "./src/index.js",
|
47
47
|
"types": "./src/index.d.ts"
|
@@ -5,3 +5,5 @@ export declare const alpType = "0xceab84acf6bf70f503c3b0627acaff6b3f84cee0f2d7ed
|
|
5
5
|
export declare const alpDecimals = 6;
|
6
6
|
export declare const depositVaultRegistry = "0x3c6595e543c4766dd63b5b2fa918516bac2920bc1944da068be031dced46a18d";
|
7
7
|
export declare const alpSupplyObjectId = "0x7705d4670e7ef4623d6392888f73f6773b5f0218b6cb1486a4be238692a58bca";
|
8
|
+
export declare const poolObjectId = "0x9a1c1130b6c8c6b465397ef8a99b2917c5a7a957df98cb4812212674aa971f63";
|
9
|
+
export declare const poolAccRewardPerShareKey = "accRewardPerShare";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.alpSupplyObjectId = exports.depositVaultRegistry = exports.alpDecimals = exports.alpType = exports.platform = exports.platformId = void 0;
|
3
|
+
exports.poolAccRewardPerShareKey = exports.poolObjectId = exports.alpSupplyObjectId = exports.depositVaultRegistry = exports.alpDecimals = exports.alpType = exports.platform = exports.platformId = void 0;
|
4
4
|
exports.platformId = 'abex';
|
5
5
|
exports.platform = {
|
6
6
|
id: exports.platformId,
|
@@ -14,4 +14,6 @@ exports.alpType = '0xceab84acf6bf70f503c3b0627acaff6b3f84cee0f2d7ed53d00fa6c2a16
|
|
14
14
|
exports.alpDecimals = 6;
|
15
15
|
exports.depositVaultRegistry = '0x3c6595e543c4766dd63b5b2fa918516bac2920bc1944da068be031dced46a18d';
|
16
16
|
exports.alpSupplyObjectId = '0x7705d4670e7ef4623d6392888f73f6773b5f0218b6cb1486a4be238692a58bca';
|
17
|
+
exports.poolObjectId = '0x9a1c1130b6c8c6b465397ef8a99b2917c5a7a957df98cb4812212674aa971f63';
|
18
|
+
exports.poolAccRewardPerShareKey = 'accRewardPerShare';
|
17
19
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/abex/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,6CAA6C;IACpD,OAAO,EAAE,kBAAkB;IAC3B,OAAO,EAAE,iCAAiC;IAC1C,WAAW,EAAE,cAAc,EAAE,sCAAsC;CACpE,CAAC;AAEW,QAAA,OAAO,GAClB,8EAA8E,CAAC;AACpE,QAAA,WAAW,GAAG,CAAC,CAAC;AAChB,QAAA,oBAAoB,GAC/B,oEAAoE,CAAC;AAC1D,QAAA,iBAAiB,GAC5B,oEAAoE,CAAC"}
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/abex/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG,MAAM,CAAC;AACpB,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,6CAA6C;IACpD,OAAO,EAAE,kBAAkB;IAC3B,OAAO,EAAE,iCAAiC;IAC1C,WAAW,EAAE,cAAc,EAAE,sCAAsC;CACpE,CAAC;AAEW,QAAA,OAAO,GAClB,8EAA8E,CAAC;AACpE,QAAA,WAAW,GAAG,CAAC,CAAC;AAChB,QAAA,oBAAoB,GAC/B,oEAAoE,CAAC;AAC1D,QAAA,iBAAiB,GAC5B,oEAAoE,CAAC;AAC1D,QAAA,YAAY,GACvB,oEAAoE,CAAC;AAC1D,QAAA,wBAAwB,GAAG,mBAAmB,CAAC"}
|
@@ -23,10 +23,19 @@ const aptos_1 = require("../../utils/aptos");
|
|
23
23
|
const getObject_1 = require("../../utils/sui/getObject");
|
24
24
|
const constants_2 = require("../tokens/constants");
|
25
25
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
26
|
-
var _a, _b, _c, _d, _e, _f;
|
26
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
27
27
|
const client = (0, clients_1.getClientSui)();
|
28
|
+
// Pool
|
29
|
+
const poolObject = yield (0, getObject_1.getObject)(client, constants_1.poolObjectId);
|
30
|
+
const accRewardPerShare = (_b = (_a = poolObject.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.acc_reward_per_share;
|
31
|
+
if (accRewardPerShare) {
|
32
|
+
yield cache.setItem(constants_1.poolAccRewardPerShareKey, accRewardPerShare, {
|
33
|
+
prefix: constants_1.platformId,
|
34
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
35
|
+
});
|
36
|
+
}
|
28
37
|
const lpObject = yield (0, getObject_1.getObject)(client, constants_1.alpSupplyObjectId);
|
29
|
-
const lpSupply = (
|
38
|
+
const lpSupply = (_d = (_c = lpObject.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.fields.lp_supply.fields.value;
|
30
39
|
if (!lpSupply)
|
31
40
|
return;
|
32
41
|
const depositVaultFields = yield (0, getDynamicFields_1.getDynamicFields)(client, constants_1.depositVaultRegistry);
|
@@ -46,10 +55,10 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
55
|
const lpUnderlyings = [];
|
47
56
|
for (let i = 0; i < objects.length; i++) {
|
48
57
|
const object = objects[i];
|
49
|
-
const market = (
|
58
|
+
const market = (_f = (_e = object.data) === null || _e === void 0 ? void 0 : _e.content) === null || _f === void 0 ? void 0 : _f.fields;
|
50
59
|
if (!market)
|
51
60
|
return;
|
52
|
-
const uType = (
|
61
|
+
const uType = (_h = (_g = (0, aptos_1.parseTypeString)(market.value.type).keys) === null || _g === void 0 ? void 0 : _g.at(0)) === null || _h === void 0 ? void 0 : _h.type;
|
53
62
|
if (!uType)
|
54
63
|
return;
|
55
64
|
const tokenPrice = tokenPrices.get((0, portfolio_core_1.formatTokenAddress)(uType, portfolio_core_1.NetworkId.sui));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/abex/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAA2E;AAC3E,gEAAqC;AAGrC,
|
1
|
+
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/abex/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAA2E;AAC3E,gEAAqC;AAGrC,2CAQqB;AACrB,iDAAmD;AACnD,uEAAoE;AAEpE,qEAAkE;AAClE,+FAE8C;AAC9C,6CAAoD;AACpD,yDAAsD;AACtD,mDAA2D;AAE3D,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAE9B,OAAO;IACP,MAAM,UAAU,GAAG,MAAM,IAAA,qBAAS,EAAO,MAAM,EAAE,wBAAY,CAAC,CAAC;IAC/D,MAAM,iBAAiB,GACrB,MAAA,MAAA,UAAU,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC,oBAAoB,CAAC;IACxD,IAAI,iBAAiB,EAAE,CAAC;QACtB,MAAM,KAAK,CAAC,OAAO,CAAC,oCAAwB,EAAE,iBAAiB,EAAE;YAC/D,MAAM,EAAE,sBAAU;YAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;SACzB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAS,EAAY,MAAM,EAAE,6BAAiB,CAAC,CAAC;IACvE,MAAM,QAAQ,GAAG,MAAA,MAAA,QAAQ,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;IACvE,IAAI,CAAC,QAAQ;QAAE,OAAO;IAEtB,MAAM,kBAAkB,GAAG,MAAM,IAAA,mCAAgB,EAC/C,MAAM,EACN,gCAAoB,CACrB,CAAC;IACF,MAAM,OAAO,GAAG,MAAM,IAAA,iCAAe,EACnC,MAAM,EACN,kBAAkB,CAAC,GAAG,CAAC,C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
const getOwnedObjects_1 = require("../../utils/sui/getOwnedObjects");
|
20
20
|
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
21
21
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
22
|
-
var _a, _b;
|
22
|
+
var _a, _b, _c, _d;
|
23
23
|
const client = (0, clients_1.getClientSui)();
|
24
24
|
const objects = yield (0, getOwnedObjects_1.getOwnedObjects)(client, owner, {
|
25
25
|
filter: {
|
@@ -28,13 +28,38 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
28
28
|
});
|
29
29
|
if (objects.length === 0)
|
30
30
|
return [];
|
31
|
-
const alpPrice = yield cache.
|
31
|
+
const [alpPrice, suiPrice] = yield cache.getTokenPrices([constants_1.alpType, portfolio_core_1.suiNativeAddress], portfolio_core_1.NetworkId.sui);
|
32
|
+
const poolAccRewardPerShareStr = yield cache.getItem(constants_1.poolAccRewardPerShareKey, {
|
33
|
+
prefix: constants_1.platformId,
|
34
|
+
networkId: portfolio_core_1.NetworkId.sui,
|
35
|
+
});
|
36
|
+
const poolAccRewardPerShare = poolAccRewardPerShareStr
|
37
|
+
? new bignumber_js_1.default(poolAccRewardPerShareStr)
|
38
|
+
: undefined;
|
32
39
|
let alpAmount = new bignumber_js_1.default(0);
|
40
|
+
let claimmableAmount = new bignumber_js_1.default(0);
|
33
41
|
for (let i = 0; i < objects.length; i++) {
|
34
42
|
const object = objects[i];
|
35
|
-
|
43
|
+
const cAlpAmount = (_b = (_a = object.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.fields.stake;
|
44
|
+
if (!cAlpAmount)
|
45
|
+
continue;
|
46
|
+
alpAmount = alpAmount.plus(cAlpAmount);
|
47
|
+
if (!poolAccRewardPerShare)
|
48
|
+
continue;
|
49
|
+
const accRewardPerShare = (_d = (_c = object.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.fields.acc_reward_per_share;
|
50
|
+
if (!accRewardPerShare)
|
51
|
+
continue;
|
52
|
+
const cClaimmableAmount = poolAccRewardPerShare
|
53
|
+
.minus(accRewardPerShare)
|
54
|
+
.times(cAlpAmount)
|
55
|
+
.div(Math.pow(10, 18));
|
56
|
+
claimmableAmount = claimmableAmount.plus(cClaimmableAmount);
|
36
57
|
}
|
37
58
|
const asset = (0, tokenPriceToAssetToken_1.default)(constants_1.alpType, alpAmount.dividedBy(Math.pow(10, constants_1.alpDecimals)).toNumber(), portfolio_core_1.NetworkId.sui, alpPrice);
|
59
|
+
const rewardAsset = (0, tokenPriceToAssetToken_1.default)(portfolio_core_1.suiNativeAddress, claimmableAmount.dividedBy(Math.pow(10, portfolio_core_1.suiNativeDecimals)).toNumber(), portfolio_core_1.NetworkId.sui, suiPrice);
|
60
|
+
if (claimmableAmount.isZero() && alpAmount.isZero())
|
61
|
+
return [];
|
62
|
+
const value = (0, portfolio_core_1.getUsdValueSum)([rewardAsset.value, asset.value]);
|
38
63
|
const element = {
|
39
64
|
networkId: portfolio_core_1.NetworkId.sui,
|
40
65
|
label: 'Staked',
|
@@ -45,14 +70,14 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
45
70
|
{
|
46
71
|
assets: [asset],
|
47
72
|
assetsValue: asset.value,
|
48
|
-
rewardAssets: [],
|
49
|
-
rewardAssetsValue:
|
50
|
-
value
|
73
|
+
rewardAssets: [rewardAsset],
|
74
|
+
rewardAssetsValue: rewardAsset.value,
|
75
|
+
value,
|
51
76
|
yields: [],
|
52
77
|
},
|
53
78
|
],
|
54
79
|
},
|
55
|
-
value
|
80
|
+
value,
|
56
81
|
};
|
57
82
|
return [element];
|
58
83
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/abex/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+
|
1
|
+
{"version":3,"file":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G;QACxB,KAAK,EAAE,QAAQ;QACf,UAAU,EAAV,sBAAU;QACV,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX;oBACE,MAAM,EAAE,CAAC,KAAK,CAAC;oBACf,WAAW,EAAE,KAAK,CAAC,KAAK;oBACxB,YAAY,EAAE,CAAC,WAAW,CAAC;oBAC3B,iBAAiB,EAAE,WAAW,CAAC,KAAK;oBACpC,KAAK;oBACL,MAAM,EAAE,EAAE;iBACX;aACF;SACF;QACD,KAAK;KACN,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -6,6 +6,19 @@ export type Credential = {
|
|
6
6
|
lock_until: string;
|
7
7
|
stake: string;
|
8
8
|
};
|
9
|
+
export type Pool = {
|
10
|
+
acc_reward_per_share: string;
|
11
|
+
enabled: boolean;
|
12
|
+
end_time: string;
|
13
|
+
id: {
|
14
|
+
id: string;
|
15
|
+
};
|
16
|
+
last_updated_time: string;
|
17
|
+
lock_duration: string;
|
18
|
+
reward: string;
|
19
|
+
staked_amount: string;
|
20
|
+
start_time: string;
|
21
|
+
};
|
9
22
|
export type AlpMarket = {
|
10
23
|
fun_mask: string;
|
11
24
|
id: {
|
@@ -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;
|
@@ -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;
|