use super::*; #[derive(Debug, Parser)] pub(crate) struct List { #[arg(help = "List sats in .")] outpoint: OutPoint, } #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct Output { pub output: OutPoint, pub start: u64, pub end: u64, pub size: u64, pub offset: u64, pub rarity: Rarity, pub name: String, } impl List { pub(crate) fn run(self, options: Options) -> SubcommandResult { let index = Index::open(&options)?; if !index.has_sat_index() { bail!("list requires index created with `--index-sats` flag"); } index.update()?; match index.list(self.outpoint)? { Some(crate::index::List::Unspent(ranges)) => { let mut outputs = Vec::new(); for Output { output, start, end, size, offset, rarity, name, } in list(self.outpoint, ranges) { outputs.push(Output { output, start, end, size, offset,