Skip to content

Commit 752c5f4

Browse files
committed
fix display of addresses and check priority of accounts
1 parent 66b5b67 commit 752c5f4

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

bin/sozo/src/commands/declare.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ impl DeclareArgs {
6969
let class = prepare_class(&path, use_blake2s)
7070
.with_context(|| format!("Failed to prepare Sierra artifact {}", path.display()))?;
7171

72-
ui.step(format!("Compiled '{}'", class.label));
72+
ui.step(format!("Compiled '{}' (class hash {:#066x})", class.label, class.class_hash));
7373
let detail_ui = ui.subsection();
74-
detail_ui.verbose(format!("Class hash : {:#066x}", class.class_hash));
7574
detail_ui.verbose(format!("CASM hash : {:#066x}", class.casm_class_hash));
7675
detail_ui.verbose(format!("Artifact : {}", path.display()));
7776

@@ -145,8 +144,11 @@ fn prepare_class(path: &Path, use_blake2s: bool) -> Result<PreparedClass> {
145144
let casm_hash = casm_class_hash_from_bytes(&data, use_blake2s)?;
146145

147146
let label = path
148-
.file_stem()
149-
.and_then(|stem| stem.to_str())
147+
.file_name()
148+
.and_then(|name| name.to_str())
149+
.ok_or_else(|| anyhow!("Unable to infer contract name from {}", path.display()))?
150+
.split('.')
151+
.next()
150152
.ok_or_else(|| anyhow!("Unable to infer contract name from {}", path.display()))?
151153
.to_string();
152154

bin/sozo/src/commands/deploy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl DeployArgs {
7272

7373
let account = get_account_from_env(account, &starknet).await?;
7474

75-
ui.title("Deploy contract");
75+
ui.title(format!("Deploy contract (class hash {:#066x})", class_hash));
7676
ui.step("Deploying contract via UDC");
7777
let params_ui = ui.subsection();
7878
params_ui.verbose(format!("Class hash : {:#066x}", class_hash));
@@ -122,7 +122,7 @@ impl DeployArgs {
122122
let deployed =
123123
if actual_address == Felt::ZERO { expected_address } else { actual_address };
124124
ui.result(format!(
125-
"Deployment included on-chain.\n Tx hash : {hash:#066x}\n Address : \
125+
"Contract deployed onchain.\n Tx hash : {hash:#066x}\n Address : \
126126
{deployed:#066x}"
127127
));
128128
if deployed != expected_address {

0 commit comments

Comments
 (0)