Skip to content

Commit

Permalink
refactor: remove unused AccountTransaction type
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI committed Dec 10, 2023
1 parent adf7e92 commit 97e49dd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 25 deletions.
14 changes: 0 additions & 14 deletions starknet-providers/src/sequencer/models/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,20 +455,6 @@ impl TryFrom<TransactionFinalityStatus> for core::TransactionFinalityStatus {
}
}

impl TryFrom<core::BroadcastedTransaction> for AccountTransaction {
type Error = ConversionError;

fn try_from(value: core::BroadcastedTransaction) -> Result<Self, Self::Error> {
match value {
core::BroadcastedTransaction::Invoke(inner) => Ok(Self::InvokeFunction(inner.into())),
core::BroadcastedTransaction::Declare(inner) => Ok(Self::Declare(inner.try_into()?)),
core::BroadcastedTransaction::DeployAccount(inner) => {
Ok(Self::DeployAccount(inner.into()))
}
}
}
}

impl From<core::BroadcastedInvokeTransaction> for InvokeFunctionTransactionRequest {
fn from(value: core::BroadcastedInvokeTransaction) -> Self {
Self {
Expand Down
2 changes: 1 addition & 1 deletion starknet-providers/src/sequencer/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub use contract_addresses::ContractAddresses;

mod transaction_request;
pub use transaction_request::{
AccountTransaction, AddTransactionResult, AddTransactionResultCode,
AddTransactionResult, AddTransactionResultCode,
DeclareTransaction as DeclareTransactionRequest,
DeclareV1Transaction as DeclareV1TransactionRequest,
DeclareV2Transaction as DeclareV2TransactionRequest,
Expand Down
18 changes: 8 additions & 10 deletions starknet-providers/src/sequencer/models/transaction_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ const QUERY_VERSION_TWO: FieldElement = FieldElement::from_mont([
576460752142433232,
]);

/// 2 ^ 128 + 3
const QUERY_VERSION_THREE: FieldElement = FieldElement::from_mont([
18446744073700081569,
17407,
18446744073709551584,
576460752142432688,
]);

#[serde_as]
#[derive(Debug, Deserialize)]
#[cfg_attr(feature = "no_unknown_fields", serde(deny_unknown_fields))]
Expand Down Expand Up @@ -57,16 +65,6 @@ pub enum TransactionRequest {
DeployAccount(DeployAccountTransaction),
}

/// Represents a transaction in the Starknet network that is originated from an action of an
/// account.
#[derive(Debug, Serialize)]
#[serde(tag = "type", rename_all = "SCREAMING_SNAKE_CASE")]
pub enum AccountTransaction {
Declare(DeclareTransaction),
InvokeFunction(InvokeFunctionTransaction),
DeployAccount(DeployAccountTransaction),
}

#[derive(Debug, Serialize)]
#[serde(untagged)]
pub enum DeclareTransaction {
Expand Down

0 comments on commit 97e49dd

Please sign in to comment.