Skip to content

Commit

Permalink
fix: add missing fields to ordinal inscription reveals (#703)
Browse files Browse the repository at this point in the history
Multiple parents and charms

---------

Co-authored-by: Hugo CAILLARD <[email protected]>
  • Loading branch information
rafaelcr and hugocaillard authored Feb 6, 2025
1 parent 5f13912 commit 4e49608
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 37 deletions.
73 changes: 42 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions components/chainhook-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ redis = "0.21.5"
serde-redis = "0.12.0"
hex = "0.4.3"
rand = "0.8.5"
chainhook-sdk = { version = "0.12.6", default-features = false, features = [
"zeromq", "stacks-signers"
chainhook-sdk = { default-features = false, features = [
"zeromq",
"stacks-signers",
], path = "../chainhook-sdk" }
hiro-system-kit = "0.3.4"
# hiro-system-kit = { path = "../../../clarinet/components/hiro-system-kit" }
Expand Down Expand Up @@ -46,7 +47,7 @@ rocket_okapi = { version = "0.8.0", git = "https://github.com/hirosystems/okapi.
rocket = { version = "=0.5.0", features = ["json"] }

[dependencies.rocksdb]
version = "0.20.1"
version = "0.21.0"
default-features = false
features = ["lz4", "snappy"]

Expand Down
2 changes: 1 addition & 1 deletion components/chainhook-sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chainhook-sdk"
version = "0.12.11"
version = "0.12.12"
description = "Stateless Transaction Indexing Engine for Stacks and Bitcoin"
license = "GPL-3.0"
edition = "2021"
Expand Down
4 changes: 3 additions & 1 deletion components/chainhook-sdk/src/observer/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use crate::observer::{
start_observer_commands_handler, EventObserverConfig, ObserverCommand, ObserverSidecar,
};
use crate::utils::{AbstractBlock, Context};
use chainhook_types::OrdinalInscriptionCharms;
use chainhook_types::{
BitcoinBlockSignaling, BitcoinChainEvent, BitcoinNetwork, BlockchainEvent,
BlockchainUpdatedWithHeaders, OrdinalInscriptionNumber, OrdinalInscriptionRevealData,
Expand Down Expand Up @@ -1164,14 +1165,15 @@ fn test_bitcoin_chainhook_through_reorg() {
metadata: None,
metaprotocol: None,
delegate: None,
parent: None,
parents: vec![],
ordinal_number: cursor,
ordinal_block_height: b.block.block_identifier.index,
ordinal_offset: 0,
tx_index,
transfers_pre_inscription: cursor as u32,
satpoint_post_inscription: format!("{cursor}"),
curse_type: None,
charms: OrdinalInscriptionCharms::none(),
},
))
}
Expand Down
42 changes: 41 additions & 1 deletion components/chainhook-types-rs/src/ordinals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,45 @@ pub enum OrdinalInscriptionCurseType {
Generic,
}

#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct OrdinalInscriptionCharms {
pub coin: bool,
pub cursed: bool,
pub epic: bool,
pub legendary: bool,
pub lost: bool,
pub nineball: bool,
pub rare: bool,
pub reinscription: bool,
pub unbound: bool,
pub uncommon: bool,
pub vindicated: bool,
pub mythic: bool,
pub burned: bool,
pub palindrome: bool,
}

impl OrdinalInscriptionCharms {
pub fn none() -> Self {
OrdinalInscriptionCharms {
coin: false,
cursed: false,
epic: false,
legendary: false,
lost: false,
nineball: false,
rare: false,
reinscription: false,
unbound: false,
uncommon: false,
vindicated: false,
mythic: false,
burned: false,
palindrome: false,
}
}
}

#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct OrdinalInscriptionRevealData {
pub content_bytes: String,
Expand All @@ -54,14 +93,15 @@ pub struct OrdinalInscriptionRevealData {
pub delegate: Option<String>,
pub metaprotocol: Option<String>,
pub metadata: Option<Value>,
pub parent: Option<String>,
pub parents: Vec<String>,
pub ordinal_number: u64,
pub ordinal_block_height: u64,
pub ordinal_offset: u64,
pub tx_index: usize,
pub transfers_pre_inscription: u32,
pub satpoint_post_inscription: String,
pub curse_type: Option<OrdinalInscriptionCurseType>,
pub charms: OrdinalInscriptionCharms,
}

impl OrdinalInscriptionNumber {
Expand Down

0 comments on commit 4e49608

Please sign in to comment.