@@ -716,9 +716,7 @@ mod tryethers {
716
716
use eth_trie:: { EthTrie , MemoryDB , Trie } ;
717
717
use ethers:: {
718
718
providers:: { Http , Middleware , Provider } ,
719
- types:: {
720
- Block , BlockId , Bytes , EIP1186ProofResponse , Transaction , TransactionReceipt , H256 , U64 ,
721
- } ,
719
+ types:: { BlockId , Bytes , Transaction , TransactionReceipt , U64 } ,
722
720
} ;
723
721
use rlp:: { Encodable , RlpStream } ;
724
722
@@ -866,9 +864,9 @@ mod test {
866
864
use std:: str:: FromStr ;
867
865
868
866
use alloy:: {
869
- node_bindings :: Anvil ,
870
- primitives:: { Bytes , Log } ,
871
- providers:: { Provider , ProviderBuilder , WalletProvider } ,
867
+ network :: TransactionBuilder ,
868
+ primitives:: { Bytes , Log , U256 } ,
869
+ providers:: { ext :: AnvilApi , Provider , ProviderBuilder } ,
872
870
rlp:: Decodable ,
873
871
sol,
874
872
} ;
@@ -1018,9 +1016,7 @@ mod test {
1018
1016
1019
1017
#[ tokio:: test]
1020
1018
async fn test_receipt_query ( ) -> Result < ( ) > {
1021
- let rpc = ProviderBuilder :: new ( )
1022
- . with_recommended_fillers ( )
1023
- . on_anvil_with_wallet_and_config ( |anvil| Anvil :: block_time ( anvil, 1 ) ) ;
1019
+ let rpc = ProviderBuilder :: new ( ) . on_anvil ( ) ;
1024
1020
1025
1021
// Make a contract that emits events so we can pick up on them
1026
1022
sol ! {
@@ -1053,28 +1049,30 @@ mod test {
1053
1049
1054
1050
// Fire off a few transactions to emit some events
1055
1051
1056
- let address = rpc. default_signer_address ( ) ;
1057
- let current_nonce = rpc. get_transaction_count ( address) . await ?;
1058
-
1059
1052
let tx_reqs = ( 0 ..10 )
1060
1053
. map ( |i| match i % 2 {
1061
- 0 => contract
1062
- . testEmit ( )
1063
- . into_transaction_request ( )
1064
- . nonce ( current_nonce + i as u64 ) ,
1065
- 1 => contract
1066
- . twoEmits ( )
1067
- . into_transaction_request ( )
1068
- . nonce ( current_nonce + i as u64 ) ,
1054
+ 0 => contract. testEmit ( ) . into_transaction_request ( ) ,
1055
+ 1 => contract. twoEmits ( ) . into_transaction_request ( ) ,
1069
1056
_ => unreachable ! ( ) ,
1070
1057
} )
1071
1058
. collect :: < Vec < _ > > ( ) ;
1072
1059
let mut join_set = JoinSet :: new ( ) ;
1060
+
1073
1061
tx_reqs. into_iter ( ) . for_each ( |tx_req| {
1074
1062
let rpc_clone = rpc. clone ( ) ;
1075
1063
join_set. spawn ( async move {
1076
1064
rpc_clone
1077
- . send_transaction ( tx_req)
1065
+ . anvil_auto_impersonate_account ( true )
1066
+ . await
1067
+ . unwrap ( ) ;
1068
+ let sender_address = Address :: random ( ) ;
1069
+ let balance = U256 :: from ( 1e18 as u64 ) ;
1070
+ rpc_clone
1071
+ . anvil_set_balance ( sender_address, balance)
1072
+ . await
1073
+ . unwrap ( ) ;
1074
+ rpc_clone
1075
+ . send_transaction ( tx_req. with_from ( sender_address) )
1078
1076
. await
1079
1077
. unwrap ( )
1080
1078
. watch ( )
0 commit comments