mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-05 00:03:40 -07:00
28 lines
734 B
Rust
28 lines
734 B
Rust
use serde::Serialize;
|
|
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
|
|
|
|
use crate::{LoadedAddressData, Sats};
|
|
|
|
#[derive(Debug, Default, Clone, FromBytes, Immutable, IntoBytes, KnownLayout, Serialize)]
|
|
pub struct EmptyAddressData {
|
|
pub transfered: Sats,
|
|
}
|
|
|
|
impl From<LoadedAddressData> for EmptyAddressData {
|
|
fn from(value: LoadedAddressData) -> Self {
|
|
Self::from(&value)
|
|
}
|
|
}
|
|
|
|
impl From<&LoadedAddressData> for EmptyAddressData {
|
|
fn from(value: &LoadedAddressData) -> Self {
|
|
if value.sent != value.received {
|
|
dbg!(&value);
|
|
panic!("Trying to convert not empty wallet to empty !");
|
|
}
|
|
Self {
|
|
transfered: value.sent,
|
|
}
|
|
}
|
|
}
|