mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-01-22 21:31:10 -05:00
Allow withdrawing and viewing of the bitcoin balance on swap-cli
This commit is contained in:
parent
51d8623ed7
commit
f2df838a3c
@ -25,6 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
We were not handling the error when TxCancel submission fails.
|
We were not handling the error when TxCancel submission fails.
|
||||||
We also configured the electrum client to retry 5 times in order to help with this problem.
|
We also configured the electrum client to retry 5 times in order to help with this problem.
|
||||||
See issues: https://github.com/comit-network/xmr-btc-swap/issues/709 https://github.com/comit-network/xmr-btc-swap/issues/688, https://github.com/comit-network/xmr-btc-swap/issues/701.
|
See issues: https://github.com/comit-network/xmr-btc-swap/issues/709 https://github.com/comit-network/xmr-btc-swap/issues/688, https://github.com/comit-network/xmr-btc-swap/issues/701.
|
||||||
|
- Add the ability to view the swap-cli bitcoin balance and withdraw
|
||||||
|
See issue https://github.com/comit-network/xmr-btc-swap/issues/694
|
||||||
|
|
||||||
## [0.8.1] - 2021-08-16
|
## [0.8.1] - 2021-08-16
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ use crate::env::GetConfig;
|
|||||||
use crate::fs::system_data_dir;
|
use crate::fs::system_data_dir;
|
||||||
use crate::network::rendezvous::XmrBtcNamespace;
|
use crate::network::rendezvous::XmrBtcNamespace;
|
||||||
use crate::{env, monero};
|
use crate::{env, monero};
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{bail, Context, Result};
|
||||||
use bitcoin::{Address, AddressType};
|
use bitcoin::{Address, AddressType};
|
||||||
use libp2p::core::Multiaddr;
|
use libp2p::core::Multiaddr;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
@ -141,7 +141,7 @@ where
|
|||||||
bitcoin_electrum_rpc_url,
|
bitcoin_electrum_rpc_url,
|
||||||
bitcoin_target_block,
|
bitcoin_target_block,
|
||||||
amount,
|
amount,
|
||||||
address: validate_bitcoin_address(address, is_testnet)?,
|
address: bitcoin_address(address, is_testnet)?,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -529,6 +529,23 @@ fn env_config_from(testnet: bool) -> env::Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn bitcoin_address(address: Address, is_testnet: bool) -> Result<Address> {
|
||||||
|
let network = if is_testnet {
|
||||||
|
bitcoin::Network::Testnet
|
||||||
|
} else {
|
||||||
|
bitcoin::Network::Bitcoin
|
||||||
|
};
|
||||||
|
|
||||||
|
if address.network != network {
|
||||||
|
bail!(BitcoinAddressNetworkMismatch {
|
||||||
|
expected: network,
|
||||||
|
actual: address.network
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(address)
|
||||||
|
}
|
||||||
|
|
||||||
fn validate_monero_address(
|
fn validate_monero_address(
|
||||||
address: monero::Address,
|
address: monero::Address,
|
||||||
testnet: bool,
|
testnet: bool,
|
||||||
|
Loading…
Reference in New Issue
Block a user