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

# Fee.toHistoryRpc

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

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

## Imports

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

## Examples

```ts twoslash
// @noErrors
import { Fee } from 'viem/utils'

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

## Definition

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

## 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`
