refactor(cli): Remove obsolete RPC server (#346)

This commit is contained in:
Mohan 2025-05-21 18:43:02 +02:00 committed by GitHub
parent 7ef8b1c643
commit 8d0af2f8b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 19 additions and 924 deletions

View file

@ -10,7 +10,7 @@ use crate::network::quote::{BidQuote, ZeroQuoteReceived};
use crate::network::swarm;
use crate::protocol::bob::{BobState, Swap};
use crate::protocol::{bob, State};
use crate::{bitcoin, cli, monero, rpc};
use crate::{bitcoin, cli, monero};
use ::bitcoin::address::NetworkUnchecked;
use ::bitcoin::Txid;
use ::monero::Network;
@ -25,7 +25,6 @@ use serde_json::json;
use std::cmp::min;
use std::convert::TryInto;
use std::future::Future;
use std::net::SocketAddr;
use std::path::PathBuf;
use std::sync::Arc;
use std::time::Duration;
@ -191,22 +190,6 @@ impl Request for ListSellersArgs {
}
}
// StartDaemon
#[typeshare]
#[derive(Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct StartDaemonArgs {
#[typeshare(serialized_as = "string")]
pub server_address: Option<SocketAddr>,
}
impl Request for StartDaemonArgs {
type Response = serde_json::Value;
async fn request(self, ctx: Arc<Context>) -> Result<Self::Response> {
start_daemon(self, (*ctx).clone()).await
}
}
// GetSwapInfo
#[typeshare]
#[derive(Debug, Eq, PartialEq, Serialize, Deserialize)]
@ -1044,26 +1027,6 @@ pub async fn withdraw_btc(
})
}
#[tracing::instrument(fields(method = "start_daemon"), skip(context))]
pub async fn start_daemon(
start_daemon: StartDaemonArgs,
context: Context,
) -> Result<serde_json::Value> {
let StartDaemonArgs { server_address } = start_daemon;
// Default to 127.0.0.1:1234
let server_address = server_address.unwrap_or("127.0.0.1:1234".parse()?);
let (addr, server_handle) = rpc::run_server(server_address, context).await?;
tracing::info!(%addr, "Started RPC server");
server_handle.stopped().await;
tracing::info!("Stopped RPC server");
Ok(json!({}))
}
#[tracing::instrument(fields(method = "get_balance"), skip(context))]
pub async fn get_balance(balance: BalanceArgs, context: Arc<Context>) -> Result<BalanceResponse> {
let BalanceArgs { force_refresh } = balance;