# `Tezex.Rpc`
[🔗](https://github.com/objkt-com/tezex/blob/v5.0.1/lib/rpc.ex#L1)

Send transactions to the Tezos network.

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

# `encoded_private_key`

```elixir
@type encoded_private_key() :: &lt;&lt;_::32, _::_*8&gt;&gt;
```

# `error_reason`

```elixir
@type error_reason() ::
  transport_error()
  | {:missing_keys, [String.t()]}
  | {:preapply_failed, list()}
  | {:unexpected_response, term()}
  | {:invalid_counter, term()}
  | {:invalid_balance, term()}
```

# `operation`

```elixir
@type operation() :: map()
```

# `preapplied_operations`

```elixir
@type preapplied_operations() :: map()
```

# `t`

```elixir
@type t() :: %Tezex.Rpc{
  chain_id: binary(),
  endpoint: binary(),
  headers: Finch.Request.headers(),
  opts: Finch.request_opts()
}
```

# `transaction`

```elixir
@type transaction() :: map()
```

# `transport_error`

```elixir
@type transport_error() ::
  {:transport, Exception.t()}
  | {:http_status, Finch.Response.t()}
  | {:decode, Jason.DecodeError.t()}
```

# `fill_operation_fee`

```elixir
@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()}
```

# `forge_and_sign_operation`

```elixir
@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.

# `get_balance`

```elixir
@spec get_balance(t(), nonempty_binary()) ::
  {:ok, pos_integer()} | {:error, error_reason()}
```

# `get_block`

```elixir
@spec get_block(t(), nonempty_binary()) :: {:ok, map()} | {:error, transport_error()}
```

# `get_block_at_offset`

```elixir
@spec get_block_at_offset(t(), integer()) ::
  {:ok, map()} | {:error, transport_error()}
```

# `get_counter_for_account`

```elixir
@spec get_counter_for_account(t(), nonempty_binary()) ::
  {:ok, integer()} | {:error, error_reason()}
```

# `get_next_counter_for_account`

```elixir
@spec get_next_counter_for_account(t(), nonempty_binary()) ::
  {:ok, integer()} | {:error, error_reason()}
```

# `inject_operation`

```elixir
@spec inject_operation(t(), any()) :: {:ok, any()} | {:error, transport_error()}
```

# `preapply_operation`

```elixir
@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.

# `prepare_operation`

```elixir
@spec prepare_operation(
  [transaction()],
  nonempty_binary(),
  integer(),
  nonempty_binary()
) :: operation()
```

# `send_operation`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
