Skip to content

Commit

Permalink
fix: apply changes from other PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
prestwich committed Apr 5, 2024
1 parent 8022cc8 commit 7353f79
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion crates/provider/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ impl<L, F> ProviderBuilder<L, F, Ethereum> {

let this = self.signer(crate::network::EthereumSigner::from(wallet));

(this.on_reqwest_http(url).unwrap(), anvil)
(this.on_http(url).unwrap(), anvil)
}
}

Expand Down
10 changes: 5 additions & 5 deletions crates/provider/src/fillers/chain_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl<N: Network> TxFiller<N> for ChainIdFiller {
match self.0.get().copied() {
Some(chain_id) => Ok(chain_id),
None => {
let chain_id = provider.get_chain_id().await?.as_limbs()[0];
let chain_id = provider.get_chain_id().await?;
let chain_id = *self.0.get_or_init(|| chain_id);
Ok(chain_id)
}
Expand All @@ -82,11 +82,11 @@ impl<N: Network> TxFiller<N> for ChainIdFiller {
fillable: Self::Fillable,
mut tx: SendableTx<N>,
) -> TransportResult<SendableTx<N>> {
tx.as_mut_builder().map(|tx| {
if tx.chain_id().is_none() {
tx.set_chain_id(fillable)
if let Some(builder) = tx.as_mut_builder() {
if builder.chain_id().is_none() {
builder.set_chain_id(fillable)
}
});
};
Ok(tx)
}
}
29 changes: 15 additions & 14 deletions crates/provider/src/fillers/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,23 +221,24 @@ impl<N: Network> TxFiller<N> for GasFiller {
fillable: Self::Fillable,
mut tx: SendableTx<N>,
) -> TransportResult<SendableTx<N>> {
tx.as_mut_builder().map(|tx| match fillable {
if let Some(builder) = tx.as_mut_builder(){
match fillable {
GasFillable::Legacy { gas_limit, gas_price } => {
tx.set_gas_limit(gas_limit);
tx.set_gas_price(gas_price);
builder.set_gas_limit(gas_limit);
builder.set_gas_price(gas_price);
}
GasFillable::Eip1559 { gas_limit, estimate } => {
tx.set_gas_limit(gas_limit);
tx.set_max_fee_per_gas(estimate.max_fee_per_gas);
tx.set_max_priority_fee_per_gas(estimate.max_priority_fee_per_gas);
builder.set_gas_limit(gas_limit);
builder.set_max_fee_per_gas(estimate.max_fee_per_gas);
builder.set_max_priority_fee_per_gas(estimate.max_priority_fee_per_gas);
}
GasFillable::Eip4844 { gas_limit, estimate, max_fee_per_blob_gas } => {
tx.set_gas_limit(gas_limit);
tx.set_max_fee_per_gas(estimate.max_fee_per_gas);
tx.set_max_priority_fee_per_gas(estimate.max_priority_fee_per_gas);
tx.set_max_fee_per_blob_gas(max_fee_per_blob_gas);
}
});
builder.set_gas_limit(gas_limit);
builder.set_max_fee_per_gas(estimate.max_fee_per_gas);
builder.set_max_priority_fee_per_gas(estimate.max_priority_fee_per_gas);
builder.set_max_fee_per_blob_gas(max_fee_per_blob_gas);
}}
};
Ok(tx)
}
}
Expand All @@ -247,8 +248,8 @@ impl<N: Network> TxFiller<N> for GasFiller {
mod tests {
use super::*;
use crate::ProviderBuilder;
use alloy_primitives::address;
use alloy_rpc_types::{AccessListItem, TransactionRequest};
use alloy_primitives::{address, U256};
use alloy_rpc_types::{TransactionRequest};

#[tokio::test]
async fn no_gas_price_or_limit() {
Expand Down
6 changes: 3 additions & 3 deletions crates/provider/src/fillers/nonce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ impl<N: Network> TxFiller<N> for NonceFiller {
nonce: Self::Fillable,
mut tx: SendableTx<N>,
) -> TransportResult<SendableTx<N>> {
tx.as_mut_builder().map(|tx| {
tx.set_nonce(nonce);
});
if let Some(builder) = tx.as_mut_builder(){
builder.set_nonce(nonce);
}
Ok(tx)
}
}
Expand Down

0 comments on commit 7353f79

Please sign in to comment.