-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
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
1 parent
761ece3
commit 0a4e1e8
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters