# TransactionEnvelope.toRpc

Converts a [`TransactionEnvelope.TxEnvelope`](/api/TransactionEnvelope/types#txenvelope) to an [`TransactionEnvelope.Rpc`](/api/TransactionEnvelope/types#rpc).

## Imports

:::code-group
```ts [Named]
import { TransactionEnvelope } from 'ox'
```

```ts [Entrypoint]
import * as TransactionEnvelope from 'ox/TransactionEnvelope'
```
:::

## Examples

```ts twoslash
import { TransactionEnvelope } from 'ox'

const envelope_rpc = TransactionEnvelope.toRpc({
  chainId: 1,
  maxFeePerGas: 1n,
  type: 'eip1559'
})
```

## Definition

```ts
function toRpc<envelope>(
  envelope: envelope | toRpc.Input,
): toRpc.ReturnType<envelope>
```

**Source:** [src/core/TxEnvelope.ts](https://github.com/wevm/ox/blob/main/src/core/TxEnvelope.ts#L952)

## Parameters

### envelope

* **Type:** `envelope | toRpc.Input`

The transaction envelope.

## Return Type

RPC representation.

`toRpc.ReturnType<envelope>`
