fix(core): prevent chain_id from serializing for requests (#879)

* fix(core): prevent chain_id from serializing

* add default chainid for deserialization
This commit is contained in:
Dan Cline 2022-02-08 16:41:44 -05:00 committed by GitHub
parent a0568fe44e
commit ce0396ea18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -58,7 +58,8 @@ pub struct Eip1559TransactionRequest {
/// baseFeePerGas + maxPriorityFeePerGas is “refunded” to the user. /// baseFeePerGas + maxPriorityFeePerGas is “refunded” to the user.
pub max_fee_per_gas: Option<U256>, pub max_fee_per_gas: Option<U256>,
#[serde(rename = "chainId", default, skip_serializing_if = "Option::is_none")] #[serde(skip_serializing)]
#[serde(default, rename = "chainId")]
/// Chain ID (None for mainnet) /// Chain ID (None for mainnet)
pub chain_id: Option<U64>, pub chain_id: Option<U64>,
} }

View File

@ -42,7 +42,8 @@ pub struct TransactionRequest {
pub nonce: Option<U256>, pub nonce: Option<U256>,
/// Chain ID (None for mainnet) /// Chain ID (None for mainnet)
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing)]
#[serde(default, rename = "chainId")]
pub chain_id: Option<U64>, pub chain_id: Option<U64>,
///////////////// Celo-specific transaction fields ///////////////// ///////////////// Celo-specific transaction fields /////////////////