multiversx-sdk-cli 9.0.2__tar.gz → 9.2.0b0__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.0.2 → multiversx_sdk_cli-9.2.0b0}/PKG-INFO +1 -1
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli_contracts.py +53 -96
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli_delegation.py +74 -38
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli_output.py +3 -4
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli_shared.py +5 -6
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/constants.py +2 -0
- multiversx_sdk_cli-9.2.0b0/multiversx_sdk_cli/contracts.py +317 -0
- multiversx_sdk_cli-9.2.0b0/multiversx_sdk_cli/delegation/__init__.py +3 -0
- multiversx_sdk_cli-9.2.0b0/multiversx_sdk_cli/delegation/staking_provider.py +334 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/dns.py +8 -10
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/genesis.py +6 -7
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/validators/core.py +2 -2
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/validators/validators_file.py +18 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/pyproject.toml +4 -1
- multiversx_sdk_cli-9.0.2/multiversx_sdk_cli/contracts.py +0 -314
- multiversx_sdk_cli-9.0.2/multiversx_sdk_cli/delegation/__init__.py +0 -23
- multiversx_sdk_cli-9.0.2/multiversx_sdk_cli/delegation/staking_provider.py +0 -169
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/.gitignore +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/LICENSE +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/README.md +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/.vscode/settings.json +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/__init__.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/accounts.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli_accounts.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli_config.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli_data.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli_deps.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli_dns.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli_ledger.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli_localnet.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli_password.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli_transactions.py +1 -1
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli_validators.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli_wallet.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/config.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/contract_verification.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cosign_transaction.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/dependencies/__init__.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/dependencies/install.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/dependencies/modules.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/dependencies/resolution.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/docker.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/downloader.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/errors.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/guards.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/interfaces.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/ledger/__init__.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/ledger/config.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/ledger/ledger_app_handler.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/ledger/ledger_functions.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/__init__.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/config_default.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/config_general.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/config_networking.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/config_part.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/config_root.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/config_sharding.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/config_software.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/constants.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/genesis_json.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/genesis_smart_contracts_json.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/libraries.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/node.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/node_config_toml.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/nodes_setup_json.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/p2p_toml.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/seednode_p2pKey.pem +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/step_build_software.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/step_clean.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/step_config.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/step_new.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/step_prerequisites.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/step_start.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/localnet/wallets.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/myprocess.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/__init__.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/constants.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/core.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/interfaces.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/migrations.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/project_base.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/project_rust.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/__init__.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/data/__init__.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/data/common.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/data/extracted_feature.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/data/folder_report.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/data/project_report.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/data/report.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/data/wasm_report.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/do_report.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/features/__init__.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/features/features.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/features/report_option.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/features/size.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/features/twiggy_paths_check.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/format/__init__.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/format/change_type.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/format/format_options.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/report/report_creator.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/shared.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/projects/templates.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/sign_verify.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/simulation.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/transactions.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/utils.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/ux.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/validators/__init__.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/version.py +0 -0
- {multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/workstation.py +0 -0
|
@@ -3,20 +3,21 @@ import os
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
from typing import Any, List
|
|
5
5
|
|
|
6
|
-
from multiversx_sdk_core import Address, Transaction
|
|
6
|
+
from multiversx_sdk_core import Address, AddressComputer, Transaction
|
|
7
|
+
from multiversx_sdk_core.transaction_factories import TransactionsFactoryConfig
|
|
7
8
|
from multiversx_sdk_network_providers.proxy_network_provider import \
|
|
8
9
|
ProxyNetworkProvider
|
|
9
10
|
|
|
10
|
-
from multiversx_sdk_cli import cli_shared,
|
|
11
|
-
from multiversx_sdk_cli.accounts import Account, LedgerAccount
|
|
11
|
+
from multiversx_sdk_cli import cli_shared, projects, utils
|
|
12
12
|
from multiversx_sdk_cli.cli_output import CLIOutputBuilder
|
|
13
|
-
from multiversx_sdk_cli.
|
|
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
|
|
16
|
+
from multiversx_sdk_cli.contracts import SmartContract, query_contract
|
|
17
17
|
from multiversx_sdk_cli.cosign_transaction import cosign_transaction
|
|
18
18
|
from multiversx_sdk_cli.docker import is_docker_installed, run_docker
|
|
19
19
|
from multiversx_sdk_cli.errors import DockerMissingError, NoWalletProvided
|
|
20
|
+
from multiversx_sdk_cli.interfaces import IAddress
|
|
20
21
|
from multiversx_sdk_cli.projects.core import get_project_paths_recursively
|
|
21
22
|
from multiversx_sdk_cli.projects.templates import Contract
|
|
22
23
|
from multiversx_sdk_cli.ux import show_message
|
|
@@ -95,6 +96,7 @@ def setup_parser(args: List[str], subparsers: Any) -> Any:
|
|
|
95
96
|
cli_shared.add_tx_args(args, sub, with_receiver=False, with_data=False, with_guardian=True)
|
|
96
97
|
_add_function_arg(sub)
|
|
97
98
|
_add_arguments_arg(sub)
|
|
99
|
+
_add_token_transfers_args(sub)
|
|
98
100
|
sub.add_argument("--wait-result", action="store_true", default=False,
|
|
99
101
|
help="signal to wait for the transaction result - only valid if --send is set")
|
|
100
102
|
sub.add_argument("--timeout", default=100, help="max num of seconds to wait for result"
|
|
@@ -233,6 +235,12 @@ def _add_arguments_arg(sub: Any):
|
|
|
233
235
|
"boolean] or hex-encoded. E.g. --arguments 42 0x64 1000 0xabba str:TOK-a1c2ef true erd1[..]")
|
|
234
236
|
|
|
235
237
|
|
|
238
|
+
def _add_token_transfers_args(sub: Any):
|
|
239
|
+
sub.add_argument("--token-transfers", nargs='+',
|
|
240
|
+
help="token transfers for transfer & execute, as [token, amount] "
|
|
241
|
+
"E.g. --token-transfers NFT-123456-0a 1 ESDT-987654 100000000")
|
|
242
|
+
|
|
243
|
+
|
|
236
244
|
def _add_metadata_arg(sub: Any):
|
|
237
245
|
sub.add_argument("--metadata-not-upgradeable", dest="metadata_upgradeable", action="store_false",
|
|
238
246
|
help="‼ mark the contract as NOT upgradeable (default: upgradeable)")
|
|
@@ -298,70 +306,23 @@ def deploy(args: Any):
|
|
|
298
306
|
logger.debug("deploy")
|
|
299
307
|
cli_shared.check_guardian_and_options_args(args)
|
|
300
308
|
cli_shared.check_broadcast_args(args)
|
|
301
|
-
|
|
302
|
-
arguments = args.arguments
|
|
303
|
-
gas_price = args.gas_price
|
|
304
|
-
gas_limit = args.gas_limit
|
|
305
|
-
value = args.value
|
|
306
|
-
version = args.version
|
|
307
|
-
|
|
308
|
-
contract = _prepare_contract(args)
|
|
309
|
-
sender = _prepare_sender(args)
|
|
310
309
|
cli_shared.prepare_chain_id_in_args(args)
|
|
310
|
+
cli_shared.prepare_nonce_in_args(args)
|
|
311
311
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
logger.info("Contract address: %s", contract.address.to_bech32())
|
|
316
|
-
utils.log_explorer_contract_address(args.chain, contract.address.to_bech32())
|
|
317
|
-
|
|
318
|
-
_send_or_simulate(tx, contract, args)
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
def _prepare_contract(args: Any) -> SmartContract:
|
|
322
|
-
bytecode = utils.read_binary_file(Path(args.bytecode)).hex()
|
|
323
|
-
|
|
324
|
-
metadata = CodeMetadata(upgradeable=args.metadata_upgradeable, readable=args.metadata_readable,
|
|
325
|
-
payable=args.metadata_payable, payable_by_sc=args.metadata_payable_by_sc)
|
|
326
|
-
contract = SmartContract(bytecode=bytecode, metadata=metadata)
|
|
327
|
-
return contract
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
def _prepare_sender(args: Any) -> Account:
|
|
331
|
-
sender: Account
|
|
332
|
-
if args.ledger:
|
|
333
|
-
sender = LedgerAccount(account_index=args.ledger_account_index, address_index=args.ledger_address_index)
|
|
334
|
-
elif args.pem:
|
|
335
|
-
sender = Account(pem_file=args.pem, pem_index=args.pem_index)
|
|
336
|
-
elif args.keyfile:
|
|
337
|
-
password = load_password(args)
|
|
338
|
-
sender = Account(key_file=args.keyfile, password=password)
|
|
339
|
-
else:
|
|
340
|
-
raise errors.NoWalletProvided()
|
|
312
|
+
sender = cli_shared.prepare_account(args)
|
|
313
|
+
config = TransactionsFactoryConfig(args.chain)
|
|
314
|
+
contract = SmartContract(config)
|
|
341
315
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
sender.sync_nonce(ProxyNetworkProvider(args.proxy))
|
|
345
|
-
|
|
346
|
-
return sender
|
|
316
|
+
address_computer = AddressComputer(NUMBER_OF_SHARDS)
|
|
317
|
+
contract_address = address_computer.compute_contract_address(deployer=sender.address, deployment_nonce=args.nonce)
|
|
347
318
|
|
|
319
|
+
tx = contract.prepare_deploy_transaction(sender, args)
|
|
320
|
+
tx = _sign_guarded_tx(args, tx)
|
|
348
321
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
if args.ledger:
|
|
352
|
-
sender = LedgerAccount(
|
|
353
|
-
account_index=args.ledger_account_index,
|
|
354
|
-
address_index=args.ledger_address_index,
|
|
355
|
-
)
|
|
356
|
-
elif args.pem:
|
|
357
|
-
sender = Account(pem_file=args.pem, pem_index=args.pem_index)
|
|
358
|
-
elif args.keyfile:
|
|
359
|
-
password = load_password(args)
|
|
360
|
-
sender = Account(key_file=args.keyfile, password=password)
|
|
361
|
-
else:
|
|
362
|
-
raise errors.NoWalletProvided()
|
|
322
|
+
logger.info("Contract address: %s", contract_address.to_bech32())
|
|
323
|
+
utils.log_explorer_contract_address(args.chain, contract_address.to_bech32())
|
|
363
324
|
|
|
364
|
-
|
|
325
|
+
_send_or_simulate(tx, contract_address, args)
|
|
365
326
|
|
|
366
327
|
|
|
367
328
|
def _sign_guarded_tx(args: Any, tx: Transaction) -> Transaction:
|
|
@@ -382,62 +343,58 @@ def call(args: Any):
|
|
|
382
343
|
logger.debug("call")
|
|
383
344
|
cli_shared.check_guardian_and_options_args(args)
|
|
384
345
|
cli_shared.check_broadcast_args(args)
|
|
385
|
-
|
|
386
|
-
contract_address = args.contract
|
|
387
|
-
function = args.function
|
|
388
|
-
arguments = args.arguments
|
|
389
|
-
gas_price = args.gas_price
|
|
390
|
-
gas_limit = args.gas_limit
|
|
391
|
-
value = args.value
|
|
392
|
-
version = args.version
|
|
393
|
-
|
|
394
|
-
contract = SmartContract(Address.from_bech32(contract_address))
|
|
395
|
-
sender = _prepare_sender(args)
|
|
396
346
|
cli_shared.prepare_chain_id_in_args(args)
|
|
347
|
+
cli_shared.prepare_nonce_in_args(args)
|
|
348
|
+
|
|
349
|
+
sender = cli_shared.prepare_account(args)
|
|
350
|
+
config = TransactionsFactoryConfig(args.chain)
|
|
351
|
+
contract = SmartContract(config)
|
|
352
|
+
contract_address = Address.new_from_bech32(args.contract)
|
|
397
353
|
|
|
398
|
-
tx = contract.
|
|
354
|
+
tx = contract.prepare_execute_transaction(sender, args)
|
|
399
355
|
tx = _sign_guarded_tx(args, tx)
|
|
400
356
|
|
|
401
|
-
_send_or_simulate(tx,
|
|
357
|
+
_send_or_simulate(tx, contract_address, args)
|
|
402
358
|
|
|
403
359
|
|
|
404
360
|
def upgrade(args: Any):
|
|
405
361
|
logger.debug("upgrade")
|
|
362
|
+
cli_shared.check_guardian_and_options_args(args)
|
|
406
363
|
cli_shared.check_broadcast_args(args)
|
|
407
|
-
|
|
408
|
-
contract_address = args.contract
|
|
409
|
-
arguments = args.arguments
|
|
410
|
-
gas_price = args.gas_price
|
|
411
|
-
gas_limit = args.gas_limit
|
|
412
|
-
value = args.value
|
|
413
|
-
version = args.version
|
|
414
|
-
|
|
415
|
-
contract = _prepare_contract(args)
|
|
416
|
-
contract.address = Address.from_bech32(contract_address)
|
|
417
|
-
sender = _prepare_sender(args)
|
|
418
364
|
cli_shared.prepare_chain_id_in_args(args)
|
|
365
|
+
cli_shared.prepare_nonce_in_args(args)
|
|
366
|
+
|
|
367
|
+
sender = cli_shared.prepare_account(args)
|
|
368
|
+
config = TransactionsFactoryConfig(args.chain)
|
|
369
|
+
contract = SmartContract(config)
|
|
370
|
+
contract_address = Address.new_from_bech32(args.contract)
|
|
419
371
|
|
|
420
|
-
tx = contract.
|
|
372
|
+
tx = contract.prepare_upgrade_transaction(sender, args)
|
|
421
373
|
tx = _sign_guarded_tx(args, tx)
|
|
422
374
|
|
|
423
|
-
_send_or_simulate(tx,
|
|
375
|
+
_send_or_simulate(tx, contract_address, args)
|
|
424
376
|
|
|
425
377
|
|
|
426
378
|
def query(args: Any):
|
|
427
379
|
logger.debug("query")
|
|
428
380
|
|
|
429
|
-
|
|
381
|
+
# workaround so we can use the function bellow
|
|
382
|
+
args.chain = ""
|
|
383
|
+
cli_shared.prepare_chain_id_in_args(args)
|
|
384
|
+
|
|
385
|
+
contract_address = Address.new_from_bech32(args.contract)
|
|
386
|
+
|
|
387
|
+
proxy = ProxyNetworkProvider(args.proxy)
|
|
430
388
|
function = args.function
|
|
431
|
-
arguments = args.arguments
|
|
389
|
+
arguments = args.arguments or []
|
|
432
390
|
|
|
433
|
-
|
|
434
|
-
result = contract.query(ProxyNetworkProvider(args.proxy), function, arguments)
|
|
391
|
+
result = query_contract(contract_address, proxy, function, arguments)
|
|
435
392
|
utils.dump_out_json(result)
|
|
436
393
|
|
|
437
394
|
|
|
438
|
-
def _send_or_simulate(tx: Transaction,
|
|
395
|
+
def _send_or_simulate(tx: Transaction, contract_address: IAddress, args: Any):
|
|
439
396
|
output_builder = cli_shared.send_or_simulate(tx, args, dump_output=False)
|
|
440
|
-
output_builder.set_contract_address(
|
|
397
|
+
output_builder.set_contract_address(contract_address)
|
|
441
398
|
utils.dump_out_json(output_builder.build(), outfile=args.outfile)
|
|
442
399
|
|
|
443
400
|
|
|
@@ -447,7 +404,7 @@ def verify(args: Any) -> None:
|
|
|
447
404
|
|
|
448
405
|
packaged_src = Path(args.packaged_src).expanduser().resolve()
|
|
449
406
|
|
|
450
|
-
owner =
|
|
407
|
+
owner = cli_shared.prepare_account(args)
|
|
451
408
|
docker_image = args.docker_image
|
|
452
409
|
contract_variant = args.contract_variant
|
|
453
410
|
|
{multiversx_sdk_cli-9.0.2 → multiversx_sdk_cli-9.2.0b0}/multiversx_sdk_cli/cli_delegation.py
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from typing import Any, List
|
|
2
2
|
|
|
3
|
+
from multiversx_sdk_core.transaction_factories import TransactionsFactoryConfig
|
|
3
4
|
from multiversx_sdk_network_providers.proxy_network_provider import \
|
|
4
5
|
ProxyNetworkProvider
|
|
5
6
|
|
|
6
7
|
from multiversx_sdk_cli import cli_shared, errors, utils
|
|
7
|
-
from multiversx_sdk_cli.delegation import
|
|
8
|
-
from multiversx_sdk_cli.transactions import do_prepare_transaction
|
|
8
|
+
from multiversx_sdk_cli.delegation import DelegationOperations
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def setup_parser(args: List[str], subparsers: Any) -> Any:
|
|
@@ -142,11 +142,14 @@ def _add_common_arguments(args: List[str], sub: Any):
|
|
|
142
142
|
def do_create_delegation_contract(args: Any):
|
|
143
143
|
cli_shared.check_guardian_and_options_args(args)
|
|
144
144
|
cli_shared.check_broadcast_args(args)
|
|
145
|
-
cli_shared.prepare_nonce_in_args(args)
|
|
146
145
|
cli_shared.prepare_chain_id_in_args(args)
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
cli_shared.prepare_nonce_in_args(args)
|
|
147
|
+
|
|
148
|
+
sender = cli_shared.prepare_account(args)
|
|
149
|
+
config = TransactionsFactoryConfig(args.chain)
|
|
150
|
+
delegation = DelegationOperations(config)
|
|
149
151
|
|
|
152
|
+
tx = delegation.prepare_transaction_for_new_delegation_contract(sender, args)
|
|
150
153
|
cli_shared.send_or_simulate(tx, args)
|
|
151
154
|
|
|
152
155
|
|
|
@@ -167,119 +170,152 @@ def get_contract_address_by_deploy_tx_hash(args: Any):
|
|
|
167
170
|
def add_new_nodes(args: Any):
|
|
168
171
|
cli_shared.check_guardian_and_options_args(args)
|
|
169
172
|
cli_shared.check_broadcast_args(args)
|
|
170
|
-
cli_shared.prepare_nonce_in_args(args)
|
|
171
173
|
cli_shared.prepare_chain_id_in_args(args)
|
|
172
|
-
|
|
173
|
-
tx = do_prepare_transaction(args)
|
|
174
|
+
cli_shared.prepare_nonce_in_args(args)
|
|
174
175
|
|
|
176
|
+
sender = cli_shared.prepare_account(args)
|
|
177
|
+
config = TransactionsFactoryConfig(args.chain)
|
|
178
|
+
delegation = DelegationOperations(config)
|
|
179
|
+
|
|
180
|
+
tx = delegation.prepare_transaction_for_adding_nodes(sender, args)
|
|
175
181
|
cli_shared.send_or_simulate(tx, args)
|
|
176
182
|
|
|
177
183
|
|
|
178
184
|
def remove_nodes(args: Any):
|
|
179
185
|
cli_shared.check_guardian_and_options_args(args)
|
|
180
186
|
cli_shared.check_broadcast_args(args)
|
|
181
|
-
cli_shared.prepare_nonce_in_args(args)
|
|
182
187
|
cli_shared.prepare_chain_id_in_args(args)
|
|
183
|
-
|
|
184
|
-
|
|
188
|
+
cli_shared.prepare_nonce_in_args(args)
|
|
189
|
+
|
|
190
|
+
sender = cli_shared.prepare_account(args)
|
|
191
|
+
config = TransactionsFactoryConfig(args.chain)
|
|
192
|
+
delegation = DelegationOperations(config)
|
|
185
193
|
|
|
194
|
+
tx = delegation.prepare_transaction_for_removing_nodes(sender, args)
|
|
186
195
|
cli_shared.send_or_simulate(tx, args)
|
|
187
196
|
|
|
188
197
|
|
|
189
198
|
def stake_nodes(args: Any):
|
|
190
199
|
cli_shared.check_guardian_and_options_args(args)
|
|
191
200
|
cli_shared.check_broadcast_args(args)
|
|
192
|
-
cli_shared.prepare_nonce_in_args(args)
|
|
193
201
|
cli_shared.prepare_chain_id_in_args(args)
|
|
194
|
-
|
|
195
|
-
|
|
202
|
+
cli_shared.prepare_nonce_in_args(args)
|
|
203
|
+
|
|
204
|
+
sender = cli_shared.prepare_account(args)
|
|
205
|
+
config = TransactionsFactoryConfig(args.chain)
|
|
206
|
+
delegation = DelegationOperations(config)
|
|
196
207
|
|
|
208
|
+
tx = delegation.prepare_transaction_for_staking_nodes(sender, args)
|
|
197
209
|
cli_shared.send_or_simulate(tx, args)
|
|
198
210
|
|
|
199
211
|
|
|
200
212
|
def unbond_nodes(args: Any):
|
|
201
213
|
cli_shared.check_guardian_and_options_args(args)
|
|
202
214
|
cli_shared.check_broadcast_args(args)
|
|
203
|
-
cli_shared.prepare_nonce_in_args(args)
|
|
204
215
|
cli_shared.prepare_chain_id_in_args(args)
|
|
205
|
-
|
|
206
|
-
tx = do_prepare_transaction(args)
|
|
216
|
+
cli_shared.prepare_nonce_in_args(args)
|
|
207
217
|
|
|
218
|
+
sender = cli_shared.prepare_account(args)
|
|
219
|
+
config = TransactionsFactoryConfig(args.chain)
|
|
220
|
+
delegation = DelegationOperations(config)
|
|
221
|
+
|
|
222
|
+
tx = delegation.prepare_transaction_for_unbonding_nodes(sender, args)
|
|
208
223
|
cli_shared.send_or_simulate(tx, args)
|
|
209
224
|
|
|
210
225
|
|
|
211
226
|
def unstake_nodes(args: Any):
|
|
212
227
|
cli_shared.check_guardian_and_options_args(args)
|
|
213
228
|
cli_shared.check_broadcast_args(args)
|
|
214
|
-
cli_shared.prepare_nonce_in_args(args)
|
|
215
229
|
cli_shared.prepare_chain_id_in_args(args)
|
|
216
|
-
|
|
217
|
-
|
|
230
|
+
cli_shared.prepare_nonce_in_args(args)
|
|
231
|
+
|
|
232
|
+
sender = cli_shared.prepare_account(args)
|
|
233
|
+
config = TransactionsFactoryConfig(args.chain)
|
|
234
|
+
delegation = DelegationOperations(config)
|
|
218
235
|
|
|
236
|
+
tx = delegation.prepare_transaction_for_unstaking_nodes(sender, args)
|
|
219
237
|
cli_shared.send_or_simulate(tx, args)
|
|
220
238
|
|
|
221
239
|
|
|
222
240
|
def unjail_nodes(args: Any):
|
|
223
241
|
cli_shared.check_guardian_and_options_args(args)
|
|
224
242
|
cli_shared.check_broadcast_args(args)
|
|
225
|
-
cli_shared.prepare_nonce_in_args(args)
|
|
226
243
|
cli_shared.prepare_chain_id_in_args(args)
|
|
227
|
-
|
|
228
|
-
|
|
244
|
+
cli_shared.prepare_nonce_in_args(args)
|
|
245
|
+
|
|
246
|
+
sender = cli_shared.prepare_account(args)
|
|
247
|
+
config = TransactionsFactoryConfig(args.chain)
|
|
248
|
+
delegation = DelegationOperations(config)
|
|
229
249
|
|
|
250
|
+
tx = delegation.prepare_transaction_for_unjailing_nodes(sender, args)
|
|
230
251
|
cli_shared.send_or_simulate(tx, args)
|
|
231
252
|
|
|
232
253
|
|
|
233
254
|
def change_service_fee(args: Any):
|
|
234
255
|
cli_shared.check_guardian_and_options_args(args)
|
|
235
256
|
cli_shared.check_broadcast_args(args)
|
|
236
|
-
cli_shared.prepare_nonce_in_args(args)
|
|
237
257
|
cli_shared.prepare_chain_id_in_args(args)
|
|
238
|
-
|
|
239
|
-
tx = do_prepare_transaction(args)
|
|
258
|
+
cli_shared.prepare_nonce_in_args(args)
|
|
240
259
|
|
|
260
|
+
sender = cli_shared.prepare_account(args)
|
|
261
|
+
config = TransactionsFactoryConfig(args.chain)
|
|
262
|
+
delegation = DelegationOperations(config)
|
|
263
|
+
|
|
264
|
+
tx = delegation.prepare_transaction_for_changing_service_fee(sender, args)
|
|
241
265
|
cli_shared.send_or_simulate(tx, args)
|
|
242
266
|
|
|
243
267
|
|
|
244
268
|
def modify_delegation_cap(args: Any):
|
|
245
269
|
cli_shared.check_guardian_and_options_args(args)
|
|
246
270
|
cli_shared.check_broadcast_args(args)
|
|
247
|
-
cli_shared.prepare_nonce_in_args(args)
|
|
248
271
|
cli_shared.prepare_chain_id_in_args(args)
|
|
249
|
-
|
|
250
|
-
|
|
272
|
+
cli_shared.prepare_nonce_in_args(args)
|
|
273
|
+
|
|
274
|
+
sender = cli_shared.prepare_account(args)
|
|
275
|
+
config = TransactionsFactoryConfig(args.chain)
|
|
276
|
+
delegation = DelegationOperations(config)
|
|
251
277
|
|
|
278
|
+
tx = delegation.prepare_transaction_for_modifying_delegation_cap(sender, args)
|
|
252
279
|
cli_shared.send_or_simulate(tx, args)
|
|
253
280
|
|
|
254
281
|
|
|
255
282
|
def automatic_activation(args: Any):
|
|
256
283
|
cli_shared.check_guardian_and_options_args(args)
|
|
257
284
|
cli_shared.check_broadcast_args(args)
|
|
258
|
-
cli_shared.prepare_nonce_in_args(args)
|
|
259
285
|
cli_shared.prepare_chain_id_in_args(args)
|
|
260
|
-
|
|
261
|
-
|
|
286
|
+
cli_shared.prepare_nonce_in_args(args)
|
|
287
|
+
|
|
288
|
+
sender = cli_shared.prepare_account(args)
|
|
289
|
+
config = TransactionsFactoryConfig(args.chain)
|
|
290
|
+
delegation = DelegationOperations(config)
|
|
262
291
|
|
|
292
|
+
tx = delegation.prepare_transaction_for_automatic_activation(sender, args)
|
|
263
293
|
cli_shared.send_or_simulate(tx, args)
|
|
264
294
|
|
|
265
295
|
|
|
266
296
|
def redelegate_cap(args: Any):
|
|
267
297
|
cli_shared.check_guardian_and_options_args(args)
|
|
268
298
|
cli_shared.check_broadcast_args(args)
|
|
269
|
-
cli_shared.prepare_nonce_in_args(args)
|
|
270
299
|
cli_shared.prepare_chain_id_in_args(args)
|
|
271
|
-
|
|
272
|
-
tx = do_prepare_transaction(args)
|
|
300
|
+
cli_shared.prepare_nonce_in_args(args)
|
|
273
301
|
|
|
302
|
+
sender = cli_shared.prepare_account(args)
|
|
303
|
+
config = TransactionsFactoryConfig(args.chain)
|
|
304
|
+
delegation = DelegationOperations(config)
|
|
305
|
+
|
|
306
|
+
tx = delegation.prepare_transaction_for_redelegate_cap(sender, args)
|
|
274
307
|
cli_shared.send_or_simulate(tx, args)
|
|
275
308
|
|
|
276
309
|
|
|
277
310
|
def set_metadata(args: Any):
|
|
278
311
|
cli_shared.check_guardian_and_options_args(args)
|
|
279
312
|
cli_shared.check_broadcast_args(args)
|
|
280
|
-
cli_shared.prepare_nonce_in_args(args)
|
|
281
313
|
cli_shared.prepare_chain_id_in_args(args)
|
|
282
|
-
|
|
283
|
-
|
|
314
|
+
cli_shared.prepare_nonce_in_args(args)
|
|
315
|
+
|
|
316
|
+
sender = cli_shared.prepare_account(args)
|
|
317
|
+
config = TransactionsFactoryConfig(args.chain)
|
|
318
|
+
delegation = DelegationOperations(config)
|
|
284
319
|
|
|
320
|
+
tx = delegation.prepare_transaction_for_setting_metadata(sender, args)
|
|
285
321
|
cli_shared.send_or_simulate(tx, args)
|
|
@@ -3,12 +3,11 @@ import logging
|
|
|
3
3
|
from collections import OrderedDict
|
|
4
4
|
from typing import Any, Dict, List, Optional, Union
|
|
5
5
|
|
|
6
|
-
from multiversx_sdk_core import Address
|
|
7
6
|
from multiversx_sdk_network_providers.transactions import \
|
|
8
7
|
transaction_to_dictionary
|
|
9
8
|
|
|
10
9
|
from multiversx_sdk_cli import utils
|
|
11
|
-
from multiversx_sdk_cli.interfaces import ITransaction
|
|
10
|
+
from multiversx_sdk_cli.interfaces import IAddress, ITransaction
|
|
12
11
|
from multiversx_sdk_cli.utils import ISerializable
|
|
13
12
|
|
|
14
13
|
logger = logging.getLogger("cli.output")
|
|
@@ -19,7 +18,7 @@ class CLIOutputBuilder:
|
|
|
19
18
|
self.emitted_transaction_hash: Optional[str] = None
|
|
20
19
|
self.emitted_transaction: Union[ITransaction, None] = None
|
|
21
20
|
self.emitted_transaction_omitted_fields: List[str] = []
|
|
22
|
-
self.contract_address: Union[
|
|
21
|
+
self.contract_address: Union[IAddress, None] = None
|
|
23
22
|
self.transaction_on_network: Union[ISerializable, None] = None
|
|
24
23
|
self.transaction_on_network_omitted_fields: List[str] = []
|
|
25
24
|
self.simulation_results: Union[ISerializable, None] = None
|
|
@@ -33,7 +32,7 @@ class CLIOutputBuilder:
|
|
|
33
32
|
self.emitted_transaction_omitted_fields = omitted_fields
|
|
34
33
|
return self
|
|
35
34
|
|
|
36
|
-
def set_contract_address(self, contract_address:
|
|
35
|
+
def set_contract_address(self, contract_address: IAddress):
|
|
37
36
|
self.contract_address = contract_address
|
|
38
37
|
return self
|
|
39
38
|
|
|
@@ -10,7 +10,7 @@ from multiversx_sdk_network_providers.proxy_network_provider import \
|
|
|
10
10
|
ProxyNetworkProvider
|
|
11
11
|
|
|
12
12
|
from multiversx_sdk_cli import config, errors, utils
|
|
13
|
-
from multiversx_sdk_cli.accounts import Account
|
|
13
|
+
from multiversx_sdk_cli.accounts import Account, LedgerAccount
|
|
14
14
|
from multiversx_sdk_cli.cli_output import CLIOutputBuilder
|
|
15
15
|
from multiversx_sdk_cli.cli_password import (load_guardian_password,
|
|
16
16
|
load_password)
|
|
@@ -93,9 +93,9 @@ def add_tx_args(args: List[str], sub: Any, with_nonce: bool = True, with_receive
|
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
def add_guardian_args(sub: Any):
|
|
96
|
-
sub.add_argument("--guardian", type=str, help="the address of the guradian")
|
|
97
|
-
sub.add_argument("--guardian-service-url", type=str, help="the url of the guardian service")
|
|
98
|
-
sub.add_argument("--guardian-2fa-code", type=str, help="the 2fa code for the guardian")
|
|
96
|
+
sub.add_argument("--guardian", type=str, help="the address of the guradian", default="")
|
|
97
|
+
sub.add_argument("--guardian-service-url", type=str, help="the url of the guardian service", default="")
|
|
98
|
+
sub.add_argument("--guardian-2fa-code", type=str, help="the 2fa code for the guardian", default="")
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
def add_wallet_args(args: List[str], sub: Any):
|
|
@@ -150,8 +150,7 @@ def prepare_account(args: Any):
|
|
|
150
150
|
password = load_password(args)
|
|
151
151
|
account = Account(key_file=args.keyfile, password=password)
|
|
152
152
|
elif args.ledger:
|
|
153
|
-
|
|
154
|
-
account = Account(address=Address.new_from_bech32(address))
|
|
153
|
+
account = LedgerAccount(account_index=args.ledger_account_index, address_index=args.ledger_address_index)
|
|
155
154
|
else:
|
|
156
155
|
raise errors.NoWalletProvided()
|
|
157
156
|
|