From e17d6bfd56758137519f13c1db13c46e5fac52f4 Mon Sep 17 00:00:00 2001 From: Michael Yu Date: Tue, 9 Jan 2024 19:54:27 -0800 Subject: [PATCH] Add charms to StreamEvent (#55) --- src/index/updater/inscription_updater.rs | 8 +++++++- src/index/updater/inscription_updater/stream.rs | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/index/updater/inscription_updater.rs b/src/index/updater/inscription_updater.rs index 3176081c31..10a91177f4 100644 --- a/src/index/updater/inscription_updater.rs +++ b/src/index/updater/inscription_updater.rs @@ -609,7 +609,13 @@ impl<'a, 'db, 'tx> InscriptionUpdater<'a, 'db, 'tx> { self.height, self.block_hash, ) - .with_create(sat, i64::from(inscription_number), inscription, parent) + .with_create( + sat, + i64::from(inscription_number), + inscription, + parent, + charms, + ) .publish()?; (unbound, sequence_number) diff --git a/src/index/updater/inscription_updater/stream.rs b/src/index/updater/inscription_updater/stream.rs index e53bbb88a7..31120b4a62 100644 --- a/src/index/updater/inscription_updater/stream.rs +++ b/src/index/updater/inscription_updater/stream.rs @@ -146,6 +146,7 @@ pub struct StreamEvent { sat: Option, sat_details: Option, // Output is borrowed from subcommand::traits::Output, to show the details of the sat inscription_number: Option, + charms: Option, content_type: Option, content_length: Option, content_media: Option, @@ -206,6 +207,7 @@ impl StreamEvent { tx_is_coinbase: tx.is_coin_base(), sat: None, inscription_number: None, + charms: None, content_type: None, content_length: None, content_media: None, @@ -345,11 +347,13 @@ impl StreamEvent { inscription_number: i64, inscription: Inscription, parent: Option, + charms: u16, ) -> &mut Self { self.enrich_content(inscription); self.sat = sat; self.inscription_number = Some(inscription_number); self.parent = parent; + self.charms = Some(charms); self.sat_details = match self.sat { Some(Sat(n)) => { let sat = Sat(n);