@echoclaw/echo-0g 1.0.0
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 +1175 -0
- package/dist/0g-compute/account.d.ts +36 -0
- package/dist/0g-compute/account.d.ts.map +1 -0
- package/dist/0g-compute/account.js +85 -0
- package/dist/0g-compute/account.js.map +1 -0
- package/dist/0g-compute/bridge.d.ts +16 -0
- package/dist/0g-compute/bridge.d.ts.map +1 -0
- package/dist/0g-compute/bridge.js +40 -0
- package/dist/0g-compute/bridge.js.map +1 -0
- package/dist/0g-compute/broker-factory.d.ts +19 -0
- package/dist/0g-compute/broker-factory.d.ts.map +1 -0
- package/dist/0g-compute/broker-factory.js +65 -0
- package/dist/0g-compute/broker-factory.js.map +1 -0
- package/dist/0g-compute/constants.d.ts +10 -0
- package/dist/0g-compute/constants.d.ts.map +1 -0
- package/dist/0g-compute/constants.js +12 -0
- package/dist/0g-compute/constants.js.map +1 -0
- package/dist/0g-compute/monitor.d.ts +43 -0
- package/dist/0g-compute/monitor.d.ts.map +1 -0
- package/dist/0g-compute/monitor.js +302 -0
- package/dist/0g-compute/monitor.js.map +1 -0
- package/dist/0g-compute/pricing.d.ts +43 -0
- package/dist/0g-compute/pricing.d.ts.map +1 -0
- package/dist/0g-compute/pricing.js +53 -0
- package/dist/0g-compute/pricing.js.map +1 -0
- package/dist/0g-compute/sdk-bridge.cjs +17 -0
- package/dist/0g-compute/sdk-bridge.cjs.map +1 -0
- package/dist/0g-compute/sdk-bridge.d.cts +9 -0
- package/dist/0g-compute/sdk-bridge.d.cts.map +1 -0
- package/dist/0g-compute/smoke-test.d.ts +11 -0
- package/dist/0g-compute/smoke-test.d.ts.map +1 -0
- package/dist/0g-compute/smoke-test.js +172 -0
- package/dist/0g-compute/smoke-test.js.map +1 -0
- package/dist/bot/daemon.d.ts +34 -0
- package/dist/bot/daemon.d.ts.map +1 -0
- package/dist/bot/daemon.js +386 -0
- package/dist/bot/daemon.js.map +1 -0
- package/dist/bot/executor.d.ts +14238 -0
- package/dist/bot/executor.d.ts.map +1 -0
- package/dist/bot/executor.js +183 -0
- package/dist/bot/executor.js.map +1 -0
- package/dist/bot/nonce-queue.d.ts +20 -0
- package/dist/bot/nonce-queue.d.ts.map +1 -0
- package/dist/bot/nonce-queue.js +41 -0
- package/dist/bot/nonce-queue.js.map +1 -0
- package/dist/bot/notify.d.ts +15 -0
- package/dist/bot/notify.d.ts.map +1 -0
- package/dist/bot/notify.js +98 -0
- package/dist/bot/notify.js.map +1 -0
- package/dist/bot/orders.d.ts +30 -0
- package/dist/bot/orders.d.ts.map +1 -0
- package/dist/bot/orders.js +172 -0
- package/dist/bot/orders.js.map +1 -0
- package/dist/bot/state.d.ts +14 -0
- package/dist/bot/state.d.ts.map +1 -0
- package/dist/bot/state.js +109 -0
- package/dist/bot/state.js.map +1 -0
- package/dist/bot/stream.d.ts +28 -0
- package/dist/bot/stream.d.ts.map +1 -0
- package/dist/bot/stream.js +96 -0
- package/dist/bot/stream.js.map +1 -0
- package/dist/bot/triggers.d.ts +17 -0
- package/dist/bot/triggers.d.ts.map +1 -0
- package/dist/bot/triggers.js +95 -0
- package/dist/bot/triggers.js.map +1 -0
- package/dist/bot/types.d.ts +199 -0
- package/dist/bot/types.d.ts.map +1 -0
- package/dist/bot/types.js +12 -0
- package/dist/bot/types.js.map +1 -0
- package/dist/chainscan/client.d.ts +28 -0
- package/dist/chainscan/client.d.ts.map +1 -0
- package/dist/chainscan/client.js +361 -0
- package/dist/chainscan/client.js.map +1 -0
- package/dist/chainscan/constants.d.ts +15 -0
- package/dist/chainscan/constants.d.ts.map +1 -0
- package/dist/chainscan/constants.js +15 -0
- package/dist/chainscan/constants.js.map +1 -0
- package/dist/chainscan/types.d.ts +148 -0
- package/dist/chainscan/types.d.ts.map +1 -0
- package/dist/chainscan/types.js +2 -0
- package/dist/chainscan/types.js.map +1 -0
- package/dist/chainscan/validation.d.ts +35 -0
- package/dist/chainscan/validation.d.ts.map +1 -0
- package/dist/chainscan/validation.js +97 -0
- package/dist/chainscan/validation.js.map +1 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +328 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/0g-compute.d.ts +21 -0
- package/dist/commands/0g-compute.d.ts.map +1 -0
- package/dist/commands/0g-compute.js +850 -0
- package/dist/commands/0g-compute.js.map +1 -0
- package/dist/commands/chainscan.d.ts +17 -0
- package/dist/commands/chainscan.d.ts.map +1 -0
- package/dist/commands/chainscan.js +605 -0
- package/dist/commands/chainscan.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +251 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/echobook.d.ts +17 -0
- package/dist/commands/echobook.d.ts.map +1 -0
- package/dist/commands/echobook.js +905 -0
- package/dist/commands/echobook.js.map +1 -0
- package/dist/commands/jaine-subgraph.d.ts +3 -0
- package/dist/commands/jaine-subgraph.d.ts.map +1 -0
- package/dist/commands/jaine-subgraph.js +565 -0
- package/dist/commands/jaine-subgraph.js.map +1 -0
- package/dist/commands/jaine.d.ts +3 -0
- package/dist/commands/jaine.d.ts.map +1 -0
- package/dist/commands/jaine.js +1415 -0
- package/dist/commands/jaine.js.map +1 -0
- package/dist/commands/marketmaker.d.ts +6 -0
- package/dist/commands/marketmaker.d.ts.map +1 -0
- package/dist/commands/marketmaker.js +451 -0
- package/dist/commands/marketmaker.js.map +1 -0
- package/dist/commands/send.d.ts +3 -0
- package/dist/commands/send.d.ts.map +1 -0
- package/dist/commands/send.js +229 -0
- package/dist/commands/send.js.map +1 -0
- package/dist/commands/setup.d.ts +3 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +263 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/slop-app.d.ts +9 -0
- package/dist/commands/slop-app.d.ts.map +1 -0
- package/dist/commands/slop-app.js +708 -0
- package/dist/commands/slop-app.js.map +1 -0
- package/dist/commands/slop-stream.d.ts +9 -0
- package/dist/commands/slop-stream.d.ts.map +1 -0
- package/dist/commands/slop-stream.js +99 -0
- package/dist/commands/slop-stream.js.map +1 -0
- package/dist/commands/slop.d.ts +3 -0
- package/dist/commands/slop.d.ts.map +1 -0
- package/dist/commands/slop.js +1053 -0
- package/dist/commands/slop.js.map +1 -0
- package/dist/commands/wallet.d.ts +13 -0
- package/dist/commands/wallet.d.ts.map +1 -0
- package/dist/commands/wallet.js +748 -0
- package/dist/commands/wallet.js.map +1 -0
- package/dist/config/paths.d.ts +13 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +33 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/config/store.d.ts +48 -0
- package/dist/config/store.d.ts.map +1 -0
- package/dist/config/store.js +113 -0
- package/dist/config/store.js.map +1 -0
- package/dist/constants/chain.d.ts +57 -0
- package/dist/constants/chain.d.ts.map +1 -0
- package/dist/constants/chain.js +51 -0
- package/dist/constants/chain.js.map +1 -0
- package/dist/echobook/api.d.ts +38 -0
- package/dist/echobook/api.d.ts.map +1 -0
- package/dist/echobook/api.js +86 -0
- package/dist/echobook/api.js.map +1 -0
- package/dist/echobook/auth.d.ts +31 -0
- package/dist/echobook/auth.d.ts.map +1 -0
- package/dist/echobook/auth.js +93 -0
- package/dist/echobook/auth.js.map +1 -0
- package/dist/echobook/comments.d.ts +26 -0
- package/dist/echobook/comments.d.ts.map +1 -0
- package/dist/echobook/comments.js +20 -0
- package/dist/echobook/comments.js.map +1 -0
- package/dist/echobook/follows.d.ts +19 -0
- package/dist/echobook/follows.d.ts.map +1 -0
- package/dist/echobook/follows.js +21 -0
- package/dist/echobook/follows.js.map +1 -0
- package/dist/echobook/jwtCache.d.ts +15 -0
- package/dist/echobook/jwtCache.d.ts.map +1 -0
- package/dist/echobook/jwtCache.js +63 -0
- package/dist/echobook/jwtCache.js.map +1 -0
- package/dist/echobook/notifications.d.ts +30 -0
- package/dist/echobook/notifications.d.ts.map +1 -0
- package/dist/echobook/notifications.js +26 -0
- package/dist/echobook/notifications.js.map +1 -0
- package/dist/echobook/points.d.ts +35 -0
- package/dist/echobook/points.d.ts.map +1 -0
- package/dist/echobook/points.js +20 -0
- package/dist/echobook/points.js.map +1 -0
- package/dist/echobook/posts.d.ts +46 -0
- package/dist/echobook/posts.d.ts.map +1 -0
- package/dist/echobook/posts.js +43 -0
- package/dist/echobook/posts.js.map +1 -0
- package/dist/echobook/profile.d.ts +29 -0
- package/dist/echobook/profile.d.ts.map +1 -0
- package/dist/echobook/profile.js +14 -0
- package/dist/echobook/profile.js.map +1 -0
- package/dist/echobook/submolts.d.ts +22 -0
- package/dist/echobook/submolts.d.ts.map +1 -0
- package/dist/echobook/submolts.js +24 -0
- package/dist/echobook/submolts.js.map +1 -0
- package/dist/echobook/tradeProof.d.ts +21 -0
- package/dist/echobook/tradeProof.d.ts.map +1 -0
- package/dist/echobook/tradeProof.js +14 -0
- package/dist/echobook/tradeProof.js.map +1 -0
- package/dist/echobook/votes.d.ts +17 -0
- package/dist/echobook/votes.d.ts.map +1 -0
- package/dist/echobook/votes.js +20 -0
- package/dist/echobook/votes.js.map +1 -0
- package/dist/errors.d.ts +125 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +147 -0
- package/dist/errors.js.map +1 -0
- package/dist/intents/store.d.ts +22 -0
- package/dist/intents/store.d.ts.map +1 -0
- package/dist/intents/store.js +76 -0
- package/dist/intents/store.js.map +1 -0
- package/dist/intents/types.d.ts +21 -0
- package/dist/intents/types.d.ts.map +1 -0
- package/dist/intents/types.js +2 -0
- package/dist/intents/types.js.map +1 -0
- package/dist/jaine/abi/erc20.d.ts +90 -0
- package/dist/jaine/abi/erc20.d.ts.map +1 -0
- package/dist/jaine/abi/erc20.js +65 -0
- package/dist/jaine/abi/erc20.js.map +1 -0
- package/dist/jaine/abi/factory.d.ts +38 -0
- package/dist/jaine/abi/factory.d.ts.map +1 -0
- package/dist/jaine/abi/factory.js +26 -0
- package/dist/jaine/abi/factory.js.map +1 -0
- package/dist/jaine/abi/index.d.ts +11 -0
- package/dist/jaine/abi/index.d.ts.map +1 -0
- package/dist/jaine/abi/index.js +11 -0
- package/dist/jaine/abi/index.js.map +1 -0
- package/dist/jaine/abi/nftManager.d.ts +282 -0
- package/dist/jaine/abi/nftManager.d.ts.map +1 -0
- package/dist/jaine/abi/nftManager.js +182 -0
- package/dist/jaine/abi/nftManager.js.map +1 -0
- package/dist/jaine/abi/pool.d.ts +77 -0
- package/dist/jaine/abi/pool.d.ts.map +1 -0
- package/dist/jaine/abi/pool.js +56 -0
- package/dist/jaine/abi/pool.js.map +1 -0
- package/dist/jaine/abi/quoter.d.ts +84 -0
- package/dist/jaine/abi/quoter.d.ts.map +1 -0
- package/dist/jaine/abi/quoter.js +53 -0
- package/dist/jaine/abi/quoter.js.map +1 -0
- package/dist/jaine/abi/router.d.ts +135 -0
- package/dist/jaine/abi/router.d.ts.map +1 -0
- package/dist/jaine/abi/router.js +88 -0
- package/dist/jaine/abi/router.js.map +1 -0
- package/dist/jaine/abi/w0g.d.ts +41 -0
- package/dist/jaine/abi/w0g.d.ts.map +1 -0
- package/dist/jaine/abi/w0g.js +34 -0
- package/dist/jaine/abi/w0g.js.map +1 -0
- package/dist/jaine/allowance.d.ts +48 -0
- package/dist/jaine/allowance.d.ts.map +1 -0
- package/dist/jaine/allowance.js +192 -0
- package/dist/jaine/allowance.js.map +1 -0
- package/dist/jaine/coreTokens.d.ts +32 -0
- package/dist/jaine/coreTokens.d.ts.map +1 -0
- package/dist/jaine/coreTokens.js +91 -0
- package/dist/jaine/coreTokens.js.map +1 -0
- package/dist/jaine/pathEncoding.d.ts +39 -0
- package/dist/jaine/pathEncoding.d.ts.map +1 -0
- package/dist/jaine/pathEncoding.js +98 -0
- package/dist/jaine/pathEncoding.js.map +1 -0
- package/dist/jaine/paths.d.ts +11 -0
- package/dist/jaine/paths.d.ts.map +1 -0
- package/dist/jaine/paths.js +20 -0
- package/dist/jaine/paths.js.map +1 -0
- package/dist/jaine/poolCache.d.ts +47 -0
- package/dist/jaine/poolCache.d.ts.map +1 -0
- package/dist/jaine/poolCache.js +195 -0
- package/dist/jaine/poolCache.js.map +1 -0
- package/dist/jaine/routing.d.ts +41 -0
- package/dist/jaine/routing.d.ts.map +1 -0
- package/dist/jaine/routing.js +247 -0
- package/dist/jaine/routing.js.map +1 -0
- package/dist/jaine/subgraph/client.d.ts +26 -0
- package/dist/jaine/subgraph/client.d.ts.map +1 -0
- package/dist/jaine/subgraph/client.js +201 -0
- package/dist/jaine/subgraph/client.js.map +1 -0
- package/dist/jaine/subgraph/constants.d.ts +9 -0
- package/dist/jaine/subgraph/constants.d.ts.map +1 -0
- package/dist/jaine/subgraph/constants.js +9 -0
- package/dist/jaine/subgraph/constants.js.map +1 -0
- package/dist/jaine/subgraph/queries.d.ts +21 -0
- package/dist/jaine/subgraph/queries.d.ts.map +1 -0
- package/dist/jaine/subgraph/queries.js +304 -0
- package/dist/jaine/subgraph/queries.js.map +1 -0
- package/dist/jaine/subgraph/types.d.ts +209 -0
- package/dist/jaine/subgraph/types.d.ts.map +1 -0
- package/dist/jaine/subgraph/types.js +7 -0
- package/dist/jaine/subgraph/types.js.map +1 -0
- package/dist/jaine/userTokens.d.ts +27 -0
- package/dist/jaine/userTokens.d.ts.map +1 -0
- package/dist/jaine/userTokens.js +89 -0
- package/dist/jaine/userTokens.js.map +1 -0
- package/dist/openclaw/config.d.ts +43 -0
- package/dist/openclaw/config.d.ts.map +1 -0
- package/dist/openclaw/config.js +231 -0
- package/dist/openclaw/config.js.map +1 -0
- package/dist/openclaw/hooks-client.d.ts +24 -0
- package/dist/openclaw/hooks-client.d.ts.map +1 -0
- package/dist/openclaw/hooks-client.js +119 -0
- package/dist/openclaw/hooks-client.js.map +1 -0
- package/dist/slop/abi/factory.d.ts +128 -0
- package/dist/slop/abi/factory.d.ts.map +1 -0
- package/dist/slop/abi/factory.js +70 -0
- package/dist/slop/abi/factory.js.map +1 -0
- package/dist/slop/abi/feeCollector.d.ts +95 -0
- package/dist/slop/abi/feeCollector.d.ts.map +1 -0
- package/dist/slop/abi/feeCollector.js +71 -0
- package/dist/slop/abi/feeCollector.js.map +1 -0
- package/dist/slop/abi/index.d.ts +5 -0
- package/dist/slop/abi/index.d.ts.map +1 -0
- package/dist/slop/abi/index.js +5 -0
- package/dist/slop/abi/index.js.map +1 -0
- package/dist/slop/abi/registry.d.ts +135 -0
- package/dist/slop/abi/registry.d.ts.map +1 -0
- package/dist/slop/abi/registry.js +90 -0
- package/dist/slop/abi/registry.js.map +1 -0
- package/dist/slop/abi/token.d.ts +320 -0
- package/dist/slop/abi/token.d.ts.map +1 -0
- package/dist/slop/abi/token.js +251 -0
- package/dist/slop/abi/token.js.map +1 -0
- package/dist/slop/auth.d.ts +19 -0
- package/dist/slop/auth.d.ts.map +1 -0
- package/dist/slop/auth.js +92 -0
- package/dist/slop/auth.js.map +1 -0
- package/dist/slop/jwtCache.d.ts +27 -0
- package/dist/slop/jwtCache.d.ts.map +1 -0
- package/dist/slop/jwtCache.js +91 -0
- package/dist/slop/jwtCache.js.map +1 -0
- package/dist/slop/quote.d.ts +80 -0
- package/dist/slop/quote.d.ts.map +1 -0
- package/dist/slop/quote.js +174 -0
- package/dist/slop/quote.js.map +1 -0
- package/dist/utils/canonicalJson.d.ts +8 -0
- package/dist/utils/canonicalJson.d.ts.map +1 -0
- package/dist/utils/canonicalJson.js +20 -0
- package/dist/utils/canonicalJson.js.map +1 -0
- package/dist/utils/env.d.ts +11 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/env.js +20 -0
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/http.d.ts +19 -0
- package/dist/utils/http.d.ts.map +1 -0
- package/dist/utils/http.js +61 -0
- package/dist/utils/http.js.map +1 -0
- package/dist/utils/logger.d.ts +4 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +21 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/output.d.ts +29 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +51 -0
- package/dist/utils/output.js.map +1 -0
- package/dist/utils/rateLimit.d.ts +22 -0
- package/dist/utils/rateLimit.d.ts.map +1 -0
- package/dist/utils/rateLimit.js +58 -0
- package/dist/utils/rateLimit.js.map +1 -0
- package/dist/utils/respond.d.ts +19 -0
- package/dist/utils/respond.d.ts.map +1 -0
- package/dist/utils/respond.js +25 -0
- package/dist/utils/respond.js.map +1 -0
- package/dist/utils/ui.d.ts +38 -0
- package/dist/utils/ui.d.ts.map +1 -0
- package/dist/utils/ui.js +126 -0
- package/dist/utils/ui.js.map +1 -0
- package/dist/wallet/client.d.ts +4 -0
- package/dist/wallet/client.d.ts.map +1 -0
- package/dist/wallet/client.js +53 -0
- package/dist/wallet/client.js.map +1 -0
- package/dist/wallet/keystore.d.ts +22 -0
- package/dist/wallet/keystore.d.ts.map +1 -0
- package/dist/wallet/keystore.js +111 -0
- package/dist/wallet/keystore.js.map +1 -0
- package/package.json +63 -0
- package/skills/echo/SKILL.md +1121 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { EchoError, ErrorCodes } from "../../errors.js";
|
|
2
|
+
import { loadConfig } from "../../config/store.js";
|
|
3
|
+
import logger from "../../utils/logger.js";
|
|
4
|
+
import { TokenBucket, ConcurrencyLimiter } from "../../utils/rateLimit.js";
|
|
5
|
+
import { SUBGRAPH_DEFAULTS } from "./constants.js";
|
|
6
|
+
import * as Q from "./queries.js";
|
|
7
|
+
// --- Rate limiting instances ---
|
|
8
|
+
const bucket = new TokenBucket(SUBGRAPH_DEFAULTS.RATE_LIMIT_PER_SEC);
|
|
9
|
+
const limiter = new ConcurrencyLimiter(SUBGRAPH_DEFAULTS.MAX_CONCURRENT);
|
|
10
|
+
// --- Helpers ---
|
|
11
|
+
function getSubgraphUrl() {
|
|
12
|
+
return loadConfig().services.jaineSubgraphUrl;
|
|
13
|
+
}
|
|
14
|
+
function isRetryable(err) {
|
|
15
|
+
if (err instanceof EchoError) {
|
|
16
|
+
return err.code === ErrorCodes.SUBGRAPH_RATE_LIMITED ||
|
|
17
|
+
err.code === ErrorCodes.SUBGRAPH_TIMEOUT ||
|
|
18
|
+
err.code === ErrorCodes.SUBGRAPH_API_ERROR;
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
async function withRetry(fn, maxRetries = SUBGRAPH_DEFAULTS.MAX_RETRIES) {
|
|
23
|
+
let lastError;
|
|
24
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
25
|
+
try {
|
|
26
|
+
return await fn();
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
lastError = err instanceof Error ? err : new Error(String(err));
|
|
30
|
+
if (!isRetryable(err) || attempt === maxRetries)
|
|
31
|
+
throw lastError;
|
|
32
|
+
const backoff = Math.min(1000 * 2 ** attempt, 8000) + Math.random() * 500;
|
|
33
|
+
logger.warn(`[Subgraph] Retry ${attempt + 1}/${maxRetries} after ${Math.round(backoff)}ms: ${lastError.message}`);
|
|
34
|
+
await new Promise(resolve => setTimeout(resolve, backoff));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
throw lastError;
|
|
38
|
+
}
|
|
39
|
+
// --- Core GraphQL POST ---
|
|
40
|
+
async function postGraphQL(query, variables) {
|
|
41
|
+
await bucket.acquire();
|
|
42
|
+
await limiter.acquire();
|
|
43
|
+
const start = Date.now();
|
|
44
|
+
try {
|
|
45
|
+
return await withRetry(async () => {
|
|
46
|
+
const url = getSubgraphUrl();
|
|
47
|
+
const controller = new AbortController();
|
|
48
|
+
const timer = setTimeout(() => controller.abort(), SUBGRAPH_DEFAULTS.TIMEOUT_MS);
|
|
49
|
+
try {
|
|
50
|
+
const res = await fetch(url, {
|
|
51
|
+
method: "POST",
|
|
52
|
+
headers: { "Content-Type": "application/json" },
|
|
53
|
+
body: JSON.stringify({ query, variables }),
|
|
54
|
+
signal: controller.signal,
|
|
55
|
+
});
|
|
56
|
+
if (res.status === 429) {
|
|
57
|
+
throw new EchoError(ErrorCodes.SUBGRAPH_RATE_LIMITED, "Subgraph HTTP 429");
|
|
58
|
+
}
|
|
59
|
+
if (!res.ok) {
|
|
60
|
+
throw new EchoError(ErrorCodes.SUBGRAPH_API_ERROR, `Subgraph HTTP ${res.status}`);
|
|
61
|
+
}
|
|
62
|
+
const json = (await res.json());
|
|
63
|
+
if (json.errors && json.errors.length > 0) {
|
|
64
|
+
const msg = json.errors.map(e => e.message).join("; ");
|
|
65
|
+
throw new EchoError(ErrorCodes.SUBGRAPH_INVALID_RESPONSE, `GraphQL errors: ${msg}`);
|
|
66
|
+
}
|
|
67
|
+
if (!json.data) {
|
|
68
|
+
throw new EchoError(ErrorCodes.SUBGRAPH_INVALID_RESPONSE, "Missing data in response");
|
|
69
|
+
}
|
|
70
|
+
return json.data;
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
if (err instanceof EchoError)
|
|
74
|
+
throw err;
|
|
75
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
76
|
+
throw new EchoError(ErrorCodes.SUBGRAPH_TIMEOUT, `Subgraph request timed out after ${SUBGRAPH_DEFAULTS.TIMEOUT_MS}ms`, "Try again or check network connectivity");
|
|
77
|
+
}
|
|
78
|
+
throw new EchoError(ErrorCodes.SUBGRAPH_API_ERROR, err instanceof Error ? err.message : "Subgraph request failed");
|
|
79
|
+
}
|
|
80
|
+
finally {
|
|
81
|
+
clearTimeout(timer);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
limiter.release();
|
|
87
|
+
const durationMs = Date.now() - start;
|
|
88
|
+
logger.debug(`[Subgraph] query ${durationMs}ms`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export const subgraphClient = {
|
|
92
|
+
async getMeta() {
|
|
93
|
+
const data = await postGraphQL(Q.META);
|
|
94
|
+
return data._meta;
|
|
95
|
+
},
|
|
96
|
+
async getTopPools(limit = SUBGRAPH_DEFAULTS.DEFAULT_POOL_LIMIT, skip = 0) {
|
|
97
|
+
const data = await postGraphQL(Q.POOLS_TOP_TVL, {
|
|
98
|
+
first: Math.min(limit, 1000),
|
|
99
|
+
skip,
|
|
100
|
+
});
|
|
101
|
+
return data.pools;
|
|
102
|
+
},
|
|
103
|
+
async getPoolsForToken(token, opts) {
|
|
104
|
+
const data = await postGraphQL(Q.POOLS_FOR_TOKEN, {
|
|
105
|
+
token: token.toLowerCase(),
|
|
106
|
+
first: Math.min(opts?.limit ?? 100, 1000),
|
|
107
|
+
skip: opts?.skip ?? 0,
|
|
108
|
+
});
|
|
109
|
+
return data.pools;
|
|
110
|
+
},
|
|
111
|
+
async getPoolsForPair(tokenA, tokenB, opts) {
|
|
112
|
+
const data = await postGraphQL(Q.POOLS_FOR_PAIR, {
|
|
113
|
+
tokenA: tokenA.toLowerCase(),
|
|
114
|
+
tokenB: tokenB.toLowerCase(),
|
|
115
|
+
first: Math.min(opts?.limit ?? 100, 1000),
|
|
116
|
+
skip: opts?.skip ?? 0,
|
|
117
|
+
});
|
|
118
|
+
return data.pools;
|
|
119
|
+
},
|
|
120
|
+
async getNewestPools(limit = 20) {
|
|
121
|
+
const data = await postGraphQL(Q.NEWEST_POOLS, {
|
|
122
|
+
first: Math.min(limit, 1000),
|
|
123
|
+
});
|
|
124
|
+
return data.pools;
|
|
125
|
+
},
|
|
126
|
+
async getPool(id) {
|
|
127
|
+
const data = await postGraphQL(Q.POOL_GET, {
|
|
128
|
+
id: id.toLowerCase(),
|
|
129
|
+
});
|
|
130
|
+
return data.pool;
|
|
131
|
+
},
|
|
132
|
+
async getPoolDayData(poolId, opts) {
|
|
133
|
+
const data = await postGraphQL(Q.POOL_DAY_DATA, {
|
|
134
|
+
poolId: poolId.toLowerCase(),
|
|
135
|
+
first: Math.min(opts?.limit ?? 30, 1000),
|
|
136
|
+
skip: opts?.skip ?? 0,
|
|
137
|
+
});
|
|
138
|
+
return data.poolDayDatas;
|
|
139
|
+
},
|
|
140
|
+
async getPoolHourData(poolId, opts) {
|
|
141
|
+
const data = await postGraphQL(Q.POOL_HOUR_DATA, {
|
|
142
|
+
poolId: poolId.toLowerCase(),
|
|
143
|
+
first: Math.min(opts?.limit ?? 24, 1000),
|
|
144
|
+
skip: opts?.skip ?? 0,
|
|
145
|
+
});
|
|
146
|
+
return data.poolHourDatas;
|
|
147
|
+
},
|
|
148
|
+
async getRecentSwaps(poolId, opts) {
|
|
149
|
+
const data = await postGraphQL(Q.RECENT_SWAPS, {
|
|
150
|
+
poolId: poolId.toLowerCase(),
|
|
151
|
+
first: Math.min(opts?.limit ?? 20, 1000),
|
|
152
|
+
skip: opts?.skip ?? 0,
|
|
153
|
+
});
|
|
154
|
+
return data.swaps;
|
|
155
|
+
},
|
|
156
|
+
async getMints(poolId, opts) {
|
|
157
|
+
const data = await postGraphQL(Q.MINTS, {
|
|
158
|
+
poolId: poolId.toLowerCase(),
|
|
159
|
+
first: Math.min(opts?.limit ?? 20, 1000),
|
|
160
|
+
skip: opts?.skip ?? 0,
|
|
161
|
+
});
|
|
162
|
+
return data.mints;
|
|
163
|
+
},
|
|
164
|
+
async getBurns(poolId, opts) {
|
|
165
|
+
const data = await postGraphQL(Q.BURNS, {
|
|
166
|
+
poolId: poolId.toLowerCase(),
|
|
167
|
+
first: Math.min(opts?.limit ?? 20, 1000),
|
|
168
|
+
skip: opts?.skip ?? 0,
|
|
169
|
+
});
|
|
170
|
+
return data.burns;
|
|
171
|
+
},
|
|
172
|
+
async getCollects(poolId, opts) {
|
|
173
|
+
const data = await postGraphQL(Q.COLLECTS, {
|
|
174
|
+
poolId: poolId.toLowerCase(),
|
|
175
|
+
first: Math.min(opts?.limit ?? 20, 1000),
|
|
176
|
+
skip: opts?.skip ?? 0,
|
|
177
|
+
});
|
|
178
|
+
return data.collects;
|
|
179
|
+
},
|
|
180
|
+
async getDexDayData(limit = 30) {
|
|
181
|
+
const data = await postGraphQL(Q.DEX_DAY_DATA, {
|
|
182
|
+
first: Math.min(limit, 1000),
|
|
183
|
+
});
|
|
184
|
+
return data.jaineDexDayDatas;
|
|
185
|
+
},
|
|
186
|
+
async getToken(id) {
|
|
187
|
+
const data = await postGraphQL(Q.TOKEN_INFO, {
|
|
188
|
+
id: id.toLowerCase(),
|
|
189
|
+
});
|
|
190
|
+
return data.token;
|
|
191
|
+
},
|
|
192
|
+
async getTopTokens(opts) {
|
|
193
|
+
const query = opts?.by === "volume" ? Q.TOP_TOKENS_BY_VOLUME : Q.TOP_TOKENS_BY_TVL;
|
|
194
|
+
const data = await postGraphQL(query, {
|
|
195
|
+
first: Math.min(opts?.limit ?? 20, 1000),
|
|
196
|
+
skip: opts?.skip ?? 0,
|
|
197
|
+
});
|
|
198
|
+
return data.tokens;
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/jaine/subgraph/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAelC,kCAAkC;AAElC,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;AACrE,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;AAEzE,kBAAkB;AAElB,SAAS,cAAc;IACrB,OAAO,U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|
|
2
|
+
readonly DEFAULT_URL: "https://api.goldsky.com/api/public/project_cmgl0cagfjymu01wc2mojevm6/subgraphs/jaine-v3-goldsky/0.0.2/gn";
|
|
3
|
+
readonly TIMEOUT_MS: 15000;
|
|
4
|
+
readonly RATE_LIMIT_PER_SEC: 5;
|
|
5
|
+
readonly MAX_CONCURRENT: 2;
|
|
6
|
+
readonly MAX_RETRIES: 2;
|
|
7
|
+
readonly DEFAULT_POOL_LIMIT: 500;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/jaine/subgraph/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB;;;;;;;CAOpB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const SUBGRAPH_DEFAULTS = {
|
|
2
|
+
DEFAULT_URL: "https://api.goldsky.com/api/public/project_cmgl0cagfjymu01wc2mojevm6/subgraphs/jaine-v3-goldsky/0.0.2/gn",
|
|
3
|
+
TIMEOUT_MS: 15_000,
|
|
4
|
+
RATE_LIMIT_PER_SEC: 5,
|
|
5
|
+
MAX_CONCURRENT: 2,
|
|
6
|
+
MAX_RETRIES: 2,
|
|
7
|
+
DEFAULT_POOL_LIMIT: 500,
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/jaine/subgraph/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,0GAA0G;IACvH,UAAU,EAAE,MAAM;IAClB,kBAAkB,EAAE,CAAC;IACrB,cAAc,EAAE,CAAC;IACjB,WAAW,EAAE,CAAC;IACd,kBAAkB,EAAE,GAAG;CACf,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL query strings for Jaine V3 subgraph.
|
|
3
|
+
* Plain strings — zero npm dependencies.
|
|
4
|
+
*/
|
|
5
|
+
export declare const META = "{\n _meta {\n block { number timestamp hash }\n deployment\n hasIndexingErrors\n }\n}";
|
|
6
|
+
export declare const POOLS_TOP_TVL = "query PoolsTopTvl($first: Int!, $skip: Int!) {\n pools(\n first: $first\n skip: $skip\n orderBy: totalValueLockedUSD\n orderDirection: desc\n ) {\n \n id\n createdAtTimestamp\n createdAtBlockNumber\n token0 { id symbol name decimals }\n token1 { id symbol name decimals }\n feeTier\n liquidity\n sqrtPrice\n token0Price\n token1Price\n tick\n observationIndex\n volumeToken0\n volumeToken1\n volumeUSD\n feesUSD\n txCount\n totalValueLockedToken0\n totalValueLockedToken1\n totalValueLockedUSD\n totalValueLockedETH\n liquidityProviderCount\n\n }\n}";
|
|
7
|
+
export declare const POOLS_FOR_TOKEN = "query PoolsForToken($token: Bytes!, $first: Int!, $skip: Int!) {\n pools(\n first: $first\n skip: $skip\n orderBy: totalValueLockedUSD\n orderDirection: desc\n where: { or: [{ token0: $token }, { token1: $token }] }\n ) {\n \n id\n createdAtTimestamp\n createdAtBlockNumber\n token0 { id symbol name decimals }\n token1 { id symbol name decimals }\n feeTier\n liquidity\n sqrtPrice\n token0Price\n token1Price\n tick\n observationIndex\n volumeToken0\n volumeToken1\n volumeUSD\n feesUSD\n txCount\n totalValueLockedToken0\n totalValueLockedToken1\n totalValueLockedUSD\n totalValueLockedETH\n liquidityProviderCount\n\n }\n}";
|
|
8
|
+
export declare const POOLS_FOR_PAIR = "query PoolsForPair($tokenA: Bytes!, $tokenB: Bytes!, $first: Int!, $skip: Int!) {\n pools(\n first: $first\n skip: $skip\n orderBy: totalValueLockedUSD\n orderDirection: desc\n where: { or: [\n { token0: $tokenA, token1: $tokenB },\n { token0: $tokenB, token1: $tokenA }\n ] }\n ) {\n \n id\n createdAtTimestamp\n createdAtBlockNumber\n token0 { id symbol name decimals }\n token1 { id symbol name decimals }\n feeTier\n liquidity\n sqrtPrice\n token0Price\n token1Price\n tick\n observationIndex\n volumeToken0\n volumeToken1\n volumeUSD\n feesUSD\n txCount\n totalValueLockedToken0\n totalValueLockedToken1\n totalValueLockedUSD\n totalValueLockedETH\n liquidityProviderCount\n\n }\n}";
|
|
9
|
+
export declare const NEWEST_POOLS = "query NewestPools($first: Int!) {\n pools(\n first: $first\n orderBy: createdAtTimestamp\n orderDirection: desc\n ) {\n \n id\n createdAtTimestamp\n createdAtBlockNumber\n token0 { id symbol name decimals }\n token1 { id symbol name decimals }\n feeTier\n liquidity\n sqrtPrice\n token0Price\n token1Price\n tick\n observationIndex\n volumeToken0\n volumeToken1\n volumeUSD\n feesUSD\n txCount\n totalValueLockedToken0\n totalValueLockedToken1\n totalValueLockedUSD\n totalValueLockedETH\n liquidityProviderCount\n\n }\n}";
|
|
10
|
+
export declare const POOL_GET = "query PoolGet($id: ID!) {\n pool(id: $id) {\n \n id\n createdAtTimestamp\n createdAtBlockNumber\n token0 { id symbol name decimals }\n token1 { id symbol name decimals }\n feeTier\n liquidity\n sqrtPrice\n token0Price\n token1Price\n tick\n observationIndex\n volumeToken0\n volumeToken1\n volumeUSD\n feesUSD\n txCount\n totalValueLockedToken0\n totalValueLockedToken1\n totalValueLockedUSD\n totalValueLockedETH\n liquidityProviderCount\n\n }\n}";
|
|
11
|
+
export declare const POOL_DAY_DATA = "query PoolDayData($poolId: String!, $first: Int!, $skip: Int!) {\n poolDayDatas(\n first: $first\n skip: $skip\n orderBy: date\n orderDirection: desc\n where: { pool: $poolId }\n ) {\n \n id\n date\n pool { id }\n liquidity\n sqrtPrice\n token0Price\n token1Price\n tick\n tvlUSD\n volumeToken0\n volumeToken1\n volumeUSD\n feesUSD\n txCount\n open high low close\n\n }\n}";
|
|
12
|
+
export declare const POOL_HOUR_DATA = "query PoolHourData($poolId: String!, $first: Int!, $skip: Int!) {\n poolHourDatas(\n first: $first\n skip: $skip\n orderBy: periodStartUnix\n orderDirection: desc\n where: { pool: $poolId }\n ) {\n \n id\n periodStartUnix\n pool { id }\n liquidity\n sqrtPrice\n token0Price\n token1Price\n tick\n tvlUSD\n volumeToken0\n volumeToken1\n volumeUSD\n feesUSD\n txCount\n open high low close\n\n }\n}";
|
|
13
|
+
export declare const RECENT_SWAPS = "query RecentSwaps($poolId: String!, $first: Int!, $skip: Int!) {\n swaps(\n first: $first\n skip: $skip\n orderBy: timestamp\n orderDirection: desc\n where: { pool: $poolId }\n ) {\n \n id\n timestamp\n pool { id }\n token0 { id symbol }\n token1 { id symbol }\n sender\n recipient\n origin\n amount0\n amount1\n amountUSD\n sqrtPriceX96\n tick\n\n }\n}";
|
|
14
|
+
export declare const MINTS = "query Mints($poolId: String!, $first: Int!, $skip: Int!) {\n mints(\n first: $first\n skip: $skip\n orderBy: timestamp\n orderDirection: desc\n where: { pool: $poolId }\n ) {\n \n id\n timestamp\n pool { id }\n token0 { id symbol }\n token1 { id symbol }\n owner\n sender\n origin\n amount\n amount0\n amount1\n amountUSD\n tickLower\n tickUpper\n\n }\n}";
|
|
15
|
+
export declare const BURNS = "query Burns($poolId: String!, $first: Int!, $skip: Int!) {\n burns(\n first: $first\n skip: $skip\n orderBy: timestamp\n orderDirection: desc\n where: { pool: $poolId }\n ) {\n \n id\n timestamp\n pool { id }\n token0 { id symbol }\n token1 { id symbol }\n owner\n origin\n amount\n amount0\n amount1\n amountUSD\n tickLower\n tickUpper\n\n }\n}";
|
|
16
|
+
export declare const COLLECTS = "query Collects($poolId: String!, $first: Int!, $skip: Int!) {\n collects(\n first: $first\n skip: $skip\n orderBy: timestamp\n orderDirection: desc\n where: { pool: $poolId }\n ) {\n \n id\n timestamp\n pool { id }\n owner\n amount0\n amount1\n amountUSD\n tickLower\n tickUpper\n\n }\n}";
|
|
17
|
+
export declare const DEX_DAY_DATA = "query DexDayData($first: Int!) {\n jaineDexDayDatas(\n first: $first\n orderBy: date\n orderDirection: desc\n ) {\n \n id\n date\n volumeETH\n volumeUSD\n volumeUSDUntracked\n feesUSD\n txCount\n tvlUSD\n\n }\n}";
|
|
18
|
+
export declare const TOKEN_INFO = "query TokenInfo($id: ID!) {\n token(id: $id) {\n \n id\n symbol\n name\n decimals\n totalSupply\n volume\n volumeUSD\n untrackedVolumeUSD\n feesUSD\n txCount\n poolCount\n totalValueLocked\n totalValueLockedUSD\n totalValueLockedUSDUntracked\n derivedETH\n\n }\n}";
|
|
19
|
+
export declare const TOP_TOKENS_BY_TVL = "query TopTokensByTvl($first: Int!, $skip: Int!) {\n tokens(\n first: $first\n skip: $skip\n orderBy: totalValueLockedUSD\n orderDirection: desc\n ) {\n \n id\n symbol\n name\n decimals\n totalSupply\n volume\n volumeUSD\n untrackedVolumeUSD\n feesUSD\n txCount\n poolCount\n totalValueLocked\n totalValueLockedUSD\n totalValueLockedUSDUntracked\n derivedETH\n\n }\n}";
|
|
20
|
+
export declare const TOP_TOKENS_BY_VOLUME = "query TopTokensByVolume($first: Int!, $skip: Int!) {\n tokens(\n first: $first\n skip: $skip\n orderBy: volumeUSD\n orderDirection: desc\n ) {\n \n id\n symbol\n name\n decimals\n totalSupply\n volume\n volumeUSD\n untrackedVolumeUSD\n feesUSD\n txCount\n poolCount\n totalValueLocked\n totalValueLockedUSD\n totalValueLockedUSDUntracked\n derivedETH\n\n }\n}";
|
|
21
|
+
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/jaine/subgraph/queries.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2JH,eAAO,MAAM,IAAI,qGAMf,CAAC;AAEH,eAAO,MAAM,aAAa,klBASxB,CAAC;AAEH,eAAO,MAAM,eAAe,iqBAU1B,CAAC;AAEH,eAAO,MAAM,cAAc,2uBAazB,CAAC;AAEH,eAAO,MAAM,YAAY,mjBAQvB,CAAC;AAEH,eAAO,MAAM,QAAQ,+dAInB,CAAC;AAEH,eAAO,MAAM,aAAa,6ZAUxB,CAAC;AAEH,eAAO,MAAM,cAAc,qbAUzB,CAAC;AAEH,eAAO,MAAM,YAAY,wYAUvB,CAAC;AAEH,eAAO,MAAM,KAAK,0YAUhB,CAAC;AAEH,eAAO,MAAM,KAAK,gYAUhB,CAAC;AAEH,eAAO,MAAM,QAAQ,kUAUnB,CAAC;AAEH,eAAO,MAAM,YAAY,+OAQvB,CAAC;AAEH,eAAO,MAAM,UAAU,gSAIrB,CAAC;AAEH,eAAO,MAAM,iBAAiB,oZAS5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,6YAS/B,CAAC"}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL query strings for Jaine V3 subgraph.
|
|
3
|
+
* Plain strings — zero npm dependencies.
|
|
4
|
+
*/
|
|
5
|
+
const POOL_FIELDS = `
|
|
6
|
+
id
|
|
7
|
+
createdAtTimestamp
|
|
8
|
+
createdAtBlockNumber
|
|
9
|
+
token0 { id symbol name decimals }
|
|
10
|
+
token1 { id symbol name decimals }
|
|
11
|
+
feeTier
|
|
12
|
+
liquidity
|
|
13
|
+
sqrtPrice
|
|
14
|
+
token0Price
|
|
15
|
+
token1Price
|
|
16
|
+
tick
|
|
17
|
+
observationIndex
|
|
18
|
+
volumeToken0
|
|
19
|
+
volumeToken1
|
|
20
|
+
volumeUSD
|
|
21
|
+
feesUSD
|
|
22
|
+
txCount
|
|
23
|
+
totalValueLockedToken0
|
|
24
|
+
totalValueLockedToken1
|
|
25
|
+
totalValueLockedUSD
|
|
26
|
+
totalValueLockedETH
|
|
27
|
+
liquidityProviderCount
|
|
28
|
+
`;
|
|
29
|
+
const TOKEN_FIELDS = `
|
|
30
|
+
id
|
|
31
|
+
symbol
|
|
32
|
+
name
|
|
33
|
+
decimals
|
|
34
|
+
totalSupply
|
|
35
|
+
volume
|
|
36
|
+
volumeUSD
|
|
37
|
+
untrackedVolumeUSD
|
|
38
|
+
feesUSD
|
|
39
|
+
txCount
|
|
40
|
+
poolCount
|
|
41
|
+
totalValueLocked
|
|
42
|
+
totalValueLockedUSD
|
|
43
|
+
totalValueLockedUSDUntracked
|
|
44
|
+
derivedETH
|
|
45
|
+
`;
|
|
46
|
+
const POOL_DAY_DATA_FIELDS = `
|
|
47
|
+
id
|
|
48
|
+
date
|
|
49
|
+
pool { id }
|
|
50
|
+
liquidity
|
|
51
|
+
sqrtPrice
|
|
52
|
+
token0Price
|
|
53
|
+
token1Price
|
|
54
|
+
tick
|
|
55
|
+
tvlUSD
|
|
56
|
+
volumeToken0
|
|
57
|
+
volumeToken1
|
|
58
|
+
volumeUSD
|
|
59
|
+
feesUSD
|
|
60
|
+
txCount
|
|
61
|
+
open high low close
|
|
62
|
+
`;
|
|
63
|
+
const POOL_HOUR_DATA_FIELDS = `
|
|
64
|
+
id
|
|
65
|
+
periodStartUnix
|
|
66
|
+
pool { id }
|
|
67
|
+
liquidity
|
|
68
|
+
sqrtPrice
|
|
69
|
+
token0Price
|
|
70
|
+
token1Price
|
|
71
|
+
tick
|
|
72
|
+
tvlUSD
|
|
73
|
+
volumeToken0
|
|
74
|
+
volumeToken1
|
|
75
|
+
volumeUSD
|
|
76
|
+
feesUSD
|
|
77
|
+
txCount
|
|
78
|
+
open high low close
|
|
79
|
+
`;
|
|
80
|
+
const SWAP_FIELDS = `
|
|
81
|
+
id
|
|
82
|
+
timestamp
|
|
83
|
+
pool { id }
|
|
84
|
+
token0 { id symbol }
|
|
85
|
+
token1 { id symbol }
|
|
86
|
+
sender
|
|
87
|
+
recipient
|
|
88
|
+
origin
|
|
89
|
+
amount0
|
|
90
|
+
amount1
|
|
91
|
+
amountUSD
|
|
92
|
+
sqrtPriceX96
|
|
93
|
+
tick
|
|
94
|
+
`;
|
|
95
|
+
const MINT_FIELDS = `
|
|
96
|
+
id
|
|
97
|
+
timestamp
|
|
98
|
+
pool { id }
|
|
99
|
+
token0 { id symbol }
|
|
100
|
+
token1 { id symbol }
|
|
101
|
+
owner
|
|
102
|
+
sender
|
|
103
|
+
origin
|
|
104
|
+
amount
|
|
105
|
+
amount0
|
|
106
|
+
amount1
|
|
107
|
+
amountUSD
|
|
108
|
+
tickLower
|
|
109
|
+
tickUpper
|
|
110
|
+
`;
|
|
111
|
+
const BURN_FIELDS = `
|
|
112
|
+
id
|
|
113
|
+
timestamp
|
|
114
|
+
pool { id }
|
|
115
|
+
token0 { id symbol }
|
|
116
|
+
token1 { id symbol }
|
|
117
|
+
owner
|
|
118
|
+
origin
|
|
119
|
+
amount
|
|
120
|
+
amount0
|
|
121
|
+
amount1
|
|
122
|
+
amountUSD
|
|
123
|
+
tickLower
|
|
124
|
+
tickUpper
|
|
125
|
+
`;
|
|
126
|
+
const COLLECT_FIELDS = `
|
|
127
|
+
id
|
|
128
|
+
timestamp
|
|
129
|
+
pool { id }
|
|
130
|
+
owner
|
|
131
|
+
amount0
|
|
132
|
+
amount1
|
|
133
|
+
amountUSD
|
|
134
|
+
tickLower
|
|
135
|
+
tickUpper
|
|
136
|
+
`;
|
|
137
|
+
const DEX_DAY_DATA_FIELDS = `
|
|
138
|
+
id
|
|
139
|
+
date
|
|
140
|
+
volumeETH
|
|
141
|
+
volumeUSD
|
|
142
|
+
volumeUSDUntracked
|
|
143
|
+
feesUSD
|
|
144
|
+
txCount
|
|
145
|
+
tvlUSD
|
|
146
|
+
`;
|
|
147
|
+
// --- Queries ---
|
|
148
|
+
export const META = `{
|
|
149
|
+
_meta {
|
|
150
|
+
block { number timestamp hash }
|
|
151
|
+
deployment
|
|
152
|
+
hasIndexingErrors
|
|
153
|
+
}
|
|
154
|
+
}`;
|
|
155
|
+
export const POOLS_TOP_TVL = `query PoolsTopTvl($first: Int!, $skip: Int!) {
|
|
156
|
+
pools(
|
|
157
|
+
first: $first
|
|
158
|
+
skip: $skip
|
|
159
|
+
orderBy: totalValueLockedUSD
|
|
160
|
+
orderDirection: desc
|
|
161
|
+
) {
|
|
162
|
+
${POOL_FIELDS}
|
|
163
|
+
}
|
|
164
|
+
}`;
|
|
165
|
+
export const POOLS_FOR_TOKEN = `query PoolsForToken($token: Bytes!, $first: Int!, $skip: Int!) {
|
|
166
|
+
pools(
|
|
167
|
+
first: $first
|
|
168
|
+
skip: $skip
|
|
169
|
+
orderBy: totalValueLockedUSD
|
|
170
|
+
orderDirection: desc
|
|
171
|
+
where: { or: [{ token0: $token }, { token1: $token }] }
|
|
172
|
+
) {
|
|
173
|
+
${POOL_FIELDS}
|
|
174
|
+
}
|
|
175
|
+
}`;
|
|
176
|
+
export const POOLS_FOR_PAIR = `query PoolsForPair($tokenA: Bytes!, $tokenB: Bytes!, $first: Int!, $skip: Int!) {
|
|
177
|
+
pools(
|
|
178
|
+
first: $first
|
|
179
|
+
skip: $skip
|
|
180
|
+
orderBy: totalValueLockedUSD
|
|
181
|
+
orderDirection: desc
|
|
182
|
+
where: { or: [
|
|
183
|
+
{ token0: $tokenA, token1: $tokenB },
|
|
184
|
+
{ token0: $tokenB, token1: $tokenA }
|
|
185
|
+
] }
|
|
186
|
+
) {
|
|
187
|
+
${POOL_FIELDS}
|
|
188
|
+
}
|
|
189
|
+
}`;
|
|
190
|
+
export const NEWEST_POOLS = `query NewestPools($first: Int!) {
|
|
191
|
+
pools(
|
|
192
|
+
first: $first
|
|
193
|
+
orderBy: createdAtTimestamp
|
|
194
|
+
orderDirection: desc
|
|
195
|
+
) {
|
|
196
|
+
${POOL_FIELDS}
|
|
197
|
+
}
|
|
198
|
+
}`;
|
|
199
|
+
export const POOL_GET = `query PoolGet($id: ID!) {
|
|
200
|
+
pool(id: $id) {
|
|
201
|
+
${POOL_FIELDS}
|
|
202
|
+
}
|
|
203
|
+
}`;
|
|
204
|
+
export const POOL_DAY_DATA = `query PoolDayData($poolId: String!, $first: Int!, $skip: Int!) {
|
|
205
|
+
poolDayDatas(
|
|
206
|
+
first: $first
|
|
207
|
+
skip: $skip
|
|
208
|
+
orderBy: date
|
|
209
|
+
orderDirection: desc
|
|
210
|
+
where: { pool: $poolId }
|
|
211
|
+
) {
|
|
212
|
+
${POOL_DAY_DATA_FIELDS}
|
|
213
|
+
}
|
|
214
|
+
}`;
|
|
215
|
+
export const POOL_HOUR_DATA = `query PoolHourData($poolId: String!, $first: Int!, $skip: Int!) {
|
|
216
|
+
poolHourDatas(
|
|
217
|
+
first: $first
|
|
218
|
+
skip: $skip
|
|
219
|
+
orderBy: periodStartUnix
|
|
220
|
+
orderDirection: desc
|
|
221
|
+
where: { pool: $poolId }
|
|
222
|
+
) {
|
|
223
|
+
${POOL_HOUR_DATA_FIELDS}
|
|
224
|
+
}
|
|
225
|
+
}`;
|
|
226
|
+
export const RECENT_SWAPS = `query RecentSwaps($poolId: String!, $first: Int!, $skip: Int!) {
|
|
227
|
+
swaps(
|
|
228
|
+
first: $first
|
|
229
|
+
skip: $skip
|
|
230
|
+
orderBy: timestamp
|
|
231
|
+
orderDirection: desc
|
|
232
|
+
where: { pool: $poolId }
|
|
233
|
+
) {
|
|
234
|
+
${SWAP_FIELDS}
|
|
235
|
+
}
|
|
236
|
+
}`;
|
|
237
|
+
export const MINTS = `query Mints($poolId: String!, $first: Int!, $skip: Int!) {
|
|
238
|
+
mints(
|
|
239
|
+
first: $first
|
|
240
|
+
skip: $skip
|
|
241
|
+
orderBy: timestamp
|
|
242
|
+
orderDirection: desc
|
|
243
|
+
where: { pool: $poolId }
|
|
244
|
+
) {
|
|
245
|
+
${MINT_FIELDS}
|
|
246
|
+
}
|
|
247
|
+
}`;
|
|
248
|
+
export const BURNS = `query Burns($poolId: String!, $first: Int!, $skip: Int!) {
|
|
249
|
+
burns(
|
|
250
|
+
first: $first
|
|
251
|
+
skip: $skip
|
|
252
|
+
orderBy: timestamp
|
|
253
|
+
orderDirection: desc
|
|
254
|
+
where: { pool: $poolId }
|
|
255
|
+
) {
|
|
256
|
+
${BURN_FIELDS}
|
|
257
|
+
}
|
|
258
|
+
}`;
|
|
259
|
+
export const COLLECTS = `query Collects($poolId: String!, $first: Int!, $skip: Int!) {
|
|
260
|
+
collects(
|
|
261
|
+
first: $first
|
|
262
|
+
skip: $skip
|
|
263
|
+
orderBy: timestamp
|
|
264
|
+
orderDirection: desc
|
|
265
|
+
where: { pool: $poolId }
|
|
266
|
+
) {
|
|
267
|
+
${COLLECT_FIELDS}
|
|
268
|
+
}
|
|
269
|
+
}`;
|
|
270
|
+
export const DEX_DAY_DATA = `query DexDayData($first: Int!) {
|
|
271
|
+
jaineDexDayDatas(
|
|
272
|
+
first: $first
|
|
273
|
+
orderBy: date
|
|
274
|
+
orderDirection: desc
|
|
275
|
+
) {
|
|
276
|
+
${DEX_DAY_DATA_FIELDS}
|
|
277
|
+
}
|
|
278
|
+
}`;
|
|
279
|
+
export const TOKEN_INFO = `query TokenInfo($id: ID!) {
|
|
280
|
+
token(id: $id) {
|
|
281
|
+
${TOKEN_FIELDS}
|
|
282
|
+
}
|
|
283
|
+
}`;
|
|
284
|
+
export const TOP_TOKENS_BY_TVL = `query TopTokensByTvl($first: Int!, $skip: Int!) {
|
|
285
|
+
tokens(
|
|
286
|
+
first: $first
|
|
287
|
+
skip: $skip
|
|
288
|
+
orderBy: totalValueLockedUSD
|
|
289
|
+
orderDirection: desc
|
|
290
|
+
) {
|
|
291
|
+
${TOKEN_FIELDS}
|
|
292
|
+
}
|
|
293
|
+
}`;
|
|
294
|
+
export const TOP_TOKENS_BY_VOLUME = `query TopTokensByVolume($first: Int!, $skip: Int!) {
|
|
295
|
+
tokens(
|
|
296
|
+
first: $first
|
|
297
|
+
skip: $skip
|
|
298
|
+
orderBy: volumeUSD
|
|
299
|
+
orderDirection: desc
|
|
300
|
+
) {
|
|
301
|
+
${TOKEN_FIELDS}
|
|
302
|
+
}
|
|
303
|
+
}`;
|
|
304
|
+
//# sourceMappingURL=queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/jaine/subgraph/queries.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,GAAG;;;;;;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