Skip to content

emitWithArgs: support pre-resolved transaction hash in addition to a write promise #8109

@gonzaotc

Description

@gonzaotc

Currently emitWithArgs only accepts a Promise (the raw write call).

Requested behavior: accept either a Promise<0x${string}> or a resolved `0x${string}` hash directly, so a single transaction can be checked multiple times:

const tx = await contract.write.foo([...]);

await viem.assertions.emitWithArgs(tx, contract, 'Event1', [...]);
await viem.assertions.emitWithArgs(tx, contract, 'Event2', [...]);

The signature change could look like:

emitWithArgs(tx: Promise<`0x${string}`> | `0x${string}`, ...): Promise<void>

Metadata

Metadata

Assignees

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions