UNPKG

fortmatic

Version:
20 lines (19 loc) 765 B
import { JsonRpcBatchRequestPayload, JsonRpcError, JsonRpcRequestPayload, JsonRpcResponsePayload } from '../types'; /** * A class which standardizes JSON RPC responses to ensure the correct * formatting. */ export declare class JsonRpcResponse<ResultType = any> { private readonly _jsonrpc; private readonly _id; private _result?; private _error?; constructor(responsePayload: JsonRpcResponsePayload); constructor(response: JsonRpcResponse<ResultType>); constructor(payload: JsonRpcRequestPayload | JsonRpcBatchRequestPayload); applyError(error?: JsonRpcError | null): this; applyResult(result?: ResultType | null): this; get hasError(): boolean; get hasResult(): boolean; get payload(): JsonRpcResponsePayload; }