Skip to main content

ord/subcommand/
balances.rs

1use super::*;
2
3#[derive(Debug, PartialEq, Serialize, Deserialize)]
4pub struct Output {
5  pub runes: BTreeMap<SpacedRune, BTreeMap<OutPoint, Pile>>,
6}
7
8pub(crate) fn run(settings: Settings) -> SubcommandResult {
9  let index = Index::open(&settings)?;
10
11  ensure!(
12    index.has_rune_index(),
13    "`ord balances` requires index created with `--index-runes` flag",
14  );
15
16  index.update()?;
17
18  Ok(Some(Box::new(Output {
19    runes: index.get_rune_balance_map()?,
20  })))
21}