Skip to content

Commit a09d4d4

Browse files
authored
feat: .events() helper on TransactionReceipt (#679)
1 parent 5c676a6 commit a09d4d4

File tree

2 files changed

+12
-0
lines changed
  • examples/starknet-wasm/src
  • starknet-core/src/types

2 files changed

+12
-0
lines changed

examples/starknet-wasm/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![allow(clippy::unused_unit)]
2+
#![allow(unexpected_cfgs)]
23

34
use starknet_crypto::Felt;
45
use wasm_bindgen::prelude::*;

starknet-core/src/types/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,17 @@ impl TransactionReceipt {
614614
Self::DeployAccount(receipt) => &receipt.execution_result,
615615
}
616616
}
617+
618+
/// Gets a reference to the transaction's emitted events.
619+
pub fn events(&self) -> &[Event] {
620+
match self {
621+
Self::Invoke(receipt) => &receipt.events,
622+
Self::L1Handler(receipt) => &receipt.events,
623+
Self::Declare(receipt) => &receipt.events,
624+
Self::Deploy(receipt) => &receipt.events,
625+
Self::DeployAccount(receipt) => &receipt.events,
626+
}
627+
}
617628
}
618629

619630
impl L1HandlerTransaction {

0 commit comments

Comments
 (0)