From 252f389b2c3f6cbd8017056cc61c8bcb8703059e Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Tue, 25 Mar 2025 16:26:50 +0200 Subject: [PATCH 01/12] add args for custom api and wallet urls --- multiversx_sdk_cli/cli_faucet.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/multiversx_sdk_cli/cli_faucet.py b/multiversx_sdk_cli/cli_faucet.py index a9700528..fab50a27 100644 --- a/multiversx_sdk_cli/cli_faucet.py +++ b/multiversx_sdk_cli/cli_faucet.py @@ -6,7 +6,7 @@ from multiversx_sdk import Message, NativeAuthClient, NativeAuthClientConfig from multiversx_sdk_cli import cli_shared -from multiversx_sdk_cli.errors import BadUserInput +from multiversx_sdk_cli.errors import ArgumentsNotProvidedError, BadUserInput logger = logging.getLogger("cli.faucet") @@ -27,7 +27,9 @@ def setup_parser(args: list[str], subparsers: Any) -> Any: sub = cli_shared.add_command_subparser(subparsers, "faucet", "request", "Request xEGLD.") cli_shared.add_wallet_args(args, sub) - sub.add_argument("--chain", required=True, choices=["D", "T"], help="the chain identifier") + sub.add_argument("--chain", choices=["D", "T"], help="the chain identifier") + sub.add_argument("--api", type=str, help="custom api url for the native auth client") + sub.add_argument("--wallet-url", type=str, help="custom wallet url to call the faucet from") sub.set_defaults(func=faucet) parser.epilog = cli_shared.build_group_epilog(subparsers) @@ -59,6 +61,9 @@ def call_web_wallet_faucet(wallet_url: str, access_token: str): def get_wallet_and_api_urls(args: Any) -> tuple[str, str]: chain: str = args.chain + if not chain: + return get_custom_wallet_and_api_urls(args) + if chain.upper() == "D": return WebWalletUrls.DEVNET.value, ApiUrls.DEVNET.value @@ -66,3 +71,16 @@ def get_wallet_and_api_urls(args: Any) -> tuple[str, str]: return WebWalletUrls.TESTNET.value, ApiUrls.TESTNET.value raise BadUserInput("Invalid chain id. Choose between 'D' for devnet and 'T' for testnet.") + + +def get_custom_wallet_and_api_urls(args: Any) -> tuple[str, str]: + wallet = args.wallet_url + api = args.api + + if not wallet: + raise ArgumentsNotProvidedError("--wallet-url not provided") + + if not api: + raise ArgumentsNotProvidedError("--api not provided") + + return wallet, api From 6c031e26907d48891d6523766805e6cb3e992c7c Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Tue, 25 Mar 2025 16:27:01 +0200 Subject: [PATCH 02/12] remove old & unused errors --- multiversx_sdk_cli/errors.py | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/multiversx_sdk_cli/errors.py b/multiversx_sdk_cli/errors.py index be13e41b..577d6207 100644 --- a/multiversx_sdk_cli/errors.py +++ b/multiversx_sdk_cli/errors.py @@ -62,31 +62,11 @@ def __init__(self, directory: str): super().__init__(f"Bad directory: {directory}") -class BadFile(KnownError): - def __init__(self, filename: str, inner: Any = None): - super().__init__(f"Bad file: {filename}.", inner) - - -class NotSupportedProject(KnownError): - def __init__(self, directory: str): - super().__init__(f"Directory is not a supported project: {directory}") - - class PlatformNotSupported(KnownError): def __init__(self, action_or_item: str, platform: str): super().__init__(f"[{action_or_item}] is not supported on platform [{platform}].") -class BuildError(KnownError): - def __init__(self, message: str): - super().__init__(f"Build error: {message}.") - - -class UnknownArgumentFormat(KnownError): - def __init__(self, argument: Any): - super().__init__(f"Cannot handle non-hex, non-number arguments yet: {argument}.") - - class BadInputError(KnownError): def __init__(self, input: str, message: str): super().__init__(f"Bad input [{input}]: {message}") @@ -126,11 +106,6 @@ def __init__(self, message: str): super().__init__(f"Bad usage: {message}.") -class CannotReadValidatorsData(KnownError): - def __init__(self): - super(CannotReadValidatorsData, self).__init__("cannot read validators data") - - class TransactionIsNotSigned(KnownError): def __init__(self): super().__init__("Transaction is not signed.") @@ -141,11 +116,6 @@ def __init__(self): super().__init__("No wallet provided.") -class LedgerError(KnownError): - def __init__(self, message: str): - super().__init__("Ledger error: " + message) - - class DockerMissingError(KnownError): def __init__(self): super().__init__("Docker is not installed! Please visit https://docs.docker.com/get-docker/ to install docker.") @@ -161,12 +131,6 @@ def __init__(self, message: str): super().__init__(message) -class ProxyError(KnownError): - def __init__(self, message: str, url: str, data: str, code: str): - inner = {"url": url, "data": data, "code": code} - super().__init__(message, inner) - - class WalletGenerationError(KnownError): def __init__(self, message: str): super().__init__(message) From edaeaf71ee2bdda9fe9a28858451dda5b36a7d7d Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Tue, 25 Mar 2025 16:31:39 +0200 Subject: [PATCH 03/12] rename args --- multiversx_sdk_cli/cli_faucet.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/multiversx_sdk_cli/cli_faucet.py b/multiversx_sdk_cli/cli_faucet.py index fab50a27..be1f54b3 100644 --- a/multiversx_sdk_cli/cli_faucet.py +++ b/multiversx_sdk_cli/cli_faucet.py @@ -28,7 +28,7 @@ def setup_parser(args: list[str], subparsers: Any) -> Any: sub = cli_shared.add_command_subparser(subparsers, "faucet", "request", "Request xEGLD.") cli_shared.add_wallet_args(args, sub) sub.add_argument("--chain", choices=["D", "T"], help="the chain identifier") - sub.add_argument("--api", type=str, help="custom api url for the native auth client") + sub.add_argument("--api-url", type=str, help="custom api url for the native auth client") sub.add_argument("--wallet-url", type=str, help="custom wallet url to call the faucet from") sub.set_defaults(func=faucet) @@ -75,12 +75,12 @@ def get_wallet_and_api_urls(args: Any) -> tuple[str, str]: def get_custom_wallet_and_api_urls(args: Any) -> tuple[str, str]: wallet = args.wallet_url - api = args.api + api = args.api_url if not wallet: raise ArgumentsNotProvidedError("--wallet-url not provided") if not api: - raise ArgumentsNotProvidedError("--api not provided") + raise ArgumentsNotProvidedError("--api-url not provided") return wallet, api From 90616e0aa6436617721fc1afa7c120b0374ee567 Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Wed, 26 Mar 2025 17:47:03 +0200 Subject: [PATCH 04/12] recall nonce by deafult if nonce not set and proxy is provided --- CLI.md | 204 +++++++++++++++++--------- multiversx_sdk_cli/args_validation.py | 6 +- multiversx_sdk_cli/cli_shared.py | 4 +- 3 files changed, 140 insertions(+), 74 deletions(-) diff --git a/CLI.md b/CLI.md index c388fdd5..15a0c111 100644 --- a/CLI.md +++ b/CLI.md @@ -130,9 +130,11 @@ options: mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender --proxy PROXY 🔗 the URL of the proxy - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -222,9 +224,11 @@ options: mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender --proxy PROXY 🔗 the URL of the proxy - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -324,9 +328,11 @@ options: mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender --proxy PROXY 🔗 the URL of the proxy - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -501,9 +507,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --receiver RECEIVER 🖄 the address of the receiver --receiver-username RECEIVER_USERNAME 🖄 the username of the receiver --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) @@ -720,9 +728,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -775,9 +785,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -828,9 +840,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -881,9 +895,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -934,9 +950,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -987,9 +1005,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1039,9 +1059,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1092,9 +1114,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1145,9 +1169,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1198,9 +1224,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1251,9 +1279,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1303,9 +1333,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1395,9 +1427,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1466,9 +1500,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1521,9 +1557,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1576,9 +1614,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1631,9 +1671,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1686,9 +1728,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1741,9 +1785,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1794,9 +1840,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1847,9 +1895,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1900,9 +1950,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1953,9 +2005,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -2006,9 +2060,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -2060,9 +2116,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -2114,9 +2172,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -2169,9 +2229,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -2224,9 +2286,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -2280,9 +2344,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -2336,9 +2402,11 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction + --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network + if --proxy is provided. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False) + False). This argument is OBSOLETE. The nonce is fetched from the + network if --proxy is provided. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) diff --git a/multiversx_sdk_cli/args_validation.py b/multiversx_sdk_cli/args_validation.py index 1829ccf0..c15b290b 100644 --- a/multiversx_sdk_cli/args_validation.py +++ b/multiversx_sdk_cli/args_validation.py @@ -10,13 +10,11 @@ def validate_transaction_args(args: Any): def validate_nonce_args(args: Any): - """If nonce is not provided, ensure that recall_nonce is provided. If recall_nonce is provided, ensure that proxy is provided.""" + """If nonce is not provided, ensure that proxy is provided.""" if hasattr(args, "nonce") and args.nonce is None: - if not args.recall_nonce: - raise InvalidArgumentsError("Either --nonce or --recall-nonce must be provided") if hasattr(args, "proxy") and not args.proxy: - raise InvalidArgumentsError("--proxy must be provided if --recall-nonce is used") + raise InvalidArgumentsError("--proxy must be provided if --nonce is not provided") def validate_receiver_args(args: Any): diff --git a/multiversx_sdk_cli/cli_shared.py b/multiversx_sdk_cli/cli_shared.py index 26857ffd..8153f01e 100644 --- a/multiversx_sdk_cli/cli_shared.py +++ b/multiversx_sdk_cli/cli_shared.py @@ -103,13 +103,13 @@ def add_tx_args( type=int, required=False, default=None, - help="# the nonce for the transaction", + help="# the nonce for the transaction. The nonce is fetched from the network if --proxy is provided.", ) sub.add_argument( "--recall-nonce", action="store_true", default=False, - help="⭮ whether to recall the nonce when creating the transaction (default: %(default)s)", + help="⭮ whether to recall the nonce when creating the transaction (default: %(default)s). This argument is OBSOLETE. The nonce is fetched from the network if --proxy is provided.", ) if with_receiver: From 9bce6846e462a00892dc97a7d128e8771697c269 Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Thu, 27 Mar 2025 15:54:27 +0200 Subject: [PATCH 05/12] add deprecation warning --- CLI.md | 238 +++++++++++++------------------ multiversx_sdk_cli/cli.py | 3 + multiversx_sdk_cli/cli_shared.py | 4 +- 3 files changed, 107 insertions(+), 138 deletions(-) diff --git a/CLI.md b/CLI.md index 15a0c111..e93bd7f5 100644 --- a/CLI.md +++ b/CLI.md @@ -130,11 +130,10 @@ options: mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender --proxy PROXY 🔗 the URL of the proxy - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -224,11 +223,10 @@ options: mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender --proxy PROXY 🔗 the URL of the proxy - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -328,11 +326,10 @@ options: mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender --proxy PROXY 🔗 the URL of the proxy - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -507,11 +504,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --receiver RECEIVER 🖄 the address of the receiver --receiver-username RECEIVER_USERNAME 🖄 the username of the receiver --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) @@ -728,11 +724,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -785,11 +780,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -840,11 +834,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -895,11 +888,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -950,11 +942,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1005,11 +996,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1059,11 +1049,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1114,11 +1103,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1169,11 +1157,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1224,11 +1211,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1279,11 +1265,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1333,11 +1318,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1427,11 +1411,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1500,11 +1483,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1557,11 +1539,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1614,11 +1595,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1671,11 +1651,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1728,11 +1707,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1785,11 +1763,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1840,11 +1817,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1895,11 +1871,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -1950,11 +1925,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -2005,11 +1979,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -2060,11 +2033,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -2116,11 +2088,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -2172,11 +2143,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -2229,11 +2199,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -2286,11 +2255,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -2344,11 +2312,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) @@ -2402,11 +2369,10 @@ options: --sender-wallet-index SENDER_WALLET_INDEX 🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender - --nonce NONCE # the nonce for the transaction. The nonce is fetched from the network - if --proxy is provided. + --nonce NONCE # the nonce for the transaction. If not provided, is fetched from the + network. --recall-nonce ⭮ whether to recall the nonce when creating the transaction (default: - False). This argument is OBSOLETE. The nonce is fetched from the - network if --proxy is provided. + False). This argument is OBSOLETE. --gas-price GAS_PRICE ⛽ the gas price (default: 1000000000) --gas-limit GAS_LIMIT ⛽ the gas limit --value VALUE the value to transfer (default: 0) diff --git a/multiversx_sdk_cli/cli.py b/multiversx_sdk_cli/cli.py index 8bf57fd8..903a0a33 100644 --- a/multiversx_sdk_cli/cli.py +++ b/multiversx_sdk_cli/cli.py @@ -66,6 +66,9 @@ def _do_main(cli_args: list[str]): default_hrp = config.get_address_hrp() LibraryConfig.default_address_hrp = default_hrp + if hasattr(args, "recall_nonce") and args.recall_nonce: + logger.warning("The --recall-nonce flag is DEPRECATED. The nonce is fetched from the network by deafult.") + if not hasattr(args, "func"): parser.print_help() else: diff --git a/multiversx_sdk_cli/cli_shared.py b/multiversx_sdk_cli/cli_shared.py index 8153f01e..ad0ddedb 100644 --- a/multiversx_sdk_cli/cli_shared.py +++ b/multiversx_sdk_cli/cli_shared.py @@ -103,13 +103,13 @@ def add_tx_args( type=int, required=False, default=None, - help="# the nonce for the transaction. The nonce is fetched from the network if --proxy is provided.", + help="# the nonce for the transaction. If not provided, is fetched from the network.", ) sub.add_argument( "--recall-nonce", action="store_true", default=False, - help="⭮ whether to recall the nonce when creating the transaction (default: %(default)s). This argument is OBSOLETE. The nonce is fetched from the network if --proxy is provided.", + help="⭮ whether to recall the nonce when creating the transaction (default: %(default)s). This argument is OBSOLETE.", ) if with_receiver: From f0755dc0984931a0f2b4a394b6eca4580d44d944 Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Thu, 27 Mar 2025 15:57:28 +0200 Subject: [PATCH 06/12] fix typo --- multiversx_sdk_cli/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multiversx_sdk_cli/cli.py b/multiversx_sdk_cli/cli.py index 903a0a33..00519941 100644 --- a/multiversx_sdk_cli/cli.py +++ b/multiversx_sdk_cli/cli.py @@ -67,7 +67,7 @@ def _do_main(cli_args: list[str]): LibraryConfig.default_address_hrp = default_hrp if hasattr(args, "recall_nonce") and args.recall_nonce: - logger.warning("The --recall-nonce flag is DEPRECATED. The nonce is fetched from the network by deafult.") + logger.warning("The --recall-nonce flag is DEPRECATED. The nonce is fetched from the network by default.") if not hasattr(args, "func"): parser.print_help() From 0966879097cdd8a6a4b98b543449fe821574a15f Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Mon, 31 Mar 2025 17:10:29 +0300 Subject: [PATCH 07/12] fetch hrp from network if possible --- multiversx_sdk_cli/cli_faucet.py | 6 ++--- multiversx_sdk_cli/cli_shared.py | 38 +++++++++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/multiversx_sdk_cli/cli_faucet.py b/multiversx_sdk_cli/cli_faucet.py index be1f54b3..fab50a27 100644 --- a/multiversx_sdk_cli/cli_faucet.py +++ b/multiversx_sdk_cli/cli_faucet.py @@ -28,7 +28,7 @@ def setup_parser(args: list[str], subparsers: Any) -> Any: sub = cli_shared.add_command_subparser(subparsers, "faucet", "request", "Request xEGLD.") cli_shared.add_wallet_args(args, sub) sub.add_argument("--chain", choices=["D", "T"], help="the chain identifier") - sub.add_argument("--api-url", type=str, help="custom api url for the native auth client") + sub.add_argument("--api", type=str, help="custom api url for the native auth client") sub.add_argument("--wallet-url", type=str, help="custom wallet url to call the faucet from") sub.set_defaults(func=faucet) @@ -75,12 +75,12 @@ def get_wallet_and_api_urls(args: Any) -> tuple[str, str]: def get_custom_wallet_and_api_urls(args: Any) -> tuple[str, str]: wallet = args.wallet_url - api = args.api_url + api = args.api if not wallet: raise ArgumentsNotProvidedError("--wallet-url not provided") if not api: - raise ArgumentsNotProvidedError("--api-url not provided") + raise ArgumentsNotProvidedError("--api not provided") return wallet, api diff --git a/multiversx_sdk_cli/cli_shared.py b/multiversx_sdk_cli/cli_shared.py index ad0ddedb..4841ee56 100644 --- a/multiversx_sdk_cli/cli_shared.py +++ b/multiversx_sdk_cli/cli_shared.py @@ -8,6 +8,7 @@ from multiversx_sdk import ( Account, Address, + ApiNetworkProvider, LedgerAccount, ProxyNetworkProvider, Transaction, @@ -282,7 +283,7 @@ def parse_omit_fields_arg(args: Any) -> list[str]: def prepare_account(args: Any): - hrp = config.get_address_hrp() + hrp = _get_address_hrp(args) if args.pem: return Account.new_from_pem(file_path=Path(args.pem), index=args.sender_wallet_index, hrp=hrp) @@ -302,8 +303,39 @@ def prepare_account(args: Any): raise errors.NoWalletProvided() +def _get_address_hrp(args: Any) -> str: + """If proxy is provided, fetch the hrp from the network, otherwise get the hrp from config""" + hrp = "" + + if hasattr(args, "proxy") and args.proxy: + hrp = _get_hrp_from_proxy(args) + elif hasattr(args, "api") and args.api: + hrp = _get_hrp_from_api(args) + + if hrp: + return hrp + + return config.get_address_hrp() + + +def _get_hrp_from_proxy(args: Any) -> str: + network_provider_config = config.get_config_for_network_providers() + proxy = ProxyNetworkProvider(url=args.proxy, config=network_provider_config) + network_config = proxy.get_network_config() + hrp = network_config.raw.get("erd_address_hrp", "") + return hrp + + +def _get_hrp_from_api(args: Any) -> str: + network_provider_config = config.get_config_for_network_providers() + proxy = ApiNetworkProvider(url=args.api, config=network_provider_config) + network_config = proxy.get_network_config() + hrp = network_config.raw.get("erd_address_hrp", "") + return hrp + + def load_guardian_account(args: Any) -> Union[IAccount, None]: - hrp = config.get_address_hrp() + hrp = _get_address_hrp(args) if args.guardian_pem: return Account.new_from_pem(file_path=Path(args.guardian_pem), index=args.guardian_wallet_index, hrp=hrp) @@ -434,7 +466,7 @@ def _is_matching_address(account_address: Union[Address, None], args_address: Un def load_relayer_account(args: Any) -> Union[IAccount, None]: - hrp = config.get_address_hrp() + hrp = _get_address_hrp(args) if args.relayer_pem: return Account.new_from_pem(file_path=Path(args.relayer_pem), index=args.relayer_wallet_index, hrp=hrp) From 198df5b248c646c462d8a7fa0938796c377c4655 Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Tue, 1 Apr 2025 10:18:36 +0300 Subject: [PATCH 08/12] fix mypy errors --- multiversx_sdk_cli/cli_shared.py | 6 +++--- multiversx_sdk_cli/config.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/multiversx_sdk_cli/cli_shared.py b/multiversx_sdk_cli/cli_shared.py index 4841ee56..f7e3390f 100644 --- a/multiversx_sdk_cli/cli_shared.py +++ b/multiversx_sdk_cli/cli_shared.py @@ -305,7 +305,7 @@ def prepare_account(args: Any): def _get_address_hrp(args: Any) -> str: """If proxy is provided, fetch the hrp from the network, otherwise get the hrp from config""" - hrp = "" + hrp: str = "" if hasattr(args, "proxy") and args.proxy: hrp = _get_hrp_from_proxy(args) @@ -322,7 +322,7 @@ def _get_hrp_from_proxy(args: Any) -> str: network_provider_config = config.get_config_for_network_providers() proxy = ProxyNetworkProvider(url=args.proxy, config=network_provider_config) network_config = proxy.get_network_config() - hrp = network_config.raw.get("erd_address_hrp", "") + hrp: str = network_config.raw.get("erd_address_hrp", "") return hrp @@ -330,7 +330,7 @@ def _get_hrp_from_api(args: Any) -> str: network_provider_config = config.get_config_for_network_providers() proxy = ApiNetworkProvider(url=args.api, config=network_provider_config) network_config = proxy.get_network_config() - hrp = network_config.raw.get("erd_address_hrp", "") + hrp: str = network_config.raw.get("erd_address_hrp", "") return hrp diff --git a/multiversx_sdk_cli/config.py b/multiversx_sdk_cli/config.py index 222e4c7b..ee83f3c5 100644 --- a/multiversx_sdk_cli/config.py +++ b/multiversx_sdk_cli/config.py @@ -57,7 +57,7 @@ def get_value(name: str) -> str: return value -def get_address_hrp(): +def get_address_hrp() -> str: return get_value("default_address_hrp") From 6d86a1b7c5c1bc438f5b48636616c0e1386e0f09 Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Tue, 1 Apr 2025 15:42:43 +0300 Subject: [PATCH 09/12] bump version --- CLI.md | 2 ++ pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CLI.md b/CLI.md index e93bd7f5..9c8e9845 100644 --- a/CLI.md +++ b/CLI.md @@ -3031,5 +3031,7 @@ options: or Ledger devices (default: 0) --sender-username SENDER_USERNAME 🖄 the username of the sender --chain {D,T} the chain identifier + --api API custom api url for the native auth client + --wallet-url WALLET_URL custom wallet url to call the faucet from ``` diff --git a/pyproject.toml b/pyproject.toml index 684c0320..b911b8cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "multiversx-sdk-cli" -version = "10.0.1" +version = "10.1.0" authors = [ { name="MultiversX" }, ] From 72b68448be3c0ff4b4c1f6f2f1a154f30ac3517d Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Tue, 1 Apr 2025 18:44:30 +0300 Subject: [PATCH 10/12] add hrp argument --- multiversx_sdk_cli/cli_faucet.py | 1 + multiversx_sdk_cli/cli_shared.py | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/multiversx_sdk_cli/cli_faucet.py b/multiversx_sdk_cli/cli_faucet.py index fab50a27..3056a285 100644 --- a/multiversx_sdk_cli/cli_faucet.py +++ b/multiversx_sdk_cli/cli_faucet.py @@ -30,6 +30,7 @@ def setup_parser(args: list[str], subparsers: Any) -> Any: sub.add_argument("--chain", choices=["D", "T"], help="the chain identifier") sub.add_argument("--api", type=str, help="custom api url for the native auth client") sub.add_argument("--wallet-url", type=str, help="custom wallet url to call the faucet from") + sub.add_argument("--hrp", type=str, help="The hrp used to convert the address to its bech32 representation") sub.set_defaults(func=faucet) parser.epilog = cli_shared.build_group_epilog(subparsers) diff --git a/multiversx_sdk_cli/cli_shared.py b/multiversx_sdk_cli/cli_shared.py index f7e3390f..0b3ca2c6 100644 --- a/multiversx_sdk_cli/cli_shared.py +++ b/multiversx_sdk_cli/cli_shared.py @@ -176,6 +176,9 @@ def add_wallet_args(args: list[str], sub: Any): help="🔑 the address index; can be used for PEM files, keyfiles of type mnemonic or Ledger devices (default: %(default)s)", ) sub.add_argument("--sender-username", required=False, help="🖄 the username of the sender") + sub.add_argument( + "--hrp", required=False, type=str, help="The hrp used to convert the address to its bech32 representation" + ) def add_guardian_wallet_args(args: list[str], sub: Any): @@ -304,9 +307,11 @@ def prepare_account(args: Any): def _get_address_hrp(args: Any) -> str: - """If proxy is provided, fetch the hrp from the network, otherwise get the hrp from config""" - hrp: str = "" + """Use hrp provided by the user. If not provided, fetch from network. If proxy not provided, get hrp from config.""" + if hasattr(args, "hrp") and args.hrp: + return args.hrp + hrp: str = "" if hasattr(args, "proxy") and args.proxy: hrp = _get_hrp_from_proxy(args) elif hasattr(args, "api") and args.api: From 103c27ef40edd782d778700017bc6a493c28c189 Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Wed, 2 Apr 2025 10:30:29 +0300 Subject: [PATCH 11/12] fixes & remove obsolete arg from tests --- multiversx_sdk_cli/cli_faucet.py | 1 - multiversx_sdk_cli/tests/test_cli_contracts.py | 9 --------- .../tests/test_cli_validators_localnet.py | 12 ------------ 3 files changed, 22 deletions(-) diff --git a/multiversx_sdk_cli/cli_faucet.py b/multiversx_sdk_cli/cli_faucet.py index 3056a285..fab50a27 100644 --- a/multiversx_sdk_cli/cli_faucet.py +++ b/multiversx_sdk_cli/cli_faucet.py @@ -30,7 +30,6 @@ def setup_parser(args: list[str], subparsers: Any) -> Any: sub.add_argument("--chain", choices=["D", "T"], help="the chain identifier") sub.add_argument("--api", type=str, help="custom api url for the native auth client") sub.add_argument("--wallet-url", type=str, help="custom wallet url to call the faucet from") - sub.add_argument("--hrp", type=str, help="The hrp used to convert the address to its bech32 representation") sub.set_defaults(func=faucet) parser.epilog = cli_shared.build_group_epilog(subparsers) diff --git a/multiversx_sdk_cli/tests/test_cli_contracts.py b/multiversx_sdk_cli/tests/test_cli_contracts.py index bb822e70..4d579cfe 100644 --- a/multiversx_sdk_cli/tests/test_cli_contracts.py +++ b/multiversx_sdk_cli/tests/test_cli_contracts.py @@ -28,7 +28,6 @@ def test_contract_deploy(): "https://testnet-api.multiversx.com", "--chain", "T", - "--recall-nonce", "--gas-limit", "5000000", "--arguments", @@ -57,7 +56,6 @@ def test_contract_upgrade(): "https://testnet-api.multiversx.com", "--chain", "T", - "--recall-nonce", "--gas-limit", "5000000", "--arguments", @@ -86,7 +84,6 @@ def test_contract_call(): "https://testnet-api.multiversx.com", "--chain", "T", - "--recall-nonce", "--gas-limit", "5000000", "--arguments", @@ -177,7 +174,6 @@ def test_contract_flow(capsys: Any): adder, "--pem", alice, - "--recall-nonce", "--gas-limit", "5000000", "--proxy", @@ -220,7 +216,6 @@ def test_contract_flow(capsys: Any): alice, "--function", "add", - "--recall-nonce", "--gas-limit", "5000000", "--proxy", @@ -262,7 +257,6 @@ def test_contract_flow(capsys: Any): adder, "--pem", alice, - "--recall-nonce", "--gas-limit", "5000000", "--proxy", @@ -287,7 +281,6 @@ def test_contract_deploy_without_required_arguments(): adder, "--pem", alice, - "--recall-nonce", "--gas-limit", "5000000", "--arguments", @@ -490,7 +483,6 @@ def test_contract_query(capsys: Any): adder_abi, "--pem", alice, - "--recall-nonce", "--gas-limit", "5000000", "--proxy", @@ -516,7 +508,6 @@ def test_contract_query(capsys: Any): alice, "--function", "add", - "--recall-nonce", "--gas-limit", "5000000", "--proxy", diff --git a/multiversx_sdk_cli/tests/test_cli_validators_localnet.py b/multiversx_sdk_cli/tests/test_cli_validators_localnet.py index 89149f18..067b0d23 100644 --- a/multiversx_sdk_cli/tests/test_cli_validators_localnet.py +++ b/multiversx_sdk_cli/tests/test_cli_validators_localnet.py @@ -34,7 +34,6 @@ def test_stake(): "localnet", "--proxy", "http://127.0.0.1:7950", - "--recall-nonce", ] ) assert return_code == 0 @@ -78,7 +77,6 @@ def test_stake_top_up(): "localnet", "--proxy", "http://127.0.0.1:7950", - "--recall-nonce", ] ) assert return_code == 0 @@ -99,7 +97,6 @@ def test_unstake(): "localnet", "--proxy", "http://127.0.0.1:7950", - "--recall-nonce", ] ) assert return_code == 0 @@ -120,7 +117,6 @@ def test_unbond(): "localnet", "--proxy", "http://127.0.0.1:7950", - "--recall-nonce", ] ) assert return_code == 0 @@ -143,7 +139,6 @@ def test_unjail(): "localnet", "--proxy", "http://127.0.0.1:7950", - "--recall-nonce", ] ) assert return_code == 0 @@ -164,7 +159,6 @@ def test_change_reward_address(): "localnet", "--proxy", "http://127.0.0.1:7950", - "--recall-nonce", ] ) assert return_code == 0 @@ -185,7 +179,6 @@ def test_unstake_nodes(): "localnet", "--proxy", "http://127.0.0.1:7950", - "--recall-nonce", ] ) assert return_code == 0 @@ -206,7 +199,6 @@ def test_unstake_tokens(): "localnet", "--proxy", "http://127.0.0.1:7950", - "--recall-nonce", ] ) assert return_code == 0 @@ -227,7 +219,6 @@ def test_unbond_nodes(): "localnet", "--proxy", "http://127.0.0.1:7950", - "--recall-nonce", ] ) assert return_code == 0 @@ -248,7 +239,6 @@ def test_unbond_tokens(): "localnet", "--proxy", "http://127.0.0.1:7950", - "--recall-nonce", ] ) assert return_code == 0 @@ -267,7 +257,6 @@ def test_clean_registration_data(): "localnet", "--proxy", "http://127.0.0.1:7950", - "--recall-nonce", ] ) assert return_code == 0 @@ -288,7 +277,6 @@ def test_re_stake_unstaked_nodes(): "localnet", "--proxy", "http://127.0.0.1:7950", - "--recall-nonce", ] ) assert return_code == 0 From f3e12cb6a0124792127fa678be185cfced43c2b5 Mon Sep 17 00:00:00 2001 From: Alexandru Popenta Date: Wed, 2 Apr 2025 10:35:21 +0300 Subject: [PATCH 12/12] fix mypy error --- multiversx_sdk_cli/cli_shared.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/multiversx_sdk_cli/cli_shared.py b/multiversx_sdk_cli/cli_shared.py index 0b3ca2c6..316b8629 100644 --- a/multiversx_sdk_cli/cli_shared.py +++ b/multiversx_sdk_cli/cli_shared.py @@ -308,10 +308,12 @@ def prepare_account(args: Any): def _get_address_hrp(args: Any) -> str: """Use hrp provided by the user. If not provided, fetch from network. If proxy not provided, get hrp from config.""" + hrp: str = "" + if hasattr(args, "hrp") and args.hrp: - return args.hrp + hrp = args.hrp + return hrp - hrp: str = "" if hasattr(args, "proxy") and args.proxy: hrp = _get_hrp_from_proxy(args) elif hasattr(args, "api") and args.api: