UNPKG

lisk-framework

Version:

Lisk blockchain application platform

28 lines (27 loc) 869 B
export type ID = string | number | null; export type JSONRPCResult = string | number | boolean | object; export interface JSONRPCErrorObject { code: number; message: string; data?: JSONRPCResult; } export interface RequestObject { readonly id: ID; readonly jsonrpc: string; readonly method: string; readonly params?: Record<string, unknown>; } export type NotificationRequest = Omit<RequestObject, 'id'>; export interface ResponseObjectWithError { readonly id: ID; readonly jsonrpc: string; readonly error: JSONRPCErrorObject; readonly result?: never; } export interface ResponseObjectWithResult<T = JSONRPCResult> { readonly id: ID; readonly jsonrpc: string; readonly error?: never; readonly result: T; } export type ResponseObject<T = JSONRPCResult> = ResponseObjectWithError | ResponseObjectWithResult<T>;