@@ -24,17 +24,15 @@ const waitFor = async (name: string, url: string) => {
2424 } ) ;
2525
2626 do {
27- if ( ! isAvailable ) {
27+ if ( isAvailable === undefined ) {
2828 // Only add a delay if it's not the first time
2929 await new Promise ( ( resolve ) => setTimeout ( resolve , POLL_INTERVAL_MS ) ) ;
3030 }
3131
3232 await client
3333 . request ( { method : 'web3_clientVersion' } )
3434 . then ( ( ) => ( isAvailable = true ) )
35- . catch ( ( e : any ) => {
36- isAvailable = ( e as Error ) . name !== 'HttpRequestError' ;
37- } ) ;
35+ . catch ( ( ) => ( isAvailable = false ) ) ;
3836 } while ( ! isAvailable ) ;
3937
4038 console . log ( `${ name } is available` ) ;
@@ -61,13 +59,15 @@ const deployEnvironment = async () => {
6159} ;
6260
6361( async ( ) => {
62+ console . log ( 'Waiting for blockchain node' ) ;
6463 await waitFor ( 'Blockchain node' , nodeUrl ) ;
64+ const bundlerAndPaymasterReady = Promise . all ( [
65+ waitFor ( 'Bundler' , bundlerUrl ) ,
66+ waitFor ( 'Mock paymaster' , paymasterUrl ) ,
67+ ] ) ;
6568
6669 const environment = await deployEnvironment ( ) ;
6770 await writeFile ( './.gator-env.json' , JSON . stringify ( environment , null , 2 ) ) ;
6871
69- await Promise . all ( [
70- waitFor ( 'Bundler' , bundlerUrl ) ,
71- waitFor ( 'Mock paymaster' , paymasterUrl ) ,
72- ] ) ;
72+ await bundlerAndPaymasterReady ;
7373} ) ( ) ;
0 commit comments