multiversx / mx-sdk-py-cli

Python Command Line Tools and SDK for interacting with the MultiversX blockchain and dApps.
Other
48 stars 36 forks source link

`KeyError: bech32` when signing with keyfile #236

Closed ctindogaru closed 1 year ago

ctindogaru commented 1 year ago

I'm getting the following error when I'm using mxpy contract call --keyfile

Traceback (most recent call last):
  File "/Users/constantindogaru/.pyenv/versions/3.8.16/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/constantindogaru/.pyenv/versions/3.8.16/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/constantindogaru/multiversx-sdk/mxpy-venv/lib/python3.8/site-packages/multiversx_sdk_cli/cli.py", line 110, in <module>
    ret = main(sys.argv[1:])
  File "/Users/constantindogaru/multiversx-sdk/mxpy-venv/lib/python3.8/site-packages/multiversx_sdk_cli/cli.py", line 29, in main
    _do_main(cli_args)
  File "/Users/constantindogaru/multiversx-sdk/mxpy-venv/lib/python3.8/site-packages/multiversx_sdk_cli/cli.py", line 54, in _do_main
    args.func(args)
  File "/Users/constantindogaru/multiversx-sdk/mxpy-venv/lib/python3.8/site-packages/multiversx_sdk_cli/cli_contracts.py", line 381, in call
    sender = _prepare_sender(args)
  File "/Users/constantindogaru/multiversx-sdk/mxpy-venv/lib/python3.8/site-packages/multiversx_sdk_cli/cli_contracts.py", line 338, in _prepare_sender
    sender = Account(key_file=args.keyfile, password=password)
  File "/Users/constantindogaru/multiversx-sdk/mxpy-venv/lib/python3.8/site-packages/multiversx_sdk_cli/accounts.py", line 59, in __init__
    self.signer = UserSigner.from_wallet(key_file_path, password)
  File "/Users/constantindogaru/multiversx-sdk/mxpy-venv/lib/python3.8/site-packages/multiversx_sdk_wallet/user_signer.py", line 25, in from_wallet
    secret_key = UserWallet.decrypt_secret_key_from_file(path, password)
  File "/Users/constantindogaru/multiversx-sdk/mxpy-venv/lib/python3.8/site-packages/multiversx_sdk_wallet/user_wallet.py", line 22, in decrypt_secret_key_from_file
    return cls.decrypt_secret_key(key_file_object, password)
  File "/Users/constantindogaru/multiversx-sdk/mxpy-venv/lib/python3.8/site-packages/multiversx_sdk_wallet/user_wallet.py", line 26, in decrypt_secret_key
    _, buffer = keyfile.load_from_key_file_object(keyfile_object, password)
  File "/Users/constantindogaru/multiversx-sdk/mxpy-venv/lib/python3.8/site-packages/multiversx_sdk_wallet/keyfile.py", line 61, in load_from_key_file_object
    address_bech32 = keystore['bech32']
KeyError: 'bech32'

macOS version: Ventura 13.2.1 mxpy version: 6.0.1

andreibancioiu commented 1 year ago

Will be fixed by https://github.com/multiversx/mx-sdk-py-cli/pull/235.

Thank you!

andreibancioiu commented 1 year ago

Fixed in v6.1.0.

Thank you!