@@ -402,7 +402,7 @@ def get_transaction_data(
402
402
abi = abi , abi_codec = web3 .codec , fn_identifier = function_name , args = args , kwargs = kwargs
403
403
)
404
404
return encode_transaction_data (
405
- web3 = web3 ,
405
+ w3 = web3 ,
406
406
fn_identifier = function_name ,
407
407
contract_abi = abi ,
408
408
fn_abi = fn_abi ,
@@ -640,8 +640,8 @@ def estimate_gas_for_function(
640
640
) -> int :
641
641
"""Temporary workaround until next web3.py release (5.X.X)"""
642
642
estimate_transaction = prepare_transaction (
643
+ w3 = web3 ,
643
644
address = to_checksum_address (address ),
644
- web3 = web3 ,
645
645
fn_identifier = fn_identifier ,
646
646
contract_abi = contract_abi ,
647
647
fn_abi = fn_abi ,
@@ -924,10 +924,10 @@ def estimate_gas(
924
924
if not expected_error :
925
925
raise err
926
926
927
- block = self .data .contract .web3 .eth .get_block (BLOCK_ID_LATEST )
927
+ block = self .data .contract .w3 .eth .get_block (BLOCK_ID_LATEST )
928
928
929
929
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 )
931
931
932
932
transaction_estimated = TransactionEstimated (
933
933
from_address = self .from_address ,
@@ -942,7 +942,7 @@ def estimate_gas(
942
942
log .debug (
943
943
"Transaction gas estimated" ,
944
944
** 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 ,
946
946
)
947
947
948
948
return transaction_estimated
@@ -1296,7 +1296,7 @@ def to_log_details(self) -> Dict[str, Any]:
1296
1296
if isinstance (slot .data , SmartContractCall ):
1297
1297
function_call = slot .data
1298
1298
data = get_transaction_data (
1299
- web3 = function_call .contract .web3 ,
1299
+ web3 = function_call .contract .w3 ,
1300
1300
abi = function_call .contract .abi ,
1301
1301
function_name = function_call .function ,
1302
1302
args = function_call .args ,
@@ -1412,7 +1412,9 @@ def to_log_details(self) -> Dict[str, Any]:
1412
1412
def new_contract_proxy (
1413
1413
self , abi : ABI , contract_address : Union [Address , ChecksumAddress ]
1414
1414
) -> 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
1416
1418
1417
1419
def deploy_single_contract (
1418
1420
self ,
@@ -1431,8 +1433,9 @@ def deploy_single_contract(
1431
1433
1432
1434
ctor_parameters = constructor_parameters or ()
1433
1435
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 ()
1436
1439
constructor_call = ByteCode (contract_name , contract_transaction ["data" ])
1437
1440
1438
1441
block = self .get_block (BLOCK_ID_LATEST )
0 commit comments