mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-05-19 15:10:34 -04:00
Reorder: Move open to top
This commit is contained in:
parent
d63790c2a6
commit
b17e6cbd94
1 changed files with 24 additions and 24 deletions
|
@ -38,6 +38,30 @@ impl Wallet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn open(&self) -> Result<()> {
|
||||||
|
self.inner
|
||||||
|
.lock()
|
||||||
|
.await
|
||||||
|
.open_wallet(self.name.as_str())
|
||||||
|
.await?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn open_or_create(&self) -> Result<()> {
|
||||||
|
let open_wallet_response = self.open().await;
|
||||||
|
if open_wallet_response.is_err() {
|
||||||
|
self.inner.lock().await.create_wallet(self.name.as_str()).await.context(
|
||||||
|
"Unable to create Monero wallet, please ensure that the monero-wallet-rpc is available",
|
||||||
|
)?;
|
||||||
|
|
||||||
|
debug!("Created Monero wallet {}", self.name);
|
||||||
|
} else {
|
||||||
|
debug!("Opened Monero wallet {}", self.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// Get the balance of the primary account.
|
/// Get the balance of the primary account.
|
||||||
pub async fn get_balance(&self) -> Result<Amount> {
|
pub async fn get_balance(&self) -> Result<Amount> {
|
||||||
let amount = self.inner.lock().await.get_balance(0).await?;
|
let amount = self.inner.lock().await.get_balance(0).await?;
|
||||||
|
@ -164,30 +188,6 @@ impl Wallet {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn open(&self) -> Result<()> {
|
|
||||||
self.inner
|
|
||||||
.lock()
|
|
||||||
.await
|
|
||||||
.open_wallet(self.name.as_str())
|
|
||||||
.await?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn open_or_create(&self) -> Result<()> {
|
|
||||||
let open_wallet_response = self.open().await;
|
|
||||||
if open_wallet_response.is_err() {
|
|
||||||
self.inner.lock().await.create_wallet(self.name.as_str()).await.context(
|
|
||||||
"Unable to create Monero wallet, please ensure that the monero-wallet-rpc is available",
|
|
||||||
)?;
|
|
||||||
|
|
||||||
debug!("Created Monero wallet {}", self.name);
|
|
||||||
} else {
|
|
||||||
debug!("Opened Monero wallet {}", self.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn watch_for_transfer(
|
pub async fn watch_for_transfer(
|
||||||
&self,
|
&self,
|
||||||
public_spend_key: PublicKey,
|
public_spend_key: PublicKey,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue