JsonRpcRequest

data class JsonRpcRequest(val method: String, val params: JsonElement? = null, val id: JsonElement? = null)

A JSON-RPC 2.0 request or notification.

id absent means a notification: no response is expected, which is how the wallet pushes accountsChanged, txChanged and messageSignature.

params is a bare object, not a positional array. That is what the reference TypeScript client sends — provider.request({ method, params }) passes the params object straight through — and OpenRPC 0.5.0 leaves paramStructure unset on every method, so the by-name form is the one with an implementation behind it.

Constructors

Link copied to clipboard
constructor(method: String, params: JsonElement? = null, id: JsonElement? = null)

Types

Link copied to clipboard
object Companion

Decoder for inbound request frames.

Properties

Link copied to clipboard
val id: JsonElement?
Link copied to clipboard

True when id is absent, so no response is expected.

Link copied to clipboard
Link copied to clipboard
val params: JsonElement?

Functions

Link copied to clipboard
fun encode(): JsonObject

The frame as a JSON object: jsonrpc is always set, params and id only when present.