@surf-ai/sdk 0.1.5-beta → 1.0.0-alpha.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 +93 -159
- package/dist/chunk-4NA3GKVD.js +100 -0
- package/dist/{client-3YMIRPDV.js → client-Z45B2GYT.js} +1 -1
- package/dist/db/index.cjs +63 -37
- package/dist/db/index.d.cts +5 -2
- package/dist/db/index.d.ts +5 -2
- package/dist/db/index.js +63 -37
- package/dist/server/index.cjs +211 -190
- package/dist/server/index.d.cts +204 -16
- package/dist/server/index.d.ts +204 -16
- package/dist/server/index.js +131 -153
- package/package.json +6 -29
- package/dist/chunk-J4OMYO3F.js +0 -70
- package/dist/react/index.d.ts +0 -3450
- package/dist/react/index.js +0 -1092
- package/src/theme/index.css +0 -314
package/dist/server/index.cjs
CHANGED
|
@@ -30,32 +30,58 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// src/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
// src/core/config.ts
|
|
34
|
+
function trimTrailingSlashes(value) {
|
|
35
|
+
return String(value || "").replace(/\/+$/, "");
|
|
36
|
+
}
|
|
37
|
+
function readSurfApiConfig() {
|
|
38
|
+
return {
|
|
39
|
+
baseUrl: trimTrailingSlashes(process.env.SURF_API_BASE_URL || DEFAULT_API_BASE_URL),
|
|
40
|
+
apiKey: process.env.SURF_API_KEY
|
|
41
|
+
};
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
|
|
43
|
+
function requireSurfApiConfig() {
|
|
44
|
+
const config = readSurfApiConfig();
|
|
45
|
+
if (!config.apiKey) {
|
|
46
|
+
throw new Error("SURF_API_KEY is required");
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
return { baseUrl: config.baseUrl, apiKey: config.apiKey };
|
|
49
|
+
}
|
|
50
|
+
function readAdminApiKey() {
|
|
51
|
+
return process.env.SURF_API_KEY;
|
|
52
|
+
}
|
|
53
|
+
var DEFAULT_API_BASE_URL;
|
|
54
|
+
var init_config = __esm({
|
|
55
|
+
"src/core/config.ts"() {
|
|
56
|
+
"use strict";
|
|
57
|
+
DEFAULT_API_BASE_URL = "https://api.ask.surf/gateway/v1";
|
|
54
58
|
}
|
|
55
|
-
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// src/core/transport.ts
|
|
62
|
+
function sleep(ms) {
|
|
63
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
56
64
|
}
|
|
57
65
|
function normalizePath(path2) {
|
|
58
|
-
return String(path2 || "").replace(/^\/+/, "")
|
|
66
|
+
return String(path2 || "").replace(/^\/+/, "");
|
|
67
|
+
}
|
|
68
|
+
function buildUrl(path2, params) {
|
|
69
|
+
const { baseUrl } = requireSurfApiConfig();
|
|
70
|
+
const url = new URL(`${baseUrl}/${normalizePath(path2)}`);
|
|
71
|
+
if (params) {
|
|
72
|
+
for (const [key, value] of Object.entries(params)) {
|
|
73
|
+
if (value != null) {
|
|
74
|
+
url.searchParams.set(key, String(value));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return url.toString();
|
|
79
|
+
}
|
|
80
|
+
function buildHeaders(extra) {
|
|
81
|
+
const { apiKey } = requireSurfApiConfig();
|
|
82
|
+
const headers = new Headers(extra);
|
|
83
|
+
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
84
|
+
return headers;
|
|
59
85
|
}
|
|
60
86
|
async function fetchJson(url, init, retries = 1) {
|
|
61
87
|
for (let attempt = 0; attempt <= retries; attempt++) {
|
|
@@ -65,37 +91,52 @@ async function fetchJson(url, init, retries = 1) {
|
|
|
65
91
|
throw new Error(`API error ${res.status}: ${text2.slice(0, 200)}`);
|
|
66
92
|
}
|
|
67
93
|
const text = await res.text();
|
|
68
|
-
if (text)
|
|
69
|
-
|
|
94
|
+
if (text) {
|
|
95
|
+
return JSON.parse(text);
|
|
96
|
+
}
|
|
97
|
+
if (attempt < retries) {
|
|
98
|
+
await sleep(1e3);
|
|
99
|
+
}
|
|
70
100
|
}
|
|
71
101
|
throw new Error(`Empty response from ${url}`);
|
|
72
102
|
}
|
|
73
|
-
async function
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (params) {
|
|
77
|
-
for (const [k, v] of Object.entries(params)) {
|
|
78
|
-
if (v != null) cleaned[k] = String(v);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
const qs = Object.keys(cleaned).length ? "?" + new URLSearchParams(cleaned).toString() : "";
|
|
82
|
-
return fetchJson(`${config.baseUrl}/${normalizePath(path2)}${qs}`, {
|
|
83
|
-
headers: config.headers
|
|
103
|
+
async function getJson(path2, params) {
|
|
104
|
+
return fetchJson(buildUrl(path2, params), {
|
|
105
|
+
headers: buildHeaders()
|
|
84
106
|
});
|
|
85
107
|
}
|
|
86
|
-
async function
|
|
87
|
-
|
|
88
|
-
return fetchJson(`${config.baseUrl}/${normalizePath(path2)}`, {
|
|
108
|
+
async function postJson(path2, body) {
|
|
109
|
+
return fetchJson(buildUrl(path2), {
|
|
89
110
|
method: "POST",
|
|
90
|
-
headers: {
|
|
111
|
+
headers: buildHeaders({
|
|
112
|
+
"Content-Type": "application/json"
|
|
113
|
+
}),
|
|
91
114
|
body: body ? JSON.stringify(body) : void 0
|
|
92
115
|
});
|
|
93
116
|
}
|
|
94
|
-
var
|
|
117
|
+
var init_transport = __esm({
|
|
118
|
+
"src/core/transport.ts"() {
|
|
119
|
+
"use strict";
|
|
120
|
+
init_config();
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// src/data/client.ts
|
|
125
|
+
var client_exports = {};
|
|
126
|
+
__export(client_exports, {
|
|
127
|
+
get: () => get,
|
|
128
|
+
post: () => post
|
|
129
|
+
});
|
|
130
|
+
async function get(path2, params) {
|
|
131
|
+
return getJson(path2, params);
|
|
132
|
+
}
|
|
133
|
+
async function post(path2, body) {
|
|
134
|
+
return postJson(path2, body);
|
|
135
|
+
}
|
|
95
136
|
var init_client = __esm({
|
|
96
137
|
"src/data/client.ts"() {
|
|
97
138
|
"use strict";
|
|
98
|
-
|
|
139
|
+
init_transport();
|
|
99
140
|
}
|
|
100
141
|
});
|
|
101
142
|
|
|
@@ -112,18 +153,27 @@ var import_express = __toESM(require("express"), 1);
|
|
|
112
153
|
var import_cors = __toESM(require("cors"), 1);
|
|
113
154
|
var import_fs = __toESM(require("fs"), 1);
|
|
114
155
|
var import_path = __toESM(require("path"), 1);
|
|
115
|
-
var import_http_proxy_middleware = require("http-proxy-middleware");
|
|
116
156
|
var import_croner = require("croner");
|
|
157
|
+
init_config();
|
|
158
|
+
function requireBearerAuth(req, res, next) {
|
|
159
|
+
const apiKey = readAdminApiKey();
|
|
160
|
+
if (!apiKey) {
|
|
161
|
+
return res.status(503).json({ error: "SURF_API_KEY is not configured" });
|
|
162
|
+
}
|
|
163
|
+
if (req.headers.authorization !== `Bearer ${apiKey}`) {
|
|
164
|
+
return res.status(401).json({ error: "Unauthorized" });
|
|
165
|
+
}
|
|
166
|
+
next();
|
|
167
|
+
}
|
|
117
168
|
function createServer(options = {}) {
|
|
118
|
-
const port = options.port
|
|
169
|
+
const port = options.port ?? (process.env.PORT ? Number.parseInt(process.env.PORT, 10) : void 0);
|
|
170
|
+
if (!Number.isInteger(port)) {
|
|
171
|
+
throw new Error("createServer requires a port via options.port or process.env.PORT");
|
|
172
|
+
}
|
|
119
173
|
const routesDir = options.routesDir || import_path.default.join(process.cwd(), "routes");
|
|
120
174
|
const cronDir = options.cronDir || process.cwd();
|
|
121
|
-
const enableProxy = options.proxy !== false;
|
|
122
175
|
const app = (0, import_express.default)();
|
|
123
176
|
app.use((0, import_cors.default)());
|
|
124
|
-
if (enableProxy) {
|
|
125
|
-
setupProxy(app, port);
|
|
126
|
-
}
|
|
127
177
|
app.use(import_express.default.json());
|
|
128
178
|
app.get("/api/health", (_req, res) => {
|
|
129
179
|
res.json({ status: "ok" });
|
|
@@ -133,12 +183,13 @@ function createServer(options = {}) {
|
|
|
133
183
|
if (!file.endsWith(".js") && !file.endsWith(".ts")) continue;
|
|
134
184
|
const name = file.replace(/\.(js|ts)$/, "");
|
|
135
185
|
try {
|
|
136
|
-
const
|
|
137
|
-
const handler = route.default || route;
|
|
186
|
+
const handler = require(import_path.default.join(routesDir, file));
|
|
138
187
|
if (typeof handler === "function") {
|
|
139
188
|
app.use(`/api/${name}`, handler);
|
|
140
189
|
console.log(`Route registered: /api/${name}`);
|
|
190
|
+
continue;
|
|
141
191
|
}
|
|
192
|
+
throw new Error(`Route module must export a handler function via module.exports`);
|
|
142
193
|
} catch (err) {
|
|
143
194
|
console.error(`Failed to load route ${file}: ${err.message}`);
|
|
144
195
|
}
|
|
@@ -162,55 +213,6 @@ function createServer(options = {}) {
|
|
|
162
213
|
}
|
|
163
214
|
};
|
|
164
215
|
}
|
|
165
|
-
function env2(surfName, legacyName) {
|
|
166
|
-
return process.env[surfName] || process.env[legacyName];
|
|
167
|
-
}
|
|
168
|
-
function setupProxy(app, port) {
|
|
169
|
-
const gatewayUrl = env2("SURF_DEPLOYED_GATEWAY_URL", "GATEWAY_URL");
|
|
170
|
-
const appToken = env2("SURF_DEPLOYED_APP_TOKEN", "APP_TOKEN");
|
|
171
|
-
const proxyBase = env2("SURF_SANDBOX_PROXY_BASE", "DATA_PROXY_BASE");
|
|
172
|
-
const isDeployed = Boolean(gatewayUrl && appToken);
|
|
173
|
-
const bufferResponse = (0, import_http_proxy_middleware.responseInterceptor)(async (buf) => buf);
|
|
174
|
-
if (isDeployed) {
|
|
175
|
-
app.use("/proxy", (0, import_http_proxy_middleware.createProxyMiddleware)({
|
|
176
|
-
target: gatewayUrl,
|
|
177
|
-
changeOrigin: true,
|
|
178
|
-
selfHandleResponse: true,
|
|
179
|
-
pathRewrite: (p) => "/gateway/v1" + p,
|
|
180
|
-
headers: {
|
|
181
|
-
Authorization: `Bearer ${appToken}`,
|
|
182
|
-
"Accept-Encoding": "identity"
|
|
183
|
-
},
|
|
184
|
-
on: { proxyRes: bufferResponse }
|
|
185
|
-
}));
|
|
186
|
-
const loopback = `http://127.0.0.1:${port}/proxy`;
|
|
187
|
-
process.env.SURF_SANDBOX_PROXY_BASE = loopback;
|
|
188
|
-
process.env.DATA_PROXY_BASE = loopback;
|
|
189
|
-
} else if (proxyBase) {
|
|
190
|
-
const target = proxyBase.replace(/\/proxy$/, "");
|
|
191
|
-
app.use((0, import_http_proxy_middleware.createProxyMiddleware)({
|
|
192
|
-
target,
|
|
193
|
-
changeOrigin: true,
|
|
194
|
-
selfHandleResponse: true,
|
|
195
|
-
pathFilter: "/proxy",
|
|
196
|
-
on: {
|
|
197
|
-
proxyReq: (proxyReq, req) => {
|
|
198
|
-
console.log(`[proxy] >> ${req.method} ${req.originalUrl}`);
|
|
199
|
-
},
|
|
200
|
-
proxyRes: (0, import_http_proxy_middleware.responseInterceptor)(async (buf, proxyRes, req) => {
|
|
201
|
-
const status = proxyRes.statusCode;
|
|
202
|
-
const tag = status && status >= 400 ? "ERR" : "OK";
|
|
203
|
-
console.log(`[proxy] << ${status} ${tag} ${req.method} ${req.originalUrl} bytes=${buf.length}`);
|
|
204
|
-
return buf;
|
|
205
|
-
}),
|
|
206
|
-
error: (err, req, res) => {
|
|
207
|
-
console.error(`[proxy] !! ${req.method} ${req.originalUrl} error: ${err.message}`);
|
|
208
|
-
if (!res.headersSent) res.status(502).json({ error: err.message });
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}));
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
216
|
var schemaSync = { run: async () => {
|
|
215
217
|
}, watch: () => {
|
|
216
218
|
} };
|
|
@@ -314,7 +316,7 @@ function setupSchemaSync(app, schemaDir) {
|
|
|
314
316
|
}
|
|
315
317
|
console.error("DB schema sync failed after all retries");
|
|
316
318
|
}
|
|
317
|
-
app.post("/api/__sync-schema", async (_req, res) => {
|
|
319
|
+
app.post("/api/__sync-schema", requireBearerAuth, async (_req, res) => {
|
|
318
320
|
try {
|
|
319
321
|
await syncWithRetry(2, 1500);
|
|
320
322
|
res.json({ ok: true });
|
|
@@ -418,16 +420,7 @@ function setupCron(app, cronDir) {
|
|
|
418
420
|
console.log(`Cron registered: [${task.id}] ${task.name} (${task.schedule})`);
|
|
419
421
|
}
|
|
420
422
|
}
|
|
421
|
-
|
|
422
|
-
app.use("/api/cron", (req, res, next) => {
|
|
423
|
-
const appToken = envFn("SURF_DEPLOYED_APP_TOKEN", "APP_TOKEN");
|
|
424
|
-
if (!appToken) return next();
|
|
425
|
-
const auth = req.headers.authorization;
|
|
426
|
-
if (!auth || auth !== `Bearer ${appToken}`) {
|
|
427
|
-
return res.status(401).json({ error: "Unauthorized" });
|
|
428
|
-
}
|
|
429
|
-
next();
|
|
430
|
-
});
|
|
423
|
+
app.use("/api/cron", requireBearerAuth);
|
|
431
424
|
app.get("/api/cron", (_req, res) => {
|
|
432
425
|
res.json(cronTasks.map((t) => {
|
|
433
426
|
const state = cronState.get(t.id) || { lastRunAt: null, lastStatus: null, lastError: null };
|
|
@@ -537,236 +530,262 @@ init_client();
|
|
|
537
530
|
// src/data/categories/exchange.ts
|
|
538
531
|
init_client();
|
|
539
532
|
var exchange = {
|
|
540
|
-
/**
|
|
533
|
+
/** Returns order book bid/ask levels with computed stats. **Included fields:** spread, spread percentage, mid-price, and total bid/ask depth. Use `limit` to control the number of price levels (1–100, default 20). Set `type=swap` to query perpetual contract order books instead of spot. */
|
|
541
534
|
depth: (params) => get("exchange/depth", params),
|
|
542
|
-
/**
|
|
535
|
+
/** Returns historical funding rate records for a perpetual contract. **Pagination:** use `from` to set the start time and `limit` to control result count. For longer history, pass the last returned timestamp as the next `from` value. **Note:** not all exchanges support historical queries via `from`; some only return recent data regardless. For the latest funding rate snapshot, see `/exchange/perp?fields=funding`. */
|
|
543
536
|
funding_history: (params) => get("exchange/funding-history", params),
|
|
544
|
-
/**
|
|
537
|
+
/** Returns OHLCV candlestick data with period summary stats (high, low, total volume). **Intervals:** 15 options from `1m` to `1M`. **Pagination:** use `from` to set the start time and `limit` to control candle count. For longer ranges, pass the last returned candle's timestamp as the next `from` value. Exchange-side limits vary (200–1000 per request). Set `type=swap` to query perpetual contract candles instead of spot. */
|
|
545
538
|
klines: (params) => get("exchange/klines", params),
|
|
546
|
-
/**
|
|
539
|
+
/** Returns historical long/short ratio for a perpetual contract. **Included fields:** ratio value, long account percentage, short account percentage. **Granularity:** `interval` supports `1h`, `4h`, `1d`. **Pagination:** use `from` for start time and `limit` for result count. For longer history, pass the last returned timestamp as the next `from` value. **Note:** not all exchanges support historical queries via `from`; some only return recent data regardless. Just pass the base pair (e.g. `pair=BTC/USDT`). For aggregated cross-exchange long/short ratio, see `/market/futures`. */
|
|
547
540
|
long_short_ratio: (params) => get("exchange/long-short-ratio", params),
|
|
548
|
-
/**
|
|
541
|
+
/** Returns trading pairs available on an exchange. **Filters:** `type` (`spot`, `swap`, `future`, `option`) or free-text `search`. **Included fields:** pair name, base/quote currencies, market type, active status, and default fee rates. Use the returned `pair` values as the `pair` parameter in other exchange endpoints. */
|
|
549
542
|
markets: (params) => get("exchange/markets", params),
|
|
550
|
-
/**
|
|
543
|
+
/** Returns a combined snapshot of perpetual contract data for a pair. **Available fields** (via `fields`): - `funding` — current funding rate, next settlement, mark/index price - `oi` — open interest in contracts and USD Just pass the base pair (e.g. `pair=BTC/USDT`). The `:USDT` swap suffix is added automatically. */
|
|
551
544
|
perp: (params) => get("exchange/perp", params),
|
|
552
|
-
/**
|
|
545
|
+
/** Returns the real-time ticker for a trading pair. **Included fields:** last price, bid/ask, 24h high/low, 24h volume, 24h price change. Set `type=swap` to query perpetual contract prices instead of spot. For historical price trends, use `/market/price`. */
|
|
553
546
|
price: (params) => get("exchange/price", params)
|
|
554
547
|
};
|
|
555
548
|
|
|
556
549
|
// src/data/categories/fund.ts
|
|
557
550
|
init_client();
|
|
558
551
|
var fund = {
|
|
559
|
-
/**
|
|
552
|
+
/** Returns a fund's **profile metadata**. **Included fields:** X accounts, team members, recent research, invested project count. This does NOT return the list of investments — use `/fund/portfolio` for that. **Lookup:** by UUID (`id`) or name (`q`). Returns 404 if not found. */
|
|
560
553
|
detail: (params) => get("fund/detail", params),
|
|
561
|
-
/**
|
|
554
|
+
/** Returns investment rounds for a fund's portfolio, sorted by date (newest first). A project may appear multiple times if the fund participated in multiple rounds. **Included fields:** project name, logo, date, raise amount, lead investor status. **Lookup:** by UUID (`id`) or name (`q`). */
|
|
562
555
|
portfolio: (params) => get("fund/portfolio", params),
|
|
563
|
-
/**
|
|
556
|
+
/** Returns top-ranked funds by a specified metric. **Available metrics:** `tier` (lower is better), `portfolio_count` (number of invested projects). */
|
|
564
557
|
ranking: (params) => get("fund/ranking", params)
|
|
565
558
|
};
|
|
566
559
|
|
|
567
560
|
// src/data/categories/kalshi.ts
|
|
568
561
|
init_client();
|
|
569
562
|
var kalshi = {
|
|
570
|
-
/**
|
|
563
|
+
/** Returns Kalshi events with nested markets, optionally filtered by `event_ticker`. Each event includes market count and a list of markets. **Data refresh:** ~30 minutes */
|
|
571
564
|
events: (params) => get("prediction-market/kalshi/events", params),
|
|
572
|
-
/**
|
|
565
|
+
/** Returns Kalshi markets, optionally filtered by `market_ticker`. Each market includes price, volume, and status. **Data refresh:** ~30 minutes */
|
|
573
566
|
markets: (params) => get("prediction-market/kalshi/markets", params),
|
|
574
|
-
/**
|
|
567
|
+
/** Returns daily open interest history for a Kalshi market, filtered by `time_range`. **Data refresh:** ~30 minutes */
|
|
575
568
|
open_interest: (params) => get("prediction-market/kalshi/open-interest", params),
|
|
576
|
-
/**
|
|
569
|
+
/** Returns price history for a Kalshi market. **Interval options:** - `interval=1d` — daily OHLC from market reports (~30 min delay) - `interval=latest` — real-time price from trades **Data refresh:** ~30 minutes (daily), real-time (latest) */
|
|
577
570
|
prices: (params) => get("prediction-market/kalshi/prices", params),
|
|
578
|
-
/**
|
|
571
|
+
/** Returns top-ranked Kalshi markets by last day's `notional_volume_usd` or `open_interest`. **Filters:** `status`. **Data refresh:** ~30 minutes */
|
|
579
572
|
ranking: (params) => get("prediction-market/kalshi/ranking", params),
|
|
580
|
-
/**
|
|
573
|
+
/** Returns individual trade records for a Kalshi market. **Filters:** `taker_side`, `min_contracts`, and date range. **Sort:** `timestamp` or `num_contracts`. **Data refresh:** real-time */
|
|
581
574
|
trades: (params) => get("prediction-market/kalshi/trades", params),
|
|
582
|
-
/**
|
|
575
|
+
/** Returns daily trading volume history for a Kalshi market, filtered by `time_range`. **Data refresh:** ~30 minutes */
|
|
583
576
|
volumes: (params) => get("prediction-market/kalshi/volumes", params)
|
|
584
577
|
};
|
|
585
578
|
|
|
586
579
|
// src/data/categories/market.ts
|
|
587
580
|
init_client();
|
|
588
581
|
var market = {
|
|
589
|
-
/**
|
|
582
|
+
/** Returns daily ETF flow history for US spot ETFs. **Included fields:** net flow (USD), token price, per-ticker breakdown. Sorted by date descending. `symbol`: `BTC` or `ETH`. */
|
|
590
583
|
etf: (params) => get("market/etf", params),
|
|
591
|
-
/**
|
|
584
|
+
/** Returns Bitcoin Fear & Greed Index history. **Included fields:** index value (0-100), classification label, BTC price at each data point. Sorted newest-first. Use `from`/`to` to filter by date range. */
|
|
592
585
|
fear_greed: (params) => get("market/fear-greed", params),
|
|
593
|
-
/**
|
|
586
|
+
/** Returns futures market data across all tracked tokens. **Included fields:** open interest, funding rate, long/short ratio, 24h volume. Sorted by `volume_24h` by default — use `sort_by` to change. */
|
|
594
587
|
futures: (params) => get("market/futures", params),
|
|
595
|
-
/**
|
|
588
|
+
/** Returns OHLC-style aggregated liquidation data for a token on a specific exchange. **Filters:** `symbol`, `exchange`, `interval`. Useful for charting liquidation volume over time. */
|
|
596
589
|
liquidation_chart: (params) => get("market/liquidation/chart", params),
|
|
597
|
-
/**
|
|
590
|
+
/** Returns liquidation breakdown by exchange. **Included fields:** total, long, and short volumes in USD. **Filters:** `symbol` and `time_range` (`1h`, `4h`, `12h`, `24h`). */
|
|
598
591
|
liquidation_exchange_list: (params) => get("market/liquidation/exchange-list", params),
|
|
599
|
-
/**
|
|
592
|
+
/** Returns individual large liquidation orders above a USD threshold (`min_amount`, default 10000). **Filters:** `exchange` and `symbol`. For aggregate totals and long/short breakdown by exchange, use `/market/liquidation/exchange-list`. For historical liquidation charts, use `/market/liquidation/chart`. */
|
|
600
593
|
liquidation_order: (params) => get("market/liquidation/order", params),
|
|
601
|
-
/**
|
|
594
|
+
/** Returns on-chain indicator time-series for BTC or ETH. **Available metrics:** `nupl`, `sopr`, `mvrv`, `puell-multiple`, `nvm`, `nvt`, `nvt-golden-cross`, `exchange-flows` (inflow/outflow/netflow/reserve). */
|
|
602
595
|
onchain_indicator: (params) => get("market/onchain-indicator", params),
|
|
603
|
-
/**
|
|
596
|
+
/** Returns options market data for a `symbol`. **Included fields:** open interest, volume, put/call ratio, max pain price. */
|
|
604
597
|
options: (params) => get("market/options", params),
|
|
605
|
-
/**
|
|
598
|
+
/** Returns historical price data points for a token over a specified time range. **Time range options:** - Predefined: `1d`, `7d`, `14d`, `30d`, `90d`, `180d`, `365d`, `max` - Custom: use `from` / `to` (Unix seconds or `YYYY-MM-DD`) **Granularity** is automatic based on range: - `1d` → 5-minute intervals - `7d`–`90d` → hourly - `180d`+ → daily */
|
|
606
599
|
price: (params) => get("market/price", params),
|
|
607
|
-
/**
|
|
600
|
+
/** Returns a technical indicator for a trading pair on a given exchange and interval. **Modes:** - Set `from`/`to` for time-series - Omit for latest value only **Indicator-specific tuning** via `options` (e.g. `period:7`, `fast_period:8,slow_period:21,signal_period:5`, `period:10,stddev:1.5`). **Available indicators:** `rsi`, `macd`, `ema`, `sma`, `bbands`, `stoch`, `adx`, `atr`, `cci`, `obv`, `vwap`, `dmi`, `ichimoku`, `supertrend`. */
|
|
608
601
|
price_indicator: (params) => get("market/price-indicator", params),
|
|
609
|
-
/**
|
|
602
|
+
/** Returns tokens ranked by a specified metric. **Available metrics:** `market_cap`, `top_gainers`, `top_losers`, `volume`. **Note:** `top_gainers` and `top_losers` rank by 24h price change within the top 250 coins by market cap. For circulating supply, FDV, ATH/ATL, use `/project/detail?fields=token_info`. */
|
|
610
603
|
ranking: (params) => get("market/ranking", params)
|
|
611
604
|
};
|
|
612
605
|
|
|
606
|
+
// src/data/categories/matching.ts
|
|
607
|
+
init_client();
|
|
608
|
+
var matching = {
|
|
609
|
+
/** Returns daily volume and open interest comparison for a specific matched market pair. Both `polymarket_condition_id` and `kalshi_market_ticker` are required. **Volume units:** Polymarket = USD, Kalshi = contracts. */
|
|
610
|
+
market_daily: (params) => get("prediction-market/matching/daily", params),
|
|
611
|
+
/** Given a Polymarket condition_id or Kalshi market_ticker, find the corresponding match on the other platform. Provide at least one of `polymarket_condition_id` or `kalshi_market_ticker`. When both are provided, results are filtered to pairs matching both (useful for verifying a specific pair). */
|
|
612
|
+
market_find: (params) => get("prediction-market/matching/find", params),
|
|
613
|
+
/** Returns one-to-one matched market pairs between Polymarket and Kalshi. Each pair maps a Polymarket condition_id to a Kalshi market_ticker with a confidence score. **Volume units differ:** Polymarket = USD, Kalshi = contracts ($1 binary options). **Data refresh:** seed-driven, updated periodically. */
|
|
614
|
+
market_pairs: (params) => get("prediction-market/matching/pairs", params)
|
|
615
|
+
};
|
|
616
|
+
|
|
613
617
|
// src/data/categories/news.ts
|
|
614
618
|
init_client();
|
|
615
619
|
var news = {
|
|
616
620
|
/** Returns the full content of a single news article by its ID (returned as `id` in feed and search results). */
|
|
617
621
|
detail: (params) => get("news/detail", params),
|
|
618
|
-
/**
|
|
622
|
+
/** Returns crypto news from major sources. **Filters:** `source` (enum), `project`, and time range (`from`/`to`). **Sort:** `recency` (default) or `trending`. Use the detail endpoint with article `id` for full content. */
|
|
619
623
|
feed: (params) => get("news/feed", params)
|
|
620
624
|
};
|
|
621
625
|
|
|
622
626
|
// src/data/categories/onchain.ts
|
|
623
627
|
init_client();
|
|
624
628
|
var onchain = {
|
|
625
|
-
/**
|
|
629
|
+
/** Returns bridge protocols ranked by total USD volume over a specified time range. */
|
|
626
630
|
bridge_ranking: (params) => get("onchain/bridge/ranking", params),
|
|
627
|
-
/**
|
|
631
|
+
/** Returns the current gas price for an EVM chain via `eth_gasPrice` JSON-RPC. **Included fields:** gas price in both wei (raw) and Gwei (human-readable). **Supported chains:** `ethereum`, `polygon`, `bsc`, `arbitrum`, `optimism`, `base`, `avalanche`, `fantom`, `linea`, `cyber`. */
|
|
628
632
|
gas_price: (params) => get("onchain/gas-price", params),
|
|
629
|
-
/**
|
|
633
|
+
/** Executes a structured JSON query on blockchain data. No raw SQL needed — specify source, fields, filters, sort, and pagination. All tables live in the **agent** database. Use `GET /v1/onchain/schema` to discover available tables and their columns. **Key rules:** - **Source format:** `agent.<table_name>` (e.g. `agent.ethereum_transactions`, `agent.ethereum_dex_trades`) - Max 10,000 rows (default 20), 30s timeout - **Always filter on block_date** — it is the partition key. Without it, queries scan billions of rows and will timeout **Data refresh:** ~24 hours. ## Example ```json { "source": "agent.ethereum_dex_trades", "fields": ["block_time", "project", "token_pair", "amount_usd", "taker"], "filters": [ {"field": "block_date", "op": "gte", "value": "2025-03-01"}, {"field": "project", "op": "eq", "value": "uniswap"}, {"field": "amount_usd", "op": "gte", "value": 100000} ], "sort": [{"field": "amount_usd", "order": "desc"}], "limit": 20 } ``` */
|
|
630
634
|
structured_query: (body) => post("onchain/query", body),
|
|
631
|
-
/**
|
|
635
|
+
/** Returns table metadata for all available on-chain databases. **Included fields:** database name, table name, column names, types, and comments. */
|
|
632
636
|
schema: () => get("onchain/schema"),
|
|
633
|
-
/**
|
|
637
|
+
/** Executes a raw SQL SELECT query against blockchain data. All tables live in the **agent** database. Use `GET /v1/onchain/schema` to discover available tables and their columns before writing queries. ## Rules - Only SELECT/WITH statements allowed (read-only) - All table references must be database-qualified: `agent.<table_name>` - Max 10,000 rows (default 1,000), 30s timeout - **Always filter on block_date or block_number** — partition key, without it queries will timeout - Avoid `SELECT *` on large tables — specify only the columns you need **Data refresh:** ~24 hours. ## Example ```sql SELECT block_time, token_pair, amount_usd, taker, tx_hash FROM agent.ethereum_dex_trades WHERE block_date >= today() - 7 AND project = 'uniswap' AND amount_usd > 100000 ORDER BY amount_usd DESC LIMIT 20 ``` */
|
|
634
638
|
sql: (body) => post("onchain/sql", body),
|
|
635
|
-
/**
|
|
639
|
+
/** Returns transaction details by hash. All numeric fields are hex-encoded — use parseInt(hex, 16) to convert. **Supported chains:** `ethereum`, `polygon`, `bsc`, `arbitrum`, `optimism`, `base`, `avalanche`, `fantom`, `linea`, `cyber`. Returns 404 if the transaction is not found. */
|
|
636
640
|
tx: (params) => get("onchain/tx", params),
|
|
637
|
-
/**
|
|
641
|
+
/** Returns DeFi yield pools ranked by APY or TVL. Returns the latest snapshot. Filter by protocol. */
|
|
638
642
|
yield_ranking: (params) => get("onchain/yield/ranking", params)
|
|
639
643
|
};
|
|
640
644
|
|
|
641
645
|
// src/data/categories/polymarket.ts
|
|
642
646
|
init_client();
|
|
643
647
|
var polymarket = {
|
|
644
|
-
/**
|
|
648
|
+
/** Returns trade and redemption activity for a Polymarket wallet. **Data refresh:** ~30 minutes */
|
|
645
649
|
activity: (params) => get("prediction-market/polymarket/activity", params),
|
|
646
|
-
/**
|
|
650
|
+
/** Returns Polymarket events with nested markets, optionally filtered by `event_slug`. Each event includes aggregated status, volume, and a list of markets with `side_a`/`side_b` outcomes. **Data refresh:** ~30 minutes */
|
|
647
651
|
events: (params) => get("prediction-market/polymarket/events", params),
|
|
648
|
-
/**
|
|
652
|
+
/** Returns Polymarket markets, optionally filtered by `market_slug`. Each market includes `side_a` and `side_b` outcomes. Current prices are available via `/polymarket/prices` using the `condition_id`. **Data refresh:** ~30 minutes */
|
|
649
653
|
markets: (params) => get("prediction-market/polymarket/markets", params),
|
|
650
|
-
/**
|
|
654
|
+
/** Returns daily open interest history for a Polymarket market. **Data refresh:** ~30 minutes */
|
|
651
655
|
open_interest: (params) => get("prediction-market/polymarket/open-interest", params),
|
|
652
|
-
/**
|
|
656
|
+
/** Returns wallet positions on Polymarket markets. **Data refresh:** ~30 minutes */
|
|
653
657
|
positions: (params) => get("prediction-market/polymarket/positions", params),
|
|
654
|
-
/**
|
|
658
|
+
/** Returns aggregated price history for a Polymarket market. Use `interval=latest` for the most recent price snapshot. **Data refresh:** ~30 minutes */
|
|
655
659
|
prices: (params) => get("prediction-market/polymarket/prices", params),
|
|
656
|
-
/**
|
|
660
|
+
/** Returns top-ranked Polymarket markets. **Sort by:** `volume_24h`, `volume_7d`, `open_interest`, or `trade_count`. **Filters:** `status` and `end_before`. **Data refresh:** ~30 minutes */
|
|
657
661
|
ranking: (params) => get("prediction-market/polymarket/ranking", params),
|
|
658
|
-
/**
|
|
662
|
+
/** Returns paginated trade records for a Polymarket market or wallet. **Filters:** `condition_id` (market) or `address` (wallet), plus `outcome_label`, `min_amount`, and date range. At least one of `condition_id` or `address` is required. **Sort:** `newest`, `oldest`, or `largest`. **Data refresh:** ~30 minutes */
|
|
659
663
|
trades: (params) => get("prediction-market/polymarket/trades", params),
|
|
660
|
-
/**
|
|
664
|
+
/** Returns trading volume and trade count history for a Polymarket market. **Data refresh:** ~30 minutes */
|
|
661
665
|
volumes: (params) => get("prediction-market/polymarket/volumes", params)
|
|
662
666
|
};
|
|
663
667
|
|
|
664
668
|
// src/data/categories/prediction_market.ts
|
|
665
669
|
init_client();
|
|
666
670
|
var prediction_market = {
|
|
667
|
-
/**
|
|
671
|
+
/** Returns daily notional volume and open interest aggregated by category across Kalshi and Polymarket. **Filters:** `source` or `category`. **Data refresh:** daily */
|
|
668
672
|
category_metrics: (params) => get("prediction-market/category-metrics", params)
|
|
669
673
|
};
|
|
670
674
|
|
|
671
675
|
// src/data/categories/project.ts
|
|
672
676
|
init_client();
|
|
673
677
|
var project = {
|
|
674
|
-
/**
|
|
678
|
+
/** Returns time-series DeFi metrics for a project. **Available metrics:** `volume`, `fee`, `fees`, `revenue`, `tvl`, `users`. **Lookup:** by UUID (`id`) or name (`q`). Filter by `chain` and date range (`from`/`to`). Returns 404 if the project is not found. **Note:** this endpoint only returns data for DeFi protocol projects (e.g. `aave`, `uniswap`, `lido`, `makerdao`). Use `q` with a DeFi protocol name. */
|
|
675
679
|
defi_metrics: (params) => get("project/defi/metrics", params),
|
|
676
|
-
/**
|
|
680
|
+
/** Returns top DeFi projects ranked by a protocol metric. **Available metrics:** `tvl`, `revenue`, `fees`, `volume`, `users`. */
|
|
677
681
|
defi_ranking: (params) => get("project/defi/ranking", params),
|
|
678
|
-
/**
|
|
682
|
+
/** Returns multiple project sub-resources in a single request. **Available fields** (via `fields`): `overview`, `token_info`, `tokenomics`, `funding`, `team`, `contracts`, `social`, `tge_status`. **Lookup:** accepts project names directly via `q` (e.g. `?q=aave`) — no need to call `/search/project` first. Also accepts UUID via `id`. Returns 404 if not found. For DeFi metrics (TVL, fees, revenue, volume, users) and per-chain breakdown, use `/project/defi/metrics`. */
|
|
679
683
|
detail: (params) => get("project/detail", params)
|
|
680
684
|
};
|
|
681
685
|
|
|
682
686
|
// src/data/categories/search.ts
|
|
683
687
|
init_client();
|
|
684
688
|
var search = {
|
|
685
|
-
/**
|
|
689
|
+
/** Searches and filters airdrop opportunities. **Filters:** keyword, status, reward type, task type. Returns paginated results with optional task details. */
|
|
686
690
|
airdrop: (params) => get("search/airdrop", params),
|
|
687
|
-
/**
|
|
691
|
+
/** Searches project events by keyword, optionally filtered by `type`. **Valid types:** `launch`, `upgrade`, `partnership`, `news`, `airdrop`, `listing`, `twitter`. **Lookup:** by UUID (`id`) or name (`q`). Returns 404 if the project is not found. */
|
|
688
692
|
events: (params) => get("search/events", params),
|
|
689
|
-
/**
|
|
693
|
+
/** Searches funds by keyword. **Included fields:** name, tier, type, logo, top invested projects. */
|
|
690
694
|
fund: (params) => get("search/fund", params),
|
|
691
|
-
/**
|
|
695
|
+
/** Searches Kalshi events by keyword and/or category. **Filters:** - Keyword matching event title, subtitle, or market title - Category At least one of `q` or `category` is required. Returns events with nested markets. **Data refresh:** ~30 minutes */
|
|
692
696
|
kalshi: (params) => get("search/kalshi", params),
|
|
693
|
-
/**
|
|
697
|
+
/** Searches crypto news articles by keyword. Returns top 10 results ranked by relevance with highlighted matching fragments. */
|
|
694
698
|
news: (params) => get("search/news", params),
|
|
695
|
-
/**
|
|
699
|
+
/** Searches Polymarket events by keyword, tags, and/or category. **Filters:** - Keyword matching market question, event title, or description - Comma-separated tag labels - Surf-curated category At least one of `q`, `tags`, or `category` is required. Returns events with nested markets ranked by volume. **Data refresh:** ~30 minutes */
|
|
696
700
|
polymarket: (params) => get("search/polymarket", params),
|
|
697
|
-
/**
|
|
701
|
+
/** Searches crypto projects by keyword. **Included fields:** name, description, chains, logo. */
|
|
698
702
|
project: (params) => get("search/project", params),
|
|
699
|
-
/**
|
|
703
|
+
/** Searches X (Twitter) users by keyword. **Included fields:** handle, display name, bio, follower count, avatar. */
|
|
700
704
|
social_people: (params) => get("search/social/people", params),
|
|
701
|
-
/**
|
|
705
|
+
/** Searches X (Twitter) posts by keyword or `from:handle` syntax. **Included fields:** author, content, engagement metrics, timestamp. **Pagination:** check `meta.has_more`; if true, pass `meta.next_cursor` as the `cursor` query parameter in the next request. */
|
|
702
706
|
social_posts: (params) => get("search/social/posts", params),
|
|
703
|
-
/**
|
|
707
|
+
/** Searches wallets by ENS name, address label, or address prefix. Returns matching wallet addresses with entity labels. */
|
|
704
708
|
wallet: (params) => get("search/wallet", params),
|
|
705
|
-
/**
|
|
709
|
+
/** Searches web pages, articles, and content by keyword. **Filters:** domain via `site` (e.g. `coindesk.com`). **Included fields:** titles, URLs, content snippets. */
|
|
706
710
|
web: (params) => get("search/web", params)
|
|
707
711
|
};
|
|
708
712
|
|
|
709
713
|
// src/data/categories/social.ts
|
|
710
714
|
init_client();
|
|
711
715
|
var social = {
|
|
712
|
-
/**
|
|
716
|
+
/** Returns a **point-in-time snapshot** of social analytics for a project. **Available fields** (via `fields`): `sentiment`, `follower_geo`, `smart_followers`. **Lookup:** by X account ID (`x_id`) or project name (`q`, e.g. `uniswap`, `solana`). The `q` parameter must be a crypto project name, not a personal Twitter handle. Returns 404 if the project has no linked Twitter account. For sentiment **trends over time**, use `/social/mindshare` instead. */
|
|
713
717
|
detail: (params) => get("social/detail", params),
|
|
714
|
-
/**
|
|
718
|
+
/** Returns mindshare (social view count) **time-series trend** for a project, aggregated by `interval`. **Intervals:** `5m`, `1h`, `1d`, `7d`. **Filters:** date range with `from`/`to` (Unix seconds). Lookup by name (`q`). Use this for sentiment **trends**, mindshare **over time**, or social momentum changes. For a **point-in-time snapshot** of social analytics (sentiment score, follower geo, smart followers), use `/social/detail` instead. */
|
|
715
719
|
mindshare: (params) => get("social/mindshare", params),
|
|
716
|
-
/**
|
|
720
|
+
/** Returns top crypto projects ranked by mindshare (social view count), refreshed every 5 minutes. **Filters:** - `tag` — scope to a category (e.g. `dex`, `l1`, `meme`) - `time_range` — ranking window (`24h`, `48h`, `7d`, `30d`) Supports `limit`/`offset` pagination. */
|
|
717
721
|
ranking: (params) => get("social/ranking", params),
|
|
718
|
-
/**
|
|
722
|
+
/** Returns smart follower count time-series for a project, sorted by date descending. **Lookup:** by X account ID (`x_id`) or project name (`q`). The `q` parameter must be a project name (e.g. `uniswap`, `ethereum`), not a personal X handle — use `x_id` for individual accounts. Returns 404 if the project has no linked X account. */
|
|
719
723
|
smart_followers_history: (params) => get("social/smart-followers/history", params),
|
|
720
|
-
/** Returns replies/comments on a specific tweet. Lookup by `tweet_id`. */
|
|
724
|
+
/** Returns replies/comments on a specific tweet. **Lookup:** by `tweet_id`. */
|
|
721
725
|
tweet_replies: (params) => get("social/tweet/replies", params),
|
|
722
|
-
/**
|
|
726
|
+
/** Returns X (Twitter) posts by numeric post ID strings. Pass up to 100 comma-separated IDs via the `ids` query parameter. */
|
|
723
727
|
tweets: (params) => get("social/tweets", params),
|
|
724
|
-
/**
|
|
728
|
+
/** Returns an X (Twitter) user profile. **Included fields:** display name, follower count, following count, and bio. **Lookup:** by `handle` (without @). */
|
|
725
729
|
user: (params) => get("social/user", params),
|
|
726
|
-
/** Returns a list of followers for the specified handle on X (Twitter). Lookup by `handle` (without @). */
|
|
730
|
+
/** Returns a list of followers for the specified handle on X (Twitter). **Lookup:** by `handle` (without @). */
|
|
727
731
|
user_followers: (params) => get("social/user/followers", params),
|
|
728
|
-
/** Returns a list of users that the specified handle follows on X (Twitter). Lookup by `handle` (without @). */
|
|
732
|
+
/** Returns a list of users that the specified handle follows on X (Twitter). **Lookup:** by `handle` (without @). */
|
|
729
733
|
user_following: (params) => get("social/user/following", params),
|
|
730
|
-
/**
|
|
734
|
+
/** Returns recent X (Twitter) posts by a specific user, ordered by recency. **Lookup:** by `handle` (without @). Use `filter=original` to exclude retweets. **Pagination:** check `meta.has_more`; if true, pass `meta.next_cursor` as the `cursor` query parameter in the next request. */
|
|
731
735
|
user_posts: (params) => get("social/user/posts", params),
|
|
732
|
-
/** Returns recent replies by the specified handle on X (Twitter). Lookup by `handle` (without @). */
|
|
736
|
+
/** Returns recent replies by the specified handle on X (Twitter). **Lookup:** by `handle` (without @). */
|
|
733
737
|
user_replies: (params) => get("social/user/replies", params)
|
|
734
738
|
};
|
|
735
739
|
|
|
736
740
|
// src/data/categories/token.ts
|
|
737
741
|
init_client();
|
|
738
742
|
var token = {
|
|
739
|
-
/**
|
|
743
|
+
/** Returns recent DEX swap events for a token contract address. **Covered DEXes:** `uniswap`, `sushiswap`, `curve`, `balancer`. **Included fields:** trading pair, amounts, USD value, taker address. **Data refresh:** ~24 hours · **Chains:** Ethereum, Base */
|
|
740
744
|
dex_trades: (params) => get("token/dex-trades", params),
|
|
741
|
-
/**
|
|
745
|
+
/** Returns top token holders for a contract address. **Included fields:** wallet address, balance, and percentage. **Lookup:** by `address` and `chain`. Supports EVM chains and Solana. */
|
|
742
746
|
holders: (params) => get("token/holders", params),
|
|
743
|
-
/**
|
|
747
|
+
/** Returns token unlock time-series with amounts and allocation breakdowns. **Lookup:** by project UUID (`id`) or token `symbol`. Filter by date range with `from`/`to` — defaults to the current calendar month when omitted. Returns 404 if no token found. */
|
|
744
748
|
tokenomics: (params) => get("token/tokenomics", params),
|
|
745
|
-
/**
|
|
749
|
+
/** Returns recent transfer events **for a specific token** (ERC-20/TRC-20 contract). Pass the **token contract address** in `address` — returns every on-chain transfer of that token regardless of sender/receiver. **Included fields:** sender, receiver, raw amount, block timestamp. Use this to analyze a token's on-chain activity (e.g. large movements, distribution patterns). **Lookup:** `address` (token contract) + `chain`. Sort by `asc` or `desc`. **Data refresh:** ~24 hours · **Chains:** Ethereum, Base, TRON (Solana uses a different source with no delay) */
|
|
746
750
|
transfers: (params) => get("token/transfers", params)
|
|
747
751
|
};
|
|
748
752
|
|
|
753
|
+
// src/data/categories/v2.ts
|
|
754
|
+
init_client();
|
|
755
|
+
var v2 = {
|
|
756
|
+
/** Historical orderbook snapshots for a Kalshi market. Returns yes-side bid/ask levels. Timestamps in milliseconds, prices in cents. Data refresh: ~5 minutes */
|
|
757
|
+
kalshi_orderbooks: (params) => get("gateway/v2/kalshi/orderbooks", params),
|
|
758
|
+
/** OHLCV candlestick data for a Polymarket market. Prices normalized to YES side. Data refresh: ~30 minutes */
|
|
759
|
+
polymarket_candlesticks: (params) => get("gateway/v2/polymarket/candlesticks/{condition_id}", params),
|
|
760
|
+
/** Cumulative volume time series for a Polymarket token. Data refresh: ~30 minutes */
|
|
761
|
+
polymarket_volume_timeseries: (params) => get("gateway/v2/polymarket/markets/{token_id}/volume", params),
|
|
762
|
+
/** Historical orderbook snapshots for a Polymarket token. Returns raw bid/ask depth levels. Timestamps in milliseconds. Data refresh: ~5 minutes */
|
|
763
|
+
polymarket_orderbooks: (params) => get("gateway/v2/polymarket/orderbooks", params),
|
|
764
|
+
/** Volume breakdown by outcome (YES/NO) for a Polymarket market. Data refresh: ~30 minutes */
|
|
765
|
+
polymarket_volume_chart: (params) => get("gateway/v2/polymarket/volume-chart/{condition_id}", params)
|
|
766
|
+
};
|
|
767
|
+
|
|
749
768
|
// src/data/categories/wallet.ts
|
|
750
769
|
init_client();
|
|
751
770
|
var wallet = {
|
|
752
|
-
/**
|
|
771
|
+
/** Returns multiple wallet sub-resources in a single request. **Available fields** (via `fields`): `balance`, `tokens`, `labels`, `nft`. **Lookup:** by `address`. Partial failures return available fields with per-field error info. Returns 422 if `fields` is invalid. */
|
|
753
772
|
detail: (params) => get("wallet/detail", params),
|
|
754
|
-
/**
|
|
773
|
+
/** Returns full transaction history for a wallet — swaps, transfers, and contract interactions. **Lookup:** by `address`. Filter by `chain` — supports `ethereum`, `polygon`, `bsc`, `arbitrum`, `optimism`, `avalanche`, `fantom`, `base`. */
|
|
755
774
|
history: (params) => get("wallet/history", params),
|
|
756
|
-
/**
|
|
775
|
+
/** Returns entity labels for multiple wallet addresses. Pass up to 100 comma-separated addresses via the `addresses` query parameter. **Included fields:** entity name, type, and labels per address. */
|
|
757
776
|
labels_batch: (params) => get("wallet/labels/batch", params),
|
|
758
|
-
/**
|
|
777
|
+
/** Returns a time-series of the wallet's total net worth in USD. Returns ~288 data points at 5-minute intervals covering the last 24 hours. Fixed window — no custom time range supported. */
|
|
759
778
|
net_worth: (params) => get("wallet/net-worth", params),
|
|
760
|
-
/**
|
|
779
|
+
/** Returns all DeFi protocol positions for a wallet — lending, staking, LP, and farming with token breakdowns and USD values. **Lookup:** by `address`. */
|
|
761
780
|
protocols: (params) => get("wallet/protocols", params),
|
|
762
|
-
/**
|
|
781
|
+
/** Returns recent token transfers **sent or received by a wallet**. Pass the **wallet address** in `address` — returns all ERC-20/SPL token transfers where this wallet is the sender or receiver. **Included fields:** token contract, counterparty, raw amount, block timestamp. Use this to audit a wallet's token flow (e.g. inflows, outflows, airdrop receipts). **Lookup:** `address` (wallet, raw 0x hex or base58 — ENS not supported). Filter by `chain` — supports `ethereum`, `base`, `solana`. **Data refresh:** ~24 hours · **Chains:** Ethereum, Base (Solana uses a different source with no delay) */
|
|
763
782
|
transfers: (params) => get("wallet/transfers", params)
|
|
764
783
|
};
|
|
765
784
|
|
|
766
785
|
// src/data/categories/web.ts
|
|
767
786
|
init_client();
|
|
768
787
|
var web = {
|
|
769
|
-
/**
|
|
788
|
+
/** Fetches a web page and converts it to clean, LLM-friendly markdown. **Options:** - `target_selector` — extract specific page sections - `remove_selector` — strip unwanted elements Returns 400 if the URL is invalid or unreachable. */
|
|
770
789
|
fetch: (params) => get("web/fetch", params)
|
|
771
790
|
};
|
|
772
791
|
|
|
@@ -780,6 +799,7 @@ var dataApi = {
|
|
|
780
799
|
fund,
|
|
781
800
|
kalshi,
|
|
782
801
|
market,
|
|
802
|
+
matching,
|
|
783
803
|
news,
|
|
784
804
|
onchain,
|
|
785
805
|
polymarket,
|
|
@@ -788,6 +808,7 @@ var dataApi = {
|
|
|
788
808
|
search,
|
|
789
809
|
social,
|
|
790
810
|
token,
|
|
811
|
+
v2,
|
|
791
812
|
wallet,
|
|
792
813
|
web
|
|
793
814
|
};
|