@blockrun/llm 3.9.0 → 3.10.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 +19 -4
- package/dist/index.cjs +89 -20
- package/dist/index.d.cts +40 -12
- package/dist/index.d.ts +40 -12
- package/dist/index.js +88 -20
- package/package.json +11 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @blockrun/llm (TypeScript SDK)
|
|
2
2
|
|
|
3
|
-
> **@blockrun/llm** is a TypeScript/Node.js SDK for accessing <!-- br:models.chatVisible -->
|
|
3
|
+
> **@blockrun/llm** is a TypeScript/Node.js SDK for accessing <!-- br:models.chatVisible -->71<!-- /br:models.chatVisible --> 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
4
|
>
|
|
5
5
|
> 🆓 **Includes 7 fully-free NVIDIA-hosted models** (5 visible in `/v1/models`, 2 hidden but directly callable) — DeepSeek V4 Flash (1M context), Nemotron Nano Omni (vision), Qwen3 Coder, Llama 4, Mistral, plus the gpt-oss pair. Zero USDC, no rate-limit gimmicks. Use `routingProfile: 'free'` or call any `nvidia/*` model directly.
|
|
6
6
|
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
## Installation
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
# Base
|
|
24
|
+
# Base / EVM payments — nothing else needed
|
|
25
25
|
npm install @blockrun/llm
|
|
26
26
|
# or
|
|
27
27
|
pnpm add @blockrun/llm
|
|
@@ -29,6 +29,21 @@ pnpm add @blockrun/llm
|
|
|
29
29
|
yarn add @blockrun/llm
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
**Solana payments** need two more packages. They are optional peer dependencies,
|
|
33
|
+
so npm will not install them for you:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install @blockrun/llm @solana/web3.js @solana/spl-token
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Why they are not automatic: `@solana/spl-token` pulls in `bigint-buffer`, whose
|
|
40
|
+
native `toBigIntLE()` has an unpatched buffer overflow
|
|
41
|
+
([GHSA-3gc7-fjrx-p6mg](https://github.com/advisories/GHSA-3gc7-fjrx-p6mg)) with no
|
|
42
|
+
fixed release anywhere. As an optional *dependency* it landed in the lockfile of
|
|
43
|
+
every consumer, including projects that only ever pay on Base. As an optional
|
|
44
|
+
*peer* it reaches only the projects that ask for Solana. Calling a Solana path
|
|
45
|
+
without them throws an error naming the exact install command.
|
|
46
|
+
|
|
32
47
|
## Quick Start (Base - Default)
|
|
33
48
|
|
|
34
49
|
```typescript
|
|
@@ -263,7 +278,7 @@ const reply = await client.chat('nvidia/deepseek-v4-flash', 'hello', {
|
|
|
263
278
|
|
|
264
279
|
| Profile | Description | Best For |
|
|
265
280
|
|---------|-------------|----------|
|
|
266
|
-
| `free` | NVIDIA free tier — smart-routes across <!-- br:models.free -->
|
|
281
|
+
| `free` | NVIDIA free tier — smart-routes across <!-- br:models.free -->6<!-- /br:models.free --> models (DeepSeek V4 Flash, Nemotron Nano Omni, Qwen3, Llama 4, Mistral, plus 2 hidden gpt-oss) | Zero-cost testing, dev, prod |
|
|
267
282
|
| `eco` | Cheapest models per tier (DeepSeek, xAI) | Cost-sensitive production |
|
|
268
283
|
| `auto` | Best balance of cost/quality (default) | General use |
|
|
269
284
|
| `premium` | Top-tier models (OpenAI, Anthropic) | Quality-critical tasks |
|
|
@@ -883,7 +898,7 @@ const premium = await client.smartChat('Write a legal brief', { routingProfile:
|
|
|
883
898
|
|
|
884
899
|
| Profile | Description | Best For |
|
|
885
900
|
|---------|-------------|----------|
|
|
886
|
-
| `free` | NVIDIA free tier (<!-- br:models.free -->
|
|
901
|
+
| `free` | NVIDIA free tier (<!-- br:models.free -->6<!-- /br:models.free --> models, smart-routed) | Zero-cost testing, dev, prod |
|
|
887
902
|
| `eco` | Budget-optimized | Cost-sensitive workloads |
|
|
888
903
|
| `auto` | Intelligent routing (default) | General use |
|
|
889
904
|
| `premium` | Best quality models | Critical tasks |
|
package/dist/index.cjs
CHANGED
|
@@ -48,6 +48,7 @@ __export(index_exports, {
|
|
|
48
48
|
PortraitClient: () => PortraitClient,
|
|
49
49
|
PriceClient: () => PriceClient,
|
|
50
50
|
RPC_PRICE_USD: () => RPC_PRICE_USD,
|
|
51
|
+
RetiredEndpointError: () => RetiredEndpointError,
|
|
51
52
|
RpcClient: () => RpcClient,
|
|
52
53
|
SOLANA_NETWORK: () => SOLANA_NETWORK,
|
|
53
54
|
SOLANA_WALLET_FILE_PATH: () => SOLANA_WALLET_FILE,
|
|
@@ -121,6 +122,12 @@ var BlockrunError = class extends Error {
|
|
|
121
122
|
this.name = "BlockrunError";
|
|
122
123
|
}
|
|
123
124
|
};
|
|
125
|
+
var RetiredEndpointError = class extends BlockrunError {
|
|
126
|
+
constructor(message) {
|
|
127
|
+
super(message);
|
|
128
|
+
this.name = "RetiredEndpointError";
|
|
129
|
+
}
|
|
130
|
+
};
|
|
124
131
|
var PaymentError = class extends BlockrunError {
|
|
125
132
|
constructor(message) {
|
|
126
133
|
super(message);
|
|
@@ -140,6 +147,35 @@ var APIError = class extends BlockrunError {
|
|
|
140
147
|
|
|
141
148
|
// src/x402.ts
|
|
142
149
|
var import_accounts = require("viem/accounts");
|
|
150
|
+
|
|
151
|
+
// src/solana-deps.ts
|
|
152
|
+
var INSTALL_HINT = "npm install @solana/web3.js @solana/spl-token (or pnpm add / yarn add)";
|
|
153
|
+
function missing(pkg, what, cause) {
|
|
154
|
+
return new Error(
|
|
155
|
+
`@blockrun/llm: ${what} requires the optional peer dependency "${pkg}", which is not installed.
|
|
156
|
+
|
|
157
|
+
${INSTALL_HINT}
|
|
158
|
+
|
|
159
|
+
Solana packages are optional peers so that consumers who only use Base/EVM payments do not inherit them. If you only make Base payments, you should not be reaching this code path \u2014 check which chain you passed.
|
|
160
|
+
Original error: ${cause instanceof Error ? cause.message : String(cause)}`
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
async function loadSolanaWeb3(what) {
|
|
164
|
+
try {
|
|
165
|
+
return await import("@solana/web3.js");
|
|
166
|
+
} catch (err) {
|
|
167
|
+
throw missing("@solana/web3.js", what, err);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
async function loadSplToken(what) {
|
|
171
|
+
try {
|
|
172
|
+
return await import("@solana/spl-token");
|
|
173
|
+
} catch (err) {
|
|
174
|
+
throw missing("@solana/spl-token", what, err);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// src/x402.ts
|
|
143
179
|
var BASE_CHAIN_ID = 8453;
|
|
144
180
|
var USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
145
181
|
var SOLANA_NETWORK = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
@@ -268,9 +304,17 @@ async function createPaymentPayload(privateKey, fromAddress, recipient, amount,
|
|
|
268
304
|
return btoa(JSON.stringify(paymentData));
|
|
269
305
|
}
|
|
270
306
|
async function createSolanaPaymentPayload(secretKey, fromAddress, recipient, amount, feePayer, options = {}) {
|
|
271
|
-
const {
|
|
272
|
-
|
|
273
|
-
|
|
307
|
+
const {
|
|
308
|
+
Connection,
|
|
309
|
+
PublicKey,
|
|
310
|
+
TransactionMessage,
|
|
311
|
+
VersionedTransaction,
|
|
312
|
+
ComputeBudgetProgram,
|
|
313
|
+
Keypair
|
|
314
|
+
} = await loadSolanaWeb3("createSolanaPaymentPayload()");
|
|
315
|
+
const { getAssociatedTokenAddress, createTransferCheckedInstruction } = await loadSplToken(
|
|
316
|
+
"createSolanaPaymentPayload()"
|
|
317
|
+
);
|
|
274
318
|
const rpcUrl = options.rpcUrl || "https://sol.blockrun.ai/api/v1/solana/rpc";
|
|
275
319
|
const connection = options.rpcHeaders ? new Connection(rpcUrl, { httpHeaders: options.rpcHeaders }) : new Connection(rpcUrl);
|
|
276
320
|
const keypair = Keypair.fromSecretKey(secretKey);
|
|
@@ -564,7 +608,7 @@ function getCostSummary() {
|
|
|
564
608
|
}
|
|
565
609
|
|
|
566
610
|
// src/version.ts
|
|
567
|
-
var SDK_VERSION = "3.
|
|
611
|
+
var SDK_VERSION = "3.10.0";
|
|
568
612
|
var USER_AGENT = `blockrun-ts/${SDK_VERSION}`;
|
|
569
613
|
|
|
570
614
|
// src/client.ts
|
|
@@ -1783,20 +1827,38 @@ var LLMClient = class _LLMClient {
|
|
|
1783
1827
|
}
|
|
1784
1828
|
// ── PM convenience helpers (Predexon v2) ─────────────────────────────────
|
|
1785
1829
|
// Thin wrappers over pm() / pmQuery() for the most common v2 endpoints.
|
|
1786
|
-
/**
|
|
1787
|
-
*
|
|
1788
|
-
|
|
1789
|
-
|
|
1830
|
+
/** RETIRED — `/v1/pm/markets` no longer exists.
|
|
1831
|
+
*
|
|
1832
|
+
* Predexon sunset market matching on 2026-07-20 and the whole canonical layer
|
|
1833
|
+
* went with it, so this path returns 410 upstream. Use
|
|
1834
|
+
* `pm("markets/search", { q })` for cross-venue lookups.
|
|
1835
|
+
*
|
|
1836
|
+
* Kept as a throwing stub rather than deleted so upgrading does not break
|
|
1837
|
+
* property access; it throws before any network I/O.
|
|
1838
|
+
*
|
|
1839
|
+
* @throws {RetiredEndpointError} always. */
|
|
1840
|
+
async pmMarkets(_params) {
|
|
1841
|
+
throw new RetiredEndpointError(
|
|
1842
|
+
'/v1/pm/markets was sunset by Predexon on 2026-07-20 (upstream 410). Use pm("markets/search", { q }) for cross-venue lookups.'
|
|
1843
|
+
);
|
|
1790
1844
|
}
|
|
1791
|
-
/**
|
|
1792
|
-
*
|
|
1793
|
-
|
|
1794
|
-
|
|
1845
|
+
/** RETIRED — `/v1/pm/markets/listings` no longer exists (410, sunset
|
|
1846
|
+
* 2026-07-20 with market matching). Use `pm("markets/search", { q })`.
|
|
1847
|
+
*
|
|
1848
|
+
* @throws {RetiredEndpointError} always. */
|
|
1849
|
+
async pmListings(_params) {
|
|
1850
|
+
throw new RetiredEndpointError(
|
|
1851
|
+
'/v1/pm/markets/listings was sunset by Predexon on 2026-07-20 (upstream 410). Use pm("markets/search", { q }) for cross-venue lookups.'
|
|
1852
|
+
);
|
|
1795
1853
|
}
|
|
1796
|
-
/**
|
|
1797
|
-
*
|
|
1798
|
-
|
|
1799
|
-
|
|
1854
|
+
/** RETIRED — `/v1/pm/outcomes/{predexonId}` no longer exists (410, sunset
|
|
1855
|
+
* 2026-07-20 with market matching). Use `pm("markets/search", { q })`.
|
|
1856
|
+
*
|
|
1857
|
+
* @throws {RetiredEndpointError} always. */
|
|
1858
|
+
async pmOutcome(_predexonId) {
|
|
1859
|
+
throw new RetiredEndpointError(
|
|
1860
|
+
'/v1/pm/outcomes/{predexon_id} was sunset by Predexon on 2026-07-20 (upstream 410). Use pm("markets/search", { q }) for cross-venue lookups.'
|
|
1861
|
+
);
|
|
1800
1862
|
}
|
|
1801
1863
|
/** Polymarket markets with cursor-based keyset pagination (use pagination_key).
|
|
1802
1864
|
* Tier 1 ($0.001/call). */
|
|
@@ -1808,12 +1870,18 @@ var LLMClient = class _LLMClient {
|
|
|
1808
1870
|
async pmPolymarketEventsKeyset(params) {
|
|
1809
1871
|
return this.pm("polymarket/events/keyset", params);
|
|
1810
1872
|
}
|
|
1811
|
-
/** List available sports categories. Tier 1 ($0.001/call).
|
|
1873
|
+
/** List available sports categories. Tier 1 ($0.001/call).
|
|
1874
|
+
*
|
|
1875
|
+
* NOTE: upstream returns 500 for every `sports/*` path as of 2026-08-04.
|
|
1876
|
+
* The route still resolves, so this works again the moment Predexon restores
|
|
1877
|
+
* it, but do not build on it yet. */
|
|
1812
1878
|
async pmSportsCategories() {
|
|
1813
1879
|
return this.pm("sports/categories");
|
|
1814
1880
|
}
|
|
1815
1881
|
/** List sports markets grouped by game. Filter with league, sport_type,
|
|
1816
|
-
* status, venue. Tier 1 ($0.001/call).
|
|
1882
|
+
* status, venue. Tier 1 ($0.001/call).
|
|
1883
|
+
*
|
|
1884
|
+
* NOTE: upstream returns 500 for every `sports/*` path as of 2026-08-04. */
|
|
1817
1885
|
async pmSportsMarkets(params) {
|
|
1818
1886
|
return this.pm("sports/markets", params);
|
|
1819
1887
|
}
|
|
@@ -4894,7 +4962,7 @@ var os3 = __toESM(require("os"), 1);
|
|
|
4894
4962
|
var WALLET_DIR2 = path3.join(os3.homedir(), ".blockrun");
|
|
4895
4963
|
var SOLANA_WALLET_FILE = path3.join(WALLET_DIR2, ".solana-session");
|
|
4896
4964
|
async function createSolanaWallet() {
|
|
4897
|
-
const { Keypair } = await
|
|
4965
|
+
const { Keypair } = await loadSolanaWeb3("Solana wallet operations");
|
|
4898
4966
|
const bs58 = await import("bs58");
|
|
4899
4967
|
const keypair = Keypair.generate();
|
|
4900
4968
|
return {
|
|
@@ -4951,7 +5019,7 @@ async function solanaKeyToBytes(privateKey) {
|
|
|
4951
5019
|
}
|
|
4952
5020
|
}
|
|
4953
5021
|
async function solanaPublicKey(privateKey) {
|
|
4954
|
-
const { Keypair } = await
|
|
5022
|
+
const { Keypair } = await loadSolanaWeb3("Solana wallet operations");
|
|
4955
5023
|
const bytes = await solanaKeyToBytes(privateKey);
|
|
4956
5024
|
return Keypair.fromSecretKey(bytes).publicKey.toBase58();
|
|
4957
5025
|
}
|
|
@@ -6245,6 +6313,7 @@ var AnthropicClient = class {
|
|
|
6245
6313
|
PortraitClient,
|
|
6246
6314
|
PriceClient,
|
|
6247
6315
|
RPC_PRICE_USD,
|
|
6316
|
+
RetiredEndpointError,
|
|
6248
6317
|
RpcClient,
|
|
6249
6318
|
SOLANA_NETWORK,
|
|
6250
6319
|
SOLANA_WALLET_FILE_PATH,
|
package/dist/index.d.cts
CHANGED
|
@@ -947,6 +947,16 @@ interface PollOptions {
|
|
|
947
947
|
declare class BlockrunError extends Error {
|
|
948
948
|
constructor(message: string);
|
|
949
949
|
}
|
|
950
|
+
/**
|
|
951
|
+
* Thrown by a helper whose upstream endpoint no longer exists.
|
|
952
|
+
*
|
|
953
|
+
* Kept as a throwing method rather than deleted so upgrading does not break
|
|
954
|
+
* imports or property access — the failure is explicit and immediate instead of
|
|
955
|
+
* a round trip that returns 410/404.
|
|
956
|
+
*/
|
|
957
|
+
declare class RetiredEndpointError extends BlockrunError {
|
|
958
|
+
constructor(message: string);
|
|
959
|
+
}
|
|
950
960
|
declare class PaymentError extends BlockrunError {
|
|
951
961
|
constructor(message: string);
|
|
952
962
|
}
|
|
@@ -1284,25 +1294,43 @@ declare class LLMClient {
|
|
|
1284
1294
|
* });
|
|
1285
1295
|
*/
|
|
1286
1296
|
pmQuery(path: string, query: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
1287
|
-
/**
|
|
1288
|
-
*
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
* (
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
*
|
|
1295
|
-
|
|
1297
|
+
/** RETIRED — `/v1/pm/markets` no longer exists.
|
|
1298
|
+
*
|
|
1299
|
+
* Predexon sunset market matching on 2026-07-20 and the whole canonical layer
|
|
1300
|
+
* went with it, so this path returns 410 upstream. Use
|
|
1301
|
+
* `pm("markets/search", { q })` for cross-venue lookups.
|
|
1302
|
+
*
|
|
1303
|
+
* Kept as a throwing stub rather than deleted so upgrading does not break
|
|
1304
|
+
* property access; it throws before any network I/O.
|
|
1305
|
+
*
|
|
1306
|
+
* @throws {RetiredEndpointError} always. */
|
|
1307
|
+
pmMarkets(_params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1308
|
+
/** RETIRED — `/v1/pm/markets/listings` no longer exists (410, sunset
|
|
1309
|
+
* 2026-07-20 with market matching). Use `pm("markets/search", { q })`.
|
|
1310
|
+
*
|
|
1311
|
+
* @throws {RetiredEndpointError} always. */
|
|
1312
|
+
pmListings(_params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1313
|
+
/** RETIRED — `/v1/pm/outcomes/{predexonId}` no longer exists (410, sunset
|
|
1314
|
+
* 2026-07-20 with market matching). Use `pm("markets/search", { q })`.
|
|
1315
|
+
*
|
|
1316
|
+
* @throws {RetiredEndpointError} always. */
|
|
1317
|
+
pmOutcome(_predexonId: string): Promise<Record<string, unknown>>;
|
|
1296
1318
|
/** Polymarket markets with cursor-based keyset pagination (use pagination_key).
|
|
1297
1319
|
* Tier 1 ($0.001/call). */
|
|
1298
1320
|
pmPolymarketMarketsKeyset(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1299
1321
|
/** Polymarket events with cursor-based keyset pagination (use pagination_key).
|
|
1300
1322
|
* Tier 1 ($0.001/call). */
|
|
1301
1323
|
pmPolymarketEventsKeyset(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1302
|
-
/** List available sports categories. Tier 1 ($0.001/call).
|
|
1324
|
+
/** List available sports categories. Tier 1 ($0.001/call).
|
|
1325
|
+
*
|
|
1326
|
+
* NOTE: upstream returns 500 for every `sports/*` path as of 2026-08-04.
|
|
1327
|
+
* The route still resolves, so this works again the moment Predexon restores
|
|
1328
|
+
* it, but do not build on it yet. */
|
|
1303
1329
|
pmSportsCategories(): Promise<Record<string, unknown>>;
|
|
1304
1330
|
/** List sports markets grouped by game. Filter with league, sport_type,
|
|
1305
|
-
* status, venue. Tier 1 ($0.001/call).
|
|
1331
|
+
* status, venue. Tier 1 ($0.001/call).
|
|
1332
|
+
*
|
|
1333
|
+
* NOTE: upstream returns 500 for every `sports/*` path as of 2026-08-04. */
|
|
1306
1334
|
pmSportsMarkets(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1307
1335
|
/** Fetch identity + profile metadata for one wallet (ENS, Twitter, portfolio,
|
|
1308
1336
|
* etc.). Tier 2 ($0.005/call). */
|
|
@@ -3210,4 +3238,4 @@ declare function validateTemperature(temperature?: number): void;
|
|
|
3210
3238
|
*/
|
|
3211
3239
|
declare function validateTopP(topP?: number): void;
|
|
3212
3240
|
|
|
3213
|
-
export { APIError, AnthropicClient, type AudioModel, type AudioTrack, BASE_CHAIN_ID, type BarResolution, type BlockRunAnthropicOptions, BlockrunClient, type BlockrunClientOptions, BlockrunError, type CallInitiatedResponse, type CallModel, type CallOptions, type CallStatusResponse, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatResponseWithCost, type ChatUsage, type CostEntry, type CostEstimate, type CreatePaymentOptions, type FunctionCall, type FunctionDefinition, type HistoryOptions, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, KNOWN_PROVIDERS, LLMClient, type LLMClientOptions, type ListOptions, type MarketSession, type Model, MusicClient, type MusicClientOptions, type MusicGenerateOptions, type MusicResponse, NETWORK_ALIASES, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PHONE_PRICES, PORTRAIT_ENROLLMENT_PRICE_USD, PaymentError, type PaymentLinks, type PhoneBuyOptions, type PhoneBuyResponse, PhoneClient, type PhoneClientOptions, type PhoneListResponse, type PhoneLookupResponse, type PhoneNumberRecord, type PhoneReleaseResponse, type PhoneRenewResponse, type PollOptions, PortraitClient, type PortraitClientOptions, type PortraitEnrollOptions, type PortraitEnrollResponse, type PriceBar, type PriceCategory, PriceClient, type PriceClientOptions, type PriceHistoryResponse, type PriceOptions, type PricePoint, RPC_PRICE_USD, type ResponseFormat, type RoutingDecision, type RoutingProfile, type RoutingTier, type RpcBatchRequest, RpcClient, type RpcClientOptions, type RpcError, type RpcNetwork, type RpcResponse, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, SUPPORTED_NETWORKS, SearchClient, type SearchClientOptions, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type SoundEffectOptions, type SpeechAudio, SpeechClient, type SpeechClientOptions, type SpeechGenerateOptions, type SpeechModel, type SpeechResponse, type SpeechVoice, type Spending, type SpendingReport, type StockMarket, SurfClient, type SurfClientOptions, type SymbolListResponse, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, VideoClient, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, VoiceClient, type VoiceClientOptions, type VoiceInfo, type VoicePreset, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XSearchSource, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatSolanaWalletMigrationNotice, formatWalletCreatedMessage, formatWalletMigrationNotice, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, importSolanaWallet, importWallet, listDiscoveredSolanaWallets, listDiscoveredWallets, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, validateMaxTokens, validateModel, validateTemperature, validateTopP };
|
|
3241
|
+
export { APIError, AnthropicClient, type AudioModel, type AudioTrack, BASE_CHAIN_ID, type BarResolution, type BlockRunAnthropicOptions, BlockrunClient, type BlockrunClientOptions, BlockrunError, type CallInitiatedResponse, type CallModel, type CallOptions, type CallStatusResponse, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatResponseWithCost, type ChatUsage, type CostEntry, type CostEstimate, type CreatePaymentOptions, type FunctionCall, type FunctionDefinition, type HistoryOptions, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, KNOWN_PROVIDERS, LLMClient, type LLMClientOptions, type ListOptions, type MarketSession, type Model, MusicClient, type MusicClientOptions, type MusicGenerateOptions, type MusicResponse, NETWORK_ALIASES, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PHONE_PRICES, PORTRAIT_ENROLLMENT_PRICE_USD, PaymentError, type PaymentLinks, type PhoneBuyOptions, type PhoneBuyResponse, PhoneClient, type PhoneClientOptions, type PhoneListResponse, type PhoneLookupResponse, type PhoneNumberRecord, type PhoneReleaseResponse, type PhoneRenewResponse, type PollOptions, PortraitClient, type PortraitClientOptions, type PortraitEnrollOptions, type PortraitEnrollResponse, type PriceBar, type PriceCategory, PriceClient, type PriceClientOptions, type PriceHistoryResponse, type PriceOptions, type PricePoint, RPC_PRICE_USD, type ResponseFormat, RetiredEndpointError, type RoutingDecision, type RoutingProfile, type RoutingTier, type RpcBatchRequest, RpcClient, type RpcClientOptions, type RpcError, type RpcNetwork, type RpcResponse, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, SUPPORTED_NETWORKS, SearchClient, type SearchClientOptions, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type SoundEffectOptions, type SpeechAudio, SpeechClient, type SpeechClientOptions, type SpeechGenerateOptions, type SpeechModel, type SpeechResponse, type SpeechVoice, type Spending, type SpendingReport, type StockMarket, SurfClient, type SurfClientOptions, type SymbolListResponse, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, VideoClient, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, VoiceClient, type VoiceClientOptions, type VoiceInfo, type VoicePreset, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XSearchSource, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatSolanaWalletMigrationNotice, formatWalletCreatedMessage, formatWalletMigrationNotice, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, importSolanaWallet, importWallet, listDiscoveredSolanaWallets, listDiscoveredWallets, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, validateMaxTokens, validateModel, validateTemperature, validateTopP };
|
package/dist/index.d.ts
CHANGED
|
@@ -947,6 +947,16 @@ interface PollOptions {
|
|
|
947
947
|
declare class BlockrunError extends Error {
|
|
948
948
|
constructor(message: string);
|
|
949
949
|
}
|
|
950
|
+
/**
|
|
951
|
+
* Thrown by a helper whose upstream endpoint no longer exists.
|
|
952
|
+
*
|
|
953
|
+
* Kept as a throwing method rather than deleted so upgrading does not break
|
|
954
|
+
* imports or property access — the failure is explicit and immediate instead of
|
|
955
|
+
* a round trip that returns 410/404.
|
|
956
|
+
*/
|
|
957
|
+
declare class RetiredEndpointError extends BlockrunError {
|
|
958
|
+
constructor(message: string);
|
|
959
|
+
}
|
|
950
960
|
declare class PaymentError extends BlockrunError {
|
|
951
961
|
constructor(message: string);
|
|
952
962
|
}
|
|
@@ -1284,25 +1294,43 @@ declare class LLMClient {
|
|
|
1284
1294
|
* });
|
|
1285
1295
|
*/
|
|
1286
1296
|
pmQuery(path: string, query: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
1287
|
-
/**
|
|
1288
|
-
*
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
* (
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
*
|
|
1295
|
-
|
|
1297
|
+
/** RETIRED — `/v1/pm/markets` no longer exists.
|
|
1298
|
+
*
|
|
1299
|
+
* Predexon sunset market matching on 2026-07-20 and the whole canonical layer
|
|
1300
|
+
* went with it, so this path returns 410 upstream. Use
|
|
1301
|
+
* `pm("markets/search", { q })` for cross-venue lookups.
|
|
1302
|
+
*
|
|
1303
|
+
* Kept as a throwing stub rather than deleted so upgrading does not break
|
|
1304
|
+
* property access; it throws before any network I/O.
|
|
1305
|
+
*
|
|
1306
|
+
* @throws {RetiredEndpointError} always. */
|
|
1307
|
+
pmMarkets(_params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1308
|
+
/** RETIRED — `/v1/pm/markets/listings` no longer exists (410, sunset
|
|
1309
|
+
* 2026-07-20 with market matching). Use `pm("markets/search", { q })`.
|
|
1310
|
+
*
|
|
1311
|
+
* @throws {RetiredEndpointError} always. */
|
|
1312
|
+
pmListings(_params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1313
|
+
/** RETIRED — `/v1/pm/outcomes/{predexonId}` no longer exists (410, sunset
|
|
1314
|
+
* 2026-07-20 with market matching). Use `pm("markets/search", { q })`.
|
|
1315
|
+
*
|
|
1316
|
+
* @throws {RetiredEndpointError} always. */
|
|
1317
|
+
pmOutcome(_predexonId: string): Promise<Record<string, unknown>>;
|
|
1296
1318
|
/** Polymarket markets with cursor-based keyset pagination (use pagination_key).
|
|
1297
1319
|
* Tier 1 ($0.001/call). */
|
|
1298
1320
|
pmPolymarketMarketsKeyset(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1299
1321
|
/** Polymarket events with cursor-based keyset pagination (use pagination_key).
|
|
1300
1322
|
* Tier 1 ($0.001/call). */
|
|
1301
1323
|
pmPolymarketEventsKeyset(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1302
|
-
/** List available sports categories. Tier 1 ($0.001/call).
|
|
1324
|
+
/** List available sports categories. Tier 1 ($0.001/call).
|
|
1325
|
+
*
|
|
1326
|
+
* NOTE: upstream returns 500 for every `sports/*` path as of 2026-08-04.
|
|
1327
|
+
* The route still resolves, so this works again the moment Predexon restores
|
|
1328
|
+
* it, but do not build on it yet. */
|
|
1303
1329
|
pmSportsCategories(): Promise<Record<string, unknown>>;
|
|
1304
1330
|
/** List sports markets grouped by game. Filter with league, sport_type,
|
|
1305
|
-
* status, venue. Tier 1 ($0.001/call).
|
|
1331
|
+
* status, venue. Tier 1 ($0.001/call).
|
|
1332
|
+
*
|
|
1333
|
+
* NOTE: upstream returns 500 for every `sports/*` path as of 2026-08-04. */
|
|
1306
1334
|
pmSportsMarkets(params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
1307
1335
|
/** Fetch identity + profile metadata for one wallet (ENS, Twitter, portfolio,
|
|
1308
1336
|
* etc.). Tier 2 ($0.005/call). */
|
|
@@ -3210,4 +3238,4 @@ declare function validateTemperature(temperature?: number): void;
|
|
|
3210
3238
|
*/
|
|
3211
3239
|
declare function validateTopP(topP?: number): void;
|
|
3212
3240
|
|
|
3213
|
-
export { APIError, AnthropicClient, type AudioModel, type AudioTrack, BASE_CHAIN_ID, type BarResolution, type BlockRunAnthropicOptions, BlockrunClient, type BlockrunClientOptions, BlockrunError, type CallInitiatedResponse, type CallModel, type CallOptions, type CallStatusResponse, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatResponseWithCost, type ChatUsage, type CostEntry, type CostEstimate, type CreatePaymentOptions, type FunctionCall, type FunctionDefinition, type HistoryOptions, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, KNOWN_PROVIDERS, LLMClient, type LLMClientOptions, type ListOptions, type MarketSession, type Model, MusicClient, type MusicClientOptions, type MusicGenerateOptions, type MusicResponse, NETWORK_ALIASES, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PHONE_PRICES, PORTRAIT_ENROLLMENT_PRICE_USD, PaymentError, type PaymentLinks, type PhoneBuyOptions, type PhoneBuyResponse, PhoneClient, type PhoneClientOptions, type PhoneListResponse, type PhoneLookupResponse, type PhoneNumberRecord, type PhoneReleaseResponse, type PhoneRenewResponse, type PollOptions, PortraitClient, type PortraitClientOptions, type PortraitEnrollOptions, type PortraitEnrollResponse, type PriceBar, type PriceCategory, PriceClient, type PriceClientOptions, type PriceHistoryResponse, type PriceOptions, type PricePoint, RPC_PRICE_USD, type ResponseFormat, type RoutingDecision, type RoutingProfile, type RoutingTier, type RpcBatchRequest, RpcClient, type RpcClientOptions, type RpcError, type RpcNetwork, type RpcResponse, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, SUPPORTED_NETWORKS, SearchClient, type SearchClientOptions, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type SoundEffectOptions, type SpeechAudio, SpeechClient, type SpeechClientOptions, type SpeechGenerateOptions, type SpeechModel, type SpeechResponse, type SpeechVoice, type Spending, type SpendingReport, type StockMarket, SurfClient, type SurfClientOptions, type SymbolListResponse, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, VideoClient, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, VoiceClient, type VoiceClientOptions, type VoiceInfo, type VoicePreset, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XSearchSource, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatSolanaWalletMigrationNotice, formatWalletCreatedMessage, formatWalletMigrationNotice, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, importSolanaWallet, importWallet, listDiscoveredSolanaWallets, listDiscoveredWallets, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, validateMaxTokens, validateModel, validateTemperature, validateTopP };
|
|
3241
|
+
export { APIError, AnthropicClient, type AudioModel, type AudioTrack, BASE_CHAIN_ID, type BarResolution, type BlockRunAnthropicOptions, BlockrunClient, type BlockrunClientOptions, BlockrunError, type CallInitiatedResponse, type CallModel, type CallOptions, type CallStatusResponse, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatResponseWithCost, type ChatUsage, type CostEntry, type CostEstimate, type CreatePaymentOptions, type FunctionCall, type FunctionDefinition, type HistoryOptions, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, KNOWN_PROVIDERS, LLMClient, type LLMClientOptions, type ListOptions, type MarketSession, type Model, MusicClient, type MusicClientOptions, type MusicGenerateOptions, type MusicResponse, NETWORK_ALIASES, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PHONE_PRICES, PORTRAIT_ENROLLMENT_PRICE_USD, PaymentError, type PaymentLinks, type PhoneBuyOptions, type PhoneBuyResponse, PhoneClient, type PhoneClientOptions, type PhoneListResponse, type PhoneLookupResponse, type PhoneNumberRecord, type PhoneReleaseResponse, type PhoneRenewResponse, type PollOptions, PortraitClient, type PortraitClientOptions, type PortraitEnrollOptions, type PortraitEnrollResponse, type PriceBar, type PriceCategory, PriceClient, type PriceClientOptions, type PriceHistoryResponse, type PriceOptions, type PricePoint, RPC_PRICE_USD, type ResponseFormat, RetiredEndpointError, type RoutingDecision, type RoutingProfile, type RoutingTier, type RpcBatchRequest, RpcClient, type RpcClientOptions, type RpcError, type RpcNetwork, type RpcResponse, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, SUPPORTED_NETWORKS, SearchClient, type SearchClientOptions, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type SoundEffectOptions, type SpeechAudio, SpeechClient, type SpeechClientOptions, type SpeechGenerateOptions, type SpeechModel, type SpeechResponse, type SpeechVoice, type Spending, type SpendingReport, type StockMarket, SurfClient, type SurfClientOptions, type SymbolListResponse, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, VideoClient, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, VoiceClient, type VoiceClientOptions, type VoiceInfo, type VoicePreset, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XSearchSource, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatSolanaWalletMigrationNotice, formatWalletCreatedMessage, formatWalletMigrationNotice, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, importSolanaWallet, importWallet, listDiscoveredSolanaWallets, listDiscoveredWallets, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, validateMaxTokens, validateModel, validateTemperature, validateTopP };
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,12 @@ var BlockrunError = class extends Error {
|
|
|
8
8
|
this.name = "BlockrunError";
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
+
var RetiredEndpointError = class extends BlockrunError {
|
|
12
|
+
constructor(message) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = "RetiredEndpointError";
|
|
15
|
+
}
|
|
16
|
+
};
|
|
11
17
|
var PaymentError = class extends BlockrunError {
|
|
12
18
|
constructor(message) {
|
|
13
19
|
super(message);
|
|
@@ -27,6 +33,35 @@ var APIError = class extends BlockrunError {
|
|
|
27
33
|
|
|
28
34
|
// src/x402.ts
|
|
29
35
|
import { signTypedData } from "viem/accounts";
|
|
36
|
+
|
|
37
|
+
// src/solana-deps.ts
|
|
38
|
+
var INSTALL_HINT = "npm install @solana/web3.js @solana/spl-token (or pnpm add / yarn add)";
|
|
39
|
+
function missing(pkg, what, cause) {
|
|
40
|
+
return new Error(
|
|
41
|
+
`@blockrun/llm: ${what} requires the optional peer dependency "${pkg}", which is not installed.
|
|
42
|
+
|
|
43
|
+
${INSTALL_HINT}
|
|
44
|
+
|
|
45
|
+
Solana packages are optional peers so that consumers who only use Base/EVM payments do not inherit them. If you only make Base payments, you should not be reaching this code path \u2014 check which chain you passed.
|
|
46
|
+
Original error: ${cause instanceof Error ? cause.message : String(cause)}`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
async function loadSolanaWeb3(what) {
|
|
50
|
+
try {
|
|
51
|
+
return await import("@solana/web3.js");
|
|
52
|
+
} catch (err) {
|
|
53
|
+
throw missing("@solana/web3.js", what, err);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async function loadSplToken(what) {
|
|
57
|
+
try {
|
|
58
|
+
return await import("@solana/spl-token");
|
|
59
|
+
} catch (err) {
|
|
60
|
+
throw missing("@solana/spl-token", what, err);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/x402.ts
|
|
30
65
|
var BASE_CHAIN_ID = 8453;
|
|
31
66
|
var USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
32
67
|
var SOLANA_NETWORK = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
@@ -155,9 +190,17 @@ async function createPaymentPayload(privateKey, fromAddress, recipient, amount,
|
|
|
155
190
|
return btoa(JSON.stringify(paymentData));
|
|
156
191
|
}
|
|
157
192
|
async function createSolanaPaymentPayload(secretKey, fromAddress, recipient, amount, feePayer, options = {}) {
|
|
158
|
-
const {
|
|
159
|
-
|
|
160
|
-
|
|
193
|
+
const {
|
|
194
|
+
Connection,
|
|
195
|
+
PublicKey,
|
|
196
|
+
TransactionMessage,
|
|
197
|
+
VersionedTransaction,
|
|
198
|
+
ComputeBudgetProgram,
|
|
199
|
+
Keypair
|
|
200
|
+
} = await loadSolanaWeb3("createSolanaPaymentPayload()");
|
|
201
|
+
const { getAssociatedTokenAddress, createTransferCheckedInstruction } = await loadSplToken(
|
|
202
|
+
"createSolanaPaymentPayload()"
|
|
203
|
+
);
|
|
161
204
|
const rpcUrl = options.rpcUrl || "https://sol.blockrun.ai/api/v1/solana/rpc";
|
|
162
205
|
const connection = options.rpcHeaders ? new Connection(rpcUrl, { httpHeaders: options.rpcHeaders }) : new Connection(rpcUrl);
|
|
163
206
|
const keypair = Keypair.fromSecretKey(secretKey);
|
|
@@ -451,7 +494,7 @@ function getCostSummary() {
|
|
|
451
494
|
}
|
|
452
495
|
|
|
453
496
|
// src/version.ts
|
|
454
|
-
var SDK_VERSION = "3.
|
|
497
|
+
var SDK_VERSION = "3.10.0";
|
|
455
498
|
var USER_AGENT = `blockrun-ts/${SDK_VERSION}`;
|
|
456
499
|
|
|
457
500
|
// src/client.ts
|
|
@@ -1670,20 +1713,38 @@ var LLMClient = class _LLMClient {
|
|
|
1670
1713
|
}
|
|
1671
1714
|
// ── PM convenience helpers (Predexon v2) ─────────────────────────────────
|
|
1672
1715
|
// Thin wrappers over pm() / pmQuery() for the most common v2 endpoints.
|
|
1673
|
-
/**
|
|
1674
|
-
*
|
|
1675
|
-
|
|
1676
|
-
|
|
1716
|
+
/** RETIRED — `/v1/pm/markets` no longer exists.
|
|
1717
|
+
*
|
|
1718
|
+
* Predexon sunset market matching on 2026-07-20 and the whole canonical layer
|
|
1719
|
+
* went with it, so this path returns 410 upstream. Use
|
|
1720
|
+
* `pm("markets/search", { q })` for cross-venue lookups.
|
|
1721
|
+
*
|
|
1722
|
+
* Kept as a throwing stub rather than deleted so upgrading does not break
|
|
1723
|
+
* property access; it throws before any network I/O.
|
|
1724
|
+
*
|
|
1725
|
+
* @throws {RetiredEndpointError} always. */
|
|
1726
|
+
async pmMarkets(_params) {
|
|
1727
|
+
throw new RetiredEndpointError(
|
|
1728
|
+
'/v1/pm/markets was sunset by Predexon on 2026-07-20 (upstream 410). Use pm("markets/search", { q }) for cross-venue lookups.'
|
|
1729
|
+
);
|
|
1677
1730
|
}
|
|
1678
|
-
/**
|
|
1679
|
-
*
|
|
1680
|
-
|
|
1681
|
-
|
|
1731
|
+
/** RETIRED — `/v1/pm/markets/listings` no longer exists (410, sunset
|
|
1732
|
+
* 2026-07-20 with market matching). Use `pm("markets/search", { q })`.
|
|
1733
|
+
*
|
|
1734
|
+
* @throws {RetiredEndpointError} always. */
|
|
1735
|
+
async pmListings(_params) {
|
|
1736
|
+
throw new RetiredEndpointError(
|
|
1737
|
+
'/v1/pm/markets/listings was sunset by Predexon on 2026-07-20 (upstream 410). Use pm("markets/search", { q }) for cross-venue lookups.'
|
|
1738
|
+
);
|
|
1682
1739
|
}
|
|
1683
|
-
/**
|
|
1684
|
-
*
|
|
1685
|
-
|
|
1686
|
-
|
|
1740
|
+
/** RETIRED — `/v1/pm/outcomes/{predexonId}` no longer exists (410, sunset
|
|
1741
|
+
* 2026-07-20 with market matching). Use `pm("markets/search", { q })`.
|
|
1742
|
+
*
|
|
1743
|
+
* @throws {RetiredEndpointError} always. */
|
|
1744
|
+
async pmOutcome(_predexonId) {
|
|
1745
|
+
throw new RetiredEndpointError(
|
|
1746
|
+
'/v1/pm/outcomes/{predexon_id} was sunset by Predexon on 2026-07-20 (upstream 410). Use pm("markets/search", { q }) for cross-venue lookups.'
|
|
1747
|
+
);
|
|
1687
1748
|
}
|
|
1688
1749
|
/** Polymarket markets with cursor-based keyset pagination (use pagination_key).
|
|
1689
1750
|
* Tier 1 ($0.001/call). */
|
|
@@ -1695,12 +1756,18 @@ var LLMClient = class _LLMClient {
|
|
|
1695
1756
|
async pmPolymarketEventsKeyset(params) {
|
|
1696
1757
|
return this.pm("polymarket/events/keyset", params);
|
|
1697
1758
|
}
|
|
1698
|
-
/** List available sports categories. Tier 1 ($0.001/call).
|
|
1759
|
+
/** List available sports categories. Tier 1 ($0.001/call).
|
|
1760
|
+
*
|
|
1761
|
+
* NOTE: upstream returns 500 for every `sports/*` path as of 2026-08-04.
|
|
1762
|
+
* The route still resolves, so this works again the moment Predexon restores
|
|
1763
|
+
* it, but do not build on it yet. */
|
|
1699
1764
|
async pmSportsCategories() {
|
|
1700
1765
|
return this.pm("sports/categories");
|
|
1701
1766
|
}
|
|
1702
1767
|
/** List sports markets grouped by game. Filter with league, sport_type,
|
|
1703
|
-
* status, venue. Tier 1 ($0.001/call).
|
|
1768
|
+
* status, venue. Tier 1 ($0.001/call).
|
|
1769
|
+
*
|
|
1770
|
+
* NOTE: upstream returns 500 for every `sports/*` path as of 2026-08-04. */
|
|
1704
1771
|
async pmSportsMarkets(params) {
|
|
1705
1772
|
return this.pm("sports/markets", params);
|
|
1706
1773
|
}
|
|
@@ -4781,7 +4848,7 @@ import * as os3 from "os";
|
|
|
4781
4848
|
var WALLET_DIR2 = path3.join(os3.homedir(), ".blockrun");
|
|
4782
4849
|
var SOLANA_WALLET_FILE = path3.join(WALLET_DIR2, ".solana-session");
|
|
4783
4850
|
async function createSolanaWallet() {
|
|
4784
|
-
const { Keypair } = await
|
|
4851
|
+
const { Keypair } = await loadSolanaWeb3("Solana wallet operations");
|
|
4785
4852
|
const bs58 = await import("bs58");
|
|
4786
4853
|
const keypair = Keypair.generate();
|
|
4787
4854
|
return {
|
|
@@ -4838,7 +4905,7 @@ async function solanaKeyToBytes(privateKey) {
|
|
|
4838
4905
|
}
|
|
4839
4906
|
}
|
|
4840
4907
|
async function solanaPublicKey(privateKey) {
|
|
4841
|
-
const { Keypair } = await
|
|
4908
|
+
const { Keypair } = await loadSolanaWeb3("Solana wallet operations");
|
|
4842
4909
|
const bytes = await solanaKeyToBytes(privateKey);
|
|
4843
4910
|
return Keypair.fromSecretKey(bytes).publicKey.toBase58();
|
|
4844
4911
|
}
|
|
@@ -6131,6 +6198,7 @@ export {
|
|
|
6131
6198
|
PortraitClient,
|
|
6132
6199
|
PriceClient,
|
|
6133
6200
|
RPC_PRICE_USD,
|
|
6201
|
+
RetiredEndpointError,
|
|
6134
6202
|
RpcClient,
|
|
6135
6203
|
SOLANA_NETWORK,
|
|
6136
6204
|
SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockrun/llm",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "BlockRun SDK - Pay-per-request AI (LLM, Image, Video, Music, Voice) via x402 on Base and Solana",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -52,9 +52,7 @@
|
|
|
52
52
|
"viem": "^2.49.0"
|
|
53
53
|
},
|
|
54
54
|
"optionalDependencies": {
|
|
55
|
-
"@anthropic-ai/sdk": "^0.39.0"
|
|
56
|
-
"@solana/spl-token": "^0.4.14",
|
|
57
|
-
"@solana/web3.js": "^1.98.4"
|
|
55
|
+
"@anthropic-ai/sdk": "^0.39.0"
|
|
58
56
|
},
|
|
59
57
|
"devDependencies": {
|
|
60
58
|
"@eslint/js": "^9.39.4",
|
|
@@ -77,11 +75,19 @@
|
|
|
77
75
|
},
|
|
78
76
|
"packageManager": "pnpm@9.15.4",
|
|
79
77
|
"peerDependencies": {
|
|
80
|
-
"@blockrun/clawrouter": "^0.12.222"
|
|
78
|
+
"@blockrun/clawrouter": "^0.12.222",
|
|
79
|
+
"@solana/spl-token": "^0.4.14",
|
|
80
|
+
"@solana/web3.js": "^1.98.4"
|
|
81
81
|
},
|
|
82
82
|
"peerDependenciesMeta": {
|
|
83
83
|
"@blockrun/clawrouter": {
|
|
84
84
|
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"@solana/spl-token": {
|
|
87
|
+
"optional": true
|
|
88
|
+
},
|
|
89
|
+
"@solana/web3.js": {
|
|
90
|
+
"optional": true
|
|
85
91
|
}
|
|
86
92
|
}
|
|
87
93
|
}
|