@blockrun/llm 1.12.0 → 1.15.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 +66 -16
- package/dist/index.cjs +69 -9
- package/dist/index.d.cts +49 -6
- package/dist/index.d.ts +49 -6
- package/dist/index.js +69 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @blockrun/llm (TypeScript SDK)
|
|
2
2
|
|
|
3
3
|
> **@blockrun/llm** is a TypeScript/Node.js SDK for accessing 41+ large language models (GPT-5, Claude, Gemini, Grok, DeepSeek, Kimi, and more) with automatic pay-per-request USDC micropayments via the x402 protocol. No API keys required — your wallet signature is your authentication. Supports **streaming**, smart routing, Base and Solana chains.
|
|
4
|
+
>
|
|
5
|
+
> 🆓 **Includes 9 fully-free NVIDIA-hosted models** — DeepSeek V4 Pro/Flash (1M context), Nemotron Nano Omni (vision), Qwen3, Llama 4, GLM-4.7, Mistral. Zero USDC, no rate-limit gimmicks. Use `routingProfile: 'free'` or call any `nvidia/*` model directly.
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/@blockrun/llm)
|
|
6
8
|
[](LICENSE)
|
|
@@ -39,6 +41,41 @@ const response = await client.chat('openai/gpt-4o', 'Hello!');
|
|
|
39
41
|
|
|
40
42
|
That's it. The SDK handles x402 payment automatically.
|
|
41
43
|
|
|
44
|
+
### Try It Free (No USDC Required)
|
|
45
|
+
|
|
46
|
+
Want to kick the tires before funding a wallet? Route to BlockRun's free NVIDIA tier:
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { LLMClient } from '@blockrun/llm';
|
|
50
|
+
|
|
51
|
+
const client = new LLMClient(); // Wallet still required for signing, but $0 charged
|
|
52
|
+
|
|
53
|
+
// Option 1: call a free model directly
|
|
54
|
+
const reply = await client.chat('nvidia/qwen3-next-80b-a3b-thinking', 'Explain x402 in 1 sentence');
|
|
55
|
+
|
|
56
|
+
// Option 2: let the smart router pick the best free model per request
|
|
57
|
+
const result = await client.smartChat('What is 2+2?', { routingProfile: 'free' });
|
|
58
|
+
console.log(result.model); // e.g. 'nvidia/deepseek-v4-flash' (cheapest capable for SIMPLE tier)
|
|
59
|
+
console.log(result.response); // '4'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Available free models** (input + output both $0, all NVIDIA-hosted, last refreshed 2026-04-28):
|
|
63
|
+
|
|
64
|
+
| Model ID | Context | Best For |
|
|
65
|
+
|----------|---------|----------|
|
|
66
|
+
| `nvidia/deepseek-v4-flash` | 1M | DeepSeek V4 Flash — 284B / 13B active MoE, ~5× faster than V4 Pro. Best free chat / summarization / light reasoning |
|
|
67
|
+
| `nvidia/nemotron-3-nano-omni-30b-a3b-reasoning` | 256K | Only vision-capable free model — text + images + video (≤2 min) + audio (≤1 hr) |
|
|
68
|
+
| `nvidia/qwen3-next-80b-a3b-thinking` | 131K | 116 tok/s reasoning with thinking mode |
|
|
69
|
+
| `nvidia/mistral-small-4-119b` | 131K | 114 tok/s — fastest free chat |
|
|
70
|
+
| `nvidia/llama-4-maverick` | 131K | Meta Llama 4 Maverick MoE |
|
|
71
|
+
| `nvidia/qwen3-coder-480b` | 131K | Coding-optimised 480B MoE |
|
|
72
|
+
| `nvidia/gpt-oss-120b` | 128K | OpenAI open-weight 120B — 123 tok/s. Hidden from `/v1/models` for privacy but direct calls still work |
|
|
73
|
+
| `nvidia/gpt-oss-20b` | 128K | OpenAI open-weight 20B — 155 tok/s. Hidden from `/v1/models` but direct calls still work |
|
|
74
|
+
|
|
75
|
+
> Need V4-Pro-class reasoning? Use the paid `deepseek/deepseek-v4-pro` ($0.50/$1.00 with the 75% promo through 2026-05-31) — `nvidia/deepseek-v4-pro` is currently hidden because NVIDIA's NIM deployment is hung; backend MODEL_REDIRECTS forwards calls to V4 Flash.
|
|
76
|
+
|
|
77
|
+
> Note: `nvidia/gpt-oss-120b` and `nvidia/gpt-oss-20b` were retired 2026-04-28 — NVIDIA's free build.nvidia.com tier reserves the right to use prompts/outputs for service improvement, which conflicts with our data-privacy policy.
|
|
78
|
+
|
|
42
79
|
## Quick Start (Solana)
|
|
43
80
|
|
|
44
81
|
```typescript
|
|
@@ -115,7 +152,7 @@ console.log(complex.model); // 'xai/grok-4-1-fast-reasoning'
|
|
|
115
152
|
|
|
116
153
|
| Profile | Description | Best For |
|
|
117
154
|
|---------|-------------|----------|
|
|
118
|
-
| `free` |
|
|
155
|
+
| `free` | NVIDIA free tier — smart-routes across 9 models (DeepSeek V4 Pro/Flash, Nemotron Nano Omni, Qwen3, GLM-4.7, Llama 4, Mistral) | Zero-cost testing, dev, prod |
|
|
119
156
|
| `eco` | Cheapest models per tier (DeepSeek, xAI) | Cost-sensitive production |
|
|
120
157
|
| `auto` | Best balance of cost/quality (default) | General use |
|
|
121
158
|
| `premium` | Top-tier models (OpenAI, Anthropic) | Quality-critical tasks |
|
|
@@ -213,10 +250,17 @@ Released 2026-04-23 — first fully retrained base since GPT-4.5. 1M context, 12
|
|
|
213
250
|
| `google/gemini-2.5-flash-lite` | $0.10/M | $0.40/M |
|
|
214
251
|
|
|
215
252
|
### DeepSeek
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
253
|
+
|
|
254
|
+
V4 family launched 2026-04-24. DeepSeek upstream now serves the legacy
|
|
255
|
+
`deepseek-chat` / `deepseek-reasoner` aliases as V4 Flash non-thinking /
|
|
256
|
+
thinking modes. V4 Pro is the new flagship paid SKU — 1.6T MoE / 49B active,
|
|
257
|
+
1M context, MMLU-Pro 87.5, GPQA 90.1, SWE-bench 80.6, LiveCodeBench 93.5.
|
|
258
|
+
|
|
259
|
+
| Model | Input Price | Output Price | Context | Notes |
|
|
260
|
+
|-------|-------------|--------------|---------|-------|
|
|
261
|
+
| `deepseek/deepseek-v4-pro` | $0.50/M | $1.00/M | 1M | V4 flagship — strongest open-weight reasoner. **75% off until 2026-05-31** (list $2.00/$4.00) |
|
|
262
|
+
| `deepseek/deepseek-chat` | $0.20/M | $0.40/M | 1M | V4 Flash non-thinking (paid endpoint with 5MB request bodies; same upstream as `nvidia/deepseek-v4-flash`) |
|
|
263
|
+
| `deepseek/deepseek-reasoner` | $0.20/M | $0.40/M | 1M | V4 Flash thinking (same upstream as `deepseek-chat`, thinking enabled by default) |
|
|
220
264
|
|
|
221
265
|
### xAI Grok
|
|
222
266
|
| Model | Input Price | Output Price | Context | Notes |
|
|
@@ -245,20 +289,26 @@ Released 2026-04-23 — first fully retrained base since GPT-4.5. 1M context, 12
|
|
|
245
289
|
|
|
246
290
|
### NVIDIA (Free) + Moonshot
|
|
247
291
|
|
|
248
|
-
Free tier refreshed 2026-04-
|
|
249
|
-
|
|
250
|
-
|
|
292
|
+
Free tier refreshed 2026-04-28: added `nvidia/deepseek-v4-flash` (1M context)
|
|
293
|
+
and Nemotron Nano Omni (vision). `nvidia/gpt-oss-120b` and
|
|
294
|
+
`nvidia/gpt-oss-20b` were briefly delisted over privacy concerns then
|
|
295
|
+
**re-enabled 2026-04-30** with `available: true` + `hidden: true` — they
|
|
296
|
+
no longer appear in `/v1/models` (so SmartChat won't auto-pick them) but
|
|
297
|
+
direct calls by full ID still return HTTP 200. `nvidia/deepseek-v4-pro`,
|
|
298
|
+
`nvidia/deepseek-v3.2`, and `nvidia/glm-4.7` are hidden because NVIDIA's
|
|
299
|
+
NIM deployment is hung — backend MODEL_REDIRECTS forwards calls to V4
|
|
300
|
+
Flash / qwen3-coder.
|
|
251
301
|
|
|
252
302
|
| Model | Input Price | Output Price | Notes |
|
|
253
303
|
|-------|-------------|--------------|-------|
|
|
254
|
-
| `nvidia/
|
|
255
|
-
| `nvidia/
|
|
256
|
-
| `nvidia/
|
|
257
|
-
| `nvidia/
|
|
304
|
+
| `nvidia/deepseek-v4-flash` | **FREE** | **FREE** | 284B / 13B active MoE, 1M context — best free chat / summarization / light reasoning |
|
|
305
|
+
| `nvidia/nemotron-3-nano-omni-30b-a3b-reasoning` | **FREE** | **FREE** | 31B / 3.2B active MoE, 256K — only vision-capable free model |
|
|
306
|
+
| `nvidia/qwen3-next-80b-a3b-thinking` | **FREE** | **FREE** | 116 tok/s — reasoning flagship with thinking mode |
|
|
307
|
+
| `nvidia/mistral-small-4-119b` | **FREE** | **FREE** | 114 tok/s — fastest free chat |
|
|
308
|
+
| `nvidia/llama-4-maverick` | **FREE** | **FREE** | Meta Llama 4 Maverick MoE |
|
|
258
309
|
| `nvidia/qwen3-coder-480b` | **FREE** | **FREE** | Coding-optimised 480B MoE |
|
|
259
|
-
| `nvidia/
|
|
260
|
-
| `nvidia/gpt-oss-
|
|
261
|
-
| `nvidia/gpt-oss-20b` | **FREE** | **FREE** | OpenAI open-weight 20B — 155 tok/s |
|
|
310
|
+
| `nvidia/gpt-oss-120b` | **FREE** | **FREE** | Hidden from `/v1/models` for privacy but direct calls still work — 123 tok/s |
|
|
311
|
+
| `nvidia/gpt-oss-20b` | **FREE** | **FREE** | Hidden from `/v1/models` but direct calls still work — 155 tok/s |
|
|
262
312
|
| `moonshot/kimi-k2.5` | $0.60/M | $3.00/M | Direct from Moonshot — replaces `nvidia/kimi-k2.5` |
|
|
263
313
|
|
|
264
314
|
### E2E Verified Models
|
|
@@ -544,7 +594,7 @@ const premium = await client.smartChat('Write a legal brief', { routingProfile:
|
|
|
544
594
|
|
|
545
595
|
| Profile | Description | Best For |
|
|
546
596
|
|---------|-------------|----------|
|
|
547
|
-
| `free` | NVIDIA free models
|
|
597
|
+
| `free` | NVIDIA free tier (9 models, smart-routed) | Zero-cost testing, dev, prod |
|
|
548
598
|
| `eco` | Budget-optimized | Cost-sensitive workloads |
|
|
549
599
|
| `auto` | Intelligent routing (default) | General use |
|
|
550
600
|
| `premium` | Best quality models | Critical tasks |
|
package/dist/index.cjs
CHANGED
|
@@ -1633,17 +1633,70 @@ var LLMClient = class _LLMClient {
|
|
|
1633
1633
|
/**
|
|
1634
1634
|
* Structured query for Predexon prediction market data (POST endpoints).
|
|
1635
1635
|
*
|
|
1636
|
-
* For
|
|
1636
|
+
* For endpoints that require a JSON body, e.g. bulk wallet identity lookup.
|
|
1637
|
+
* Tier 1 = $0.001/call, Tier 2 = $0.005/call.
|
|
1637
1638
|
*
|
|
1638
|
-
* @param path - Endpoint path, e.g. "polymarket/
|
|
1639
|
+
* @param path - Endpoint path, e.g. "polymarket/wallet/identities"
|
|
1639
1640
|
* @param query - JSON body for the structured query
|
|
1640
1641
|
*
|
|
1641
1642
|
* @example
|
|
1642
|
-
* const
|
|
1643
|
+
* const batch = await client.pmQuery("polymarket/wallet/identities", {
|
|
1644
|
+
* addresses: ["0xabc...", "0xdef..."],
|
|
1645
|
+
* });
|
|
1643
1646
|
*/
|
|
1644
1647
|
async pmQuery(path5, query) {
|
|
1645
1648
|
return this.requestWithPaymentRaw(`/v1/pm/${path5}`, query);
|
|
1646
1649
|
}
|
|
1650
|
+
// ── PM convenience helpers (Predexon v2) ─────────────────────────────────
|
|
1651
|
+
// Thin wrappers over pm() / pmQuery() for the most common v2 endpoints.
|
|
1652
|
+
/** List canonical cross-venue markets (Predexon v2). Tier 1 ($0.001/call).
|
|
1653
|
+
* Filter with venue, status, category, league, event_id, pagination_key. */
|
|
1654
|
+
async pmMarkets(params) {
|
|
1655
|
+
return this.pm("markets", params);
|
|
1656
|
+
}
|
|
1657
|
+
/** List venue-native executable listings flattened across canonical markets
|
|
1658
|
+
* (Predexon v2). Tier 1 ($0.001/call). */
|
|
1659
|
+
async pmListings(params) {
|
|
1660
|
+
return this.pm("markets/listings", params);
|
|
1661
|
+
}
|
|
1662
|
+
/** Resolve a canonical Predexon outcome ID to its market context and venue
|
|
1663
|
+
* listings. Tier 1 ($0.001/call). */
|
|
1664
|
+
async pmOutcome(predexonId) {
|
|
1665
|
+
return this.pm(`outcomes/${predexonId}`);
|
|
1666
|
+
}
|
|
1667
|
+
/** Polymarket markets with cursor-based keyset pagination (use pagination_key).
|
|
1668
|
+
* Tier 1 ($0.001/call). */
|
|
1669
|
+
async pmPolymarketMarketsKeyset(params) {
|
|
1670
|
+
return this.pm("polymarket/markets/keyset", params);
|
|
1671
|
+
}
|
|
1672
|
+
/** Polymarket events with cursor-based keyset pagination (use pagination_key).
|
|
1673
|
+
* Tier 1 ($0.001/call). */
|
|
1674
|
+
async pmPolymarketEventsKeyset(params) {
|
|
1675
|
+
return this.pm("polymarket/events/keyset", params);
|
|
1676
|
+
}
|
|
1677
|
+
/** List available sports categories. Tier 1 ($0.001/call). */
|
|
1678
|
+
async pmSportsCategories() {
|
|
1679
|
+
return this.pm("sports/categories");
|
|
1680
|
+
}
|
|
1681
|
+
/** List sports markets grouped by game. Filter with league, sport_type,
|
|
1682
|
+
* status, venue. Tier 1 ($0.001/call). */
|
|
1683
|
+
async pmSportsMarkets(params) {
|
|
1684
|
+
return this.pm("sports/markets", params);
|
|
1685
|
+
}
|
|
1686
|
+
/** Fetch identity + profile metadata for one wallet (ENS, Twitter, portfolio,
|
|
1687
|
+
* etc.). Tier 2 ($0.005/call). */
|
|
1688
|
+
async pmWalletIdentity(wallet) {
|
|
1689
|
+
return this.pm(`polymarket/wallet/identity/${wallet}`);
|
|
1690
|
+
}
|
|
1691
|
+
/** Bulk identity lookup for up to 200 wallet addresses (POST). Tier 2 ($0.005/call). */
|
|
1692
|
+
async pmWalletIdentities(addresses) {
|
|
1693
|
+
return this.pmQuery("polymarket/wallet/identities", { addresses });
|
|
1694
|
+
}
|
|
1695
|
+
/** Discover wallets connected to a seed address via on-chain transfers and
|
|
1696
|
+
* identity proofs. Tier 2 ($0.005/call). */
|
|
1697
|
+
async pmWalletCluster(address) {
|
|
1698
|
+
return this.pm(`polymarket/wallet/${address}/cluster`);
|
|
1699
|
+
}
|
|
1647
1700
|
/**
|
|
1648
1701
|
* Get current session spending.
|
|
1649
1702
|
*
|
|
@@ -2265,12 +2318,19 @@ var SearchClient = class {
|
|
|
2265
2318
|
var import_accounts6 = require("viem/accounts");
|
|
2266
2319
|
var DEFAULT_API_URL5 = "https://blockrun.ai/api";
|
|
2267
2320
|
var DEFAULT_TIMEOUT5 = 6e4;
|
|
2268
|
-
var XClient = class {
|
|
2321
|
+
var XClient = class _XClient {
|
|
2269
2322
|
account;
|
|
2270
2323
|
privateKey;
|
|
2271
2324
|
apiUrl;
|
|
2272
2325
|
timeout;
|
|
2326
|
+
static deprecationWarned = false;
|
|
2273
2327
|
constructor(options = {}) {
|
|
2328
|
+
if (!_XClient.deprecationWarned) {
|
|
2329
|
+
console.warn(
|
|
2330
|
+
"[@blockrun/llm] XClient: BlockRun's /v1/x/* (AttentionVC) integration was removed 2026-04-30. All calls will return HTTP 404 until a replacement X data upstream is reintroduced."
|
|
2331
|
+
);
|
|
2332
|
+
_XClient.deprecationWarned = true;
|
|
2333
|
+
}
|
|
2274
2334
|
const envKey = typeof process !== "undefined" && process.env ? process.env.BLOCKRUN_WALLET_KEY || process.env.BASE_CHAIN_WALLET_KEY : void 0;
|
|
2275
2335
|
const privateKey = options.privateKey || envKey;
|
|
2276
2336
|
if (!privateKey) {
|
|
@@ -2824,13 +2884,13 @@ var path2 = __toESM(require("path"), 1);
|
|
|
2824
2884
|
var os2 = __toESM(require("os"), 1);
|
|
2825
2885
|
var WALLET_DIR2 = path2.join(os2.homedir(), ".blockrun");
|
|
2826
2886
|
var SOLANA_WALLET_FILE = path2.join(WALLET_DIR2, ".solana-session");
|
|
2827
|
-
function createSolanaWallet() {
|
|
2828
|
-
const { Keypair } =
|
|
2829
|
-
const bs58 =
|
|
2887
|
+
async function createSolanaWallet() {
|
|
2888
|
+
const { Keypair } = await import("@solana/web3.js");
|
|
2889
|
+
const bs58 = await import("bs58");
|
|
2830
2890
|
const keypair = Keypair.generate();
|
|
2831
2891
|
return {
|
|
2832
2892
|
address: keypair.publicKey.toBase58(),
|
|
2833
|
-
privateKey: bs58.default
|
|
2893
|
+
privateKey: (bs58.default ?? bs58).encode(keypair.secretKey)
|
|
2834
2894
|
};
|
|
2835
2895
|
}
|
|
2836
2896
|
async function solanaKeyToBytes(privateKey) {
|
|
@@ -2923,7 +2983,7 @@ async function getOrCreateSolanaWallet() {
|
|
|
2923
2983
|
return { privateKey: fileKey, address: address2, isNew: false };
|
|
2924
2984
|
}
|
|
2925
2985
|
}
|
|
2926
|
-
const { address, privateKey } = createSolanaWallet();
|
|
2986
|
+
const { address, privateKey } = await createSolanaWallet();
|
|
2927
2987
|
saveSolanaWallet(privateKey);
|
|
2928
2988
|
return { address, privateKey, isNew: true };
|
|
2929
2989
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1066,15 +1066,46 @@ declare class LLMClient {
|
|
|
1066
1066
|
/**
|
|
1067
1067
|
* Structured query for Predexon prediction market data (POST endpoints).
|
|
1068
1068
|
*
|
|
1069
|
-
* For
|
|
1069
|
+
* For endpoints that require a JSON body, e.g. bulk wallet identity lookup.
|
|
1070
|
+
* Tier 1 = $0.001/call, Tier 2 = $0.005/call.
|
|
1070
1071
|
*
|
|
1071
|
-
* @param path - Endpoint path, e.g. "polymarket/
|
|
1072
|
+
* @param path - Endpoint path, e.g. "polymarket/wallet/identities"
|
|
1072
1073
|
* @param query - JSON body for the structured query
|
|
1073
1074
|
*
|
|
1074
1075
|
* @example
|
|
1075
|
-
* const
|
|
1076
|
+
* const batch = await client.pmQuery("polymarket/wallet/identities", {
|
|
1077
|
+
* addresses: ["0xabc...", "0xdef..."],
|
|
1078
|
+
* });
|
|
1076
1079
|
*/
|
|
1077
1080
|
pmQuery(path: string, query: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
1081
|
+
/** List canonical cross-venue markets (Predexon v2). Tier 1 ($0.001/call).
|
|
1082
|
+
* Filter with venue, status, category, league, event_id, pagination_key. */
|
|
1083
|
+
pmMarkets(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1084
|
+
/** List venue-native executable listings flattened across canonical markets
|
|
1085
|
+
* (Predexon v2). Tier 1 ($0.001/call). */
|
|
1086
|
+
pmListings(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1087
|
+
/** Resolve a canonical Predexon outcome ID to its market context and venue
|
|
1088
|
+
* listings. Tier 1 ($0.001/call). */
|
|
1089
|
+
pmOutcome(predexonId: string): Promise<Record<string, unknown>>;
|
|
1090
|
+
/** Polymarket markets with cursor-based keyset pagination (use pagination_key).
|
|
1091
|
+
* Tier 1 ($0.001/call). */
|
|
1092
|
+
pmPolymarketMarketsKeyset(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1093
|
+
/** Polymarket events with cursor-based keyset pagination (use pagination_key).
|
|
1094
|
+
* Tier 1 ($0.001/call). */
|
|
1095
|
+
pmPolymarketEventsKeyset(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1096
|
+
/** List available sports categories. Tier 1 ($0.001/call). */
|
|
1097
|
+
pmSportsCategories(): Promise<Record<string, unknown>>;
|
|
1098
|
+
/** List sports markets grouped by game. Filter with league, sport_type,
|
|
1099
|
+
* status, venue. Tier 1 ($0.001/call). */
|
|
1100
|
+
pmSportsMarkets(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1101
|
+
/** Fetch identity + profile metadata for one wallet (ENS, Twitter, portfolio,
|
|
1102
|
+
* etc.). Tier 2 ($0.005/call). */
|
|
1103
|
+
pmWalletIdentity(wallet: string): Promise<Record<string, unknown>>;
|
|
1104
|
+
/** Bulk identity lookup for up to 200 wallet addresses (POST). Tier 2 ($0.005/call). */
|
|
1105
|
+
pmWalletIdentities(addresses: string[]): Promise<Record<string, unknown>>;
|
|
1106
|
+
/** Discover wallets connected to a seed address via on-chain transfers and
|
|
1107
|
+
* identity proofs. Tier 2 ($0.005/call). */
|
|
1108
|
+
pmWalletCluster(address: string): Promise<Record<string, unknown>>;
|
|
1078
1109
|
/**
|
|
1079
1110
|
* Get current session spending.
|
|
1080
1111
|
*
|
|
@@ -1343,11 +1374,21 @@ interface XSearchOptions {
|
|
|
1343
1374
|
queryType?: "Latest" | "Top" | "Default";
|
|
1344
1375
|
cursor?: string;
|
|
1345
1376
|
}
|
|
1377
|
+
/**
|
|
1378
|
+
* BlockRun X/Twitter client.
|
|
1379
|
+
*
|
|
1380
|
+
* @deprecated BlockRun's `/v1/x/*` (AttentionVC-partnered) integration was
|
|
1381
|
+
* removed from the backend on 2026-04-30 (commit 80dcf52). All `XClient`
|
|
1382
|
+
* calls will return HTTP 404 until a replacement upstream is wired up.
|
|
1383
|
+
* The class is kept in the SDK so existing imports do not break;
|
|
1384
|
+
* instantiation logs a one-time `console.warn`.
|
|
1385
|
+
*/
|
|
1346
1386
|
declare class XClient {
|
|
1347
1387
|
private account;
|
|
1348
1388
|
private privateKey;
|
|
1349
1389
|
private apiUrl;
|
|
1350
1390
|
private timeout;
|
|
1391
|
+
private static deprecationWarned;
|
|
1351
1392
|
constructor(options?: XClientOptions);
|
|
1352
1393
|
userLookup(usernames: string | string[]): Promise<XUserLookupResponse>;
|
|
1353
1394
|
userInfo(username: string): Promise<XUserInfoResponse>;
|
|
@@ -1746,12 +1787,14 @@ interface SolanaWalletInfo {
|
|
|
1746
1787
|
}
|
|
1747
1788
|
/**
|
|
1748
1789
|
* Create a new Solana wallet.
|
|
1749
|
-
* Requires @solana/web3.js (optional dep)
|
|
1790
|
+
* Requires @solana/web3.js (optional dep) — loaded lazily via dynamic
|
|
1791
|
+
* import so callers that never touch Solana don't pay the resolution cost
|
|
1792
|
+
* and ESM consumers don't trip over esbuild's __require shim.
|
|
1750
1793
|
*/
|
|
1751
|
-
declare function createSolanaWallet(): {
|
|
1794
|
+
declare function createSolanaWallet(): Promise<{
|
|
1752
1795
|
address: string;
|
|
1753
1796
|
privateKey: string;
|
|
1754
|
-
}
|
|
1797
|
+
}>;
|
|
1755
1798
|
/**
|
|
1756
1799
|
* Convert a bs58 private key string to Uint8Array (64 bytes).
|
|
1757
1800
|
* Accepts: bs58-encoded 64-byte key (standard Solana format).
|
package/dist/index.d.ts
CHANGED
|
@@ -1066,15 +1066,46 @@ declare class LLMClient {
|
|
|
1066
1066
|
/**
|
|
1067
1067
|
* Structured query for Predexon prediction market data (POST endpoints).
|
|
1068
1068
|
*
|
|
1069
|
-
* For
|
|
1069
|
+
* For endpoints that require a JSON body, e.g. bulk wallet identity lookup.
|
|
1070
|
+
* Tier 1 = $0.001/call, Tier 2 = $0.005/call.
|
|
1070
1071
|
*
|
|
1071
|
-
* @param path - Endpoint path, e.g. "polymarket/
|
|
1072
|
+
* @param path - Endpoint path, e.g. "polymarket/wallet/identities"
|
|
1072
1073
|
* @param query - JSON body for the structured query
|
|
1073
1074
|
*
|
|
1074
1075
|
* @example
|
|
1075
|
-
* const
|
|
1076
|
+
* const batch = await client.pmQuery("polymarket/wallet/identities", {
|
|
1077
|
+
* addresses: ["0xabc...", "0xdef..."],
|
|
1078
|
+
* });
|
|
1076
1079
|
*/
|
|
1077
1080
|
pmQuery(path: string, query: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
1081
|
+
/** List canonical cross-venue markets (Predexon v2). Tier 1 ($0.001/call).
|
|
1082
|
+
* Filter with venue, status, category, league, event_id, pagination_key. */
|
|
1083
|
+
pmMarkets(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1084
|
+
/** List venue-native executable listings flattened across canonical markets
|
|
1085
|
+
* (Predexon v2). Tier 1 ($0.001/call). */
|
|
1086
|
+
pmListings(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1087
|
+
/** Resolve a canonical Predexon outcome ID to its market context and venue
|
|
1088
|
+
* listings. Tier 1 ($0.001/call). */
|
|
1089
|
+
pmOutcome(predexonId: string): Promise<Record<string, unknown>>;
|
|
1090
|
+
/** Polymarket markets with cursor-based keyset pagination (use pagination_key).
|
|
1091
|
+
* Tier 1 ($0.001/call). */
|
|
1092
|
+
pmPolymarketMarketsKeyset(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1093
|
+
/** Polymarket events with cursor-based keyset pagination (use pagination_key).
|
|
1094
|
+
* Tier 1 ($0.001/call). */
|
|
1095
|
+
pmPolymarketEventsKeyset(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1096
|
+
/** List available sports categories. Tier 1 ($0.001/call). */
|
|
1097
|
+
pmSportsCategories(): Promise<Record<string, unknown>>;
|
|
1098
|
+
/** List sports markets grouped by game. Filter with league, sport_type,
|
|
1099
|
+
* status, venue. Tier 1 ($0.001/call). */
|
|
1100
|
+
pmSportsMarkets(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1101
|
+
/** Fetch identity + profile metadata for one wallet (ENS, Twitter, portfolio,
|
|
1102
|
+
* etc.). Tier 2 ($0.005/call). */
|
|
1103
|
+
pmWalletIdentity(wallet: string): Promise<Record<string, unknown>>;
|
|
1104
|
+
/** Bulk identity lookup for up to 200 wallet addresses (POST). Tier 2 ($0.005/call). */
|
|
1105
|
+
pmWalletIdentities(addresses: string[]): Promise<Record<string, unknown>>;
|
|
1106
|
+
/** Discover wallets connected to a seed address via on-chain transfers and
|
|
1107
|
+
* identity proofs. Tier 2 ($0.005/call). */
|
|
1108
|
+
pmWalletCluster(address: string): Promise<Record<string, unknown>>;
|
|
1078
1109
|
/**
|
|
1079
1110
|
* Get current session spending.
|
|
1080
1111
|
*
|
|
@@ -1343,11 +1374,21 @@ interface XSearchOptions {
|
|
|
1343
1374
|
queryType?: "Latest" | "Top" | "Default";
|
|
1344
1375
|
cursor?: string;
|
|
1345
1376
|
}
|
|
1377
|
+
/**
|
|
1378
|
+
* BlockRun X/Twitter client.
|
|
1379
|
+
*
|
|
1380
|
+
* @deprecated BlockRun's `/v1/x/*` (AttentionVC-partnered) integration was
|
|
1381
|
+
* removed from the backend on 2026-04-30 (commit 80dcf52). All `XClient`
|
|
1382
|
+
* calls will return HTTP 404 until a replacement upstream is wired up.
|
|
1383
|
+
* The class is kept in the SDK so existing imports do not break;
|
|
1384
|
+
* instantiation logs a one-time `console.warn`.
|
|
1385
|
+
*/
|
|
1346
1386
|
declare class XClient {
|
|
1347
1387
|
private account;
|
|
1348
1388
|
private privateKey;
|
|
1349
1389
|
private apiUrl;
|
|
1350
1390
|
private timeout;
|
|
1391
|
+
private static deprecationWarned;
|
|
1351
1392
|
constructor(options?: XClientOptions);
|
|
1352
1393
|
userLookup(usernames: string | string[]): Promise<XUserLookupResponse>;
|
|
1353
1394
|
userInfo(username: string): Promise<XUserInfoResponse>;
|
|
@@ -1746,12 +1787,14 @@ interface SolanaWalletInfo {
|
|
|
1746
1787
|
}
|
|
1747
1788
|
/**
|
|
1748
1789
|
* Create a new Solana wallet.
|
|
1749
|
-
* Requires @solana/web3.js (optional dep)
|
|
1790
|
+
* Requires @solana/web3.js (optional dep) — loaded lazily via dynamic
|
|
1791
|
+
* import so callers that never touch Solana don't pay the resolution cost
|
|
1792
|
+
* and ESM consumers don't trip over esbuild's __require shim.
|
|
1750
1793
|
*/
|
|
1751
|
-
declare function createSolanaWallet(): {
|
|
1794
|
+
declare function createSolanaWallet(): Promise<{
|
|
1752
1795
|
address: string;
|
|
1753
1796
|
privateKey: string;
|
|
1754
|
-
}
|
|
1797
|
+
}>;
|
|
1755
1798
|
/**
|
|
1756
1799
|
* Convert a bs58 private key string to Uint8Array (64 bytes).
|
|
1757
1800
|
* Accepts: bs58-encoded 64-byte key (standard Solana format).
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
-
});
|
|
7
|
-
|
|
8
1
|
// src/client.ts
|
|
9
2
|
import { privateKeyToAccount } from "viem/accounts";
|
|
10
3
|
|
|
@@ -1544,17 +1537,70 @@ var LLMClient = class _LLMClient {
|
|
|
1544
1537
|
/**
|
|
1545
1538
|
* Structured query for Predexon prediction market data (POST endpoints).
|
|
1546
1539
|
*
|
|
1547
|
-
* For
|
|
1540
|
+
* For endpoints that require a JSON body, e.g. bulk wallet identity lookup.
|
|
1541
|
+
* Tier 1 = $0.001/call, Tier 2 = $0.005/call.
|
|
1548
1542
|
*
|
|
1549
|
-
* @param path - Endpoint path, e.g. "polymarket/
|
|
1543
|
+
* @param path - Endpoint path, e.g. "polymarket/wallet/identities"
|
|
1550
1544
|
* @param query - JSON body for the structured query
|
|
1551
1545
|
*
|
|
1552
1546
|
* @example
|
|
1553
|
-
* const
|
|
1547
|
+
* const batch = await client.pmQuery("polymarket/wallet/identities", {
|
|
1548
|
+
* addresses: ["0xabc...", "0xdef..."],
|
|
1549
|
+
* });
|
|
1554
1550
|
*/
|
|
1555
1551
|
async pmQuery(path5, query) {
|
|
1556
1552
|
return this.requestWithPaymentRaw(`/v1/pm/${path5}`, query);
|
|
1557
1553
|
}
|
|
1554
|
+
// ── PM convenience helpers (Predexon v2) ─────────────────────────────────
|
|
1555
|
+
// Thin wrappers over pm() / pmQuery() for the most common v2 endpoints.
|
|
1556
|
+
/** List canonical cross-venue markets (Predexon v2). Tier 1 ($0.001/call).
|
|
1557
|
+
* Filter with venue, status, category, league, event_id, pagination_key. */
|
|
1558
|
+
async pmMarkets(params) {
|
|
1559
|
+
return this.pm("markets", params);
|
|
1560
|
+
}
|
|
1561
|
+
/** List venue-native executable listings flattened across canonical markets
|
|
1562
|
+
* (Predexon v2). Tier 1 ($0.001/call). */
|
|
1563
|
+
async pmListings(params) {
|
|
1564
|
+
return this.pm("markets/listings", params);
|
|
1565
|
+
}
|
|
1566
|
+
/** Resolve a canonical Predexon outcome ID to its market context and venue
|
|
1567
|
+
* listings. Tier 1 ($0.001/call). */
|
|
1568
|
+
async pmOutcome(predexonId) {
|
|
1569
|
+
return this.pm(`outcomes/${predexonId}`);
|
|
1570
|
+
}
|
|
1571
|
+
/** Polymarket markets with cursor-based keyset pagination (use pagination_key).
|
|
1572
|
+
* Tier 1 ($0.001/call). */
|
|
1573
|
+
async pmPolymarketMarketsKeyset(params) {
|
|
1574
|
+
return this.pm("polymarket/markets/keyset", params);
|
|
1575
|
+
}
|
|
1576
|
+
/** Polymarket events with cursor-based keyset pagination (use pagination_key).
|
|
1577
|
+
* Tier 1 ($0.001/call). */
|
|
1578
|
+
async pmPolymarketEventsKeyset(params) {
|
|
1579
|
+
return this.pm("polymarket/events/keyset", params);
|
|
1580
|
+
}
|
|
1581
|
+
/** List available sports categories. Tier 1 ($0.001/call). */
|
|
1582
|
+
async pmSportsCategories() {
|
|
1583
|
+
return this.pm("sports/categories");
|
|
1584
|
+
}
|
|
1585
|
+
/** List sports markets grouped by game. Filter with league, sport_type,
|
|
1586
|
+
* status, venue. Tier 1 ($0.001/call). */
|
|
1587
|
+
async pmSportsMarkets(params) {
|
|
1588
|
+
return this.pm("sports/markets", params);
|
|
1589
|
+
}
|
|
1590
|
+
/** Fetch identity + profile metadata for one wallet (ENS, Twitter, portfolio,
|
|
1591
|
+
* etc.). Tier 2 ($0.005/call). */
|
|
1592
|
+
async pmWalletIdentity(wallet) {
|
|
1593
|
+
return this.pm(`polymarket/wallet/identity/${wallet}`);
|
|
1594
|
+
}
|
|
1595
|
+
/** Bulk identity lookup for up to 200 wallet addresses (POST). Tier 2 ($0.005/call). */
|
|
1596
|
+
async pmWalletIdentities(addresses) {
|
|
1597
|
+
return this.pmQuery("polymarket/wallet/identities", { addresses });
|
|
1598
|
+
}
|
|
1599
|
+
/** Discover wallets connected to a seed address via on-chain transfers and
|
|
1600
|
+
* identity proofs. Tier 2 ($0.005/call). */
|
|
1601
|
+
async pmWalletCluster(address) {
|
|
1602
|
+
return this.pm(`polymarket/wallet/${address}/cluster`);
|
|
1603
|
+
}
|
|
1558
1604
|
/**
|
|
1559
1605
|
* Get current session spending.
|
|
1560
1606
|
*
|
|
@@ -2176,12 +2222,19 @@ var SearchClient = class {
|
|
|
2176
2222
|
import { privateKeyToAccount as privateKeyToAccount5 } from "viem/accounts";
|
|
2177
2223
|
var DEFAULT_API_URL5 = "https://blockrun.ai/api";
|
|
2178
2224
|
var DEFAULT_TIMEOUT5 = 6e4;
|
|
2179
|
-
var XClient = class {
|
|
2225
|
+
var XClient = class _XClient {
|
|
2180
2226
|
account;
|
|
2181
2227
|
privateKey;
|
|
2182
2228
|
apiUrl;
|
|
2183
2229
|
timeout;
|
|
2230
|
+
static deprecationWarned = false;
|
|
2184
2231
|
constructor(options = {}) {
|
|
2232
|
+
if (!_XClient.deprecationWarned) {
|
|
2233
|
+
console.warn(
|
|
2234
|
+
"[@blockrun/llm] XClient: BlockRun's /v1/x/* (AttentionVC) integration was removed 2026-04-30. All calls will return HTTP 404 until a replacement X data upstream is reintroduced."
|
|
2235
|
+
);
|
|
2236
|
+
_XClient.deprecationWarned = true;
|
|
2237
|
+
}
|
|
2185
2238
|
const envKey = typeof process !== "undefined" && process.env ? process.env.BLOCKRUN_WALLET_KEY || process.env.BASE_CHAIN_WALLET_KEY : void 0;
|
|
2186
2239
|
const privateKey = options.privateKey || envKey;
|
|
2187
2240
|
if (!privateKey) {
|
|
@@ -2735,13 +2788,13 @@ import * as path2 from "path";
|
|
|
2735
2788
|
import * as os2 from "os";
|
|
2736
2789
|
var WALLET_DIR2 = path2.join(os2.homedir(), ".blockrun");
|
|
2737
2790
|
var SOLANA_WALLET_FILE = path2.join(WALLET_DIR2, ".solana-session");
|
|
2738
|
-
function createSolanaWallet() {
|
|
2739
|
-
const { Keypair } =
|
|
2740
|
-
const bs58 =
|
|
2791
|
+
async function createSolanaWallet() {
|
|
2792
|
+
const { Keypair } = await import("@solana/web3.js");
|
|
2793
|
+
const bs58 = await import("bs58");
|
|
2741
2794
|
const keypair = Keypair.generate();
|
|
2742
2795
|
return {
|
|
2743
2796
|
address: keypair.publicKey.toBase58(),
|
|
2744
|
-
privateKey: bs58.default
|
|
2797
|
+
privateKey: (bs58.default ?? bs58).encode(keypair.secretKey)
|
|
2745
2798
|
};
|
|
2746
2799
|
}
|
|
2747
2800
|
async function solanaKeyToBytes(privateKey) {
|
|
@@ -2834,7 +2887,7 @@ async function getOrCreateSolanaWallet() {
|
|
|
2834
2887
|
return { privateKey: fileKey, address: address2, isNew: false };
|
|
2835
2888
|
}
|
|
2836
2889
|
}
|
|
2837
|
-
const { address, privateKey } = createSolanaWallet();
|
|
2890
|
+
const { address, privateKey } = await createSolanaWallet();
|
|
2838
2891
|
saveSolanaWallet(privateKey);
|
|
2839
2892
|
return { address, privateKey, isNew: true };
|
|
2840
2893
|
}
|