@blockrun/llm 2.12.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1323 -1302
- package/dist/index.cjs +294 -505
- package/dist/index.d.cts +175 -347
- package/dist/index.d.ts +175 -347
- package/dist/index.js +290 -504
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -460,6 +460,45 @@ interface VoiceInfo {
|
|
|
460
460
|
preview_url?: string;
|
|
461
461
|
[key: string]: unknown;
|
|
462
462
|
}
|
|
463
|
+
interface RpcClientOptions {
|
|
464
|
+
/** EVM wallet private key (hex string starting with 0x) */
|
|
465
|
+
privateKey?: `0x${string}` | string;
|
|
466
|
+
/** API endpoint URL (default: https://blockrun.ai/api) */
|
|
467
|
+
apiUrl?: string;
|
|
468
|
+
/** Request timeout in milliseconds (default: 60000 — upstream gateway timeout is 20s) */
|
|
469
|
+
timeout?: number;
|
|
470
|
+
}
|
|
471
|
+
/** A JSON-RPC 2.0 error object. */
|
|
472
|
+
interface RpcError {
|
|
473
|
+
code?: number;
|
|
474
|
+
message?: string;
|
|
475
|
+
data?: unknown;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Response from a multi-chain JSON-RPC call.
|
|
479
|
+
*
|
|
480
|
+
* Standard JSON-RPC 2.0 envelope plus BlockRun gateway metadata pulled
|
|
481
|
+
* from response headers (X-Network / X-Cache / X-Payment-Receipt).
|
|
482
|
+
*/
|
|
483
|
+
interface RpcResponse<T = unknown> {
|
|
484
|
+
jsonrpc?: string;
|
|
485
|
+
id?: string | number | null;
|
|
486
|
+
result?: T;
|
|
487
|
+
error?: RpcError;
|
|
488
|
+
/** Canonical network key, e.g. "ethereum" (from X-Network) */
|
|
489
|
+
network?: string;
|
|
490
|
+
/** Served from the gateway's method-aware cache (from X-Cache) */
|
|
491
|
+
cacheHit?: boolean;
|
|
492
|
+
/** x402 settlement tx hash (single calls) */
|
|
493
|
+
txHash?: string;
|
|
494
|
+
}
|
|
495
|
+
/** A single request in a JSON-RPC batch (jsonrpc/id auto-filled if omitted). */
|
|
496
|
+
interface RpcBatchRequest {
|
|
497
|
+
method: string;
|
|
498
|
+
params?: unknown[];
|
|
499
|
+
id?: string | number;
|
|
500
|
+
jsonrpc?: string;
|
|
501
|
+
}
|
|
463
502
|
/** Built-in Bland.ai voice presets. Any string is accepted (custom voice IDs work too). */
|
|
464
503
|
type VoicePreset = "nat" | "josh" | "maya" | "june" | "paige" | "derek" | "florian";
|
|
465
504
|
/** Bland.ai conversation model tier. */
|
|
@@ -578,6 +617,22 @@ interface VideoGenerateOptions {
|
|
|
578
617
|
* with `imageUrl`. Real-person likeness is not supported on BlockRun.
|
|
579
618
|
*/
|
|
580
619
|
realFaceAssetId?: string;
|
|
620
|
+
/**
|
|
621
|
+
* First-and-last-frame interpolation: a second image that seeds the FINAL
|
|
622
|
+
* frame so the model tweens from `imageUrl` → `lastFrameUrl`. Requires
|
|
623
|
+
* `imageUrl` (the first frame) and a Seedance model
|
|
624
|
+
* (bytedance/seedance-1.5-pro, seedance-2.0, or seedance-2.0-fast).
|
|
625
|
+
* Priced identically to image-to-video. Mutually exclusive with
|
|
626
|
+
* `realFaceAssetId`.
|
|
627
|
+
*/
|
|
628
|
+
lastFrameUrl?: string;
|
|
629
|
+
/**
|
|
630
|
+
* Omni / multi-reference: up to 9 reference image URLs for character/style
|
|
631
|
+
* consistency (**Seedance 2.0 only**). Cite them as "image 1", "image 2"
|
|
632
|
+
* in the prompt. Mutually exclusive with `imageUrl` / `lastFrameUrl` /
|
|
633
|
+
* `realFaceAssetId`.
|
|
634
|
+
*/
|
|
635
|
+
referenceImageUrls?: string[];
|
|
581
636
|
/** Duration to bill for (defaults to model's default duration) */
|
|
582
637
|
durationSeconds?: number;
|
|
583
638
|
/** Output aspect ratio. Token360 / Seedance only — silently ignored by xAI Grok. */
|
|
@@ -672,130 +727,6 @@ interface ExaFindSimilarOptions {
|
|
|
672
727
|
/** Exclude pages from the same domain as the reference URL */
|
|
673
728
|
excludeSourceDomain?: boolean;
|
|
674
729
|
}
|
|
675
|
-
interface XUser {
|
|
676
|
-
id: string;
|
|
677
|
-
userName: string;
|
|
678
|
-
name: string;
|
|
679
|
-
profilePicture?: string;
|
|
680
|
-
description?: string;
|
|
681
|
-
followers?: number;
|
|
682
|
-
following?: number;
|
|
683
|
-
isBlueVerified?: boolean;
|
|
684
|
-
verifiedType?: string;
|
|
685
|
-
location?: string;
|
|
686
|
-
joined?: string;
|
|
687
|
-
}
|
|
688
|
-
interface XUserLookupResponse {
|
|
689
|
-
users: XUser[];
|
|
690
|
-
not_found?: string[];
|
|
691
|
-
total_requested?: number;
|
|
692
|
-
total_found?: number;
|
|
693
|
-
}
|
|
694
|
-
interface XFollower {
|
|
695
|
-
id: string;
|
|
696
|
-
name?: string;
|
|
697
|
-
screen_name?: string;
|
|
698
|
-
userName?: string;
|
|
699
|
-
location?: string;
|
|
700
|
-
description?: string;
|
|
701
|
-
protected?: boolean;
|
|
702
|
-
verified?: boolean;
|
|
703
|
-
followers_count?: number;
|
|
704
|
-
following_count?: number;
|
|
705
|
-
favourites_count?: number;
|
|
706
|
-
statuses_count?: number;
|
|
707
|
-
created_at?: string;
|
|
708
|
-
profile_image_url_https?: string;
|
|
709
|
-
can_dm?: boolean;
|
|
710
|
-
}
|
|
711
|
-
interface XFollowersResponse {
|
|
712
|
-
followers: XFollower[];
|
|
713
|
-
has_next_page?: boolean;
|
|
714
|
-
next_cursor?: string;
|
|
715
|
-
total_returned?: number;
|
|
716
|
-
username?: string;
|
|
717
|
-
}
|
|
718
|
-
interface XFollowingsResponse {
|
|
719
|
-
followings: XFollower[];
|
|
720
|
-
has_next_page?: boolean;
|
|
721
|
-
next_cursor?: string;
|
|
722
|
-
total_returned?: number;
|
|
723
|
-
username?: string;
|
|
724
|
-
}
|
|
725
|
-
interface XUserInfoResponse {
|
|
726
|
-
data: Record<string, unknown>;
|
|
727
|
-
username?: string;
|
|
728
|
-
}
|
|
729
|
-
interface XVerifiedFollowersResponse {
|
|
730
|
-
followers: XFollower[];
|
|
731
|
-
has_next_page?: boolean;
|
|
732
|
-
next_cursor?: string;
|
|
733
|
-
total_returned?: number;
|
|
734
|
-
}
|
|
735
|
-
interface XTweet {
|
|
736
|
-
id: string;
|
|
737
|
-
text?: string;
|
|
738
|
-
created_at?: string;
|
|
739
|
-
author?: Record<string, unknown>;
|
|
740
|
-
favorite_count?: number;
|
|
741
|
-
retweet_count?: number;
|
|
742
|
-
reply_count?: number;
|
|
743
|
-
view_count?: number;
|
|
744
|
-
lang?: string;
|
|
745
|
-
entities?: Record<string, unknown>;
|
|
746
|
-
media?: Array<Record<string, unknown>>;
|
|
747
|
-
[key: string]: unknown;
|
|
748
|
-
}
|
|
749
|
-
interface XTweetsResponse {
|
|
750
|
-
tweets: XTweet[];
|
|
751
|
-
has_next_page?: boolean;
|
|
752
|
-
next_cursor?: string;
|
|
753
|
-
total_returned?: number;
|
|
754
|
-
}
|
|
755
|
-
interface XMentionsResponse {
|
|
756
|
-
tweets: XTweet[];
|
|
757
|
-
has_next_page?: boolean;
|
|
758
|
-
next_cursor?: string;
|
|
759
|
-
total_returned?: number;
|
|
760
|
-
username?: string;
|
|
761
|
-
}
|
|
762
|
-
interface XTweetLookupResponse {
|
|
763
|
-
tweets: XTweet[];
|
|
764
|
-
not_found?: string[];
|
|
765
|
-
total_requested?: number;
|
|
766
|
-
total_found?: number;
|
|
767
|
-
}
|
|
768
|
-
interface XTweetRepliesResponse {
|
|
769
|
-
replies: XTweet[];
|
|
770
|
-
has_next_page?: boolean;
|
|
771
|
-
next_cursor?: string;
|
|
772
|
-
total_returned?: number;
|
|
773
|
-
}
|
|
774
|
-
interface XTweetThreadResponse {
|
|
775
|
-
tweets: XTweet[];
|
|
776
|
-
has_next_page?: boolean;
|
|
777
|
-
next_cursor?: string;
|
|
778
|
-
total_returned?: number;
|
|
779
|
-
}
|
|
780
|
-
interface XSearchResponse {
|
|
781
|
-
tweets: XTweet[];
|
|
782
|
-
has_next_page?: boolean;
|
|
783
|
-
next_cursor?: string;
|
|
784
|
-
total_returned?: number;
|
|
785
|
-
}
|
|
786
|
-
interface XTrendingResponse {
|
|
787
|
-
data: Record<string, unknown>;
|
|
788
|
-
}
|
|
789
|
-
interface XArticlesRisingResponse {
|
|
790
|
-
data: Record<string, unknown>;
|
|
791
|
-
}
|
|
792
|
-
interface XAuthorAnalyticsResponse {
|
|
793
|
-
data: Record<string, unknown>;
|
|
794
|
-
handle?: string;
|
|
795
|
-
}
|
|
796
|
-
interface XCompareAuthorsResponse {
|
|
797
|
-
data: Record<string, unknown>;
|
|
798
|
-
}
|
|
799
730
|
type PriceCategory = "crypto" | "fx" | "commodity" | "usstock" | "stocks";
|
|
800
731
|
type StockMarket = "us" | "hk" | "jp" | "kr" | "gb" | "de" | "fr" | "nl" | "ie" | "lu" | "cn" | "ca";
|
|
801
732
|
type BarResolution = "1" | "5" | "15" | "60" | "240" | "D" | "W" | "M";
|
|
@@ -858,11 +789,6 @@ interface SearchClientOptions {
|
|
|
858
789
|
apiUrl?: string;
|
|
859
790
|
timeout?: number;
|
|
860
791
|
}
|
|
861
|
-
interface XClientOptions {
|
|
862
|
-
privateKey?: `0x${string}` | string;
|
|
863
|
-
apiUrl?: string;
|
|
864
|
-
timeout?: number;
|
|
865
|
-
}
|
|
866
792
|
interface PriceClientOptions {
|
|
867
793
|
privateKey?: `0x${string}` | string;
|
|
868
794
|
apiUrl?: string;
|
|
@@ -1304,136 +1230,6 @@ declare class LLMClient {
|
|
|
1304
1230
|
* console.log(`Balance: $${balance.toFixed(2)} USDC`);
|
|
1305
1231
|
*/
|
|
1306
1232
|
getBalance(): Promise<number>;
|
|
1307
|
-
/**
|
|
1308
|
-
* Look up X/Twitter user profiles by username.
|
|
1309
|
-
*
|
|
1310
|
-
* Powered by AttentionVC. $0.002 per user (min $0.02, max $0.20).
|
|
1311
|
-
*
|
|
1312
|
-
* @param usernames - Single username or array of usernames (without @)
|
|
1313
|
-
*/
|
|
1314
|
-
xUserLookup(usernames: string | string[]): Promise<XUserLookupResponse>;
|
|
1315
|
-
/**
|
|
1316
|
-
* Get followers of an X/Twitter user.
|
|
1317
|
-
*
|
|
1318
|
-
* Powered by AttentionVC. $0.05 per page (~200 accounts).
|
|
1319
|
-
*
|
|
1320
|
-
* @param username - X/Twitter username (without @)
|
|
1321
|
-
* @param cursor - Pagination cursor from previous response
|
|
1322
|
-
*/
|
|
1323
|
-
xFollowers(username: string, cursor?: string): Promise<XFollowersResponse>;
|
|
1324
|
-
/**
|
|
1325
|
-
* Get accounts an X/Twitter user is following.
|
|
1326
|
-
*
|
|
1327
|
-
* Powered by AttentionVC. $0.05 per page (~200 accounts).
|
|
1328
|
-
*
|
|
1329
|
-
* @param username - X/Twitter username (without @)
|
|
1330
|
-
* @param cursor - Pagination cursor from previous response
|
|
1331
|
-
*/
|
|
1332
|
-
xFollowings(username: string, cursor?: string): Promise<XFollowingsResponse>;
|
|
1333
|
-
/**
|
|
1334
|
-
* Get detailed profile info for a single X/Twitter user.
|
|
1335
|
-
*
|
|
1336
|
-
* Powered by AttentionVC. $0.002 per request.
|
|
1337
|
-
*
|
|
1338
|
-
* @param username - X/Twitter username (without @)
|
|
1339
|
-
*/
|
|
1340
|
-
xUserInfo(username: string): Promise<XUserInfoResponse>;
|
|
1341
|
-
/**
|
|
1342
|
-
* Get verified (blue-check) followers of an X/Twitter user.
|
|
1343
|
-
*
|
|
1344
|
-
* Powered by AttentionVC. $0.048 per page.
|
|
1345
|
-
*
|
|
1346
|
-
* @param userId - X/Twitter user ID (not username)
|
|
1347
|
-
* @param cursor - Pagination cursor from previous response
|
|
1348
|
-
*/
|
|
1349
|
-
xVerifiedFollowers(userId: string, cursor?: string): Promise<XVerifiedFollowersResponse>;
|
|
1350
|
-
/**
|
|
1351
|
-
* Get tweets posted by an X/Twitter user.
|
|
1352
|
-
*
|
|
1353
|
-
* Powered by AttentionVC. $0.032 per page.
|
|
1354
|
-
*
|
|
1355
|
-
* @param username - X/Twitter username (without @)
|
|
1356
|
-
* @param includeReplies - Include reply tweets (default: false)
|
|
1357
|
-
* @param cursor - Pagination cursor from previous response
|
|
1358
|
-
*/
|
|
1359
|
-
xUserTweets(username: string, includeReplies?: boolean, cursor?: string): Promise<XTweetsResponse>;
|
|
1360
|
-
/**
|
|
1361
|
-
* Get tweets that mention an X/Twitter user.
|
|
1362
|
-
*
|
|
1363
|
-
* Powered by AttentionVC. $0.032 per page.
|
|
1364
|
-
*
|
|
1365
|
-
* @param username - X/Twitter username (without @)
|
|
1366
|
-
* @param sinceTime - Start time filter (ISO8601 or Unix timestamp)
|
|
1367
|
-
* @param untilTime - End time filter (ISO8601 or Unix timestamp)
|
|
1368
|
-
* @param cursor - Pagination cursor from previous response
|
|
1369
|
-
*/
|
|
1370
|
-
xUserMentions(username: string, sinceTime?: string, untilTime?: string, cursor?: string): Promise<XMentionsResponse>;
|
|
1371
|
-
/**
|
|
1372
|
-
* Fetch full tweet data for up to 200 tweet IDs.
|
|
1373
|
-
*
|
|
1374
|
-
* Powered by AttentionVC. $0.16 per batch.
|
|
1375
|
-
*
|
|
1376
|
-
* @param tweetIds - Single tweet ID or array of tweet IDs (max 200)
|
|
1377
|
-
*/
|
|
1378
|
-
xTweetLookup(tweetIds: string | string[]): Promise<XTweetLookupResponse>;
|
|
1379
|
-
/**
|
|
1380
|
-
* Get replies to a specific tweet.
|
|
1381
|
-
*
|
|
1382
|
-
* Powered by AttentionVC. $0.032 per page.
|
|
1383
|
-
*
|
|
1384
|
-
* @param tweetId - The tweet ID to get replies for
|
|
1385
|
-
* @param queryType - Sort order: 'Latest' or 'Default'
|
|
1386
|
-
* @param cursor - Pagination cursor from previous response
|
|
1387
|
-
*/
|
|
1388
|
-
xTweetReplies(tweetId: string, queryType?: string, cursor?: string): Promise<XTweetRepliesResponse>;
|
|
1389
|
-
/**
|
|
1390
|
-
* Get the full thread context for a tweet.
|
|
1391
|
-
*
|
|
1392
|
-
* Powered by AttentionVC. $0.032 per page.
|
|
1393
|
-
*
|
|
1394
|
-
* @param tweetId - The tweet ID to get thread for
|
|
1395
|
-
* @param cursor - Pagination cursor from previous response
|
|
1396
|
-
*/
|
|
1397
|
-
xTweetThread(tweetId: string, cursor?: string): Promise<XTweetThreadResponse>;
|
|
1398
|
-
/**
|
|
1399
|
-
* Search X/Twitter with advanced query operators.
|
|
1400
|
-
*
|
|
1401
|
-
* Powered by AttentionVC. $0.032 per page.
|
|
1402
|
-
*
|
|
1403
|
-
* @param query - Search query (supports Twitter search operators)
|
|
1404
|
-
* @param queryType - Sort order: 'Latest', 'Top', or 'Default'
|
|
1405
|
-
* @param cursor - Pagination cursor from previous response
|
|
1406
|
-
*/
|
|
1407
|
-
xSearch(query: string, queryType?: string, cursor?: string): Promise<XSearchResponse>;
|
|
1408
|
-
/**
|
|
1409
|
-
* Get current trending topics on X/Twitter.
|
|
1410
|
-
*
|
|
1411
|
-
* Powered by AttentionVC. $0.002 per request.
|
|
1412
|
-
*/
|
|
1413
|
-
xTrending(): Promise<XTrendingResponse>;
|
|
1414
|
-
/**
|
|
1415
|
-
* Get rising/viral articles from X/Twitter.
|
|
1416
|
-
*
|
|
1417
|
-
* Powered by AttentionVC intelligence layer. $0.05 per request.
|
|
1418
|
-
*/
|
|
1419
|
-
xArticlesRising(): Promise<XArticlesRisingResponse>;
|
|
1420
|
-
/**
|
|
1421
|
-
* Get author analytics and intelligence metrics for an X/Twitter user.
|
|
1422
|
-
*
|
|
1423
|
-
* Powered by AttentionVC intelligence layer. $0.02 per request.
|
|
1424
|
-
*
|
|
1425
|
-
* @param handle - X/Twitter handle (without @)
|
|
1426
|
-
*/
|
|
1427
|
-
xAuthorAnalytics(handle: string): Promise<XAuthorAnalyticsResponse>;
|
|
1428
|
-
/**
|
|
1429
|
-
* Compare two X/Twitter authors side-by-side with intelligence metrics.
|
|
1430
|
-
*
|
|
1431
|
-
* Powered by AttentionVC intelligence layer. $0.05 per request.
|
|
1432
|
-
*
|
|
1433
|
-
* @param handle1 - First X/Twitter handle (without @)
|
|
1434
|
-
* @param handle2 - Second X/Twitter handle (without @)
|
|
1435
|
-
*/
|
|
1436
|
-
xCompareAuthors(handle1: string, handle2: string): Promise<XCompareAuthorsResponse>;
|
|
1437
1233
|
/**
|
|
1438
1234
|
* Query Predexon prediction market data (GET endpoints).
|
|
1439
1235
|
*
|
|
@@ -2123,78 +1919,6 @@ declare class SearchClient {
|
|
|
2123
1919
|
getWalletAddress(): string;
|
|
2124
1920
|
}
|
|
2125
1921
|
|
|
2126
|
-
/**
|
|
2127
|
-
* BlockRun X (Twitter) Client - AttentionVC-partnered X/Twitter API via x402.
|
|
2128
|
-
*
|
|
2129
|
-
* Wraps the /api/v1/x/* endpoint family. Every call is gated by an x402
|
|
2130
|
-
* payment; the client handles the 402 → sign → retry dance automatically.
|
|
2131
|
-
*
|
|
2132
|
-
* Usage:
|
|
2133
|
-
* import { XClient } from "@blockrun/llm";
|
|
2134
|
-
*
|
|
2135
|
-
* const x = new XClient({ privateKey: "0x..." });
|
|
2136
|
-
* const info = await x.userInfo("elonmusk");
|
|
2137
|
-
* const followers = await x.followers("paulg");
|
|
2138
|
-
* const results = await x.search("x402 micropayments", { queryType: "Latest" });
|
|
2139
|
-
*/
|
|
2140
|
-
|
|
2141
|
-
interface XUserTweetsOptions {
|
|
2142
|
-
username?: string;
|
|
2143
|
-
userId?: string;
|
|
2144
|
-
cursor?: string;
|
|
2145
|
-
includeReplies?: boolean;
|
|
2146
|
-
}
|
|
2147
|
-
interface XMentionsOptions {
|
|
2148
|
-
sinceTime?: string;
|
|
2149
|
-
untilTime?: string;
|
|
2150
|
-
cursor?: string;
|
|
2151
|
-
}
|
|
2152
|
-
interface XTweetRepliesOptions {
|
|
2153
|
-
cursor?: string;
|
|
2154
|
-
queryType?: "Latest" | "Default";
|
|
2155
|
-
}
|
|
2156
|
-
interface XSearchOptions {
|
|
2157
|
-
queryType?: "Latest" | "Top" | "Default";
|
|
2158
|
-
cursor?: string;
|
|
2159
|
-
}
|
|
2160
|
-
/**
|
|
2161
|
-
* BlockRun X/Twitter client.
|
|
2162
|
-
*
|
|
2163
|
-
* @deprecated BlockRun's `/v1/x/*` (AttentionVC-partnered) integration was
|
|
2164
|
-
* removed from the backend on 2026-04-30 (commit 80dcf52). All `XClient`
|
|
2165
|
-
* calls will return HTTP 404 until a replacement upstream is wired up.
|
|
2166
|
-
* The class is kept in the SDK so existing imports do not break;
|
|
2167
|
-
* instantiation logs a one-time `console.warn`.
|
|
2168
|
-
*/
|
|
2169
|
-
declare class XClient {
|
|
2170
|
-
private account;
|
|
2171
|
-
private privateKey;
|
|
2172
|
-
private apiUrl;
|
|
2173
|
-
private timeout;
|
|
2174
|
-
private static deprecationWarned;
|
|
2175
|
-
constructor(options?: XClientOptions);
|
|
2176
|
-
userLookup(usernames: string | string[]): Promise<XUserLookupResponse>;
|
|
2177
|
-
userInfo(username: string): Promise<XUserInfoResponse>;
|
|
2178
|
-
followers(username: string, cursor?: string): Promise<XFollowersResponse>;
|
|
2179
|
-
/** `/v1/x/users/following` (singular path variant). */
|
|
2180
|
-
following(username: string, cursor?: string): Promise<XFollowingsResponse>;
|
|
2181
|
-
/** `/v1/x/users/followings` (plural path variant). */
|
|
2182
|
-
followings(username: string, cursor?: string): Promise<XFollowingsResponse>;
|
|
2183
|
-
verifiedFollowers(userId: string, cursor?: string): Promise<XVerifiedFollowersResponse>;
|
|
2184
|
-
userTweets(options: XUserTweetsOptions): Promise<XTweetsResponse>;
|
|
2185
|
-
mentions(username: string, options?: XMentionsOptions): Promise<XMentionsResponse>;
|
|
2186
|
-
tweetLookup(tweetIds: string | string[]): Promise<XTweetLookupResponse>;
|
|
2187
|
-
tweetReplies(tweetId: string, options?: XTweetRepliesOptions): Promise<XTweetRepliesResponse>;
|
|
2188
|
-
tweetThread(tweetId: string, cursor?: string): Promise<XTweetThreadResponse>;
|
|
2189
|
-
search(query: string, options?: XSearchOptions): Promise<XSearchResponse>;
|
|
2190
|
-
trending(): Promise<XTrendingResponse>;
|
|
2191
|
-
articlesRising(): Promise<XArticlesRisingResponse>;
|
|
2192
|
-
private post;
|
|
2193
|
-
private payAndRetry;
|
|
2194
|
-
private fetchWithTimeout;
|
|
2195
|
-
getWalletAddress(): string;
|
|
2196
|
-
}
|
|
2197
|
-
|
|
2198
1922
|
/**
|
|
2199
1923
|
* BlockRun Price Client - Pyth-backed market data via x402.
|
|
2200
1924
|
*
|
|
@@ -2296,6 +2020,125 @@ declare class SurfClient {
|
|
|
2296
2020
|
getWalletAddress(): string;
|
|
2297
2021
|
}
|
|
2298
2022
|
|
|
2023
|
+
/**
|
|
2024
|
+
* BlockRun RPC Client - Multi-chain JSON-RPC (Tatum gateway) via x402 micropayments.
|
|
2025
|
+
*
|
|
2026
|
+
* One endpoint, 40+ chains: Ethereum, Base, Solana, Polygon, BSC, Arbitrum,
|
|
2027
|
+
* Optimism, Avalanche, Bitcoin, Sui, and more. Standard JSON-RPC 2.0
|
|
2028
|
+
* passthrough — no API key, pay-per-call in USDC.
|
|
2029
|
+
*
|
|
2030
|
+
* SECURITY NOTE - Private Key Handling:
|
|
2031
|
+
* Your private key NEVER leaves your machine. Here's what happens:
|
|
2032
|
+
* 1. Key stays local - only used to sign an EIP-712 typed data message
|
|
2033
|
+
* 2. Only the SIGNATURE is sent in the PAYMENT-SIGNATURE header
|
|
2034
|
+
* 3. BlockRun verifies the signature on-chain via Coinbase CDP facilitator
|
|
2035
|
+
*
|
|
2036
|
+
* Usage:
|
|
2037
|
+
* import { RpcClient } from '@blockrun/llm';
|
|
2038
|
+
*
|
|
2039
|
+
* const client = new RpcClient({ privateKey: '0x...' });
|
|
2040
|
+
*
|
|
2041
|
+
* // EVM chains speak eth_* JSON-RPC
|
|
2042
|
+
* const block = await client.call('ethereum', 'eth_blockNumber');
|
|
2043
|
+
* console.log(block.result); // e.g. "0x1499f7c"
|
|
2044
|
+
*
|
|
2045
|
+
* const balance = await client.call('base', 'eth_getBalance', [
|
|
2046
|
+
* '0x4200000000000000000000000000000000000006',
|
|
2047
|
+
* 'latest',
|
|
2048
|
+
* ]);
|
|
2049
|
+
*
|
|
2050
|
+
* // Non-EVM chains speak their native JSON-RPC
|
|
2051
|
+
* const slot = await client.call('solana', 'getSlot');
|
|
2052
|
+
*
|
|
2053
|
+
* // Batch: one payment, per-element pricing ($0.002 x N)
|
|
2054
|
+
* const out = await client.batch('polygon', [
|
|
2055
|
+
* { method: 'eth_blockNumber' },
|
|
2056
|
+
* { method: 'eth_gasPrice' },
|
|
2057
|
+
* ]);
|
|
2058
|
+
*
|
|
2059
|
+
* Pricing:
|
|
2060
|
+
* Flat $0.002 per JSON-RPC call; a batch charges per element.
|
|
2061
|
+
*
|
|
2062
|
+
* Networks:
|
|
2063
|
+
* 40 curated chains (see SUPPORTED_NETWORKS) plus common aliases
|
|
2064
|
+
* (eth, arb, op, matic, bnb, avax, sol, btc, xrp, dot, ...). Unknown but
|
|
2065
|
+
* well-formed slugs fall through to a generic `{slug}-mainnet` gateway
|
|
2066
|
+
* attempt, so new Tatum chains work without an SDK update.
|
|
2067
|
+
*/
|
|
2068
|
+
|
|
2069
|
+
/**
|
|
2070
|
+
* Flat price per JSON-RPC call (batch = N x this). Informational only —
|
|
2071
|
+
* the actual quote always comes from the 402 challenge.
|
|
2072
|
+
*/
|
|
2073
|
+
declare const RPC_PRICE_USD = 0.002;
|
|
2074
|
+
/**
|
|
2075
|
+
* Curated chains accepted by /v1/rpc/{network}. Mirrors the backend chain
|
|
2076
|
+
* registry (verified live 2026-06-07). EVM chains use eth_* JSON-RPC;
|
|
2077
|
+
* non-EVM (Solana / UTXO / NEAR / Sui / XRP Ledger / Polkadot) speak their
|
|
2078
|
+
* own JSON-RPC dialect.
|
|
2079
|
+
*/
|
|
2080
|
+
declare const SUPPORTED_NETWORKS: readonly ["ethereum", "base", "arbitrum", "arbitrum-nova", "optimism", "polygon", "bsc", "avalanche", "fantom", "cronos", "celo", "gnosis", "zksync", "berachain", "unichain", "monad", "chiliz", "moonbeam", "aurora", "flare", "oasis", "kaia", "sonic", "xdc", "abstract", "hyperevm", "plume", "ronin", "rootstock", "solana", "bitcoin", "litecoin", "dogecoin", "bitcoin-cash", "near", "sui", "ripple", "polkadot", "kusama", "zcash"];
|
|
2081
|
+
type RpcNetwork = (typeof SUPPORTED_NETWORKS)[number] | (string & {});
|
|
2082
|
+
/** Common short names the gateway also accepts (resolved server-side). */
|
|
2083
|
+
declare const NETWORK_ALIASES: Record<string, string>;
|
|
2084
|
+
/**
|
|
2085
|
+
* BlockRun Multi-chain RPC Client.
|
|
2086
|
+
*
|
|
2087
|
+
* Standard JSON-RPC 2.0 access to 40+ chains through BlockRun's Tatum
|
|
2088
|
+
* gateway with automatic x402 micropayments on Base chain.
|
|
2089
|
+
*
|
|
2090
|
+
* Flat $0.002 per call; a JSON-RPC batch charges per element.
|
|
2091
|
+
*/
|
|
2092
|
+
declare class RpcClient {
|
|
2093
|
+
private account;
|
|
2094
|
+
private privateKey;
|
|
2095
|
+
private apiUrl;
|
|
2096
|
+
private timeout;
|
|
2097
|
+
private sessionTotalUsd;
|
|
2098
|
+
private sessionCalls;
|
|
2099
|
+
constructor(options?: RpcClientOptions);
|
|
2100
|
+
/**
|
|
2101
|
+
* Make a single JSON-RPC 2.0 call. Flat $0.002.
|
|
2102
|
+
*
|
|
2103
|
+
* @param network - Chain name (e.g. "ethereum", "base", "solana") or a
|
|
2104
|
+
* common alias ("eth", "sol", "matic", ...). See
|
|
2105
|
+
* SUPPORTED_NETWORKS / NETWORK_ALIASES.
|
|
2106
|
+
* @param method - Chain RPC method, e.g. "eth_blockNumber", "eth_call",
|
|
2107
|
+
* "eth_getBalance" (EVM) or "getSlot", "getAccountInfo"
|
|
2108
|
+
* (Solana).
|
|
2109
|
+
* @param params - Method-specific params array (optional).
|
|
2110
|
+
* @returns RpcResponse with `result` (or JSON-RPC `error`), plus
|
|
2111
|
+
* `network`, `cacheHit` and `txHash` metadata.
|
|
2112
|
+
*
|
|
2113
|
+
* @example
|
|
2114
|
+
* const block = await client.call('ethereum', 'eth_blockNumber');
|
|
2115
|
+
* console.log(parseInt(block.result as string, 16));
|
|
2116
|
+
*/
|
|
2117
|
+
call<T = unknown>(network: RpcNetwork, method: string, params?: unknown[]): Promise<RpcResponse<T>>;
|
|
2118
|
+
/**
|
|
2119
|
+
* Make a JSON-RPC 2.0 batch call. Priced per element ($0.002 x N).
|
|
2120
|
+
*
|
|
2121
|
+
* @param network - Chain name or alias (see {@link call}).
|
|
2122
|
+
* @param requests - Requests, each with a `method` and optional
|
|
2123
|
+
* `params` / `id`. `jsonrpc` and missing ids are
|
|
2124
|
+
* filled in automatically.
|
|
2125
|
+
* @returns Array of RpcResponse, in upstream order.
|
|
2126
|
+
*
|
|
2127
|
+
* @example
|
|
2128
|
+
* const out = await client.batch('base', [
|
|
2129
|
+
* { method: 'eth_blockNumber' },
|
|
2130
|
+
* { method: 'eth_gasPrice' },
|
|
2131
|
+
* ]);
|
|
2132
|
+
*/
|
|
2133
|
+
batch(network: RpcNetwork, requests: RpcBatchRequest[]): Promise<RpcResponse[]>;
|
|
2134
|
+
private toResponse;
|
|
2135
|
+
private requestWithPayment;
|
|
2136
|
+
private handlePaymentAndRetry;
|
|
2137
|
+
private fetchWithTimeout;
|
|
2138
|
+
getWalletAddress(): string;
|
|
2139
|
+
getSpending(): Spending;
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2299
2142
|
/**
|
|
2300
2143
|
* BlockrunClient — the x402-paying HTTP primitive for the BlockRun gateway.
|
|
2301
2144
|
*
|
|
@@ -2701,21 +2544,6 @@ declare class SolanaLLMClient {
|
|
|
2701
2544
|
imageEdit(prompt: string, image: string | string[], options?: ImageEditOptions): Promise<ImageResponse>;
|
|
2702
2545
|
/** Standalone search (Solana payment). */
|
|
2703
2546
|
search(query: string, options?: SearchOptions): Promise<SearchResult>;
|
|
2704
|
-
xUserLookup(usernames: string | string[]): Promise<XUserLookupResponse>;
|
|
2705
|
-
xFollowers(username: string, cursor?: string): Promise<XFollowersResponse>;
|
|
2706
|
-
xFollowings(username: string, cursor?: string): Promise<XFollowingsResponse>;
|
|
2707
|
-
xUserInfo(username: string): Promise<XUserInfoResponse>;
|
|
2708
|
-
xVerifiedFollowers(userId: string, cursor?: string): Promise<XVerifiedFollowersResponse>;
|
|
2709
|
-
xUserTweets(username: string, includeReplies?: boolean, cursor?: string): Promise<XTweetsResponse>;
|
|
2710
|
-
xUserMentions(username: string, sinceTime?: string, untilTime?: string, cursor?: string): Promise<XMentionsResponse>;
|
|
2711
|
-
xTweetLookup(tweetIds: string | string[]): Promise<XTweetLookupResponse>;
|
|
2712
|
-
xTweetReplies(tweetId: string, queryType?: string, cursor?: string): Promise<XTweetRepliesResponse>;
|
|
2713
|
-
xTweetThread(tweetId: string, cursor?: string): Promise<XTweetThreadResponse>;
|
|
2714
|
-
xSearch(query: string, queryType?: string, cursor?: string): Promise<XSearchResponse>;
|
|
2715
|
-
xTrending(): Promise<XTrendingResponse>;
|
|
2716
|
-
xArticlesRising(): Promise<XArticlesRisingResponse>;
|
|
2717
|
-
xAuthorAnalytics(handle: string): Promise<XAuthorAnalyticsResponse>;
|
|
2718
|
-
xCompareAuthors(handle1: string, handle2: string): Promise<XCompareAuthorsResponse>;
|
|
2719
2547
|
pm(path: string, params?: Record<string, string>): Promise<Record<string, unknown>>;
|
|
2720
2548
|
pmQuery(path: string, query: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2721
2549
|
/**
|
|
@@ -3083,4 +2911,4 @@ declare function validateTemperature(temperature?: number): void;
|
|
|
3083
2911
|
*/
|
|
3084
2912
|
declare function validateTopP(topP?: number): void;
|
|
3085
2913
|
|
|
3086
|
-
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, 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, type ResponseFormat, type RoutingDecision, type RoutingProfile, type RoutingTier, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, 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
|
|
2914
|
+
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, formatWalletCreatedMessage, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, validateMaxTokens, validateModel, validateTemperature, validateTopP };
|