mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-18 04:14:32 -05:00
Rename ImportOutput to reflect purpose
This commit is contained in:
parent
213034dc1f
commit
36ed3a0b8b
@ -2,7 +2,7 @@ use crate::{
|
||||
bitcoin,
|
||||
bitcoin::{BroadcastSignedTransaction, WatchForRawTransaction},
|
||||
bob, monero,
|
||||
monero::{ImportOutput, Transfer},
|
||||
monero::{CreateWalletForOutput, Transfer},
|
||||
transport::SendReceive,
|
||||
};
|
||||
use anyhow::{anyhow, Result};
|
||||
@ -20,7 +20,7 @@ pub use message::{Message, Message0, Message1, Message2, UnexpectedMessage};
|
||||
pub async fn next_state<
|
||||
R: RngCore + CryptoRng,
|
||||
B: WatchForRawTransaction + BroadcastSignedTransaction,
|
||||
M: ImportOutput + Transfer,
|
||||
M: CreateWalletForOutput + Transfer,
|
||||
T: SendReceive<Message, bob::Message>,
|
||||
>(
|
||||
bitcoin_wallet: &B,
|
||||
@ -582,7 +582,7 @@ impl State5 {
|
||||
pub async fn refund_xmr<B, M>(self, bitcoin_wallet: &B, monero_wallet: &M) -> Result<()>
|
||||
where
|
||||
B: WatchForRawTransaction,
|
||||
M: ImportOutput,
|
||||
M: CreateWalletForOutput,
|
||||
{
|
||||
let tx_cancel = bitcoin::TxCancel::new(
|
||||
&self.tx_lock,
|
||||
@ -611,7 +611,7 @@ impl State5 {
|
||||
// NOTE: This actually generates and opens a new wallet, closing the currently
|
||||
// open one.
|
||||
monero_wallet
|
||||
.import_output(monero::PrivateKey::from_scalar(s), self.v)
|
||||
.create_and_load_wallet_for_output(monero::PrivateKey::from_scalar(s), self.v)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
|
@ -5,7 +5,7 @@ use crate::{
|
||||
WatchForRawTransaction,
|
||||
},
|
||||
monero,
|
||||
monero::{CheckTransfer, ImportOutput},
|
||||
monero::{CheckTransfer, CreateWalletForOutput},
|
||||
transport::SendReceive,
|
||||
};
|
||||
use anyhow::{anyhow, Result};
|
||||
@ -24,7 +24,7 @@ pub use message::{Message, Message0, Message1, Message2, Message3, UnexpectedMes
|
||||
pub async fn next_state<
|
||||
R: RngCore + CryptoRng,
|
||||
B: WatchForRawTransaction + SignTxLock + BuildTxLockPsbt + BroadcastSignedTransaction,
|
||||
M: ImportOutput + CheckTransfer,
|
||||
M: CreateWalletForOutput + CheckTransfer,
|
||||
T: SendReceive<Message, alice::Message>,
|
||||
>(
|
||||
bitcoin_wallet: &B,
|
||||
@ -559,7 +559,7 @@ pub struct State5 {
|
||||
impl State5 {
|
||||
pub async fn claim_xmr<W>(&self, monero_wallet: &W) -> Result<()>
|
||||
where
|
||||
W: monero::ImportOutput,
|
||||
W: monero::CreateWalletForOutput,
|
||||
{
|
||||
let s_b = monero::PrivateKey {
|
||||
scalar: self.s_b.into_ed25519(),
|
||||
@ -569,7 +569,9 @@ impl State5 {
|
||||
|
||||
// NOTE: This actually generates and opens a new wallet, closing the currently
|
||||
// open one.
|
||||
monero_wallet.import_output(s, self.v).await?;
|
||||
monero_wallet
|
||||
.create_and_load_wallet_for_output(s, self.v)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -122,8 +122,8 @@ pub trait CheckTransfer {
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
pub trait ImportOutput {
|
||||
async fn import_output(
|
||||
pub trait CreateWalletForOutput {
|
||||
async fn create_and_load_wallet_for_output(
|
||||
&self,
|
||||
private_spend_key: PrivateKey,
|
||||
private_view_key: PrivateViewKey,
|
||||
|
@ -4,8 +4,8 @@ use monero::{Address, Network, PrivateKey};
|
||||
use monero_harness::Monero;
|
||||
use std::str::FromStr;
|
||||
use xmr_btc::monero::{
|
||||
Amount, CheckTransfer, ImportOutput, PrivateViewKey, PublicKey, PublicViewKey, Transfer,
|
||||
TransferProof, TxHash,
|
||||
Amount, CheckTransfer, CreateWalletForOutput, PrivateViewKey, PublicKey, PublicViewKey,
|
||||
Transfer, TransferProof, TxHash,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -37,8 +37,8 @@ impl Transfer for AliceWallet<'_> {
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl ImportOutput for AliceWallet<'_> {
|
||||
async fn import_output(
|
||||
impl CreateWalletForOutput for AliceWallet<'_> {
|
||||
async fn create_and_load_wallet_for_output(
|
||||
&self,
|
||||
private_spend_key: PrivateKey,
|
||||
private_view_key: PrivateViewKey,
|
||||
@ -99,8 +99,8 @@ impl CheckTransfer for BobWallet<'_> {
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl ImportOutput for BobWallet<'_> {
|
||||
async fn import_output(
|
||||
impl CreateWalletForOutput for BobWallet<'_> {
|
||||
async fn create_and_load_wallet_for_output(
|
||||
&self,
|
||||
private_spend_key: PrivateKey,
|
||||
private_view_key: PrivateViewKey,
|
||||
|
Loading…
Reference in New Issue
Block a user