# StateChange.visit

Streams a source's changes into a sink.

Wipes arrive before the slot changes of the same account, so a sink applies the wipe then the writes.

## Imports

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

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

## Examples

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

const { pendingState } = ExecutedTx.detach(executed)

StateChange.visit(pendingState, {
  storage(change) {
    console.log(change.address, change.key, change.current)
  }
})
```

## Definition

```ts
function visit(
  source: Source,
  sink: Sink,
): void
```

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

## Parameters

### source

* **Type:** [`Source`](/evm/execution/StateChange/types#statechangesource)

Source of changes.

### sink

* **Type:** [`Sink`](/evm/execution/StateChange/types#statechangesink)

Sink to receive them.

#### sink.account

* **Type:** `(change: AccountChange) => void`
* **Optional**

An account whose value changed.

#### sink.accountRead

* **Type:** `(change: AccountChange) => void`
* **Optional**

An account the transaction loaded but left unchanged.

#### sink.bytecode

* **Type:** `(codeHash: 0x${string}, code: Uint8Array) => void`
* **Optional**

Bytecode, keyed by its hash.

#### sink.storage

* **Type:** `(change: StorageChange) => void`
* **Optional**

A storage slot whose value changed.

#### sink.storageRead

* **Type:** `(change: StorageChange) => void`
* **Optional**

A storage slot the transaction loaded but left unchanged.

#### sink.storageWipe

* **Type:** `(address: abitype_Address) => void`
* **Optional**

An account whose storage was wiped, before its slot changes.

## Return Type

`void`
