From 0f6d3688c26661774ab9a3fe8f1d621cedcae298 Mon Sep 17 00:00:00 2001 From: James Prestwich <10149425+prestwich@users.noreply.github.com> Date: Fri, 3 Dec 2021 12:03:49 -0800 Subject: [PATCH] feature: impl Default for eip2718::TypedTransaction (#646) --- ethers-core/src/types/transaction/eip2718.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ethers-core/src/types/transaction/eip2718.rs b/ethers-core/src/types/transaction/eip2718.rs index 671ea552..60db1fb6 100644 --- a/ethers-core/src/types/transaction/eip2718.rs +++ b/ethers-core/src/types/transaction/eip2718.rs @@ -34,6 +34,20 @@ pub enum TypedTransaction { Eip1559(Eip1559TransactionRequest), } +#[cfg(feature = "legacy")] +impl Default for TypedTransaction { + fn default() -> Self { + TypedTransaction::Legacy(Default::default()) + } +} + +#[cfg(not(feature = "legacy"))] +impl Default for TypedTransaction { + fn default() -> Self { + TypedTransaction::Eip1559(Default::default()) + } +} + use TypedTransaction::*; impl TypedTransaction {