> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# TxEnvelope

:::info
`TxEnvelope` is a re-export of ox's [`TransactionEnvelope`](https://oxlib.sh/api/TransactionEnvelope). Refer to the ox documentation for the full reference.
:::

Errors & Types for working with Transaction Envelopes.

:::note
Refer to the following modules for specific Transaction Envelope types:

* [`TxEnvelopeLegacy`](/docs/utilities/txenvelopelegacy)
* [`TxEnvelopeEip1559`](/docs/utilities/txenvelopeeip1559)
* [`TxEnvelopeEip2930`](/docs/utilities/txenvelopeeip2930)
* [`TxEnvelopeEip4844`](/docs/utilities/txenvelopeeip4844)
* [`TxEnvelopeEip7702`](/docs/utilities/txenvelopeeip7702)
:::

## Functions

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`TxEnvelope.assert`](/docs/utilities/txenvelope/assert) | Asserts a [`TxEnvelope.TxEnvelope`](/docs/utilities/txenvelope/types#txenvelope) is valid. |
| [`TxEnvelope.deserialize`](/docs/utilities/txenvelope/deserialize) | Deserializes a [`TxEnvelope.TxEnvelope`](/docs/utilities/txenvelope/types#txenvelope) from its serialized form. |
| [`TxEnvelope.from`](/docs/utilities/txenvelope/from) | Converts an arbitrary transaction object or serialized transaction into a Transaction Envelope. |
| [`TxEnvelope.getSerializedType`](/docs/utilities/txenvelope/getSerializedType) | Returns the type of a serialized Transaction Envelope. |
| [`TxEnvelope.getSignPayload`](/docs/utilities/txenvelope/getSignPayload) | Returns the payload to sign for a [`TxEnvelope.TxEnvelope`](/docs/utilities/txenvelope/types#txenvelope). |
| [`TxEnvelope.getType`](/docs/utilities/txenvelope/getType) | Returns the type of a Transaction Envelope. |
| [`TxEnvelope.hash`](/docs/utilities/txenvelope/hash) | Hashes a [`TxEnvelope.TxEnvelope`](/docs/utilities/txenvelope/types#txenvelope). This is the "transaction hash". |
| [`TxEnvelope.serialize`](/docs/utilities/txenvelope/serialize) | Serializes a [`TxEnvelope.TxEnvelope`](/docs/utilities/txenvelope/types#txenvelope). |
| [`TxEnvelope.toRpc`](/docs/utilities/txenvelope/toRpc) | Converts a [`TxEnvelope.TxEnvelope`](/docs/utilities/txenvelope/types#txenvelope) to an [`TxEnvelope.Rpc`](/docs/utilities/txenvelope/types#rpc). |
| [`TxEnvelope.toTransactionRequest`](/docs/utilities/txenvelope/toTransactionRequest) | Converts a [`TxEnvelope.TxEnvelope`](/docs/utilities/txenvelope/types#txenvelope) to a [`TransactionRequest.TransactionRequest`](/docs/utilities/transactionrequest/types#transactionrequest). |
| [`TxEnvelope.validate`](/docs/utilities/txenvelope/validate) | Validates a [`TxEnvelope.TxEnvelope`](/docs/utilities/txenvelope/types#txenvelope). Returns `true` if the envelope is valid, `false` otherwise. |

## Errors

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`TxEnvelope.FeeCapTooHighError`](/docs/utilities/txenvelope/errors#txenvelopefeecaptoohigherror) | Thrown when a fee cap is too high. |
| [`TxEnvelope.GasPriceTooHighError`](/docs/utilities/txenvelope/errors#txenvelopegaspricetoohigherror) | Thrown when a gas price is too high. |
| [`TxEnvelope.InvalidChainIdError`](/docs/utilities/txenvelope/errors#txenvelopeinvalidchainiderror) | Thrown when a chain ID is invalid. |
| [`TxEnvelope.InvalidSerializedError`](/docs/utilities/txenvelope/errors#txenvelopeinvalidserializederror) | Thrown when a serialized transaction is invalid. |
| [`TxEnvelope.InvalidSerializedTypeError`](/docs/utilities/txenvelope/errors#txenvelopeinvalidserializedtypeerror) | Thrown when a serialized transaction type cannot be resolved. |
| [`TxEnvelope.InvalidTypeError`](/docs/utilities/txenvelope/errors#txenvelopeinvalidtypeerror) | Thrown when a transaction envelope type cannot be resolved. |
| [`TxEnvelope.TipAboveFeeCapError`](/docs/utilities/txenvelope/errors#txenvelopetipabovefeecaperror) | Thrown when a tip is higher than a fee cap. |

## Types

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`TxEnvelope.Base`](/docs/utilities/txenvelope/types#txenvelopebase) | Base type for a Transaction Envelope. Transaction Envelopes inherit this type. |
| [`TxEnvelope.BaseRpc`](/docs/utilities/txenvelope/types#txenvelopebaserpc) | RPC representation of a [`TxEnvelope.Base`](/docs/utilities/txenvelope/types#base). |
| [`TxEnvelope.BaseSigned`](/docs/utilities/txenvelope/types#txenvelopebasesigned) | Signed representation of a [`TxEnvelope.Base`](/docs/utilities/txenvelope/types#base). |
| [`TxEnvelope.Rpc`](/docs/utilities/txenvelope/types#txenveloperpc) | RPC representation of a [`TxEnvelope.TxEnvelope`](/docs/utilities/txenvelope/types#txenvelope). |
| [`TxEnvelope.Serialized`](/docs/utilities/txenvelope/types#txenvelopeserialized) | Serialized Transaction Envelope. |
| [`TxEnvelope.TxEnvelope`](/docs/utilities/txenvelope/types#txenvelopetxenvelope) | Transaction Envelope. |
| [`TxEnvelope.Type`](/docs/utilities/txenvelope/types#txenvelopetype) | Transaction Envelope type. |

## Viem Helpers

Functions added by Viem on top of the `TxEnvelope` module.

| Name | Description |
| ---- | ----------- |
| [`TxEnvelope.recoverAddress`](/docs/utilities/txenvelope/recoverAddress) | Recovers the signing address of a transaction envelope, either serialized or as an envelope object. |
