multiversx-sdk-cli 9.6.2__tar.gz → 9.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/PKG-INFO +4 -5
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/accounts.py +3 -4
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cli.py +5 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cli_accounts.py +1 -3
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cli_config.py +1 -1
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cli_contracts.py +86 -37
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cli_delegation.py +138 -51
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cli_dns.py +17 -7
- multiversx_sdk_cli-9.7.0/multiversx_sdk_cli/cli_faucet.py +72 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cli_output.py +3 -3
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cli_shared.py +16 -6
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cli_transactions.py +47 -3
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cli_validators.py +1 -1
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cli_wallet.py +33 -8
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/config.py +1 -15
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/contract_verification.py +3 -3
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/contracts.py +82 -135
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cosign_transaction.py +3 -3
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/custom_network_provider.py +1 -1
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/delegation/staking_provider.py +129 -22
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/dependencies/install.py +1 -3
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/dependencies/modules.py +19 -56
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/dns.py +70 -11
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/docker.py +1 -1
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/errors.py +16 -42
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/interfaces.py +6 -1
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/ledger/ledger_app_handler.py +1 -1
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/config_part.py +2 -2
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/node_config_toml.py +1 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/wallets.py +1 -1
- multiversx_sdk_cli-9.7.0/multiversx_sdk_cli/native_auth_client.py +104 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/core.py +7 -10
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/project_base.py +17 -20
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/data/folder_report.py +7 -3
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/sign_verify.py +1 -2
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/simulation.py +2 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/transactions.py +81 -71
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/utils.py +4 -15
- multiversx_sdk_cli-9.7.0/multiversx_sdk_cli/validators/__init__.py +23 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/validators/core.py +1 -3
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/validators/validators_file.py +1 -3
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/version.py +1 -1
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/pyproject.toml +4 -5
- multiversx_sdk_cli-9.6.2/multiversx_sdk_cli/validators/__init__.py +0 -28
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/.gitignore +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/LICENSE +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/README.md +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/.vscode/settings.json +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/__init__.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cli_data.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cli_deps.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cli_ledger.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cli_localnet.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/cli_password.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/constants.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/delegation/__init__.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/dependencies/__init__.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/dependencies/resolution.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/dependency_checker.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/downloader.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/guards.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/ledger/__init__.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/ledger/config.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/ledger/ledger_functions.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/__init__.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/config_default.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/config_general.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/config_networking.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/config_root.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/config_sharding.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/config_software.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/constants.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/genesis.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/genesis_json.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/genesis_smart_contracts_json.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/libraries.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/node.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/nodes_setup_json.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/p2p_toml.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/seednode_p2pKey.pem +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/step_build_software.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/step_clean.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/step_config.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/step_new.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/step_prerequisites.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/localnet/step_start.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/myprocess.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/__init__.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/constants.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/interfaces.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/migrations.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/project_rust.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/__init__.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/data/__init__.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/data/common.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/data/extracted_feature.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/data/project_report.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/data/report.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/data/wasm_report.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/do_report.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/features/__init__.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/features/features.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/features/report_option.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/features/size.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/features/twiggy_paths_check.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/format/__init__.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/format/change_type.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/format/format_options.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/report/report_creator.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/shared.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/projects/templates.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/ux.py +0 -0
- {multiversx_sdk_cli-9.6.2 → multiversx_sdk_cli-9.7.0}/multiversx_sdk_cli/workstation.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: multiversx-sdk-cli
|
|
3
|
-
Version: 9.
|
|
3
|
+
Version: 9.7.0
|
|
4
4
|
Summary: MultiversX Smart Contracts Tools
|
|
5
5
|
Project-URL: Homepage, https://github.com/multiversx/mx-sdk-py-cli
|
|
6
6
|
Author: MultiversX
|
|
@@ -11,13 +11,12 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
13
|
Requires-Python: >=3.8
|
|
14
|
+
Requires-Dist: argcomplete==3.2.2
|
|
14
15
|
Requires-Dist: ledgercomm[hid]
|
|
15
|
-
Requires-Dist: multiversx-sdk
|
|
16
|
-
Requires-Dist: multiversx-sdk-network-providers<0.14.0,>=0.13.0
|
|
17
|
-
Requires-Dist: multiversx-sdk-wallet<0.10.0,>=0.9.0
|
|
16
|
+
Requires-Dist: multiversx-sdk==0.13.0
|
|
18
17
|
Requires-Dist: prettytable
|
|
19
|
-
Requires-Dist: requests
|
|
20
18
|
Requires-Dist: requests-cache
|
|
19
|
+
Requires-Dist: requests<3.0.0,>=2.32.0
|
|
21
20
|
Requires-Dist: rich==13.3.4
|
|
22
21
|
Requires-Dist: semver
|
|
23
22
|
Requires-Dist: toml>=0.10.2
|
|
@@ -2,10 +2,9 @@ import logging
|
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
from typing import Any, Optional, Protocol
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
|
|
7
|
-
from
|
|
8
|
-
from multiversx_sdk_wallet import UserSigner
|
|
5
|
+
from multiversx_sdk import (Address, Message, MessageComputer,
|
|
6
|
+
TransactionComputer, UserSigner)
|
|
7
|
+
from multiversx_sdk.network_providers.accounts import AccountOnNetwork
|
|
9
8
|
|
|
10
9
|
from multiversx_sdk_cli.constants import DEFAULT_HRP
|
|
11
10
|
from multiversx_sdk_cli.interfaces import IAccount, IAddress, ITransaction
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
# PYTHON_ARGCOMPLETE_OK
|
|
1
2
|
import argparse
|
|
2
3
|
import logging
|
|
3
4
|
import sys
|
|
4
5
|
from argparse import ArgumentParser
|
|
5
6
|
from typing import Any, List
|
|
6
7
|
|
|
8
|
+
import argcomplete
|
|
7
9
|
from rich.logging import RichHandler
|
|
8
10
|
|
|
9
11
|
import multiversx_sdk_cli.cli_accounts
|
|
@@ -13,6 +15,7 @@ import multiversx_sdk_cli.cli_data
|
|
|
13
15
|
import multiversx_sdk_cli.cli_delegation
|
|
14
16
|
import multiversx_sdk_cli.cli_deps
|
|
15
17
|
import multiversx_sdk_cli.cli_dns
|
|
18
|
+
import multiversx_sdk_cli.cli_faucet
|
|
16
19
|
import multiversx_sdk_cli.cli_ledger
|
|
17
20
|
import multiversx_sdk_cli.cli_localnet
|
|
18
21
|
import multiversx_sdk_cli.cli_transactions
|
|
@@ -41,6 +44,7 @@ def _do_main(cli_args: List[str]):
|
|
|
41
44
|
utils.ensure_folder(config.SDK_PATH)
|
|
42
45
|
argv_with_config_args = config.add_config_args(cli_args)
|
|
43
46
|
parser = setup_parser(argv_with_config_args)
|
|
47
|
+
argcomplete.autocomplete(parser)
|
|
44
48
|
args = parser.parse_args(argv_with_config_args)
|
|
45
49
|
|
|
46
50
|
if args.verbose:
|
|
@@ -97,6 +101,7 @@ See:
|
|
|
97
101
|
commands.append(multiversx_sdk_cli.cli_data.setup_parser(subparsers))
|
|
98
102
|
commands.append(multiversx_sdk_cli.cli_delegation.setup_parser(args, subparsers))
|
|
99
103
|
commands.append(multiversx_sdk_cli.cli_dns.setup_parser(args, subparsers))
|
|
104
|
+
commands.append(multiversx_sdk_cli.cli_faucet.setup_parser(args, subparsers))
|
|
100
105
|
|
|
101
106
|
parser.epilog = """
|
|
102
107
|
----------------------
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import Any
|
|
3
3
|
|
|
4
|
-
from
|
|
5
|
-
from multiversx_sdk_network_providers.proxy_network_provider import \
|
|
6
|
-
ProxyNetworkProvider
|
|
4
|
+
from multiversx_sdk import Address, ProxyNetworkProvider
|
|
7
5
|
|
|
8
6
|
from multiversx_sdk_cli import cli_shared, utils
|
|
9
7
|
|
|
@@ -103,7 +103,7 @@ def list_configs(args: Any):
|
|
|
103
103
|
def delete_config(args: Any):
|
|
104
104
|
config_file = config.resolve_config_path()
|
|
105
105
|
if not config_file.is_file():
|
|
106
|
-
logger.info(
|
|
106
|
+
logger.info("Config file not found. Aborting...")
|
|
107
107
|
return
|
|
108
108
|
|
|
109
109
|
confirm_continuation(f"The file `{str(config_file)}` will be deleted. Do you want to continue? (y/n)")
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
+
import json
|
|
1
2
|
import logging
|
|
2
3
|
import os
|
|
3
4
|
from pathlib import Path
|
|
4
|
-
from typing import Any, List
|
|
5
|
+
from typing import Any, List, Tuple
|
|
5
6
|
|
|
6
|
-
from
|
|
7
|
-
|
|
8
|
-
from
|
|
9
|
-
ProxyNetworkProvider
|
|
7
|
+
from multiversx_sdk import (Address, AddressComputer, ProxyNetworkProvider,
|
|
8
|
+
Transaction, TransactionsFactoryConfig)
|
|
9
|
+
from multiversx_sdk.abi import Abi
|
|
10
10
|
|
|
11
11
|
from multiversx_sdk_cli import cli_shared, projects, utils
|
|
12
12
|
from multiversx_sdk_cli.cli_output import CLIOutputBuilder
|
|
13
13
|
from multiversx_sdk_cli.constants import NUMBER_OF_SHARDS
|
|
14
14
|
from multiversx_sdk_cli.contract_verification import \
|
|
15
15
|
trigger_contract_verification
|
|
16
|
-
from multiversx_sdk_cli.contracts import SmartContract
|
|
16
|
+
from multiversx_sdk_cli.contracts import SmartContract
|
|
17
17
|
from multiversx_sdk_cli.cosign_transaction import cosign_transaction
|
|
18
18
|
from multiversx_sdk_cli.dependency_checker import check_if_rust_is_installed
|
|
19
19
|
from multiversx_sdk_cli.docker import is_docker_installed, run_docker
|
|
@@ -21,7 +21,7 @@ from multiversx_sdk_cli.errors import DockerMissingError, NoWalletProvided
|
|
|
21
21
|
from multiversx_sdk_cli.interfaces import IAddress
|
|
22
22
|
from multiversx_sdk_cli.projects.core import get_project_paths_recursively
|
|
23
23
|
from multiversx_sdk_cli.projects.templates import Contract
|
|
24
|
-
from multiversx_sdk_cli.ux import show_message
|
|
24
|
+
from multiversx_sdk_cli.ux import show_message, show_warning
|
|
25
25
|
|
|
26
26
|
logger = logging.getLogger("cli.contracts")
|
|
27
27
|
|
|
@@ -53,12 +53,13 @@ def setup_parser(args: List[str], subparsers: Any) -> Any:
|
|
|
53
53
|
sub.add_argument("--path", default=os.getcwd(), help="the project directory (default: current directory)")
|
|
54
54
|
sub.set_defaults(func=clean)
|
|
55
55
|
|
|
56
|
-
sub = cli_shared.add_command_subparser(subparsers, "contract", "test", "Run
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
sub = cli_shared.add_command_subparser(subparsers, "contract", "test", "Run tests.")
|
|
57
|
+
sub.add_argument("--path", default=os.getcwd(),
|
|
58
|
+
help="the directory of the contract (default: %(default)s)")
|
|
59
|
+
sub.add_argument("--go", action="store_true",
|
|
60
|
+
help="this arg runs rust and go tests (default: false)")
|
|
61
|
+
sub.add_argument("--scen", action="store_true", help="this arg runs scenarios (default: false). If `--scen` and `--go` are both specified, scen overrides the go argument")
|
|
62
|
+
sub.add_argument("--nocapture", action="store_true", help="this arg prints the entire output of the vm (default: false)")
|
|
62
63
|
sub.set_defaults(func=run_tests)
|
|
63
64
|
|
|
64
65
|
sub = cli_shared.add_command_subparser(subparsers, "contract", "report", "Print a detailed report of the smart contracts.")
|
|
@@ -73,11 +74,12 @@ def setup_parser(args: List[str], subparsers: Any) -> Any:
|
|
|
73
74
|
output_description = CLIOutputBuilder.describe(with_contract=True, with_transaction_on_network=True, with_simulation=True)
|
|
74
75
|
sub = cli_shared.add_command_subparser(subparsers, "contract", "deploy", f"Deploy a Smart Contract.{output_description}")
|
|
75
76
|
_add_bytecode_arg(sub)
|
|
77
|
+
_add_contract_abi_arg(sub)
|
|
76
78
|
_add_metadata_arg(sub)
|
|
77
79
|
cli_shared.add_outfile_arg(sub)
|
|
78
80
|
cli_shared.add_wallet_args(args, sub)
|
|
79
81
|
cli_shared.add_proxy_arg(sub)
|
|
80
|
-
cli_shared.add_tx_args(args, sub, with_receiver=False, with_data=False
|
|
82
|
+
cli_shared.add_tx_args(args, sub, with_receiver=False, with_data=False)
|
|
81
83
|
_add_arguments_arg(sub)
|
|
82
84
|
sub.add_argument("--wait-result", action="store_true", default=False,
|
|
83
85
|
help="signal to wait for the transaction result - only valid if --send is set")
|
|
@@ -91,10 +93,11 @@ def setup_parser(args: List[str], subparsers: Any) -> Any:
|
|
|
91
93
|
sub = cli_shared.add_command_subparser(subparsers, "contract", "call",
|
|
92
94
|
f"Interact with a Smart Contract (execute function).{output_description}")
|
|
93
95
|
_add_contract_arg(sub)
|
|
96
|
+
_add_contract_abi_arg(sub)
|
|
94
97
|
cli_shared.add_outfile_arg(sub)
|
|
95
98
|
cli_shared.add_wallet_args(args, sub)
|
|
96
99
|
cli_shared.add_proxy_arg(sub)
|
|
97
|
-
cli_shared.add_tx_args(args, sub, with_receiver=False, with_data=False
|
|
100
|
+
cli_shared.add_tx_args(args, sub, with_receiver=False, with_data=False)
|
|
98
101
|
_add_function_arg(sub)
|
|
99
102
|
_add_arguments_arg(sub)
|
|
100
103
|
_add_token_transfers_args(sub)
|
|
@@ -110,12 +113,13 @@ def setup_parser(args: List[str], subparsers: Any) -> Any:
|
|
|
110
113
|
sub = cli_shared.add_command_subparser(subparsers, "contract", "upgrade",
|
|
111
114
|
f"Upgrade a previously-deployed Smart Contract.{output_description}")
|
|
112
115
|
_add_contract_arg(sub)
|
|
116
|
+
_add_contract_abi_arg(sub)
|
|
113
117
|
cli_shared.add_outfile_arg(sub)
|
|
114
118
|
_add_bytecode_arg(sub)
|
|
115
119
|
_add_metadata_arg(sub)
|
|
116
120
|
cli_shared.add_wallet_args(args, sub)
|
|
117
121
|
cli_shared.add_proxy_arg(sub)
|
|
118
|
-
cli_shared.add_tx_args(args, sub, with_receiver=False, with_data=False
|
|
122
|
+
cli_shared.add_tx_args(args, sub, with_receiver=False, with_data=False)
|
|
119
123
|
_add_arguments_arg(sub)
|
|
120
124
|
sub.add_argument("--wait-result", action="store_true", default=False,
|
|
121
125
|
help="signal to wait for the transaction result - only valid if --send is set")
|
|
@@ -129,6 +133,7 @@ def setup_parser(args: List[str], subparsers: Any) -> Any:
|
|
|
129
133
|
sub = cli_shared.add_command_subparser(subparsers, "contract", "query",
|
|
130
134
|
"Query a Smart Contract (call a pure function)")
|
|
131
135
|
_add_contract_arg(sub)
|
|
136
|
+
_add_contract_abi_arg(sub)
|
|
132
137
|
cli_shared.add_proxy_arg(sub)
|
|
133
138
|
_add_function_arg(sub)
|
|
134
139
|
_add_arguments_arg(sub)
|
|
@@ -172,7 +177,7 @@ def setup_parser(args: List[str], subparsers: Any) -> Any:
|
|
|
172
177
|
|
|
173
178
|
def _add_project_arg(sub: Any):
|
|
174
179
|
sub.add_argument("project", nargs='?', default=os.getcwd(),
|
|
175
|
-
help="
|
|
180
|
+
help="the project directory (default: current directory)")
|
|
176
181
|
|
|
177
182
|
|
|
178
183
|
def _add_build_options_sc_meta(sub: Any):
|
|
@@ -213,10 +218,6 @@ def _add_build_options_args(sub: Any):
|
|
|
213
218
|
help="for rust projects, optionally specify the suffix of the wasm bytecode output file")
|
|
214
219
|
|
|
215
220
|
|
|
216
|
-
def _add_recursive_arg(sub: Any):
|
|
217
|
-
sub.add_argument("-r", "--recursive", dest="recursive", action="store_true", help="locate projects recursively")
|
|
218
|
-
|
|
219
|
-
|
|
220
221
|
def _add_bytecode_arg(sub: Any):
|
|
221
222
|
sub.add_argument("--bytecode", type=str, required=True,
|
|
222
223
|
help="the file containing the WASM bytecode")
|
|
@@ -226,6 +227,10 @@ def _add_contract_arg(sub: Any):
|
|
|
226
227
|
sub.add_argument("contract", help="🖄 the address of the Smart Contract")
|
|
227
228
|
|
|
228
229
|
|
|
230
|
+
def _add_contract_abi_arg(sub: Any):
|
|
231
|
+
sub.add_argument("--abi", type=str, help="the ABI of the Smart Contract")
|
|
232
|
+
|
|
233
|
+
|
|
229
234
|
def _add_function_arg(sub: Any):
|
|
230
235
|
sub.add_argument("--function", required=True, type=str, help="the function to call")
|
|
231
236
|
|
|
@@ -234,6 +239,8 @@ def _add_arguments_arg(sub: Any):
|
|
|
234
239
|
sub.add_argument("--arguments", nargs='+',
|
|
235
240
|
help="arguments for the contract transaction, as [number, bech32-address, ascii string, "
|
|
236
241
|
"boolean] or hex-encoded. E.g. --arguments 42 0x64 1000 0xabba str:TOK-a1c2ef true erd1[..]")
|
|
242
|
+
sub.add_argument("--arguments-file", type=str, help="a json file containing the arguments. ONLY if abi file is provided. "
|
|
243
|
+
"E.g. [{ 'to': 'erd1...', 'amount': 10000000000 }]")
|
|
237
244
|
|
|
238
245
|
|
|
239
246
|
def _add_token_transfers_args(sub: Any):
|
|
@@ -286,25 +293,28 @@ def clean(args: Any):
|
|
|
286
293
|
|
|
287
294
|
|
|
288
295
|
def build(args: Any):
|
|
289
|
-
check_if_rust_is_installed()
|
|
290
296
|
project_paths = [Path(args.path)]
|
|
291
297
|
arg_list = cli_shared.convert_args_object_to_args_list(args)
|
|
292
298
|
|
|
293
299
|
for project in project_paths:
|
|
294
300
|
projects.build_project(project, arg_list)
|
|
295
301
|
|
|
302
|
+
show_warning("The primary tool for building smart contracts is `sc-meta`. Try using the `sc-meta all build` command.")
|
|
303
|
+
|
|
296
304
|
|
|
297
305
|
def do_report(args: Any):
|
|
298
|
-
|
|
306
|
+
deprecation_message = "`mxpy contract report` is deprecated. Please use `sc-meta report` instead."
|
|
307
|
+
logger.warning(deprecation_message)
|
|
308
|
+
|
|
299
309
|
args_dict = args.__dict__
|
|
300
310
|
projects.do_report(args, args_dict)
|
|
301
311
|
|
|
312
|
+
show_warning(deprecation_message)
|
|
313
|
+
|
|
302
314
|
|
|
303
315
|
def run_tests(args: Any):
|
|
304
316
|
check_if_rust_is_installed()
|
|
305
|
-
|
|
306
|
-
for project in project_paths:
|
|
307
|
-
projects.run_tests(project, args)
|
|
317
|
+
projects.run_tests(args)
|
|
308
318
|
|
|
309
319
|
|
|
310
320
|
def deploy(args: Any):
|
|
@@ -316,15 +326,16 @@ def deploy(args: Any):
|
|
|
316
326
|
|
|
317
327
|
sender = cli_shared.prepare_account(args)
|
|
318
328
|
config = TransactionsFactoryConfig(args.chain)
|
|
319
|
-
|
|
329
|
+
abi = Abi.load(Path(args.abi)) if args.abi else None
|
|
330
|
+
contract = SmartContract(config, abi)
|
|
320
331
|
|
|
321
|
-
|
|
322
|
-
contract_address = address_computer.compute_contract_address(deployer=sender.address, deployment_nonce=args.nonce)
|
|
332
|
+
arguments, should_prepare_args = _get_contract_arguments(args)
|
|
323
333
|
|
|
324
334
|
tx = contract.prepare_deploy_transaction(
|
|
325
335
|
owner=sender,
|
|
326
336
|
bytecode=Path(args.bytecode),
|
|
327
|
-
arguments=
|
|
337
|
+
arguments=arguments,
|
|
338
|
+
should_prepare_args=should_prepare_args,
|
|
328
339
|
upgradeable=args.metadata_upgradeable,
|
|
329
340
|
readable=args.metadata_readable,
|
|
330
341
|
payable=args.metadata_payable,
|
|
@@ -337,6 +348,9 @@ def deploy(args: Any):
|
|
|
337
348
|
guardian=args.guardian)
|
|
338
349
|
tx = _sign_guarded_tx(args, tx)
|
|
339
350
|
|
|
351
|
+
address_computer = AddressComputer(NUMBER_OF_SHARDS)
|
|
352
|
+
contract_address = address_computer.compute_contract_address(deployer=sender.address, deployment_nonce=args.nonce)
|
|
353
|
+
|
|
340
354
|
logger.info("Contract address: %s", contract_address.to_bech32())
|
|
341
355
|
utils.log_explorer_contract_address(args.chain, contract_address.to_bech32())
|
|
342
356
|
|
|
@@ -365,15 +379,20 @@ def call(args: Any):
|
|
|
365
379
|
cli_shared.prepare_nonce_in_args(args)
|
|
366
380
|
|
|
367
381
|
sender = cli_shared.prepare_account(args)
|
|
382
|
+
|
|
368
383
|
config = TransactionsFactoryConfig(args.chain)
|
|
369
|
-
|
|
384
|
+
abi = Abi.load(Path(args.abi)) if args.abi else None
|
|
385
|
+
contract = SmartContract(config, abi)
|
|
386
|
+
|
|
387
|
+
arguments, should_prepare_args = _get_contract_arguments(args)
|
|
370
388
|
contract_address = Address.new_from_bech32(args.contract)
|
|
371
389
|
|
|
372
390
|
tx = contract.prepare_execute_transaction(
|
|
373
391
|
caller=sender,
|
|
374
392
|
contract=contract_address,
|
|
375
393
|
function=args.function,
|
|
376
|
-
arguments=
|
|
394
|
+
arguments=arguments,
|
|
395
|
+
should_prepare_args=should_prepare_args,
|
|
377
396
|
gas_limit=int(args.gas_limit),
|
|
378
397
|
value=int(args.value),
|
|
379
398
|
transfers=args.token_transfers,
|
|
@@ -395,14 +414,18 @@ def upgrade(args: Any):
|
|
|
395
414
|
|
|
396
415
|
sender = cli_shared.prepare_account(args)
|
|
397
416
|
config = TransactionsFactoryConfig(args.chain)
|
|
398
|
-
|
|
417
|
+
abi = Abi.load(Path(args.abi)) if args.abi else None
|
|
418
|
+
contract = SmartContract(config, abi)
|
|
419
|
+
|
|
420
|
+
arguments, should_prepare_args = _get_contract_arguments(args)
|
|
399
421
|
contract_address = Address.new_from_bech32(args.contract)
|
|
400
422
|
|
|
401
423
|
tx = contract.prepare_upgrade_transaction(
|
|
402
424
|
owner=sender,
|
|
403
425
|
contract=contract_address,
|
|
404
426
|
bytecode=Path(args.bytecode),
|
|
405
|
-
arguments=
|
|
427
|
+
arguments=arguments,
|
|
428
|
+
should_prepare_args=should_prepare_args,
|
|
406
429
|
upgradeable=args.metadata_upgradeable,
|
|
407
430
|
readable=args.metadata_readable,
|
|
408
431
|
payable=args.metadata_payable,
|
|
@@ -421,20 +444,46 @@ def upgrade(args: Any):
|
|
|
421
444
|
def query(args: Any):
|
|
422
445
|
logger.debug("query")
|
|
423
446
|
|
|
424
|
-
# workaround so we can use the function
|
|
447
|
+
# workaround so we can use the function below to set chainID
|
|
425
448
|
args.chain = ""
|
|
426
449
|
cli_shared.prepare_chain_id_in_args(args)
|
|
427
450
|
|
|
451
|
+
config = TransactionsFactoryConfig(args.chain)
|
|
452
|
+
abi = Abi.load(Path(args.abi)) if args.abi else None
|
|
453
|
+
contract = SmartContract(config, abi)
|
|
454
|
+
|
|
455
|
+
arguments, should_prepare_args = _get_contract_arguments(args)
|
|
428
456
|
contract_address = Address.new_from_bech32(args.contract)
|
|
429
457
|
|
|
430
458
|
proxy = ProxyNetworkProvider(args.proxy)
|
|
431
459
|
function = args.function
|
|
432
|
-
arguments: List[Any] = args.arguments or []
|
|
433
460
|
|
|
434
|
-
result = query_contract(
|
|
461
|
+
result = contract.query_contract(
|
|
462
|
+
contract_address=contract_address,
|
|
463
|
+
proxy=proxy,
|
|
464
|
+
function=function,
|
|
465
|
+
arguments=arguments,
|
|
466
|
+
should_prepare_args=should_prepare_args
|
|
467
|
+
)
|
|
468
|
+
|
|
435
469
|
utils.dump_out_json(result)
|
|
436
470
|
|
|
437
471
|
|
|
472
|
+
def _get_contract_arguments(args: Any) -> Tuple[List[Any], bool]:
|
|
473
|
+
json_args = json.loads(Path(args.arguments_file).expanduser().read_text()) if args.arguments_file else None
|
|
474
|
+
|
|
475
|
+
if json_args and args.arguments:
|
|
476
|
+
raise Exception("Provide either '--arguments' or '--arguments-file'.")
|
|
477
|
+
|
|
478
|
+
if json_args:
|
|
479
|
+
if not args.abi:
|
|
480
|
+
raise Exception("Can't use '--arguments-file' without providing the Abi file.")
|
|
481
|
+
|
|
482
|
+
return json_args, False
|
|
483
|
+
else:
|
|
484
|
+
return args.arguments, True
|
|
485
|
+
|
|
486
|
+
|
|
438
487
|
def _send_or_simulate(tx: Transaction, contract_address: IAddress, args: Any):
|
|
439
488
|
output_builder = cli_shared.send_or_simulate(tx, args, dump_output=False)
|
|
440
489
|
output_builder.set_contract_address(contract_address)
|