diff --git a/crates/blockifier/src/transaction/account_transaction.rs b/crates/blockifier/src/transaction/account_transaction.rs index 2395274b70..73a19e4425 100644 --- a/crates/blockifier/src/transaction/account_transaction.rs +++ b/crates/blockifier/src/transaction/account_transaction.rs @@ -76,6 +76,29 @@ pub enum AccountTransaction { Invoke(InvokeTransaction), } +impl TryFrom for AccountTransaction { + type Error = TransactionExecutionError; + + fn try_from( + executable_transaction: starknet_api::executable_transaction::Transaction, + ) -> Result { + match executable_transaction { + starknet_api::executable_transaction::Transaction::Declare(declare_tx) => { + Ok(Self::Declare(declare_tx.try_into()?)) + } + starknet_api::executable_transaction::Transaction::DeployAccount(deploy_account_tx) => { + Ok(Self::DeployAccount(DeployAccountTransaction { + tx: deploy_account_tx, + only_query: false, + })) + } + starknet_api::executable_transaction::Transaction::Invoke(invoke_tx) => { + Ok(Self::Invoke(InvokeTransaction { tx: invoke_tx, only_query: false })) + } + } + } +} + impl HasRelatedFeeType for AccountTransaction { fn version(&self) -> TransactionVersion { match self {