Merge branch 'main' into Pravdyvy/private-definition-token

This commit is contained in:
Pravdyvy 2025-12-02 07:53:47 +02:00
commit 4fb6ba9530
6 changed files with 19 additions and 26 deletions

View File

@ -56,7 +56,7 @@ fn make_private_account_input_from_str(account_id: &str) -> String {
pub async fn pre_test(
home_dir: PathBuf,
) -> Result<(ServerHandle, JoinHandle<Result<()>>, TempDir)> {
wallet::execute_setup("test_pass".to_owned()).await?;
wallet::cli::execute_setup("test_pass".to_owned()).await?;
let home_dir_sequencer = home_dir.join("sequencer");

View File

@ -189,3 +189,12 @@ pub async fn execute_continuous_run() -> Result<()> {
latest_block_num = seq_client.get_last_block().await?.last_block;
}
}
pub async fn execute_setup(password: String) -> Result<()> {
let config = fetch_config().await?;
let wallet_core = WalletCore::start_from_config_new_storage(config.clone(), password).await?;
wallet_core.store_persistent_data().await?;
Ok(())
}

View File

@ -123,10 +123,6 @@ impl WalletSubcommand for PinataProgramSubcommandPublic {
println!("Transaction data is {transfer_tx:?}");
let path = wallet_core.store_persistent_data().await?;
println!("Stored persistent accounts at {path:#?}");
Ok(SubcommandReturnValue::Empty)
}
}

View File

@ -5,7 +5,9 @@ use base64::{Engine, engine::general_purpose::STANDARD as BASE64};
use common::{
block::HashableBlockData, sequencer_client::SequencerClient, transaction::NSSATransaction,
};
use key_protocol::{key_management::key_tree::traits::KeyNode, key_protocol_core::NSSAUserData};
use key_protocol::{
key_management::key_tree::traits::KeyNode as _, key_protocol_core::NSSAUserData,
};
use nssa::{Account, privacy_preserving_transaction::message::EncryptedAccountData};
use nssa_core::account::Nonce;
use rand::{RngCore, rngs::OsRng};

View File

@ -19,8 +19,7 @@ use tokio::io::AsyncWriteExt;
use crate::{
config::PersistentStorage,
helperfunctions::{
fetch_config, fetch_persistent_storage, get_home, produce_data_for_storage,
produce_random_nonces,
fetch_persistent_storage, get_home, produce_data_for_storage, produce_random_nonces,
},
poller::TxPoller,
};
@ -295,12 +294,3 @@ impl WalletCore {
))
}
}
pub async fn execute_setup(password: String) -> Result<()> {
let config = fetch_config().await?;
let wallet_core = WalletCore::start_from_config_new_storage(config.clone(), password).await?;
wallet_core.store_persistent_data().await?;
Ok(())
}

View File

@ -1,10 +1,7 @@
use anyhow::Result;
use clap::{CommandFactory as _, Parser as _};
use tokio::runtime::Builder;
use wallet::{
cli::{Args, OverCommand, execute_continuous_run, execute_subcommand},
execute_setup,
};
use wallet::cli::{Args, OverCommand, execute_continuous_run, execute_setup, execute_subcommand};
pub const NUM_THREADS: usize = 2;
@ -26,17 +23,16 @@ fn main() -> Result<()> {
env_logger::init();
runtime.block_on(async move {
if let Some(overcommand) = args.command {
match overcommand {
if let Some(over_command) = args.command {
match over_command {
OverCommand::Command(command) => {
// TODO: Do something with the output
let _output = execute_subcommand(command).await?;
Ok(())
}
OverCommand::Setup { password } => Ok(execute_setup(password).await?),
OverCommand::Setup { password } => execute_setup(password).await,
}
} else if args.continuous_run {
Ok(execute_continuous_run().await?)
execute_continuous_run().await
} else {
let help = Args::command().render_long_help();
println!("{help}");