Move definitions out of lib.rs

This commit is contained in:
Franck Royer 2021-01-21 13:43:25 +11:00
parent b88a777bae
commit f2a25ee49b
No known key found for this signature in database
GPG key ID: A82ED75A8DFC50A4
16 changed files with 85 additions and 81 deletions

View file

@ -26,37 +26,3 @@ pub mod seed;
pub mod trace;
mod fs;
use serde::{Deserialize, Serialize};
use std::fmt::{self, Display};
/// XMR/BTC swap amounts.
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq)]
// TODO(Franck): review necessity of this struct
pub struct SwapAmounts {
/// Amount of BTC to swap.
#[serde(with = "::bitcoin::util::amount::serde::as_sat")]
pub btc: bitcoin::Amount,
/// Amount of XMR to swap.
#[serde(with = "monero::monero_amount")]
pub xmr: monero::Amount,
}
// TODO: Display in XMR and BTC (not picos and sats).
impl Display for SwapAmounts {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"{} sats for {} piconeros",
self.btc.as_sat(),
self.xmr.as_piconero()
)
}
}
#[derive(Debug, Clone, Copy)]
pub enum ExpiredTimelocks {
None,
Cancel,
Punish,
}