# `EEVM.Transaction.Envelope`
[🔗](https://github.com/mw2000/eevm/blob/v0.1.0/lib/eevm/transaction/envelope.ex#L1)

Transaction envelope encoding/decoding for legacy and typed transactions.

Decoding turns wire addresses into integers, an empty `to` into `nil`, and
access-list storage keys into integers; encoding does the reverse.

# `decode`

```elixir
@spec decode(binary()) :: {:ok, EEVM.Transaction.t()} | {:error, atom()}
```

Decode a transaction from wire format.

A `0x`-prefixed hex string returns `{:error, :hex_string}`; decode it with
`EEVM.bytes/1` first.

# `encode`

```elixir
@spec encode(EEVM.Transaction.t()) :: binary()
```

Encode a transaction to its wire format (binary).

Raises `ArgumentError` naming the field when a field has the wrong type,
such as a hex string for `to` or a missing signature.

---

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