|
6 | 6 | from argparse import FileType |
7 | 7 | from functools import cache |
8 | 8 | from pathlib import Path |
9 | | -from typing import Any, Text, Union, cast |
| 9 | +from typing import Any, Optional, Text, Union, cast |
10 | 10 |
|
11 | 11 | from multiversx_sdk import ( |
12 | 12 | Account, |
|
39 | 39 | from multiversx_sdk_cli.simulation import Simulator |
40 | 40 | from multiversx_sdk_cli.transactions import send_and_wait_for_result |
41 | 41 | from multiversx_sdk_cli.utils import log_explorer_transaction |
42 | | -from multiversx_sdk_cli.ux import confirm_continuation, show_warning |
| 42 | +from multiversx_sdk_cli.ux import confirm_continuation |
43 | 43 |
|
44 | 44 | logger = logging.getLogger("cli_shared") |
45 | 45 |
|
@@ -509,16 +509,8 @@ def get_current_nonce_for_address(address: Address, proxy_url: Union[str, None]) |
509 | 509 |
|
510 | 510 |
|
511 | 511 | @cache |
512 | | -def get_chain_id(chain_id: str, proxy_url: str) -> str: |
513 | | - if chain_id and proxy_url: |
514 | | - fetched_chain_id = _fetch_chain_id(proxy_url) |
515 | | - |
516 | | - if chain_id != fetched_chain_id: |
517 | | - show_warning( |
518 | | - f"The chain ID you have provided does not match the chain ID you got from the proxy. Will use the proxy's value: '{fetched_chain_id}'" |
519 | | - ) |
520 | | - return fetched_chain_id |
521 | | - |
| 512 | +def get_chain_id(proxy_url: str, chain_id: Optional[str] = None) -> str: |
| 513 | + """We know and have already validated that if chainID is not provided, proxy is provided.""" |
522 | 514 | if chain_id: |
523 | 515 | return chain_id |
524 | 516 |
|
@@ -647,8 +639,11 @@ def prepare_guardian_relayer_data(args: Any) -> GuardianRelayerData: |
647 | 639 |
|
648 | 640 |
|
649 | 641 | def set_proxy_from_config_if_not_provided(args: Any, config: config.MxpyConfig) -> None: |
650 | | - """This function modifies the `args` object by setting the proxy from the config if not already set.""" |
| 642 | + """This function modifies the `args` object by setting the proxy from the config if not already set. If proxy is not needed (chainID and nonce are provided), the proxy will not be set.""" |
651 | 643 | if not args.proxy: |
| 644 | + if hasattr(args, "chain") and args.chain and hasattr(args, "nonce") and args.nonce: |
| 645 | + return |
| 646 | + |
652 | 647 | if config.proxy_url: |
653 | 648 | logger.info(f"Using proxy URL from config: {config.proxy_url}") |
654 | 649 | args.proxy = config.proxy_url |
0 commit comments