Skip to content

Commit e927201

Browse files
committed
Add connection inspection code in the scenario script
1 parent e6db3a1 commit e927201

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

ibc.ts/src/scenario/index.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,28 @@ async function main() {
7373
console.log("Create a connection");
7474
await createConnection({ chainA, chainB });
7575
}
76+
77+
while (true) {
78+
const connectionCheckPrompt = new Select({
79+
name: "connection check",
80+
message: "Will you check connection?",
81+
choices: ["yes", "skip", "exit"]
82+
});
83+
const connectionCheckAnswer = await connectionCheckPrompt.run();
84+
85+
if (connectionCheckAnswer === "exit") {
86+
return;
87+
}
88+
89+
if (connectionCheckAnswer === "yes") {
90+
console.log("Check a connection");
91+
await checkConnections({ chainA, chainB });
92+
}
93+
94+
if (connectionCheckAnswer === "skip") {
95+
break;
96+
}
97+
}
7698
}
7799

78100
main().catch(console.error);
@@ -139,3 +161,17 @@ async function createConnection({
139161
})
140162
);
141163
}
164+
165+
async function checkConnections({
166+
chainA,
167+
chainB
168+
}: {
169+
chainA: Chain;
170+
chainB: Chain;
171+
}) {
172+
const connectionA = await chainA.queryConnection();
173+
console.log(`Connection in A ${JSON.stringify(connectionA)}`);
174+
175+
const connectionB = await chainB.queryConnection();
176+
console.log(`Connection in B ${JSON.stringify(connectionB)}`);
177+
}

0 commit comments

Comments
 (0)