# UserOperationGas.toRpc

Converts a [`UserOperationGas.UserOperationGas`](/ercs/erc4337/UserOperationGas/types#useroperationgas) to a [`UserOperationGas.Rpc`](/ercs/erc4337/UserOperationGas/types#rpc).

## Imports

:::code-group
```ts [Named]
import { UserOperationGas } from 'ox/erc4337'
```

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

## Examples

```ts twoslash
import { UserOperationGas } from 'ox/erc4337'

const userOperationGas = UserOperationGas.toRpc({
  callGasLimit: 300_000n,
  preVerificationGas: 100_000n,
  verificationGasLimit: 100_000n
})
```

## Definition

```ts
function toRpc<entryPointVersion>(
  userOperationGas: toRpc.Input<entryPointVersion>,
): Rpc<entryPointVersion>
```

**Source:** [src/erc4337/UserOperationGas.ts](https://github.com/wevm/ox/blob/main/src/erc4337/UserOperationGas.ts#L136)

## Parameters

### userOperationGas

* **Type:** `toRpc.Input<entryPointVersion>`

The user operation gas to convert.

## Return Type

An RPC-formatted user operation gas.

`Rpc<entryPointVersion>`
