@@ -106,6 +106,28 @@ await viem.assertions.revertWithCustomErrorWithArgs(
106
106
);
107
107
```
108
108
109
+ This assertion can take predicate functions to match some of the arguments:
110
+
111
+ ``` ts
112
+ await viem .assertions .revertWithCustomErrorWithArgs (
113
+ contract .read .revertWithCustomErrorWithUintAndString ([1n , " test" ]),
114
+ contract ,
115
+ " CustomErrorWithUintAndString" ,
116
+ [(arg : bigint ) => arg === 1n , " test" ],
117
+ );
118
+ ```
119
+
120
+ ``` ts
121
+ import { anyValue } from " @nomicfoundation/hardhat-toolbox-viem/predicates" ;
122
+
123
+ await viem .assertions .revertWithCustomErrorWithArgs (
124
+ contract .read .revertWithCustomErrorWithUintAndString ([1n , " test" ]),
125
+ contract ,
126
+ " CustomErrorWithUintAndString" ,
127
+ [1n , anyValue ],
128
+ );
129
+ ```
130
+
109
131
### Events
110
132
111
133
#### ` .emit `
@@ -133,6 +155,28 @@ await viem.assertions.emitWithArgs(
133
155
);
134
156
```
135
157
158
+ This assertion can take predicate functions to match some of the arguments:
159
+
160
+ ``` ts
161
+ await viem .assertions .emitWithArgs (
162
+ contract .write .emitTwoUints ([1n , 2n ]),
163
+ contract ,
164
+ " WithTwoUintArgs" ,
165
+ [1n , (arg : bigint ) => arg >= 2 ],
166
+ );
167
+ ```
168
+
169
+ ``` ts
170
+ import { anyValue } from " @nomicfoundation/hardhat-toolbox-viem/predicates" ;
171
+
172
+ await viem .assertions .emitWithArgs (
173
+ contract .write .emitTwoUints ([1n , 2n ]),
174
+ contract ,
175
+ " WithTwoUintArgs" ,
176
+ [anyValue , 2n ],
177
+ );
178
+ ```
179
+
136
180
### Balance change
137
181
138
182
These assertions can be used to check how a given transaction affects the ether balance of a specific address.
0 commit comments