titan_types/
address.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use {
    crate::{RuneAmount, TxOutEntry},
    bitcoin::OutPoint,
    serde::{Deserialize, Serialize},
};

#[derive(Debug, Serialize, Deserialize)]
pub struct AddressData {
    pub value: u64,
    pub runes: Vec<RuneAmount>,
    pub outputs: Vec<AddressTxOut>,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct AddressTxOut {
    pub outpoint: OutPoint,
    pub value: u64,
    pub runes: Vec<RuneAmount>,
}

impl From<(OutPoint, TxOutEntry)> for AddressTxOut {
    fn from((outpoint, tx_out): (OutPoint, TxOutEntry)) -> Self {
        Self {
            outpoint,
            value: tx_out.value,
            runes: tx_out.runes,
        }
    }
}