> **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.

# TxEnvelopeEip1559.serialize

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

Serializes a [`TxEnvelopeEip1559.TxEnvelopeEip1559`](/docs/utilities/txenvelopeeip1559/types#txenvelopeeip1559).

## Imports

```ts
import { TxEnvelopeEip1559 } from 'viem/utils'
```

## Examples

```ts twoslash
// @noErrors
import { TxEnvelopeEip1559, Value } from 'viem/utils'

const envelope = TxEnvelopeEip1559.from({
  chainId: 1,
  maxFeePerGas: Value.fromGwei('10'),
  maxPriorityFeePerGas: Value.fromGwei('1'),
  to: '0x0000000000000000000000000000000000000000',
  value: Value.fromEther('1')
})

const serialized = TxEnvelopeEip1559.serialize(envelope) // [!code focus]
```

### Attaching Signatures

It is possible to attach a `signature` to the serialized Transaction Envelope.

```ts twoslash
// @noErrors
import { Secp256k1, TxEnvelopeEip1559, Value } from 'viem/utils'

const envelope = TxEnvelopeEip1559.from({
  chainId: 1,
  maxFeePerGas: Value.fromGwei('10'),
  maxPriorityFeePerGas: Value.fromGwei('1'),
  to: '0x0000000000000000000000000000000000000000',
  value: Value.fromEther('1')
})

const signature = Secp256k1.sign({
  payload: TxEnvelopeEip1559.getSignPayload(envelope),
  privateKey: '0x...'
})

const serialized = TxEnvelopeEip1559.serialize(envelope, {
  // [!code focus]
  signature // [!code focus]
}) // [!code focus]

// ... send `serialized` transaction to JSON-RPC `eth_sendRawTransaction`
```

## Definition

```ts
function serialize(
  envelope: PartialBy<TxEnvelopeEip1559, 'type'>,
  options?: serialize.Options,
): Serialized
```

## Parameters

### envelope

* **Type:** `PartialBy<TxEnvelopeEip1559, 'type'>`

The Transaction Envelope to serialize.

### options

* **Type:** `serialize.Options`
* **Optional**

Options.

#### options.signature

* **Type:** `{ r: 0x${string}; s: 0x${string}; yParity: number; }`
* **Optional**

Signature to append to the serialized Transaction Envelope.

## Return Type

The serialized Transaction Envelope.

`Serialized`
