Skip to content

Commit

Permalink
fix: v0.3 smaller fixes (#69)
Browse files Browse the repository at this point in the history
* fix: fixes for 0.3

* fmt
  • Loading branch information
QuantumExplorer authored Nov 17, 2024
1 parent 22271c1 commit e8b2db5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
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

0 comments on commit e8b2db5

Please sign in to comment.