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 18, 2025
1 parent 141914f commit 3c2465c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
50 changes: 25 additions & 25 deletions bin/katana/src/cli/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ use std::sync::Arc;
use anyhow::{Context, Result};
use clap::Args;
use inquire::{Confirm, CustomType};
use katana_chain_spec::{SettlementLayer, DEV_UNALLOCATED};
use katana_chain_spec::{DEV_UNALLOCATED, SettlementLayer};
use katana_primitives::chain::ChainId;
use katana_primitives::genesis::allocation::DevAllocationsGenerator;
use katana_primitives::genesis::Genesis;
use katana_primitives::genesis::allocation::DevAllocationsGenerator;
use katana_primitives::{ContractAddress, Felt};
use lazy_static::lazy_static;
use starknet::accounts::{ExecutionEncoding, SingleOwnerAccount};
Expand All @@ -23,27 +23,6 @@ use starknet::providers::{JsonRpcClient, Provider, Url};
use starknet::signers::{LocalWallet, SigningKey};
use tokio::runtime::Runtime;

#[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 @@ -74,7 +53,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 @@ -158,7 +137,7 @@ impl InitArgs {
.0
};

Ok(InitInput {
Ok(PromptOutcome {
account: account_address,
settlement_contract,
settlement_id: parse_cairo_short_string(&l1_chain_id)?,
Expand All @@ -169,6 +148,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 3c2465c

Please sign in to comment.