mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-01-11 23:49:41 -05:00
Reorder: Move open to top
This commit is contained in:
parent
d63790c2a6
commit
b17e6cbd94
@ -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.
|
||||
pub async fn get_balance(&self) -> Result<Amount> {
|
||||
let amount = self.inner.lock().await.get_balance(0).await?;
|
||||
@ -164,30 +188,6 @@ impl Wallet {
|
||||
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(
|
||||
&self,
|
||||
public_spend_key: PublicKey,
|
||||
|
Loading…
Reference in New Issue
Block a user