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

# AbiEvent.assertArgs

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

Asserts that the provided arguments match the decoded log arguments.

## Imports

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

## Examples

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

const abiEvent = AbiEvent.from(
  'event Transfer(address indexed from, address indexed to, uint256 value)'
)

const args = AbiEvent.decode(abiEvent, {
  data: '0x0000000000000000000000000000000000000000000000000000000000000001',
  topics: [
    '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
    '0x000000000000000000000000a5cc3c03994db5b0d9a5eedd10cabab0813678ac',
    '0x000000000000000000000000a5cc3c03994db5b0d9a5eedd10cabab0813678ac'
  ]
})

AbiEvent.assertArgs(abiEvent, args, {
  from: '0xa5cc3c03994db5b0d9a5eedd10cabab0813678ad',
  to: '0xa5cc3c03994db5b0d9a5eedd10cabab0813678ac',
  value: 1n
})

// @error: AbiEvent.ArgsMismatchError: Given arguments to not match the arguments decoded from the log.
// @error: Event: event Transfer(address indexed from, address indexed to, uint256 value)
// @error: Expected Arguments:
// @error:   from:   0xa5cc3c03994db5b0d9a5eedd10cabab0813678ac
// @error:   to:     0xa5cc3c03994db5b0d9a5eedd10cabab0813678ad
// @error:   value:  1
// @error: Given Arguments:
// @error:   from:   0xa5cc3c03994db5b0d9a5eedd10cabab0813678ad
// @error:   to:     0xa5cc3c03994db5b0d9a5eedd10cabab0813678ac
// @error:   value:  1
```

## Definition

```ts
function assertArgs<abiEvent>(
  abiEvent: abiEvent | AbiEvent,
  args: unknown,
  matchArgs: IsNarrowable<abiEvent, AbiEvent> extends true ? abiEvent['inputs'] extends readonly [] ? never : internal.ParametersToPrimitiveTypes<abiEvent['inputs'], {
    EnableUnion: true;
    IndexedOnly: false;
    Required: false;
}> : unknown,
): void
```

## Parameters

### abiEvent

* **Type:** `abiEvent | AbiEvent`

ABI Event to check.

### args

* **Type:** `unknown`

Decoded arguments.

### matchArgs

* **Type:** `IsNarrowable<abiEvent, AbiEvent> extends true ? abiEvent['inputs'] extends readonly [] ? never : internal.ParametersToPrimitiveTypes<abiEvent['inputs'], {
    EnableUnion: true;
    IndexedOnly: false;
    Required: false;
  }> : unknown`

The arguments to check.

## Return Type

`void`
