根据钱包(区块链)助记词查询钱包的余额(可以是 btc ,eth 等)
试了一下 gpt-4 、Claude-Opus 、谷歌 gemini-pro 、通义千问、百度灵码,结果全部翻车。没一个正常的,出现
的错误发给它,反复修改几遍还是无法正常运行。
选取部分错误
Traceback (most recent call last): File "/root/pyu.py", line 3, in <module> from eth_account.hdaccount import mnemonic_to_private_key ImportError: cannot import name 'mnemonic_to_private_key' from 'eth_account.hdaccount' (/usr/local/lib/python3.10/dist-packages/eth_account/hdaccount/__init__.py)
Traceback (most recent call last): File "/root/e1.py", line 10, in <module> if web3.isConnected(): AttributeError: 'Web3' object has no attribute 'isConnected'. Did you mean: 'is_connected'?
Traceback (most recent call last): File "/root/e2.py", line 35, in <module> wallet_address = wallet.get_address(0, 0) AttributeError: 'Wallet' object has no attribute 'get_address'
Traceback (most recent call last): File "/root/e3.py", line 27, in <module> wallet = bip44.Wallet(seed) File "/usr/local/lib/python3.10/dist-packages/bip44/wallet.py", line 20, in __init__ self._seed = Mnemonic(language).to_seed(mnemonic, passphrase) File "/usr/local/lib/python3.10/dist-packages/mnemonic/mnemonic.py", line 234, in to_seed mnemonic = cls.normalize_string(mnemonic) File "/usr/local/lib/python3.10/dist-packages/mnemonic/mnemonic.py", line 96, in normalize_string utxt = txt.decode("utf8") UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9e in position 0: invalid start byte
Traceback (most recent call last): File "/root/b1.py", line 30, in <module> balance = get_wallet_balance_from_mnemonic(mnemonic) File "/root/b1.py", line 5, in get_wallet_balance_from_mnemonic private_key = Web3.to_checksum_address(Web3.accounts.privateKeyFromMnemonic(mnemonic)) AttributeError: type object 'Web3' has no attribute 'accounts'
1
zhutianjingtu 257 天前
😂
|
2
HojiOShi 257 天前
😂
|
3
zeusho871 257 天前
是这个库更新太快了吧。。。你得问问版本 或者看看代码 他们调用的 api 是对的
|