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

# TxEnvelopeEip7702.toRpc

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

Converts an [`TxEnvelopeEip7702.TxEnvelopeEip7702`](/docs/utilities/txenvelopeeip7702/types#txenvelopeeip7702) to an [`TxEnvelopeEip7702.Rpc`](/docs/utilities/txenvelopeeip7702/types#rpc).

## Imports

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

## Examples

```ts twoslash
// @noErrors
import { Authorization, RpcRequest, TxEnvelopeEip7702, Value } from 'viem/utils'

const envelope = TxEnvelopeEip7702.from({
  authorizationList: [...],
  chainId: 1,
  nonce: 0n,
  gas: 21000n,
  maxFeePerGas: Value.fromGwei('10'),
  to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
  value: Value.fromEther('1'),
})

const envelope_rpc = TxEnvelopeEip7702.toRpc(envelope) // [!code focus]

const request = RpcRequest.from({
  id: 0,
  method: 'eth_sendTransaction',
  params: [envelope_rpc],
})
```

## Definition

```ts
function toRpc(
  envelope: toRpc.Input,
): Rpc
```

## Parameters

### envelope

* **Type:** `toRpc.Input`

The EIP-7702 transaction envelope to convert.

#### envelope.accessList

* **Type:** `readonly { address: abitype_Address; storageKeys: readonly 0x${string}[]; }[]`
* **Optional**

EIP-2930 Access List.

#### envelope.authorizationList

* **Type:** `readonly { address: abitype_Address; chainId: numberType; nonce: bigintType; r: 0x${string}; s: 0x${string}; yParity: numberType; }[]`

EIP-7702 Authorization List.

#### envelope.chainId

* **Type:** `numberType`

EIP-155 Chain ID.

#### envelope.data

* **Type:** `0x${string}`
* **Optional**

Contract code or a hashed method call with encoded args

#### envelope.from

* **Type:** `Address.Address | undefined`
* **Optional**

Sender of the transaction. RPC-only metadata; not part of the
serialized envelope. Carried here for parity with
[`TransactionRequest.TransactionRequest`](/docs/utilities/transactionrequest/types#transactionrequest) and
[`Transaction.Transaction`](/docs/utilities/transaction/types#transaction).

#### envelope.gas

* **Type:** `bigintType`
* **Optional**

Gas provided for transaction execution

#### envelope.input

* **Type:** `0x${string}`
* **Optional**

#### envelope.maxFeePerGas

* **Type:** `bigintType`
* **Optional**

Total fee per gas in wei (gasPrice/baseFeePerGas + maxPriorityFeePerGas).

#### envelope.maxPriorityFeePerGas

* **Type:** `bigintType`
* **Optional**

Max priority fee per gas (in wei).

#### envelope.nonce

* **Type:** `bigintType`
* **Optional**

Unique number identifying this transaction

#### envelope.r

* **Type:** `0x${string}`

#### envelope.s

* **Type:** `0x${string}`

#### envelope.to

* **Type:** `Address.Address | null | undefined`
* **Optional**

Transaction recipient

#### envelope.type

* **Type:** `type`

Transaction type

#### envelope.v

* **Type:** `numberType`
* **Optional**

#### envelope.value

* **Type:** `bigintType`
* **Optional**

Value in wei sent with this transaction

#### envelope.yParity

* **Type:** `numberType`
* **Optional**

ECDSA signature yParity.

## Return Type

An RPC-formatted EIP-7702 transaction envelope.

`Rpc`
