Skip to content

Commit

Permalink
feat: merge "inscription_revealed" and "inscription_transferred" into…
Browse files Browse the repository at this point in the history
… "inscription_feed"
  • Loading branch information
lgalabru committed Apr 13, 2023
1 parent 45b9abd commit 741290d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 25 deletions.
16 changes: 4 additions & 12 deletions README.md
Expand Up @@ -160,19 +160,11 @@ The current `bitcoin` predicates supports the following `if_this` constructs:
}
}

// Get any transaction including a new Ordinal inscription
// Get any transaction including a new Ordinal inscription (inscription revealed and transfered)
{
"if_this": {
"protocol": "ordinals",
"operation": "inscription_revealed"
}
}

// Get any transaction transferring a revealed Ordinal inscription
{
"if_this": {
"protocol": "ordinals",
"operation": "inscription_transferred"
"operation": "inscription_feed"
}
}

Expand Down Expand Up @@ -273,7 +265,7 @@ Putting all the pieces together:
"testnet": {
"if_this": {
"protocol": "ordinals",
"operation": "inscription_revealed"
"operation": "inscription_feed"
},
"then_that": {
"http_post": {
Expand All @@ -286,7 +278,7 @@ Putting all the pieces together:
"mainnet": {
"if_this": {
"protocol": "ordinals",
"operation": "inscription_revealed"
"operation": "inscription_feed"
},
"then_that": {
"http_post": {
Expand Down
2 changes: 1 addition & 1 deletion components/chainhook-cli/src/cli/mod.rs
Expand Up @@ -464,7 +464,7 @@ async fn handle_command(opts: Opts, ctx: Context) -> Result<(), String> {
start_block: Some(0),
end_block: Some(100),
predicate: BitcoinPredicateType::Protocol(Protocols::Ordinal(
OrdinalOperations::InscriptionRevealed,
OrdinalOperations::InscriptionFeed,
)),
expire_after_occurrence: None,
action: HookAction::FileAppend(FileHook {
Expand Down
Expand Up @@ -418,19 +418,12 @@ impl BitcoinPredicateType {
false
}
BitcoinPredicateType::Protocol(Protocols::Ordinal(
OrdinalOperations::InscriptionRevealed,
OrdinalOperations::InscriptionFeed,
)) => {
for op in tx.metadata.ordinal_operations.iter() {
if let OrdinalOperation::InscriptionRevealed(_) = op {
return true;
}
}
false
}
BitcoinPredicateType::Protocol(Protocols::Ordinal(
OrdinalOperations::InscriptionTransferred,
)) => {
for op in tx.metadata.ordinal_operations.iter() {
if let OrdinalOperation::InscriptionTransferred(_) = op {
return true;
}
Expand Down
3 changes: 1 addition & 2 deletions components/chainhook-event-observer/src/chainhooks/types.rs
Expand Up @@ -509,8 +509,7 @@ pub enum StacksOperations {
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum OrdinalOperations {
InscriptionRevealed,
InscriptionTransferred,
InscriptionFeed,
}

pub fn get_stacks_canonical_magic_bytes(network: &BitcoinNetwork) -> [u8; 2] {
Expand Down
3 changes: 1 addition & 2 deletions docs/chainhook-openapi.json
Expand Up @@ -512,8 +512,7 @@
"OrdinalOperations": {
"type": "string",
"enum": [
"inscription_revealed",
"inscription_transferred"
"inscription_feed"
]
},
"HookAction": {
Expand Down

0 comments on commit 741290d

Please sign in to comment.