Companion

object Companion

Constructors for the two shapes a response can take, plus the decoder.

Functions

Link copied to clipboard
fun decode(json: JsonObject): JsonRpcResponse

Parses one response frame. Only the error member is validated here; result is kept raw for the typed decoders in DappJson.

Link copied to clipboard
fun failure(id: JsonElement?, exception: DappException): JsonRpcResponse

A failed response whose error body is built from exception by JsonRpcErrorBody.from.

fun failure(id: JsonElement?, error: JsonRpcErrorBody): JsonRpcResponse

A failed response carrying error verbatim.

Link copied to clipboard
fun success(id: JsonElement?, result: JsonElement?): JsonRpcResponse

A successful response. A null result is emitted as JSON null.