import { JsonRpcRequest, JsonRpcResponse } from './JsonRpc'; export declare class RawBatchResponse { private readonly _results; private readonly _batch; constructor(results: Array, batch: Batch); get results(): Array; get batch(): Batch; resolve(): Promise; } /** * Batch of JSON RPC calls */ export interface Batch { /** * Add new call to current batch * * @param method * @param params * @returns promise for the method execution result */ addCall(method: string, params: any): Promise; /** * @returns raw JSON RPC data in that batch */ getItems(): Array; /** * Resolves all promises in current batch. Please note that 'resolve' is in terms of batch, and any particular * promise may still be rejected, depending on the state of the response. */ resolve(): Array>; /** * Rejects all promises, regardless state * * @param reason optional error to pass to reject */ reject(reason?: any): any; } export declare type BatchItem = { request: JsonRpcRequest; response?: JsonRpcResponse; resolve?: (value?: any | PromiseLike) => void; reject?: (reason?: any) => void; promise?: Promise; }; export declare class DefaultBatch implements Batch { calls: Array; constructor(); addCall(method: string, params: any): Promise; processResponse(item: BatchItem): Promise; resolve(): Array>; reject(reason?: any): void; getItems(): Array; } /** * Joins few separate batches into one batch */ export declare class JoinedBatch implements Batch { batches: Array; constructor(...batches: Array); addCall(method: string, params: any): Promise; getItems(): Array; resolve(): Array>; reject(reason?: any): void; } /** * Batch wrapper that ignores calls for resolve/reject. */ export declare class UnresolvableBatch implements Batch { delegate: Batch; constructor(delegate: Batch); addCall(method: string, params: any): Promise; getItems(): Array; reject(reason?: any): void; resolve(): Array>; }