File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 "private" : true ,
44 "scripts" : {
55 "start" : " pnpm run start:deploy-contracts" ,
6- "start:deploy-contracts" : " wait-port anvil:8545 && tsx src/index.ts"
6+ "start:deploy-contracts" : " tsx src/helpers/ wait-anvil.ts && tsx src/index.ts"
77 },
88 "dependencies" : {
99 "viem" : " ^2.9.9"
Original file line number Diff line number Diff line change 1+ import waitPort from 'wait-port' ;
2+
3+ const url = new URL ( process . env . ANVIL_RPC || 'http://anvil:8545' ) ;
4+
5+ ( async ( ) => {
6+ const ok = await waitPort ( {
7+ host : url . hostname ,
8+ port : parseInt ( url . port || '80' ) ,
9+ timeout : 10000 , // 10s timeout
10+ output : 'silent' ,
11+ } ) ;
12+
13+ if ( ! ok ) {
14+ console . error ( `❌ Timed out waiting for ${ url . hostname } :${ url . port } ` ) ;
15+ process . exit ( 1 ) ;
16+ }
17+
18+ console . log ( `✅ ${ url . hostname } :${ url . port } is available` ) ;
19+ } ) ( ) ;
Original file line number Diff line number Diff line change 22 "name" : " mock-paymaster" ,
33 "private" : true ,
44 "scripts" : {
5- "start" : " wait-port anvil:8545 && ts-node src/index.ts"
5+ "start" : " tsx src/helpers/ wait-anvil.ts && tsx src/index.ts"
66 },
77 "dependencies" : {
88 "@fastify/cors" : " ^9.0.1" ,
1818 "@biomejs/biome" : " ^1.9.4" ,
1919 "@types/node" : " ^20.12.4" ,
2020 "ts-node" : " ^10.9.2" ,
21+ "tsx" : " ^4.19.3" ,
2122 "wait-port" : " ^1.0.4"
2223 }
2324}
Original file line number Diff line number Diff line change 1+ import waitPort from 'wait-port' ;
2+
3+ const url = new URL ( process . env . ANVIL_RPC || 'http://anvil:8545' ) ;
4+
5+ ( async ( ) => {
6+ const ok = await waitPort ( {
7+ host : url . hostname ,
8+ port : parseInt ( url . port || '80' ) ,
9+ timeout : 10000 , // 10s timeout
10+ output : 'silent' ,
11+ } ) ;
12+
13+ if ( ! ok ) {
14+ console . error ( `❌ Timed out waiting for ${ url . hostname } :${ url . port } ` ) ;
15+ process . exit ( 1 ) ;
16+ }
17+
18+ console . log ( `✅ ${ url . hostname } :${ url . port } is available` ) ;
19+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments