Skip to content

Commit

Permalink
fix: support hex values for conditional options (#1824)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Dec 23, 2024
1 parent 409af86 commit 20f70c5
Showing 1 changed file with 38 additions and 4 deletions.
42 changes: 38 additions & 4 deletions crates/rpc-types-eth/src/erc4337.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,57 @@ pub struct ConditionalOptions {
pub known_accounts: AddressHashMap<AccountStorage>,
/// The minimal block number at which the transaction can be included.
/// `None` indicates no minimum block number constraint.
#[cfg_attr(feature = "serde", serde(default, skip_serializing_if = "Option::is_none"))]
#[cfg_attr(
feature = "serde",
serde(
default,
with = "alloy_serde::quantity::opt",
skip_serializing_if = "Option::is_none"
)
)]
pub block_number_min: Option<BlockNumber>,
/// The maximal block number at which the transaction can be included.
/// `None` indicates no maximum block number constraint.
#[cfg_attr(feature = "serde", serde(default, skip_serializing_if = "Option::is_none"))]
#[cfg_attr(
feature = "serde",
serde(
default,
with = "alloy_serde::quantity::opt",
skip_serializing_if = "Option::is_none"
)
)]
pub block_number_max: Option<BlockNumber>,
/// The minimal timestamp at which the transaction can be included.
/// `None` indicates no minimum timestamp constraint.
#[cfg_attr(feature = "serde", serde(default, skip_serializing_if = "Option::is_none"))]
#[cfg_attr(
feature = "serde",
serde(
default,
with = "alloy_serde::quantity::opt",
skip_serializing_if = "Option::is_none"
)
)]
pub timestamp_min: Option<u64>,
/// The maximal timestamp at which the transaction can be included.
/// `None` indicates no maximum timestamp constraint.
#[cfg_attr(feature = "serde", serde(default, skip_serializing_if = "Option::is_none"))]
#[cfg_attr(
feature = "serde",
serde(
default,
with = "alloy_serde::quantity::opt",
skip_serializing_if = "Option::is_none"
)
)]
pub timestamp_max: Option<u64>,
}

/// Represents the expected state of an account for a transaction to be conditionally accepted.
///
/// Allows for a user to express their preference of a known prestate at a particular account. Only
/// one of the storage root or storage slots is allowed to be set. If the storage root is set, then
/// the user prefers their transaction to only be included in a block if the account's storage root
/// matches. If the storage slots are set, then the user prefers their transaction to only be
/// included if the particular storage slot values from state match.
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(untagged))]
Expand Down

0 comments on commit 20f70c5

Please sign in to comment.