Exth.Rpc.Request (Exth v0.2.1)

View Source

Represents a JSON-RPC request with validation.

A request consists of:

  • method - The RPC method name (string or atom)
  • params - List of parameters for the method
  • id - Optional positive integer for request identification
  • jsonrpc - JSON-RPC version (defaults to "2.0")

Example

iex> Request.new("eth_getBalance", ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e", "latest"])
%Request{
  method: "eth_getBalance",
  params: ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e", "latest"],
  id: nil,
  jsonrpc: "2.0"
}

Summary

Types

t()

@type t() :: %Exth.Rpc.Request{
  id: Exth.Rpc.id(),
  jsonrpc: Exth.Rpc.jsonrpc(),
  method: Exth.Rpc.method(),
  params: Exth.Rpc.params()
}

Functions

new(method, params, id \\ nil)

@spec new(Exth.Rpc.method(), Exth.Rpc.params(), Exth.Rpc.id() | nil) :: t()