@@ -4,7 +4,10 @@ use crate::BlockHashOrNumber;
4
4
use alloy_eips:: eip7702:: SignedAuthorization ;
5
5
use alloy_primitives:: { keccak256, Address , ChainId , TxKind , B256 , U256 } ;
6
6
7
- use alloy_consensus:: { SignableTransaction , TxEip1559 , TxEip2930 , TxEip4844 , TxEip7702 , TxLegacy } ;
7
+ use alloy_consensus:: {
8
+ SignableTransaction , Transaction as AlloyTransaction , TxEip1559 , TxEip2930 , TxEip4844 ,
9
+ TxEip7702 , TxLegacy ,
10
+ } ;
8
11
use alloy_eips:: {
9
12
eip2718:: { Decodable2718 , Eip2718Error , Eip2718Result , Encodable2718 } ,
10
13
eip2930:: AccessList ,
@@ -197,19 +200,6 @@ impl Transaction {
197
200
}
198
201
}
199
202
200
- /// Get `chain_id`.
201
- pub const fn chain_id ( & self ) -> Option < u64 > {
202
- match self {
203
- Self :: Legacy ( TxLegacy { chain_id, .. } ) => * chain_id,
204
- Self :: Eip2930 ( TxEip2930 { chain_id, .. } ) |
205
- Self :: Eip1559 ( TxEip1559 { chain_id, .. } ) |
206
- Self :: Eip4844 ( TxEip4844 { chain_id, .. } ) |
207
- Self :: Eip7702 ( TxEip7702 { chain_id, .. } ) => Some ( * chain_id) ,
208
- #[ cfg( feature = "optimism" ) ]
209
- Self :: Deposit ( _) => None ,
210
- }
211
- }
212
-
213
203
/// Sets the transaction's chain id to the provided value.
214
204
pub fn set_chain_id ( & mut self , chain_id : u64 ) {
215
205
match self {
@@ -824,7 +814,7 @@ impl Encodable for Transaction {
824
814
}
825
815
}
826
816
827
- impl alloy_consensus :: Transaction for Transaction {
817
+ impl AlloyTransaction for Transaction {
828
818
fn chain_id ( & self ) -> Option < ChainId > {
829
819
match self {
830
820
Self :: Legacy ( tx) => tx. chain_id ( ) ,
@@ -1974,6 +1964,7 @@ mod tests {
1974
1964
transaction:: { signature:: Signature , TxEip1559 , TxKind , TxLegacy } ,
1975
1965
Transaction , TransactionSigned , TransactionSignedEcRecovered , TransactionSignedNoHash ,
1976
1966
} ;
1967
+ use alloy_consensus:: Transaction as _;
1977
1968
use alloy_eips:: eip2718:: { Decodable2718 , Encodable2718 } ;
1978
1969
use alloy_primitives:: { address, b256, bytes, hex, Address , Bytes , Parity , B256 , U256 } ;
1979
1970
use alloy_rlp:: { Decodable , Encodable , Error as RlpError } ;
0 commit comments