Options
All
  • Public
  • Public/Protected
  • All
Menu

@cosmjs/json-rpc Documentation

Index

Type Aliases

JsonRpcId: number | string

Variables

jsonRpcCode: { internalError: number; invalidParams: number; invalidRequest: number; methodNotFound: number; parseError: number; serverError: { default: number } } = ...

Error codes as specified in JSON-RPC 2.0

see

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

Type declaration

  • internalError: number
  • invalidParams: number
  • invalidRequest: number
  • methodNotFound: number
  • parseError: number
  • serverError: { default: number }
    • default: number

Functions

  • 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

  • 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

  • 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

Generated using TypeDoc