Send transactions to the Tezos network.
send_operation/4 is the main function, see tests for usage.
Summary
Functions
Return the parameter type of entrypoint name of contract address, as a
Micheline expression.
Return the entrypoints of contract address, as the node sends them:
%{"entrypoints" => %{name => type}, "unreachable" => [...]}, where each
type is a Micheline expression. The node leaves out "unreachable" when it
is empty, and lists "default" only if the contract annotates a branch
%default.
Sign the forged operation and returns the forged operation+signature payload to be injected.
Simulate the application of the operations with the context of the given block and return the result of each operation application.
Send an operation to a Tezos RPC node.
Types
@type encoded_private_key() :: <<_::32, _::_*8>>
@type error_reason() :: transport_error() | {:missing_keys, [String.t()]} | {:preapply_failed, list()} | {:unexpected_response, term()} | {:invalid_counter, term()} | {:invalid_balance, term()} | {:no_such_entrypoint, binary()} | {:invalid_address, binary()} | {:invalid_entrypoint, binary()} | :no_transactions
@type operation() :: map()
@type preapplied_operations() :: map()
@type t() :: %Tezex.Rpc{ chain_id: binary(), endpoint: binary(), headers: Finch.Request.headers(), opts: Finch.request_opts() }
@type transaction() :: map()
@type transport_error() :: {:transport, Exception.t()} | {:http_status, Finch.Response.t()} | {:decode, Jason.DecodeError.t()}
Functions
@spec entrypoint(t(), nonempty_binary(), nonempty_binary()) :: {:ok, map()} | {:error, transport_error() | {:no_such_entrypoint, binary()} | {:invalid_address, binary()} | {:invalid_entrypoint, binary()}}
Return the parameter type of entrypoint name of contract address, as a
Micheline expression.
For "default" on a contract that has no %default annotation, the node
returns the whole parameter type, so this also gives the type of a call
without an entrypoint.
The node answers 404 when the name is unknown, when address is an
implicit account and when the contract doesn't exist. All three return
{:error, {:no_such_entrypoint, name}}.
Returns {:error, {:invalid_address, address}} when address isn't a
KT1, tz1, tz2, tz3 or tz4 address with a valid checksum, and
{:error, {:invalid_entrypoint, name}} when name isn't 1 to 31 bytes long
or is "." or "..".
Successful results are cached, see Tezex.Rpc.EntrypointCache.
@spec entrypoints(t(), nonempty_binary()) :: {:ok, map()} | {:error, transport_error() | {:invalid_address, binary()}}
Return the entrypoints of contract address, as the node sends them:
%{"entrypoints" => %{name => type}, "unreachable" => [...]}, where each
type is a Micheline expression. The node leaves out "unreachable" when it
is empty, and lists "default" only if the contract annotates a branch
%default.
Returns {:error, {:invalid_address, address}} when address isn't a
KT1, tz1, tz2, tz3 or tz4 address with a valid checksum.
Successful results are cached, see Tezex.Rpc.EntrypointCache.
@spec fill_operation_fee(operation(), [preapplied_operations()], gas_limit: non_neg_integer(), storage_limit: non_neg_integer(), gas_reserve: non_neg_integer(), burn_reserve: non_neg_integer() ) :: {:ok, operation()} | {:error, Tezex.ForgeOperation.error_reason()}
@spec forge_and_sign_operation(operation(), encoded_private_key()) :: {:ok, nonempty_binary()} | {:error, Tezex.ForgeOperation.error_reason()}
Sign the forged operation and returns the forged operation+signature payload to be injected.
@spec get_balance(t(), nonempty_binary()) :: {:ok, pos_integer()} | {:error, error_reason()}
@spec get_block(t(), nonempty_binary()) :: {:ok, map()} | {:error, transport_error()}
@spec get_block_at_offset(t(), integer()) :: {:ok, map()} | {:error, transport_error()}
@spec get_counter_for_account(t(), nonempty_binary()) :: {:ok, integer()} | {:error, error_reason()}
@spec get_next_counter_for_account(t(), nonempty_binary()) :: {:ok, integer()} | {:error, error_reason()}
@spec inject_operation(t(), any()) :: {:ok, any()} | {:error, transport_error()}
@spec preapply_operation(t(), map(), encoded_private_key(), any()) :: {:ok, list()} | {:error, error_reason()}
Simulate the application of the operations with the context of the given block and return the result of each operation application.
@spec prepare_operation( [transaction(), ...], nonempty_binary(), integer(), nonempty_binary() ) :: operation()
@spec send_operation( t(), [transaction()] | transaction(), nonempty_binary(), encoded_private_key(), offset: non_neg_integer(), storage_limit: non_neg_integer() ) :: {:ok, any()} | {:error, error_reason()}
Send an operation to a Tezos RPC node.