diff --git a/Cargo.toml b/Cargo.toml index 3702ec50..f6c40001 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -174,3 +174,13 @@ required-features = ["yubi"] name = "paginated_logs" path = "examples/paginated_logs.rs" required-features = ["rustls"] + +[[example]] +name = "subscribe_contract_events" +path = "examples/subscribe_contract_events.rs" +required-features = ["rustls", "ws"] + +[[example]] +name = "subscribe_contract_events_with_meta" +path = "examples/subscribe_contract_events_with_meta.rs" +required-features = ["rustls", "ws"] diff --git a/ethers-contract/src/multicall/mod.rs b/ethers-contract/src/multicall/mod.rs index a8d05145..80f76c8c 100644 --- a/ethers-contract/src/multicall/mod.rs +++ b/ethers-contract/src/multicall/mod.rs @@ -28,7 +28,7 @@ pub const MULTICALL_ADDRESS: Address = H160([ ]); /// The chain IDs that [`MULTICALL_ADDRESS`] has been deployed to. -/// Taken from: https://github.com/mds1/multicall#multicall3-contract-addresses +/// Taken from: pub static MULTICALL_SUPPORTED_CHAIN_IDS: Lazy<[U256; 48]> = Lazy::new(|| { use Chain::*; [ @@ -42,7 +42,7 @@ pub static MULTICALL_SUPPORTED_CHAIN_IDS: Lazy<[U256; 48]> = Lazy::new(|| { U256::from(OptimismGoerli), // OptimismGoerli U256::from(OptimismKovan), // OptimismKovan U256::from(Arbitrum), // Arbitrum - U256::from(421613), // ArbitrumGoerli, + U256::from(ArbitrumGoerli), // ArbitrumGoerli, U256::from(ArbitrumTestnet), // Arbitrum Rinkeby U256::from(Polygon), // Polygon U256::from(PolygonMumbai), // PolygonMumbai diff --git a/ethers-core/src/types/mod.rs b/ethers-core/src/types/mod.rs index 3c2aff0e..335f8540 100644 --- a/ethers-core/src/types/mod.rs +++ b/ethers-core/src/types/mod.rs @@ -6,7 +6,7 @@ pub type Selector = [u8; 4]; pub use ethabi::ethereum_types::H256 as TxHash; pub use ethabi::ethereum_types::{ - Address, BigEndianHash, Bloom, H128, H160, H256, H32, H512, H64, U128, U256, U64, U512, + Address, BigEndianHash, Bloom, H128, H160, H256, H32, H512, H64, U128, U256, U512, U64, }; pub mod transaction; diff --git a/ethers-core/src/utils/mod.rs b/ethers-core/src/utils/mod.rs index 9aaefc43..1a0b0c1b 100644 --- a/ethers-core/src/utils/mod.rs +++ b/ethers-core/src/utils/mod.rs @@ -156,7 +156,7 @@ where K: TryInto + Copy, { let exponent: u32 = units.try_into()?.as_num(); - let mut amount_str = amount.to_string().replace("_", ""); + let mut amount_str = amount.to_string().replace('_', ""); let dec_len = if let Some(di) = amount_str.find('.') { amount_str.remove(di); amount_str[di..].len() as u32 diff --git a/ethers-middleware/tests/signer.rs b/ethers-middleware/tests/signer.rs index df00babe..efa35ad8 100644 --- a/ethers-middleware/tests/signer.rs +++ b/ethers-middleware/tests/signer.rs @@ -147,18 +147,22 @@ async fn typed_txs() { assert_eq!(tx.transaction_type, Some(expected.into())); } - let mut nonce = provider.get_transaction_count(address, None).await.unwrap(); - let tx = TransactionRequest::new().from(address).to(address).nonce(nonce); - nonce += 1.into(); - let tx1 = - provider.send_transaction(tx.clone(), Some(BlockNumber::Pending.into())).await.unwrap(); + let nonce = provider.get_transaction_count(address, None).await.unwrap(); + let bn = Some(BlockNumber::Pending.into()); + let gas_price = provider.get_gas_price().await.unwrap() * 125 / 100; - let tx = tx.clone().nonce(nonce).from(address).to(address).with_access_list(vec![]); - nonce += 1.into(); - let tx2 = provider.send_transaction(tx, Some(BlockNumber::Pending.into())).await.unwrap(); + let tx = TransactionRequest::new().from(address).to(address).nonce(nonce).gas_price(gas_price); + let tx1 = provider.send_transaction(tx.clone(), bn).await.unwrap(); - let tx = Eip1559TransactionRequest::new().from(address).to(address).nonce(nonce); - let tx3 = provider.send_transaction(tx, Some(BlockNumber::Pending.into())).await.unwrap(); + let tx = tx.clone().from(address).to(address).nonce(nonce + 1).with_access_list(vec![]); + let tx2 = provider.send_transaction(tx, bn).await.unwrap(); + + let tx = Eip1559TransactionRequest::new() + .from(address) + .to(address) + .nonce(nonce + 2) + .max_fee_per_gas(gas_price); + let tx3 = provider.send_transaction(tx, bn).await.unwrap(); futures_util::join!(check_tx(tx1, 0), check_tx(tx2, 1), check_tx(tx3, 2),); } diff --git a/scripts/examples.sh b/scripts/examples.sh index 594d639e..ee50628e 100755 --- a/scripts/examples.sh +++ b/scripts/examples.sh @@ -10,7 +10,7 @@ ignored=( "subscribe_logs" "trezor" "yubi" - "remove_liquidty" + "remove_liquidity" ) # run all examples @@ -21,5 +21,5 @@ for file in examples/*.rs; do continue fi echo "running: $file" - cargo r -p ethers --example "$(basename "$name")" --features "ethers-solc" + cargo r -p ethers --example "$(basename "$name")" --features "ethers-solc rustls ws" done