mech-client 0.15.3__py3-none-any.whl → 0.15.5__py3-none-any.whl
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.
- mech_client/__init__.py +1 -1
- mech_client/cli.py +318 -54
- mech_client/interact.py +1 -1
- {mech_client-0.15.3.dist-info → mech_client-0.15.5.dist-info}/METADATA +1 -2
- {mech_client-0.15.3.dist-info → mech_client-0.15.5.dist-info}/RECORD +8 -8
- {mech_client-0.15.3.dist-info → mech_client-0.15.5.dist-info}/LICENSE +0 -0
- {mech_client-0.15.3.dist-info → mech_client-0.15.5.dist-info}/WHEEL +0 -0
- {mech_client-0.15.3.dist-info → mech_client-0.15.5.dist-info}/entry_points.txt +0 -0
mech_client/__init__.py
CHANGED
mech_client/cli.py
CHANGED
|
@@ -25,6 +25,7 @@ from pathlib import Path
|
|
|
25
25
|
from typing import Any, Dict, List, Optional, Tuple
|
|
26
26
|
|
|
27
27
|
import click
|
|
28
|
+
import requests
|
|
28
29
|
from click import ClickException
|
|
29
30
|
from dotenv import load_dotenv, set_key
|
|
30
31
|
from operate.cli import OperateApp
|
|
@@ -243,12 +244,34 @@ def setup_agent_mode(
|
|
|
243
244
|
].configure_local_config = mech_client_configure_local_config # type: ignore
|
|
244
245
|
|
|
245
246
|
print(f"Setting up agent mode using config at {template}...")
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
247
|
+
try:
|
|
248
|
+
run_service(
|
|
249
|
+
operate=operate,
|
|
250
|
+
config_path=template,
|
|
251
|
+
build_only=True,
|
|
252
|
+
use_binary=True,
|
|
253
|
+
skip_dependency_check=False,
|
|
254
|
+
)
|
|
255
|
+
except requests.exceptions.HTTPError as e:
|
|
256
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
257
|
+
raise ClickException(
|
|
258
|
+
f"RPC endpoint error: {e}\n\n"
|
|
259
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
260
|
+
f"Possible solutions:\n"
|
|
261
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
262
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'\n"
|
|
263
|
+
f" 3. Check your network connection"
|
|
264
|
+
) from e
|
|
265
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
266
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
267
|
+
raise ClickException(
|
|
268
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
269
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
270
|
+
f"Possible solutions:\n"
|
|
271
|
+
f" 1. Check your internet connection\n"
|
|
272
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
273
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
274
|
+
) from e
|
|
252
275
|
|
|
253
276
|
|
|
254
277
|
@click.command()
|
|
@@ -328,6 +351,7 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
328
351
|
priority_mech: str,
|
|
329
352
|
use_prepaid: bool,
|
|
330
353
|
use_offchain: bool,
|
|
354
|
+
key: Optional[str],
|
|
331
355
|
tools: Optional[tuple],
|
|
332
356
|
safe: Optional[str] = None,
|
|
333
357
|
extra_attribute: Optional[List[str]] = None,
|
|
@@ -341,7 +365,7 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
341
365
|
try:
|
|
342
366
|
agent_mode = is_agent_mode(ctx)
|
|
343
367
|
click.echo(f"Running interact with agent_mode={agent_mode}")
|
|
344
|
-
key_path: Optional[str] =
|
|
368
|
+
key_path: Optional[str] = key
|
|
345
369
|
key_password: Optional[str] = None
|
|
346
370
|
|
|
347
371
|
extra_attributes_dict: Dict[str, Any] = {}
|
|
@@ -423,6 +447,26 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
423
447
|
sleep=sleep,
|
|
424
448
|
chain_config=chain_config,
|
|
425
449
|
)
|
|
450
|
+
except requests.exceptions.HTTPError as e:
|
|
451
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
452
|
+
raise ClickException(
|
|
453
|
+
f"RPC endpoint error: {e}\n\n"
|
|
454
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
455
|
+
f"Possible solutions:\n"
|
|
456
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
457
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'\n"
|
|
458
|
+
f" 3. Check your network connection"
|
|
459
|
+
) from e
|
|
460
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
461
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
462
|
+
raise ClickException(
|
|
463
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
464
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
465
|
+
f"Possible solutions:\n"
|
|
466
|
+
f" 1. Check your internet connection\n"
|
|
467
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
468
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
469
|
+
) from e
|
|
426
470
|
except (ValueError, FileNotFoundError, Exception) as e:
|
|
427
471
|
raise ClickException(str(e)) from e
|
|
428
472
|
|
|
@@ -500,6 +544,26 @@ def tools_for_agents(agent_id: Optional[int], chain_config: str) -> None:
|
|
|
500
544
|
]
|
|
501
545
|
|
|
502
546
|
click.echo(tabulate(data, headers=headers, tablefmt="grid"))
|
|
547
|
+
except requests.exceptions.HTTPError as e:
|
|
548
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
549
|
+
raise ClickException(
|
|
550
|
+
f"RPC endpoint error: {e}\n\n"
|
|
551
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
552
|
+
f"Possible solutions:\n"
|
|
553
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
554
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'\n"
|
|
555
|
+
f" 3. Check your network connection"
|
|
556
|
+
) from e
|
|
557
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
558
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
559
|
+
raise ClickException(
|
|
560
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
561
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
562
|
+
f"Possible solutions:\n"
|
|
563
|
+
f" 1. Check your internet connection\n"
|
|
564
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
565
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
566
|
+
) from e
|
|
503
567
|
except (KeyError, TypeError) as e:
|
|
504
568
|
click.echo(f"Error processing tool data: {str(e)}")
|
|
505
569
|
except json.JSONDecodeError as e:
|
|
@@ -516,6 +580,26 @@ def tool_description(tool_id: str, chain_config: str) -> None:
|
|
|
516
580
|
try:
|
|
517
581
|
description = get_tool_description(tool_id, chain_config)
|
|
518
582
|
click.echo(f"Description for tool {tool_id}: {description}")
|
|
583
|
+
except requests.exceptions.HTTPError as e:
|
|
584
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
585
|
+
raise ClickException(
|
|
586
|
+
f"RPC endpoint error: {e}\n\n"
|
|
587
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
588
|
+
f"Possible solutions:\n"
|
|
589
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
590
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'\n"
|
|
591
|
+
f" 3. Check your network connection"
|
|
592
|
+
) from e
|
|
593
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
594
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
595
|
+
raise ClickException(
|
|
596
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
597
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
598
|
+
f"Possible solutions:\n"
|
|
599
|
+
f" 1. Check your internet connection\n"
|
|
600
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
601
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
602
|
+
) from e
|
|
519
603
|
except KeyError as e:
|
|
520
604
|
click.echo(f"Tool not found or missing description: {str(e)}")
|
|
521
605
|
except json.JSONDecodeError as e:
|
|
@@ -566,6 +650,26 @@ def tool_io_schema(tool_id: str, chain_config: str) -> None:
|
|
|
566
650
|
output_schema, headers=["Field", "Type", "Description"], tablefmt="grid"
|
|
567
651
|
)
|
|
568
652
|
)
|
|
653
|
+
except requests.exceptions.HTTPError as e:
|
|
654
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
655
|
+
raise ClickException(
|
|
656
|
+
f"RPC endpoint error: {e}\n\n"
|
|
657
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
658
|
+
f"Possible solutions:\n"
|
|
659
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
660
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'\n"
|
|
661
|
+
f" 3. Check your network connection"
|
|
662
|
+
) from e
|
|
663
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
664
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
665
|
+
raise ClickException(
|
|
666
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
667
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
668
|
+
f"Possible solutions:\n"
|
|
669
|
+
f" 1. Check your internet connection\n"
|
|
670
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
671
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
672
|
+
) from e
|
|
569
673
|
except KeyError as e:
|
|
570
674
|
click.echo(f"Error accessing schema data: {str(e)}")
|
|
571
675
|
except json.JSONDecodeError as e:
|
|
@@ -596,6 +700,26 @@ def tools_for_marketplace_mech(service_id: int, chain_config: str) -> None:
|
|
|
596
700
|
|
|
597
701
|
click.echo(tabulate(data, headers=headers, tablefmt="grid"))
|
|
598
702
|
|
|
703
|
+
except requests.exceptions.HTTPError as e:
|
|
704
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
705
|
+
raise ClickException(
|
|
706
|
+
f"RPC endpoint error: {e}\n\n"
|
|
707
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
708
|
+
f"Possible solutions:\n"
|
|
709
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
710
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'\n"
|
|
711
|
+
f" 3. Check your network connection"
|
|
712
|
+
) from e
|
|
713
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
714
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
715
|
+
raise ClickException(
|
|
716
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
717
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
718
|
+
f"Possible solutions:\n"
|
|
719
|
+
f" 1. Check your internet connection\n"
|
|
720
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
721
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
722
|
+
) from e
|
|
599
723
|
except (KeyError, TypeError) as e:
|
|
600
724
|
click.echo(f"Error processing tool data: {str(e)}")
|
|
601
725
|
except IOError as e:
|
|
@@ -610,6 +734,26 @@ def tool_description_for_marketplace_mech(tool_id: str, chain_config: str) -> No
|
|
|
610
734
|
try:
|
|
611
735
|
description = get_tool_description_for_marketplace_mech(tool_id, chain_config)
|
|
612
736
|
click.echo(f"Description for tool {tool_id}: {description}")
|
|
737
|
+
except requests.exceptions.HTTPError as e:
|
|
738
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
739
|
+
raise ClickException(
|
|
740
|
+
f"RPC endpoint error: {e}\n\n"
|
|
741
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
742
|
+
f"Possible solutions:\n"
|
|
743
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
744
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'\n"
|
|
745
|
+
f" 3. Check your network connection"
|
|
746
|
+
) from e
|
|
747
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
748
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
749
|
+
raise ClickException(
|
|
750
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
751
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
752
|
+
f"Possible solutions:\n"
|
|
753
|
+
f" 1. Check your internet connection\n"
|
|
754
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
755
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
756
|
+
) from e
|
|
613
757
|
except KeyError as e:
|
|
614
758
|
click.echo(f"Tool not found or missing description: {str(e)}")
|
|
615
759
|
except IOError as e:
|
|
@@ -646,6 +790,26 @@ def tool_io_schema_for_marketplace_mech(tool_id: str, chain_config: str) -> None
|
|
|
646
790
|
output_schema, headers=["Field", "Type", "Description"], tablefmt="grid"
|
|
647
791
|
)
|
|
648
792
|
)
|
|
793
|
+
except requests.exceptions.HTTPError as e:
|
|
794
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
795
|
+
raise ClickException(
|
|
796
|
+
f"RPC endpoint error: {e}\n\n"
|
|
797
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
798
|
+
f"Possible solutions:\n"
|
|
799
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
800
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'\n"
|
|
801
|
+
f" 3. Check your network connection"
|
|
802
|
+
) from e
|
|
803
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
804
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
805
|
+
raise ClickException(
|
|
806
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
807
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
808
|
+
f"Possible solutions:\n"
|
|
809
|
+
f" 1. Check your internet connection\n"
|
|
810
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
811
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
812
|
+
) from e
|
|
649
813
|
except KeyError as e:
|
|
650
814
|
click.echo(f"Error accessing schema data: {str(e)}")
|
|
651
815
|
except IOError as e:
|
|
@@ -668,26 +832,51 @@ def tool_io_schema_for_marketplace_mech(tool_id: str, chain_config: str) -> None
|
|
|
668
832
|
def deposit_native(
|
|
669
833
|
ctx: click.Context,
|
|
670
834
|
amount_to_deposit: str,
|
|
835
|
+
key: Optional[str] = None,
|
|
671
836
|
safe: Optional[str] = None,
|
|
672
837
|
chain_config: Optional[str] = None,
|
|
673
838
|
) -> None:
|
|
674
839
|
"""Deposits Native balance for prepaid requests."""
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
840
|
+
try:
|
|
841
|
+
agent_mode = is_agent_mode(ctx)
|
|
842
|
+
click.echo(f"Running deposit native with agent_mode={agent_mode}")
|
|
843
|
+
|
|
844
|
+
key_path: Optional[str] = key
|
|
845
|
+
key_password: Optional[str] = None
|
|
846
|
+
if agent_mode:
|
|
847
|
+
safe, key_path, key_password = fetch_agent_mode_data(chain_config)
|
|
848
|
+
if not safe or not key_path:
|
|
849
|
+
raise ClickException(
|
|
850
|
+
"Cannot fetch safe or key data for the agent mode."
|
|
851
|
+
)
|
|
852
|
+
|
|
853
|
+
deposit_native_main(
|
|
854
|
+
agent_mode=agent_mode,
|
|
855
|
+
safe_address=safe,
|
|
856
|
+
amount=amount_to_deposit,
|
|
857
|
+
private_key_path=key_path,
|
|
858
|
+
private_key_password=key_password,
|
|
859
|
+
chain_config=chain_config,
|
|
860
|
+
)
|
|
861
|
+
except requests.exceptions.HTTPError as e:
|
|
862
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
863
|
+
raise ClickException(
|
|
864
|
+
f"RPC endpoint error: {e}\n\n"
|
|
865
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
866
|
+
f"Possible solutions:\n"
|
|
867
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
868
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
869
|
+
) from e
|
|
870
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
871
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
872
|
+
raise ClickException(
|
|
873
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
874
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
875
|
+
f"Possible solutions:\n"
|
|
876
|
+
f" 1. Check your internet connection\n"
|
|
877
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
878
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
879
|
+
) from e
|
|
691
880
|
|
|
692
881
|
|
|
693
882
|
@click.command(name="deposit-token")
|
|
@@ -706,26 +895,51 @@ def deposit_native(
|
|
|
706
895
|
def deposit_token(
|
|
707
896
|
ctx: click.Context,
|
|
708
897
|
amount_to_deposit: str,
|
|
898
|
+
key: Optional[str] = None,
|
|
709
899
|
safe: Optional[str] = None,
|
|
710
900
|
chain_config: Optional[str] = None,
|
|
711
901
|
) -> None:
|
|
712
902
|
"""Deposits Token balance for prepaid requests."""
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
903
|
+
try:
|
|
904
|
+
agent_mode = is_agent_mode(ctx)
|
|
905
|
+
click.echo(f"Running deposit token with agent_mode={agent_mode}")
|
|
906
|
+
|
|
907
|
+
key_path: Optional[str] = key
|
|
908
|
+
key_password: Optional[str] = None
|
|
909
|
+
if agent_mode:
|
|
910
|
+
safe, key_path, key_password = fetch_agent_mode_data(chain_config)
|
|
911
|
+
if not safe or not key_path:
|
|
912
|
+
raise ClickException(
|
|
913
|
+
"Cannot fetch safe or key data for the agent mode."
|
|
914
|
+
)
|
|
915
|
+
|
|
916
|
+
deposit_token_main(
|
|
917
|
+
agent_mode=agent_mode,
|
|
918
|
+
safe_address=safe,
|
|
919
|
+
amount=amount_to_deposit,
|
|
920
|
+
private_key_path=key_path,
|
|
921
|
+
private_key_password=key_password,
|
|
922
|
+
chain_config=chain_config,
|
|
923
|
+
)
|
|
924
|
+
except requests.exceptions.HTTPError as e:
|
|
925
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
926
|
+
raise ClickException(
|
|
927
|
+
f"RPC endpoint error: {e}\n\n"
|
|
928
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
929
|
+
f"Possible solutions:\n"
|
|
930
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
931
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
932
|
+
) from e
|
|
933
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
934
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
935
|
+
raise ClickException(
|
|
936
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
937
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
938
|
+
f"Possible solutions:\n"
|
|
939
|
+
f" 1. Check your internet connection\n"
|
|
940
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
941
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
942
|
+
) from e
|
|
729
943
|
|
|
730
944
|
|
|
731
945
|
@click.command(name="purchase-nvm-subscription")
|
|
@@ -744,23 +958,53 @@ def nvm_subscribe(
|
|
|
744
958
|
ctx: click.Context,
|
|
745
959
|
chain_config: str,
|
|
746
960
|
safe: Optional[str] = None,
|
|
961
|
+
key: Optional[str] = None,
|
|
747
962
|
) -> None:
|
|
748
963
|
"""Allows to purchase nvm subscription for nvm mech requests."""
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
964
|
+
try:
|
|
965
|
+
agent_mode = is_agent_mode(ctx)
|
|
966
|
+
click.echo(f"Running purchase nvm subscription with agent_mode={agent_mode}")
|
|
967
|
+
|
|
968
|
+
key_path: Optional[str] = key
|
|
969
|
+
key_password: Optional[str] = None
|
|
970
|
+
if agent_mode:
|
|
971
|
+
safe, key_path, key_password = fetch_agent_mode_data(chain_config)
|
|
972
|
+
if not safe or not key_path:
|
|
973
|
+
raise ClickException(
|
|
974
|
+
"Cannot fetch safe or key data for the agent mode."
|
|
975
|
+
)
|
|
976
|
+
|
|
977
|
+
if not key_path:
|
|
978
|
+
raise ClickException(
|
|
979
|
+
"Private key path is required. Use --key option or set up agent mode."
|
|
980
|
+
)
|
|
981
|
+
|
|
982
|
+
nvm_subscribe_main(
|
|
983
|
+
agent_mode=agent_mode,
|
|
984
|
+
safe_address=safe,
|
|
985
|
+
private_key_path=key_path,
|
|
986
|
+
private_key_password=key_password,
|
|
987
|
+
chain_config=chain_config,
|
|
988
|
+
)
|
|
989
|
+
except requests.exceptions.HTTPError as e:
|
|
990
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
991
|
+
raise ClickException(
|
|
992
|
+
f"RPC endpoint error: {e}\n\n"
|
|
993
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
994
|
+
f"Possible solutions:\n"
|
|
995
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
996
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
997
|
+
) from e
|
|
998
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
999
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
1000
|
+
raise ClickException(
|
|
1001
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
1002
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
1003
|
+
f"Possible solutions:\n"
|
|
1004
|
+
f" 1. Check your internet connection\n"
|
|
1005
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
1006
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
1007
|
+
) from e
|
|
764
1008
|
|
|
765
1009
|
|
|
766
1010
|
@click.command(name="fetch-mm-mechs-info")
|
|
@@ -806,6 +1050,26 @@ def query_mm_mechs_info_cli(
|
|
|
806
1050
|
|
|
807
1051
|
click.echo(tabulate(data, headers=headers, tablefmt="grid"))
|
|
808
1052
|
return None
|
|
1053
|
+
except requests.exceptions.HTTPError as e:
|
|
1054
|
+
subgraph_url = os.getenv("MECHX_SUBGRAPH_URL", "default")
|
|
1055
|
+
raise ClickException(
|
|
1056
|
+
f"Subgraph endpoint error: {e}\n\n"
|
|
1057
|
+
f"Current subgraph URL: {subgraph_url}\n\n"
|
|
1058
|
+
f"Possible solutions:\n"
|
|
1059
|
+
f" 1. Check if the subgraph endpoint is available and accessible\n"
|
|
1060
|
+
f" 2. Set a different subgraph URL: export MECHX_SUBGRAPH_URL='https://your-subgraph-url'\n"
|
|
1061
|
+
f" 3. Check your network connection"
|
|
1062
|
+
) from e
|
|
1063
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
1064
|
+
subgraph_url = os.getenv("MECHX_SUBGRAPH_URL", "default")
|
|
1065
|
+
raise ClickException(
|
|
1066
|
+
f"Network error connecting to subgraph endpoint: {e}\n\n"
|
|
1067
|
+
f"Current subgraph URL: {subgraph_url}\n\n"
|
|
1068
|
+
f"Possible solutions:\n"
|
|
1069
|
+
f" 1. Check your internet connection\n"
|
|
1070
|
+
f" 2. Verify the subgraph URL is correct\n"
|
|
1071
|
+
f" 3. Try a different subgraph provider: export MECHX_SUBGRAPH_URL='https://your-subgraph-url'"
|
|
1072
|
+
) from e
|
|
809
1073
|
except Exception as e: # pylint: disable=broad-except
|
|
810
1074
|
click.echo(f"Error: {str(e)}")
|
|
811
1075
|
return None
|
mech_client/interact.py
CHANGED
|
@@ -79,7 +79,7 @@ class LedgerConfig:
|
|
|
79
79
|
|
|
80
80
|
def __post_init__(self) -> None:
|
|
81
81
|
"""Post initialization to override with environment variables."""
|
|
82
|
-
address = os.getenv("
|
|
82
|
+
address = os.getenv("MECHX_CHAIN_RPC")
|
|
83
83
|
if address:
|
|
84
84
|
self.address = address
|
|
85
85
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mech-client
|
|
3
|
-
Version: 0.15.
|
|
3
|
+
Version: 0.15.5
|
|
4
4
|
Summary: Basic client to interact with a mech
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Author: David Minarsch
|
|
@@ -544,7 +544,6 @@ MECHX_GAS_LIMIT
|
|
|
544
544
|
MECHX_TRANSACTION_URL
|
|
545
545
|
MECHX_SUBGRAPH_URL
|
|
546
546
|
|
|
547
|
-
MECHX_LEDGER_ADDRESS
|
|
548
547
|
MECHX_LEDGER_CHAIN_ID
|
|
549
548
|
MECHX_LEDGER_POA_CHAIN
|
|
550
549
|
MECHX_LEDGER_DEFAULT_GAS_PRICE_STRATEGY
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
mech_client/__init__.py,sha256=
|
|
1
|
+
mech_client/__init__.py,sha256=rp55DfMHjUI-7sUptqITc6cDLAcfaIwjAdkPUNvpG8Y,43
|
|
2
2
|
mech_client/abis/AgentMech.json,sha256=IEbs_xBGunBu5h-uT5DvIty8Zw412QoPI46S_DUMYNw,18082
|
|
3
3
|
mech_client/abis/AgentRegistry.json,sha256=2qmXeFINZWz9pyOma6Bq67kMDSUI1lD7WvgHLwuETD8,24723
|
|
4
4
|
mech_client/abis/AgreementStoreManager.base.json,sha256=_ljdIZcfFGmFzBHUTfhA4X0382ZHHpkdr_CziTwUETo,34360
|
|
@@ -30,7 +30,7 @@ mech_client/abis/SubscriptionToken.base.json,sha256=5StPEyfRvDMTqtQPO-KakXXZqobX
|
|
|
30
30
|
mech_client/abis/TransferNFTCondition.base.json,sha256=71O_3itHBz9qPtoTLev8_a7KxlcQfIZSfxK2562lkqw,42540
|
|
31
31
|
mech_client/abis/TransferNFTCondition.gnosis.json,sha256=-huhxV54eoNY8mR9WtQdmSgQDgaKiUi0PULJ4HEshWw,42540
|
|
32
32
|
mech_client/acn.py,sha256=Rj_jLPvJ5loDQfGbu3a_O24cJC4SwIErLceSz_zVYS8,5356
|
|
33
|
-
mech_client/cli.py,sha256=
|
|
33
|
+
mech_client/cli.py,sha256=DMM0q26oG_iK2kt70pOwAJ6wi7yUqQErzO_Zt-yAfFo,41101
|
|
34
34
|
mech_client/config/mech_client_base.json,sha256=y3yhaq-eecjm9_x3ITivFvfe56zEODW9WFQUUyffhLA,1090
|
|
35
35
|
mech_client/config/mech_client_gnosis.json,sha256=m5x_RzM8sN5GbJNtZ742nIogoVhnnB1_8kYm3o3BVDI,1102
|
|
36
36
|
mech_client/config/mech_client_polygon.json,sha256=VtoneJEasDN0otWuVOsysWaj7K36PDVsczNBTsWkOe4,1185
|
|
@@ -38,7 +38,7 @@ mech_client/configs/mechs.json,sha256=eR0yoNNtGozNB0w4KMx9E9dxM-zI10EhDSKnBuw8nP
|
|
|
38
38
|
mech_client/delivery.py,sha256=PU_qSzP5juDRHiKQsyg6TH9oacc8nRoRY9BQBBe_fW0,5588
|
|
39
39
|
mech_client/fetch_ipfs_hash.py,sha256=tg_hYVf4deXl89x3SOBrGFUthaSeN_Vg_OHDtfjdbp4,2752
|
|
40
40
|
mech_client/helpers/__init__.py,sha256=nmQig1EqBQ9EMOpgdykP3a6_2NWcoVH3-lnyHP5n0ws,1196
|
|
41
|
-
mech_client/interact.py,sha256=
|
|
41
|
+
mech_client/interact.py,sha256=UVkOnX5OizJXkVvLADs3KIZttFyZ_5MGgKc5ZyR7v48,21342
|
|
42
42
|
mech_client/marketplace_interact.py,sha256=LIXz9_hHM_6PRo_PTWAKplWlkdR6cNA22HRv7qTyzM4,41048
|
|
43
43
|
mech_client/mech_marketplace_subgraph.py,sha256=X_ypxfokN-YBtsUCVOHUecsinkbRDZ5fR5WCkid1ntM,3153
|
|
44
44
|
mech_client/mech_marketplace_tool_management.py,sha256=G1O0ajbeltRM5FpqPfmn2C4QRrwqf5HfWKUH2VKn6UA,7365
|
|
@@ -71,8 +71,8 @@ scripts/nvm_subscription/manager.py,sha256=yr1xKoQp7Vp4jqBiq2x4VzisEtCuQMuM4v8HK
|
|
|
71
71
|
scripts/nvm_subscription/resources/networks.json,sha256=xH0P3YkgkMTkQdahVKO0kI9m6ybJ67iwHApstUlfRmw,2359
|
|
72
72
|
scripts/utils.py,sha256=bbupA1PwBbVlMRojCFXEvj20eGAZ37PYRM2XsiwT85U,3332
|
|
73
73
|
scripts/whitelist.py,sha256=7PDGrl5GADe6kphxAH02oR5xalYYQovUfBz-xPjUnxw,604
|
|
74
|
-
mech_client-0.15.
|
|
75
|
-
mech_client-0.15.
|
|
76
|
-
mech_client-0.15.
|
|
77
|
-
mech_client-0.15.
|
|
78
|
-
mech_client-0.15.
|
|
74
|
+
mech_client-0.15.5.dist-info/LICENSE,sha256=mdBDB-mWKV5Cz4ejBzBiKqan6Z8zVLAh9xwM64O2FW4,11339
|
|
75
|
+
mech_client-0.15.5.dist-info/METADATA,sha256=znxJSiA48nYqilbWkhAwZPfE4i-tUCiEepZHf2G1Kp4,31112
|
|
76
|
+
mech_client-0.15.5.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
|
|
77
|
+
mech_client-0.15.5.dist-info/entry_points.txt,sha256=SbRMRsayzD8XfNXhgwPuXEqQsdZ5Bw9XDPnUuaDExyY,45
|
|
78
|
+
mech_client-0.15.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|