diff --git a/crates/blockifier/src/transaction/account_transaction.rs b/crates/blockifier/src/transaction/account_transaction.rs index 1b8ce0881b..a4b245dd0d 100644 --- a/crates/blockifier/src/transaction/account_transaction.rs +++ b/crates/blockifier/src/transaction/account_transaction.rs @@ -94,19 +94,6 @@ macro_rules! implement_tx_getter_calls { $(pub fn $field(&self) -> $field_type { self.tx.$field() })* -}; -} - -macro_rules! implement_account_tx_inner_getters { - ($(($field:ident, $field_type:ty)),*) => { - $(pub fn $field(&self) -> $field_type { - match &self.tx { - // TODO(AvivG): Consider moving some of the logic to the Transaction enum. - Transaction::Declare(tx) => tx.tx.$field().clone(), - Transaction::DeployAccount(tx) => tx.tx.$field().clone(), - Transaction::Invoke(tx) => tx.tx.$field().clone(), - } - })* }; } @@ -136,12 +123,7 @@ impl From for AccountTransaction { impl HasRelatedFeeType for AccountTransaction { fn version(&self) -> TransactionVersion { - // TODO(AvivG): Consider moving some of the logic to the Transaction enum. - match &self.tx { - Transaction::Declare(tx) => tx.tx.version(), - Transaction::DeployAccount(tx) => tx.tx.version(), - Transaction::Invoke(tx) => tx.tx.version(), - } + self.tx.version() } fn is_l1_handler(&self) -> bool { @@ -154,10 +136,7 @@ impl AccountTransaction { (resource_bounds, ValidResourceBounds), (tip, Tip), (sender_address, ContractAddress), - (tx_hash, TransactionHash) - ); - - implement_account_tx_inner_getters!( + (tx_hash, TransactionHash), (signature, TransactionSignature), (nonce, Nonce), (nonce_data_availability_mode, DataAvailabilityMode), diff --git a/crates/starknet_api/src/executable_transaction.rs b/crates/starknet_api/src/executable_transaction.rs index ec0a3557fa..fe3e20f9f4 100644 --- a/crates/starknet_api/src/executable_transaction.rs +++ b/crates/starknet_api/src/executable_transaction.rs @@ -60,7 +60,16 @@ pub enum AccountTransaction { } impl AccountTransaction { - implement_account_tx_inner_getters!((resource_bounds, ValidResourceBounds), (tip, Tip)); + implement_account_tx_inner_getters!( + (resource_bounds, ValidResourceBounds), + (tip, Tip), + (signature, TransactionSignature), + (nonce, Nonce), + (nonce_data_availability_mode, DataAvailabilityMode), + (fee_data_availability_mode, DataAvailabilityMode), + (paymaster_data, PaymasterData), + (version, TransactionVersion) + ); pub fn contract_address(&self) -> ContractAddress { match self { @@ -74,14 +83,6 @@ impl AccountTransaction { self.contract_address() } - pub fn nonce(&self) -> Nonce { - match self { - AccountTransaction::Declare(tx_data) => tx_data.tx.nonce(), - AccountTransaction::DeployAccount(tx_data) => tx_data.tx.nonce(), - AccountTransaction::Invoke(tx_data) => tx_data.tx.nonce(), - } - } - pub fn tx_hash(&self) -> TransactionHash { match self { AccountTransaction::Declare(tx_data) => tx_data.tx_hash,