mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-16 09:03:54 -05:00
Network check upon spot price request
This commit is contained in:
parent
02974811ad
commit
af60d3bb54
15 changed files with 245 additions and 76 deletions
|
|
@ -1,6 +1,7 @@
|
|||
pub mod wallet;
|
||||
mod wallet_rpc;
|
||||
|
||||
pub use ::monero::network::Network;
|
||||
pub use ::monero::{Address, PrivateKey, PublicKey};
|
||||
pub use curve25519_dalek::scalar::Scalar;
|
||||
pub use wallet::Wallet;
|
||||
|
|
@ -19,33 +20,15 @@ use std::str::FromStr;
|
|||
|
||||
pub const PICONERO_OFFSET: u64 = 1_000_000_000_000;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, Serialize, Deserialize)]
|
||||
pub enum Network {
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(remote = "Network")]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum network {
|
||||
Mainnet,
|
||||
Stagenet,
|
||||
Testnet,
|
||||
}
|
||||
|
||||
impl From<monero::Network> for Network {
|
||||
fn from(network: monero::Network) -> Self {
|
||||
match network {
|
||||
monero::Network::Mainnet => Self::Mainnet,
|
||||
monero::Network::Stagenet => Self::Stagenet,
|
||||
monero::Network::Testnet => Self::Testnet,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Network> for monero::Network {
|
||||
fn from(network: Network) -> Self {
|
||||
match network {
|
||||
Network::Mainnet => monero::Network::Mainnet,
|
||||
Network::Stagenet => monero::Network::Stagenet,
|
||||
Network::Testnet => monero::Network::Testnet,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn private_key_from_secp256k1_scalar(scalar: bitcoin::Scalar) -> PrivateKey {
|
||||
let mut bytes = scalar.to_bytes();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue