Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dash-evo-tool"
version = "0.2.0"
version = "0.3.0"
license = "MIT"
edition = "2021"
default-run = "dash-evo-tool"
Expand Down
10 changes: 8 additions & 2 deletions src/database/identities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ impl Database {
let id = identifier.to_vec();
let conn = self.conn.lock().unwrap();

conn.execute(
let rows_updated = conn.execute(
"UPDATE identity SET alias = ? WHERE id = ?",
params![new_alias, id],
)?;

if rows_updated == 0 {
return Err(rusqlite::Error::QueryReturnedNoRows);
}

Ok(())
}
pub fn insert_local_qualified_identity(
Expand Down Expand Up @@ -164,11 +168,13 @@ impl Database {

let conn = self.conn.lock().unwrap();
let mut stmt = conn.prepare(
"SELECT data FROM identity WHERE is_local = 1 AND network = ? AND data IS NOT NULL",
"SELECT data, alias FROM identity WHERE is_local = 1 AND network = ? AND data IS NOT NULL",
)?;
let identity_iter = stmt.query_map(params![network], |row| {
let data: Vec<u8> = row.get(0)?;
let alias: Option<String> = row.get(1)?;
let mut identity: QualifiedIdentity = QualifiedIdentity::from_bytes(&data);
identity.alias = alias;

identity.associated_wallets = wallets
.iter()
Expand Down
16 changes: 9 additions & 7 deletions src/ui/identities/identities_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,15 @@ impl IdentitiesScreen {
} else {
identity_to_update.alias = Some(alias);
}
self.app_context
.db
.set_alias(
&identity_to_update.identity.id(),
identity_to_update.alias.as_ref().map(|s| s.as_str()),
)
.ok();
match self.app_context.db.set_alias(
&identity_to_update.identity.id(),
identity_to_update.alias.as_ref().map(|s| s.as_str()),
) {
Ok(_) => {}
Err(e) => {
eprintln!("{}", e)
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/ui/identities/withdraw_from_identity_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl WithdrawalScreen {
ui.text_edit_singleline(&mut self.withdrawal_amount);

if ui.button("Max").clicked() {
let expected_max_amount = self.max_amount.saturating_sub(30000) as f64 * 1e-8;
let expected_max_amount = self.max_amount.saturating_sub(5000000) as f64 * 1e-8;

// Use flooring and format the result with 4 decimal places
let floored_amount = (expected_max_amount * 10_000.0).floor() / 10_000.0;
Expand Down