@sonarwatch/portfolio-plugins 0.11.173 → 0.11.175
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1415 -1407
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/Cache.d.ts +8 -0
- package/src/Cache.js +8 -0
- package/src/Cache.js.map +1 -1
- package/src/plugins/armada-staking/constants.d.ts +8 -0
- package/src/plugins/armada-staking/constants.js +37 -1
- package/src/plugins/armada-staking/constants.js.map +1 -1
- package/src/plugins/armada-staking/index.js +4 -0
- package/src/plugins/armada-staking/index.js.map +1 -1
- package/src/plugins/armada-staking/stakingFetcher.js +1 -1
- package/src/plugins/armada-staking/stakingFetcher.js.map +1 -1
- package/src/plugins/balancer/helpers/pools.js +21 -21
- package/src/plugins/daos/filters.d.ts +4 -4
- package/src/plugins/daos/filters.js +9 -9
- package/src/plugins/daos/filters.js.map +1 -1
- package/src/plugins/daos/realmsDepositsFetcher.js +1 -1
- package/src/plugins/daos/realmsDepositsFetcher.js.map +1 -1
- package/src/plugins/daos/realmsProgramsJob.js +2 -2
- package/src/plugins/daos/realmsProgramsJob.js.map +1 -1
- package/src/plugins/mango/banksJob.js +15 -5
- package/src/plugins/mango/banksJob.js.map +1 -1
- package/src/plugins/mango/collateralFetcher.js +4 -4
- package/src/plugins/mango/collateralFetcher.js.map +1 -1
- package/src/plugins/mango/constants.d.ts +1 -1
- package/src/plugins/mango/constants.js +2 -2
- package/src/plugins/mango/constants.js.map +1 -1
- package/src/plugins/marginfi/banksJob.js +34 -9
- package/src/plugins/marginfi/banksJob.js.map +1 -1
- package/src/plugins/marginfi/constants.d.ts +1 -1
- package/src/plugins/marginfi/constants.js +2 -2
- package/src/plugins/marginfi/constants.js.map +1 -1
- package/src/plugins/marginfi/depositsFetcher.js +12 -41
- package/src/plugins/marginfi/depositsFetcher.js.map +1 -1
- package/src/plugins/marginfi/filters.js +4 -0
- package/src/plugins/marginfi/filters.js.map +1 -1
- package/src/plugins/marginfi/helpers.d.ts +1 -1
- package/src/plugins/marginfi/helpers.js +41 -31
- package/src/plugins/marginfi/helpers.js.map +1 -1
- package/src/plugins/marginfi/structs/Bank.d.ts +19 -12
- package/src/plugins/marginfi/structs/Bank.js +19 -12
- package/src/plugins/marginfi/structs/Bank.js.map +1 -1
- package/src/plugins/marginfi/types.d.ts +7 -3
- package/src/plugins/rain/helpers.d.ts +1 -1
- package/src/plugins/rain/helpers.js +1 -1
- package/src/plugins/rain/helpers.js.map +1 -1
- package/src/plugins/rain/poolsFetcher.js +1 -3
- package/src/plugins/rain/poolsFetcher.js.map +1 -1
- package/src/plugins/solend/marketsJob.js +1 -1
- package/src/plugins/solend/marketsJob.js.map +1 -1
- package/src/plugins/solend/reservesJob.js +24 -14
- package/src/plugins/solend/reservesJob.js.map +1 -1
- package/src/plugins/suilend/marketsJob.js +1 -1
- package/src/plugins/suilend/marketsJob.js.map +1 -1
- 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
@@ -13,7 +13,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
-
const web3_js_1 = require("@solana/web3.js");
|
17
16
|
const constants_1 = require("./constants");
|
18
17
|
const clients_1 = require("../../utils/clients");
|
19
18
|
const pool_1 = require("./structs/pool");
|
@@ -23,8 +22,7 @@ const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo"
|
|
23
22
|
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
24
23
|
const client = (0, clients_1.getClientSolana)();
|
25
24
|
// Trying to get https://solscan.io/account/4g5zooignaoVrS6NdUWEcNLxZmJGN9UJBAGtrUiBwieF
|
26
|
-
const
|
27
|
-
const poolAccount = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, pool_1.poolStruct, pda);
|
25
|
+
const poolAccount = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, pool_1.poolStruct, (0, helpers_1.getPoolPda)(owner));
|
28
26
|
if (!poolAccount || poolAccount.totalAmount.isZero())
|
29
27
|
return [];
|
30
28
|
const tokenPrice = yield cache.getTokenPrice(poolAccount.currency.toString(), portfolio_core_1.NetworkId.solana);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"poolsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/rain/poolsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;
|
1
|
+
{"version":3,"file":"poolsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/rain/poolsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AAGpC,2CAAyC;AACzC,iDAAsD;AACtD,yCAA4C;AAC5C,qGAA6E;AAC7E,uCAAuC;AACvC,kFAA+E;AAE/E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,wFAAwF;IAExF,MAAM,WAAW,GAAG,MAAM,IAAA,2CAAoB,EAC5C,MAAM,EACN,iBAAU,EACV,IAAA,oBAAU,EAAC,KAAK,CAAC,CAClB,CAAC;IACF,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,WAAW,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,CAAC;IAEhE,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,aAAa,CAC1C,WAAW,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAC/B,0BAAS,CAAC,MAAM,CACjB,CAAC;IACF,IAAI,CAAC,UAAU;QAAE,OAAO,EAAE,CAAC;IAE3B,MAAM,cAAc,GAAqB,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAc,EAAE,CAAC;IACrC,MAAM,cAAc,GAAqB,EAAE,CAAC;IAC5C,MAAM,cAAc,GAAc,EAAE,CAAC;IACrC,MAAM,YAAY,GAAqB,EAAE,CAAC;IAE1C,MAAM,MAAM,GAAG,WAAW,CAAC,WAAW;SACnC,SAAS,CAAC,SAAA,EAAE,EAAI,UAAU,CAAC,QAAQ,CAAA,CAAC;SACpC,QAAQ,EAAE,CAAC;IACd,cAAc,CAAC,IAAI,CACjB,IAAA,gCAAsB,EACpB,UAAU,CAAC,OAAO,EAClB,MAAM,EACN,0BAAS,CAAC,MAAM,EAChB,UAAU,CACX,CACF,CAAC;IAEF,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE1E,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,GACrE,IAAA,wCAAuB,EAAC,cAAc,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;IAExE,OAAO;QACL;YACE,IAAI,EAAE,qCAAoB,CAAC,UAAU;YACrC,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK,EAAE,SAAS;YAChB,KAAK;YACL,IAAI,EAAE;gBACJ,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,cAAc;gBACd,aAAa;gBACb,cAAc;gBACd,eAAe,EAAE,IAAI;gBACrB,WAAW;gBACX,WAAW;gBACX,YAAY;gBACZ,KAAK;aACN;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"}
|
@@ -28,7 +28,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
28
|
});
|
29
29
|
}
|
30
30
|
yield cache.setItem(constants_1.marketsKey, marketsEnhanced, {
|
31
|
-
prefix: constants_1.
|
31
|
+
prefix: constants_1.platformId,
|
32
32
|
networkId: portfolio_core_1.NetworkId.solana,
|
33
33
|
});
|
34
34
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA6C;AAC7C,
|
1
|
+
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA6C;AAC7C,2CAKqB;AAErB,uCAAuC;AAIvC,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,cAAc,GAAgC,MAAM,eAAK,CAAC,GAAG,CACjE,2BAAe,CAChB,CAAC;IACF,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC;IACxC,MAAM,eAAe,GAAiB,EAAE,CAAC;IACzC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,eAAe,CAAC,IAAI,iCACf,UAAU,KACb,IAAI,EAAE,IAAA,oBAAU,EAAC,UAAU,CAAC,IAAI,CAAC,IACjC,CAAC;QACH,MAAM,KAAK,CAAC,OAAO,CACjB,UAAU,CAAC,OAAO,kCAEb,UAAU,KACb,IAAI,EAAE,IAAA,oBAAU,EAAC,UAAU,CAAC,IAAI,CAAC,KAEnC;YACE,MAAM,EAAN,yBAAM;YACN,SAAS,EAAE,0BAAS,CAAC,MAAM;SAC5B,CACF,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,CAAC,OAAO,CAAC,sBAAU,EAAE,eAAe,EAAE;QAC/C,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,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -17,11 +17,13 @@ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
|
17
17
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
18
|
const constants_1 = require("./constants");
|
19
19
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
20
|
-
const markets = yield cache.
|
21
|
-
prefix: constants_1.
|
20
|
+
const markets = yield cache.getItem(constants_1.marketsKey, {
|
21
|
+
prefix: constants_1.platformId,
|
22
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
22
23
|
});
|
24
|
+
if (!markets)
|
25
|
+
return;
|
23
26
|
const reservesAddressesByMarket = markets.map((m) => m.reserves.map((r) => r.address));
|
24
|
-
const promises = [];
|
25
27
|
const reservesInfosResponses = [];
|
26
28
|
const mints = new Set();
|
27
29
|
for (let i = 0; i < reservesAddressesByMarket.length; i += 1) {
|
@@ -39,6 +41,9 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
41
|
});
|
40
42
|
}
|
41
43
|
const tokenPriceById = yield cache.getTokenPricesAsMap(Array.from(mints), portfolio_core_1.NetworkId.solana);
|
44
|
+
const reserveItems = [];
|
45
|
+
const rateItems = [];
|
46
|
+
const sources = [];
|
42
47
|
for (let i = 0; i < reservesAddressesByMarket.length; i += 1) {
|
43
48
|
const reservesAddresses = reservesAddressesByMarket[i];
|
44
49
|
const poolName = markets[i].name;
|
@@ -48,9 +53,9 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
53
|
for (let j = 0; j < reservesInfoRes.data.results.length; j += 1) {
|
49
54
|
const reserveInfo = reservesInfoRes.data.results[j];
|
50
55
|
const reserveAddress = reservesAddresses[j];
|
51
|
-
|
52
|
-
|
53
|
-
|
56
|
+
reserveItems.push({
|
57
|
+
key: reserveAddress,
|
58
|
+
value: Object.assign({ pubkey: reserveAddress }, reserveInfo),
|
54
59
|
});
|
55
60
|
const { reserve } = reserveInfo;
|
56
61
|
const { liquidity, collateral } = reserve;
|
@@ -73,7 +78,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
78
|
? cTokenExchangeRate.multipliedBy(mintTokenPrice.price).toNumber()
|
74
79
|
: undefined;
|
75
80
|
if (cPrice) {
|
76
|
-
|
81
|
+
sources.push({
|
77
82
|
address: collateral.mintPubkey.toString(),
|
78
83
|
decimals,
|
79
84
|
id: constants_1.platformId,
|
@@ -82,9 +87,9 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
82
87
|
price: cPrice,
|
83
88
|
timestamp: Date.now(),
|
84
89
|
weight: 1,
|
85
|
-
})
|
90
|
+
});
|
86
91
|
}
|
87
|
-
if (borrowedAmount <=
|
92
|
+
if (borrowedAmount <= 1 && depositedAmount <= 1)
|
88
93
|
continue;
|
89
94
|
const rate = {
|
90
95
|
tokenAddress,
|
@@ -101,13 +106,18 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
101
106
|
platformId: constants_1.platformId,
|
102
107
|
poolName,
|
103
108
|
};
|
104
|
-
|
105
|
-
prefix: portfolio_core_1.borrowLendRatesPrefix,
|
106
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
107
|
-
}));
|
109
|
+
rateItems.push({ key: `${reserveAddress}-${tokenAddress}`, value: rate });
|
108
110
|
}
|
109
111
|
}
|
110
|
-
yield
|
112
|
+
yield cache.setTokenPriceSources(sources);
|
113
|
+
yield cache.setItems(reserveItems, {
|
114
|
+
prefix: constants_1.reservesPrefix,
|
115
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
116
|
+
});
|
117
|
+
yield cache.setItems(rateItems, {
|
118
|
+
prefix: portfolio_core_1.borrowLendRatesPrefix,
|
119
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
120
|
+
});
|
111
121
|
});
|
112
122
|
const job = {
|
113
123
|
id: `${constants_1.platformId}-reserves`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"reservesJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/reservesJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA6C;AAC7C,+
|
1
|
+
{"version":3,"file":"reservesJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/solend/reservesJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA6C;AAC7C,+DAMoC;AACpC,gEAAqC;AACrC,2CAMqB;AAKrB,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,OAAO,CAAe,sBAAU,EAAE;QAC5D,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IACH,IAAI,CAAC,OAAO;QAAE,OAAO;IAErB,MAAM,yBAAyB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAClD,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CACjC,CAAC;IAEF,MAAM,sBAAsB,GAAG,EAAE,CAAC;IAClC,MAAM,KAAK,GAAgB,IAAI,GAAG,EAAE,CAAC;IAErC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,yBAAyB,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7D,MAAM,iBAAiB,GAAG,yBAAyB,CAAC,CAAC,CAAC,CAAC;QACvD,MAAM,eAAe,GACnB,MAAM,eAAK;aACR,GAAG,CAAC,GAAG,2BAAe,GAAG,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;aACvD,KAAK,CAAC,GAAG,EAA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;IAC5B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -45,7 +45,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
45
|
tokenAddress: reserve.fields.coin_type.fields.name,
|
46
46
|
utilizationRatio: utilization.toNumber(),
|
47
47
|
depositYield: { apr: depositApr, apy: (0, portfolio_core_1.aprToApy)(depositApr) },
|
48
|
-
borrowYield: { apr: borrowApr, apy: (0, portfolio_core_1.aprToApy)(borrowApr) },
|
48
|
+
borrowYield: { apr: -borrowApr, apy: -(0, portfolio_core_1.aprToApy)(borrowApr) },
|
49
49
|
};
|
50
50
|
rates.push(rate);
|
51
51
|
promises.push(cache.setItem(`${reserve.fields.id.id}-${reserve.fields.coin_type.fields.name}`, rate, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/suilend/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAKoC;AACpC,gEAAqC;AAGrC,iDAAmD;AACnD,qEAAkE;AAClE,2CAAiE;AAEjE,uCAAwD;AACxD,mDAAkD;AAElD,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;IAC9B,MAAM,cAAc,GAAG,MAAM,IAAA,iCAAe,EAAgB,MAAM,EAAE;QAClE,sBAAU;KACX,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,EAAE,CAAC;IACpB,MAAM,KAAK,GAAqB,EAAE,CAAC;IACnC,MAAM,cAAc,GAAoB,EAAE,CAAC;IAE3C,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE,CAAC;QACpC,IAAI,MAAA,MAAA,MAAM,CAAC,IAAI,0CAAE,OAAO,0CAAE,MAAM,EAAE,CAAC;YACjC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI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QAClB,SAAS,EAAE,0BAAS,CAAC,GAAG;KACzB,CACF,CACF,CAAC;IAEF,MAAM,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,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;
|