Skip to content

Commit 05e53b8

Browse files
committed
Fix problems introduced by update to web3 v6
1 parent bcf1b7f commit 05e53b8

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Changelog
2+
3+
## 0.1.8 (2022-10-13)
4+
* Fix problems introduced by update to web3 v6
5+
26
## 0.1.7 (2022-10-13)
37
* Update dependencies
48

raiden_common/network/proxies/token_network_registry.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ def filter_token_added_events(self) -> List[Dict[str, Any]]:
504504
)
505505
events = filter_.get_all_entries()
506506
if filter_.filter_id:
507-
self.proxy.web3.eth.uninstallFilter(filter_.filter_id)
507+
self.proxy.w3.eth.uninstall_filter(filter_.filter_id)
508508

509509
return events
510510

raiden_common/network/rpc/client.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -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)

raiden_common/tasks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def check_gas_reserve(raiden: "RaidenService") -> None: # pragma: no unittest
9898
has_enough_balance, estimated_required_balance = gas_reserve.has_enough_gas_reserve(
9999
raiden, channels_to_open=1
100100
)
101-
estimated_required_balance_eth = Web3.fromWei(estimated_required_balance, "ether")
101+
estimated_required_balance_eth = Web3.from_wei(estimated_required_balance, "ether")
102102

103103
if not has_enough_balance:
104104
notification_body = (

0 commit comments

Comments
 (0)