Skip to content

Commit 6b4b87b

Browse files
committed
fixup! feat(cli): simplified send and deposit commands
1 parent a3f5541 commit 6b4b87b

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

apps/cli/src/wallet.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import input from "@inquirer/input";
12
import {
23
createTestClient,
34
defineChain,
@@ -7,6 +8,7 @@ import {
78
} from "viem";
89
import { cannon } from "viem/chains";
910
import { getProjectName } from "./base.js";
11+
import { PREFERRED_PORT } from "./config.js";
1012
import { getProjectPort } from "./exec/rollups.js";
1113

1214
export const cartesi = defineChain({
@@ -22,10 +24,17 @@ const getRpcUrl = async (options: {
2224
// if rpcUrl is provided, use it
2325
if (options.rpcUrl) return options.rpcUrl;
2426

25-
// otherwise, resolve host:port of the docker project
26-
const projectName = getProjectName(options);
27-
const host = await getProjectPort({ projectName });
28-
return `http://${host}/anvil`;
27+
// otherwise, try to resolve host:port of the docker project
28+
try {
29+
const projectName = getProjectName(options);
30+
const host = await getProjectPort({ projectName });
31+
return `http://${host}/anvil`;
32+
} catch (e) {
33+
return await input({
34+
message: "RPC URL",
35+
default: `http://127.0.0.1:${PREFERRED_PORT}/anvil`,
36+
});
37+
}
2938
};
3039

3140
export const connect = async (options: {

0 commit comments

Comments
 (0)