From 96d21cf9e4f4cf925009b0a858f582c7fe129bc4 Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Tue, 3 Oct 2023 15:37:01 +0300 Subject: [PATCH] remove --tag argument from mxpy deps --- CLI.md | 70 ++++++++++++++++------ CLI.md.sh | 2 + multiversx_sdk_cli/cli_deps.py | 9 +-- multiversx_sdk_cli/dependencies/modules.py | 2 +- 4 files changed, 59 insertions(+), 24 deletions(-) diff --git a/CLI.md b/CLI.md index 6b7e9c6b..089d07d6 100644 --- a/CLI.md +++ b/CLI.md @@ -85,13 +85,12 @@ usage: mxpy contract new [-h] ... Create a new Smart Contract project based on a template. -positional arguments: - name - options: - -h, --help show this help message and exit - --template TEMPLATE the template to use - --directory DIRECTORY 🗀 the parent directory of the project (default: current directory) + -h, --help show this help message and exit + --name NAME The name of the contract. If missing, the name of the template will be used. + --template TEMPLATE the template to use + --tag TAG the framework version on which the contract should be created + --path PATH the parent directory of the project (default: current directory) ``` ### Contract.Templates @@ -105,6 +104,7 @@ List the available Smart Contract templates. options: -h, --help show this help message and exit + --tag TAG the sc-meta framework version referred to ``` ### Contract.Build @@ -994,7 +994,7 @@ usage: mxpy wallet COMMAND [-h] ... Create wallet, derive secret key from mnemonic, bech32 address helpers etc. COMMANDS: - {new,convert,bech32} + {new,convert,bech32,sign-message,verify-message} OPTIONS: -h, --help show this help message and exit @@ -1005,6 +1005,8 @@ COMMANDS summary new Create a new wallet and print its mnemonic; optionally save as password-protected JSON (recommended) or PEM (not recommended) convert Convert a wallet from one format to another bech32 Helper for encoding and decoding bech32 addresses +sign-message Sign a message +verify-message Verify a previously message ``` ### Wallet.New @@ -1041,7 +1043,7 @@ options: --outfile OUTFILE path to the output file --in-format {raw-mnemonic,keystore-mnemonic,keystore-secret-key,pem} the format of the input file - --out-format {raw-mnemonic,keystore-mnemonic,keystore-secret-key,pem} + --out-format {raw-mnemonic,keystore-mnemonic,keystore-secret-key,pem,address-bech32,address-hex} the format of the output file --address-index ADDRESS_INDEX the address index, if input format is raw-mnemonic, keystore-mnemonic or pem (with multiple entries) and the output format is keystore- @@ -1067,6 +1069,44 @@ options: --encode whether to encode --decode whether to decode +``` +### Wallet.SignMessage + + +``` +$ mxpy wallet sign-message --help +usage: mxpy wallet sign-message [-h] ... + +Sign a message + +options: + -h, --help show this help message and exit + --message MESSAGE the message you want to sign + --pem PEM 🔑 the PEM file, if keyfile not provided + --pem-index PEM_INDEX 🔑 the index in the PEM file (default: 0) + --keyfile KEYFILE 🔑 a JSON keyfile, if PEM not provided + --passfile PASSFILE 🔑 a file containing keyfile's password, if keyfile provided + --ledger 🔐 bool flag for signing transaction using ledger + --ledger-account-index LEDGER_ACCOUNT_INDEX 🔐 the index of the account when using Ledger + --ledger-address-index LEDGER_ADDRESS_INDEX 🔐 the index of the address when using Ledger + --sender-username SENDER_USERNAME 🖄 the username of the sender + +``` +### Wallet.VerifyMessage + + +``` +$ mxpy wallet verify-message --help +usage: mxpy wallet verify-message [-h] ... + +Verify a previously message + +options: + -h, --help show this help message and exit + --bech32-address BECH32_ADDRESS the bech32 address of the signer + --message MESSAGE the previously signed message(readable text, as it was signed) + --signature SIGNATURE the signature in hex format + ``` ## Group **Localnet** @@ -1217,13 +1257,11 @@ usage: mxpy deps install [-h] ... Install dependencies or multiversx-sdk modules. positional arguments: - {all,llvm,clang,cpp,rust,golang,vmtools,mx_chain_go,mx_chain_proxy_go,wasm-opt,twiggy,testwallets} - the dependency to install + {all,rust,golang,vmtools,testwallets} the dependency to install options: - -h, --help show this help message and exit - --overwrite whether to overwrite an existing installation - --tag TAG the tag or version to install + -h, --help show this help message and exit + --overwrite whether to overwrite an existing installation ``` ### Dependencies.Check @@ -1236,12 +1274,10 @@ usage: mxpy deps check [-h] ... Check whether a dependency is installed. positional arguments: - {all,llvm,clang,cpp,rust,golang,vmtools,mx_chain_go,mx_chain_proxy_go,wasm-opt,twiggy,testwallets} - the dependency to check + {all,rust,golang,vmtools,testwallets} the dependency to check options: - -h, --help show this help message and exit - --tag TAG the tag or version to check + -h, --help show this help message and exit ``` ## Group **Configuration** diff --git a/CLI.md.sh b/CLI.md.sh index 7b686d87..db02f98f 100755 --- a/CLI.md.sh +++ b/CLI.md.sh @@ -70,6 +70,8 @@ generate() { command "Wallet.New" "wallet new" command "Wallet.Convert" "wallet convert" command "Wallet.Bech32" "wallet bech32" + command "Wallet.SignMessage" "wallet sign-message" + command "Wallet.VerifyMessage" "wallet verify-message" group "Localnet" "localnet" command "Localnet.Setup" "localnet setup" diff --git a/multiversx_sdk_cli/cli_deps.py b/multiversx_sdk_cli/cli_deps.py index 471e0610..095eb5ce 100644 --- a/multiversx_sdk_cli/cli_deps.py +++ b/multiversx_sdk_cli/cli_deps.py @@ -20,7 +20,6 @@ def setup_parser(subparsers: Any) -> Any: sub = cli_shared.add_command_subparser(subparsers, "deps", "check", "Check whether a dependency is installed.") sub.add_argument("name", choices=choices, help="the dependency to check") - sub.add_argument("--tag", help="the tag or version to check") sub.set_defaults(func=check) parser.epilog = cli_shared.build_group_epilog(subparsers) @@ -35,18 +34,16 @@ def install(args: Any): def check(args: Any): name: str = args.name - tag: str = args.tag module = dependencies.get_module_by_key(name) - default_tag: str = config.get_dependency_tag(module.key) - tag_to_check = tag or default_tag + tag_to_check: str = config.get_dependency_tag(module.key) resolution: str = config.get_dependency_resolution(module.key) resolution = resolution if resolution else "HOST" - logger.info(f"Checking dependency: module = {module.key}, tag = {tag_to_check}; default tag = {default_tag}, resolution = {resolution}") + logger.info(f"Checking dependency: module = {module.key}, tag = {tag_to_check}, resolution = {resolution}") installed = module.is_installed(tag_to_check) if installed: - logger.info(f"[{name} {tag_to_check}] is installed. Default version (tag) is [{default_tag}].") + logger.info(f"[{name} {tag_to_check}] is installed.") return raise errors.DependencyMissing(name, tag_to_check) diff --git a/multiversx_sdk_cli/dependencies/modules.py b/multiversx_sdk_cli/dependencies/modules.py index 19224462..a9a6dc16 100644 --- a/multiversx_sdk_cli/dependencies/modules.py +++ b/multiversx_sdk_cli/dependencies/modules.py @@ -129,7 +129,7 @@ def _get_download_url(self, tag: str) -> str: platform = workstation.get_platform() url = config.get_dependency_url(self.key, tag, platform) - if url is None: + if not url: raise errors.PlatformNotSupported(self.key, platform) url = url.replace("{TAG}", tag)