Stop using deprecated web3.py interface (#1759)

* Refactor contract function call to support web3.py v5.0.0. (backwards compatible with v4)
This commit is contained in:
Ryan Chow 2019-04-09 06:33:36 -07:00 committed by F. Eugene Aumson
parent 2ff5c39712
commit 6c36832f0e
2 changed files with 13 additions and 4 deletions

View File

@ -428,9 +428,9 @@ def is_valid_signature(
)
try:
return (
contract.call().isValidSignature(
contract.functions.isValidSignature(
data, to_checksum_address(signer_address), signature
),
).call(),
"",
)
except web3.exceptions.BadFunctionCallOutput as exception:

View File

@ -1,3 +1,12 @@
class Contract:
def call(self): ...
from typing import Callable
class ContractFunctions:
def __getattr__(self, function_name) -> Callable:
...
...
class Contract:
functions: ContractFunctions
...