Skip to content

Commit

Permalink
feat: custom OZ account class hash
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI committed Aug 13, 2024
1 parent e2210b1 commit 0e9b706
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/subcommands/account/oz/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ pub struct Init {
help = "Overwrite the account config file if it already exists"
)]
force: bool,
#[clap(long, short, help = "Custom account class hash")]
class_hash: Option<Felt>,
#[clap(
value_parser = ExpandedPathbufParser,
help = "Path to save the account config file"
Expand All @@ -43,6 +45,21 @@ impl Init {
anyhow::bail!("account config file already exists");
}

let class_hash = match self.class_hash {
Some(custom_hash) => {
eprintln!(
"{}",
"WARNING: you're using a custom account class hash. \
The deployed account may not work as expected. \
Fetching custom accounts is currently not supported."
.bright_magenta()
);

custom_hash
}
None => OZ_ACCOUNT_CLASS_HASH,
};

let signer = self.signer.into_signer().await?;

// Too lazy to write random salt generation
Expand All @@ -56,7 +73,7 @@ impl Init {
legacy: false,
}),
deployment: DeploymentStatus::Undeployed(UndeployedStatus {
class_hash: OZ_ACCOUNT_CLASS_HASH,
class_hash,
salt,
context: None,
}),
Expand Down

0 comments on commit 0e9b706

Please sign in to comment.