File tree 3 files changed +16
-1
lines changed
rpc-types-eth/src/transaction
3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ pub trait Network: Debug + Clone + Copy + Sized + Send + Sync + 'static {
80
80
81
81
/// The JSON body of a transaction response.
82
82
#[ doc( alias = "TxResponse" ) ]
83
- type TransactionResponse : RpcObject + TransactionResponse ;
83
+ type TransactionResponse : RpcObject + TransactionResponse + AsRef < Self :: TxEnvelope > ;
84
84
85
85
/// The JSON body of a transaction receipt.
86
86
#[ doc( alias = "TransactionReceiptResponse" , alias = "TxReceiptResponse" ) ]
Original file line number Diff line number Diff line change @@ -61,6 +61,12 @@ pub struct Transaction<T = TxEnvelope> {
61
61
// pub hash: B256,
62
62
}
63
63
64
+ impl < T > AsRef < T > for Transaction < T > {
65
+ fn as_ref ( & self ) -> & T {
66
+ & self . inner
67
+ }
68
+ }
69
+
64
70
impl < T > TransactionTrait for Transaction < T >
65
71
where
66
72
T : TransactionTrait ,
Original file line number Diff line number Diff line change @@ -178,6 +178,15 @@ pub struct WithOtherFields<T> {
178
178
pub other : OtherFields ,
179
179
}
180
180
181
+ impl < T , U > AsRef < U > for WithOtherFields < T >
182
+ where
183
+ T : AsRef < U > ,
184
+ {
185
+ fn as_ref ( & self ) -> & U {
186
+ self . inner . as_ref ( )
187
+ }
188
+ }
189
+
181
190
impl < T > WithOtherFields < T > {
182
191
/// Creates a new [`WithOtherFields`] instance.
183
192
pub fn new ( inner : T ) -> Self {
You can’t perform that action at this time.
0 commit comments