diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c75ea74..ec543d37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- ORCHESTRATOR: We incorrectly passed the `--mainnet` flag to the `asb` binary but it is the default for the asb. +- CONTROLLER: Add a `bitcoin-seed` command to the controller. You can use it to export the descriptor of the internal Bitcoin wallet. + ## [3.0.0-beta.10] - 2025-08-14 -GUI + CLI + ASB: Fix an issue where the Monero RPC pool would fail to build TLS handshakes over Tor +- GUI + CLI + ASB: Fix an issue where the Monero RPC pool would fail to build TLS handshakes over Tor ## [3.0.0-beta.9] - 2025-08-12 diff --git a/justfile b/justfile index da872029..b563c457 100644 --- a/justfile +++ b/justfile @@ -69,7 +69,7 @@ swap: # Run the asb on testnet asb-testnet: - cargo run -p swap-asb --bin asb -- --trace --testnet start + cargo run -p swap-asb --bin asb -- --trace --testnet start --rpc-bind-port 9944 --rpc-bind-host 0.0.0.0 # Updates our submodules (currently only Monero C++ codebase) update_submodules: diff --git a/swap-controller-api/src/lib.rs b/swap-controller-api/src/lib.rs index cef716e5..2e4523d6 100644 --- a/swap-controller-api/src/lib.rs +++ b/swap-controller-api/src/lib.rs @@ -8,6 +8,11 @@ pub struct BitcoinBalanceResponse { pub balance: bitcoin::Amount, } +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct BitcoinSeedResponse { + pub descriptor: String, +} + #[derive(Serialize, Deserialize, Debug, Clone)] pub struct MoneroBalanceResponse { pub balance: u64, @@ -46,6 +51,8 @@ pub trait AsbApi { async fn check_connection(&self) -> Result<(), ErrorObjectOwned>; #[method(name = "bitcoin_balance")] async fn bitcoin_balance(&self) -> Result; + #[method(name = "bitcoin_seed")] + async fn bitcoin_seed(&self) -> Result; #[method(name = "monero_balance")] async fn monero_balance(&self) -> Result; #[method(name = "monero_address")] diff --git a/swap-controller/src/cli.rs b/swap-controller/src/cli.rs index 8e27ae5d..5aca1128 100644 --- a/swap-controller/src/cli.rs +++ b/swap-controller/src/cli.rs @@ -19,6 +19,8 @@ pub enum Cmd { CheckConnection, /// Get Bitcoin balance BitcoinBalance, + /// Get Bitcoin descriptor containing private keys + BitcoinSeed, /// Get Monero balance MoneroBalance, /// Get Monero wallet address diff --git a/swap-controller/src/main.rs b/swap-controller/src/main.rs index a9149892..9124ddc1 100644 --- a/swap-controller/src/main.rs +++ b/swap-controller/src/main.rs @@ -80,6 +80,10 @@ async fn dispatch(cmd: Cmd, client: impl AsbApiClient) -> anyhow::Result<()> { } } } + Cmd::BitcoinSeed => { + let response = client.bitcoin_seed().await?; + println!("Descriptor (BIP-0382) containing the private keys of the internal Bitcoin wallet: \n{}", response.descriptor); + } } Ok(()) } diff --git a/swap-orchestrator/src/asb.rs b/swap-orchestrator/src/asb.rs index 1a2efc44..e3fd0128 100644 --- a/swap-orchestrator/src/asb.rs +++ b/swap-orchestrator/src/asb.rs @@ -18,7 +18,9 @@ impl Network { impl IntoFlag for Network { fn to_flag(self) -> Flag { match self.0 { - (monero::Network::Mainnet, bitcoin::Network::Bitcoin) => flag!("--mainnet"), + // Mainnet is the default for the asb + (monero::Network::Mainnet, bitcoin::Network::Bitcoin) => Flag(None), + // Testnet requires the --testnet flag (monero::Network::Stagenet, bitcoin::Network::Testnet) => flag!("--testnet"), _ => panic!("Only either Mainnet Bitcoin & Mainnet Monero or Testnet Bitcoin & Stagenet Monero are supported"), } diff --git a/swap/src/asb/rpc/server.rs b/swap/src/asb/rpc/server.rs index 4a581a6e..2b48d000 100644 --- a/swap/src/asb/rpc/server.rs +++ b/swap/src/asb/rpc/server.rs @@ -7,8 +7,8 @@ use jsonrpsee::types::error::ErrorCode; use jsonrpsee::types::ErrorObjectOwned; use std::sync::Arc; use swap_controller_api::{ - ActiveConnectionsResponse, AsbApiServer, BitcoinBalanceResponse, MoneroAddressResponse, - MoneroBalanceResponse, MoneroSeedResponse, MultiaddressesResponse, Swap, + ActiveConnectionsResponse, AsbApiServer, BitcoinBalanceResponse, BitcoinSeedResponse, + MoneroAddressResponse, MoneroBalanceResponse, MoneroSeedResponse, MultiaddressesResponse, Swap, }; use tokio_util::task::AbortOnDropHandle; @@ -72,6 +72,20 @@ impl AsbApiServer for RpcImpl { Ok(BitcoinBalanceResponse { balance }) } + async fn bitcoin_seed(&self) -> Result { + static EXPORT_ROLE: &str = "asb"; + + let wallet_export = self + .bitcoin_wallet + .wallet_export(EXPORT_ROLE) + .await + .into_json_rpc_result()?; + + Ok(BitcoinSeedResponse { + descriptor: format!("{}", wallet_export.descriptor()), + }) + } + async fn monero_balance(&self) -> Result { let wallet = self.monero_wallet.main_wallet().await; let balance = wallet.total_balance().await;