mxpy 10.1.0__tar.gz → 10.2.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.
- {mxpy-10.1.0 → mxpy-10.2.0}/PKG-INFO +1 -1
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli_contracts.py +68 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli_output.py +3 -3
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/transactions.py +1 -57
- {mxpy-10.1.0 → mxpy-10.2.0}/pyproject.toml +1 -1
- {mxpy-10.1.0 → mxpy-10.2.0}/.gitignore +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/LICENSE +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/README.md +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/__init__.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/args_validation.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/base_transactions_controller.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli_config.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli_data.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli_delegation.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli_deps.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli_dns.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli_faucet.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli_ledger.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli_localnet.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli_password.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli_shared.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli_transactions.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli_validator_wallet.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli_validators.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cli_wallet.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/config.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/constants.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/contract_verification.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/contracts.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/cosign_transaction.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/delegation.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/dependencies/__init__.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/dependencies/install.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/dependencies/modules.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/dependencies/resolution.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/dns.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/docker.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/downloader.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/errors.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/guardian_relayer_data.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/guards.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/interfaces.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/__init__.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/config_default.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/config_general.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/config_networking.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/config_part.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/config_root.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/config_sharding.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/config_software.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/constants.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/genesis.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/genesis_json.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/genesis_smart_contracts_json.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/libraries.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/node.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/node_config_toml.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/nodes_setup_json.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/p2p_toml.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/seednode_p2pKey.pem +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/step_build_software.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/step_clean.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/step_config.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/step_new.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/step_prerequisites.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/step_start.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/localnet/wallets.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/myprocess.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/sign_verify.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/simulation.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/utils.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/ux.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/validators.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/version.py +0 -0
- {mxpy-10.1.0 → mxpy-10.2.0}/multiversx_sdk_cli/workstation.py +0 -0
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import hashlib
|
|
1
2
|
import json
|
|
2
3
|
import logging
|
|
3
4
|
import os
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
from typing import Any
|
|
6
7
|
|
|
8
|
+
import requests
|
|
7
9
|
from multiversx_sdk import (
|
|
8
10
|
Address,
|
|
9
11
|
AddressComputer,
|
|
12
|
+
Message,
|
|
10
13
|
ProxyNetworkProvider,
|
|
11
14
|
Transaction,
|
|
12
15
|
TransactionsFactoryConfig,
|
|
@@ -177,8 +180,37 @@ def setup_parser(args: list[str], subparsers: Any) -> Any:
|
|
|
177
180
|
help="in case of a multicontract, specify the contract variant you want to verify",
|
|
178
181
|
)
|
|
179
182
|
cli_shared.add_wallet_args(args, sub)
|
|
183
|
+
sub.add_argument(
|
|
184
|
+
"--skip-confirmation",
|
|
185
|
+
"-y",
|
|
186
|
+
dest="skip_confirmation",
|
|
187
|
+
action="store_true",
|
|
188
|
+
default=False,
|
|
189
|
+
help="can be used to skip the confirmation prompt",
|
|
190
|
+
)
|
|
180
191
|
sub.set_defaults(func=verify)
|
|
181
192
|
|
|
193
|
+
sub = cli_shared.add_command_subparser(
|
|
194
|
+
subparsers,
|
|
195
|
+
"contract",
|
|
196
|
+
"unverify",
|
|
197
|
+
"Unverify a previously verified Smart Contract",
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
_add_contract_arg(sub)
|
|
201
|
+
sub.add_argument(
|
|
202
|
+
"--code-hash",
|
|
203
|
+
required=True,
|
|
204
|
+
help="the code hash of the contract",
|
|
205
|
+
)
|
|
206
|
+
sub.add_argument(
|
|
207
|
+
"--verifier-url",
|
|
208
|
+
required=True,
|
|
209
|
+
help="the url of the service that validates the contract",
|
|
210
|
+
)
|
|
211
|
+
cli_shared.add_wallet_args(args, sub)
|
|
212
|
+
sub.set_defaults(func=unverify)
|
|
213
|
+
|
|
182
214
|
sub = cli_shared.add_command_subparser(
|
|
183
215
|
subparsers,
|
|
184
216
|
"contract",
|
|
@@ -524,6 +556,14 @@ def _send_or_simulate(tx: Transaction, contract_address: Address, args: Any):
|
|
|
524
556
|
|
|
525
557
|
|
|
526
558
|
def verify(args: Any) -> None:
|
|
559
|
+
if not args.skip_confirmation:
|
|
560
|
+
response = input(
|
|
561
|
+
"Are you sure you want to verify the contract? This will publish the contract's source code, which will be displayed on the MultiversX Explorer (y/n): "
|
|
562
|
+
)
|
|
563
|
+
if response.lower() != "y":
|
|
564
|
+
logger.info("Contract verification cancelled.")
|
|
565
|
+
return
|
|
566
|
+
|
|
527
567
|
contract = Address.new_from_bech32(args.contract)
|
|
528
568
|
verifier_url = args.verifier_url
|
|
529
569
|
|
|
@@ -537,6 +577,34 @@ def verify(args: Any) -> None:
|
|
|
537
577
|
logger.info("Contract verification request completed!")
|
|
538
578
|
|
|
539
579
|
|
|
580
|
+
def unverify(args: Any) -> None:
|
|
581
|
+
account = cli_shared.prepare_account(args)
|
|
582
|
+
contract: str = args.contract
|
|
583
|
+
code_hash: str = args.code_hash
|
|
584
|
+
verifier_url: str = f"{args.verifier_url}/verifier"
|
|
585
|
+
|
|
586
|
+
payload = {
|
|
587
|
+
"contract": contract,
|
|
588
|
+
"codeHash": code_hash,
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
serialized_payload = json.dumps(payload, separators=(",", ":")).encode("utf-8")
|
|
592
|
+
hash = hashlib.sha256(serialized_payload).hexdigest()
|
|
593
|
+
message_to_sign = (contract + hash).encode("utf-8")
|
|
594
|
+
|
|
595
|
+
signature = account.sign_message(Message(message_to_sign))
|
|
596
|
+
|
|
597
|
+
request_payload = {
|
|
598
|
+
"signature": signature.hex(),
|
|
599
|
+
"payload": payload,
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
headers = {"Content-type": "application/json"}
|
|
603
|
+
response = requests.delete(verifier_url, json=request_payload, headers=headers)
|
|
604
|
+
logger.info(f"Your request to unverify contract {contract} was submitted.")
|
|
605
|
+
print(response.json().get("message"))
|
|
606
|
+
|
|
607
|
+
|
|
540
608
|
def do_reproducible_build(args: Any):
|
|
541
609
|
project_path = args.project
|
|
542
610
|
docker_image = args.docker_image
|
|
@@ -6,7 +6,6 @@ from typing import Any, Optional, Union
|
|
|
6
6
|
from multiversx_sdk import Address, Transaction, TransactionOnNetwork
|
|
7
7
|
|
|
8
8
|
from multiversx_sdk_cli import utils
|
|
9
|
-
from multiversx_sdk_cli.transactions import transaction_on_network_to_dictionary
|
|
10
9
|
from multiversx_sdk_cli.utils import ISerializable
|
|
11
10
|
|
|
12
11
|
logger = logging.getLogger("cli.output")
|
|
@@ -36,7 +35,8 @@ class CLIOutputBuilder:
|
|
|
36
35
|
return self
|
|
37
36
|
|
|
38
37
|
def set_awaited_transaction(self, awaited_transaction: TransactionOnNetwork, omitted_fields: list[str] = []):
|
|
39
|
-
|
|
38
|
+
self.set_transaction_on_network(awaited_transaction, omitted_fields)
|
|
39
|
+
self.set_emitted_transaction_hash(awaited_transaction.hash.hex())
|
|
40
40
|
|
|
41
41
|
def set_transaction_on_network(
|
|
42
42
|
self,
|
|
@@ -69,7 +69,7 @@ class CLIOutputBuilder:
|
|
|
69
69
|
output["contractAddress"] = contract_address
|
|
70
70
|
|
|
71
71
|
if self.transaction_on_network:
|
|
72
|
-
transaction_on_network_dict =
|
|
72
|
+
transaction_on_network_dict = self.transaction_on_network.raw
|
|
73
73
|
utils.omit_fields(transaction_on_network_dict, self.transaction_on_network_omitted_fields)
|
|
74
74
|
output["transactionOnNetwork"] = transaction_on_network_dict
|
|
75
75
|
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import Optional, Protocol, TextIO, Union
|
|
4
4
|
|
|
5
5
|
from multiversx_sdk import (
|
|
6
6
|
Address,
|
|
7
7
|
AwaitingOptions,
|
|
8
|
-
SmartContractResult,
|
|
9
8
|
TokenTransfer,
|
|
10
9
|
Transaction,
|
|
11
|
-
TransactionEvent,
|
|
12
|
-
TransactionLogs,
|
|
13
10
|
TransactionOnNetwork,
|
|
14
11
|
TransactionsFactoryConfig,
|
|
15
12
|
TransferTransactionsFactory,
|
|
@@ -116,56 +113,3 @@ def load_transaction_from_file(f: TextIO) -> Transaction:
|
|
|
116
113
|
data_json: bytes = f.read().encode()
|
|
117
114
|
transaction_dictionary = json.loads(data_json).get("tx") or json.loads(data_json).get("emittedTransaction")
|
|
118
115
|
return Transaction.new_from_dictionary(transaction_dictionary)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
def transaction_event_to_dictionary(event: TransactionEvent) -> dict[str, Any]:
|
|
122
|
-
return {
|
|
123
|
-
"address": event.address.to_bech32(),
|
|
124
|
-
"identifier": event.identifier,
|
|
125
|
-
"topics": [topic.hex() for topic in event.topics],
|
|
126
|
-
"data": event.data.decode(),
|
|
127
|
-
"additional_data": [data.hex() for data in event.additional_data],
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
def transaction_logs_to_dictionary(logs: TransactionLogs) -> dict[str, Any]:
|
|
132
|
-
return {
|
|
133
|
-
"address": logs.address.to_bech32(),
|
|
134
|
-
"events": [transaction_event_to_dictionary(event) for event in logs.events],
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
def smart_contract_result_to_dictionary(result: SmartContractResult) -> dict[str, Any]:
|
|
139
|
-
return {
|
|
140
|
-
"sender": result.sender.to_bech32(),
|
|
141
|
-
"receiver": result.receiver.to_bech32(),
|
|
142
|
-
"data": result.data.decode(),
|
|
143
|
-
"logs": transaction_logs_to_dictionary(result.logs),
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
def transaction_on_network_to_dictionary(tx: TransactionOnNetwork) -> dict[str, Any]:
|
|
148
|
-
return {
|
|
149
|
-
"sender": tx.sender.to_bech32(),
|
|
150
|
-
"receiver": tx.receiver.to_bech32(),
|
|
151
|
-
"hash": tx.hash.hex(),
|
|
152
|
-
"nonce": tx.nonce,
|
|
153
|
-
"round": tx.round,
|
|
154
|
-
"epoch": tx.epoch,
|
|
155
|
-
"timestamp": tx.timestamp,
|
|
156
|
-
"blockHash": tx.block_hash.hex(),
|
|
157
|
-
"miniBlockHash": tx.miniblock_hash.hex(),
|
|
158
|
-
"senderShard": tx.sender_shard,
|
|
159
|
-
"receiverShard": tx.receiver_shard,
|
|
160
|
-
"value": tx.value,
|
|
161
|
-
"gasLimit": tx.gas_limit,
|
|
162
|
-
"gasPrice": tx.gas_price,
|
|
163
|
-
"function": tx.function,
|
|
164
|
-
"data": tx.data.decode(),
|
|
165
|
-
"version": tx.version,
|
|
166
|
-
"options": tx.options,
|
|
167
|
-
"signature": tx.signature.hex(),
|
|
168
|
-
"status": tx.status.status,
|
|
169
|
-
"smartContractResults": [smart_contract_result_to_dictionary(res) for res in tx.smart_contract_results],
|
|
170
|
-
"logs": transaction_logs_to_dictionary(tx.logs),
|
|
171
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|