Skip to content

Commit

Permalink
feat: EIP-4844 gas methods in builder
Browse files Browse the repository at this point in the history
  • Loading branch information
onbjerg committed Mar 11, 2024
1 parent b809324 commit 98b7c67
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/network/src/ethereum/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ impl TransactionBuilder<Ethereum> for alloy_rpc_types::TransactionRequest {
self.max_priority_fee_per_gas = Some(max_priority_fee_per_gas);
}

fn max_fee_per_blob_gas(&self) -> Option<U256> {
self.max_fee_per_blob_gas
}

fn set_max_fee_per_blob_gas(&mut self, max_fee_per_blob_gas: U256) {
self.max_fee_per_blob_gas = Some(max_fee_per_blob_gas)
}

fn gas_limit(&self) -> Option<U256> {
self.gas
}
Expand Down
12 changes: 12 additions & 0 deletions crates/network/src/transaction/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,18 @@ pub trait TransactionBuilder<N: Network>: Default + Sized + Send + Sync + 'stati
self
}

/// Get the max fee per blob gas for the transaction.
fn max_fee_per_blob_gas(&self) -> Option<U256>;

/// Set the max fee per blob gas for the transaction.
fn set_max_fee_per_blob_gas(&mut self, max_fee_per_blob_gas: U256);

/// Builder-pattern method for setting max fee per blob gas .
fn with_max_fee_per_blob_gas(mut self, max_fee_per_blob_gas: U256) -> Self {
self.set_max_fee_per_blob_gas(max_fee_per_blob_gas);
self
}

/// Get the gas limit for the transaction.
fn gas_limit(&self) -> Option<U256>;

Expand Down

0 comments on commit 98b7c67

Please sign in to comment.