Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
#### Removed

- The deprecated `sncast completion`. Use `sncast completions` instead.
- The deprecated `argent` option for `--type` flag in `account create` and `account import` commands. Use `ready` instead

## [0.54.0] - 2025-12-09

Expand Down
4 changes: 1 addition & 3 deletions crates/sncast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ pub type NestedMap<T> = HashMap<String, HashMap<String, T>>;
pub enum AccountType {
#[serde(rename = "open_zeppelin")]
OpenZeppelin,
Argent,
Ready,
Braavos,
}
Expand All @@ -69,7 +68,6 @@ impl FromStr for AccountType {
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"open_zeppelin" | "open-zeppelin" | "oz" => Ok(AccountType::OpenZeppelin),
"argent" => Ok(AccountType::Argent),
"ready" => Ok(AccountType::Ready),
"braavos" => Ok(AccountType::Braavos),
account_type => Err(anyhow!("Invalid account type = {account_type}")),
Expand Down Expand Up @@ -437,7 +435,7 @@ pub fn get_account_data_from_keystore(
.and_then(|account_type| account_type.parse().ok());

let public_key = match account_type.context("Failed to get type key")? {
AccountType::Argent | AccountType::Ready => parse_to_felt("/variant/owner"),
AccountType::Ready => parse_to_felt("/variant/owner"),
AccountType::OpenZeppelin => parse_to_felt("/variant/public_key"),
AccountType::Braavos => get_braavos_account_public_key(&account_info)?,
}
Expand Down
20 changes: 4 additions & 16 deletions crates/sncast/src/starknet_commands/account/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use camino::Utf8PathBuf;
use clap::Args;
use console::style;
use conversions::IntoConv;
use foundry_ui::components::warning::WarningMessage;
use serde_json::json;
use sncast::helpers::braavos::BraavosAccountFactory;
use sncast::helpers::constants::{
Expand All @@ -16,7 +15,6 @@ use sncast::helpers::constants::{
};
use sncast::helpers::rpc::{RpcArgs, generate_network_flag};
use sncast::response::account::create::AccountCreateResponse;
use sncast::response::ui::UI;
use sncast::{
AccountType, Network, check_class_hash_exists, check_if_legacy_contract,
extract_or_generate_salt, get_chain_id, get_keystore_password, handle_account_factory_error,
Expand Down Expand Up @@ -65,20 +63,11 @@ pub async fn create(
provider: &JsonRpcClient<HttpTransport>,
chain_id: Felt,
create: &Create,
ui: &UI,
) -> Result<AccountCreateResponse> {
// TODO(#3556): Remove this warning once we drop Argent account type
if create.account_type == AccountType::Argent {
ui.print_warning(WarningMessage::new(
"Argent has rebranded as Ready. The `argent` option for the `--type` flag in `account create` is deprecated, please use `ready` instead.",
));
ui.print_blank_line();
}

let salt = extract_or_generate_salt(create.salt);
let class_hash = create.class_hash.unwrap_or(match create.account_type {
AccountType::OpenZeppelin => OZ_CLASS_HASH,
AccountType::Argent | AccountType::Ready => READY_CLASS_HASH,
AccountType::Ready => READY_CLASS_HASH,
AccountType::Braavos => BRAAVOS_CLASS_HASH,
});
check_class_hash_exists(provider, class_hash).await?;
Expand Down Expand Up @@ -176,7 +165,7 @@ async fn generate_account(
OpenZeppelinAccountFactory::new(class_hash, chain_id, signer, provider).await?;
get_address_and_deployment_fee(factory, salt).await?
}
AccountType::Argent | AccountType::Ready => {
AccountType::Ready => {
let factory =
ArgentAccountFactory::new(class_hash, chain_id, None, signer, provider).await?;

Expand Down Expand Up @@ -273,12 +262,11 @@ fn create_to_keystore(
}
})
}
AccountType::Argent | AccountType::Ready => {
AccountType::Ready => {
json!({
"version": 1,
"variant": {
// TODO(#3556): Remove hardcoded "argent" and use format! with `AccountType::Ready`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about preexisting argent accounts, I assume the logic to use them is still existing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes my bad. I didn't think about that

"type": "argent",
"type": AccountType::Ready,
"version": 1,
"owner": format!("{:#x}", private_key.verifying_key().scalar()),
"guardian": "0x0",
Expand Down
4 changes: 2 additions & 2 deletions crates/sncast/src/starknet_commands/account/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ async fn get_deployment_result(
ui: &UI,
) -> Result<InvokeResponse> {
match account_type {
AccountType::Argent | AccountType::Ready => {
AccountType::Ready => {
let factory = ArgentAccountFactory::new(
class_hash,
chain_id,
Expand Down Expand Up @@ -390,7 +390,7 @@ pub(crate) fn compute_account_address(
chain_id: Felt,
) -> Felt {
match account_type {
AccountType::Argent | AccountType::Ready => get_contract_address(
AccountType::Ready => get_contract_address(
salt,
class_hash,
&[private_key.verifying_key().scalar(), Felt::ZERO],
Expand Down
11 changes: 0 additions & 11 deletions crates/sncast/src/starknet_commands/account/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ use anyhow::{Context, Result, bail, ensure};
use camino::Utf8PathBuf;
use clap::Args;
use conversions::string::{TryFromDecStr, TryFromHexStr};
use foundry_ui::components::warning::WarningMessage;
use sncast::check_if_legacy_contract;
use sncast::helpers::account::generate_account_name;
use sncast::helpers::rpc::RpcArgs;
use sncast::response::account::import::AccountImportResponse;
use sncast::response::ui::UI;
use sncast::{AccountType, check_class_hash_exists, get_chain_id, handle_rpc_error};
use starknet_rust::core::types::{BlockId, BlockTag, StarknetError};
use starknet_rust::providers::jsonrpc::{HttpTransport, JsonRpcClient};
Expand Down Expand Up @@ -69,16 +67,7 @@ pub async fn import(
accounts_file: &Utf8PathBuf,
provider: &JsonRpcClient<HttpTransport>,
import: &Import,
ui: &UI,
) -> Result<AccountImportResponse> {
// TODO(#3556): Remove this warning once we drop Argent account type
if import.account_type == AccountType::Argent {
ui.print_warning(WarningMessage::new(
"Argent has rebranded as Ready. The `argent` option for the `--type` flag in `account import` is deprecated, please use `ready` instead.",
));
ui.print_blank_line();
}

let private_key = if let Some(passed_private_key) = &import.private_key {
passed_private_key
} else if let Some(passed_private_key_file_path) = &import.private_key_file_path {
Expand Down
8 changes: 1 addition & 7 deletions crates/sncast/src/starknet_commands/account/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,7 @@ impl Message for AccountDataRepresentationMessage {
let _ = writeln!(result, " legacy: {legacy}");
}
if let Some(ref account_type) = self.account_type {
// TODO(#3556): Remove this adjustment when the `argent` account type is removed
let displayed_type = if account_type == &AccountType::Argent {
&AccountType::Ready
} else {
account_type
};
let _ = writeln!(result, " type: {displayed_type:?}");
let _ = writeln!(result, " type: {account_type:?}");
}

result.trim_end().to_string()
Expand Down
9 changes: 1 addition & 8 deletions crates/sncast/src/starknet_commands/account/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,11 @@ pub fn prepare_account_json(
class_hash: Option<Felt>,
salt: Option<Felt>,
) -> serde_json::Value {
// TODO(#3556): Once `Argent` variant is deleted, use `account_type` directly
let saved_account_type = match account_type {
AccountType::Argent => AccountType::Ready,
_ => account_type,
};
let mut account_json = json!({
"private_key": format!("{:#x}", private_key.secret_scalar()),
"public_key": format!("{:#x}", private_key.verifying_key().scalar()),
"address": format!("{address:#x}"),
"type": format!("{saved_account_type}").to_lowercase().replace("openzeppelin", "open_zeppelin"),
"type": format!("{account_type}").to_lowercase().replace("openzeppelin", "open_zeppelin"),
"deployed": deployed,
"legacy": legacy,
});
Expand Down Expand Up @@ -214,7 +209,6 @@ pub async fn account(
&config.accounts_file,
&provider,
&import,
ui,
)
.await;

Expand Down Expand Up @@ -254,7 +248,6 @@ pub async fn account(
&provider,
chain_id,
&create,
ui,
)
.await;

Expand Down
129 changes: 3 additions & 126 deletions crates/sncast/tests/e2e/account/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ use crate::helpers::env::set_create_keystore_password_env;
use camino::Utf8PathBuf;
use conversions::string::IntoHexStr;
use serde_json::{json, to_string_pretty};
use shared::test_utils::output_assert::{
AsOutput, assert_stderr_contains, assert_stdout, assert_stdout_contains,
};
use shared::test_utils::output_assert::{AsOutput, assert_stderr_contains, assert_stdout_contains};
use snapbox::assert_data_eq;
use sncast::AccountType;
use sncast::helpers::constants::{
Expand Down Expand Up @@ -88,74 +86,6 @@ pub async fn test_happy_case(account_type: &str) {
assert_data_eq!(contents, to_string_pretty(&expected).unwrap());
}

// TODO(#3556): Remove this test once we drop Argent account type
#[tokio::test]
pub async fn test_happy_case_argent_with_deprecation_warning() {
let temp_dir = tempdir().expect("Unable to create a temporary directory");
let accounts_file = "accounts.json";

let args = vec![
"--accounts-file",
accounts_file,
"account",
"create",
"--url",
URL,
"--name",
"my_account",
"--salt",
"0x1",
"--type",
"argent",
];

let snapbox = runner(&args)
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
.current_dir(temp_dir.path());
let output = snapbox.assert().success();

assert_stdout(
output,
indoc! {r"
[WARNING] Argent has rebranded as Ready. The `argent` option for the `--type` flag in `account create` is deprecated, please use `ready` instead.

Success: Account created

Address: 0x0[..]

Account successfully created but it needs to be deployed. The estimated deployment fee is [..] STRK. Prefund the account to cover deployment transaction fee

After prefunding the account, run:
sncast --accounts-file accounts.json account deploy --url http://127.0.0.1:5055/rpc --name my_account

To see account creation details, visit:
account: [..]
"},
);

let contents = fs::read_to_string(temp_dir.path().join(accounts_file))
.expect("Unable to read created file");

let expected = json!(
{
"alpha-sepolia": {
"my_account": {
"address": "0x[..]",
"class_hash": "0x[..]",
"deployed": false,
"legacy": false,
"private_key": "0x[..]",
"public_key": "0x[..]",
"salt": "0x1",
"type": "ready"
}
}
}
);

assert_data_eq!(contents, to_string_pretty(&expected).unwrap());
}

#[tokio::test]
pub async fn test_invalid_class_hash() {
let temp_dir = tempdir().expect("Unable to create a temporary directory");
Expand Down Expand Up @@ -461,58 +391,6 @@ pub async fn test_happy_case_keystore(account_type: &str) {
);
}

// TODO(#3556): Remove this test once we drop Argent account type
#[tokio::test]
pub async fn test_happy_case_keystore_argent_with_deprecation_warning() {
let temp_dir = tempdir().expect("Unable to create a temporary directory");
let keystore_file = "my_key.json";
let account_file = "my_account.json";
set_create_keystore_password_env();

let args = vec![
"--keystore",
keystore_file,
"--account",
account_file,
"account",
"create",
"--url",
URL,
"--type",
"argent",
];

let snapbox = runner(&args)
.env("SNCAST_FORCE_SHOW_EXPLORER_LINKS", "1")
.current_dir(temp_dir.path());

snapbox.assert().stdout_eq(formatdoc! {r"
[WARNING] Argent has rebranded as Ready. The `argent` option for the `--type` flag in `account create` is deprecated, please use `ready` instead.

Success: Account created

Address: 0x0[..]

Account successfully created but it needs to be deployed. The estimated deployment fee is [..] STRK. Prefund the account to cover deployment transaction fee

After prefunding the account, run:
sncast --account {} --keystore {} account deploy --url {}

To see account creation details, visit:
account: [..]
", account_file, keystore_file, URL});

assert!(temp_dir.path().join(keystore_file).exists());

let contents = fs::read_to_string(temp_dir.path().join(account_file))
.expect("Unable to read created file");

assert_data_eq!(
contents,
get_keystore_account_pattern("argent".parse().unwrap(), None),
);
}

#[tokio::test]
pub async fn test_happy_case_keystore_add_profile() {
let tempdir = copy_config_to_tempdir("tests/data/files/correct_snfoundry.toml", None);
Expand Down Expand Up @@ -864,13 +742,12 @@ fn get_keystore_account_pattern(account_type: AccountType, class_hash: Option<&s
}
)
}
AccountType::Argent | AccountType::Ready => {
AccountType::Ready => {
json!(
{
"version": 1,
"variant": {
// TODO(#3556): Remove hardcoded "argent" and use format! with `AccountType::Ready`
"type": "argent",
"type": AccountType::Ready,
"version": 1,
"owner": "0x[..]",
"guardian": "0x0"
Expand Down
2 changes: 1 addition & 1 deletion crates/sncast/tests/e2e/account/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn create_tempdir_with_accounts_file(file_name: &str, with_sample_data: bool
"private_key": "0x1c3495fce931c0b3ed244f55c54226441a8254deafbc7fab2e46926b4d2fdae",
"public_key": "0x63b3a3ac141e4c007b167b27450f110c729cc0d0238541ca705b0de5144edbd",
"salt": "0xe2b200bbdf76c31b",
"type": "argent"
"type": "ready"
}
},
"custom-network": {
Expand Down
Loading
Loading