Skip to content

Commit

Permalink
Merge pull request #96 from dashpay/v0.4-dev
Browse files Browse the repository at this point in the history
v0.4 dev to master
  • Loading branch information
ogabrielides authored Nov 26, 2024
2 parents 2ec8bde + 07ffa35 commit 3e304a7
Show file tree
Hide file tree
Showing 31 changed files with 1,006 additions and 434 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MAINNET_WALLET_PRIVATE_KEY=

# Testnet configuration
TESTNET_SHOW_IN_UI=true
TESTNET_DAPI_ADDRESSES=https://34.214.48.68:1443,https://35.166.18.166:1443,https://52.12.176.90:1443,https://44.233.44.95:1443,https://52.12.176.90:1443,https://44.233.44.95:1443,https://52.34.144.50:1443,https://44.240.98.102:1443,https://54.201.32.131:1443,https://52.10.229.11:1443,https://52.13.132.146:1443,https://44.228.242.181:1443,https://35.82.197.197:1443,https://52.40.219.41:1443,https://44.239.39.153:1443,https://54.149.33.167:1443,https://35.164.23.245:1443,https://52.33.28.47:1443,https://52.43.86.231:1443,https://52.43.13.92:1443,https://35.163.144.230:1443,https://52.89.154.48:1443,https://52.24.124.162:1443,https://35.85.21.179:1443,https://54.187.14.232:1443,https://54.68.235.201:1443,https://52.13.250.182:1443,https://35.82.49.196:1443,https://44.232.196.6:1443,https://54.189.164.39:1443,https://54.213.204.85:1443
TESTNET_DAPI_ADDRESSES=https://34.214.48.68:1443,https://35.166.18.166:1443,https://52.12.176.90:1443,https://44.233.44.95:1443,https://52.34.144.50:1443,https://44.240.98.102:1443,https://54.201.32.131:1443,https://52.10.229.11:1443,https://52.13.132.146:1443,https://44.228.242.181:1443,https://35.82.197.197:1443,https://52.40.219.41:1443,https://44.239.39.153:1443,https://54.149.33.167:1443,https://35.164.23.245:1443,https://52.33.28.47:1443,https://52.43.86.231:1443,https://52.43.13.92:1443,https://35.163.144.230:1443,https://52.89.154.48:1443,https://52.24.124.162:1443,https://35.85.21.179:1443,https://54.187.14.232:1443,https://54.68.235.201:1443,https://52.13.250.182:1443,https://35.82.49.196:1443,https://44.232.196.6:1443,https://54.189.164.39:1443,https://54.213.204.85:1443
TESTNET_CORE_HOST=127.0.0.1
TESTNET_CORE_RPC_PORT=19998
TESTNET_CORE_RPC_USER=dashrpc
Expand Down
12 changes: 11 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ edition = "2021"
default-run = "dash-evo-tool"
rust-version = "1.81"

[build]
rustflags = [
"-C", "target-feature=+avx,-avx2,-avx512f,-avx512cd,-avx512er,-avx512pf,-avx512bw,-avx512dq,-avx512vl"
]

[dependencies]
bip39 = { version = "2.1.0", features = ["all-languages", "rand"] }
derive_more = "1.0.0"
accesskit = "=0.16.1"
egui = { version = "0.29.1" }
egui_extras = "0.29.1"
rfd = "0.15.1"
qrcode = "0.14.1"
eframe = { version = "0.29.1", features = ["persistence"] }
strum = { version = "0.26.1", features = ["derive"] }
Expand Down Expand Up @@ -59,4 +65,8 @@ regex = "1.11"
zmq = "0.10"

[target.'cfg(target_os = "windows")'.dependencies]
zeromq = "0.4.1"
zeromq = "0.4.1"

