@@ -9,10 +9,10 @@ use std::sync::Arc;
99use anyhow:: { Context , Result } ;
1010use clap:: Args ;
1111use inquire:: { Confirm , CustomType } ;
12- use katana_chain_spec:: { SettlementLayer , DEV_UNALLOCATED } ;
12+ use katana_chain_spec:: { DEV_UNALLOCATED , SettlementLayer } ;
1313use katana_primitives:: chain:: ChainId ;
14- use katana_primitives:: genesis:: allocation:: DevAllocationsGenerator ;
1514use katana_primitives:: genesis:: Genesis ;
15+ use katana_primitives:: genesis:: allocation:: DevAllocationsGenerator ;
1616use katana_primitives:: { ContractAddress , Felt } ;
1717use lazy_static:: lazy_static;
1818use starknet:: accounts:: { ExecutionEncoding , SingleOwnerAccount } ;
@@ -23,27 +23,6 @@ use starknet::providers::{JsonRpcClient, Provider, Url};
2323use starknet:: signers:: { LocalWallet , SigningKey } ;
2424use tokio:: runtime:: Runtime ;
2525
26- #[ derive( Debug ) ]
27- struct InitInput {
28- /// the account address that is used to send the transactions for contract
29- /// deployment/initialization.
30- account : ContractAddress ,
31-
32- // the id of the new chain to be initialized.
33- id : String ,
34-
35- // the chain id of the settlement layer.
36- settlement_id : String ,
37-
38- // the rpc url for the settlement layer.
39- rpc_url : Url ,
40-
41- settlement_contract : ContractAddress ,
42-
43- // path at which the config file will be written at.
44- output_path : PathBuf ,
45- }
46-
4726#[ derive( Debug , Args ) ]
4827pub struct InitArgs {
4928 /// The path to where the config file will be written at.
@@ -74,7 +53,7 @@ impl InitArgs {
7453 chain_spec. store ( input. output_path )
7554 }
7655
77- fn prompt ( & self , rt : & Runtime ) -> Result < InitInput > {
56+ fn prompt ( & self , rt : & Runtime ) -> Result < PromptOutcome > {
7857 let chain_id = CustomType :: < String > :: new ( "Id" )
7958 . with_help_message ( "This will be the id of your rollup chain." )
8059 // checks that the input is a valid ascii string.
@@ -158,7 +137,7 @@ impl InitArgs {
158137 . 0
159138 } ;
160139
161- Ok ( InitInput {
140+ Ok ( PromptOutcome {
162141 account : account_address,
163142 settlement_contract,
164143 settlement_id : parse_cairo_short_string ( & l1_chain_id) ?,
@@ -169,6 +148,27 @@ impl InitArgs {
169148 }
170149}
171150
151+ #[ derive( Debug ) ]
152+ struct PromptOutcome {
153+ /// the account address that is used to send the transactions for contract
154+ /// deployment/initialization.
155+ account : ContractAddress ,
156+
157+ // the id of the new chain to be initialized.
158+ id : String ,
159+
160+ // the chain id of the settlement layer.
161+ settlement_id : String ,
162+
163+ // the rpc url for the settlement layer.
164+ rpc_url : Url ,
165+
166+ settlement_contract : ContractAddress ,
167+
168+ // path at which the config file will be written at.
169+ output_path : PathBuf ,
170+ }
171+
172172// > CONFIG_DIR/$chain_id/config.json
173173fn config_path ( id : & str ) -> Result < PathBuf > {
174174 Ok ( config_dir ( id) ?. join ( "config" ) . with_extension ( "json" ) )
0 commit comments