File tree Expand file tree Collapse file tree 4 files changed +11
-2
lines changed Expand file tree Collapse file tree 4 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -377,6 +377,7 @@ pub async fn new_wallet_context_from_cluster(
377377 rpc: fullnode_url. into( ) ,
378378 ws: None ,
379379 basic_auth: None ,
380+ chain_id: None ,
380381 } ] ,
381382 active_address : Some ( address) ,
382383 active_env : Some ( "localnet" . to_string ( ) ) ,
Original file line number Diff line number Diff line change @@ -165,6 +165,10 @@ impl Display for SuiEnv {
165165 writeln ! ( writer) ?;
166166 write ! ( writer, "Basic Auth: {}" , basic_auth) ?;
167167 }
168+ if let Some ( chain_id) = & self . chain_id {
169+ writeln ! ( writer) ?;
170+ write ! ( writer, "Chain ID: {}" , chain_id) ?;
171+ }
168172 write ! ( f, "{}" , writer)
169173 }
170174}
Original file line number Diff line number Diff line change @@ -1821,7 +1821,7 @@ impl SuiClientCommands {
18211821 "Environment config with name [{alias}] already exists."
18221822 ) ) ;
18231823 }
1824- let env = SuiEnv {
1824+ let mut env = SuiEnv {
18251825 alias,
18261826 rpc,
18271827 ws,
@@ -1833,7 +1833,8 @@ impl SuiClientCommands {
18331833 env. create_rpc_client ( None , None ) . await ?;
18341834 context. config . envs . push ( env. clone ( ) ) ;
18351835 context. config . save ( ) ?;
1836- let _ = context. cache_chain_id ( & context. get_client ( ) . await ?) . await ?;
1836+ let chain_id = context. cache_chain_id ( & context. get_client ( ) . await ?) . await ?;
1837+ env. chain_id = Some ( chain_id) ;
18371838 SuiClientCommandResult :: NewEnv ( env)
18381839 }
18391840 SuiClientCommands :: ActiveEnv => SuiClientCommandResult :: ActiveEnv (
Original file line number Diff line number Diff line change @@ -1625,6 +1625,9 @@ async fn prompt_if_no_config(
16251625 }
16261626 . persisted ( wallet_conf_path)
16271627 . save ( ) ?;
1628+
1629+ let context = WalletContext :: new ( wallet_conf_path) ?;
1630+ let _ = context. cache_chain_id ( & context. get_client ( ) . await ?) . await ?;
16281631 }
16291632 }
16301633 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments