@surf-ai/sdk 0.1.0 → 0.1.4
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/dist/react/index.d.ts +247 -179
- package/dist/react/index.js +215 -103
- package/dist/server/index.cjs +35 -35
- package/dist/server/index.d.cts +240 -172
- package/dist/server/index.d.ts +240 -172
- package/dist/server/index.js +35 -35
- package/package.json +8 -4
package/dist/server/index.cjs
CHANGED
|
@@ -568,19 +568,19 @@ var fund = {
|
|
|
568
568
|
init_client();
|
|
569
569
|
var kalshi = {
|
|
570
570
|
/** Get 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
|
-
events: (params) => get("kalshi/events", params),
|
|
571
|
+
events: (params) => get("prediction-market/kalshi/events", params),
|
|
572
572
|
/** Get Kalshi markets, optionally filtered by `market_ticker`. Each market includes price, volume, and status. Data refresh: ~30 minutes */
|
|
573
|
-
markets: (params) => get("kalshi/markets", params),
|
|
573
|
+
markets: (params) => get("prediction-market/kalshi/markets", params),
|
|
574
574
|
/** Get daily open interest history for a Kalshi market filtered by `time_range`. Data refresh: ~30 minutes */
|
|
575
|
-
open_interest: (params) => get("kalshi/open-interest", params),
|
|
575
|
+
open_interest: (params) => get("prediction-market/kalshi/open-interest", params),
|
|
576
576
|
/** Get price history for a Kalshi market. Use `interval=1d` for daily OHLC from market reports (~30 min delay), or `interval=latest` for real-time price from trades. Data refresh: ~30 minutes (daily), real-time (latest) */
|
|
577
|
-
prices: (params) => get("kalshi/prices", params),
|
|
577
|
+
prices: (params) => get("prediction-market/kalshi/prices", params),
|
|
578
578
|
/** Get top-ranked Kalshi markets by last day's `notional_volume_usd` or `open_interest`. Filter by `status`. Data refresh: ~30 minutes */
|
|
579
|
-
ranking: (params) => get("kalshi/ranking", params),
|
|
579
|
+
ranking: (params) => get("prediction-market/kalshi/ranking", params),
|
|
580
580
|
/** Get individual trade records for a Kalshi market. Filter by `taker_side`, `min_contracts`, and date range. Sort by `timestamp` or `num_contracts`. Data refresh: real-time */
|
|
581
|
-
trades: (params) => get("kalshi/trades", params),
|
|
581
|
+
trades: (params) => get("prediction-market/kalshi/trades", params),
|
|
582
582
|
/** Get daily trading volume history for a Kalshi market filtered by `time_range`. Data refresh: ~30 minutes */
|
|
583
|
-
volumes: (params) => get("kalshi/volumes", params)
|
|
583
|
+
volumes: (params) => get("prediction-market/kalshi/volumes", params)
|
|
584
584
|
};
|
|
585
585
|
|
|
586
586
|
// src/data/categories/market.ts
|
|
@@ -593,11 +593,11 @@ var market = {
|
|
|
593
593
|
/** Get futures market data across all tracked tokens — open interest, funding rate, long/short ratio, and 24h volume. Sort by `sort_by` (default: volume_24h). */
|
|
594
594
|
futures: (params) => get("market/futures", params),
|
|
595
595
|
/** Get OHLC-style aggregated liquidation data for a token on a specific exchange. Filter by `symbol`, `exchange`, and `interval`. Useful for charting liquidation volume over time. */
|
|
596
|
-
liquidation_chart: (params) => get("market/liquidation
|
|
596
|
+
liquidation_chart: (params) => get("market/liquidation/chart", params),
|
|
597
597
|
/** Get liquidation breakdown by exchange — total, long, and short volumes in USD. Filter by `symbol` and `time_range` (`1h`, `4h`, `12h`, `24h`). */
|
|
598
|
-
liquidation_exchange_list: (params) => get("market/liquidation
|
|
598
|
+
liquidation_exchange_list: (params) => get("market/liquidation/exchange-list", params),
|
|
599
599
|
/** Get individual large liquidation orders above a USD threshold (`min_amount`, default 10000). Filter by `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
|
-
liquidation_order: (params) => get("market/liquidation
|
|
600
|
+
liquidation_order: (params) => get("market/liquidation/order", params),
|
|
601
601
|
/** Get on-chain indicator time-series for BTC or ETH. Metrics: `nupl`, `sopr`, `mvrv`, `puell-multiple`, `nvm`, `nvt`, `nvt-golden-cross`, `exchange-flows` (inflow/outflow/netflow/reserve). */
|
|
602
602
|
onchain_indicator: (params) => get("market/onchain-indicator", params),
|
|
603
603
|
/** Get options market data — open interest, volume, put/call ratio, and max pain price for a `symbol`. */
|
|
@@ -623,42 +623,42 @@ var news = {
|
|
|
623
623
|
init_client();
|
|
624
624
|
var onchain = {
|
|
625
625
|
/** List bridge protocols ranked by total USD volume over a time range. */
|
|
626
|
-
bridge_ranking: (params) => get("onchain/bridge
|
|
626
|
+
bridge_ranking: (params) => get("onchain/bridge/ranking", params),
|
|
627
627
|
/** Get the current gas price for an EVM chain via `eth_gasPrice` JSON-RPC. Returns gas price in both wei (raw) and Gwei (human-readable). **Supported chains:** `ethereum`, `polygon`, `bsc`, `arbitrum`, `optimism`, `base`, `avalanche`, `fantom`, `linea`, `cyber`. */
|
|
628
628
|
gas_price: (params) => get("onchain/gas-price", params),
|
|
629
|
-
/** Execute 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. - Source format: `agent.<table_name>` like `agent.ethereum_transactions` or `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. */
|
|
630
|
-
structured_query: (body) => post("onchain/
|
|
629
|
+
/** Execute 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. - Source format: `agent.<table_name>` like `agent.ethereum_transactions` or `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
|
+
structured_query: (body) => post("onchain/query", body),
|
|
631
631
|
/** Get table metadata — database, table, column names, types, and comments for all available on-chain databases. */
|
|
632
632
|
schema: () => get("onchain/schema"),
|
|
633
|
-
/** Execute 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. */
|
|
633
|
+
/** Execute 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
634
|
sql: (body) => post("onchain/sql", body),
|
|
635
635
|
/** Get 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
636
|
tx: (params) => get("onchain/tx", params),
|
|
637
637
|
/** List DeFi yield pools ranked by APY or TVL. Returns the latest snapshot. Filter by protocol. */
|
|
638
|
-
yield_ranking: (params) => get("onchain/yield
|
|
638
|
+
yield_ranking: (params) => get("onchain/yield/ranking", params)
|
|
639
639
|
};
|
|
640
640
|
|
|
641
641
|
// src/data/categories/polymarket.ts
|
|
642
642
|
init_client();
|
|
643
643
|
var polymarket = {
|
|
644
644
|
/** Get trade and redemption activity for a Polymarket wallet. Data refresh: ~30 minutes */
|
|
645
|
-
activity: (params) => get("polymarket/activity", params),
|
|
645
|
+
activity: (params) => get("prediction-market/polymarket/activity", params),
|
|
646
646
|
/** Get 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
|
-
events: (params) => get("polymarket/events", params),
|
|
647
|
+
events: (params) => get("prediction-market/polymarket/events", params),
|
|
648
648
|
/** Get 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
|
-
markets: (params) => get("polymarket/markets", params),
|
|
649
|
+
markets: (params) => get("prediction-market/polymarket/markets", params),
|
|
650
650
|
/** Get daily open interest history for a Polymarket market. Data refresh: ~30 minutes */
|
|
651
|
-
open_interest: (params) => get("polymarket/open-interest", params),
|
|
651
|
+
open_interest: (params) => get("prediction-market/polymarket/open-interest", params),
|
|
652
652
|
/** Get wallet positions on Polymarket markets. Data refresh: ~30 minutes */
|
|
653
|
-
positions: (params) => get("polymarket/positions", params),
|
|
653
|
+
positions: (params) => get("prediction-market/polymarket/positions", params),
|
|
654
654
|
/** Get aggregated price history for a Polymarket market. Use `interval=latest` for the most recent price snapshot. Data refresh: ~30 minutes */
|
|
655
|
-
prices: (params) => get("polymarket/prices", params),
|
|
655
|
+
prices: (params) => get("prediction-market/polymarket/prices", params),
|
|
656
656
|
/** Get top-ranked Polymarket markets by `volume_24h`, `volume_7d`, `open_interest`, or `trade_count`. Filter by `status` and `end_before`. Data refresh: ~30 minutes */
|
|
657
|
-
ranking: (params) => get("polymarket/ranking", params),
|
|
657
|
+
ranking: (params) => get("prediction-market/polymarket/ranking", params),
|
|
658
658
|
/** Get paginated trade records for a Polymarket market or wallet. Filter by `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 by `newest`, `oldest`, or `largest`. Data refresh: ~30 minutes */
|
|
659
|
-
trades: (params) => get("polymarket/trades", params),
|
|
659
|
+
trades: (params) => get("prediction-market/polymarket/trades", params),
|
|
660
660
|
/** Get trading volume and trade count history for a Polymarket market. Data refresh: ~30 minutes */
|
|
661
|
-
volumes: (params) => get("polymarket/volumes", params)
|
|
661
|
+
volumes: (params) => get("prediction-market/polymarket/volumes", params)
|
|
662
662
|
};
|
|
663
663
|
|
|
664
664
|
// src/data/categories/prediction_market.ts
|
|
@@ -672,9 +672,9 @@ var prediction_market = {
|
|
|
672
672
|
init_client();
|
|
673
673
|
var project = {
|
|
674
674
|
/** Get 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
|
-
defi_metrics: (params) => get("project/defi
|
|
675
|
+
defi_metrics: (params) => get("project/defi/metrics", params),
|
|
676
676
|
/** Get top DeFi projects ranked by a protocol metric. Available metrics: `tvl`, `revenue`, `fees`, `volume`, `users`. */
|
|
677
|
-
defi_ranking: (params) => get("project/defi
|
|
677
|
+
defi_ranking: (params) => get("project/defi/ranking", params),
|
|
678
678
|
/** Get multiple project sub-resources in a single request. Use `fields` to select: `overview`, `token_info`, `tokenomics`, `funding`, `team`, `contracts`, `social`, `tge_status`. **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
679
|
detail: (params) => get("project/detail", params)
|
|
680
680
|
};
|
|
@@ -697,9 +697,9 @@ var search = {
|
|
|
697
697
|
/** Search crypto projects by keyword. Returns matching projects with name, description, chains, and logo. */
|
|
698
698
|
project: (params) => get("search/project", params),
|
|
699
699
|
/** Search X (Twitter) users by keyword. Returns user profiles with handle, display name, bio, follower count, and avatar. */
|
|
700
|
-
social_people: (params) => get("search/social
|
|
700
|
+
social_people: (params) => get("search/social/people", params),
|
|
701
701
|
/** Search X (Twitter) posts by keyword or `from:handle` syntax. Returns posts with author, content, engagement metrics, and timestamp. To load more results, check `meta.has_more`; if true, pass `meta.next_cursor` as the `cursor` query parameter in the next request. */
|
|
702
|
-
social_posts: (params) => get("search/social
|
|
702
|
+
social_posts: (params) => get("search/social/posts", params),
|
|
703
703
|
/** Search wallets by ENS name, address label, or address prefix. Returns matching wallet addresses with entity labels. */
|
|
704
704
|
wallet: (params) => get("search/wallet", params),
|
|
705
705
|
/** Search web pages, articles, and content by keyword. Filter by domain with `site` like `coindesk.com`. Returns titles, URLs, and content snippets. */
|
|
@@ -716,21 +716,21 @@ var social = {
|
|
|
716
716
|
/** Get top crypto projects ranked by mindshare (social view count), sourced directly from Argus real-time data (refreshed every 5 minutes). Filter by `tag` to scope to a category (e.g. `dex`, `l1`, `meme`). Use `time_range` (`24h`, `48h`, `7d`, `30d`) to control the ranking window. Supports `limit`/`offset` pagination. */
|
|
717
717
|
ranking: (params) => get("social/ranking", params),
|
|
718
718
|
/** Get 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
|
-
smart_followers_history: (params) => get("social/smart-followers
|
|
719
|
+
smart_followers_history: (params) => get("social/smart-followers/history", params),
|
|
720
720
|
/** Returns replies/comments on a specific tweet. Lookup by `tweet_id`. */
|
|
721
|
-
tweet_replies: (params) => get("social/tweet
|
|
721
|
+
tweet_replies: (params) => get("social/tweet/replies", params),
|
|
722
722
|
/** Get X (Twitter) posts by numeric post ID strings. Pass up to 100 comma-separated IDs via the `ids` query parameter. */
|
|
723
723
|
tweets: (params) => get("social/tweets", params),
|
|
724
724
|
/** Get an X (Twitter) user profile — display name, follower count, following count, and bio. Lookup by `handle` (without @). */
|
|
725
725
|
user: (params) => get("social/user", params),
|
|
726
726
|
/** Returns a list of followers for the specified handle on X (Twitter). Lookup by `handle` (without @). */
|
|
727
|
-
user_followers: (params) => get("social/user
|
|
727
|
+
user_followers: (params) => get("social/user/followers", params),
|
|
728
728
|
/** Returns a list of users that the specified handle follows on X (Twitter). Lookup by `handle` (without @). */
|
|
729
|
-
user_following: (params) => get("social/user
|
|
729
|
+
user_following: (params) => get("social/user/following", params),
|
|
730
730
|
/** Get recent X (Twitter) posts by a specific user, ordered by recency. Lookup by `handle` (without @). Use `filter=original` to exclude retweets. To load more results, check `meta.has_more`; if true, pass `meta.next_cursor` as the `cursor` query parameter in the next request. */
|
|
731
|
-
user_posts: (params) => get("social/user
|
|
731
|
+
user_posts: (params) => get("social/user/posts", params),
|
|
732
732
|
/** Returns recent replies by the specified handle on X (Twitter). Lookup by `handle` (without @). */
|
|
733
|
-
user_replies: (params) => get("social/user
|
|
733
|
+
user_replies: (params) => get("social/user/replies", params)
|
|
734
734
|
};
|
|
735
735
|
|
|
736
736
|
// src/data/categories/token.ts
|
|
@@ -754,7 +754,7 @@ var wallet = {
|
|
|
754
754
|
/** Get 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
755
|
history: (params) => get("wallet/history", params),
|
|
756
756
|
/** Get entity labels for multiple wallet addresses. Pass up to 100 comma-separated addresses via the `addresses` query parameter. Returns entity name, type, and labels per address. */
|
|
757
|
-
labels_batch: (params) => get("wallet/labels
|
|
757
|
+
labels_batch: (params) => get("wallet/labels/batch", params),
|
|
758
758
|
/** Get 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
759
|
net_worth: (params) => get("wallet/net-worth", params),
|
|
760
760
|
/** Get all DeFi protocol positions for a wallet — lending, staking, LP, and farming with token breakdowns and USD values. Lookup by `address`. */
|