use super::*; #[derive(Boilerplate)] pub(crate) struct OutputHtml { pub(crate) outpoint: OutPoint, pub(crate) list: Option, pub(crate) chain: Chain, pub(crate) output: TxOut, pub(crate) inscriptions: Vec, pub(crate) runes: Vec<(Rune, Pile)>, } #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct OutputJson { pub value: u64, pub script_pubkey: String, pub address: Option, pub transaction: String, pub sat_ranges: Option>, pub inscriptions: Vec, pub runes: BTreeMap, } impl OutputJson { pub fn new( outpoint: OutPoint, list: Option, chain: Chain, output: TxOut, inscriptions: Vec, runes: BTreeMap, ) -> Self { Self { value: output.value, runes: runes.into_iter().collect(), script_pubkey: output.script_pubkey.to_asm_string(), address: chain .address_from_script(&output.script_pubkey) .ok() .map(|address| address.to_string()),