JSONRPCService

JSONRPCService handles incoming JSON-RPC method calls. A full list of methods is documented at the JSON-RPC Methods Specification. Note that JSONRPCService does not expose any form of external interface (such as an HTTP server). Full nodes should implement these services so that users can interact with the node. For more information about these external services, see our document on extending plasma-core.


getAllMethods

jsonrpc.getAllMethods()

Returns all available RPC methods.

Returns

Object: All subdispatcher methods as a single object in the form { name: methodref }.


getMethod

jsonrpc.getMethod(name)

Returns a method by its name.

Parameters

  1. name - string: Name of the method.

Returns

Function: A reference to the method with that name.


handle

jsonrpc.handle(method, params = [])

Calls a method with the given name and params.

Parameters

  1. method - string: Name of the method to call.
  2. params - Array: An array of parameters.

Returns

Promise<any>: The result of the method call.


handleRawRequest

jsonrpc.handleRawRequest(request)

Handles a raw JSON-RPC request.

Parameters

  1. request - Object: A JSON-RPC request object.

Returns

Promise<Object>: A JSON-RPC response object.