feat: Orchestration & Controller (#492)

* fix: formatting in stress_test.rs

* refactor: move asb binary into swap-asb

* refactor(swap-asb): remove unused disable_timestamp argument

* fix(monero-sys): Include search path for aarch64-linux-gnu

* fix(swap): notpick formatting in swap.rs

* feat(swap-env): Split up config wizard, add default rendezvous points

* feat(swap-controller, swap-controller-api): Minimal maker shell with just a check-connection command

* fix(monero-rpc-pool): Use new axum route path syntax to prevent runtime panic

* feat(ci): Specify crate when building binaries; build asb-controller

* fix: Add swap-controller, swap-controller-api crates and their dependencies to Cargo.toml

* feat(Dockerfile): Build asb-controller; default to 1.87 rust toolchain

* feat(swap-orchestrator): Compose spec generator

* formatting: nitpicks

* fix: add swap-orchestrator auto generated files to gitginore

* refactoring(swap-orchestrator: Use Into<_> to derive asb::Network and electrs::Network from Bitcoin/Monero network, use defaults

* feat(swap-env): Change default bitcoin_confirmation_target to 1

* feat: Dockerfile for asb-controller, bitcoin-balance and monero-balance controller commands

* formatting: nitpicks

* changelog: default bitcoin finality confirmations change

* feat(ci): Build swap-orchestrator binary

* disable rpc server by default, split rpc-bind into rpc-bind-port and rpc-bind-host

* feat(swap-controller): Add monero-address command to print primary address of internal wallet

* chore: upgrade rustyline to 17.0.0

* changelog: Document CONTROLLER, ORCHESTRATOR and JSON-RPC server

* refactor: Change swap-orchestrator binary to just "orchestrator"

* refactor: let RpcServer::start(...) take port and host seperately

* default electrum servers in config wizard

* formatting

* feat(swap-orchestrator): README

* feat(swap-controller): Add Multiaddresses and ActiveConnections command

Signed-off-by: Binarybaron <binarybaron@protonmail.com>

* refactor(asb/event_loop.rs): Move quote logic and tower service into their own modules

* fix(swap): some unit tests

* feat(swap-controller): redumentary repl command auto complete

* formatting

* feat(swap-orchestrator): Burn Git commit hash into orchestrator binary

* feat(swap-orchestrator): burn git commit hash into binary when building from source

* feat(Dockerfiles): Build with --locked

* feat: derive ports for images from network combination

add some doc into the docker compose file

* small refactorings

* feat(swap-controller): Add get-swaps command

* feat: add more default electrum mainnet nodes

* feat: build asb-controller docker image in ci, move asb Dockerfile into swap-asb

* fix: do not allow pre-built docker images for now

* amend changelog

* remove default monero_daemon_url, default to None (Monero RPC pool)

* unify asb and orchestrator wizard for monero daemon url setup

---------

Signed-off-by: Binarybaron <binarybaron@protonmail.com>
This commit is contained in:
Mohan 2025-08-06 15:33:41 +02:00 committed by GitHub
parent 7c82853050
commit 97a4a31af9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 2979 additions and 704 deletions

View file

@ -0,0 +1,53 @@
use jsonrpsee::proc_macros::rpc;
use jsonrpsee::types::ErrorObjectOwned;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct BitcoinBalanceResponse {
#[serde(with = "bitcoin::amount::serde::as_sat")]
pub balance: bitcoin::Amount,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct MoneroBalanceResponse {
pub balance: u64,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct MoneroAddressResponse {
pub address: String,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct MultiaddressesResponse {
pub multiaddresses: Vec<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ActiveConnectionsResponse {
pub connections: usize,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Swap {
pub id: String,
pub state: String,
}
#[rpc(client, server)]
pub trait AsbApi {
#[method(name = "check_connection")]
async fn check_connection(&self) -> Result<(), ErrorObjectOwned>;
#[method(name = "bitcoin_balance")]
async fn bitcoin_balance(&self) -> Result<BitcoinBalanceResponse, ErrorObjectOwned>;
#[method(name = "monero_balance")]
async fn monero_balance(&self) -> Result<MoneroBalanceResponse, ErrorObjectOwned>;
#[method(name = "monero_address")]
async fn monero_address(&self) -> Result<MoneroAddressResponse, ErrorObjectOwned>;
#[method(name = "multiaddresses")]
async fn multiaddresses(&self) -> Result<MultiaddressesResponse, ErrorObjectOwned>;
#[method(name = "active_connections")]
async fn active_connections(&self) -> Result<ActiveConnectionsResponse, ErrorObjectOwned>;
#[method(name = "get_swaps")]
async fn get_swaps(&self) -> Result<Vec<Swap>, ErrorObjectOwned>;
}