mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-16 17:14:13 -05:00
feat(gui, swap): allow change-address to be omitted and default to internal wallet (#68)
This PR: - allows --change-address to be omitted and default to internal wallet address (https://github.com/comit-network/xmr-btc-swap/pull/1709). This is a change that is merged from upstream into our fork - adds the necessary components for the tauri integration and the ui components to allow toggling between internal vs external refund address Co-authored-by: binarybaron <86064887+binarybaron@users.noreply.github.com> Co-authored-by: Einliterflasche <81313171+Einliterflasche@users.noreply.github.com> Co-authored-by: Byron Hambly <byron@hambly.dev>
This commit is contained in:
parent
91482f1e16
commit
063f9dbf9b
8 changed files with 118 additions and 50 deletions
|
|
@ -44,8 +44,8 @@ pub trait Request {
|
|||
pub struct BuyXmrArgs {
|
||||
#[typeshare(serialized_as = "string")]
|
||||
pub seller: Multiaddr,
|
||||
#[typeshare(serialized_as = "string")]
|
||||
pub bitcoin_change_address: bitcoin::Address,
|
||||
#[typeshare(serialized_as = "Option<string>")]
|
||||
pub bitcoin_change_address: Option<bitcoin::Address>,
|
||||
#[typeshare(serialized_as = "string")]
|
||||
pub monero_receive_address: monero::Address,
|
||||
}
|
||||
|
|
@ -545,6 +545,21 @@ pub async fn buy_xmr(
|
|||
.as_ref()
|
||||
.expect("Could not find Bitcoin wallet"),
|
||||
);
|
||||
|
||||
let bitcoin_change_address = match bitcoin_change_address {
|
||||
Some(addr) => addr,
|
||||
None => {
|
||||
let internal_wallet_address = bitcoin_wallet.new_address().await?;
|
||||
|
||||
tracing::info!(
|
||||
internal_wallet_address=%internal_wallet_address,
|
||||
"No --change-address supplied. Any change will be received to the internal wallet."
|
||||
);
|
||||
|
||||
internal_wallet_address
|
||||
}
|
||||
};
|
||||
|
||||
let monero_wallet = Arc::clone(
|
||||
context
|
||||
.monero_wallet
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue