Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bindings:implement a generic interface
Browse files Browse the repository at this point in the history
pythcoiner committed Jan 3, 2025
1 parent 761ece3 commit 0a4e1e8
Showing 2 changed files with 64 additions and 0 deletions.
63 changes: 63 additions & 0 deletions src/interface.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
pub enum Error {
//
}

pub struct PoolConfig {
pub denomination: f64,
pub fee: u32,
pub max_duration: u32,
pub peers: u8,
}

pub struct PeerConfig {
pub outpoint: String,
pub electrum: String,
pub mnemonics: String,
pub address: String,
pub relay: String,
}

/// Initiate and participate to a coinjoin
///
/// # Arguments
/// * `config` - configuration of the pool to initiate
/// * `peer` - information about the peer
///
pub fn initiate_coinjoin(
_config: PoolConfig,
_peer: PeerConfig,
) -> Result<String /* Txid */, Error> {
// TODO:
Ok(String::new())
}

/// List available pools
///
/// # Arguments
/// * `back` - how many second back look in the past
/// * `timeout` - how many second we will wait before fetching relay notifications
/// * `relay` - the relay url, must start w/ `wss://` or `ws://`
///
/// # Returns a [`Vec`] of [`String`] containing a json serialization of a [`Pool`]
pub fn list_pool(
_back: u64,
_timeout: u64,
_relay: String,
) -> Result<Vec<String /* Pool */>, Error> {
// TODO:
Ok(Vec::new())
}

/// Try to join an already initiated coinjoin
///
/// # Arguments
/// * `pool` - [`String`] containing a json serialization of a [`Pool`]
/// * `peer` - information about the peer
///
pub fn join_coinjoin(
_pool: String, /* Pool */
_peer: PeerConfig,
) -> Result<String /* Txid */, Error> {
// TODO:
Ok(String::new())
}
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![allow(dead_code)]
pub mod coinjoin;
pub mod electrum;
pub mod interface;
pub mod joinstr;
pub mod nostr;
pub mod signer;

0 comments on commit 0a4e1e8

Please sign in to comment.