View Source Xander.Transaction (Xander v0.2.0)
Submits transactions to a Cardano node using the Node-to-Client (n2c) protocol.
Summary
Functions
Returns a child specification for the process. This determines the configuration of the OTP process when it is started by its parent.
Emits events when in the connected
state. Must transition to the
idle
state prior to sending queries to the node.
Emits events when in the disconnected
state.
Emits events when in the idle
state.
This maps to the StIdle state in the Cardano Local State Query protocol.
This is the state where the process waits for a query to be made and the
queue is empty.
Sends a transaction to the connected Cardano node.
Starts a new transaction process.
Types
@type t() :: %Xander.Transaction{ client: atom(), network: any(), path: any(), port: non_neg_integer() | 0, queue: :queue.queue(), socket: any() }
Type defining the Transaction struct.
@type tx_id() :: binary()
Functions
@spec child_spec(Keyword.t()) :: %{ id: atom(), start: {atom(), atom(), Keyword.t()}, type: atom(), restart: atom(), shutdown: integer() }
Returns a child specification for the process. This determines the configuration of the OTP process when it is started by its parent.
@spec connected(:info | :internal, :establish | any(), t()) :: {:next_state, :disconnected, t()} | {:next_state, :idle, t()}
Emits events when in the connected
state. Must transition to the
idle
state prior to sending queries to the node.
@spec disconnected(:info | :internal | {:call, any()}, any(), t()) :: {:next_state, :disconnected, t()} | {:next_state, :connected, t(), [{:next_event, :internal, :establish}]} | {:keep_state, t(), [{:reply, any(), {:error, :disconnected}}]}
Emits events when in the disconnected
state.
@spec idle( :info | :internal | {:call, any()}, {:request, atom(), atom()} | {:tcp_closed, any()}, t() ) :: {:next_state, :disconnected, t()} | {:next_state, :busy, t(), [{:next_event, :internal, :send_tx}]}
Emits events when in the idle
state.
This maps to the StIdle state in the Cardano Local State Query protocol.
This is the state where the process waits for a query to be made and the
queue is empty.
@spec send(atom() | pid(), binary()) :: {:accepted, tx_id()} | {:rejected, binary()} | {:error, binary()}
Sends a transaction to the connected Cardano node.
For example:
Xander.Transaction.send(tx_hash)
@spec start_link(Keyword.t()) :: GenServer.on_start()
Starts a new transaction process.