# PendingState.insertAccount

Returns state with an account's values replaced.

The state is not modified; the returned copy is what [`Evm.commitSource`](/evm/execution/Evm/commitSource) applies. Use this to adjust what a transaction left before putting it back.

## Imports

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

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

## Examples

```ts twoslash
// @noErrors
import { Evm, ExecutedTx, PendingState } from 'ox/evm'

const { pendingState } = ExecutedTx.detach(executed)

// Put the balance back to what it was, then apply the rest.
const edited = PendingState.insertAccount(pendingState, {
  address,
  current: { balance: 0n, codeHash, nonce: 1n },
  original: { balance: 0n, codeHash, nonce: 1n },
})
Evm.commitSource(evm, edited)
```

## Definition

```ts
function insertAccount(
  state: PendingState,
  options: insertAccount.Options,
): PendingState
```

**Source:** [src/evm/PendingState.ts](https://github.com/wevm/ox/blob/main/src/evm/PendingState.ts#L149)

## Parameters

### state

* **Type:** `PendingState`

Pending state.

#### state.'~changes'

* **Type:** `Changes`

### options

* **Type:** `insertAccount.Options`

Account, and the values to give it.

#### options.address

* **Type:** `abitype_Address`

Account to insert.

#### options.current

* **Type:** `ChangeAccount`
* **Optional**

Value after the change. Omit for an account that does not exist.

#### options.original

* **Type:** `ChangeAccount`
* **Optional**

Value at the transaction boundary. Omit for one that did not exist.

## Return Type

State carrying the account.

`PendingState`
