|
|
@ -3,7 +3,7 @@ use bdk::bitcoin::Network; |
|
|
|
use daemon::auth::Authenticated; |
|
|
|
use daemon::model::cfd::OrderId; |
|
|
|
use daemon::model::{Price, Usd, WalletInfo}; |
|
|
|
use daemon::projection::{CfdAction, Feeds}; |
|
|
|
use daemon::projection::{Cfd, CfdAction, Feeds, Identity}; |
|
|
|
use daemon::routes::EmbeddedFileExt; |
|
|
|
use daemon::to_sse_event::ToSseEvent; |
|
|
|
use daemon::{maker_cfd, maker_inc_connections, monitor, oracle, wallet}; |
|
|
@ -236,6 +236,30 @@ pub async fn post_withdraw_request( |
|
|
|
Ok(url) |
|
|
|
} |
|
|
|
|
|
|
|
#[rocket::get("/cfds")] |
|
|
|
pub async fn get_cfds<'r>( |
|
|
|
rx: &State<Feeds>, |
|
|
|
_auth: Authenticated, |
|
|
|
) -> Result<Json<Vec<Cfd>>, HttpApiProblem> { |
|
|
|
let rx = rx.inner(); |
|
|
|
let rx_cfds = rx.cfds.clone(); |
|
|
|
let cfds = rx_cfds.borrow().clone(); |
|
|
|
|
|
|
|
Ok(Json(cfds)) |
|
|
|
} |
|
|
|
|
|
|
|
#[rocket::get("/takers")] |
|
|
|
pub async fn get_takers<'r>( |
|
|
|
rx: &State<Feeds>, |
|
|
|
_auth: Authenticated, |
|
|
|
) -> Result<Json<Vec<Identity>>, HttpApiProblem> { |
|
|
|
let rx = rx.inner(); |
|
|
|
let rx_connected_takers = rx.connected_takers.clone(); |
|
|
|
let takers = rx_connected_takers.borrow().clone(); |
|
|
|
|
|
|
|
Ok(Json(takers)) |
|
|
|
} |
|
|
|
|
|
|
|
#[cfg(test)] |
|
|
|
mod tests { |
|
|
|
use super::*; |
|
|
|