From a8201e6083c8d8e7196c7b4883441535eeb0a2d2 Mon Sep 17 00:00:00 2001 From: Jonathan LEI Date: Sun, 1 Dec 2024 23:39:55 +0800 Subject: [PATCH] feat: `.events()` helper on `TransactionReceipt` --- starknet-core/src/types/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/starknet-core/src/types/mod.rs b/starknet-core/src/types/mod.rs index 174968f5..8693f7a1 100644 --- a/starknet-core/src/types/mod.rs +++ b/starknet-core/src/types/mod.rs @@ -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 {