Skip to content

Commit

Permalink
chore(katana): rename prompt answer struct
Browse files Browse the repository at this point in the history
  • Loading branch information
kariy committed Jan 23, 2025
1 parent b97d864 commit 1af1789
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
46 changes: 23 additions & 23 deletions bin/katana/src/cli/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,6 @@ use tokio::runtime::Runtime;

const CARTRIDGE_SN_SEPOLIA_PROVIDER: &str = "https://api.cartridge.gg/x/starknet/sepolia";

#[derive(Debug)]
struct InitInput {
/// the account address that is used to send the transactions for contract
/// deployment/initialization.
account: ContractAddress,

// the id of the new chain to be initialized.
id: String,

// the chain id of the settlement layer.
settlement_id: String,

// the rpc url for the settlement layer.
rpc_url: Url,

settlement_contract: ContractAddress,

// path at which the config file will be written at.
output_path: PathBuf,
}

#[derive(Debug, Args)]
pub struct InitArgs {
/// The path to where the config file will be written at.
Expand Down Expand Up @@ -76,7 +55,7 @@ impl InitArgs {
chain_spec.store(input.output_path)
}

fn prompt(&self, rt: &Runtime) -> Result<InitInput> {
fn prompt(&self, rt: &Runtime) -> Result<PromptOutcome> {
let chain_id = CustomType::<String>::new("Id")
.with_help_message("This will be the id of your rollup chain.")
// checks that the input is a valid ascii string.
Expand Down Expand Up @@ -185,7 +164,7 @@ impl InitArgs {
.0
};

Ok(InitInput {
Ok(PromptOutcome {
account: account_address,
settlement_contract,
settlement_id: parse_cairo_short_string(&l1_chain_id)?,
Expand All @@ -196,6 +175,27 @@ impl InitArgs {
}
}

#[derive(Debug)]
struct PromptOutcome {
/// the account address that is used to send the transactions for contract
/// deployment/initialization.
account: ContractAddress,

// the id of the new chain to be initialized.
id: String,

// the chain id of the settlement layer.
settlement_id: String,

// the rpc url for the settlement layer.
rpc_url: Url,

settlement_contract: ContractAddress,

// path at which the config file will be written at.
output_path: PathBuf,
}

// > CONFIG_DIR/$chain_id/config.json
fn config_path(id: &str) -> Result<PathBuf> {
Ok(config_dir(id)?.join("config").with_extension("json"))
Expand Down
4 changes: 2 additions & 2 deletions crates/katana/core/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ use katana_primitives::block::{
use katana_primitives::da::L1DataAvailabilityMode;
use katana_primitives::env::BlockEnv;
use katana_primitives::receipt::{Event, ReceiptWithTxHash};
use katana_primitives::state::{StateUpdates, compute_state_diff_hash};
use katana_primitives::state::{compute_state_diff_hash, StateUpdates};
use katana_primitives::transaction::{TxHash, TxWithHash};
use katana_primitives::version::CURRENT_STARKNET_VERSION;
use katana_primitives::{ContractAddress, Felt, address};
use katana_primitives::{address, ContractAddress, Felt};
use katana_provider::traits::block::{BlockHashProvider, BlockWriter};
use katana_provider::traits::trie::TrieWriter;
use katana_trie::compute_merkle_root;
Expand Down

0 comments on commit 1af1789

Please sign in to comment.