Skip to content

Commit

Permalink
feat: .events() helper on TransactionReceipt
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI committed Dec 1, 2024
1 parent 5c676a6 commit 984f37a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/starknet-wasm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(clippy::unused_unit)]
#![allow(unexpected_cfgs)]

use starknet_crypto::Felt;
use wasm_bindgen::prelude::*;
Expand Down
11 changes: 11 additions & 0 deletions starknet-core/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,17 @@ impl TransactionReceipt {
Self::DeployAccount(receipt) => &receipt.execution_result,
}
}

/// Gets a reference to the transaction's emitted events.
pub fn events(&self) -> &[Event] {
match self {
Self::Invoke(receipt) => &receipt.events,
Self::L1Handler(receipt) => &receipt.events,
Self::Declare(receipt) => &receipt.events,
Self::Deploy(receipt) => &receipt.events,
Self::DeployAccount(receipt) => &receipt.events,
}
}
}

impl L1HandlerTransaction {
Expand Down

0 comments on commit 984f37a

Please sign in to comment.