From 95d50ac0a3a537cb63a390bad818415899c90693 Mon Sep 17 00:00:00 2001 From: Jonathan LEI Date: Sat, 9 Dec 2023 20:36:39 -0700 Subject: [PATCH] refactor: remove unused `AccountTransaction` type (#520) --- .../src/sequencer/models/conversions.rs | 14 -------------- starknet-providers/src/sequencer/models/mod.rs | 2 +- .../sequencer/models/transaction_request.rs | 18 ++++++++---------- 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/starknet-providers/src/sequencer/models/conversions.rs b/starknet-providers/src/sequencer/models/conversions.rs index bb9f9b61..bd487ed5 100644 --- a/starknet-providers/src/sequencer/models/conversions.rs +++ b/starknet-providers/src/sequencer/models/conversions.rs @@ -455,20 +455,6 @@ impl TryFrom for core::TransactionFinalityStatus { } } -impl TryFrom for AccountTransaction { - type Error = ConversionError; - - fn try_from(value: core::BroadcastedTransaction) -> Result { - 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 for InvokeFunctionTransactionRequest { fn from(value: core::BroadcastedInvokeTransaction) -> Self { Self { diff --git a/starknet-providers/src/sequencer/models/mod.rs b/starknet-providers/src/sequencer/models/mod.rs index 2a4203c9..fd40c6b1 100644 --- a/starknet-providers/src/sequencer/models/mod.rs +++ b/starknet-providers/src/sequencer/models/mod.rs @@ -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, diff --git a/starknet-providers/src/sequencer/models/transaction_request.rs b/starknet-providers/src/sequencer/models/transaction_request.rs index bb1a76c4..63b7d033 100644 --- a/starknet-providers/src/sequencer/models/transaction_request.rs +++ b/starknet-providers/src/sequencer/models/transaction_request.rs @@ -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))] @@ -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 {