1655 lines
56 KiB
Rust
Raw Normal View History

2026-06-17 13:53:54 -04:00
use anyhow::Result;
2025-10-13 17:25:36 +03:00
use clap::Subcommand;
use lee::AccountId;
2025-10-13 17:25:36 +03:00
2025-10-27 14:32:28 +02:00
use crate::{
2025-12-12 13:40:56 +02:00
AccDecodeData::Decode,
feat(wallet): add keycard support for public accounts for public/privacy txs for program facades (#461) * feat: add basic commands for communicating with keycard * initialize changes * reorganization * add script file for easier wallet access * update commands * fixes * fixed load for non continuous run * Updates for signatures with keycard * fix BIP-340 signatures for fixed sized messages * fmt * refactor and add pin support to program facades * fix unit test * fixes * Revert "fixes" This reverts commit 41f34f4ff4145b7abb60fd9bec168ae4b60f23b4. * fixes * fixes * Removed privacy keycard calls * Revert "Removed privacy keycard calls" This reverts commit d70ef505a1f40b87159099761f5fce5a31e3f17b. * Add domain separators * Removed privacy txs for keycard * CI fixes * CI fixes * addressed some comments * fix ci * initialize branch * ci fixes * fix integration test issue and updated keycard firmware * addressed more comments * fixed deny * remove keycard-py * fixed from earlier merge * add hash_message tests * add test * fix deny * CI fixes * fixed integration tests * Update public.rs * update artifacts * privacy command fixes * ci and comments * addressed comments * comment fixes * fixes from merging main * adding support to other programs * expanded support * ci fixes * ci and add private account keys test * some fixes and setup notes * Ci fixes * ci fixes * update key paths to avoid collisions in tests * added separated files for keycard_tests_2.sh * first round of comments * Revert "Merge branch 'main' into marvin/keycard-commands" This reverts commit 3fce53f663a3996938dddf77680854570063ca21, reversing changes made to e7b42a5177641455a8917bd2e29db20afd9690e5. * python comments * addressed comments * compile error fixed * fix artifacts * fix main merge error * adjust signer logic workflow * updating logic * fmt * refactored * clippy fix * minor fix * addressing comments * minor fix * ci fix * addressed deferred comments * clean up * minor cleanup * ci fixes * fmt fix * feat!(wallet): Merged `SigningGroup` with `AccountManager` (#500) * feat: account manager extension * feat(wallet): added unified way of sending public transactions to all facades * fix(wallet): no sign option added * fix(deny): deny fix * fix(wallet): suggestion 1 * fix(wallet): suggestion fix 1 * feat!: Add new path for externally provided seed to the circuit. BREAKING CHANGE: add identity variants to the circuit and change semantics for `Claim::Authorized` for private PDAs * feat(ci): use separate job per each integration tests module * feat(ci): cache rust artifacts * feat(ci): build integration tests binary once and reuse it * fix(wallet): fmt * ci: add bench-regression workflow with criterion-compare for crypto_primitives_bench * fix(wallet): merge postfix * feat!(wallet): SigningGroup merged with AccountManager * fix(ci): deny and artifacts fix * fix(deny): deny fix * fix keycard and lint --------- Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com> Co-authored-by: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> * addressed comments * minor comments * Rebase to main * CI fixes --------- Co-authored-by: Pravdyvy <46261001+Pravdyvy@users.noreply.github.com> Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com>
2026-06-05 17:35:10 -04:00
AccountIdentity, WalletCore,
account::AccountIdWithPrivacy,
cli::{CliAccountMention, SubcommandReturnValue, WalletSubcommand},
program_facades::token::Token,
2025-10-27 14:32:28 +02:00
};
2026-03-10 00:17:43 +03:00
/// Represents generic CLI subcommand for a wallet working with token program.
2025-10-27 14:32:28 +02:00
#[derive(Subcommand, Debug, Clone)]
pub enum TokenProgramAgnosticSubcommand {
2026-03-10 00:17:43 +03:00
/// Produce a new token.
2025-10-27 14:32:28 +02:00
New {
/// Either 32 byte base58 account id string with privacy prefix or a label.
#[arg(long)]
definition_account_id: CliAccountMention,
/// Either 32 byte base58 account id string with privacy prefix or a label.
#[arg(long)]
supply_account_id: CliAccountMention,
2025-10-27 14:32:28 +02:00
#[arg(short, long)]
name: String,
#[arg(short, long)]
total_supply: u128,
},
2026-03-10 00:17:43 +03:00
/// Send tokens from one account to another with variable privacy.
2025-10-29 12:02:41 +02:00
///
2026-01-21 17:58:45 -05:00
/// If receiver is private, then `to` and (`to_npk` , `to_vpk`) is a mutually exclusive
2025-11-26 00:27:20 +03:00
/// patterns.
2025-10-29 12:02:41 +02:00
///
2025-11-26 00:27:20 +03:00
/// First is used for owned accounts, second otherwise.
2025-10-27 14:32:28 +02:00
Send {
/// Either 32 byte base58 account id string with privacy prefix or a label.
#[arg(long)]
from: CliAccountMention,
/// Either 32 byte base58 account id string with privacy prefix or a label.
#[arg(long)]
to: Option<CliAccountMention>,
2026-03-10 00:17:43 +03:00
/// `to_npk` - valid 32 byte hex string.
#[arg(long, conflicts_with = "to_keys")]
2025-10-27 14:32:28 +02:00
to_npk: Option<String>,
/// `to_vpk` - valid hex-encoded ML-KEM-768 encapsulation key (1184 bytes).
#[arg(long, conflicts_with = "to_keys")]
2026-01-21 17:58:45 -05:00
to_vpk: Option<String>,
/// Path to a keys file exported by `wallet account show-keys`, containing npk
/// and vpk on separate lines. Replaces `--to-npk` and `--to-vpk`.
#[arg(long, conflicts_with_all = ["to_npk", "to_vpk"])]
to_keys: Option<String>,
/// Identifier for the recipient's private account (only used when sending to a foreign
/// private account via `--to-npk`/`--to-vpk` or `--to-keys`).
#[arg(long)]
to_identifier: Option<u128>,
2026-03-10 00:17:43 +03:00
/// amount - amount of balance to move.
2025-10-27 14:32:28 +02:00
#[arg(long)]
amount: u128,
},
2025-12-11 14:46:16 +02:00
/// Burn tokens on `holder`, modify `definition`.
///
2026-03-10 00:17:43 +03:00
/// `holder` is owned.
2025-12-11 14:46:16 +02:00
///
2025-12-12 13:40:56 +02:00
/// Also if `definition` is private then it is owned, because
/// we can not modify foreign accounts.
2025-12-11 14:46:16 +02:00
Burn {
/// Either 32 byte base58 account id string with privacy prefix or a label.
#[arg(long)]
definition: CliAccountMention,
/// Either 32 byte base58 account id string with privacy prefix or a label.
#[arg(long)]
holder: CliAccountMention,
2026-03-10 00:17:43 +03:00
/// amount - amount of balance to burn.
2025-12-11 14:46:16 +02:00
#[arg(long)]
amount: u128,
},
/// Mint tokens on `holder`, modify `definition`.
///
2026-03-10 00:17:43 +03:00
/// `definition` is owned.
2025-12-11 14:46:16 +02:00
///
2026-01-21 17:58:45 -05:00
/// If `holder` is private, then `holder` and (`holder_npk` , `holder_vpk`) is a mutually
2025-12-11 14:46:16 +02:00
/// exclusive patterns.
///
/// First is used for owned accounts, second otherwise.
Mint {
/// Either 32 byte base58 account id string with privacy prefix or a label.
#[arg(long)]
definition: CliAccountMention,
/// Either 32 byte base58 account id string with privacy prefix or a label.
#[arg(long)]
holder: Option<CliAccountMention>,
2026-03-10 00:17:43 +03:00
/// `holder_npk` - valid 32 byte hex string.
#[arg(long, conflicts_with = "holder_keys")]
2025-12-11 14:46:16 +02:00
holder_npk: Option<String>,
/// `holder_vpk` - valid hex-encoded ML-KEM-768 encapsulation key (1184 bytes).
#[arg(long, conflicts_with = "holder_keys")]
2026-01-21 17:58:45 -05:00
holder_vpk: Option<String>,
/// Path to a keys file exported by `wallet account show-keys`, containing npk
/// and vpk on separate lines. Replaces `--holder-npk` and `--holder-vpk`.
#[arg(long, conflicts_with_all = ["holder_npk", "holder_vpk"])]
holder_keys: Option<String>,
/// Identifier for the holder's private account (only used when minting to a foreign
/// private account via `--holder-npk`/`--holder-vpk` or `--holder-keys`).
#[arg(long)]
holder_identifier: Option<u128>,
2026-03-10 00:17:43 +03:00
/// amount - amount of balance to mint.
2025-12-11 14:46:16 +02:00
#[arg(long)]
amount: u128,
},
2025-10-27 14:32:28 +02:00
}
2026-06-17 13:53:54 -04:00
impl TokenProgramAgnosticSubcommand {
async fn handle_new(
definition_account_id: CliAccountMention,
supply_account_id: CliAccountMention,
name: String,
total_supply: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let def_mention = definition_account_id.clone();
let sup_mention = supply_account_id.clone();
let definition_account_id = definition_account_id.resolve(wallet_core.storage())?;
let supply_account_id = supply_account_id.resolve(wallet_core.storage())?;
let underlying_subcommand = match (definition_account_id, supply_account_id) {
(AccountIdWithPrivacy::Public(_), AccountIdWithPrivacy::Public(_)) => {
TokenProgramSubcommand::Create(
CreateNewTokenProgramSubcommand::NewPublicDefPublicSupp {
definition_account_id: def_mention,
supply_account_id: sup_mention,
name,
total_supply,
},
)
}
(
AccountIdWithPrivacy::Public(definition_account_id),
AccountIdWithPrivacy::Private(supply_account_id),
) => TokenProgramSubcommand::Create(
CreateNewTokenProgramSubcommand::NewPublicDefPrivateSupp {
definition_account_id,
supply_account_id,
name,
total_supply,
},
),
(
AccountIdWithPrivacy::Private(definition_account_id),
AccountIdWithPrivacy::Private(supply_account_id),
) => TokenProgramSubcommand::Create(
CreateNewTokenProgramSubcommand::NewPrivateDefPrivateSupp {
definition_account_id,
supply_account_id,
name,
total_supply,
},
),
(
AccountIdWithPrivacy::Private(definition_account_id),
AccountIdWithPrivacy::Public(supply_account_id),
) => TokenProgramSubcommand::Create(
CreateNewTokenProgramSubcommand::NewPrivateDefPublicSupp {
definition_account_id,
supply_account_id,
name,
total_supply,
},
),
};
underlying_subcommand.handle_subcommand(wallet_core).await
}
fn route_send_owned(
from: AccountIdWithPrivacy,
to: AccountIdWithPrivacy,
from_mention: CliAccountMention,
to_mention: Option<CliAccountMention>,
amount: u128,
) -> TokenProgramSubcommand {
match (from, to) {
(AccountIdWithPrivacy::Public(_), AccountIdWithPrivacy::Public(_)) => {
TokenProgramSubcommand::Public(TokenProgramSubcommandPublic::TransferToken {
sender_account_id: from_mention,
2026-06-17 17:34:11 -04:00
recipient_account_id: to_mention.expect(
"`wallet::cli::programs::token::Send`: Invalid to_mention account provided",
),
2026-06-17 13:53:54 -04:00
balance_to_move: amount,
})
}
(AccountIdWithPrivacy::Private(from), AccountIdWithPrivacy::Private(to)) => {
TokenProgramSubcommand::Private(
TokenProgramSubcommandPrivate::TransferTokenPrivateOwned {
sender_account_id: from,
recipient_account_id: to,
balance_to_move: amount,
},
)
}
(AccountIdWithPrivacy::Private(from), AccountIdWithPrivacy::Public(to)) => {
TokenProgramSubcommand::Deshielded(
TokenProgramSubcommandDeshielded::TransferTokenDeshielded {
sender_account_id: from,
recipient_account_id: to,
balance_to_move: amount,
},
)
}
(AccountIdWithPrivacy::Public(from), AccountIdWithPrivacy::Private(to)) => {
TokenProgramSubcommand::Shielded(
TokenProgramSubcommandShielded::TransferTokenShieldedOwned {
sender: Some(from_mention.into_public_identity(from)),
recipient_account_id: to,
balance_to_move: amount,
},
)
}
}
}
fn route_send_foreign(
from: AccountIdWithPrivacy,
from_mention: CliAccountMention,
to_npk: String,
to_vpk: String,
to_identifier: Option<u128>,
amount: u128,
) -> TokenProgramSubcommand {
match from {
AccountIdWithPrivacy::Private(from) => TokenProgramSubcommand::Private(
TokenProgramSubcommandPrivate::TransferTokenPrivateForeign {
sender_account_id: from,
recipient_npk: to_npk,
recipient_vpk: to_vpk,
recipient_identifier: to_identifier,
balance_to_move: amount,
},
),
AccountIdWithPrivacy::Public(from) => TokenProgramSubcommand::Shielded(
TokenProgramSubcommandShielded::TransferTokenShieldedForeign {
sender: Some(from_mention.into_public_identity(from)),
recipient_npk: to_npk,
recipient_vpk: to_vpk,
recipient_identifier: to_identifier,
balance_to_move: amount,
},
),
}
}
2026-06-17 17:34:11 -04:00
#[expect(
clippy::too_many_arguments,
reason = "extracted match arm with many destructured fields"
)]
2026-06-17 13:53:54 -04:00
async fn handle_send(
from: CliAccountMention,
to: Option<CliAccountMention>,
to_npk: Option<String>,
to_vpk: Option<String>,
to_keys: Option<String>,
to_identifier: Option<u128>,
amount: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let from_mention = from.clone();
let to_mention = to.clone();
let (to_npk, to_vpk) = if let Some(path) = to_keys {
let (npk_bytes, vpk_bytes) = crate::cli::read_keys_file(&path)?;
(Some(hex::encode(npk_bytes)), Some(hex::encode(vpk_bytes)))
} else {
(to_npk, to_vpk)
};
let from = from.resolve(wallet_core.storage())?;
let to = to
.map(|account_mention| account_mention.resolve(wallet_core.storage()))
.transpose()?;
let underlying_subcommand = match (to, to_npk, to_vpk) {
(None, None, None) => {
2026-06-17 17:34:11 -04:00
anyhow::bail!("Provide either account account_id of receiver or their public keys");
2026-06-17 13:53:54 -04:00
}
(Some(_), Some(_), Some(_)) => {
anyhow::bail!(
"Provide only one variant: either account account_id of receiver or their public keys"
);
}
(_, Some(_), None) | (_, None, Some(_)) => {
anyhow::bail!("List of public keys is uncomplete");
}
(Some(to), None, None) => {
Self::route_send_owned(from, to, from_mention, to_mention, amount)
}
(None, Some(to_npk), Some(to_vpk)) => {
Self::route_send_foreign(from, from_mention, to_npk, to_vpk, to_identifier, amount)
}
};
underlying_subcommand.handle_subcommand(wallet_core).await
}
async fn handle_burn(
definition: CliAccountMention,
holder: CliAccountMention,
amount: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let holder_mention = holder.clone();
let definition = definition.resolve(wallet_core.storage())?;
let holder = holder.resolve(wallet_core.storage())?;
let underlying_subcommand = match (definition, holder) {
(AccountIdWithPrivacy::Public(definition), AccountIdWithPrivacy::Public(_)) => {
TokenProgramSubcommand::Public(TokenProgramSubcommandPublic::BurnToken {
definition_account_id: definition,
holder_account_id: holder_mention,
amount,
})
}
2026-06-17 17:34:11 -04:00
(AccountIdWithPrivacy::Private(definition), AccountIdWithPrivacy::Private(holder)) => {
TokenProgramSubcommand::Private(
TokenProgramSubcommandPrivate::BurnTokenPrivateOwned {
definition_account_id: definition,
holder_account_id: holder,
amount,
},
)
}
(AccountIdWithPrivacy::Private(definition), AccountIdWithPrivacy::Public(holder)) => {
TokenProgramSubcommand::Deshielded(
TokenProgramSubcommandDeshielded::BurnTokenDeshieldedOwned {
definition_account_id: definition,
holder_account_id: holder,
amount,
},
)
}
(AccountIdWithPrivacy::Public(definition), AccountIdWithPrivacy::Private(holder)) => {
TokenProgramSubcommand::Shielded(
TokenProgramSubcommandShielded::BurnTokenShielded {
definition_account_id: definition,
holder_account_id: holder,
amount,
},
)
}
2026-06-17 13:53:54 -04:00
};
underlying_subcommand.handle_subcommand(wallet_core).await
}
fn route_mint_owned(
definition: AccountIdWithPrivacy,
holder: AccountIdWithPrivacy,
def_mention: CliAccountMention,
holder_mention: Option<CliAccountMention>,
amount: u128,
) -> TokenProgramSubcommand {
match (definition, holder) {
(AccountIdWithPrivacy::Public(_), AccountIdWithPrivacy::Public(_)) => {
TokenProgramSubcommand::Public(TokenProgramSubcommandPublic::MintToken {
definition_account_id: def_mention,
holder_account_id: holder_mention.expect("`wallet::cli::programs::token::Mint`: Invalid holder_mention account provided"),
amount,
})
}
(AccountIdWithPrivacy::Private(definition), AccountIdWithPrivacy::Private(holder)) => {
TokenProgramSubcommand::Private(
TokenProgramSubcommandPrivate::MintTokenPrivateOwned {
definition_account_id: definition,
holder_account_id: holder,
amount,
},
)
}
(AccountIdWithPrivacy::Private(definition), AccountIdWithPrivacy::Public(holder)) => {
TokenProgramSubcommand::Deshielded(
TokenProgramSubcommandDeshielded::MintTokenDeshielded {
definition_account_id: definition,
holder_account_id: holder,
amount,
},
)
}
(AccountIdWithPrivacy::Public(definition), AccountIdWithPrivacy::Private(holder)) => {
TokenProgramSubcommand::Shielded(
TokenProgramSubcommandShielded::MintTokenShieldedOwned {
definition_account_id: definition,
holder_account_id: holder,
amount,
},
)
}
}
}
2026-06-17 17:34:11 -04:00
const fn route_mint_foreign(
2026-06-17 13:53:54 -04:00
definition: AccountIdWithPrivacy,
holder_npk: String,
holder_vpk: String,
holder_identifier: Option<u128>,
amount: u128,
) -> TokenProgramSubcommand {
match definition {
AccountIdWithPrivacy::Private(definition) => TokenProgramSubcommand::Private(
TokenProgramSubcommandPrivate::MintTokenPrivateForeign {
definition_account_id: definition,
holder_npk,
holder_vpk,
holder_identifier,
amount,
},
),
AccountIdWithPrivacy::Public(definition) => TokenProgramSubcommand::Shielded(
TokenProgramSubcommandShielded::MintTokenShieldedForeign {
definition_account_id: definition,
holder_npk,
holder_vpk,
holder_identifier,
amount,
},
),
}
}
2026-06-17 17:34:11 -04:00
#[expect(
clippy::too_many_arguments,
reason = "extracted match arm with many destructured fields"
)]
2026-06-17 13:53:54 -04:00
async fn handle_mint(
definition: CliAccountMention,
holder: Option<CliAccountMention>,
holder_npk: Option<String>,
holder_vpk: Option<String>,
holder_keys: Option<String>,
holder_identifier: Option<u128>,
amount: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let def_mention = definition.clone();
let holder_mention = holder.clone();
let (holder_npk, holder_vpk) = if let Some(path) = holder_keys {
let (npk_bytes, vpk_bytes) = crate::cli::read_keys_file(&path)?;
(Some(hex::encode(npk_bytes)), Some(hex::encode(vpk_bytes)))
} else {
(holder_npk, holder_vpk)
};
let definition = definition.resolve(wallet_core.storage())?;
let holder = holder
.map(|account_mention| account_mention.resolve(wallet_core.storage()))
.transpose()?;
let underlying_subcommand = match (holder, holder_npk, holder_vpk) {
(None, None, None) => {
2026-06-17 17:34:11 -04:00
anyhow::bail!("Provide either account account_id of holder or their public keys");
2026-06-17 13:53:54 -04:00
}
(Some(_), Some(_), Some(_)) => {
anyhow::bail!(
"Provide only one variant: either account_id of holder or their public keys"
);
}
(_, Some(_), None) | (_, None, Some(_)) => {
anyhow::bail!("List of public keys is uncomplete");
}
(Some(holder), None, None) => {
Self::route_mint_owned(definition, holder, def_mention, holder_mention, amount)
}
2026-06-17 17:34:11 -04:00
(None, Some(holder_npk), Some(holder_vpk)) => Self::route_mint_foreign(
definition,
holder_npk,
holder_vpk,
holder_identifier,
amount,
),
2026-06-17 13:53:54 -04:00
};
underlying_subcommand.handle_subcommand(wallet_core).await
}
}
2025-10-27 14:32:28 +02:00
impl WalletSubcommand for TokenProgramAgnosticSubcommand {
async fn handle_subcommand(
self,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
match self {
2026-03-09 18:27:56 +03:00
Self::New {
definition_account_id,
supply_account_id,
2025-10-27 14:32:28 +02:00
name,
total_supply,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_new(
definition_account_id,
supply_account_id,
name,
total_supply,
wallet_core,
)
.await
2025-10-27 14:32:28 +02:00
}
2026-03-09 18:27:56 +03:00
Self::Send {
2025-10-27 14:32:28 +02:00
from,
to,
to_npk,
2026-01-21 17:58:45 -05:00
to_vpk,
to_keys,
to_identifier,
2025-10-27 14:32:28 +02:00
amount,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_send(
2026-06-17 17:34:11 -04:00
from,
to,
to_npk,
to_vpk,
to_keys,
to_identifier,
amount,
wallet_core,
2026-06-17 13:53:54 -04:00
)
.await
2025-12-11 14:46:16 +02:00
}
2026-03-09 18:27:56 +03:00
Self::Burn {
2025-12-11 14:46:16 +02:00
definition,
holder,
amount,
2026-06-17 13:53:54 -04:00
} => Self::handle_burn(definition, holder, amount, wallet_core).await,
2026-03-09 18:27:56 +03:00
Self::Mint {
2025-12-11 14:46:16 +02:00
definition,
holder,
holder_npk,
2026-01-21 17:58:45 -05:00
holder_vpk,
holder_keys,
holder_identifier,
2025-12-11 14:46:16 +02:00
amount,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_mint(
definition,
holder,
holder_npk,
holder_vpk,
holder_keys,
holder_identifier,
amount,
wallet_core,
)
.await
2025-10-27 14:32:28 +02:00
}
}
}
}
2025-10-13 17:25:36 +03:00
2026-03-10 00:17:43 +03:00
/// Represents generic CLI subcommand for a wallet working with `token_program`.
2025-10-13 17:25:36 +03:00
#[derive(Subcommand, Debug, Clone)]
pub enum TokenProgramSubcommand {
2026-03-10 00:17:43 +03:00
/// Creation of new token.
2025-12-02 15:27:20 +02:00
#[command(subcommand)]
Create(CreateNewTokenProgramSubcommand),
2026-03-10 00:17:43 +03:00
/// Public execution.
2025-10-14 10:18:54 +03:00
#[command(subcommand)]
Public(TokenProgramSubcommandPublic),
2026-03-10 00:17:43 +03:00
/// Private execution.
2025-10-14 10:18:54 +03:00
#[command(subcommand)]
Private(TokenProgramSubcommandPrivate),
2026-03-10 00:17:43 +03:00
/// Deshielded execution.
2025-10-20 09:10:54 +03:00
#[command(subcommand)]
Deshielded(TokenProgramSubcommandDeshielded),
2026-03-10 00:17:43 +03:00
/// Shielded execution.
2025-10-20 09:10:54 +03:00
#[command(subcommand)]
Shielded(TokenProgramSubcommandShielded),
2025-10-14 10:18:54 +03:00
}
2026-03-10 00:17:43 +03:00
/// Represents generic public CLI subcommand for a wallet working with `token_program`.
2025-10-14 10:18:54 +03:00
#[derive(Subcommand, Debug, Clone)]
pub enum TokenProgramSubcommandPublic {
2025-11-26 00:27:20 +03:00
// Transfer tokens using the token program
2025-10-13 17:25:36 +03:00
TransferToken {
#[arg(short, long)]
feat(wallet): add keycard support for public accounts for public/privacy txs for program facades (#461) * feat: add basic commands for communicating with keycard * initialize changes * reorganization * add script file for easier wallet access * update commands * fixes * fixed load for non continuous run * Updates for signatures with keycard * fix BIP-340 signatures for fixed sized messages * fmt * refactor and add pin support to program facades * fix unit test * fixes * Revert "fixes" This reverts commit 41f34f4ff4145b7abb60fd9bec168ae4b60f23b4. * fixes * fixes * Removed privacy keycard calls * Revert "Removed privacy keycard calls" This reverts commit d70ef505a1f40b87159099761f5fce5a31e3f17b. * Add domain separators * Removed privacy txs for keycard * CI fixes * CI fixes * addressed some comments * fix ci * initialize branch * ci fixes * fix integration test issue and updated keycard firmware * addressed more comments * fixed deny * remove keycard-py * fixed from earlier merge * add hash_message tests * add test * fix deny * CI fixes * fixed integration tests * Update public.rs * update artifacts * privacy command fixes * ci and comments * addressed comments * comment fixes * fixes from merging main * adding support to other programs * expanded support * ci fixes * ci and add private account keys test * some fixes and setup notes * Ci fixes * ci fixes * update key paths to avoid collisions in tests * added separated files for keycard_tests_2.sh * first round of comments * Revert "Merge branch 'main' into marvin/keycard-commands" This reverts commit 3fce53f663a3996938dddf77680854570063ca21, reversing changes made to e7b42a5177641455a8917bd2e29db20afd9690e5. * python comments * addressed comments * compile error fixed * fix artifacts * fix main merge error * adjust signer logic workflow * updating logic * fmt * refactored * clippy fix * minor fix * addressing comments * minor fix * ci fix * addressed deferred comments * clean up * minor cleanup * ci fixes * fmt fix * feat!(wallet): Merged `SigningGroup` with `AccountManager` (#500) * feat: account manager extension * feat(wallet): added unified way of sending public transactions to all facades * fix(wallet): no sign option added * fix(deny): deny fix * fix(wallet): suggestion 1 * fix(wallet): suggestion fix 1 * feat!: Add new path for externally provided seed to the circuit. BREAKING CHANGE: add identity variants to the circuit and change semantics for `Claim::Authorized` for private PDAs * feat(ci): use separate job per each integration tests module * feat(ci): cache rust artifacts * feat(ci): build integration tests binary once and reuse it * fix(wallet): fmt * ci: add bench-regression workflow with criterion-compare for crypto_primitives_bench * fix(wallet): merge postfix * feat!(wallet): SigningGroup merged with AccountManager * fix(ci): deny and artifacts fix * fix(deny): deny fix * fix keycard and lint --------- Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com> Co-authored-by: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> * addressed comments * minor comments * Rebase to main * CI fixes --------- Co-authored-by: Pravdyvy <46261001+Pravdyvy@users.noreply.github.com> Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com>
2026-06-05 17:35:10 -04:00
sender_account_id: CliAccountMention,
2025-10-13 17:25:36 +03:00
#[arg(short, long)]
feat(wallet): add keycard support for public accounts for public/privacy txs for program facades (#461) * feat: add basic commands for communicating with keycard * initialize changes * reorganization * add script file for easier wallet access * update commands * fixes * fixed load for non continuous run * Updates for signatures with keycard * fix BIP-340 signatures for fixed sized messages * fmt * refactor and add pin support to program facades * fix unit test * fixes * Revert "fixes" This reverts commit 41f34f4ff4145b7abb60fd9bec168ae4b60f23b4. * fixes * fixes * Removed privacy keycard calls * Revert "Removed privacy keycard calls" This reverts commit d70ef505a1f40b87159099761f5fce5a31e3f17b. * Add domain separators * Removed privacy txs for keycard * CI fixes * CI fixes * addressed some comments * fix ci * initialize branch * ci fixes * fix integration test issue and updated keycard firmware * addressed more comments * fixed deny * remove keycard-py * fixed from earlier merge * add hash_message tests * add test * fix deny * CI fixes * fixed integration tests * Update public.rs * update artifacts * privacy command fixes * ci and comments * addressed comments * comment fixes * fixes from merging main * adding support to other programs * expanded support * ci fixes * ci and add private account keys test * some fixes and setup notes * Ci fixes * ci fixes * update key paths to avoid collisions in tests * added separated files for keycard_tests_2.sh * first round of comments * Revert "Merge branch 'main' into marvin/keycard-commands" This reverts commit 3fce53f663a3996938dddf77680854570063ca21, reversing changes made to e7b42a5177641455a8917bd2e29db20afd9690e5. * python comments * addressed comments * compile error fixed * fix artifacts * fix main merge error * adjust signer logic workflow * updating logic * fmt * refactored * clippy fix * minor fix * addressing comments * minor fix * ci fix * addressed deferred comments * clean up * minor cleanup * ci fixes * fmt fix * feat!(wallet): Merged `SigningGroup` with `AccountManager` (#500) * feat: account manager extension * feat(wallet): added unified way of sending public transactions to all facades * fix(wallet): no sign option added * fix(deny): deny fix * fix(wallet): suggestion 1 * fix(wallet): suggestion fix 1 * feat!: Add new path for externally provided seed to the circuit. BREAKING CHANGE: add identity variants to the circuit and change semantics for `Claim::Authorized` for private PDAs * feat(ci): use separate job per each integration tests module * feat(ci): cache rust artifacts * feat(ci): build integration tests binary once and reuse it * fix(wallet): fmt * ci: add bench-regression workflow with criterion-compare for crypto_primitives_bench * fix(wallet): merge postfix * feat!(wallet): SigningGroup merged with AccountManager * fix(ci): deny and artifacts fix * fix(deny): deny fix * fix keycard and lint --------- Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com> Co-authored-by: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> * addressed comments * minor comments * Rebase to main * CI fixes --------- Co-authored-by: Pravdyvy <46261001+Pravdyvy@users.noreply.github.com> Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com>
2026-06-05 17:35:10 -04:00
recipient_account_id: CliAccountMention,
2025-10-13 17:25:36 +03:00
#[arg(short, long)]
balance_to_move: u128,
},
2025-12-11 14:46:16 +02:00
// Burn tokens using the token program
BurnToken {
#[arg(short, long)]
definition_account_id: AccountId,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
feat(wallet): add keycard support for public accounts for public/privacy txs for program facades (#461) * feat: add basic commands for communicating with keycard * initialize changes * reorganization * add script file for easier wallet access * update commands * fixes * fixed load for non continuous run * Updates for signatures with keycard * fix BIP-340 signatures for fixed sized messages * fmt * refactor and add pin support to program facades * fix unit test * fixes * Revert "fixes" This reverts commit 41f34f4ff4145b7abb60fd9bec168ae4b60f23b4. * fixes * fixes * Removed privacy keycard calls * Revert "Removed privacy keycard calls" This reverts commit d70ef505a1f40b87159099761f5fce5a31e3f17b. * Add domain separators * Removed privacy txs for keycard * CI fixes * CI fixes * addressed some comments * fix ci * initialize branch * ci fixes * fix integration test issue and updated keycard firmware * addressed more comments * fixed deny * remove keycard-py * fixed from earlier merge * add hash_message tests * add test * fix deny * CI fixes * fixed integration tests * Update public.rs * update artifacts * privacy command fixes * ci and comments * addressed comments * comment fixes * fixes from merging main * adding support to other programs * expanded support * ci fixes * ci and add private account keys test * some fixes and setup notes * Ci fixes * ci fixes * update key paths to avoid collisions in tests * added separated files for keycard_tests_2.sh * first round of comments * Revert "Merge branch 'main' into marvin/keycard-commands" This reverts commit 3fce53f663a3996938dddf77680854570063ca21, reversing changes made to e7b42a5177641455a8917bd2e29db20afd9690e5. * python comments * addressed comments * compile error fixed * fix artifacts * fix main merge error * adjust signer logic workflow * updating logic * fmt * refactored * clippy fix * minor fix * addressing comments * minor fix * ci fix * addressed deferred comments * clean up * minor cleanup * ci fixes * fmt fix * feat!(wallet): Merged `SigningGroup` with `AccountManager` (#500) * feat: account manager extension * feat(wallet): added unified way of sending public transactions to all facades * fix(wallet): no sign option added * fix(deny): deny fix * fix(wallet): suggestion 1 * fix(wallet): suggestion fix 1 * feat!: Add new path for externally provided seed to the circuit. BREAKING CHANGE: add identity variants to the circuit and change semantics for `Claim::Authorized` for private PDAs * feat(ci): use separate job per each integration tests module * feat(ci): cache rust artifacts * feat(ci): build integration tests binary once and reuse it * fix(wallet): fmt * ci: add bench-regression workflow with criterion-compare for crypto_primitives_bench * fix(wallet): merge postfix * feat!(wallet): SigningGroup merged with AccountManager * fix(ci): deny and artifacts fix * fix(deny): deny fix * fix keycard and lint --------- Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com> Co-authored-by: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> * addressed comments * minor comments * Rebase to main * CI fixes --------- Co-authored-by: Pravdyvy <46261001+Pravdyvy@users.noreply.github.com> Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com>
2026-06-05 17:35:10 -04:00
holder_account_id: CliAccountMention,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
amount: u128,
},
// Transfer tokens using the token program
MintToken {
#[arg(short, long)]
feat(wallet): add keycard support for public accounts for public/privacy txs for program facades (#461) * feat: add basic commands for communicating with keycard * initialize changes * reorganization * add script file for easier wallet access * update commands * fixes * fixed load for non continuous run * Updates for signatures with keycard * fix BIP-340 signatures for fixed sized messages * fmt * refactor and add pin support to program facades * fix unit test * fixes * Revert "fixes" This reverts commit 41f34f4ff4145b7abb60fd9bec168ae4b60f23b4. * fixes * fixes * Removed privacy keycard calls * Revert "Removed privacy keycard calls" This reverts commit d70ef505a1f40b87159099761f5fce5a31e3f17b. * Add domain separators * Removed privacy txs for keycard * CI fixes * CI fixes * addressed some comments * fix ci * initialize branch * ci fixes * fix integration test issue and updated keycard firmware * addressed more comments * fixed deny * remove keycard-py * fixed from earlier merge * add hash_message tests * add test * fix deny * CI fixes * fixed integration tests * Update public.rs * update artifacts * privacy command fixes * ci and comments * addressed comments * comment fixes * fixes from merging main * adding support to other programs * expanded support * ci fixes * ci and add private account keys test * some fixes and setup notes * Ci fixes * ci fixes * update key paths to avoid collisions in tests * added separated files for keycard_tests_2.sh * first round of comments * Revert "Merge branch 'main' into marvin/keycard-commands" This reverts commit 3fce53f663a3996938dddf77680854570063ca21, reversing changes made to e7b42a5177641455a8917bd2e29db20afd9690e5. * python comments * addressed comments * compile error fixed * fix artifacts * fix main merge error * adjust signer logic workflow * updating logic * fmt * refactored * clippy fix * minor fix * addressing comments * minor fix * ci fix * addressed deferred comments * clean up * minor cleanup * ci fixes * fmt fix * feat!(wallet): Merged `SigningGroup` with `AccountManager` (#500) * feat: account manager extension * feat(wallet): added unified way of sending public transactions to all facades * fix(wallet): no sign option added * fix(deny): deny fix * fix(wallet): suggestion 1 * fix(wallet): suggestion fix 1 * feat!: Add new path for externally provided seed to the circuit. BREAKING CHANGE: add identity variants to the circuit and change semantics for `Claim::Authorized` for private PDAs * feat(ci): use separate job per each integration tests module * feat(ci): cache rust artifacts * feat(ci): build integration tests binary once and reuse it * fix(wallet): fmt * ci: add bench-regression workflow with criterion-compare for crypto_primitives_bench * fix(wallet): merge postfix * feat!(wallet): SigningGroup merged with AccountManager * fix(ci): deny and artifacts fix * fix(deny): deny fix * fix keycard and lint --------- Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com> Co-authored-by: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> * addressed comments * minor comments * Rebase to main * CI fixes --------- Co-authored-by: Pravdyvy <46261001+Pravdyvy@users.noreply.github.com> Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com>
2026-06-05 17:35:10 -04:00
definition_account_id: CliAccountMention,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
feat(wallet): add keycard support for public accounts for public/privacy txs for program facades (#461) * feat: add basic commands for communicating with keycard * initialize changes * reorganization * add script file for easier wallet access * update commands * fixes * fixed load for non continuous run * Updates for signatures with keycard * fix BIP-340 signatures for fixed sized messages * fmt * refactor and add pin support to program facades * fix unit test * fixes * Revert "fixes" This reverts commit 41f34f4ff4145b7abb60fd9bec168ae4b60f23b4. * fixes * fixes * Removed privacy keycard calls * Revert "Removed privacy keycard calls" This reverts commit d70ef505a1f40b87159099761f5fce5a31e3f17b. * Add domain separators * Removed privacy txs for keycard * CI fixes * CI fixes * addressed some comments * fix ci * initialize branch * ci fixes * fix integration test issue and updated keycard firmware * addressed more comments * fixed deny * remove keycard-py * fixed from earlier merge * add hash_message tests * add test * fix deny * CI fixes * fixed integration tests * Update public.rs * update artifacts * privacy command fixes * ci and comments * addressed comments * comment fixes * fixes from merging main * adding support to other programs * expanded support * ci fixes * ci and add private account keys test * some fixes and setup notes * Ci fixes * ci fixes * update key paths to avoid collisions in tests * added separated files for keycard_tests_2.sh * first round of comments * Revert "Merge branch 'main' into marvin/keycard-commands" This reverts commit 3fce53f663a3996938dddf77680854570063ca21, reversing changes made to e7b42a5177641455a8917bd2e29db20afd9690e5. * python comments * addressed comments * compile error fixed * fix artifacts * fix main merge error * adjust signer logic workflow * updating logic * fmt * refactored * clippy fix * minor fix * addressing comments * minor fix * ci fix * addressed deferred comments * clean up * minor cleanup * ci fixes * fmt fix * feat!(wallet): Merged `SigningGroup` with `AccountManager` (#500) * feat: account manager extension * feat(wallet): added unified way of sending public transactions to all facades * fix(wallet): no sign option added * fix(deny): deny fix * fix(wallet): suggestion 1 * fix(wallet): suggestion fix 1 * feat!: Add new path for externally provided seed to the circuit. BREAKING CHANGE: add identity variants to the circuit and change semantics for `Claim::Authorized` for private PDAs * feat(ci): use separate job per each integration tests module * feat(ci): cache rust artifacts * feat(ci): build integration tests binary once and reuse it * fix(wallet): fmt * ci: add bench-regression workflow with criterion-compare for crypto_primitives_bench * fix(wallet): merge postfix * feat!(wallet): SigningGroup merged with AccountManager * fix(ci): deny and artifacts fix * fix(deny): deny fix * fix keycard and lint --------- Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com> Co-authored-by: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> * addressed comments * minor comments * Rebase to main * CI fixes --------- Co-authored-by: Pravdyvy <46261001+Pravdyvy@users.noreply.github.com> Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com>
2026-06-05 17:35:10 -04:00
holder_account_id: CliAccountMention,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
amount: u128,
},
2025-10-14 10:18:54 +03:00
}
2026-03-10 00:17:43 +03:00
/// Represents generic private CLI subcommand for a wallet working with `token_program`.
2025-10-14 10:18:54 +03:00
#[derive(Subcommand, Debug, Clone)]
pub enum TokenProgramSubcommandPrivate {
2025-11-26 00:27:20 +03:00
// Transfer tokens using the token program
2025-10-14 10:18:54 +03:00
TransferTokenPrivateOwned {
2025-10-13 17:25:36 +03:00
#[arg(short, long)]
sender_account_id: AccountId,
2025-10-13 17:25:36 +03:00
#[arg(short, long)]
recipient_account_id: AccountId,
2025-10-13 17:25:36 +03:00
#[arg(short, long)]
balance_to_move: u128,
},
2025-11-26 00:27:20 +03:00
// Transfer tokens using the token program
2025-10-13 17:25:36 +03:00
TransferTokenPrivateForeign {
#[arg(short, long)]
sender_account_id: AccountId,
2026-03-10 00:17:43 +03:00
/// `recipient_npk` - valid 32 byte hex string.
2025-10-13 17:25:36 +03:00
#[arg(long)]
recipient_npk: String,
/// `recipient_vpk` - valid hex-encoded ML-KEM-768 encapsulation key (1184 bytes).
2025-10-13 17:25:36 +03:00
#[arg(long)]
2026-01-21 17:58:45 -05:00
recipient_vpk: String,
/// Identifier for the recipient's private account.
#[arg(long)]
recipient_identifier: Option<u128>,
2025-10-13 17:25:36 +03:00
#[arg(short, long)]
balance_to_move: u128,
},
2025-12-11 14:46:16 +02:00
// Burn tokens using the token program
BurnTokenPrivateOwned {
#[arg(short, long)]
definition_account_id: AccountId,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
holder_account_id: AccountId,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
amount: u128,
},
// Transfer tokens using the token program
MintTokenPrivateOwned {
#[arg(short, long)]
definition_account_id: AccountId,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
holder_account_id: AccountId,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
amount: u128,
},
// Transfer tokens using the token program
MintTokenPrivateForeign {
#[arg(short, long)]
definition_account_id: AccountId,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
holder_npk: String,
#[arg(short, long)]
2026-01-21 17:58:45 -05:00
holder_vpk: String,
/// Identifier for the holder's private account.
#[arg(long)]
holder_identifier: Option<u128>,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
amount: u128,
},
2025-10-13 17:25:36 +03:00
}
2026-03-10 00:17:43 +03:00
/// Represents deshielded public CLI subcommand for a wallet working with `token_program`.
2025-10-20 09:10:54 +03:00
#[derive(Subcommand, Debug, Clone)]
pub enum TokenProgramSubcommandDeshielded {
2025-11-26 00:27:20 +03:00
// Transfer tokens using the token program
2025-10-20 09:10:54 +03:00
TransferTokenDeshielded {
#[arg(short, long)]
sender_account_id: AccountId,
2025-10-20 09:10:54 +03:00
#[arg(short, long)]
recipient_account_id: AccountId,
2025-10-20 09:10:54 +03:00
#[arg(short, long)]
balance_to_move: u128,
},
2025-12-11 14:46:16 +02:00
// Burn tokens using the token program
BurnTokenDeshieldedOwned {
#[arg(short, long)]
definition_account_id: AccountId,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
holder_account_id: AccountId,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
amount: u128,
},
// Transfer tokens using the token program
MintTokenDeshielded {
#[arg(short, long)]
definition_account_id: AccountId,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
holder_account_id: AccountId,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
amount: u128,
},
2025-10-20 09:10:54 +03:00
}
2026-03-10 00:17:43 +03:00
/// Represents generic shielded CLI subcommand for a wallet working with `token_program`.
2025-10-20 09:10:54 +03:00
#[derive(Subcommand, Debug, Clone)]
pub enum TokenProgramSubcommandShielded {
2025-11-26 00:27:20 +03:00
// Transfer tokens using the token program
2025-10-20 09:10:54 +03:00
TransferTokenShieldedOwned {
feat(wallet): add keycard support for public accounts for public/privacy txs for program facades (#461) * feat: add basic commands for communicating with keycard * initialize changes * reorganization * add script file for easier wallet access * update commands * fixes * fixed load for non continuous run * Updates for signatures with keycard * fix BIP-340 signatures for fixed sized messages * fmt * refactor and add pin support to program facades * fix unit test * fixes * Revert "fixes" This reverts commit 41f34f4ff4145b7abb60fd9bec168ae4b60f23b4. * fixes * fixes * Removed privacy keycard calls * Revert "Removed privacy keycard calls" This reverts commit d70ef505a1f40b87159099761f5fce5a31e3f17b. * Add domain separators * Removed privacy txs for keycard * CI fixes * CI fixes * addressed some comments * fix ci * initialize branch * ci fixes * fix integration test issue and updated keycard firmware * addressed more comments * fixed deny * remove keycard-py * fixed from earlier merge * add hash_message tests * add test * fix deny * CI fixes * fixed integration tests * Update public.rs * update artifacts * privacy command fixes * ci and comments * addressed comments * comment fixes * fixes from merging main * adding support to other programs * expanded support * ci fixes * ci and add private account keys test * some fixes and setup notes * Ci fixes * ci fixes * update key paths to avoid collisions in tests * added separated files for keycard_tests_2.sh * first round of comments * Revert "Merge branch 'main' into marvin/keycard-commands" This reverts commit 3fce53f663a3996938dddf77680854570063ca21, reversing changes made to e7b42a5177641455a8917bd2e29db20afd9690e5. * python comments * addressed comments * compile error fixed * fix artifacts * fix main merge error * adjust signer logic workflow * updating logic * fmt * refactored * clippy fix * minor fix * addressing comments * minor fix * ci fix * addressed deferred comments * clean up * minor cleanup * ci fixes * fmt fix * feat!(wallet): Merged `SigningGroup` with `AccountManager` (#500) * feat: account manager extension * feat(wallet): added unified way of sending public transactions to all facades * fix(wallet): no sign option added * fix(deny): deny fix * fix(wallet): suggestion 1 * fix(wallet): suggestion fix 1 * feat!: Add new path for externally provided seed to the circuit. BREAKING CHANGE: add identity variants to the circuit and change semantics for `Claim::Authorized` for private PDAs * feat(ci): use separate job per each integration tests module * feat(ci): cache rust artifacts * feat(ci): build integration tests binary once and reuse it * fix(wallet): fmt * ci: add bench-regression workflow with criterion-compare for crypto_primitives_bench * fix(wallet): merge postfix * feat!(wallet): SigningGroup merged with AccountManager * fix(ci): deny and artifacts fix * fix(deny): deny fix * fix keycard and lint --------- Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com> Co-authored-by: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> * addressed comments * minor comments * Rebase to main * CI fixes --------- Co-authored-by: Pravdyvy <46261001+Pravdyvy@users.noreply.github.com> Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com>
2026-06-05 17:35:10 -04:00
#[arg(skip)]
sender: Option<AccountIdentity>,
2025-10-20 09:10:54 +03:00
#[arg(short, long)]
recipient_account_id: AccountId,
2025-10-20 09:10:54 +03:00
#[arg(short, long)]
balance_to_move: u128,
},
2025-11-26 00:27:20 +03:00
// Transfer tokens using the token program
2025-10-20 09:10:54 +03:00
TransferTokenShieldedForeign {
feat(wallet): add keycard support for public accounts for public/privacy txs for program facades (#461) * feat: add basic commands for communicating with keycard * initialize changes * reorganization * add script file for easier wallet access * update commands * fixes * fixed load for non continuous run * Updates for signatures with keycard * fix BIP-340 signatures for fixed sized messages * fmt * refactor and add pin support to program facades * fix unit test * fixes * Revert "fixes" This reverts commit 41f34f4ff4145b7abb60fd9bec168ae4b60f23b4. * fixes * fixes * Removed privacy keycard calls * Revert "Removed privacy keycard calls" This reverts commit d70ef505a1f40b87159099761f5fce5a31e3f17b. * Add domain separators * Removed privacy txs for keycard * CI fixes * CI fixes * addressed some comments * fix ci * initialize branch * ci fixes * fix integration test issue and updated keycard firmware * addressed more comments * fixed deny * remove keycard-py * fixed from earlier merge * add hash_message tests * add test * fix deny * CI fixes * fixed integration tests * Update public.rs * update artifacts * privacy command fixes * ci and comments * addressed comments * comment fixes * fixes from merging main * adding support to other programs * expanded support * ci fixes * ci and add private account keys test * some fixes and setup notes * Ci fixes * ci fixes * update key paths to avoid collisions in tests * added separated files for keycard_tests_2.sh * first round of comments * Revert "Merge branch 'main' into marvin/keycard-commands" This reverts commit 3fce53f663a3996938dddf77680854570063ca21, reversing changes made to e7b42a5177641455a8917bd2e29db20afd9690e5. * python comments * addressed comments * compile error fixed * fix artifacts * fix main merge error * adjust signer logic workflow * updating logic * fmt * refactored * clippy fix * minor fix * addressing comments * minor fix * ci fix * addressed deferred comments * clean up * minor cleanup * ci fixes * fmt fix * feat!(wallet): Merged `SigningGroup` with `AccountManager` (#500) * feat: account manager extension * feat(wallet): added unified way of sending public transactions to all facades * fix(wallet): no sign option added * fix(deny): deny fix * fix(wallet): suggestion 1 * fix(wallet): suggestion fix 1 * feat!: Add new path for externally provided seed to the circuit. BREAKING CHANGE: add identity variants to the circuit and change semantics for `Claim::Authorized` for private PDAs * feat(ci): use separate job per each integration tests module * feat(ci): cache rust artifacts * feat(ci): build integration tests binary once and reuse it * fix(wallet): fmt * ci: add bench-regression workflow with criterion-compare for crypto_primitives_bench * fix(wallet): merge postfix * feat!(wallet): SigningGroup merged with AccountManager * fix(ci): deny and artifacts fix * fix(deny): deny fix * fix keycard and lint --------- Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com> Co-authored-by: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> * addressed comments * minor comments * Rebase to main * CI fixes --------- Co-authored-by: Pravdyvy <46261001+Pravdyvy@users.noreply.github.com> Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com>
2026-06-05 17:35:10 -04:00
#[arg(skip)]
sender: Option<AccountIdentity>,
2026-03-10 00:17:43 +03:00
/// `recipient_npk` - valid 32 byte hex string.
2025-10-20 09:10:54 +03:00
#[arg(long)]
recipient_npk: String,
/// `recipient_vpk` - valid hex-encoded ML-KEM-768 encapsulation key (1184 bytes).
2025-10-20 09:10:54 +03:00
#[arg(long)]
2026-01-21 17:58:45 -05:00
recipient_vpk: String,
/// Identifier for the recipient's private account.
#[arg(long)]
recipient_identifier: Option<u128>,
2025-10-20 09:10:54 +03:00
#[arg(short, long)]
balance_to_move: u128,
},
2025-12-11 14:46:16 +02:00
// Burn tokens using the token program
BurnTokenShielded {
#[arg(short, long)]
definition_account_id: AccountId,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
holder_account_id: AccountId,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
amount: u128,
},
// Transfer tokens using the token program
MintTokenShieldedOwned {
#[arg(short, long)]
definition_account_id: AccountId,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
holder_account_id: AccountId,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
amount: u128,
},
// Transfer tokens using the token program
MintTokenShieldedForeign {
#[arg(short, long)]
definition_account_id: AccountId,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
holder_npk: String,
#[arg(short, long)]
2026-01-21 17:58:45 -05:00
holder_vpk: String,
/// Identifier for the holder's private account.
#[arg(long)]
holder_identifier: Option<u128>,
2025-12-11 14:46:16 +02:00
#[arg(short, long)]
amount: u128,
},
2025-10-20 09:10:54 +03:00
}
2026-03-10 00:17:43 +03:00
/// Represents generic initialization subcommand for a wallet working with `token_program`.
2025-12-02 15:27:20 +02:00
#[derive(Subcommand, Debug, Clone)]
pub enum CreateNewTokenProgramSubcommand {
2026-03-10 00:17:43 +03:00
/// Create a new token using the token program.
2025-12-02 15:27:20 +02:00
///
2026-03-10 00:17:43 +03:00
/// Definition - public, supply - public.
2025-12-02 15:27:20 +02:00
NewPublicDefPublicSupp {
#[arg(short, long)]
feat(wallet): add keycard support for public accounts for public/privacy txs for program facades (#461) * feat: add basic commands for communicating with keycard * initialize changes * reorganization * add script file for easier wallet access * update commands * fixes * fixed load for non continuous run * Updates for signatures with keycard * fix BIP-340 signatures for fixed sized messages * fmt * refactor and add pin support to program facades * fix unit test * fixes * Revert "fixes" This reverts commit 41f34f4ff4145b7abb60fd9bec168ae4b60f23b4. * fixes * fixes * Removed privacy keycard calls * Revert "Removed privacy keycard calls" This reverts commit d70ef505a1f40b87159099761f5fce5a31e3f17b. * Add domain separators * Removed privacy txs for keycard * CI fixes * CI fixes * addressed some comments * fix ci * initialize branch * ci fixes * fix integration test issue and updated keycard firmware * addressed more comments * fixed deny * remove keycard-py * fixed from earlier merge * add hash_message tests * add test * fix deny * CI fixes * fixed integration tests * Update public.rs * update artifacts * privacy command fixes * ci and comments * addressed comments * comment fixes * fixes from merging main * adding support to other programs * expanded support * ci fixes * ci and add private account keys test * some fixes and setup notes * Ci fixes * ci fixes * update key paths to avoid collisions in tests * added separated files for keycard_tests_2.sh * first round of comments * Revert "Merge branch 'main' into marvin/keycard-commands" This reverts commit 3fce53f663a3996938dddf77680854570063ca21, reversing changes made to e7b42a5177641455a8917bd2e29db20afd9690e5. * python comments * addressed comments * compile error fixed * fix artifacts * fix main merge error * adjust signer logic workflow * updating logic * fmt * refactored * clippy fix * minor fix * addressing comments * minor fix * ci fix * addressed deferred comments * clean up * minor cleanup * ci fixes * fmt fix * feat!(wallet): Merged `SigningGroup` with `AccountManager` (#500) * feat: account manager extension * feat(wallet): added unified way of sending public transactions to all facades * fix(wallet): no sign option added * fix(deny): deny fix * fix(wallet): suggestion 1 * fix(wallet): suggestion fix 1 * feat!: Add new path for externally provided seed to the circuit. BREAKING CHANGE: add identity variants to the circuit and change semantics for `Claim::Authorized` for private PDAs * feat(ci): use separate job per each integration tests module * feat(ci): cache rust artifacts * feat(ci): build integration tests binary once and reuse it * fix(wallet): fmt * ci: add bench-regression workflow with criterion-compare for crypto_primitives_bench * fix(wallet): merge postfix * feat!(wallet): SigningGroup merged with AccountManager * fix(ci): deny and artifacts fix * fix(deny): deny fix * fix keycard and lint --------- Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com> Co-authored-by: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> * addressed comments * minor comments * Rebase to main * CI fixes --------- Co-authored-by: Pravdyvy <46261001+Pravdyvy@users.noreply.github.com> Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com>
2026-06-05 17:35:10 -04:00
definition_account_id: CliAccountMention,
2025-12-02 15:27:20 +02:00
#[arg(short, long)]
feat(wallet): add keycard support for public accounts for public/privacy txs for program facades (#461) * feat: add basic commands for communicating with keycard * initialize changes * reorganization * add script file for easier wallet access * update commands * fixes * fixed load for non continuous run * Updates for signatures with keycard * fix BIP-340 signatures for fixed sized messages * fmt * refactor and add pin support to program facades * fix unit test * fixes * Revert "fixes" This reverts commit 41f34f4ff4145b7abb60fd9bec168ae4b60f23b4. * fixes * fixes * Removed privacy keycard calls * Revert "Removed privacy keycard calls" This reverts commit d70ef505a1f40b87159099761f5fce5a31e3f17b. * Add domain separators * Removed privacy txs for keycard * CI fixes * CI fixes * addressed some comments * fix ci * initialize branch * ci fixes * fix integration test issue and updated keycard firmware * addressed more comments * fixed deny * remove keycard-py * fixed from earlier merge * add hash_message tests * add test * fix deny * CI fixes * fixed integration tests * Update public.rs * update artifacts * privacy command fixes * ci and comments * addressed comments * comment fixes * fixes from merging main * adding support to other programs * expanded support * ci fixes * ci and add private account keys test * some fixes and setup notes * Ci fixes * ci fixes * update key paths to avoid collisions in tests * added separated files for keycard_tests_2.sh * first round of comments * Revert "Merge branch 'main' into marvin/keycard-commands" This reverts commit 3fce53f663a3996938dddf77680854570063ca21, reversing changes made to e7b42a5177641455a8917bd2e29db20afd9690e5. * python comments * addressed comments * compile error fixed * fix artifacts * fix main merge error * adjust signer logic workflow * updating logic * fmt * refactored * clippy fix * minor fix * addressing comments * minor fix * ci fix * addressed deferred comments * clean up * minor cleanup * ci fixes * fmt fix * feat!(wallet): Merged `SigningGroup` with `AccountManager` (#500) * feat: account manager extension * feat(wallet): added unified way of sending public transactions to all facades * fix(wallet): no sign option added * fix(deny): deny fix * fix(wallet): suggestion 1 * fix(wallet): suggestion fix 1 * feat!: Add new path for externally provided seed to the circuit. BREAKING CHANGE: add identity variants to the circuit and change semantics for `Claim::Authorized` for private PDAs * feat(ci): use separate job per each integration tests module * feat(ci): cache rust artifacts * feat(ci): build integration tests binary once and reuse it * fix(wallet): fmt * ci: add bench-regression workflow with criterion-compare for crypto_primitives_bench * fix(wallet): merge postfix * feat!(wallet): SigningGroup merged with AccountManager * fix(ci): deny and artifacts fix * fix(deny): deny fix * fix keycard and lint --------- Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com> Co-authored-by: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> * addressed comments * minor comments * Rebase to main * CI fixes --------- Co-authored-by: Pravdyvy <46261001+Pravdyvy@users.noreply.github.com> Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com>
2026-06-05 17:35:10 -04:00
supply_account_id: CliAccountMention,
2025-12-02 15:27:20 +02:00
#[arg(short, long)]
name: String,
#[arg(short, long)]
total_supply: u128,
},
2026-03-10 00:17:43 +03:00
/// Create a new token using the token program.
2025-12-02 15:27:20 +02:00
///
2026-03-10 00:17:43 +03:00
/// Definition - public, supply - private.
2025-12-02 15:27:20 +02:00
NewPublicDefPrivateSupp {
#[arg(short, long)]
definition_account_id: AccountId,
2025-12-02 15:27:20 +02:00
#[arg(short, long)]
supply_account_id: AccountId,
2025-12-02 15:27:20 +02:00
#[arg(short, long)]
name: String,
#[arg(short, long)]
total_supply: u128,
},
2026-03-10 00:17:43 +03:00
/// Create a new token using the token program.
2025-12-02 15:27:20 +02:00
///
2026-03-10 00:17:43 +03:00
/// Definition - private, supply - public.
2025-12-02 15:27:20 +02:00
NewPrivateDefPublicSupp {
#[arg(short, long)]
definition_account_id: AccountId,
2025-12-02 15:27:20 +02:00
#[arg(short, long)]
supply_account_id: AccountId,
2025-12-02 15:27:20 +02:00
#[arg(short, long)]
name: String,
#[arg(short, long)]
total_supply: u128,
},
2026-03-10 00:17:43 +03:00
/// Create a new token using the token program.
2025-12-02 15:27:20 +02:00
///
2026-03-10 00:17:43 +03:00
/// Definition - private, supply - private.
2025-12-02 15:27:20 +02:00
NewPrivateDefPrivateSupp {
#[arg(short, long)]
definition_account_id: AccountId,
2025-12-02 15:27:20 +02:00
#[arg(short, long)]
supply_account_id: AccountId,
2025-12-02 15:27:20 +02:00
#[arg(short, long)]
name: String,
#[arg(short, long)]
total_supply: u128,
},
}
2026-06-17 13:53:54 -04:00
impl TokenProgramSubcommandPublic {
async fn handle_transfer_token(
sender_account_id: CliAccountMention,
recipient_account_id: CliAccountMention,
balance_to_move: u128,
2026-06-17 17:34:11 -04:00
wallet_core: &WalletCore,
2026-06-17 13:53:54 -04:00
) -> Result<SubcommandReturnValue> {
let sender = sender_account_id.resolve(wallet_core.storage())?;
let recipient = recipient_account_id.resolve(wallet_core.storage())?;
2026-06-17 17:34:11 -04:00
let (AccountIdWithPrivacy::Public(sender_id), AccountIdWithPrivacy::Public(recipient_id)) =
(sender, recipient)
2026-06-17 13:53:54 -04:00
else {
anyhow::bail!(
"`TokenProgramSubcommandPublic::TransferToken`: Unexpected private account received."
);
};
let tx_hash = Token(wallet_core)
.send_transfer_transaction(
sender_account_id.into_public_identity(sender_id),
recipient_account_id.into_public_identity(recipient_id),
balance_to_move,
)
.await?;
wallet_core
.poll_and_finalize_public_transaction(tx_hash)
.await
}
async fn handle_burn_token(
definition_account_id: AccountId,
holder_account_id: CliAccountMention,
amount: u128,
2026-06-17 17:34:11 -04:00
wallet_core: &WalletCore,
2026-06-17 13:53:54 -04:00
) -> Result<SubcommandReturnValue> {
let holder = holder_account_id.resolve(wallet_core.storage())?;
let AccountIdWithPrivacy::Public(holder_id) = holder else {
anyhow::bail!(
"`TokenProgramSubcommandPublic::BurnToken`: holder account must be public."
);
};
let tx_hash = Token(wallet_core)
.send_burn_transaction(
definition_account_id,
holder_account_id.into_public_identity(holder_id),
amount,
)
.await?;
wallet_core
.poll_and_finalize_public_transaction(tx_hash)
.await
}
async fn handle_mint_token(
definition_account_id: CliAccountMention,
holder_account_id: CliAccountMention,
amount: u128,
2026-06-17 17:34:11 -04:00
wallet_core: &WalletCore,
2026-06-17 13:53:54 -04:00
) -> Result<SubcommandReturnValue> {
let definition = definition_account_id.resolve(wallet_core.storage())?;
let holder = holder_account_id.resolve(wallet_core.storage())?;
let (AccountIdWithPrivacy::Public(def_id), AccountIdWithPrivacy::Public(holder_id)) =
(definition, holder)
else {
anyhow::bail!(
"`TokenProgramSubcommandPublic::MintToken`: holder account must be public."
);
};
let tx_hash = Token(wallet_core)
.send_mint_transaction(
definition_account_id.into_public_identity(def_id),
holder_account_id.into_public_identity(holder_id),
amount,
)
.await?;
wallet_core
.poll_and_finalize_public_transaction(tx_hash)
.await
}
}
2025-10-14 10:18:54 +03:00
impl WalletSubcommand for TokenProgramSubcommandPublic {
2025-10-13 17:25:36 +03:00
async fn handle_subcommand(
self,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
match self {
2026-03-09 18:27:56 +03:00
Self::TransferToken {
sender_account_id,
recipient_account_id,
2025-10-14 10:18:54 +03:00
balance_to_move,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_transfer_token(
sender_account_id,
recipient_account_id,
balance_to_move,
wallet_core,
)
.await
2025-10-14 10:18:54 +03:00
}
2026-03-09 18:27:56 +03:00
Self::BurnToken {
2025-12-11 14:46:16 +02:00
definition_account_id,
holder_account_id,
amount,
} => {
2026-06-17 17:34:11 -04:00
Self::handle_burn_token(
definition_account_id,
holder_account_id,
amount,
wallet_core,
)
.await
2025-12-11 14:46:16 +02:00
}
2026-03-09 18:27:56 +03:00
Self::MintToken {
2025-12-11 14:46:16 +02:00
definition_account_id,
holder_account_id,
amount,
} => {
2026-06-17 17:34:11 -04:00
Self::handle_mint_token(
definition_account_id,
holder_account_id,
amount,
wallet_core,
)
.await
2025-12-11 14:46:16 +02:00
}
2025-10-14 10:18:54 +03:00
}
}
}
2026-06-17 13:53:54 -04:00
impl TokenProgramSubcommandPrivate {
async fn handle_transfer_token_private_owned(
sender_account_id: AccountId,
recipient_account_id: AccountId,
balance_to_move: u128,
2025-10-14 10:18:54 +03:00
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
2026-06-17 13:53:54 -04:00
let (tx_hash, [secret_sender, secret_recipient]) = Token(wallet_core)
.send_transfer_transaction_private_owned_account(
sender_account_id,
recipient_account_id,
2025-10-13 17:25:36 +03:00
balance_to_move,
2026-06-17 13:53:54 -04:00
)
.await?;
wallet_core
2026-06-17 17:34:11 -04:00
.poll_and_finalize_pp_transaction(
tx_hash,
&[
Decode(secret_sender, sender_account_id),
Decode(secret_recipient, recipient_account_id),
],
)
2026-06-17 13:53:54 -04:00
.await
}
2025-10-13 17:25:36 +03:00
2026-06-17 13:53:54 -04:00
async fn handle_transfer_token_private_foreign(
sender_account_id: AccountId,
recipient_npk: String,
recipient_vpk: String,
recipient_identifier: Option<u128>,
balance_to_move: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let (recipient_npk, recipient_vpk) =
crate::cli::decode_npk_vpk(&recipient_npk, &recipient_vpk)?;
let (tx_hash, [secret_sender, _]) = Token(wallet_core)
.send_transfer_transaction_private_foreign_account(
sender_account_id,
recipient_npk,
recipient_vpk,
recipient_identifier.unwrap_or_else(rand::random),
balance_to_move,
)
.await?;
wallet_core
2026-06-17 17:34:11 -04:00
.poll_and_finalize_pp_transaction(tx_hash, &[Decode(secret_sender, sender_account_id)])
2026-06-17 13:53:54 -04:00
.await
}
2025-10-13 17:25:36 +03:00
2026-06-17 13:53:54 -04:00
async fn handle_burn_token_private_owned(
definition_account_id: AccountId,
holder_account_id: AccountId,
amount: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let (tx_hash, [secret_definition, secret_holder]) = Token(wallet_core)
.send_burn_transaction_private_owned_account(
definition_account_id,
holder_account_id,
amount,
)
.await?;
wallet_core
2026-06-17 17:34:11 -04:00
.poll_and_finalize_pp_transaction(
tx_hash,
&[
Decode(secret_definition, definition_account_id),
Decode(secret_holder, holder_account_id),
],
)
2026-06-17 13:53:54 -04:00
.await
}
2025-10-13 17:25:36 +03:00
2026-06-17 13:53:54 -04:00
async fn handle_mint_token_private_owned(
definition_account_id: AccountId,
holder_account_id: AccountId,
amount: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let (tx_hash, [secret_definition, secret_holder]) = Token(wallet_core)
.send_mint_transaction_private_owned_account(
definition_account_id,
holder_account_id,
amount,
)
.await?;
wallet_core
2026-06-17 17:34:11 -04:00
.poll_and_finalize_pp_transaction(
tx_hash,
&[
Decode(secret_definition, definition_account_id),
Decode(secret_holder, holder_account_id),
],
)
2026-06-17 13:53:54 -04:00
.await
}
2025-10-14 10:18:54 +03:00
2026-06-17 13:53:54 -04:00
async fn handle_mint_token_private_foreign(
definition_account_id: AccountId,
holder_npk: String,
holder_vpk: String,
holder_identifier: Option<u128>,
amount: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
2026-06-17 17:34:11 -04:00
let (holder_npk, holder_vpk) = crate::cli::decode_npk_vpk(&holder_npk, &holder_vpk)?;
2025-10-13 17:25:36 +03:00
2026-06-17 13:53:54 -04:00
let (tx_hash, [secret_definition, _]) = Token(wallet_core)
.send_mint_transaction_private_foreign_account(
definition_account_id,
holder_npk,
holder_vpk,
holder_identifier.unwrap_or_else(rand::random),
amount,
)
.await?;
wallet_core
2026-06-17 17:34:11 -04:00
.poll_and_finalize_pp_transaction(
tx_hash,
&[Decode(secret_definition, definition_account_id)],
)
2026-06-17 13:53:54 -04:00
.await
}
}
2025-10-13 17:25:36 +03:00
2026-06-17 13:53:54 -04:00
impl WalletSubcommand for TokenProgramSubcommandPrivate {
async fn handle_subcommand(
self,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
match self {
Self::TransferTokenPrivateOwned {
sender_account_id,
recipient_account_id,
balance_to_move,
} => {
Self::handle_transfer_token_private_owned(
sender_account_id,
recipient_account_id,
balance_to_move,
wallet_core,
)
.await
2025-10-13 17:25:36 +03:00
}
2026-03-09 18:27:56 +03:00
Self::TransferTokenPrivateForeign {
sender_account_id,
2025-10-13 17:25:36 +03:00
recipient_npk,
2026-01-21 17:58:45 -05:00
recipient_vpk,
recipient_identifier,
2025-10-13 17:25:36 +03:00
balance_to_move,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_transfer_token_private_foreign(
sender_account_id,
recipient_npk,
recipient_vpk,
recipient_identifier,
balance_to_move,
wallet_core,
)
.await
2025-10-13 17:25:36 +03:00
}
2026-03-09 18:27:56 +03:00
Self::BurnTokenPrivateOwned {
2025-12-11 14:46:16 +02:00
definition_account_id,
holder_account_id,
amount,
2025-10-20 09:10:54 +03:00
} => {
2026-06-17 13:53:54 -04:00
Self::handle_burn_token_private_owned(
definition_account_id,
holder_account_id,
amount,
wallet_core,
)
.await
2025-10-20 09:10:54 +03:00
}
2026-03-09 18:27:56 +03:00
Self::MintTokenPrivateOwned {
2025-12-11 14:46:16 +02:00
definition_account_id,
holder_account_id,
amount,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_mint_token_private_owned(
definition_account_id,
holder_account_id,
amount,
wallet_core,
)
.await
2025-12-11 14:46:16 +02:00
}
2026-03-09 18:27:56 +03:00
Self::MintTokenPrivateForeign {
2025-12-11 14:46:16 +02:00
definition_account_id,
holder_npk,
2026-01-21 17:58:45 -05:00
holder_vpk,
holder_identifier,
2025-12-11 14:46:16 +02:00
amount,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_mint_token_private_foreign(
definition_account_id,
holder_npk,
holder_vpk,
holder_identifier,
amount,
wallet_core,
)
.await
}
}
}
}
2025-12-11 14:46:16 +02:00
2026-06-17 13:53:54 -04:00
impl TokenProgramSubcommandDeshielded {
async fn handle_transfer_token_deshielded(
sender_account_id: AccountId,
recipient_account_id: AccountId,
balance_to_move: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let (tx_hash, secret_sender) = Token(wallet_core)
.send_transfer_transaction_deshielded(
sender_account_id,
recipient_account_id,
balance_to_move,
)
.await?;
wallet_core
2026-06-17 17:34:11 -04:00
.poll_and_finalize_pp_transaction(tx_hash, &[Decode(secret_sender, sender_account_id)])
2026-06-17 13:53:54 -04:00
.await
}
2025-12-11 14:46:16 +02:00
2026-06-17 13:53:54 -04:00
async fn handle_burn_token_deshielded_owned(
definition_account_id: AccountId,
holder_account_id: AccountId,
amount: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let (tx_hash, secret_definition) = Token(wallet_core)
.send_burn_transaction_deshielded_owned_account(
definition_account_id,
holder_account_id,
amount,
)
.await?;
wallet_core
2026-06-17 17:34:11 -04:00
.poll_and_finalize_pp_transaction(
tx_hash,
&[Decode(secret_definition, definition_account_id)],
)
2026-06-17 13:53:54 -04:00
.await
}
2025-12-11 14:46:16 +02:00
2026-06-17 13:53:54 -04:00
async fn handle_mint_token_deshielded(
definition_account_id: AccountId,
holder_account_id: AccountId,
amount: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let (tx_hash, secret_definition) = Token(wallet_core)
2026-06-17 17:34:11 -04:00
.send_mint_transaction_deshielded(definition_account_id, holder_account_id, amount)
2026-06-17 13:53:54 -04:00
.await?;
wallet_core
2026-06-17 17:34:11 -04:00
.poll_and_finalize_pp_transaction(
tx_hash,
&[Decode(secret_definition, definition_account_id)],
)
2026-06-17 13:53:54 -04:00
.await
2025-12-11 14:46:16 +02:00
}
}
impl WalletSubcommand for TokenProgramSubcommandDeshielded {
async fn handle_subcommand(
self,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
match self {
2026-03-09 18:27:56 +03:00
Self::TransferTokenDeshielded {
2025-12-11 14:46:16 +02:00
sender_account_id,
recipient_account_id,
balance_to_move,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_transfer_token_deshielded(
sender_account_id,
recipient_account_id,
balance_to_move,
wallet_core,
)
.await
2025-12-11 14:46:16 +02:00
}
2026-03-09 18:27:56 +03:00
Self::BurnTokenDeshieldedOwned {
2025-12-11 14:46:16 +02:00
definition_account_id,
holder_account_id,
amount,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_burn_token_deshielded_owned(
definition_account_id,
holder_account_id,
amount,
wallet_core,
)
.await
2025-12-11 14:46:16 +02:00
}
2026-03-09 18:27:56 +03:00
Self::MintTokenDeshielded {
2025-12-11 14:46:16 +02:00
definition_account_id,
holder_account_id,
amount,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_mint_token_deshielded(
definition_account_id,
holder_account_id,
amount,
wallet_core,
)
.await
}
}
}
}
2025-12-11 14:46:16 +02:00
2026-06-17 13:53:54 -04:00
impl TokenProgramSubcommandShielded {
async fn handle_transfer_token_shielded_foreign(
sender: Option<AccountIdentity>,
recipient_npk: String,
recipient_vpk: String,
recipient_identifier: Option<u128>,
balance_to_move: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let (recipient_npk, recipient_vpk) =
crate::cli::decode_npk_vpk(&recipient_npk, &recipient_vpk)?;
2025-12-11 14:46:16 +02:00
2026-06-17 13:53:54 -04:00
let (tx_hash, _) = Token(wallet_core)
.send_transfer_transaction_shielded_foreign_account(
sender.expect("sender set during Send dispatch"),
recipient_npk,
recipient_vpk,
recipient_identifier.unwrap_or_else(rand::random),
balance_to_move,
)
.await?;
2025-12-11 14:46:16 +02:00
2026-06-17 13:53:54 -04:00
wallet_core
.poll_and_finalize_pp_transaction(tx_hash, &[])
.await
}
2025-12-11 14:46:16 +02:00
2026-06-17 13:53:54 -04:00
async fn handle_transfer_token_shielded_owned(
sender: Option<AccountIdentity>,
recipient_account_id: AccountId,
balance_to_move: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let (tx_hash, secret_recipient) = Token(wallet_core)
.send_transfer_transaction_shielded_owned_account(
sender.expect("sender set during Send dispatch"),
recipient_account_id,
balance_to_move,
)
.await?;
wallet_core
2026-06-17 17:34:11 -04:00
.poll_and_finalize_pp_transaction(
tx_hash,
&[Decode(secret_recipient, recipient_account_id)],
)
2026-06-17 13:53:54 -04:00
.await
}
2025-12-11 14:46:16 +02:00
2026-06-17 13:53:54 -04:00
async fn handle_burn_token_shielded(
definition_account_id: AccountId,
holder_account_id: AccountId,
amount: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let (tx_hash, secret_holder) = Token(wallet_core)
2026-06-17 17:34:11 -04:00
.send_burn_transaction_shielded(definition_account_id, holder_account_id, amount)
2026-06-17 13:53:54 -04:00
.await?;
wallet_core
2026-06-17 17:34:11 -04:00
.poll_and_finalize_pp_transaction(tx_hash, &[Decode(secret_holder, holder_account_id)])
2026-06-17 13:53:54 -04:00
.await
}
2025-12-11 14:46:16 +02:00
2026-06-17 13:53:54 -04:00
async fn handle_mint_token_shielded_owned(
definition_account_id: AccountId,
holder_account_id: AccountId,
amount: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let (tx_hash, secret_holder) = Token(wallet_core)
.send_mint_transaction_shielded_owned_account(
definition_account_id,
holder_account_id,
amount,
)
.await?;
wallet_core
2026-06-17 17:34:11 -04:00
.poll_and_finalize_pp_transaction(tx_hash, &[Decode(secret_holder, holder_account_id)])
2026-06-17 13:53:54 -04:00
.await
}
async fn handle_mint_token_shielded_foreign(
definition_account_id: AccountId,
holder_npk: String,
holder_vpk: String,
holder_identifier: Option<u128>,
amount: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
2026-06-17 17:34:11 -04:00
let (holder_npk, holder_vpk) = crate::cli::decode_npk_vpk(&holder_npk, &holder_vpk)?;
2026-06-17 13:53:54 -04:00
let (tx_hash, _) = Token(wallet_core)
.send_mint_transaction_shielded_foreign_account(
definition_account_id,
holder_npk,
holder_vpk,
holder_identifier.unwrap_or_else(rand::random),
amount,
)
.await?;
wallet_core
.poll_and_finalize_pp_transaction(tx_hash, &[])
.await
2025-12-11 14:46:16 +02:00
}
}
impl WalletSubcommand for TokenProgramSubcommandShielded {
async fn handle_subcommand(
self,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
match self {
2026-03-09 18:27:56 +03:00
Self::TransferTokenShieldedForeign {
feat(wallet): add keycard support for public accounts for public/privacy txs for program facades (#461) * feat: add basic commands for communicating with keycard * initialize changes * reorganization * add script file for easier wallet access * update commands * fixes * fixed load for non continuous run * Updates for signatures with keycard * fix BIP-340 signatures for fixed sized messages * fmt * refactor and add pin support to program facades * fix unit test * fixes * Revert "fixes" This reverts commit 41f34f4ff4145b7abb60fd9bec168ae4b60f23b4. * fixes * fixes * Removed privacy keycard calls * Revert "Removed privacy keycard calls" This reverts commit d70ef505a1f40b87159099761f5fce5a31e3f17b. * Add domain separators * Removed privacy txs for keycard * CI fixes * CI fixes * addressed some comments * fix ci * initialize branch * ci fixes * fix integration test issue and updated keycard firmware * addressed more comments * fixed deny * remove keycard-py * fixed from earlier merge * add hash_message tests * add test * fix deny * CI fixes * fixed integration tests * Update public.rs * update artifacts * privacy command fixes * ci and comments * addressed comments * comment fixes * fixes from merging main * adding support to other programs * expanded support * ci fixes * ci and add private account keys test * some fixes and setup notes * Ci fixes * ci fixes * update key paths to avoid collisions in tests * added separated files for keycard_tests_2.sh * first round of comments * Revert "Merge branch 'main' into marvin/keycard-commands" This reverts commit 3fce53f663a3996938dddf77680854570063ca21, reversing changes made to e7b42a5177641455a8917bd2e29db20afd9690e5. * python comments * addressed comments * compile error fixed * fix artifacts * fix main merge error * adjust signer logic workflow * updating logic * fmt * refactored * clippy fix * minor fix * addressing comments * minor fix * ci fix * addressed deferred comments * clean up * minor cleanup * ci fixes * fmt fix * feat!(wallet): Merged `SigningGroup` with `AccountManager` (#500) * feat: account manager extension * feat(wallet): added unified way of sending public transactions to all facades * fix(wallet): no sign option added * fix(deny): deny fix * fix(wallet): suggestion 1 * fix(wallet): suggestion fix 1 * feat!: Add new path for externally provided seed to the circuit. BREAKING CHANGE: add identity variants to the circuit and change semantics for `Claim::Authorized` for private PDAs * feat(ci): use separate job per each integration tests module * feat(ci): cache rust artifacts * feat(ci): build integration tests binary once and reuse it * fix(wallet): fmt * ci: add bench-regression workflow with criterion-compare for crypto_primitives_bench * fix(wallet): merge postfix * feat!(wallet): SigningGroup merged with AccountManager * fix(ci): deny and artifacts fix * fix(deny): deny fix * fix keycard and lint --------- Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com> Co-authored-by: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> * addressed comments * minor comments * Rebase to main * CI fixes --------- Co-authored-by: Pravdyvy <46261001+Pravdyvy@users.noreply.github.com> Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com>
2026-06-05 17:35:10 -04:00
sender,
2025-10-20 09:10:54 +03:00
recipient_npk,
2026-01-21 17:58:45 -05:00
recipient_vpk,
recipient_identifier,
2025-10-20 09:10:54 +03:00
balance_to_move,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_transfer_token_shielded_foreign(
sender,
recipient_npk,
recipient_vpk,
recipient_identifier,
balance_to_move,
wallet_core,
)
.await
2025-10-20 09:10:54 +03:00
}
2026-03-09 18:27:56 +03:00
Self::TransferTokenShieldedOwned {
feat(wallet): add keycard support for public accounts for public/privacy txs for program facades (#461) * feat: add basic commands for communicating with keycard * initialize changes * reorganization * add script file for easier wallet access * update commands * fixes * fixed load for non continuous run * Updates for signatures with keycard * fix BIP-340 signatures for fixed sized messages * fmt * refactor and add pin support to program facades * fix unit test * fixes * Revert "fixes" This reverts commit 41f34f4ff4145b7abb60fd9bec168ae4b60f23b4. * fixes * fixes * Removed privacy keycard calls * Revert "Removed privacy keycard calls" This reverts commit d70ef505a1f40b87159099761f5fce5a31e3f17b. * Add domain separators * Removed privacy txs for keycard * CI fixes * CI fixes * addressed some comments * fix ci * initialize branch * ci fixes * fix integration test issue and updated keycard firmware * addressed more comments * fixed deny * remove keycard-py * fixed from earlier merge * add hash_message tests * add test * fix deny * CI fixes * fixed integration tests * Update public.rs * update artifacts * privacy command fixes * ci and comments * addressed comments * comment fixes * fixes from merging main * adding support to other programs * expanded support * ci fixes * ci and add private account keys test * some fixes and setup notes * Ci fixes * ci fixes * update key paths to avoid collisions in tests * added separated files for keycard_tests_2.sh * first round of comments * Revert "Merge branch 'main' into marvin/keycard-commands" This reverts commit 3fce53f663a3996938dddf77680854570063ca21, reversing changes made to e7b42a5177641455a8917bd2e29db20afd9690e5. * python comments * addressed comments * compile error fixed * fix artifacts * fix main merge error * adjust signer logic workflow * updating logic * fmt * refactored * clippy fix * minor fix * addressing comments * minor fix * ci fix * addressed deferred comments * clean up * minor cleanup * ci fixes * fmt fix * feat!(wallet): Merged `SigningGroup` with `AccountManager` (#500) * feat: account manager extension * feat(wallet): added unified way of sending public transactions to all facades * fix(wallet): no sign option added * fix(deny): deny fix * fix(wallet): suggestion 1 * fix(wallet): suggestion fix 1 * feat!: Add new path for externally provided seed to the circuit. BREAKING CHANGE: add identity variants to the circuit and change semantics for `Claim::Authorized` for private PDAs * feat(ci): use separate job per each integration tests module * feat(ci): cache rust artifacts * feat(ci): build integration tests binary once and reuse it * fix(wallet): fmt * ci: add bench-regression workflow with criterion-compare for crypto_primitives_bench * fix(wallet): merge postfix * feat!(wallet): SigningGroup merged with AccountManager * fix(ci): deny and artifacts fix * fix(deny): deny fix * fix keycard and lint --------- Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com> Co-authored-by: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com> * addressed comments * minor comments * Rebase to main * CI fixes --------- Co-authored-by: Pravdyvy <46261001+Pravdyvy@users.noreply.github.com> Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com>
2026-06-05 17:35:10 -04:00
sender,
recipient_account_id,
2025-10-20 09:10:54 +03:00
balance_to_move,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_transfer_token_shielded_owned(
sender,
recipient_account_id,
balance_to_move,
wallet_core,
)
.await
2025-12-11 14:46:16 +02:00
}
2026-03-09 18:27:56 +03:00
Self::BurnTokenShielded {
2025-12-11 14:46:16 +02:00
definition_account_id,
holder_account_id,
amount,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_burn_token_shielded(
definition_account_id,
holder_account_id,
amount,
wallet_core,
)
.await
2025-12-11 14:46:16 +02:00
}
2026-03-09 18:27:56 +03:00
Self::MintTokenShieldedOwned {
2025-12-11 14:46:16 +02:00
definition_account_id,
holder_account_id,
amount,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_mint_token_shielded_owned(
definition_account_id,
holder_account_id,
amount,
wallet_core,
)
.await
2025-12-11 14:46:16 +02:00
}
2026-03-09 18:27:56 +03:00
Self::MintTokenShieldedForeign {
2025-12-11 14:46:16 +02:00
definition_account_id,
holder_npk,
2026-01-21 17:58:45 -05:00
holder_vpk,
holder_identifier,
2025-12-11 14:46:16 +02:00
amount,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_mint_token_shielded_foreign(
definition_account_id,
holder_npk,
holder_vpk,
holder_identifier,
amount,
wallet_core,
)
.await
}
}
}
}
2025-12-11 14:46:16 +02:00
2026-06-17 13:53:54 -04:00
impl CreateNewTokenProgramSubcommand {
async fn handle_new_private_def_private_supp(
definition_account_id: AccountId,
supply_account_id: AccountId,
name: String,
total_supply: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let (tx_hash, [secret_definition, secret_supply]) = Token(wallet_core)
.send_new_definition_private_owned_definiton_and_supply(
definition_account_id,
supply_account_id,
name,
total_supply,
)
.await?;
wallet_core
2026-06-17 17:34:11 -04:00
.poll_and_finalize_pp_transaction(
tx_hash,
&[
Decode(secret_definition, definition_account_id),
Decode(secret_supply, supply_account_id),
],
)
2026-06-17 13:53:54 -04:00
.await
}
2025-12-11 14:46:16 +02:00
2026-06-17 13:53:54 -04:00
async fn handle_new_private_def_public_supp(
definition_account_id: AccountId,
supply_account_id: AccountId,
name: String,
total_supply: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let (tx_hash, secret_definition) = Token(wallet_core)
.send_new_definition_private_owned_definiton(
definition_account_id,
supply_account_id,
name,
total_supply,
)
.await?;
wallet_core
2026-06-17 17:34:11 -04:00
.poll_and_finalize_pp_transaction(
tx_hash,
&[Decode(secret_definition, definition_account_id)],
)
2026-06-17 13:53:54 -04:00
.await
}
2025-12-11 14:46:16 +02:00
2026-06-17 13:53:54 -04:00
async fn handle_new_public_def_private_supp(
definition_account_id: AccountId,
supply_account_id: AccountId,
name: String,
total_supply: u128,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
let (tx_hash, secret_supply) = Token(wallet_core)
.send_new_definition_private_owned_supply(
definition_account_id,
supply_account_id,
name,
total_supply,
)
.await?;
wallet_core
2026-06-17 17:34:11 -04:00
.poll_and_finalize_pp_transaction(tx_hash, &[Decode(secret_supply, supply_account_id)])
2026-06-17 13:53:54 -04:00
.await
}
2025-12-11 14:46:16 +02:00
2026-06-17 13:53:54 -04:00
async fn handle_new_public_def_public_supp(
definition_account_id: CliAccountMention,
supply_account_id: CliAccountMention,
name: String,
total_supply: u128,
2026-06-17 17:34:11 -04:00
wallet_core: &WalletCore,
2026-06-17 13:53:54 -04:00
) -> Result<SubcommandReturnValue> {
let definition = definition_account_id.resolve(wallet_core.storage())?;
let supply = supply_account_id.resolve(wallet_core.storage())?;
let (AccountIdWithPrivacy::Public(def_id), AccountIdWithPrivacy::Public(sup_id)) =
(definition, supply)
else {
anyhow::bail!("`NewPublicDefPublicSupp`: unexpected private account received.");
};
let tx_hash = Token(wallet_core)
.send_new_definition(
definition_account_id.into_public_identity(def_id),
supply_account_id.into_public_identity(sup_id),
name,
total_supply,
)
.await?;
wallet_core
.poll_and_finalize_public_transaction(tx_hash)
.await
2025-10-20 09:10:54 +03:00
}
}
2025-12-02 15:27:20 +02:00
impl WalletSubcommand for CreateNewTokenProgramSubcommand {
async fn handle_subcommand(
self,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
match self {
2026-03-09 18:27:56 +03:00
Self::NewPrivateDefPrivateSupp {
2025-12-02 15:27:20 +02:00
definition_account_id,
supply_account_id,
name,
total_supply,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_new_private_def_private_supp(
definition_account_id,
supply_account_id,
name,
total_supply,
wallet_core,
)
.await
2025-12-02 15:27:20 +02:00
}
2026-03-09 18:27:56 +03:00
Self::NewPrivateDefPublicSupp {
2025-12-02 15:27:20 +02:00
definition_account_id,
supply_account_id,
name,
total_supply,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_new_private_def_public_supp(
definition_account_id,
supply_account_id,
name,
total_supply,
wallet_core,
)
.await
2025-12-02 15:27:20 +02:00
}
2026-03-09 18:27:56 +03:00
Self::NewPublicDefPrivateSupp {
2025-12-02 15:27:20 +02:00
definition_account_id,
supply_account_id,
name,
total_supply,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_new_public_def_private_supp(
definition_account_id,
supply_account_id,
name,
total_supply,
wallet_core,
)
.await
2025-12-02 15:27:20 +02:00
}
2026-03-09 18:27:56 +03:00
Self::NewPublicDefPublicSupp {
2025-12-02 15:27:20 +02:00
definition_account_id,
supply_account_id,
name,
total_supply,
} => {
2026-06-17 13:53:54 -04:00
Self::handle_new_public_def_public_supp(
definition_account_id,
supply_account_id,
name,
total_supply,
wallet_core,
)
.await
2025-12-02 15:27:20 +02:00
}
}
}
}
2025-10-14 10:18:54 +03:00
impl WalletSubcommand for TokenProgramSubcommand {
async fn handle_subcommand(
self,
wallet_core: &mut WalletCore,
) -> Result<SubcommandReturnValue> {
match self {
2026-03-09 18:27:56 +03:00
Self::Create(creation_subcommand) => {
2025-12-02 15:27:20 +02:00
creation_subcommand.handle_subcommand(wallet_core).await
}
2026-03-09 18:27:56 +03:00
Self::Private(private_subcommand) => {
2025-10-14 10:18:54 +03:00
private_subcommand.handle_subcommand(wallet_core).await
}
2026-03-09 18:27:56 +03:00
Self::Public(public_subcommand) => {
2025-10-14 10:18:54 +03:00
public_subcommand.handle_subcommand(wallet_core).await
}
2026-03-09 18:27:56 +03:00
Self::Deshielded(deshielded_subcommand) => {
2025-10-20 09:10:54 +03:00
deshielded_subcommand.handle_subcommand(wallet_core).await
}
2026-03-09 18:27:56 +03:00
Self::Shielded(shielded_subcommand) => {
2025-10-20 09:10:54 +03:00
shielded_subcommand.handle_subcommand(wallet_core).await
}
2025-10-14 10:18:54 +03:00
}
}
}