@sidhujag/sysweb3-keyring 2.1.13 → 2.1.14

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.
@@ -0,0 +1,45 @@
1
+ import { type RpcReadRequest, type RpcResponse } from './rpc-transport';
2
+ export type { RpcReadRequest } from './rpc-transport';
3
+ export type RpcReadOptions = {
4
+ signal?: AbortSignal;
5
+ timeoutMs?: number;
6
+ maxResponseBytes?: number;
7
+ };
8
+ export type RpcReadClientOptions = {
9
+ fetch?: (url: string, init: RequestInit) => Promise<Response>;
10
+ requestInit?: Omit<RequestInit, 'method' | 'body' | 'signal'>;
11
+ recoverResponse?: boolean;
12
+ signal?: AbortSignal;
13
+ maxBatchItems?: number;
14
+ maxRequestBytes?: number;
15
+ maxResponseBytes?: number;
16
+ maxConcurrency?: number;
17
+ timeoutMs?: number;
18
+ };
19
+ export declare class RpcReadError extends Error {
20
+ readonly code: number;
21
+ readonly data?: unknown;
22
+ constructor(value: NonNullable<RpcResponse['error']>);
23
+ }
24
+ /** Bounded, read-only JSON-RPC transport. Each instance belongs to one endpoint generation. */
25
+ export declare class JsonRpcReadClient {
26
+ private readonly fetcher;
27
+ private readonly endpoint;
28
+ private readonly options;
29
+ private readonly lifetime;
30
+ private readonly queue;
31
+ private active;
32
+ private batchLimit;
33
+ private chainGeneration;
34
+ private chainCache?;
35
+ private chainRequest?;
36
+ constructor(url: string, options?: RpcReadClientOptions);
37
+ get url(): string;
38
+ destroy(): void;
39
+ private slot;
40
+ readMany(inputs: readonly RpcReadRequest[], options?: RpcReadOptions): Promise<PromiseSettledResult<unknown>[]>;
41
+ read(method: string, params: readonly unknown[], options?: RpcReadOptions): Promise<unknown>;
42
+ getChainId(options?: RpcReadOptions & {
43
+ fresh?: boolean;
44
+ }): Promise<string>;
45
+ }
@@ -0,0 +1,27 @@
1
+ export type RpcReadRequest = Readonly<{
2
+ method: string;
3
+ params: readonly unknown[];
4
+ }>;
5
+ export type RpcTransportRequest = Readonly<{
6
+ method: string;
7
+ params: readonly unknown[] | Record<string, unknown>;
8
+ }>;
9
+ export type RpcResponse = {
10
+ jsonrpc: '2.0';
11
+ id: number;
12
+ result?: unknown;
13
+ error?: {
14
+ code: number;
15
+ message: string;
16
+ data?: unknown;
17
+ };
18
+ };
19
+ export type RpcJsonTransport = (url: string, body: string, signal: AbortSignal) => Promise<unknown>;
20
+ export declare class RpcResponseIntegrityError extends Error {
21
+ readonly retryable: boolean;
22
+ readonly code = "SYSWEB3_RPC_RESPONSE_INVALID";
23
+ constructor(message?: string, retryable?: boolean);
24
+ }
25
+ export declare const isReadOnlyRpcMethod: (method: string) => boolean;
26
+ /** Correlate exact wire responses and recover one stale read response. */
27
+ export declare function requestJsonRpc(url: string, inputs: readonly RpcTransportRequest[], batch: boolean, signal: AbortSignal, transport: RpcJsonTransport, recoverResponse?: boolean): Promise<RpcResponse[]>;