-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider) : introduction to eth_sendRawTransactionConditional RP…
…C endpoint type (#1009) * Update request.rs * Update trait.rs * clippy * Update trait.rs * Update trait.rs * added reference and camelCase serde * Update request.rs * Update lib.rs * Create eip4337.rs * Update eip4337.rs * fix serde * reorder --------- Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
- Loading branch information
1 parent
c715e57
commit 423a4c5
Showing
3 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use alloy_primitives::{Address, BlockNumber, B256, U256}; | ||
use serde::{Deserialize, Serialize}; | ||
use std::collections::HashMap; | ||
|
||
/// Options for conditional raw transaction submissions. | ||
// reference for the implementation <https://notes.ethereum.org/@yoav/SkaX2lS9j#> | ||
// See also <https://pkg.go.dev/github.com/aK0nshin/go-ethereum/arbitrum_types#ConditionalOptions> | ||
#[derive(Debug, Serialize, Deserialize, Clone, Default)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct ConditionalOptions { | ||
/// A map of account addresses to their expected storage states. | ||
/// Each account can have a specified storage root or explicit slot-value pairs. | ||
#[serde(default)] | ||
pub known_accounts: HashMap<Address, AccountStorage>, | ||
/// The minimal block number at which the transaction can be included. | ||
/// `None` indicates no minimum block number constraint. | ||
#[serde(default, 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. | ||
#[serde(default, 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. | ||
#[serde(default, 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. | ||
#[serde(default, 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. | ||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
#[serde(untagged)] | ||
pub enum AccountStorage { | ||
/// Expected storage root hash of the account. | ||
RootHash(B256), | ||
/// Explicit storage slots and their expected values. | ||
Slots(HashMap<U256, B256>), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters