ethereum / web3.py

A python interface for interacting with the Ethereum blockchain and ecosystem.
http://web3py.readthedocs.io
MIT License
4.98k stars 1.7k forks source link

Snakecase modify_transaction not available #2087

Closed k128 closed 3 years ago

k128 commented 3 years ago
aiohttp==3.7.4.post0
aiohttp-sse-client==0.2.1
aiostream==0.4.3
async-generator==1.10
async-timeout==3.0.1
attrs==21.2.0
backcall==0.2.0
base58==2.1.0
beautifulsoup4==4.9.3
bitarray==1.2.2
camelot-py==0.10.1
certifi==2021.5.30
cffi==1.14.6
chardet==4.0.0
charset-normalizer==2.0.3
click==8.0.1
colorama==0.4.4
configparser==5.0.2
crayons==0.4.0
cryptography==3.4.7
cytoolz==0.11.0
decorator==5.0.9
deprecation==2.1.0
et-xmlfile==1.1.0
eth-abi==2.1.1
eth-account==0.5.5
eth-hash==0.3.1
eth-keyfile==0.5.1
eth-keys==0.3.3
eth-rlp==0.2.1
eth-typing==2.2.2
eth-utils==1.10.0
frozendict==2.0.3
hexbytes==0.2.1
idna==2.10
ipfshttpclient==0.7.0
ipython==7.25.0
ipython-genutils==0.2.0
jedi==0.18.0
jsonschema==3.2.0
lru-dict==1.1.7
matplotlib-inline==0.1.2
multiaddr==0.0.9
multidict==5.1.0
netaddr==0.8.0
nomics-python==3.2.0
numpy==1.20.1
opencv-python==4.5.3.56
openpyxl==3.0.7
outcome==1.1.0
packaging==21.0
pandas==1.2.2
parsimonious==0.8.1
parso==0.8.2
pdfminer.six==20201018
pickleshare==0.7.5
Pillow==8.3.1
prompt-toolkit==3.0.19
protobuf==3.17.3
pycoingecko==2.2.0
pycparser==2.20
pycryptodome==3.10.1
pyEX==0.5.0
Pygments==2.9.0
PyMuPDF==1.18.15
pyotp==2.6.0
pyparsing==2.4.7
PyPDF2==1.26.0
pypiwin32==223
pyrsistent==0.18.0
python-dateutil==2.8.1
python-dotenv==0.19.0
pytz==2021.1
pywin32==301
requests==2.26.0
rlp==2.0.1
robin-stocks==2.0.4
scipy==1.7.0
selenium==3.141.0
six==1.15.0
sniffio==1.2.0
socketIO-client-nexus==0.7.6
sortedcontainers==2.4.0
soupsieve==2.2.1
sseclient==0.0.27
tabulate==0.8.9
temporal-cache==0.1.4
toolz==0.11.1
traitlets==5.0.5
trio==0.19.0
typing-extensions==3.10.0.0
tzlocal==2.1
urllib3==1.26.6
varint==1.0.2
wcwidth==0.2.5
web3==5.17.0
webdriver-manager==3.4.2
webencodings==0.5.1
websocket-client==1.1.0
websockets==9.1
yarl==1.6.3

What was wrong?

Despite the documentation saying that modifyTransaction is deprecated in favor of modify_transaction, modify_transaction is unavailable.

>>> w3=Web3(Web3.HTTPProvider('https://rpc-mainnet.maticvigil.com/v1/myappID'))
>>> w3.eth.modify_transaction
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Eth' object has no attribute 'modify_transaction'
>>> [x for x in dir(w3.eth) if 'modify' in x]
['modifyTransaction']
k128 commented 3 years ago

Same issue with get_transaction_receipt. Not sure if this is intentional or if I'm missing something.

fselmo commented 3 years ago

Hey @k128 . These are methods and thus need to have parentheses at the end. But also, you need to pass the transaction hash and the values to be modified. Please consult the docs for examples on each method:

https://web3py.readthedocs.io/en/latest/web3.eth.html?highlight=modify_transaction#web3.eth.Eth.modify_transaction

k128 commented 3 years ago

Hey @k128 . These are methods and thus need to have parentheses at the end. But also, you need to pass the transaction hash and the values to be modified. Please consult the docs for examples on each method:

https://web3py.readthedocs.io/en/latest/web3.eth.html?highlight=modify_transaction#web3.eth.Eth.modify_transaction

fselmo, in python, object.method returns a method object if it exists. For example:

>>> w3.eth.modifyTransaction

<bound method Eth.modifyTransaction of <web3.eth.Eth object at 0x000001E8D78483A0>>

This code shows that w3.eth has a method called modifyTransaction. My original example demonstrates that the object w3.eth has no method called modify_transaction, which is the issue.

fselmo commented 3 years ago

@k128 Ah yep! You are absolutely right that should not be the expected result here. Looks like these changes came in at 5.18.0 and you are at 5.17.0 though based on your pip freeze. You may have caught non-ideal messaging between versions. Any chance you can update web3 to the latest?

k128 commented 3 years ago

Ok, updating to the lastest version seems to have fixed the issue. Thanks!