diff --git a/CHANGELOG.md b/CHANGELOG.md index b67123b8..aae7bcc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - GUI: Add white background to QR code modal to make it better scannable - GUI + CLI + ASB: Add `/dns4/rendezvous.observer/tcp/8888/p2p/12D3KooWMjceGXrYuGuDMGrfmJxALnSDbK4km6s1i1sJEgDTgGQa` to the default list of rendezvous points - GUI + CLI + ASB: Monero RPC pool now prioritizes nodes with pre-established TCP connections +- ASB + CONTROLLER: Add a `monero_seed` command to the controller shell. You can use it to export the seed and restore height of the internal Monero wallet. You can use those to import the wallet into a wallet software of your own choosing. ## [3.0.0-beta.6] - 2025-08-07 diff --git a/swap-controller-api/src/lib.rs b/swap-controller-api/src/lib.rs index 8b03610d..cef716e5 100644 --- a/swap-controller-api/src/lib.rs +++ b/swap-controller-api/src/lib.rs @@ -34,6 +34,12 @@ pub struct Swap { pub state: String, } +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct MoneroSeedResponse { + pub seed: String, + pub restore_height: u64, +} + #[rpc(client, server)] pub trait AsbApi { #[method(name = "check_connection")] @@ -44,6 +50,8 @@ pub trait AsbApi { async fn monero_balance(&self) -> Result; #[method(name = "monero_address")] async fn monero_address(&self) -> Result; + #[method(name = "monero_seed")] + async fn monero_seed(&self) -> Result; #[method(name = "multiaddresses")] async fn multiaddresses(&self) -> Result; #[method(name = "active_connections")] diff --git a/swap-controller/src/cli.rs b/swap-controller/src/cli.rs index d4bb4242..8e27ae5d 100644 --- a/swap-controller/src/cli.rs +++ b/swap-controller/src/cli.rs @@ -23,6 +23,8 @@ pub enum Cmd { MoneroBalance, /// Get Monero wallet address MoneroAddress, + /// Get Monero seed and restore height + MoneroSeed, /// Get external multiaddresses Multiaddresses, /// Get active connection count diff --git a/swap-controller/src/main.rs b/swap-controller/src/main.rs index aa63c868..a9149892 100644 --- a/swap-controller/src/main.rs +++ b/swap-controller/src/main.rs @@ -3,7 +3,7 @@ mod repl; use clap::Parser; use cli::{Cli, Cmd}; -use swap_controller_api::AsbApiClient; +use swap_controller_api::{AsbApiClient, MoneroSeedResponse}; #[tokio::main] async fn main() -> anyhow::Result<()> { @@ -43,6 +43,19 @@ async fn dispatch(cmd: Cmd, client: impl AsbApiClient) -> anyhow::Result<()> { let response = client.monero_address().await?; println!("The primary Monero address is {}", response.address); } + Cmd::MoneroSeed => { + let MoneroSeedResponse { + seed, + restore_height, + } = client.monero_seed().await?; + + println!("The seed of the internal Monero wallet is: \n{}", seed); + println!(); + println!( + "The restore height of the internal Monero wallet is {}", + restore_height + ); + } Cmd::Multiaddresses => { let response = client.multiaddresses().await?; if response.multiaddresses.is_empty() { diff --git a/swap/src/asb/rpc/server.rs b/swap/src/asb/rpc/server.rs index fae80c7f..4a581a6e 100644 --- a/swap/src/asb/rpc/server.rs +++ b/swap/src/asb/rpc/server.rs @@ -8,7 +8,7 @@ use jsonrpsee::types::ErrorObjectOwned; use std::sync::Arc; use swap_controller_api::{ ActiveConnectionsResponse, AsbApiServer, BitcoinBalanceResponse, MoneroAddressResponse, - MoneroBalanceResponse, MultiaddressesResponse, Swap, + MoneroBalanceResponse, MoneroSeedResponse, MultiaddressesResponse, Swap, }; use tokio_util::task::AbortOnDropHandle; @@ -90,6 +90,17 @@ impl AsbApiServer for RpcImpl { }) } + async fn monero_seed(&self) -> Result { + let wallet = self.monero_wallet.main_wallet().await; + let seed = wallet.seed().await.into_json_rpc_result()?; + let restore_height = wallet.get_restore_height().await.into_json_rpc_result()?; + + Ok(MoneroSeedResponse { + seed, + restore_height, + }) + } + async fn multiaddresses(&self) -> Result { let (_, addresses) = self .event_loop_service