Options
All
  • Public
  • Public/Protected
  • All
Menu

@iov/jsonrpc Documentation

Index

Type aliases

JsonRpcId

JsonRpcId: number | string

JsonRpcResponse

Functions

isJsonRpcErrorResponse

isJsonRpcSuccessResponse

makeJsonRpcId

  • makeJsonRpcId(): number
  • Creates a new ID to be used for creating a JSON-RPC request.

    Multiple calls of this produce unique values.

    The output may be any value compatible to JSON-RPC request IDs with an undefined output format and generation logic.

    Returns number

parseJsonRpcErrorResponse

parseJsonRpcId

  • parseJsonRpcId(data: unknown): JsonRpcId | null
  • Extracts ID field from request or response object.

    Returns null when no valid ID was found.

    Parameters

    • data: unknown

    Returns JsonRpcId | null

parseJsonRpcRequest

parseJsonRpcResponse

  • Returns a JsonRpcErrorResponse if input can be parsed as a JSON-RPC error. Otherwise parses input as JsonRpcSuccessResponse. Throws if input is neither a valid error nor success response.

    Parameters

    • data: unknown

    Returns JsonRpcResponse

parseJsonRpcSuccessResponse

Object literals

Const jsonRpcCode

jsonRpcCode: object

Error codes as specified in JSON-RPC 2.0

see

https://www.jsonrpc.org/specification#error_object

internalError

internalError: number = -32603

invalidParams

invalidParams: number = -32602

invalidRequest

invalidRequest: number = -32600

methodNotFound

methodNotFound: number = -32601

parseError

parseError: number = -32700

serverError

serverError: object

default

default: number = -32000

Generated using TypeDoc