Skip to content

Commit

Permalink
Merge branch 'feat/next' into relayed-v3
Browse files Browse the repository at this point in the history
  • Loading branch information
popenta committed Sep 18, 2024
2 parents 952cd34 + 830ed79 commit ff3de4c
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 30 deletions.
2 changes: 1 addition & 1 deletion multiversx_sdk_cli/cli_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down
7 changes: 6 additions & 1 deletion multiversx_sdk_cli/cli_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion multiversx_sdk_cli/cli_delegation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 3 additions & 1 deletion multiversx_sdk_cli/delegation/staking_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions multiversx_sdk_cli/dependencies/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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):
"""
Expand Down
2 changes: 1 addition & 1 deletion multiversx_sdk_cli/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!")


Expand Down
2 changes: 1 addition & 1 deletion multiversx_sdk_cli/ledger/ledger_app_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions multiversx_sdk_cli/localnet/config_part.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand Down
2 changes: 2 additions & 0 deletions multiversx_sdk_cli/simulation.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -19,6 +20,7 @@ def to_dictionary(self) -> Dict[str, Any]:

return dictionary


class Simulator():
def __init__(self, proxy: INetworkProvider) -> None:
self.proxy = proxy
Expand Down
4 changes: 2 additions & 2 deletions multiversx_sdk_cli/tests/local_verify_server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http.server import HTTPServer, BaseHTTPRequestHandler
import json
from http.server import BaseHTTPRequestHandler, HTTPServer

HOST = 'localhost'
PORT = 7777
Expand All @@ -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'))
Expand Down
2 changes: 2 additions & 0 deletions multiversx_sdk_cli/tests/test_cli_staking_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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):
Expand Down
21 changes: 8 additions & 13 deletions multiversx_sdk_cli/validators/__init__.py
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion multiversx_sdk_cli/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
16 changes: 12 additions & 4 deletions mxpy-up.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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).")
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit ff3de4c

Please sign in to comment.