# TxEnvelopeEip2930.toRpc

Converts an [`TxEnvelopeEip2930.TxEnvelopeEip2930`](/api/TxEnvelopeEip2930/types#txenvelopeeip2930) to an [`TxEnvelopeEip2930.Rpc`](/api/TxEnvelopeEip2930/types#rpc).

## Imports

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

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

## Examples

```ts twoslash
import { RpcRequest, TxEnvelopeEip2930, Value } from 'ox'

const envelope = TxEnvelopeEip2930.from({
  chainId: 1,
  nonce: 0n,
  gas: 21000n,
  maxFeePerGas: Value.fromGwei('20'),
  to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
  value: Value.fromEther('1')
})

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

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

## Definition

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

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

## Parameters

### envelope

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

The EIP-2930 transaction envelope to convert.

#### envelope.accessList

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

EIP-2930 Access 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`](/api/TransactionRequest/types#transactionrequest) and
[`Transaction.Transaction`](/api/Transaction/types#transaction).

#### envelope.gas

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

Gas provided for transaction execution

#### envelope.gasPrice

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

Base fee per gas.

#### envelope.input

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

#### 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-2930 transaction envelope.

`Rpc`
