diff --git a/components/chainhook-sdk/src/chainhooks/bitcoin/mod.rs b/components/chainhook-sdk/src/chainhooks/bitcoin/mod.rs index 1f5b306fa..8b40153ed 100644 --- a/components/chainhook-sdk/src/chainhooks/bitcoin/mod.rs +++ b/components/chainhook-sdk/src/chainhooks/bitcoin/mod.rs @@ -1,7 +1,7 @@ use super::types::{ BitcoinChainhookSpecification, BitcoinPredicateType, DescriptorMatchingRule, ExactMatchingRule, HookAction, InputPredicate, MatchingRule, OrdinalOperations, OrdinalsMetaProtocol, - OutputPredicate, StacksOperations, + OutputPredicate, RunesOperations, StacksOperations, }; use crate::utils::Context; @@ -577,6 +577,9 @@ impl BitcoinPredicateType { } None => !tx.metadata.ordinal_operations.is_empty(), }, + BitcoinPredicateType::RunesProtocol(RunesOperations::Feed) => { + return !tx.metadata.runes_operations.is_empty() + } } } } diff --git a/components/chainhook-sdk/src/chainhooks/bitcoin/tests.rs b/components/chainhook-sdk/src/chainhooks/bitcoin/tests.rs index f2024a289..3888d5342 100644 --- a/components/chainhook-sdk/src/chainhooks/bitcoin/tests.rs +++ b/components/chainhook-sdk/src/chainhooks/bitcoin/tests.rs @@ -129,6 +129,7 @@ fn script_pubkey_evaluation(output: OutputPredicate, script_pubkey: &str, matche inputs: vec![], stacks_operations: vec![], ordinal_operations: vec![], + runes_operations: vec![], brc20_operation: None, outputs, }, @@ -212,6 +213,7 @@ fn it_serdes_brc20_payload(tick: String) { outputs: vec![], ordinal_operations: vec![], stacks_operations: vec![], + runes_operations: vec![], brc20_operation: Some(Brc20Operation::Deploy(Brc20TokenDeployData { tick, max: "21000000.000000".to_string(), diff --git a/components/chainhook-sdk/src/chainhooks/types.rs b/components/chainhook-sdk/src/chainhooks/types.rs index d67ccd429..e1d154975 100644 --- a/components/chainhook-sdk/src/chainhooks/types.rs +++ b/components/chainhook-sdk/src/chainhooks/types.rs @@ -520,6 +520,7 @@ pub enum BitcoinPredicateType { Outputs(OutputPredicate), StacksProtocol(StacksOperations), OrdinalsProtocol(OrdinalOperations), + RunesProtocol(RunesOperations), } #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, JsonSchema)] @@ -570,6 +571,12 @@ pub enum OrdinalOperations { InscriptionFeed(InscriptionFeedData), } +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case", tag = "operation")] +pub enum RunesOperations { + Feed, +} + pub fn get_stacks_canonical_magic_bytes(network: &BitcoinNetwork) -> [u8; 2] { match network { BitcoinNetwork::Mainnet => *b"X2", diff --git a/components/chainhook-sdk/src/indexer/bitcoin/mod.rs b/components/chainhook-sdk/src/indexer/bitcoin/mod.rs index 65889dbbf..3c3eeab0c 100644 --- a/components/chainhook-sdk/src/indexer/bitcoin/mod.rs +++ b/components/chainhook-sdk/src/indexer/bitcoin/mod.rs @@ -451,6 +451,7 @@ pub fn standardize_bitcoin_block( stacks_operations, ordinal_operations: vec![], brc20_operation: None, + runes_operations: vec![], proof: None, fee: sats_in.saturating_sub(sats_out), index: tx_index as u32, diff --git a/components/chainhook-sdk/src/indexer/tests/helpers/transactions.rs b/components/chainhook-sdk/src/indexer/tests/helpers/transactions.rs index 849b3ca1a..eae64b5a4 100644 --- a/components/chainhook-sdk/src/indexer/tests/helpers/transactions.rs +++ b/components/chainhook-sdk/src/indexer/tests/helpers/transactions.rs @@ -128,6 +128,7 @@ pub fn generate_test_tx_bitcoin_p2pkh_transfer( outputs, ordinal_operations: vec![], stacks_operations: vec![], + runes_operations: vec![], brc20_operation: None, proof: None, fee: 0, diff --git a/components/chainhook-types-rs/src/ordinals.rs b/components/chainhook-types-rs/src/ordinals.rs index 52a7bdf29..7b1f36bd7 100644 --- a/components/chainhook-types-rs/src/ordinals.rs +++ b/components/chainhook-types-rs/src/ordinals.rs @@ -121,3 +121,9 @@ pub enum Brc20Operation { Transfer(Brc20BalanceData), TransferSend(Brc20TransferData), } + +#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] +#[serde(rename_all = "snake_case")] +pub enum RunesOperation { + Etching, +} diff --git a/components/chainhook-types-rs/src/rosetta.rs b/components/chainhook-types-rs/src/rosetta.rs index d917912cd..022071339 100644 --- a/components/chainhook-types-rs/src/rosetta.rs +++ b/components/chainhook-types-rs/src/rosetta.rs @@ -1,7 +1,7 @@ use super::bitcoin::{TxIn, TxOut}; use crate::contract_interface::ContractInterface; use crate::ordinals::OrdinalOperation; -use crate::{events::*, Brc20Operation, DEFAULT_STACKS_NODE_RPC}; +use crate::{events::*, Brc20Operation, RunesOperation, DEFAULT_STACKS_NODE_RPC}; use schemars::JsonSchema; use std::cmp::Ordering; use std::collections::HashSet; @@ -313,6 +313,7 @@ pub struct BitcoinTransactionMetadata { pub stacks_operations: Vec, pub ordinal_operations: Vec, pub brc20_operation: Option, + pub runes_operations: Vec, pub proof: Option, pub fee: u64, pub index: u32,