feat(gui): Allow to select from recently used monero addresses (#139)

* feat(gui): Allow user to select from recently used monero addresses in textfield
This commit is contained in:
binarybaron 2024-11-09 12:11:00 +01:00 committed by GitHub
parent 4867d2713f
commit bd3fca7e41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 271 additions and 78 deletions

View file

@ -143,6 +143,21 @@ impl Database for SqliteDatabase {
Ok(address)
}
async fn get_monero_addresses(&self) -> Result<Vec<monero::Address>> {
let mut conn = self.pool.acquire().await?;
let rows = sqlx::query!("SELECT DISTINCT address FROM monero_addresses")
.fetch_all(&mut conn)
.await?;
let addresses = rows
.iter()
.map(|row| row.address.parse())
.collect::<Result<Vec<_>, _>>()?;
Ok(addresses)
}
async fn insert_address(&self, peer_id: PeerId, address: Multiaddr) -> Result<()> {
let mut conn = self.pool.acquire().await?;