JSPM

rpc-json-types

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q11642F
  • License MIT

JSON-RPC Types

Package Exports

  • rpc-json-types

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rpc-json-types) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

rpc-json-types npm version

JSON-RPC Types

API

// ---------- Typings ----------------------------------------------- //

interface JsonRpcRequest<T = any> {
  id: number;
  jsonrpc: string;
  method: string;
  params: T;
}

interface JsonRpcResult<T = any> {
  id: number;
  jsonrpc: string;
  result: T;
}

interface JsonRpcError {
  id: number;
  jsonrpc: string;
  error: ErrorResponse;
}

interface ErrorResponse {
  code: number;
  message: string;
}

type JsonRpcResponse<T = any> = JsonRpcResult<T> | JsonRpcError;

type JsonRpcPayload<P = any, R = any> = JsonRpcRequest<P> | JsonRpcResponse<R>;