diff --git a/multiversx_sdk_cli/cli_config.py b/multiversx_sdk_cli/cli_config.py index d1439ac2..4e03879d 100644 --- a/multiversx_sdk_cli/cli_config.py +++ b/multiversx_sdk_cli/cli_config.py @@ -103,7 +103,7 @@ def list_configs(args: Any): def delete_config(args: Any): config_file = config.resolve_config_path() if not config_file.is_file(): - logger.info(f"Config file not found. Aborting...") + logger.info("Config file not found. Aborting...") return confirm_continuation(f"The file `{str(config_file)}` will be deleted. Do you want to continue? (y/n)") diff --git a/multiversx_sdk_cli/cli_contracts.py b/multiversx_sdk_cli/cli_contracts.py index 0e00d697..1ff316fb 100644 --- a/multiversx_sdk_cli/cli_contracts.py +++ b/multiversx_sdk_cli/cli_contracts.py @@ -21,7 +21,7 @@ from multiversx_sdk_cli.interfaces import IAddress from multiversx_sdk_cli.projects.core import get_project_paths_recursively from multiversx_sdk_cli.projects.templates import Contract -from multiversx_sdk_cli.ux import show_message +from multiversx_sdk_cli.ux import show_message, show_warning logger = logging.getLogger("cli.contracts") @@ -302,10 +302,15 @@ def build(args: Any): def do_report(args: Any): + deprecation_message = "`mxpy contract report` is deprecated. Please use `sc-meta report` instead." + logger.warning(deprecation_message) + check_if_rust_is_installed() args_dict = args.__dict__ projects.do_report(args, args_dict) + show_warning(deprecation_message) + def run_tests(args: Any): check_if_rust_is_installed() diff --git a/multiversx_sdk_cli/cli_delegation.py b/multiversx_sdk_cli/cli_delegation.py index 7ce579f5..c341a850 100644 --- a/multiversx_sdk_cli/cli_delegation.py +++ b/multiversx_sdk_cli/cli_delegation.py @@ -171,7 +171,7 @@ def setup_parser(args: List[str], subparsers: Any) -> Any: "Create a delegation contract from validator data. Must be called by the node operator") sub.add_argument("--max-cap", required=True, help="total delegation cap in EGLD, fully denominated. Use value 0 for uncapped") - sub.add_argument("--fee", required=True, help=f"service fee as hundredths of percents. (e.g. a service fee of 37.45 percent is expressed by the integer 3745)") + sub.add_argument("--fee", required=True, help="service fee as hundredths of percents. (e.g. a service fee of 37.45 percent is expressed by the integer 3745)") _add_common_arguments(args, sub) sub.set_defaults(func=make_new_contract_from_validator_data) diff --git a/multiversx_sdk_cli/delegation/staking_provider.py b/multiversx_sdk_cli/delegation/staking_provider.py index 4d4834bb..418418dc 100644 --- a/multiversx_sdk_cli/delegation/staking_provider.py +++ b/multiversx_sdk_cli/delegation/staking_provider.py @@ -171,11 +171,13 @@ def prepare_transaction_for_unjailing_nodes(self, owner: IAccount, args: Any) -> delegation_contract = Address.new_from_bech32(args.delegation_contract) public_keys = self._load_validators_public_keys(args) + amount = int(args.value) tx = self._factory.create_transaction_for_unjailing_nodes( sender=owner.address, delegation_contract=delegation_contract, - public_keys=public_keys + public_keys=public_keys, + amount=amount ) tx.nonce = int(args.nonce) tx.version = int(args.version) diff --git a/multiversx_sdk_cli/dependencies/modules.py b/multiversx_sdk_cli/dependencies/modules.py index 6e778f44..3455b24d 100644 --- a/multiversx_sdk_cli/dependencies/modules.py +++ b/multiversx_sdk_cli/dependencies/modules.py @@ -10,7 +10,7 @@ myprocess, utils, workstation) from multiversx_sdk_cli.dependencies.resolution import ( DependencyResolution, get_dependency_resolution) -from multiversx_sdk_cli.ux import show_warning +from multiversx_sdk_cli.ux import show_message, show_warning logger = logging.getLogger("modules") @@ -241,7 +241,7 @@ def install(self, overwrite: bool) -> None: self._install_sc_meta() self._install_wasm_opt() self._install_twiggy() - self._install_sc_meta_deps() + show_message("To ensure sc-meta functions correctly, please install all the required dependencies by executing the following command: `sc-meta install all`.") def _check_install_env(self, apply_correction: bool = True): """ diff --git a/multiversx_sdk_cli/docker.py b/multiversx_sdk_cli/docker.py index b14e9ef2..02deb8bb 100644 --- a/multiversx_sdk_cli/docker.py +++ b/multiversx_sdk_cli/docker.py @@ -18,7 +18,7 @@ def is_docker_installed(): return True else: return False - except: + except Exception: logger.error("Something went wrong when checking if docker is installed!") diff --git a/multiversx_sdk_cli/ledger/ledger_app_handler.py b/multiversx_sdk_cli/ledger/ledger_app_handler.py index dde814ec..2ec9e955 100644 --- a/multiversx_sdk_cli/ledger/ledger_app_handler.py +++ b/multiversx_sdk_cli/ledger/ledger_app_handler.py @@ -30,7 +30,7 @@ class LedgerApp: def __init__(self): try: self.transport = Transport(interface="hid", debug=False) # Nano S/X using HID interface - except: + except Exception: raise LedgerError(CONNECTION_ERROR_MSG) def close(self): diff --git a/multiversx_sdk_cli/localnet/config_part.py b/multiversx_sdk_cli/localnet/config_part.py index e2df004f..cccdd17f 100644 --- a/multiversx_sdk_cli/localnet/config_part.py +++ b/multiversx_sdk_cli/localnet/config_part.py @@ -24,8 +24,8 @@ def _validate_overriding_entries(self, overriding: Dict[str, Any]) -> None: if unknown_entries: logger.error(f"""\ -Unknown localnet configuration entries: {unknown_entries}. -Please check the configuration of the localnet. +Unknown localnet configuration entries: {unknown_entries}. +Please check the configuration of the localnet. For "{self.get_name()}", the allowed entries are: {allowed_entries}.""") raise UnknownConfigurationError(f"Unknown localnet configuration entries: {unknown_entries}") diff --git a/multiversx_sdk_cli/simulation.py b/multiversx_sdk_cli/simulation.py index a6b1bbd4..bd5c41c6 100644 --- a/multiversx_sdk_cli/simulation.py +++ b/multiversx_sdk_cli/simulation.py @@ -1,5 +1,6 @@ from collections import OrderedDict from typing import Any, Dict, Protocol + from multiversx_sdk_cli.interfaces import ISimulateResponse, ITransaction from multiversx_sdk_cli.utils import ISerializable @@ -19,6 +20,7 @@ def to_dictionary(self) -> Dict[str, Any]: return dictionary + class Simulator(): def __init__(self, proxy: INetworkProvider) -> None: self.proxy = proxy diff --git a/multiversx_sdk_cli/tests/local_verify_server.py b/multiversx_sdk_cli/tests/local_verify_server.py index 010177c3..dbc989ab 100644 --- a/multiversx_sdk_cli/tests/local_verify_server.py +++ b/multiversx_sdk_cli/tests/local_verify_server.py @@ -1,5 +1,5 @@ -from http.server import HTTPServer, BaseHTTPRequestHandler import json +from http.server import BaseHTTPRequestHandler, HTTPServer HOST = 'localhost' PORT = 7777 @@ -14,7 +14,7 @@ def do_POST(self): if self.path == "/initialise": response = {'token': 7890} self.wfile.write(bytes(json.dumps(response), 'utf-8')) - + if self.path == "/verify": response = {'status': 'sent to verification'} self.wfile.write(bytes(json.dumps(response), 'utf-8')) diff --git a/multiversx_sdk_cli/tests/test_cli_staking_provider.py b/multiversx_sdk_cli/tests/test_cli_staking_provider.py index 6921fe4b..a657c0d1 100644 --- a/multiversx_sdk_cli/tests/test_cli_staking_provider.py +++ b/multiversx_sdk_cli/tests/test_cli_staking_provider.py @@ -223,6 +223,7 @@ def test_unjail_nodes(capsys: Any): "staking-provider", "unjail-nodes", "--bls-keys", f"{first_bls_key},{second_bls_key}", "--delegation-contract", "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqthllllsy5r6rh", + "--value", "5000000000000000000", "--pem", str(alice), "--chain", "T", "--nonce", "7", "--estimate-gas" @@ -235,6 +236,7 @@ def test_unjail_nodes(capsys: Any): assert transaction["sender"] == "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th" assert transaction["receiver"] == "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqthllllsy5r6rh" assert transaction["gasLimit"] == 13645500 + assert transaction["value"] == "5000000000000000000" def test_change_service_fee(capsys: Any): diff --git a/multiversx_sdk_cli/validators/__init__.py b/multiversx_sdk_cli/validators/__init__.py index c66ffcba..74a11e54 100644 --- a/multiversx_sdk_cli/validators/__init__.py +++ b/multiversx_sdk_cli/validators/__init__.py @@ -1,16 +1,11 @@ -from multiversx_sdk_cli.validators.core import (prepare_args_for_change_reward_address, - prepare_args_for_claim, - prepare_args_for_stake, - prepare_args_for_unbond, - prepare_args_for_unjail, - prepare_args_for_unstake, - prepare_args_for_unstake_nodes, - prepare_args_for_unstake_tokens, - prepare_args_for_unbond_tokens, - prepare_args_for_unbond_nodes, - prepare_args_for_clean_registered_data, - prepare_args_for_restake_unstaked_nodes) - +from multiversx_sdk_cli.validators.core import ( + prepare_args_for_change_reward_address, prepare_args_for_claim, + prepare_args_for_clean_registered_data, + prepare_args_for_restake_unstaked_nodes, prepare_args_for_stake, + prepare_args_for_unbond, prepare_args_for_unbond_nodes, + prepare_args_for_unbond_tokens, prepare_args_for_unjail, + prepare_args_for_unstake, prepare_args_for_unstake_nodes, + prepare_args_for_unstake_tokens) from multiversx_sdk_cli.validators.validators_file import ValidatorsFile __all__ = ["prepare_args_for_stake", diff --git a/multiversx_sdk_cli/version.py b/multiversx_sdk_cli/version.py index fa7c33f3..df09e4ce 100644 --- a/multiversx_sdk_cli/version.py +++ b/multiversx_sdk_cli/version.py @@ -9,7 +9,7 @@ def get_version() -> str: try: # Works for local development return _get_version_from_pyproject() - except Exception as error: + except Exception: try: # Works for the installed package return _get_version_from_metadata() diff --git a/mxpy-up.py b/mxpy-up.py index 8cfacc3e..24177d3a 100644 --- a/mxpy-up.py +++ b/mxpy-up.py @@ -21,9 +21,15 @@ def main(): parser.add_argument("--from-branch", help="use a branch of multiversx/mx-sdk-py-cli") parser.add_argument("--not-interactive", action="store_true", default=False) parser.add_argument("--verbose", action="store_true", default=False) + parser.add_argument("--ignore-deprecation", action="store_true", default=False, help="'mxpy-up.py' is obsolete, install using 'pipx': https://docs.multiversx.com/sdk-and-tools/sdk-py/installing-mxpy/#install-using-pipx") parser.set_defaults(modify_path=True) args = parser.parse_args() + logger.warning("'mxpy-up.py' is deprecated. Check out the documentation on how to install using `pipx`: https://docs.multiversx.com/sdk-and-tools/sdk-py/installing-mxpy/#install-using-pipx.") + + if not args.ignore_deprecation: + raise Exception("'mxpy-up.py' is deprecated, please install using `pipx`: https://docs.multiversx.com/sdk-and-tools/sdk-py/installing-mxpy/#install-using-pipx. If installing using 'mxpy-up` is necessary, provide the `--ignore-deprecation` flag.") + exact_version = args.exact_version from_branch = args.from_branch interactive = not args.not_interactive @@ -56,6 +62,8 @@ def main(): if interactive: guide_system_path_integration() + logger.warning("Installing `mxpy` using `mxpy-up.py` is deprecated. Check out the documentation on how to install using `pipx`: https://docs.multiversx.com/sdk-and-tools/sdk-py/installing-mxpy/#install-using-pipx") + def guard_non_root_user(): logger.debug("Checking user (should not be root).") @@ -260,7 +268,7 @@ def guide_system_path_integration(): return old_export_directive = f'export PATH="{Path("~/elrondsdk").expanduser()}:$PATH"\t# elrond-sdk' - new_export_directive = f'export PATH="${{HOME}}/multiversx-sdk:$PATH"\t# multiversx-sdk' + new_export_directive = 'export PATH="${{HOME}}/multiversx-sdk:$PATH"\t# multiversx-sdk' profile_files = get_profile_files() @@ -292,7 +300,7 @@ def guide_system_path_integration(): Your shell profile files: {profile_files_formatted} -The entry (entries) to remove: +The entry (entries) to remove: {old_export_directive} ############################################################################### Make sure you UNDERSTAND the above before proceeding further. @@ -306,12 +314,12 @@ def guide_system_path_integration(): ############################################################################### It seems that the path "~/multiversx-sdk" is already configured in shell profile. -To confirm this, CHECK the shell profile (now or after the installer script ends). +To confirm this, CHECK the shell profile (now or after the installer script ends). Your shell profile files: {profile_files_formatted} -The entry to check (it should be present): +The entry to check (it should be present): {new_export_directive}. ############################################################################### Make sure you UNDERSTAND the above before proceeding further.