Skip to content

Commit

Permalink
refactor(blockifier): handle common getters for fields that only some…
Browse files Browse the repository at this point in the history
… transactions share (#699)
  • Loading branch information
meship-starkware authored Sep 29, 2024
1 parent 16b354e commit faac38b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion crates/blockifier/src/transaction/account_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ use std::sync::Arc;

use cairo_vm::vm::runners::cairo_runner::ExecutionResources;
use starknet_api::calldata;
use starknet_api::core::{ContractAddress, EntryPointSelector, Nonce};
use starknet_api::core::{ClassHash, ContractAddress, EntryPointSelector, Nonce};
use starknet_api::data_availability::DataAvailabilityMode;
use starknet_api::deprecated_contract_class::EntryPointType;
use starknet_api::transaction::Resource::{L1DataGas, L1Gas, L2Gas};
use starknet_api::transaction::{
AccountDeploymentData,
AllResourceBounds,
Calldata,
Fee,
Expand Down Expand Up @@ -178,6 +179,22 @@ impl AccountTransaction {
}
}

pub fn class_hash(&self) -> Option<ClassHash> {
match self {
Self::Declare(tx) => Some(tx.tx.class_hash()),
Self::DeployAccount(tx) => Some(tx.tx.class_hash()),
Self::Invoke(_) => None,
}
}

pub fn account_deployment_data(&self) -> Option<AccountDeploymentData> {
match self {
Self::Declare(tx) => Some(tx.tx.account_deployment_data().clone()),
Self::DeployAccount(_) => None,
Self::Invoke(tx) => Some(tx.tx.account_deployment_data().clone()),
}
}

// TODO(nir, 01/11/2023): Consider instantiating CommonAccountFields in AccountTransaction.
pub fn tx_type(&self) -> TransactionType {
match self {
Expand Down

0 comments on commit faac38b

Please sign in to comment.