Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
specify into_eip2930 when it matches a legacy tx
Browse files Browse the repository at this point in the history
  • Loading branch information
joshieDo committed May 17, 2022
1 parent 086c04c commit a38062e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ethers-core/src/types/transaction/eip2718.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,12 @@ impl From<TypedTransaction> for TransactionRequest {

impl TypedTransaction {
fn into_eip2930(self) -> Eip2930TransactionRequest {
let access_list = self.access_list().cloned().unwrap_or_default();

match self {
Eip2930(tx) => tx,
_ => Eip2930TransactionRequest {
Legacy(tx) => Eip2930TransactionRequest { tx, access_list },
Eip1559(_) => Eip2930TransactionRequest {
tx: TransactionRequest {
from: self.from().copied(),
to: self.to().cloned(),
Expand All @@ -504,7 +507,7 @@ impl TypedTransaction {
#[cfg_attr(docsrs, doc(cfg(feature = "celo")))]
gateway_fee: None,
},
access_list: self.access_list().cloned().unwrap_or_default(),
access_list,
},
}
}
Expand Down

0 comments on commit a38062e

Please sign in to comment.