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,
|
execution_params::GetExecutionParams,
|
||||||
fs::default_config_path,
|
fs::default_config_path,
|
||||||
monero,
|
monero,
|
||||||
monero::{Amount, CreateWallet, GetAddress, OpenWallet},
|
monero::{Amount, CreateWallet, OpenWallet},
|
||||||
protocol::alice::EventLoop,
|
protocol::alice::EventLoop,
|
||||||
seed::Seed,
|
seed::Seed,
|
||||||
trace::init_tracing,
|
trace::init_tracing,
|
||||||
|
@ -30,7 +30,7 @@ use swap::{
|
|||||||
execution_params::GetExecutionParams,
|
execution_params::GetExecutionParams,
|
||||||
fs::default_config_path,
|
fs::default_config_path,
|
||||||
monero,
|
monero,
|
||||||
monero::{CreateWallet, OpenWallet, WalletBlockHeight},
|
monero::{CreateWallet, OpenWallet},
|
||||||
protocol::{
|
protocol::{
|
||||||
bob,
|
bob,
|
||||||
bob::{cancel::CancelError, Builder},
|
bob::{cancel::CancelError, Builder},
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::monero::{
|
use crate::monero::{
|
||||||
Amount, CreateWallet, CreateWalletForOutput, CreateWalletForOutputThenLoadDefaultWallet,
|
Amount, CreateWallet, CreateWalletForOutput, CreateWalletForOutputThenLoadDefaultWallet,
|
||||||
GetAddress, InsufficientFunds, OpenWallet, PrivateViewKey, PublicViewKey, Refresh, Transfer,
|
InsufficientFunds, OpenWallet, PrivateViewKey, PublicViewKey, Transfer, TransferProof, TxHash,
|
||||||
TransferProof, TxHash, WalletBlockHeight, WatchForTransfer,
|
WatchForTransfer,
|
||||||
};
|
};
|
||||||
use ::monero::{Address, Network, PrivateKey, PublicKey};
|
use ::monero::{Address, Network, PrivateKey, PublicKey};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
@ -55,6 +55,19 @@ impl Wallet {
|
|||||||
|
|
||||||
Ok(Amount::from_piconero(amount))
|
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]
|
#[async_trait]
|
||||||
@ -233,25 +246,3 @@ impl WatchForTransfer for Wallet {
|
|||||||
Ok(())
|
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,
|
database::Database,
|
||||||
execution_params::ExecutionParams,
|
execution_params::ExecutionParams,
|
||||||
monero,
|
monero,
|
||||||
monero::{CreateWalletForOutputThenLoadDefaultWallet, WalletBlockHeight},
|
monero::CreateWalletForOutputThenLoadDefaultWallet,
|
||||||
monero_ext::ScalarExt,
|
monero_ext::ScalarExt,
|
||||||
protocol::{
|
protocol::{
|
||||||
alice,
|
alice,
|
||||||
|
@ -4,7 +4,7 @@ use crate::{
|
|||||||
database::{Database, Swap},
|
database::{Database, Swap},
|
||||||
execution_params::ExecutionParams,
|
execution_params::ExecutionParams,
|
||||||
monero,
|
monero,
|
||||||
monero::{InsufficientFunds, WalletBlockHeight},
|
monero::InsufficientFunds,
|
||||||
protocol::bob::{self, event_loop::EventLoopHandle, state::*, QuoteRequest},
|
protocol::bob::{self, event_loop::EventLoopHandle, state::*, QuoteRequest},
|
||||||
};
|
};
|
||||||
use anyhow::{bail, Result};
|
use anyhow::{bail, Result};
|
||||||
|
@ -21,7 +21,6 @@ use swap::{
|
|||||||
execution_params,
|
execution_params,
|
||||||
execution_params::{ExecutionParams, GetExecutionParams},
|
execution_params::{ExecutionParams, GetExecutionParams},
|
||||||
monero,
|
monero,
|
||||||
monero::Refresh,
|
|
||||||
protocol::{alice, alice::AliceState, bob, bob::BobState},
|
protocol::{alice, alice::AliceState, bob, bob::BobState},
|
||||||
seed::Seed,
|
seed::Seed,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user