mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Remove traits in favour of public functions
This commit is contained in:
parent
578d23d7fc
commit
0945cee459
@ -31,7 +31,7 @@ use swap::{
|
||||
execution_params::GetExecutionParams,
|
||||
fs::default_config_path,
|
||||
monero,
|
||||
monero::{Amount, CreateWallet, GetAddress, OpenWallet},
|
||||
monero::{Amount, CreateWallet, OpenWallet},
|
||||
protocol::alice::EventLoop,
|
||||
seed::Seed,
|
||||
trace::init_tracing,
|
||||
|
@ -30,7 +30,7 @@ use swap::{
|
||||
execution_params::GetExecutionParams,
|
||||
fs::default_config_path,
|
||||
monero,
|
||||
monero::{CreateWallet, OpenWallet, WalletBlockHeight},
|
||||
monero::{CreateWallet, OpenWallet},
|
||||
protocol::{
|
||||
bob,
|
||||
bob::{cancel::CancelError, Builder},
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::monero::{
|
||||
Amount, CreateWallet, CreateWalletForOutput, CreateWalletForOutputThenLoadDefaultWallet,
|
||||
GetAddress, InsufficientFunds, OpenWallet, PrivateViewKey, PublicViewKey, Refresh, Transfer,
|
||||
TransferProof, TxHash, WalletBlockHeight, WatchForTransfer,
|
||||
InsufficientFunds, OpenWallet, PrivateViewKey, PublicViewKey, Transfer, TransferProof, TxHash,
|
||||
WatchForTransfer,
|
||||
};
|
||||
use ::monero::{Address, Network, PrivateKey, PublicKey};
|
||||
use anyhow::Result;
|
||||
@ -55,6 +55,19 @@ impl Wallet {
|
||||
|
||||
Ok(Amount::from_piconero(amount))
|
||||
}
|
||||
|
||||
pub async fn block_height(&self) -> Result<BlockHeight> {
|
||||
self.inner.lock().await.block_height().await
|
||||
}
|
||||
|
||||
pub async fn get_main_address(&self) -> Result<Address> {
|
||||
let address = self.inner.lock().await.get_address(0).await?;
|
||||
Ok(Address::from_str(address.address.as_str())?)
|
||||
}
|
||||
|
||||
pub async fn refresh(&self) -> Result<Refreshed> {
|
||||
self.inner.lock().await.refresh().await
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
@ -233,25 +246,3 @@ impl WatchForTransfer for Wallet {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl WalletBlockHeight for Wallet {
|
||||
async fn block_height(&self) -> Result<BlockHeight> {
|
||||
self.inner.lock().await.block_height().await
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl GetAddress for Wallet {
|
||||
async fn get_main_address(&self) -> Result<Address> {
|
||||
let address = self.inner.lock().await.get_address(0).await?;
|
||||
Ok(Address::from_str(address.address.as_str())?)
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl Refresh for Wallet {
|
||||
async fn refresh(&self) -> Result<Refreshed> {
|
||||
self.inner.lock().await.refresh().await
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ use crate::{
|
||||
database::Database,
|
||||
execution_params::ExecutionParams,
|
||||
monero,
|
||||
monero::{CreateWalletForOutputThenLoadDefaultWallet, WalletBlockHeight},
|
||||
monero::CreateWalletForOutputThenLoadDefaultWallet,
|
||||
monero_ext::ScalarExt,
|
||||
protocol::{
|
||||
alice,
|
||||
|
@ -4,7 +4,7 @@ use crate::{
|
||||
database::{Database, Swap},
|
||||
execution_params::ExecutionParams,
|
||||
monero,
|
||||
monero::{InsufficientFunds, WalletBlockHeight},
|
||||
monero::InsufficientFunds,
|
||||
protocol::bob::{self, event_loop::EventLoopHandle, state::*, QuoteRequest},
|
||||
};
|
||||
use anyhow::{bail, Result};
|
||||
|
@ -21,7 +21,6 @@ use swap::{
|
||||
execution_params,
|
||||
execution_params::{ExecutionParams, GetExecutionParams},
|
||||
monero,
|
||||
monero::Refresh,
|
||||
protocol::{alice, alice::AliceState, bob, bob::BobState},
|
||||
seed::Seed,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user