Repository: ordinals/ord (rust)

Issue:
`ord list <UTXO>` won't list inscriptions and runes
The command `ord list <utxo>` lists all sats that belong to that UTXO, but it (or any other command) won't list the inscriptions and runes.

Pull request description:
Update list.rs to include inscription and rune info
fixes #3701 - I've added the `/output/<OUTPOINT>` fields to the `ord list` command into a section called "list'.  I also reordered the fields in the pre-existing "ranges" section to make more logical sense.  There is a small amount of redundancy now with the list.sat_ranges vs ranges.start & end, and list.value vs ranges.size.  I figure that this is acceptable and better than changing the pre-existing ranges section, as some users may already be reliant upon those fields - but let me know if not and if further formatting or changes would be better.

Patch:
diff --git a/src/subcommand/list.rs b/src/subcommand/list.rs
index 290dcf4d..3a522eb1 100644
--- a/src/subcommand/list.rs
+++ b/src/subcommand/list.rs
@@ -2,24 +2,31 @@ use super::*;
 
 #[derive(Debug, Parser)]
 pub(crate) struct List {
-  #[arg(help = "List sats in <OUTPOINT>.")]
+  #[arg(help = "List information for <OUTPOINT>.")]
   outpoint: OutPoint,
 }
 
 #[derive(Debug, PartialEq, Serialize, Deserialize)]
 pub struct Output {
-  pub ranges: Option<Vec<Range>>,
+  pub address: Option<Address<NetworkUnchecked>>,
+  pub indexed: bool,
+  pub inscriptions: Vec<InscriptionId>,
+  pub runes: BTreeMap<SpacedRune, Pile>,
+  pub sat_ranges: Option<Vec<Range>>,
+  pub script_pubkey: String,
   pub spent: bool,
+  pub transaction: String,
+  pub value: u64,
 }
 
 #[derive(Debug, PartialEq, Serialize, Deserialize)]
 pub struct Range {
-  pub end: u64,
+  pub start: u64,
   pub name: String,
   pub offset: u64,
   pub rarity: Rarity,
+  pub end: u64,
   pub size: u64,
-  pub start: u64,
 }
 
 impl List {
@@ -37,13 +44,21 @@ impl List {
       "output not found"
     }
 
-    let ranges = index.list(self.outpoint)?;
-
-    let spent = index.is_output_spent(self.outpoint)?;
+    let (list, _txout) = match index.get_output_info(self.outpoint)? {
+      Some((output, txout)) => (output, txout),
+      None => return Ok(None),
+    };
 
     Ok(Some(Box::new(Output {
-      spent,
-      ranges: ranges.map(output_ranges),
+      address: list.address,
+      indexed: list.indexed,
+      inscriptions: list.inscriptions,
+      runes: list.runes,
+      sat_ranges: list.sat_ranges.map(output_ranges),
+      script_pubkey: list.script_pubkey,
+      spent: list.spent,
+      transaction: list.transaction,
+      value: list.value,
     })))
   }
 }


Test patch:
diff --git a/tests/list.rs b/tests/list.rs
index f59e79b3..58dde2ed 100644
--- a/tests/list.rs
+++ b/tests/list.rs
@@ -15,15 +15,22 @@ fn output_found() {
   assert_eq!(
     output,
     Output {
-      ranges: Some(vec![Range {
+      address: None,
+      indexed: true,
+      inscriptions: vec![],
+      runes: BTreeMap::new(),
+      sat_ranges: Some(vec![Range {
         end: 50 * COIN_VALUE,
         name: "nvtdijuwxlp".into(),
         offset: 0,
         rarity: "mythic".parse().unwrap(),
         size: 50 * COIN_VALUE,
         start: 0,
-      }]),
+       }]),
+      script_pubkey: "OP_PUSHBYTES_65 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f OP_CHECKSIG".to_string(),
       spent: false,
+      transaction: "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b".to_string(),
+      value: 5000000000,
     }
   );
 }