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