Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support hex values for conditional options #1824

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading