Skip to content

Commit dda287c

Browse files
committed
cleanup args and help menu
1 parent 89f59e7 commit dda287c

File tree

3 files changed

+16
-28
lines changed

3 files changed

+16
-28
lines changed

src/args.rs

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ use clap::{arg, Parser};
33
#[derive(Parser, Debug)]
44
pub struct BalanceArgs {
55
#[arg(
6-
long,
76
value_name = "ADDRESS",
8-
help = "The address of the account to fetch the balance of"
7+
help = "The account address to fetch the balance of"
98
)]
109
pub address: Option<String>,
1110
}
@@ -28,7 +27,6 @@ pub struct BussesArgs {}
2827
#[derive(Parser, Debug)]
2928
pub struct ClaimArgs {
3029
#[arg(
31-
long,
3230
value_name = "AMOUNT",
3331
help = "The amount of rewards to claim. Defaults to max."
3432
)]
@@ -37,7 +35,7 @@ pub struct ClaimArgs {
3735
#[arg(
3836
long,
3937
value_name = "WALLET_ADDRESS",
40-
help = "Wallet to receive claimed tokens."
38+
help = "Wallet address to receive claimed tokens."
4139
)]
4240
pub to: Option<String>,
4341
}
@@ -75,11 +73,7 @@ pub struct MineArgs {
7573

7674
#[derive(Parser, Debug)]
7775
pub struct ProofArgs {
78-
#[arg(
79-
index = 0,
80-
value_name = "ADDRESS",
81-
help = "The address of the proof to fetch"
82-
)]
76+
#[arg(value_name = "ADDRESS", help = "The address of the proof to fetch")]
8377
pub address: Option<String>,
8478
}
8579

@@ -89,32 +83,25 @@ pub struct RewardsArgs {}
8983
#[derive(Parser, Debug)]
9084
pub struct StakeArgs {
9185
#[arg(
92-
long,
9386
value_name = "AMOUNT",
94-
help = "The amount of Ore to stake. Defaults to max."
87+
help = "The amount of ORE to stake. Defaults to max."
9588
)]
9689
pub amount: Option<f64>,
9790

9891
#[arg(
9992
long,
10093
value_name = "TOKEN_ACCOUNT_ADDRESS",
101-
help = "Token account to send Ore from."
94+
help = "Token account to send ORE from. Defaults to the associated token account."
10295
)]
103-
pub sender: Option<String>,
96+
pub token_account: Option<String>,
10497
}
10598

10699
#[derive(Parser, Debug)]
107100
pub struct TransferArgs {
108-
#[arg(
109-
index = 0,
110-
value_name = "AMOUNT",
111-
help = "The amount of ORE to transfer.",
112-
required = true
113-
)]
101+
#[arg(value_name = "AMOUNT", help = "The amount of ORE to transfer.")]
114102
pub amount: f64,
115103

116104
#[arg(
117-
index = 1,
118105
value_name = "WALLET_ADDRESS",
119106
help = "The wallet address of the receipient."
120107
)]
@@ -124,9 +111,8 @@ pub struct TransferArgs {
124111
#[derive(Parser, Debug)]
125112
pub struct UpgradeArgs {
126113
#[arg(
127-
long,
128114
value_name = "AMOUNT",
129-
help = "The amount of Ore to upgrade from v1 to v2. Defaults to max."
115+
help = "The amount of ORE to upgrade from v1 to v2. Defaults to max."
130116
)]
131117
pub amount: Option<f64>,
132118
}

src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,23 @@ struct Args {
104104
#[arg(
105105
long,
106106
value_name = "KEYPAIR_FILEPATH",
107-
help = "Filepath to keypair to use.",
107+
help = "Filepath to signer keypair.",
108108
global = true
109109
)]
110110
keypair: Option<String>,
111111

112112
#[arg(
113113
long,
114114
value_name = "FEE_PAYER_FILEPATH",
115-
help = "Filepath to keypair to use as transaction fee payer.",
115+
help = "Filepath to transaction fee payer keypair.",
116116
global = true
117117
)]
118118
fee_payer: Option<String>,
119119

120120
#[arg(
121121
long,
122122
value_name = "MICROLAMPORTS",
123-
help = "Price to pay for compute units. If dynamic fees are being used, this value will be the max.",
123+
help = "Price to pay for compute units. If dynamic fees are enabled, this value will be used as the cap.",
124124
default_value = "500000",
125125
global = true
126126
)]
@@ -134,7 +134,7 @@ struct Args {
134134
)]
135135
dynamic_fee_url: Option<String>,
136136

137-
#[arg(long, help = "Use dynamic priority fees", global = true)]
137+
#[arg(long, help = "Enable dynamic priority fees", global = true)]
138138
dynamic_fee: bool,
139139

140140
#[command(subcommand)]

src/stake.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ impl Miner {
1212
pub async fn stake(&self, args: StakeArgs) {
1313
// Get signer
1414
let signer = self.signer();
15-
let sender = match args.sender {
16-
Some(sender) => Pubkey::from_str(&sender).expect("Failed to parse sender address"),
15+
let sender = match args.token_account {
16+
Some(address) => {
17+
Pubkey::from_str(&address).expect("Failed to parse token account address")
18+
}
1719
None => spl_associated_token_account::get_associated_token_address(
1820
&signer.pubkey(),
1921
&ore_api::consts::MINT_ADDRESS,

0 commit comments

Comments
 (0)