Class: BatchClient
Constructors​
constructor​
• new BatchClient(options
): BatchClient
Parameters​
Name | Type |
---|---|
options | BatchClientOptions |
Returns​
Defined in​
Properties​
nodeUrl​
• nodeUrl: string
Defined in​
headers​
• headers: object
Defined in​
interval​
• interval: number
Defined in​
requestId​
• requestId: number
= 0
Defined in​
pendingRequests​
• Private
pendingRequests: Record
<string
| number
, RequestBody
> = {}
Defined in​
batchPromises​
• Private
batchPromises: Record
<string
| number
, Promise
<ResponseBody
[]>> = {}
Defined in​
delayTimer​
• Private
Optional
delayTimer: Timeout
Defined in​
delayPromise​
• Private
Optional
delayPromise: Promise
<void
>
Defined in​
delayPromiseResolve​
• Private
Optional
delayPromiseResolve: () => void
Type declaration​
â–¸ (): void
Returns​
void
Defined in​
Methods​
wait​
â–¸ wait(): Promise
<void
>
Returns​
Promise
<void
>
Defined in​
addPendingRequest​
â–¸ addPendingRequest<T
>(method
, params?
, id?
): string
| number
Type parameters​
Name | Type |
---|---|
T | extends keyof ReadMethods | keyof WriteMethods | keyof TraceMethods |
Parameters​
Name | Type |
---|---|
method | T |
params? | Methods [T ][``"params"``] |
id? | string | number |
Returns​
string
| number
Defined in​
sendBatch​
â–¸ sendBatch(requests
): Promise
<any
>
Parameters​
Name | Type |
---|---|
requests | RequestBody [] |
Returns​
Promise
<any
>
Defined in​
fetch​
â–¸ fetch<T
, TResponse
>(method
, params?
, id?
): Promise
<TResponse
>
Automatically batches and fetches JSON-RPC calls in a single request.
Type parameters​
Name | Type |
---|---|
T | extends keyof ReadMethods | keyof WriteMethods | keyof TraceMethods |
TResponse | extends Object |
Parameters​
Name | Type | Description |
---|---|---|
method | T | Method to call |
params? | Methods [T ][``"params"``] | Method parameters |
id? | string | number | JSON-RPC Request ID |
Returns​
Promise
<TResponse
>
JSON-RPC Response