use option<identifier> for all wallet commands

This commit is contained in:
Sergio Chouhy 2026-04-27 19:57:25 -03:00
parent eb3d3d8a8d
commit c3f47f6685
3 changed files with 24 additions and 26 deletions

View File

@ -228,7 +228,7 @@ async fn create_and_transfer_public_token() -> Result<()> {
holder_label: None,
holder_npk: None,
holder_vpk: None,
holder_identifier: 0,
holder_identifier: None,
amount: mint_amount,
};
@ -569,7 +569,7 @@ async fn create_token_with_private_definition() -> Result<()> {
holder_label: None,
holder_npk: None,
holder_vpk: None,
holder_identifier: 0,
holder_identifier: None,
amount: mint_amount_public,
};
@ -618,7 +618,7 @@ async fn create_token_with_private_definition() -> Result<()> {
holder_label: None,
holder_npk: None,
holder_vpk: None,
holder_identifier: 0,
holder_identifier: None,
amount: mint_amount_private,
};
@ -1155,7 +1155,7 @@ async fn token_claiming_path_with_private_accounts() -> Result<()> {
holder_label: None,
holder_npk: Some(hex::encode(holder_keys.nullifier_public_key.0)),
holder_vpk: Some(hex::encode(holder_keys.viewing_public_key.0)),
holder_identifier,
holder_identifier: Some(holder_identifier),
amount: mint_amount,
};

View File

@ -156,7 +156,6 @@ impl WalletSubcommand for AuthTransferSubcommand {
anyhow::bail!("Provide only one of --to or --to-label")
}
};
let to_identifier = to_identifier.unwrap_or_else(rand::random);
let underlying_subcommand = match (to, to_npk, to_vpk) {
(None, None, None) => {
anyhow::bail!(
@ -313,8 +312,8 @@ pub enum NativeTokenTransferProgramSubcommandShielded {
#[arg(long)]
to_vpk: String,
/// Identifier for the recipient's private account.
#[arg(long, default_value_t = 0)]
to_identifier: u128,
#[arg(long)]
to_identifier: Option<u128>,
/// amount - amount of balance to move.
#[arg(long)]
amount: u128,
@ -353,8 +352,8 @@ pub enum NativeTokenTransferProgramSubcommandPrivate {
#[arg(long)]
to_vpk: String,
/// Identifier for the recipient's private account.
#[arg(long, default_value_t = 0)]
to_identifier: u128,
#[arg(long)]
to_identifier: Option<u128>,
/// amount - amount of balance to move.
#[arg(long)]
amount: u128,
@ -416,7 +415,7 @@ impl WalletSubcommand for NativeTokenTransferProgramSubcommandPrivate {
from,
to_npk,
to_vpk,
to_identifier,
to_identifier.unwrap_or_else(rand::random),
amount,
)
.await?;
@ -498,7 +497,7 @@ impl WalletSubcommand for NativeTokenTransferProgramSubcommandShielded {
from,
to_npk,
to_vpk,
to_identifier,
to_identifier.unwrap_or_else(rand::random),
amount,
)
.await?;

View File

@ -145,8 +145,8 @@ pub enum TokenProgramAgnosticSubcommand {
holder_vpk: Option<String>,
/// Identifier for the holder's private account (only used when minting to a foreign
/// private account via `--holder-npk`/`--holder-vpk`).
#[arg(long, default_value_t = 0)]
holder_identifier: u128,
#[arg(long)]
holder_identifier: Option<u128>,
/// amount - amount of balance to mint.
#[arg(long)]
amount: u128,
@ -256,7 +256,6 @@ impl WalletSubcommand for TokenProgramAgnosticSubcommand {
anyhow::bail!("Provide only one of --to or --to-label")
}
};
let to_identifier = to_identifier.unwrap_or_else(rand::random);
let underlying_subcommand = match (to, to_npk, to_vpk) {
(None, None, None) => {
anyhow::bail!(
@ -601,8 +600,8 @@ pub enum TokenProgramSubcommandPrivate {
#[arg(long)]
recipient_vpk: String,
/// Identifier for the recipient's private account.
#[arg(long, default_value_t = 0)]
recipient_identifier: u128,
#[arg(long)]
recipient_identifier: Option<u128>,
#[arg(short, long)]
balance_to_move: u128,
},
@ -633,8 +632,8 @@ pub enum TokenProgramSubcommandPrivate {
#[arg(short, long)]
holder_vpk: String,
/// Identifier for the holder's private account.
#[arg(long, default_value_t = 0)]
holder_identifier: u128,
#[arg(long)]
holder_identifier: Option<u128>,
#[arg(short, long)]
amount: u128,
},
@ -695,8 +694,8 @@ pub enum TokenProgramSubcommandShielded {
#[arg(long)]
recipient_vpk: String,
/// Identifier for the recipient's private account.
#[arg(long, default_value_t = 0)]
recipient_identifier: u128,
#[arg(long)]
recipient_identifier: Option<u128>,
#[arg(short, long)]
balance_to_move: u128,
},
@ -727,8 +726,8 @@ pub enum TokenProgramSubcommandShielded {
#[arg(short, long)]
holder_vpk: String,
/// Identifier for the holder's private account.
#[arg(long, default_value_t = 0)]
holder_identifier: u128,
#[arg(long)]
holder_identifier: Option<u128>,
#[arg(short, long)]
amount: u128,
},
@ -910,7 +909,7 @@ impl WalletSubcommand for TokenProgramSubcommandPrivate {
sender_account_id,
recipient_npk,
recipient_vpk,
recipient_identifier,
recipient_identifier.unwrap_or_else(rand::random),
balance_to_move,
)
.await?;
@ -1030,7 +1029,7 @@ impl WalletSubcommand for TokenProgramSubcommandPrivate {
definition_account_id,
holder_npk,
holder_vpk,
holder_identifier,
holder_identifier.unwrap_or_else(rand::random),
amount,
)
.await?;
@ -1196,7 +1195,7 @@ impl WalletSubcommand for TokenProgramSubcommandShielded {
sender_account_id,
recipient_npk,
recipient_vpk,
recipient_identifier,
recipient_identifier.unwrap_or_else(rand::random),
balance_to_move,
)
.await?;
@ -1338,7 +1337,7 @@ impl WalletSubcommand for TokenProgramSubcommandShielded {
definition_account_id,
holder_npk,
holder_vpk,
holder_identifier,
holder_identifier.unwrap_or_else(rand::random),
amount,
)
.await?;