rpc

Attribute Macro rpc 

Source
#[rpc]
Expand description

Generates the jsonrpc handler and types.

§Root Attribute Arguments:

  • all_positional: bool Positional mode means that the parameters of the RPC call are expected to be a JSON array, which will be parsed as a tuple of this function’s arguments.
  • ts_outdir: Option<String> Set the path where typescript definitions are written to (relative to the crate root). If not set, no typescript definitions will be written.
  • openrpc_outdir: Option<String> Set the path where openrpc specification file will be written to (relative to the crate root). If not set, no openrpc definition file will be written.

Note that you need to specify atleast one type definition output: ts_outdir, openrpc_outdir or both.

§Method Attribute Arguments:

  • name: Option<String> Set the name of the RPC method. Defaults to the function name.
  • notification: bool Make this a notification method. Notifications are received like method calls but cannot return anything.
  • positional: bool Positional mode means that the parameters of the RPC call are expected to be a JSON array, which will be parsed as a tuple of this function’s arguments.