# ExecutedTx.commitWith

Streams the transaction's changes to a sink, then accepts them.

The sink decides: if it throws, the transaction is discarded instead of committed and the throw is what surfaces. That is the engine's own rule, so a sink that fails cannot leave state half-applied.

## Imports

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

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

## Examples

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

const executed = Evm.transact(evm, transaction)

ExecutedTx.commitWith(executed, {
  storage(change) {
    persist(change)
  }
})
```

## Definition

```ts
function commitWith(
  executed: ExecutedTx,
  sink: StateChange.Sink,
): TxResult.TxResult
```

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

## Parameters

### executed

* **Type:** `ExecutedTx`

Executed transaction.

#### executed.'~engine'

* **Type:** `Engine`

#### executed.'~resolved'

* **Type:** `boolean`

#### executed.'~result'

* **Type:** `TxResult`

#### executed.'~token'

* **Type:** `Readonly`

Identifies the transaction this handle was created for. The engine holds it
weakly, discarding the transaction once no handle can reach it.

### sink

* **Type:** `StateChange.Sink`

Sink to receive the changes.

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

The transaction's result.

`TxResult.TxResult`
