File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 1+ import input from "@inquirer/input" ;
12import {
23 createTestClient ,
34 defineChain ,
78} from "viem" ;
89import { cannon } from "viem/chains" ;
910import { getProjectName } from "./base.js" ;
11+ import { PREFERRED_PORT } from "./config.js" ;
1012import { getProjectPort } from "./exec/rollups.js" ;
1113
1214export 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
3140export const connect = async ( options : {
You can’t perform that action at this time.
0 commit comments