use super::*;
#[derive(Boilerplate)]
pub(crate) struct OutputHtml {
pub(crate) outpoint: OutPoint,
pub(crate) list: Option<List>,
pub(crate) chain: Chain,
pub(crate) output: TxOut,
pub(crate) inscriptions: Vec<InscriptionId>,
pub(crate) runes: Vec<(Rune, Pile)>,
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct OutputJson {
pub value: u64,
pub script_pubkey: String,
pub address: Option<String>,
pub transaction: String,
pub sat_ranges: Option<Vec<(u64, u64)>>,
pub inscriptions: Vec<InscriptionId>,
pub runes: BTreeMap<Rune, u128>,
}
impl OutputJson {
pub fn new(
outpoint: OutPoint,
list: Option<List>,
chain: Chain,
output: TxOut,
inscriptions: Vec<InscriptionId>,
runes: BTreeMap<Rune, u128>,
) -> 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()),