View Source Tezex.Rpc (tezex v2.0.0-rc.5)

Send transactions to the Tezos network.

send_operation/4 is the main function, see tests for usage.

Summary

Types

@type encoded_private_key() :: <<_::32, _::_*8>>
@type op() :: map()
@type t() :: %Tezex.Rpc{
  chain_id: binary(),
  endpoint: binary(),
  headers: Finch.Request.headers(),
  opts: Finch.request_opts()
}

Functions

Link to this function

fill_operation_fee(operation, preapplied_operations, opts \\ [])

View Source
@spec fill_operation_fee(op(), [op()], keyword()) :: op()
Link to this function

forge_and_sign_operation(operation, encoded_private_key)

View Source
@spec forge_and_sign_operation(op(), encoded_private_key()) :: nonempty_binary()

Sign the forged operation and returns the forged operation+signature payload to be injected.

Link to this function

get_block(rpc, hash \\ "head")

View Source
@spec get_block(t(), nonempty_binary()) ::
  {:ok, map()} | {:error, Finch.Error.t()} | {:error, Jason.DecodeError.t()}
Link to this function

get_block_at_offset(rpc, offset)

View Source
@spec get_block_at_offset(t(), integer()) ::
  {:ok, map()} | {:error, Finch.Error.t()} | {:error, Jason.DecodeError.t()}
Link to this function

get_counter_for_account(rpc, address)

View Source
@spec get_counter_for_account(t(), nonempty_binary()) ::
  integer() | {:error, :not_integer} | {:error, Finch.Error.t()}
Link to this function

get_next_counter_for_account(rpc, address)

View Source
@spec get_next_counter_for_account(t(), nonempty_binary()) :: integer()
Link to this function

inject_operation(rpc, payload)

View Source
@spec inject_operation(t(), any()) ::
  {:ok, any()} | {:error, Finch.Error.t()} | {:error, Jason.DecodeError.t()}
Link to this function

preapply_operation(rpc, operation, encoded_private_key, protocol)

View Source
@spec preapply_operation(t(), map(), encoded_private_key(), any()) ::
  {:ok, any()} | {:error, Finch.Error.t()} | {:error, Jason.DecodeError.t()}

Simulate the application of the operations with the context of the given block and return the result of each operation application.

Link to this function

prepare_operation(contents, wallet_address, counter, branch)

View Source
@spec prepare_operation([op()], nonempty_binary(), integer(), nonempty_binary()) ::
  op()
Link to this function

send_operation(rpc, contents, wallet_address, encoded_private_key, opts \\ [])

View Source

Send an operation to a Tezos RPC node.