From 5d807e9647e482f2ab43d0c1cc83fa0ac4e388e1 Mon Sep 17 00:00:00 2001 From: Daniel Karzel Date: Wed, 3 Mar 2021 16:35:13 +1100 Subject: [PATCH] Reorder: Move utility functionality to bottom --- swap/src/monero/wallet.rs | 50 +++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/swap/src/monero/wallet.rs b/swap/src/monero/wallet.rs index 4383b599..04fe14dd 100644 --- a/swap/src/monero/wallet.rs +++ b/swap/src/monero/wallet.rs @@ -122,31 +122,6 @@ impl Wallet { Ok(()) } - /// Get the balance of the primary account. - pub async fn get_balance(&self) -> Result { - let amount = self.inner.lock().await.get_balance(0).await?; - - Ok(Amount::from_piconero(amount)) - } - - pub async fn block_height(&self) -> Result { - self.inner.lock().await.block_height().await - } - - pub async fn get_main_address(&self) -> Result
{ - let address = self.inner.lock().await.get_address(0).await?; - Ok(Address::from_str(address.address.as_str())?) - } - - pub async fn refresh(&self) -> Result { - self.inner.lock().await.refresh().await - } - - pub fn static_tx_fee_estimate(&self) -> Amount { - // Median tx fees on Monero as found here: https://www.monero.how/monero-transaction-fees, 0.000_015 * 2 (to be on the safe side) - Amount::from_monero(0.000_03f64).expect("static fee to be convertible without problems") - } - pub async fn transfer( &self, public_spend_key: PublicKey, @@ -251,4 +226,29 @@ impl Wallet { let tx_hashes = sweep_all.tx_hash_list.into_iter().map(TxHash).collect(); Ok(tx_hashes) } + + /// Get the balance of the primary account. + pub async fn get_balance(&self) -> Result { + let amount = self.inner.lock().await.get_balance(0).await?; + + Ok(Amount::from_piconero(amount)) + } + + pub async fn block_height(&self) -> Result { + self.inner.lock().await.block_height().await + } + + pub async fn get_main_address(&self) -> Result
{ + let address = self.inner.lock().await.get_address(0).await?; + Ok(Address::from_str(address.address.as_str())?) + } + + pub async fn refresh(&self) -> Result { + self.inner.lock().await.refresh().await + } + + pub fn static_tx_fee_estimate(&self) -> Amount { + // Median tx fees on Monero as found here: https://www.monero.how/monero-transaction-fees, 0.000_015 * 2 (to be on the safe side) + Amount::from_monero(0.000_03f64).expect("static fee to be convertible without problems") + } }