[target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))'.dependencies]
native-dialog = "0.7.0"
raw-cpuid = "11.2.0"
17 changes: 15 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl AppState {

let password_info = settings
.clone()
.map(|(_, _, password_info)| password_info)
.map(|(_, _, password_info, _, _)| password_info)
.flatten();

let mainnet_app_context =
Expand All @@ -150,10 +150,23 @@ impl AppState {
let mut proof_log_screen = ProofLogScreen::new(&mainnet_app_context);
let mut document_query_screen = DocumentQueryScreen::new(&mainnet_app_context);
let mut withdraws_status_screen = WithdrawsStatusScreen::new(&mainnet_app_context);

let (custom_dash_qt_path, overwrite_dash_conf) = match settings.clone() {
Some((.., db_custom_dash_qt_path, db_overwrite_dash_qt)) => {
(db_custom_dash_qt_path, db_overwrite_dash_qt)
}
_ => {
// Default values: Use system default path and overwrite conf
(None, true)
}
};

let mut network_chooser_screen = NetworkChooserScreen::new(
&mainnet_app_context,
testnet_app_context.as_ref(),
Network::Dash,
custom_dash_qt_path,
overwrite_dash_conf,
);

let mut wallets_balances_screen = WalletsBalancesScreen::new(&mainnet_app_context);
Expand All @@ -162,7 +175,7 @@ impl AppState {

let mut chosen_network = Network::Dash;

if let Some((network, screen_type, password_info)) = settings {
if let Some((network, screen_type, password_info, _, _)) = settings {
selected_main_screen = screen_type;
chosen_network = network;
if chosen_network == Network::Testnet && testnet_app_context.is_some() {
Expand Down
8 changes: 3 additions & 5 deletions src/app_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,14 @@ pub fn copy_env_file_if_not_exists() {
let app_data_dir =
app_user_data_dir_path().expect("Failed to determine application data directory");
let env_file_in_app_dir = app_data_dir.join(".env".to_string());
if env_file_in_app_dir.exists() && env_file_in_app_dir.is_file() {
} else {
if !env_file_in_app_dir.exists() || !env_file_in_app_dir.is_file() {
let env_example_file_in_exe_dir = PathBuf::from(".env.example");
if env_example_file_in_exe_dir.exists() && env_example_file_in_exe_dir.is_file() {
fs::copy(&env_example_file_in_exe_dir, env_file_in_app_dir)
.expect("Failed to copy main net env file");
.expect("Failed to copy env file");
} else {
let env_file_in_exe_dir = PathBuf::from(".env");
fs::copy(&env_file_in_exe_dir, env_file_in_app_dir)
.expect("Failed to copy main net env file");
fs::copy(&env_file_in_exe_dir, env_file_in_app_dir).expect("Failed to copy env file");
}
}
}
85 changes: 1 addition & 84 deletions src/backend_task/contested_names/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ impl AppContext {
sdk: &Sdk,
sender: mpsc::Sender<TaskResult>,
) -> Result<BackendTaskSuccessResult, String> {
let sdk = sdk.clone();
match &task {
ContestedResourceTask::QueryDPNSContestedResources => self
.query_dpns_contested_resources(sdk, sender)
Expand All @@ -39,89 +38,7 @@ impl AppContext {
ContestedResourceTask::VoteOnDPNSName(name, vote_choice, voters) => {
self.vote_on_dpns_name(name, *vote_choice, voters, sdk, sender)
.await
} // ContestedResourceTask::VoteOnContestedResource(vote_poll, vote_choice) => {
// let mut vote = Vote::default();
// let identity_private_keys_lock = self.known_identities_private_keys.lock().await;
// let loaded_identity_lock = match self.loaded_identity.lock().await.clone() {
// Some(identity) => identity,
// None => {
// return BackendEvent::TaskCompleted {
// task: Task::Document(task),
// execution_result: Err(
// "No loaded identity for signing vote transaction".to_string(),
// ),
// };
// }
// };
//
// let mut signer = SimpleSigner::default();
// let Identity::V0(identity_v0) = &loaded_identity_lock;
// for (key_id, public_key) in &identity_v0.public_keys {
// let identity_key_tuple = (identity_v0.id, *key_id);
// if let Some(private_key_bytes) =
// identity_private_keys_lock.get(&identity_key_tuple)
// {
// signer
// .private_keys
// .insert(public_key.clone(), private_key_bytes.clone());
// }
// }
//
// let voting_public_key = match loaded_identity_lock.get_first_public_key_matching(
// Purpose::VOTING,
// HashSet::from(SecurityLevel::full_range()),
// HashSet::from(KeyType::all_key_types()),
// false,
// ) {
// Some(voting_key) => voting_key,
// None => {
// return BackendEvent::TaskCompleted {
// task: Task::Document(task),
// execution_result: Err(
// "No voting key in the loaded identity. Are you sure it's a masternode identity?".to_string()
// ),
// };
// }
// };
//
// match vote {
// Vote::ResourceVote(ref mut resource_vote) => match resource_vote {
// ResourceVote::V0(ref mut resource_vote_v0) => {
// resource_vote_v0.vote_poll = vote_poll.clone();
// resource_vote_v0.resource_vote_choice = *vote_choice;
// let pro_tx_hash = self
// .loaded_identity_pro_tx_hash
// .lock()
// .await
// .expect("Expected a proTxHash in AppState");
// match vote
// .put_to_platform_and_wait_for_response(
// pro_tx_hash,
// voting_public_key,
// sdk,
// &signer,
// None,
// )
// .await
// {
// Ok(_) => {
// // TODO: Insert vote result into the database
// BackendEvent::TaskCompleted {
// task: Task::Document(task),
// execution_result: Ok(CompletedTaskPayload::String(
// "Vote cast successfully".to_string(),
// )),
// }
// }
// Err(e) => BackendEvent::TaskCompleted {
// task: Task::Document(task),
// execution_result: Err(e.to_string()),
// },
// }
// }
// },
// }
// }
}
}
}
}
Loading

0 comments on commit 3e304a7

Please sign in to comment.