@sidhujag/sysweb3-keyring 2.1.13 → 2.1.15

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.
@@ -1,23 +1,19 @@
1
1
  import { BigNumber, JsonRpcProvider, type Networkish } from './ethers-v6';
2
+ import { type RpcReadOptions, type RpcReadRequest } from './rpc-read-client';
2
3
  import type { JsonRpcPayload } from 'ethers/providers';
3
- export declare class RpcResponseIntegrityError extends Error {
4
- readonly retryable: boolean;
5
- readonly code = "SYSWEB3_RPC_RESPONSE_INVALID";
6
- constructor(message?: string, retryable?: boolean);
7
- }
4
+ export { RpcResponseIntegrityError } from './rpc-transport';
8
5
  export declare const wrapTransactionReceipt: (receipt: any) => any;
9
6
  export declare const wrapTransactionResponse: (transaction: any) => any;
10
7
  declare class BaseProvider extends JsonRpcProvider {
11
- private isPossibleGetChainId;
12
8
  private cooldownTime;
13
9
  private rateLimit;
14
10
  private requestCount;
15
11
  private lastRequestTime;
16
- private currentChainId;
17
12
  private feeDataCache;
18
13
  private feeDataPromise;
19
14
  private readonly configuredChainId?;
20
15
  private chainIdVerificationPromise;
16
+ private readonly readClient;
21
17
  isInCooldown: boolean;
22
18
  errorMessage: any;
23
19
  serverHasAnError: boolean;
@@ -41,12 +37,14 @@ declare class BaseProvider extends JsonRpcProvider {
41
37
  private canMakeRequest;
42
38
  verifyConfiguredChainId(fresh?: boolean): Promise<void>;
43
39
  private fetchAndVerifyConfiguredChainId;
40
+ private readChainId;
44
41
  private cooldown;
45
- private validateRpcResponses;
46
42
  private requestRpc;
43
+ readMany(inputs: readonly RpcReadRequest[], options?: RpcReadOptions): Promise<PromiseSettledResult<unknown>[]>;
47
44
  _send(payload: JsonRpcPayload | Array<JsonRpcPayload>): Promise<any[]>;
48
45
  send: (method: string, params: any[]) => Promise<any>;
49
46
  sendBatch(method: string, params: Array<any[]>): Promise<any[]>;
47
+ destroy(): void;
50
48
  getGasPrice(): Promise<BigNumber>;
51
49
  getFeeData(): Promise<any>;
52
50
  private readFeeData;
@@ -64,4 +62,3 @@ export declare class CustomJsonRpcProvider extends BaseProvider {
64
62
  url: string;
65
63
  }, network?: Networkish);
66
64
  }
67
- export {};
@@ -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[]>;