@@ -402,7 +402,7 @@ def get_transaction_data(
402402 abi = abi , abi_codec = web3 .codec , fn_identifier = function_name , args = args , kwargs = kwargs
403403 )
404404 return encode_transaction_data (
405- web3 = web3 ,
405+ w3 = web3 ,
406406 fn_identifier = function_name ,
407407 contract_abi = abi ,
408408 fn_abi = fn_abi ,
@@ -640,8 +640,8 @@ def estimate_gas_for_function(
640640) -> int :
641641 """Temporary workaround until next web3.py release (5.X.X)"""
642642 estimate_transaction = prepare_transaction (
643+ w3 = web3 ,
643644 address = to_checksum_address (address ),
644- web3 = web3 ,
645645 fn_identifier = fn_identifier ,
646646 contract_abi = contract_abi ,
647647 fn_abi = fn_abi ,
@@ -924,10 +924,10 @@ def estimate_gas(
924924 if not expected_error :
925925 raise err
926926
927- block = self .data .contract .web3 .eth .get_block (BLOCK_ID_LATEST )
927+ block = self .data .contract .w3 .eth .get_block (BLOCK_ID_LATEST )
928928
929929 if estimated_gas is not None :
930- gas_price = gas_price_for_fast_transaction (self .data .contract .web3 )
930+ gas_price = gas_price_for_fast_transaction (self .data .contract .w3 )
931931
932932 transaction_estimated = TransactionEstimated (
933933 from_address = self .from_address ,
@@ -942,7 +942,7 @@ def estimate_gas(
942942 log .debug (
943943 "Transaction gas estimated" ,
944944 ** transaction_estimated .to_log_details (),
945- node_gas_price = self .data .contract .web3 .eth .gas_price ,
945+ node_gas_price = self .data .contract .w3 .eth .gas_price ,
946946 )
947947
948948 return transaction_estimated
@@ -1296,7 +1296,7 @@ def to_log_details(self) -> Dict[str, Any]:
12961296 if isinstance (slot .data , SmartContractCall ):
12971297 function_call = slot .data
12981298 data = get_transaction_data (
1299- web3 = function_call .contract .web3 ,
1299+ web3 = function_call .contract .w3 ,
13001300 abi = function_call .contract .abi ,
13011301 function_name = function_call .function ,
13021302 args = function_call .args ,
@@ -1412,7 +1412,9 @@ def to_log_details(self) -> Dict[str, Any]:
14121412 def new_contract_proxy (
14131413 self , abi : ABI , contract_address : Union [Address , ChecksumAddress ]
14141414 ) -> Contract :
1415- return self .web3 .eth .contract (abi = abi , address = contract_address )
1415+ contract = self .web3 .eth .contract (abi = abi , address = contract_address )
1416+ assert isinstance (contract , Contract )
1417+ return contract
14161418
14171419 def deploy_single_contract (
14181420 self ,
@@ -1431,8 +1433,9 @@ def deploy_single_contract(
14311433
14321434 ctor_parameters = constructor_parameters or ()
14331435
1434- contract_object = self .web3 .eth .contract (abi = contract ["abi" ], bytecode = contract ["bin" ])
1435- contract_transaction = contract_object .constructor (* ctor_parameters ).buildTransaction ()
1436+ contract_object = self .web3 .eth .contract (abi = contract ["abi" ], bytecode = contract ["bin" ])()
1437+ assert isinstance (contract_object , Contract )
1438+ contract_transaction = contract_object .constructor (* ctor_parameters ).build_transaction ()
14361439 constructor_call = ByteCode (contract_name , contract_transaction ["data" ])
14371440
14381441 block = self .get_block (BLOCK_ID_LATEST )
0 commit comments