# Fee.toHistoryRpc

Converts a [`Fee.FeeHistory`](/api/Fee/types#feehistory) to a [`Fee.FeeHistoryRpc`](/api/Fee/types#feehistoryrpc).

## Imports

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

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

## Examples

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

const rpc = Fee.toHistoryRpc({
  baseFeePerGas: [1n, 2n],
  gasUsedRatio: [0.5, 0.6],
  oldestBlock: 16n,
  reward: [[1n]]
})
```

## Definition

```ts
function toHistoryRpc(
  history: FeeHistory,
): FeeHistoryRpc
```

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

## Parameters

### history

* **Type:** `FeeHistory`

The fee history to convert.

#### history.baseFeePerGas

* **Type:** `bigintType[]`

An array of block base fees per gas (in wei). This includes the next block after
the newest of the returned range, because this value can be derived from the newest block.
Zeroes are returned for pre-EIP-1559 blocks.

#### history.gasUsedRatio

* **Type:** `number[]`

An array of block gas used ratios. These are calculated as the ratio of gasUsed and gasLimit.

#### history.oldestBlock

* **Type:** `bigintType`

Lowest number block of the returned range.

#### history.reward

* **Type:** `bigintType[][]`
* **Optional**

An array of effective priority fees (in wei) per gas data points from a single block. All zeroes are returned if the block is empty.

## Return Type

An RPC fee history.

`FeeHistoryRpc`
