Reorder: Move open to top

This commit is contained in:
Daniel Karzel 2021-03-03 16:32:36 +11:00
parent d63790c2a6
commit b17e6cbd94

View File

@ -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,