Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable global flag for all commands/options #1875

Merged
merged 3 commits into from
Apr 24, 2024
Merged
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
2 changes: 2 additions & 0 deletions bin/sozo/src/commands/options/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use super::DOJO_ACCOUNT_ADDRESS_ENV_VAR;
#[command(next_help_heading = "Account options")]
pub struct AccountOptions {
#[arg(long, env = DOJO_ACCOUNT_ADDRESS_ENV_VAR)]
#[arg(global = true)]
pub account_address: Option<FieldElement>,

#[command(flatten)]
Expand All @@ -28,6 +29,7 @@ pub struct AccountOptions {

#[arg(long)]
#[arg(help = "Use legacy account (cairo0 account)")]
#[arg(global = true)]
pub legacy: bool,
}

Expand Down
3 changes: 3 additions & 0 deletions bin/sozo/src/commands/options/fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ use starknet_crypto::FieldElement;
#[command(next_help_heading = "Fee options")]
pub struct FeeOptions {
#[clap(long, help = "Maximum transaction fee in Ether (18 decimals)")]
#[arg(global = true)]
max_fee: Option<BigDecimal>,

#[clap(long, help = "Maximum transaction fee in Wei")]
#[arg(global = true)]
max_fee_raw: Option<FieldElement>,

#[clap(long, help = "Only estimate transaction fee without sending transaction")]
#[arg(global = true)]
estimate_only: bool,
}

Expand Down
3 changes: 3 additions & 0 deletions bin/sozo/src/commands/options/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@ pub struct SignerOptions {
#[arg(conflicts_with = "keystore_path")]
#[arg(help_heading = "Signer options - RAW")]
#[arg(help = "The raw private key associated with the account contract.")]
#[arg(global = true)]
pub private_key: Option<String>,

#[arg(long = "keystore", env = DOJO_KEYSTORE_PATH_ENV_VAR)]
#[arg(value_name = "PATH")]
#[arg(help_heading = "Signer options - KEYSTORE")]
#[arg(help = "Use the keystore in the given folder or file.")]
#[arg(global = true)]
pub keystore_path: Option<String>,

#[arg(long = "password", env = DOJO_KEYSTORE_PASSWORD_ENV_VAR)]
#[arg(value_name = "PASSWORD")]
#[arg(help_heading = "Signer options - KEYSTORE")]
#[arg(help = "The keystore password. Used with --keystore.")]
#[arg(global = true)]
pub keystore_password: Option<String>,
}

Expand Down
1 change: 1 addition & 0 deletions bin/sozo/src/commands/options/starknet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub struct StarknetOptions {
#[arg(long, env = STARKNET_RPC_URL_ENV_VAR)]
#[arg(value_name = "URL")]
#[arg(help = "The Starknet RPC endpoint.")]
#[arg(global = true)]
pub rpc_url: Option<Url>,
}

Expand Down
15 changes: 8 additions & 7 deletions bin/sozo/src/commands/options/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,35 @@ use starknet::core::types::FieldElement;
#[derive(Debug, Args)]
#[command(next_help_heading = "Transaction options")]
pub struct TransactionOptions {
#[arg(long)]
#[arg(value_name = "MULTIPLIER")]
#[arg(long, value_name = "MULTIPLIER")]
#[arg(help = "The multiplier to use for the fee estimate.")]
#[arg(long_help = "The multiplier to use for the fee estimate. This value will be used on \
the estimated fee which will be used as the max fee for the transaction. \
(max_fee = estimated_fee * multiplier)")]
#[arg(conflicts_with = "max_fee_raw")]
#[arg(global = true)]
pub fee_estimate_multiplier: Option<f64>,

#[arg(short, long)]
#[arg(long)]
#[arg(help = "Maximum raw value to be used for fees, in Wei.")]
#[arg(conflicts_with = "fee_estimate_multiplier")]
#[arg(global = true)]
pub max_fee_raw: Option<FieldElement>,

#[arg(short, long)]
#[arg(long)]
#[arg(help = "Wait until the transaction is accepted by the sequencer, returning the status \
and hash.")]
#[arg(long_help = "Wait until the transaction is accepted by the sequencer, returning the \
status and the hash. This will poll the transaction status until it gets \
accepted or rejected by the sequencer.")]
#[arg(global = true)]
pub wait: bool,

#[arg(short, long)]
#[arg(long)]
#[arg(
help = "If --wait is set, returns the full transaction receipt. Otherwise, it is a no-op."
)]
#[arg(long_help = "If --wait is set, returns the full transaction receipt. Otherwise, it is \
a no-op.")]
#[arg(global = true)]
pub receipt: bool,
}

Expand Down
1 change: 1 addition & 0 deletions bin/sozo/src/commands/options/world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use super::DOJO_WORLD_ADDRESS_ENV_VAR;
pub struct WorldOptions {
#[arg(help = "The address of the World contract.")]
#[arg(long = "world", env = DOJO_WORLD_ADDRESS_ENV_VAR)]
#[arg(global = true)]
pub world_address: Option<FieldElement>,
}

Expand Down
Loading