RaiEx v0.2.0 RaiEx.RPC behaviour View Source

This module provides macros for generating rpc-invoking functions.

Link to this section Summary

Functions

A macro for defining parameters and their types inside an rpc block

A macro for generating rpc calling functions with validations

Link to this section Functions

Link to this macro param(name, type, opts \\ []) View Source (macro)

A macro for defining parameters and their types inside an rpc block.

Link to this macro rpc(action, list) View Source (macro)

A macro for generating rpc calling functions with validations.

rpc :account_remove do
  param "wallet", :string
  param "account", :string
end

Transforms to a single function which takes arguments wallet and account in the declared order. Additionally this function performs type checking on the arguments, e.g. If the first argument wallet does not pass the :string type check, an ArgumentError will be raised.

Link to this section Callbacks

Link to this callback post_json_rpc(map, pos_integer, tuple) View Source
post_json_rpc(map(), pos_integer(), tuple()) ::
  {:ok, map()} |
  {:error, any()}