11import { jsonRpcErrors , procs , createEnv , getByteCode } from './geth-diff-setup.ts'
22import { afterAll , afterEach , beforeAll , describe , expect , test } from 'bun:test'
33import { encodeFunctionData , Hex , parseEther } from 'viem'
4- import { ErrorTesterAbi } from '../abi/ErrorTester '
4+ import { ErrorsAbi } from '../abi/Errors '
55import { FlipperCallerAbi } from '../abi/FlipperCaller'
66import { FlipperAbi } from '../abi/Flipper'
77
@@ -17,19 +17,19 @@ const envs = await Promise.all([createEnv('geth'), createEnv('kitchensink')])
1717
1818for ( const env of envs ) {
1919 describe ( env . serverWallet . chain . name , ( ) => {
20- let errorTesterAddr : Hex = '0x'
20+ let errorsAddr : Hex = '0x'
2121 let flipperAddr : Hex = '0x'
2222 let flipperCallerAddr : Hex = '0x'
2323 beforeAll ( async ( ) => {
2424 {
2525 const hash = await env . serverWallet . deployContract ( {
26- abi : ErrorTesterAbi ,
27- bytecode : getByteCode ( 'errorTester ' , env . evm ) ,
26+ abi : ErrorsAbi ,
27+ bytecode : getByteCode ( 'errors ' , env . evm ) ,
2828 } )
2929 const deployReceipt = await env . serverWallet . waitForTransactionReceipt ( { hash } )
3030 if ( ! deployReceipt . contractAddress )
3131 throw new Error ( 'Contract address should be set' )
32- errorTesterAddr = deployReceipt . contractAddress
32+ errorsAddr = deployReceipt . contractAddress
3333 }
3434
3535 {
@@ -60,8 +60,8 @@ for (const env of envs) {
6060 expect . assertions ( 3 )
6161 try {
6262 await env . accountWallet . readContract ( {
63- address : errorTesterAddr ,
64- abi : ErrorTesterAbi ,
63+ address : errorsAddr ,
64+ abi : ErrorsAbi ,
6565 functionName : 'triggerAssertError' ,
6666 } )
6767 } catch ( err ) {
@@ -78,8 +78,8 @@ for (const env of envs) {
7878 expect . assertions ( 3 )
7979 try {
8080 await env . accountWallet . readContract ( {
81- address : errorTesterAddr ,
82- abi : ErrorTesterAbi ,
81+ address : errorsAddr ,
82+ abi : ErrorsAbi ,
8383 functionName : 'triggerRevertError' ,
8484 } )
8585 } catch ( err ) {
@@ -96,8 +96,8 @@ for (const env of envs) {
9696 expect . assertions ( 3 )
9797 try {
9898 await env . accountWallet . readContract ( {
99- address : errorTesterAddr ,
100- abi : ErrorTesterAbi ,
99+ address : errorsAddr ,
100+ abi : ErrorsAbi ,
101101 functionName : 'triggerDivisionByZero' ,
102102 } )
103103 } catch ( err ) {
@@ -116,8 +116,8 @@ for (const env of envs) {
116116 expect . assertions ( 3 )
117117 try {
118118 await env . accountWallet . readContract ( {
119- address : errorTesterAddr ,
120- abi : ErrorTesterAbi ,
119+ address : errorsAddr ,
120+ abi : ErrorsAbi ,
121121 functionName : 'triggerOutOfBoundsError' ,
122122 } )
123123 } catch ( err ) {
@@ -136,8 +136,8 @@ for (const env of envs) {
136136 expect . assertions ( 3 )
137137 try {
138138 await env . accountWallet . readContract ( {
139- address : errorTesterAddr ,
140- abi : ErrorTesterAbi ,
139+ address : errorsAddr ,
140+ abi : ErrorsAbi ,
141141 functionName : 'triggerCustomError' ,
142142 } )
143143 } catch ( err ) {
@@ -154,8 +154,8 @@ for (const env of envs) {
154154 expect . assertions ( 3 )
155155 try {
156156 await env . accountWallet . simulateContract ( {
157- address : errorTesterAddr ,
158- abi : ErrorTesterAbi ,
157+ address : errorsAddr ,
158+ abi : ErrorsAbi ,
159159 functionName : 'valueMatch' ,
160160 value : parseEther ( '10' ) ,
161161 args : [ parseEther ( '10' ) ] ,
@@ -187,8 +187,8 @@ for (const env of envs) {
187187 expect . assertions ( 3 )
188188 try {
189189 await env . accountWallet . estimateContractGas ( {
190- address : errorTesterAddr ,
191- abi : ErrorTesterAbi ,
190+ address : errorsAddr ,
191+ abi : ErrorsAbi ,
192192 functionName : 'valueMatch' ,
193193 value : parseEther ( '10' ) ,
194194 args : [ parseEther ( '10' ) ] ,
@@ -205,8 +205,8 @@ for (const env of envs) {
205205 expect . assertions ( 3 )
206206 try {
207207 await env . accountWallet . estimateContractGas ( {
208- address : errorTesterAddr ,
209- abi : ErrorTesterAbi ,
208+ address : errorsAddr ,
209+ abi : ErrorsAbi ,
210210 functionName : 'valueMatch' ,
211211 value : parseEther ( '10' ) ,
212212 args : [ parseEther ( '10' ) ] ,
@@ -223,8 +223,8 @@ for (const env of envs) {
223223 expect . assertions ( 3 )
224224 try {
225225 await env . serverWallet . estimateContractGas ( {
226- address : errorTesterAddr ,
227- abi : ErrorTesterAbi ,
226+ address : errorsAddr ,
227+ abi : ErrorsAbi ,
228228 functionName : 'valueMatch' ,
229229 value : parseEther ( '11' ) ,
230230 args : [ parseEther ( '10' ) ] ,
@@ -255,8 +255,8 @@ for (const env of envs) {
255255 expect ( balance ) . toBe ( 0n )
256256
257257 await env . accountWallet . estimateContractGas ( {
258- address : errorTesterAddr ,
259- abi : ErrorTesterAbi ,
258+ address : errorsAddr ,
259+ abi : ErrorsAbi ,
260260 functionName : 'setState' ,
261261 args : [ true ] ,
262262 } )
@@ -273,7 +273,7 @@ for (const env of envs) {
273273 expect ( balance ) . toBe ( 0n )
274274
275275 const data = encodeFunctionData ( {
276- abi : ErrorTesterAbi ,
276+ abi : ErrorsAbi ,
277277 functionName : 'setState' ,
278278 args : [ true ] ,
279279 } )
@@ -284,7 +284,7 @@ for (const env of envs) {
284284 {
285285 data,
286286 from : env . accountWallet . account . address ,
287- to : errorTesterAddr ,
287+ to : errorsAddr ,
288288 } ,
289289 ] ,
290290 } )
0 commit comments