@@ -155,27 +155,6 @@ impl TransactionReceipt {
155
155
pub const fn transaction_type ( & self ) -> TxType {
156
156
self . inner . tx_type ( )
157
157
}
158
-
159
- /// Calculates the address that will be created by the transaction, if any.
160
- ///
161
- /// Returns `None` if the transaction is not a contract creation (the `to` field is set), or if
162
- /// the `from` field is not set.
163
- pub fn calculate_create_address ( & self , nonce : u64 ) -> Option < Address > {
164
- if self . to . is_some ( ) {
165
- return None ;
166
- }
167
- Some ( self . from . create ( nonce) )
168
- }
169
-
170
- /// Attempts to decode the logs to the provided log type.
171
- ///
172
- /// Returns the first log that decodes successfully.
173
- ///
174
- /// Returns None, if none of the logs could be decoded to the provided log type or if there
175
- /// are no logs.
176
- pub fn decoded_log < E : SolEvent > ( & self ) -> Option < alloy_primitives:: Log < E > > {
177
- self . logs ( ) . iter ( ) . find_map ( |log| E :: decode_log ( & log. inner ) . ok ( ) )
178
- }
179
158
}
180
159
181
160
impl < T > TransactionReceipt < T > {
@@ -204,6 +183,16 @@ impl<T> TransactionReceipt<T> {
204
183
pub fn into_inner ( self ) -> T {
205
184
self . inner
206
185
}
186
+
187
+ /// Calculates the address that will be created by the transaction, if any.
188
+ ///
189
+ /// Returns `None` if the transaction is not a contract creation (the `to` field is set).
190
+ pub fn calculate_create_address ( & self , nonce : u64 ) -> Option < Address > {
191
+ if self . to . is_some ( ) {
192
+ return None ;
193
+ }
194
+ Some ( self . from . create ( nonce) )
195
+ }
207
196
}
208
197
209
198
impl < L > TransactionReceipt < ReceiptEnvelope < L > > {
@@ -225,12 +214,25 @@ impl<L> TransactionReceipt<ReceiptEnvelope<L>> {
225
214
{
226
215
self . map_logs ( Into :: into)
227
216
}
217
+ }
228
218
219
+ impl < T : TxReceipt > TransactionReceipt < T > {
229
220
/// Get the receipt logs.
230
- pub fn logs ( & self ) -> & [ L ] {
221
+ pub fn logs ( & self ) -> & [ T :: Log ] {
231
222
self . inner . logs ( )
232
223
}
233
224
}
225
+ impl < T : TxReceipt < Log : AsRef < alloy_primitives:: Log > > > TransactionReceipt < T > {
226
+ /// Attempts to decode the logs to the provided log type.
227
+ ///
228
+ /// Returns the first log that decodes successfully.
229
+ ///
230
+ /// Returns None, if none of the logs could be decoded to the provided log type or if there
231
+ /// are no logs.
232
+ pub fn decoded_log < E : SolEvent > ( & self ) -> Option < alloy_primitives:: Log < E > > {
233
+ self . logs ( ) . iter ( ) . find_map ( |log| E :: decode_log ( log. as_ref ( ) ) . ok ( ) )
234
+ }
235
+ }
234
236
235
237
impl < T : TxReceipt < Log = Log > > ReceiptResponse for TransactionReceipt < T > {
236
238
fn contract_address ( & self ) -> Option < Address > {
0 commit comments