Skip to content

Commit

Permalink
Add charms to StreamEvent (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
mi-yu committed Mar 11, 2024
1 parent 79f153d commit e17d6bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/index/updater/inscription_updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions src/index/updater/inscription_updater/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ pub struct StreamEvent {
sat: Option<Sat>,
sat_details: Option<Output>, // Output is borrowed from subcommand::traits::Output, to show the details of the sat
inscription_number: Option<i64>,
charms: Option<u16>,
content_type: Option<String>,
content_length: Option<usize>,
content_media: Option<String>,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -345,11 +347,13 @@ impl StreamEvent {
inscription_number: i64,
inscription: Inscription,
parent: Option<InscriptionId>,
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);
Expand Down

0 comments on commit e17d6bf

Please sign in to comment.