bugfix: disable type serialization when legacy feature is set (#383)

This commit is contained in:
James Prestwich 2021-08-16 14:12:30 -07:00 committed by GitHub
parent 6cb7cac675
commit e98288d0d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 3 deletions

2
Cargo.lock generated
View File

@ -867,7 +867,7 @@ dependencies = [
[[package]]
name = "ethers-core"
version = "0.4.6"
version = "0.4.7"
dependencies = [
"arrayvec 0.7.1",
"bincode",

View File

@ -1,7 +1,7 @@
[package]
name = "ethers-core"
license = "MIT OR Apache-2.0"
version = "0.4.6"
version = "0.4.7"
authors = ["Georgios Konstantopoulos <me@gakonst.com>"]
edition = "2018"
description = "Core structures for the ethers-rs crate"

View File

@ -5,8 +5,21 @@ use crate::{
};
use serde::{Deserialize, Serialize};
/// The TypedTransaction enum represents all Ethereum transaction types.
///
/// Its variants correspond to specific allowed transactions:
/// 1. Legacy (pre-EIP2718) [`TransactionRequest`]
/// 2. EIP2930 (state access lists) [`Eip2930TransactionRequest`]
/// 3. EIP1559 [`Eip1559TransactionRequest`]
///
/// To support Kovan and other non-London-compatbile networks, please enable
/// the `legacy` crate feature. This will disable the `type` flag in the
/// serialized transaction, and cause contract calls and other common actions
/// to default to using the legacy transaction type.
///
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
#[serde(tag = "type")]
#[cfg_attr(not(feature = "legacy"), serde(tag = "type"))]
#[cfg_attr(feature = "legacy", serde(untagged))]
pub enum TypedTransaction {
// 0x00
#[serde(rename = "0x00")]