This commit is contained in:
Oleksandr Pravdyvyi 2025-10-20 09:20:22 +03:00
parent 833d6bf932
commit ff448cbb3c
No known key found for this signature in database
GPG Key ID: 9F8955C63C443871

View File

@ -18,6 +18,7 @@ use sequencer_runner::startup_sequencer;
use tempfile::TempDir; use tempfile::TempDir;
use tokio::task::JoinHandle; use tokio::task::JoinHandle;
use wallet::{ use wallet::{
Command, SubcommandReturnValue, WalletCore,
cli::{ cli::{
chain::{ChainSubcommand, FetchSubcommand, RegisterSubcommand}, chain::{ChainSubcommand, FetchSubcommand, RegisterSubcommand},
native_token_transfer_program::{ native_token_transfer_program::{
@ -28,9 +29,13 @@ use wallet::{
PinataProgramSubcommand, PinataProgramSubcommandPrivate, PinataProgramSubcommandPublic, PinataProgramSubcommand, PinataProgramSubcommandPrivate, PinataProgramSubcommandPublic,
}, },
token_program::{ token_program::{
TokenProgramSubcommand, TokenProgramSubcommandDeshielded, TokenProgramSubcommandPrivate, TokenProgramSubcommandPublic, TokenProgramSubcommandShielded TokenProgramSubcommand, TokenProgramSubcommandDeshielded,
TokenProgramSubcommandPrivate, TokenProgramSubcommandPublic,
TokenProgramSubcommandShielded,
}, },
}, config::PersistentAccountData, helperfunctions::{fetch_config, fetch_persistent_accounts}, Command, SubcommandReturnValue, WalletCore },
config::PersistentAccountData,
helperfunctions::{fetch_config, fetch_persistent_accounts},
}; };
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
@ -769,26 +774,32 @@ pub async fn test_success_token_program_shielded_owned() {
// Create new account for the token definition (public) // Create new account for the token definition (public)
let SubcommandReturnValue::RegisterAccount { let SubcommandReturnValue::RegisterAccount {
addr: definition_addr, addr: definition_addr,
} = wallet::execute_subcommand(Command::Chain(ChainSubcommand::Register(RegisterSubcommand::RegisterAccountPublic {}))) } = wallet::execute_subcommand(Command::Chain(ChainSubcommand::Register(
.await RegisterSubcommand::RegisterAccountPublic {},
.unwrap() )))
.await
.unwrap()
else { else {
panic!("invalid subcommand return value"); panic!("invalid subcommand return value");
}; };
// Create new account for the token supply holder (private) // Create new account for the token supply holder (private)
let SubcommandReturnValue::RegisterAccount { addr: supply_addr } = let SubcommandReturnValue::RegisterAccount { addr: supply_addr } =
wallet::execute_subcommand(Command::Chain(ChainSubcommand::Register(RegisterSubcommand::RegisterAccountPublic {}))) wallet::execute_subcommand(Command::Chain(ChainSubcommand::Register(
.await RegisterSubcommand::RegisterAccountPublic {},
.unwrap() )))
.await
.unwrap()
else { else {
panic!("invalid subcommand return value"); panic!("invalid subcommand return value");
}; };
// Create new account for receiving a token transaction // Create new account for receiving a token transaction
let SubcommandReturnValue::RegisterAccount { let SubcommandReturnValue::RegisterAccount {
addr: recipient_addr, addr: recipient_addr,
} = wallet::execute_subcommand(Command::Chain(ChainSubcommand::Register(RegisterSubcommand::RegisterAccountPrivate {}))) } = wallet::execute_subcommand(Command::Chain(ChainSubcommand::Register(
.await RegisterSubcommand::RegisterAccountPrivate {},
.unwrap() )))
.await
.unwrap()
else { else {
panic!("invalid subcommand return value"); panic!("invalid subcommand return value");
}; };
@ -844,7 +855,9 @@ pub async fn test_success_token_program_shielded_owned() {
tokio::time::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)).await; tokio::time::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)).await;
let wallet_config = fetch_config().await.unwrap(); let wallet_config = fetch_config().await.unwrap();
let wallet_storage = WalletCore::start_from_config_update_chain(wallet_config).await.unwrap(); let wallet_storage = WalletCore::start_from_config_update_chain(wallet_config)
.await
.unwrap();
let new_commitment2 = wallet_storage let new_commitment2 = wallet_storage
.get_private_account_commitment(&recipient_addr) .get_private_account_commitment(&recipient_addr)
@ -868,7 +881,9 @@ pub async fn test_success_token_program_shielded_owned() {
tokio::time::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)).await; tokio::time::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)).await;
let wallet_config = fetch_config().await.unwrap(); let wallet_config = fetch_config().await.unwrap();
let wallet_storage = WalletCore::start_from_config_update_chain(wallet_config).await.unwrap(); let wallet_storage = WalletCore::start_from_config_update_chain(wallet_config)
.await
.unwrap();
let new_commitment2 = wallet_storage let new_commitment2 = wallet_storage
.get_private_account_commitment(&recipient_addr) .get_private_account_commitment(&recipient_addr)
@ -884,26 +899,32 @@ pub async fn test_success_token_program_deshielded_owned() {
// Create new account for the token definition (public) // Create new account for the token definition (public)
let SubcommandReturnValue::RegisterAccount { let SubcommandReturnValue::RegisterAccount {
addr: definition_addr, addr: definition_addr,
} = wallet::execute_subcommand(Command::Chain(ChainSubcommand::Register(RegisterSubcommand::RegisterAccountPublic {}))) } = wallet::execute_subcommand(Command::Chain(ChainSubcommand::Register(
.await RegisterSubcommand::RegisterAccountPublic {},
.unwrap() )))
.await
.unwrap()
else { else {
panic!("invalid subcommand return value"); panic!("invalid subcommand return value");
}; };
// Create new account for the token supply holder (private) // Create new account for the token supply holder (private)
let SubcommandReturnValue::RegisterAccount { addr: supply_addr } = let SubcommandReturnValue::RegisterAccount { addr: supply_addr } =
wallet::execute_subcommand(Command::Chain(ChainSubcommand::Register(RegisterSubcommand::RegisterAccountPrivate {}))) wallet::execute_subcommand(Command::Chain(ChainSubcommand::Register(
.await RegisterSubcommand::RegisterAccountPrivate {},
.unwrap() )))
.await
.unwrap()
else { else {
panic!("invalid subcommand return value"); panic!("invalid subcommand return value");
}; };
// Create new account for receiving a token transaction // Create new account for receiving a token transaction
let SubcommandReturnValue::RegisterAccount { let SubcommandReturnValue::RegisterAccount {
addr: recipient_addr, addr: recipient_addr,
} = wallet::execute_subcommand(Command::Chain(ChainSubcommand::Register(RegisterSubcommand::RegisterAccountPublic {}))) } = wallet::execute_subcommand(Command::Chain(ChainSubcommand::Register(
.await RegisterSubcommand::RegisterAccountPublic {},
.unwrap() )))
.await
.unwrap()
else { else {
panic!("invalid subcommand return value"); panic!("invalid subcommand return value");
}; };
@ -945,7 +966,9 @@ pub async fn test_success_token_program_deshielded_owned() {
); );
let wallet_config = fetch_config().await.unwrap(); let wallet_config = fetch_config().await.unwrap();
let wallet_storage = WalletCore::start_from_config_update_chain(wallet_config).await.unwrap(); let wallet_storage = WalletCore::start_from_config_update_chain(wallet_config)
.await
.unwrap();
let new_commitment1 = wallet_storage let new_commitment1 = wallet_storage
.get_private_account_commitment(&supply_addr) .get_private_account_commitment(&supply_addr)
@ -969,7 +992,9 @@ pub async fn test_success_token_program_deshielded_owned() {
tokio::time::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)).await; tokio::time::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)).await;
let wallet_config = fetch_config().await.unwrap(); let wallet_config = fetch_config().await.unwrap();
let wallet_storage = WalletCore::start_from_config_update_chain(wallet_config).await.unwrap(); let wallet_storage = WalletCore::start_from_config_update_chain(wallet_config)
.await
.unwrap();
let new_commitment1 = wallet_storage let new_commitment1 = wallet_storage
.get_private_account_commitment(&supply_addr) .get_private_account_commitment(&supply_addr)
@ -993,7 +1018,9 @@ pub async fn test_success_token_program_deshielded_owned() {
tokio::time::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)).await; tokio::time::sleep(Duration::from_secs(TIME_TO_WAIT_FOR_BLOCK_SECONDS)).await;
let wallet_config = fetch_config().await.unwrap(); let wallet_config = fetch_config().await.unwrap();
let wallet_storage = WalletCore::start_from_config_update_chain(wallet_config).await.unwrap(); let wallet_storage = WalletCore::start_from_config_update_chain(wallet_config)
.await
.unwrap();
let new_commitment1 = wallet_storage let new_commitment1 = wallet_storage
.get_private_account_commitment(&supply_addr) .get_private_account_commitment(&supply_addr)