mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-11-29 20:16:33 -05:00
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:
parent
4867d2713f
commit
bd3fca7e41
11 changed files with 271 additions and 78 deletions
|
|
@ -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?;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue