mech-client 0.15.2__py3-none-any.whl → 0.15.4__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 +308 -55
- mech_client/interact.py +1 -1
- {mech_client-0.15.2.dist-info → mech_client-0.15.4.dist-info}/METADATA +1 -2
- {mech_client-0.15.2.dist-info → mech_client-0.15.4.dist-info}/RECORD +9 -9
- scripts/nvm_subscription/manager.py +1 -1
- {mech_client-0.15.2.dist-info → mech_client-0.15.4.dist-info}/LICENSE +0 -0
- {mech_client-0.15.2.dist-info → mech_client-0.15.4.dist-info}/WHEEL +0 -0
- {mech_client-0.15.2.dist-info → mech_client-0.15.4.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
|
|
@@ -41,7 +42,7 @@ from operate.services.manage import KeysManager
|
|
|
41
42
|
from tabulate import tabulate # type: ignore
|
|
42
43
|
|
|
43
44
|
from mech_client import __version__
|
|
44
|
-
from mech_client.interact import ConfirmationType
|
|
45
|
+
from mech_client.interact import ConfirmationType, get_mech_config
|
|
45
46
|
from mech_client.interact import interact as interact_
|
|
46
47
|
from mech_client.marketplace_interact import IPFS_URL_TEMPLATE
|
|
47
48
|
from mech_client.marketplace_interact import (
|
|
@@ -130,7 +131,12 @@ def mech_client_configure_local_config(
|
|
|
130
131
|
config.rpc = {}
|
|
131
132
|
|
|
132
133
|
for chain in template["configurations"]:
|
|
133
|
-
|
|
134
|
+
# Use environment variable if set, otherwise fall back to default from mechs.json
|
|
135
|
+
env_rpc = os.getenv("MECHX_CHAIN_RPC")
|
|
136
|
+
if env_rpc is None:
|
|
137
|
+
mech_config = get_mech_config(chain)
|
|
138
|
+
env_rpc = mech_config.rpc_url
|
|
139
|
+
config.rpc[chain] = env_rpc
|
|
134
140
|
|
|
135
141
|
config.principal_chain = template["home_chain"]
|
|
136
142
|
|
|
@@ -238,12 +244,33 @@ def setup_agent_mode(
|
|
|
238
244
|
].configure_local_config = mech_client_configure_local_config # type: ignore
|
|
239
245
|
|
|
240
246
|
print(f"Setting up agent mode using config at {template}...")
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
+
try:
|
|
248
|
+
run_service(
|
|
249
|
+
operate=operate,
|
|
250
|
+
config_path=template,
|
|
251
|
+
build_only=True,
|
|
252
|
+
skip_dependency_check=False,
|
|
253
|
+
)
|
|
254
|
+
except requests.exceptions.HTTPError as e:
|
|
255
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
256
|
+
raise ClickException(
|
|
257
|
+
f"RPC endpoint error: {e}\n\n"
|
|
258
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
259
|
+
f"Possible solutions:\n"
|
|
260
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
261
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'\n"
|
|
262
|
+
f" 3. Check your network connection"
|
|
263
|
+
) from e
|
|
264
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
265
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
266
|
+
raise ClickException(
|
|
267
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
268
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
269
|
+
f"Possible solutions:\n"
|
|
270
|
+
f" 1. Check your internet connection\n"
|
|
271
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
272
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
273
|
+
) from e
|
|
247
274
|
|
|
248
275
|
|
|
249
276
|
@click.command()
|
|
@@ -418,6 +445,26 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
418
445
|
sleep=sleep,
|
|
419
446
|
chain_config=chain_config,
|
|
420
447
|
)
|
|
448
|
+
except requests.exceptions.HTTPError as e:
|
|
449
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
450
|
+
raise ClickException(
|
|
451
|
+
f"RPC endpoint error: {e}\n\n"
|
|
452
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
453
|
+
f"Possible solutions:\n"
|
|
454
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
455
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'\n"
|
|
456
|
+
f" 3. Check your network connection"
|
|
457
|
+
) from e
|
|
458
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
459
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
460
|
+
raise ClickException(
|
|
461
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
462
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
463
|
+
f"Possible solutions:\n"
|
|
464
|
+
f" 1. Check your internet connection\n"
|
|
465
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
466
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
467
|
+
) from e
|
|
421
468
|
except (ValueError, FileNotFoundError, Exception) as e:
|
|
422
469
|
raise ClickException(str(e)) from e
|
|
423
470
|
|
|
@@ -495,6 +542,26 @@ def tools_for_agents(agent_id: Optional[int], chain_config: str) -> None:
|
|
|
495
542
|
]
|
|
496
543
|
|
|
497
544
|
click.echo(tabulate(data, headers=headers, tablefmt="grid"))
|
|
545
|
+
except requests.exceptions.HTTPError as e:
|
|
546
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
547
|
+
raise ClickException(
|
|
548
|
+
f"RPC endpoint error: {e}\n\n"
|
|
549
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
550
|
+
f"Possible solutions:\n"
|
|
551
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
552
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'\n"
|
|
553
|
+
f" 3. Check your network connection"
|
|
554
|
+
) from e
|
|
555
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
556
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
557
|
+
raise ClickException(
|
|
558
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
559
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
560
|
+
f"Possible solutions:\n"
|
|
561
|
+
f" 1. Check your internet connection\n"
|
|
562
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
563
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
564
|
+
) from e
|
|
498
565
|
except (KeyError, TypeError) as e:
|
|
499
566
|
click.echo(f"Error processing tool data: {str(e)}")
|
|
500
567
|
except json.JSONDecodeError as e:
|
|
@@ -511,6 +578,26 @@ def tool_description(tool_id: str, chain_config: str) -> None:
|
|
|
511
578
|
try:
|
|
512
579
|
description = get_tool_description(tool_id, chain_config)
|
|
513
580
|
click.echo(f"Description for tool {tool_id}: {description}")
|
|
581
|
+
except requests.exceptions.HTTPError as e:
|
|
582
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
583
|
+
raise ClickException(
|
|
584
|
+
f"RPC endpoint error: {e}\n\n"
|
|
585
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
586
|
+
f"Possible solutions:\n"
|
|
587
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
588
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'\n"
|
|
589
|
+
f" 3. Check your network connection"
|
|
590
|
+
) from e
|
|
591
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
592
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
593
|
+
raise ClickException(
|
|
594
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
595
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
596
|
+
f"Possible solutions:\n"
|
|
597
|
+
f" 1. Check your internet connection\n"
|
|
598
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
599
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
600
|
+
) from e
|
|
514
601
|
except KeyError as e:
|
|
515
602
|
click.echo(f"Tool not found or missing description: {str(e)}")
|
|
516
603
|
except json.JSONDecodeError as e:
|
|
@@ -561,6 +648,26 @@ def tool_io_schema(tool_id: str, chain_config: str) -> None:
|
|
|
561
648
|
output_schema, headers=["Field", "Type", "Description"], tablefmt="grid"
|
|
562
649
|
)
|
|
563
650
|
)
|
|
651
|
+
except requests.exceptions.HTTPError as e:
|
|
652
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
653
|
+
raise ClickException(
|
|
654
|
+
f"RPC endpoint error: {e}\n\n"
|
|
655
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
656
|
+
f"Possible solutions:\n"
|
|
657
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
658
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'\n"
|
|
659
|
+
f" 3. Check your network connection"
|
|
660
|
+
) from e
|
|
661
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
662
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
663
|
+
raise ClickException(
|
|
664
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
665
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
666
|
+
f"Possible solutions:\n"
|
|
667
|
+
f" 1. Check your internet connection\n"
|
|
668
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
669
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
670
|
+
) from e
|
|
564
671
|
except KeyError as e:
|
|
565
672
|
click.echo(f"Error accessing schema data: {str(e)}")
|
|
566
673
|
except json.JSONDecodeError as e:
|
|
@@ -591,6 +698,26 @@ def tools_for_marketplace_mech(service_id: int, chain_config: str) -> None:
|
|
|
591
698
|
|
|
592
699
|
click.echo(tabulate(data, headers=headers, tablefmt="grid"))
|
|
593
700
|
|
|
701
|
+
except requests.exceptions.HTTPError as e:
|
|
702
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
703
|
+
raise ClickException(
|
|
704
|
+
f"RPC endpoint error: {e}\n\n"
|
|
705
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
706
|
+
f"Possible solutions:\n"
|
|
707
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
708
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'\n"
|
|
709
|
+
f" 3. Check your network connection"
|
|
710
|
+
) from e
|
|
711
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
712
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
713
|
+
raise ClickException(
|
|
714
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
715
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
716
|
+
f"Possible solutions:\n"
|
|
717
|
+
f" 1. Check your internet connection\n"
|
|
718
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
719
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
720
|
+
) from e
|
|
594
721
|
except (KeyError, TypeError) as e:
|
|
595
722
|
click.echo(f"Error processing tool data: {str(e)}")
|
|
596
723
|
except IOError as e:
|
|
@@ -605,6 +732,26 @@ def tool_description_for_marketplace_mech(tool_id: str, chain_config: str) -> No
|
|
|
605
732
|
try:
|
|
606
733
|
description = get_tool_description_for_marketplace_mech(tool_id, chain_config)
|
|
607
734
|
click.echo(f"Description for tool {tool_id}: {description}")
|
|
735
|
+
except requests.exceptions.HTTPError as e:
|
|
736
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
737
|
+
raise ClickException(
|
|
738
|
+
f"RPC endpoint error: {e}\n\n"
|
|
739
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
740
|
+
f"Possible solutions:\n"
|
|
741
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
742
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'\n"
|
|
743
|
+
f" 3. Check your network connection"
|
|
744
|
+
) from e
|
|
745
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
746
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
747
|
+
raise ClickException(
|
|
748
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
749
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
750
|
+
f"Possible solutions:\n"
|
|
751
|
+
f" 1. Check your internet connection\n"
|
|
752
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
753
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
754
|
+
) from e
|
|
608
755
|
except KeyError as e:
|
|
609
756
|
click.echo(f"Tool not found or missing description: {str(e)}")
|
|
610
757
|
except IOError as e:
|
|
@@ -641,6 +788,26 @@ def tool_io_schema_for_marketplace_mech(tool_id: str, chain_config: str) -> None
|
|
|
641
788
|
output_schema, headers=["Field", "Type", "Description"], tablefmt="grid"
|
|
642
789
|
)
|
|
643
790
|
)
|
|
791
|
+
except requests.exceptions.HTTPError as e:
|
|
792
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
793
|
+
raise ClickException(
|
|
794
|
+
f"RPC endpoint error: {e}\n\n"
|
|
795
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
796
|
+
f"Possible solutions:\n"
|
|
797
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
798
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'\n"
|
|
799
|
+
f" 3. Check your network connection"
|
|
800
|
+
) from e
|
|
801
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
802
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
803
|
+
raise ClickException(
|
|
804
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
805
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
806
|
+
f"Possible solutions:\n"
|
|
807
|
+
f" 1. Check your internet connection\n"
|
|
808
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
809
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
810
|
+
) from e
|
|
644
811
|
except KeyError as e:
|
|
645
812
|
click.echo(f"Error accessing schema data: {str(e)}")
|
|
646
813
|
except IOError as e:
|
|
@@ -667,22 +834,44 @@ def deposit_native(
|
|
|
667
834
|
chain_config: Optional[str] = None,
|
|
668
835
|
) -> None:
|
|
669
836
|
"""Deposits Native balance for prepaid requests."""
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
837
|
+
try:
|
|
838
|
+
agent_mode = is_agent_mode(ctx)
|
|
839
|
+
click.echo(f"Running deposit native with agent_mode={agent_mode}")
|
|
840
|
+
|
|
841
|
+
if agent_mode:
|
|
842
|
+
safe, key_path, key_password = fetch_agent_mode_data(chain_config)
|
|
843
|
+
if not safe or not key_path:
|
|
844
|
+
raise ClickException(
|
|
845
|
+
"Cannot fetch safe or key data for the agent mode."
|
|
846
|
+
)
|
|
847
|
+
|
|
848
|
+
deposit_native_main(
|
|
849
|
+
agent_mode=agent_mode,
|
|
850
|
+
safe_address=safe,
|
|
851
|
+
amount=amount_to_deposit,
|
|
852
|
+
private_key_path=key_path,
|
|
853
|
+
private_key_password=key_password,
|
|
854
|
+
chain_config=chain_config,
|
|
855
|
+
)
|
|
856
|
+
except requests.exceptions.HTTPError as e:
|
|
857
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
858
|
+
raise ClickException(
|
|
859
|
+
f"RPC endpoint error: {e}\n\n"
|
|
860
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
861
|
+
f"Possible solutions:\n"
|
|
862
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
863
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
864
|
+
) from e
|
|
865
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
866
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
867
|
+
raise ClickException(
|
|
868
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
869
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
870
|
+
f"Possible solutions:\n"
|
|
871
|
+
f" 1. Check your internet connection\n"
|
|
872
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
873
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
874
|
+
) from e
|
|
686
875
|
|
|
687
876
|
|
|
688
877
|
@click.command(name="deposit-token")
|
|
@@ -705,22 +894,44 @@ def deposit_token(
|
|
|
705
894
|
chain_config: Optional[str] = None,
|
|
706
895
|
) -> None:
|
|
707
896
|
"""Deposits Token balance for prepaid requests."""
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
897
|
+
try:
|
|
898
|
+
agent_mode = is_agent_mode(ctx)
|
|
899
|
+
click.echo(f"Running deposit token with agent_mode={agent_mode}")
|
|
900
|
+
|
|
901
|
+
if agent_mode:
|
|
902
|
+
safe, key_path, key_password = fetch_agent_mode_data(chain_config)
|
|
903
|
+
if not safe or not key_path:
|
|
904
|
+
raise ClickException(
|
|
905
|
+
"Cannot fetch safe or key data for the agent mode."
|
|
906
|
+
)
|
|
907
|
+
|
|
908
|
+
deposit_token_main(
|
|
909
|
+
agent_mode=agent_mode,
|
|
910
|
+
safe_address=safe,
|
|
911
|
+
amount=amount_to_deposit,
|
|
912
|
+
private_key_path=key_path,
|
|
913
|
+
private_key_password=key_password,
|
|
914
|
+
chain_config=chain_config,
|
|
915
|
+
)
|
|
916
|
+
except requests.exceptions.HTTPError as e:
|
|
917
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
918
|
+
raise ClickException(
|
|
919
|
+
f"RPC endpoint error: {e}\n\n"
|
|
920
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
921
|
+
f"Possible solutions:\n"
|
|
922
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
923
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
924
|
+
) from e
|
|
925
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
926
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
927
|
+
raise ClickException(
|
|
928
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
929
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
930
|
+
f"Possible solutions:\n"
|
|
931
|
+
f" 1. Check your internet connection\n"
|
|
932
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
933
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
934
|
+
) from e
|
|
724
935
|
|
|
725
936
|
|
|
726
937
|
@click.command(name="purchase-nvm-subscription")
|
|
@@ -741,21 +952,43 @@ def nvm_subscribe(
|
|
|
741
952
|
safe: Optional[str] = None,
|
|
742
953
|
) -> None:
|
|
743
954
|
"""Allows to purchase nvm subscription for nvm mech requests."""
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
955
|
+
try:
|
|
956
|
+
agent_mode = is_agent_mode(ctx)
|
|
957
|
+
click.echo(f"Running purchase nvm subscription with agent_mode={agent_mode}")
|
|
958
|
+
|
|
959
|
+
if agent_mode:
|
|
960
|
+
safe, key_path, key_password = fetch_agent_mode_data(chain_config)
|
|
961
|
+
if not safe or not key_path:
|
|
962
|
+
raise ClickException(
|
|
963
|
+
"Cannot fetch safe or key data for the agent mode."
|
|
964
|
+
)
|
|
965
|
+
|
|
966
|
+
nvm_subscribe_main(
|
|
967
|
+
agent_mode=agent_mode,
|
|
968
|
+
safe_address=safe,
|
|
969
|
+
private_key_path=key_path,
|
|
970
|
+
private_key_password=key_password,
|
|
971
|
+
chain_config=chain_config,
|
|
972
|
+
)
|
|
973
|
+
except requests.exceptions.HTTPError as e:
|
|
974
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
975
|
+
raise ClickException(
|
|
976
|
+
f"RPC endpoint error: {e}\n\n"
|
|
977
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
978
|
+
f"Possible solutions:\n"
|
|
979
|
+
f" 1. Check if the RPC endpoint is available and accessible\n"
|
|
980
|
+
f" 2. Set a different RPC endpoint: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
981
|
+
) from e
|
|
982
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
983
|
+
rpc_url = os.getenv("MECHX_CHAIN_RPC", "default")
|
|
984
|
+
raise ClickException(
|
|
985
|
+
f"Network error connecting to RPC endpoint: {e}\n\n"
|
|
986
|
+
f"Current RPC: {rpc_url}\n\n"
|
|
987
|
+
f"Possible solutions:\n"
|
|
988
|
+
f" 1. Check your internet connection\n"
|
|
989
|
+
f" 2. Verify the RPC URL is correct\n"
|
|
990
|
+
f" 3. Try a different RPC provider: export MECHX_CHAIN_RPC='https://your-rpc-url'"
|
|
991
|
+
) from e
|
|
759
992
|
|
|
760
993
|
|
|
761
994
|
@click.command(name="fetch-mm-mechs-info")
|
|
@@ -801,6 +1034,26 @@ def query_mm_mechs_info_cli(
|
|
|
801
1034
|
|
|
802
1035
|
click.echo(tabulate(data, headers=headers, tablefmt="grid"))
|
|
803
1036
|
return None
|
|
1037
|
+
except requests.exceptions.HTTPError as e:
|
|
1038
|
+
subgraph_url = os.getenv("MECHX_SUBGRAPH_URL", "default")
|
|
1039
|
+
raise ClickException(
|
|
1040
|
+
f"Subgraph endpoint error: {e}\n\n"
|
|
1041
|
+
f"Current subgraph URL: {subgraph_url}\n\n"
|
|
1042
|
+
f"Possible solutions:\n"
|
|
1043
|
+
f" 1. Check if the subgraph endpoint is available and accessible\n"
|
|
1044
|
+
f" 2. Set a different subgraph URL: export MECHX_SUBGRAPH_URL='https://your-subgraph-url'\n"
|
|
1045
|
+
f" 3. Check your network connection"
|
|
1046
|
+
) from e
|
|
1047
|
+
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
|
1048
|
+
subgraph_url = os.getenv("MECHX_SUBGRAPH_URL", "default")
|
|
1049
|
+
raise ClickException(
|
|
1050
|
+
f"Network error connecting to subgraph endpoint: {e}\n\n"
|
|
1051
|
+
f"Current subgraph URL: {subgraph_url}\n\n"
|
|
1052
|
+
f"Possible solutions:\n"
|
|
1053
|
+
f" 1. Check your internet connection\n"
|
|
1054
|
+
f" 2. Verify the subgraph URL is correct\n"
|
|
1055
|
+
f" 3. Try a different subgraph provider: export MECHX_SUBGRAPH_URL='https://your-subgraph-url'"
|
|
1056
|
+
) from e
|
|
804
1057
|
except Exception as e: # pylint: disable=broad-except
|
|
805
1058
|
click.echo(f"Error: {str(e)}")
|
|
806
1059
|
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.4
|
|
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=jaESBB_t9V6PD63Hhd7KKXTyS3dw3f7X2r5Hr9YtJa8,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=3cd2rtY34U6VYDIKIPv9bPAK6yjf-4xvsqA64WJ8S6w,40552
|
|
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
|
|
@@ -67,12 +67,12 @@ scripts/nvm_subscription/contracts/token.py,sha256=SQmNLJzhcmNJRQ7A4-ZpN1ThPxOCl
|
|
|
67
67
|
scripts/nvm_subscription/contracts/transfer_nft.py,sha256=Z3IlfBYVQLT4WhI5cszruHCKBrwQGTBuZrlQQcuEN3s,2681
|
|
68
68
|
scripts/nvm_subscription/envs/base.env,sha256=mI2loQ5Dt-rkZzuzmgyNiV-fUutwN89kOsEmygG4K78,528
|
|
69
69
|
scripts/nvm_subscription/envs/gnosis.env,sha256=mDCb1wEY4fRQYJQuyqg2b4qTFQtHHopRaKYCXTCeACM,554
|
|
70
|
-
scripts/nvm_subscription/manager.py,sha256=
|
|
70
|
+
scripts/nvm_subscription/manager.py,sha256=yr1xKoQp7Vp4jqBiq2x4VzisEtCuQMuM4v8HKuA79Lk,13602
|
|
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.4.dist-info/LICENSE,sha256=mdBDB-mWKV5Cz4ejBzBiKqan6Z8zVLAh9xwM64O2FW4,11339
|
|
75
|
+
mech_client-0.15.4.dist-info/METADATA,sha256=l_79nWf0k3Zfm_kUuRgCqiKyRkmwPrvQH_7h9YST3A0,31112
|
|
76
|
+
mech_client-0.15.4.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
|
|
77
|
+
mech_client-0.15.4.dist-info/entry_points.txt,sha256=SbRMRsayzD8XfNXhgwPuXEqQsdZ5Bw9XDPnUuaDExyY,45
|
|
78
|
+
mech_client-0.15.4.dist-info/RECORD,,
|
|
@@ -58,7 +58,7 @@ class NVMSubscriptionManager:
|
|
|
58
58
|
Initialize the SubscriptionManager, including contract instances
|
|
59
59
|
and Web3 connection.
|
|
60
60
|
"""
|
|
61
|
-
self.url = os.getenv("
|
|
61
|
+
self.url = os.getenv("MECHX_CHAIN_RPC", CONFIGS[network]["nvm"]['web3ProviderUri'])
|
|
62
62
|
self.web3 = Web3(Web3.HTTPProvider(self.url))
|
|
63
63
|
self.agent_mode = agent_mode
|
|
64
64
|
if self.agent_mode:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|