Skip to content

Commit 81a5aa7

Browse files
committed
refactor(mock-paymaster): replace wait-port with custom anvil wait script
- Added wait-anvil.ts with configurable URL via ANVIL_RPC env var - Improved error handling with timeout messaging - Updated package.json to use new wait script
1 parent 88394a7 commit 81a5aa7

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

mock-verifying-paymaster/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "mock-paymaster",
33
"private": true,
44
"scripts": {
5-
"start": "wait-port anvil:8545 && tsx src/index.ts"
5+
"start": "tsx src/wait-anvil.ts && tsx src/index.ts"
66
},
77
"dependencies": {
88
"@pimlico/mock-paymaster": "^0.0.6",
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
})();

0 commit comments

Comments
 (0)