# TransactionRequest.toRpc

Converts a [`TransactionRequest.TransactionRequest`](/api/TransactionRequest/types#transactionrequest) to a [`TransactionRequest.Rpc`](/api/TransactionRequest/types#rpc).

## Imports

:::code-group

```ts [Named]
import { TransactionRequest } from 'ox'
```

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

:::

## Examples

```ts twoslash
import { TransactionRequest, Value } from 'ox'

const request = TransactionRequest.toRpc({
  to: '0x0000000000000000000000000000000000000000',
  value: Value.fromEther('0.01')
})
```

### Using with a Provider

You can use [`Provider.from`](/api/Provider/from) to instantiate an EIP-1193 Provider and send a transaction to the Wallet using the `eth_sendTransaction` method.

```ts twoslash
import 'ox/window'
import { Provider, TransactionRequest, Value } from 'ox'

const provider = Provider.from(window.ethereum!)

const request = TransactionRequest.toRpc({
  to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
  value: Value.fromEther('0.01')
})

const hash = await provider.request({
  // [!code focus]
  method: 'eth_sendTransaction', // [!code focus]
  params: [request] // [!code focus]
}) // [!code focus]
```

## Definition

```ts
function toRpc(
  request: TransactionRequest,
): Rpc
```

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

## Parameters

### request

* **Type:** `TransactionRequest`

The request to convert.

#### request.accessList

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

EIP-2930 Access List.

#### request.authorizationList

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

EIP-7702 Authorization List.

#### request.blobVersionedHashes

* **Type:** `readonly 0x${string}[]`
* **Optional**

Versioned hashes of blobs to be included in the transaction.

#### request.blobs

* **Type:** `readonly 0x${string}[]`
* **Optional**

Raw blob data.

#### request.chainId

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

EIP-155 Chain ID.

#### request.data

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

Contract code or a hashed method call with encoded args

#### request.from

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

Sender of the transaction.

#### request.gas

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

Gas provided for transaction execution

#### request.gasPrice

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

Base fee per gas.

#### request.input

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

#### request.maxFeePerBlobGas

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

Maximum total fee per gas sender is willing to pay for blob gas (in wei).

#### request.maxFeePerGas

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

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

#### request.maxPriorityFeePerGas

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

Max priority fee per gas (in wei).

#### request.nonce

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

Unique number identifying this transaction

#### request.r

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

ECDSA signature r.

#### request.s

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

ECDSA signature s.

#### request.to

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

Transaction recipient

#### request.type

* **Type:** `type`
* **Optional**

Transaction type

#### request.v

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

#### request.value

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

Value in wei sent with this transaction

#### request.yParity

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

ECDSA signature yParity.

## Return Type

An RPC request.

`Rpc`
