mech-client 0.14.1__py3-none-any.whl → 0.15.1__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 +258 -11
- mech_client/configs/mechs.json +110 -110
- mech_client/interact.py +6 -1
- mech_client/marketplace_interact.py +160 -42
- mech_client/safe.py +73 -0
- mech_client/subgraph.py +0 -11
- {mech_client-0.14.1.dist-info → mech_client-0.15.1.dist-info}/METADATA +278 -224
- {mech_client-0.14.1.dist-info → mech_client-0.15.1.dist-info}/RECORD +22 -48
- scripts/deposit_native.py +48 -16
- scripts/deposit_token.py +107 -31
- scripts/nvm_subscribe.py +14 -6
- scripts/nvm_subscription/contracts/base_contract.py +9 -1
- scripts/nvm_subscription/contracts/nft_sales.py +1 -3
- scripts/nvm_subscription/contracts/subscription_provider.py +2 -4
- scripts/nvm_subscription/contracts/token.py +23 -5
- scripts/nvm_subscription/manager.py +109 -16
- scripts/utils.py +2 -2
- scripts/whitelist.py +5 -1
- mech_client/helpers/acn/README.md +0 -76
- mech_client/helpers/acn/__init__.py +0 -30
- mech_client/helpers/acn/acn.proto +0 -71
- mech_client/helpers/acn/acn_pb2.py +0 -42
- mech_client/helpers/acn/custom_types.py +0 -224
- mech_client/helpers/acn/dialogues.py +0 -126
- mech_client/helpers/acn/message.py +0 -274
- mech_client/helpers/acn/protocol.yaml +0 -24
- mech_client/helpers/acn/serialization.py +0 -149
- mech_client/helpers/acn/tests/__init__.py +0 -20
- mech_client/helpers/acn/tests/test_acn.py +0 -256
- mech_client/helpers/acn/tests/test_acn_dialogues.py +0 -53
- mech_client/helpers/acn/tests/test_acn_messages.py +0 -117
- mech_client/helpers/acn_data_share/README.md +0 -32
- mech_client/helpers/acn_data_share/__init__.py +0 -32
- mech_client/helpers/acn_data_share/acn_data_share.proto +0 -17
- mech_client/helpers/acn_data_share/acn_data_share_pb2.py +0 -29
- mech_client/helpers/acn_data_share/dialogues.py +0 -115
- mech_client/helpers/acn_data_share/message.py +0 -213
- mech_client/helpers/acn_data_share/protocol.yaml +0 -21
- mech_client/helpers/acn_data_share/serialization.py +0 -111
- mech_client/helpers/acn_data_share/tests/test_acn_data_share_dialogues.py +0 -49
- mech_client/helpers/acn_data_share/tests/test_acn_data_share_messages.py +0 -53
- mech_client/helpers/p2p_libp2p_client/README.md +0 -15
- mech_client/helpers/p2p_libp2p_client/__init__.py +0 -21
- mech_client/helpers/p2p_libp2p_client/connection.py +0 -703
- mech_client/helpers/p2p_libp2p_client/connection.yaml +0 -52
- {mech_client-0.14.1.dist-info → mech_client-0.15.1.dist-info}/LICENSE +0 -0
- {mech_client-0.14.1.dist-info → mech_client-0.15.1.dist-info}/WHEEL +0 -0
- {mech_client-0.14.1.dist-info → mech_client-0.15.1.dist-info}/entry_points.txt +0 -0
mech_client/__init__.py
CHANGED
mech_client/cli.py
CHANGED
|
@@ -20,10 +20,24 @@
|
|
|
20
20
|
"""Mech client CLI module."""
|
|
21
21
|
import json
|
|
22
22
|
import os
|
|
23
|
+
import sys
|
|
24
|
+
from pathlib import Path
|
|
23
25
|
from typing import Any, Dict, List, Optional, Tuple
|
|
24
26
|
|
|
25
27
|
import click
|
|
26
28
|
from click import ClickException
|
|
29
|
+
from dotenv import load_dotenv, set_key
|
|
30
|
+
from operate.cli import OperateApp
|
|
31
|
+
from operate.cli import logger as operate_logger
|
|
32
|
+
from operate.constants import NO_STAKING_PROGRAM_ID
|
|
33
|
+
from operate.operate_types import ServiceTemplate
|
|
34
|
+
from operate.quickstart.run_service import (
|
|
35
|
+
QuickstartConfig,
|
|
36
|
+
ask_password_if_needed,
|
|
37
|
+
load_local_config,
|
|
38
|
+
run_service,
|
|
39
|
+
)
|
|
40
|
+
from operate.services.manage import KeysManager
|
|
27
41
|
from tabulate import tabulate # type: ignore
|
|
28
42
|
|
|
29
43
|
from mech_client import __version__
|
|
@@ -58,10 +72,178 @@ from scripts.deposit_token import main as deposit_token_main
|
|
|
58
72
|
from scripts.nvm_subscribe import main as nvm_subscribe_main
|
|
59
73
|
|
|
60
74
|
|
|
75
|
+
CURR_DIR = Path(__file__).resolve().parent
|
|
76
|
+
BASE_DIR = CURR_DIR.parent
|
|
77
|
+
OPERATE_FOLDER_NAME = ".operate_mech_client"
|
|
78
|
+
SETUP_MODE_COMMAND = "setup-agent-mode"
|
|
79
|
+
DEFAULT_NETWORK = "gnosis"
|
|
80
|
+
|
|
81
|
+
CHAIN_TO_TEMPLATE = {
|
|
82
|
+
"gnosis": BASE_DIR / "config" / "mech_client_gnosis.json",
|
|
83
|
+
"base": BASE_DIR / "config" / "mech_client_base.json",
|
|
84
|
+
"polygon": BASE_DIR / "config" / "mech_client_polygon.json",
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
ENV_PATH = BASE_DIR / ".env"
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def get_operate_path() -> Path:
|
|
91
|
+
"""Fetches the operate path for the mech client service"""
|
|
92
|
+
home = Path.home()
|
|
93
|
+
operate_path = home.joinpath(OPERATE_FOLDER_NAME)
|
|
94
|
+
return operate_path
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def is_agent_mode(ctx: click.Context) -> bool:
|
|
98
|
+
"""Fetches whether agent mode is on or not"""
|
|
99
|
+
client_mode = ctx.obj.get("client_mode", False)
|
|
100
|
+
agent_mode = not client_mode
|
|
101
|
+
return agent_mode
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def get_password(operate: OperateApp) -> str:
|
|
105
|
+
"""Load password from env/.env if present, otherwise prompt once and persist."""
|
|
106
|
+
load_dotenv(dotenv_path=ENV_PATH, override=False)
|
|
107
|
+
env_password = os.getenv("OPERATE_PASSWORD")
|
|
108
|
+
if env_password:
|
|
109
|
+
os.environ["OPERATE_PASSWORD"] = env_password
|
|
110
|
+
os.environ["ATTENDED"] = "false"
|
|
111
|
+
return os.environ["OPERATE_PASSWORD"]
|
|
112
|
+
|
|
113
|
+
ask_password_if_needed(operate)
|
|
114
|
+
if not operate.password:
|
|
115
|
+
raise ClickException("Password could not be set for Operate.")
|
|
116
|
+
|
|
117
|
+
os.environ["OPERATE_PASSWORD"] = operate.password
|
|
118
|
+
set_key(str(ENV_PATH), "OPERATE_PASSWORD", os.environ["OPERATE_PASSWORD"])
|
|
119
|
+
os.environ["ATTENDED"] = "false"
|
|
120
|
+
return os.environ["OPERATE_PASSWORD"]
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def mech_client_configure_local_config(
|
|
124
|
+
template: ServiceTemplate, operate: "OperateApp"
|
|
125
|
+
) -> QuickstartConfig:
|
|
126
|
+
"""Configure local quickstart configuration."""
|
|
127
|
+
config = load_local_config(operate=operate, service_name=template["name"])
|
|
128
|
+
|
|
129
|
+
if config.rpc is None:
|
|
130
|
+
config.rpc = {}
|
|
131
|
+
|
|
132
|
+
for chain in template["configurations"]:
|
|
133
|
+
config.rpc[chain] = os.getenv("MECHX_RPC_URL")
|
|
134
|
+
|
|
135
|
+
config.principal_chain = template["home_chain"]
|
|
136
|
+
|
|
137
|
+
# set chain configs in the service template
|
|
138
|
+
for chain in template["configurations"]:
|
|
139
|
+
template["configurations"][chain] |= {
|
|
140
|
+
"staking_program_id": NO_STAKING_PROGRAM_ID,
|
|
141
|
+
"rpc": config.rpc[chain],
|
|
142
|
+
"cost_of_bond": 1,
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if config.user_provided_args is None:
|
|
146
|
+
config.user_provided_args = {}
|
|
147
|
+
|
|
148
|
+
config.store()
|
|
149
|
+
return config
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def fetch_agent_mode_data(
|
|
153
|
+
chain_config: Optional[str],
|
|
154
|
+
) -> Tuple[str, str, Optional[str]]:
|
|
155
|
+
"""Fetches the agent mode data of safe address and the keystore path plus password"""
|
|
156
|
+
chain_config = chain_config or DEFAULT_NETWORK
|
|
157
|
+
|
|
158
|
+
# This is acceptable way to as the main functionality
|
|
159
|
+
# of keys manager is to allow access to the required data.
|
|
160
|
+
operate_path = get_operate_path()
|
|
161
|
+
operate = OperateApp(operate_path)
|
|
162
|
+
# Ensure the password is loaded so keys can be decrypted.
|
|
163
|
+
get_password(operate)
|
|
164
|
+
keys_manager = KeysManager(
|
|
165
|
+
path=operate._keys, # pylint: disable=protected-access
|
|
166
|
+
logger=operate_logger,
|
|
167
|
+
password=operate.password,
|
|
168
|
+
)
|
|
169
|
+
service_manager = operate.service_manager()
|
|
170
|
+
service_config_id = None
|
|
171
|
+
for service in service_manager.json:
|
|
172
|
+
if service["home_chain"] == chain_config:
|
|
173
|
+
service_config_id = service["service_config_id"]
|
|
174
|
+
break
|
|
175
|
+
|
|
176
|
+
if not service_config_id:
|
|
177
|
+
raise ClickException(
|
|
178
|
+
f"""Cannot find deployed service id for chain {chain_config}. Setup agent mode for a chain using mechx setup-agent-mode cli command."""
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
service = operate.service_manager().load(service_config_id)
|
|
182
|
+
|
|
183
|
+
key_path = keys_manager.get_private_key_file(service.agent_addresses[0])
|
|
184
|
+
safe = service.chain_configs[chain_config].chain_data.multisig
|
|
185
|
+
|
|
186
|
+
return safe, str(key_path), os.getenv("OPERATE_PASSWORD")
|
|
187
|
+
|
|
188
|
+
|
|
61
189
|
@click.group(name="mechx") # type: ignore
|
|
62
190
|
@click.version_option(__version__, prog_name="mechx")
|
|
63
|
-
|
|
191
|
+
@click.option(
|
|
192
|
+
"--client-mode",
|
|
193
|
+
is_flag=True,
|
|
194
|
+
help="Enables client mode",
|
|
195
|
+
)
|
|
196
|
+
@click.pass_context
|
|
197
|
+
def cli(ctx: click.Context, client_mode: bool) -> None:
|
|
64
198
|
"""Command-line tool for interacting with mechs."""
|
|
199
|
+
ctx.ensure_object(dict)
|
|
200
|
+
ctx.obj["client_mode"] = client_mode
|
|
201
|
+
|
|
202
|
+
cli_command = ctx.invoked_subcommand if ctx.invoked_subcommand else None
|
|
203
|
+
is_setup_called = cli_command == SETUP_MODE_COMMAND
|
|
204
|
+
|
|
205
|
+
if not is_setup_called and not client_mode:
|
|
206
|
+
click.echo("Agent mode enabled")
|
|
207
|
+
operate_path = get_operate_path()
|
|
208
|
+
if not operate_path.exists():
|
|
209
|
+
raise ClickException(
|
|
210
|
+
f"""Operate path does not exists at: {operate_path}. Setup agent mode for a chain using mechx setup-agent-mode cli command."""
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
@click.command()
|
|
215
|
+
@click.option(
|
|
216
|
+
"--chain-config",
|
|
217
|
+
type=str,
|
|
218
|
+
help="Id of the mech's chain configuration (stored configs/mechs.json)",
|
|
219
|
+
)
|
|
220
|
+
def setup_agent_mode(
|
|
221
|
+
chain_config: str,
|
|
222
|
+
) -> None:
|
|
223
|
+
"""Sets up the agent mode for users"""
|
|
224
|
+
template = CHAIN_TO_TEMPLATE.get(chain_config)
|
|
225
|
+
if template is None:
|
|
226
|
+
supported_chains = list(CHAIN_TO_TEMPLATE.keys())
|
|
227
|
+
raise ClickException(
|
|
228
|
+
f"""{chain_config} chain not supported for agent mode. Supported chains are: {supported_chains}"""
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
operate_path = get_operate_path()
|
|
232
|
+
operate = OperateApp(operate_path)
|
|
233
|
+
operate.setup()
|
|
234
|
+
get_password(operate)
|
|
235
|
+
|
|
236
|
+
sys.modules[
|
|
237
|
+
"operate.quickstart.run_service"
|
|
238
|
+
].configure_local_config = mech_client_configure_local_config # type: ignore
|
|
239
|
+
|
|
240
|
+
print(f"Setting up agent mode using config at {template}...")
|
|
241
|
+
run_service(
|
|
242
|
+
operate=operate,
|
|
243
|
+
config_path=template,
|
|
244
|
+
build_only=True,
|
|
245
|
+
skip_dependency_check=False,
|
|
246
|
+
)
|
|
65
247
|
|
|
66
248
|
|
|
67
249
|
@click.command()
|
|
@@ -133,14 +315,16 @@ def cli() -> None:
|
|
|
133
315
|
type=str,
|
|
134
316
|
help="Id of the mech's chain configuration (stored configs/mechs.json)",
|
|
135
317
|
)
|
|
318
|
+
@click.pass_context
|
|
136
319
|
def interact( # pylint: disable=too-many-arguments,too-many-locals
|
|
320
|
+
ctx: click.Context,
|
|
137
321
|
prompts: tuple,
|
|
138
322
|
agent_id: int,
|
|
139
323
|
priority_mech: str,
|
|
140
324
|
use_prepaid: bool,
|
|
141
325
|
use_offchain: bool,
|
|
142
|
-
key: Optional[str],
|
|
143
326
|
tools: Optional[tuple],
|
|
327
|
+
safe: Optional[str] = None,
|
|
144
328
|
extra_attribute: Optional[List[str]] = None,
|
|
145
329
|
confirm: Optional[str] = None,
|
|
146
330
|
retries: Optional[int] = None,
|
|
@@ -150,6 +334,11 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
150
334
|
) -> None:
|
|
151
335
|
"""Interact with a mech specifying a prompt and tool."""
|
|
152
336
|
try:
|
|
337
|
+
agent_mode = is_agent_mode(ctx)
|
|
338
|
+
click.echo(f"Running interact with agent_mode={agent_mode}")
|
|
339
|
+
key_path: Optional[str] = None
|
|
340
|
+
key_password: Optional[str] = None
|
|
341
|
+
|
|
153
342
|
extra_attributes_dict: Dict[str, Any] = {}
|
|
154
343
|
if extra_attribute:
|
|
155
344
|
for pair in extra_attribute:
|
|
@@ -171,13 +360,23 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
171
360
|
f"The number of prompts ({len(prompts)}) must match the number of tools ({len(tools)})"
|
|
172
361
|
)
|
|
173
362
|
|
|
363
|
+
if agent_mode:
|
|
364
|
+
safe, key_path, key_password = fetch_agent_mode_data(chain_config)
|
|
365
|
+
if not safe or not key_path:
|
|
366
|
+
raise ClickException(
|
|
367
|
+
"Cannot fetch safe or key data for the agent mode."
|
|
368
|
+
)
|
|
369
|
+
|
|
174
370
|
marketplace_interact_(
|
|
175
371
|
prompts=prompts,
|
|
176
372
|
priority_mech=priority_mech,
|
|
373
|
+
agent_mode=agent_mode,
|
|
374
|
+
safe_address=safe,
|
|
177
375
|
use_prepaid=use_prepaid,
|
|
178
376
|
use_offchain=use_offchain,
|
|
179
377
|
mech_offchain_url=mech_offchain_url,
|
|
180
|
-
private_key_path=
|
|
378
|
+
private_key_path=key_path,
|
|
379
|
+
private_key_password=key_password,
|
|
181
380
|
tools=tools,
|
|
182
381
|
extra_attributes=extra_attributes_dict,
|
|
183
382
|
retries=retries,
|
|
@@ -205,7 +404,8 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
205
404
|
interact_(
|
|
206
405
|
prompt=prompts[0],
|
|
207
406
|
agent_id=agent_id,
|
|
208
|
-
private_key_path=
|
|
407
|
+
private_key_path=key_path,
|
|
408
|
+
private_key_password=key_password,
|
|
209
409
|
tool=tools[0] if tools else None,
|
|
210
410
|
extra_attributes=extra_attributes_dict,
|
|
211
411
|
confirmation_type=(
|
|
@@ -459,14 +659,29 @@ def tool_io_schema_for_marketplace_mech(tool_id: str, chain_config: str) -> None
|
|
|
459
659
|
type=click.Path(exists=True, file_okay=True, dir_okay=False),
|
|
460
660
|
help="Path to private key to use for deposit",
|
|
461
661
|
)
|
|
662
|
+
@click.pass_context
|
|
462
663
|
def deposit_native(
|
|
664
|
+
ctx: click.Context,
|
|
463
665
|
amount_to_deposit: str,
|
|
464
|
-
|
|
666
|
+
safe: Optional[str] = None,
|
|
465
667
|
chain_config: Optional[str] = None,
|
|
466
668
|
) -> None:
|
|
467
669
|
"""Deposits Native balance for prepaid requests."""
|
|
670
|
+
agent_mode = is_agent_mode(ctx)
|
|
671
|
+
click.echo(f"Running deposit native with agent_mode={agent_mode}")
|
|
672
|
+
|
|
673
|
+
if agent_mode:
|
|
674
|
+
safe, key_path, key_password = fetch_agent_mode_data(chain_config)
|
|
675
|
+
if not safe or not key_path:
|
|
676
|
+
raise ClickException("Cannot fetch safe or key data for the agent mode.")
|
|
677
|
+
|
|
468
678
|
deposit_native_main(
|
|
469
|
-
|
|
679
|
+
agent_mode=agent_mode,
|
|
680
|
+
safe_address=safe,
|
|
681
|
+
amount=amount_to_deposit,
|
|
682
|
+
private_key_path=key_path,
|
|
683
|
+
private_key_password=key_password,
|
|
684
|
+
chain_config=chain_config,
|
|
470
685
|
)
|
|
471
686
|
|
|
472
687
|
|
|
@@ -482,14 +697,29 @@ def deposit_native(
|
|
|
482
697
|
type=click.Path(exists=True, file_okay=True, dir_okay=False),
|
|
483
698
|
help="Path to private key to use for deposit",
|
|
484
699
|
)
|
|
700
|
+
@click.pass_context
|
|
485
701
|
def deposit_token(
|
|
702
|
+
ctx: click.Context,
|
|
486
703
|
amount_to_deposit: str,
|
|
487
|
-
|
|
704
|
+
safe: Optional[str] = None,
|
|
488
705
|
chain_config: Optional[str] = None,
|
|
489
706
|
) -> None:
|
|
490
707
|
"""Deposits Token balance for prepaid requests."""
|
|
708
|
+
agent_mode = is_agent_mode(ctx)
|
|
709
|
+
click.echo(f"Running deposit token with agent_mode={agent_mode}")
|
|
710
|
+
|
|
711
|
+
if agent_mode:
|
|
712
|
+
safe, key_path, key_password = fetch_agent_mode_data(chain_config)
|
|
713
|
+
if not safe or not key_path:
|
|
714
|
+
raise ClickException("Cannot fetch safe or key data for the agent mode.")
|
|
715
|
+
|
|
491
716
|
deposit_token_main(
|
|
492
|
-
|
|
717
|
+
agent_mode=agent_mode,
|
|
718
|
+
safe_address=safe,
|
|
719
|
+
amount=amount_to_deposit,
|
|
720
|
+
private_key_path=key_path,
|
|
721
|
+
private_key_password=key_password,
|
|
722
|
+
chain_config=chain_config,
|
|
493
723
|
)
|
|
494
724
|
|
|
495
725
|
|
|
@@ -504,12 +734,28 @@ def deposit_token(
|
|
|
504
734
|
type=click.Path(exists=True, file_okay=True, dir_okay=False),
|
|
505
735
|
help="Path to private key to use for deposit",
|
|
506
736
|
)
|
|
737
|
+
@click.pass_context
|
|
507
738
|
def nvm_subscribe(
|
|
508
|
-
|
|
739
|
+
ctx: click.Context,
|
|
509
740
|
chain_config: str,
|
|
741
|
+
safe: Optional[str] = None,
|
|
510
742
|
) -> None:
|
|
511
743
|
"""Allows to purchase nvm subscription for nvm mech requests."""
|
|
512
|
-
|
|
744
|
+
agent_mode = is_agent_mode(ctx)
|
|
745
|
+
click.echo(f"Running purchase nvm subscription with agent_mode={agent_mode}")
|
|
746
|
+
|
|
747
|
+
if agent_mode:
|
|
748
|
+
safe, key_path, key_password = fetch_agent_mode_data(chain_config)
|
|
749
|
+
if not safe or not key_path:
|
|
750
|
+
raise ClickException("Cannot fetch safe or key data for the agent mode.")
|
|
751
|
+
|
|
752
|
+
nvm_subscribe_main(
|
|
753
|
+
agent_mode=agent_mode,
|
|
754
|
+
safe_address=safe,
|
|
755
|
+
private_key_path=key_path,
|
|
756
|
+
private_key_password=key_password,
|
|
757
|
+
chain_config=chain_config,
|
|
758
|
+
)
|
|
513
759
|
|
|
514
760
|
|
|
515
761
|
@click.command(name="fetch-mm-mechs-info")
|
|
@@ -560,6 +806,7 @@ def query_mm_mechs_info_cli(
|
|
|
560
806
|
return None
|
|
561
807
|
|
|
562
808
|
|
|
809
|
+
cli.add_command(setup_agent_mode)
|
|
563
810
|
cli.add_command(interact)
|
|
564
811
|
cli.add_command(prompt_to_ipfs)
|
|
565
812
|
cli.add_command(push_to_ipfs)
|
|
@@ -577,4 +824,4 @@ cli.add_command(query_mm_mechs_info_cli)
|
|
|
577
824
|
|
|
578
825
|
|
|
579
826
|
if __name__ == "__main__":
|
|
580
|
-
cli()
|
|
827
|
+
cli() # pylint: disable=no-value-for-parameter
|
mech_client/configs/mechs.json
CHANGED
|
@@ -1,116 +1,116 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
"gas_limit": 500000,
|
|
17
|
-
"price": 10000000000000000,
|
|
18
|
-
"transaction_url": "https://gnosisscan.io/tx/{transaction_digest}",
|
|
19
|
-
"subgraph_url": "https://api.studio.thegraph.com/query/89372/olas-gnosis-mech-marketplace/v0.0.2"
|
|
2
|
+
"gnosis": {
|
|
3
|
+
"agent_registry_contract": "0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA",
|
|
4
|
+
"service_registry_contract": "0x9338b5153AE39BB89f50468E608eD9d764B755fD",
|
|
5
|
+
"mech_marketplace_contract": "0x735FAAb1c4Ec41128c367AFb5c3baC73509f70bB",
|
|
6
|
+
"complementary_metadata_hash_address": "0x0598081D48FB80B0A7E52FAD2905AE9beCd6fC69",
|
|
7
|
+
"rpc_url": "https://rpc.eu-central-2.gateway.fm/v4/gnosis/non-archival/mainnet",
|
|
8
|
+
"wss_endpoint": "wss://rpc.gnosischain.com/wss",
|
|
9
|
+
"ledger_config": {
|
|
10
|
+
"address": "https://rpc.eu-central-2.gateway.fm/v4/gnosis/non-archival/mainnet",
|
|
11
|
+
"chain_id": 100,
|
|
12
|
+
"poa_chain": false,
|
|
13
|
+
"default_gas_price_strategy": "eip1559",
|
|
14
|
+
"is_gas_estimation_enabled": false
|
|
20
15
|
},
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
16
|
+
"gas_limit": 500000,
|
|
17
|
+
"price": 10000000000000000,
|
|
18
|
+
"transaction_url": "https://gnosisscan.io/tx/{transaction_digest}",
|
|
19
|
+
"subgraph_url": "https://api.studio.thegraph.com/query/89372/olas-gnosis-mech-marketplace/v0.0.2"
|
|
20
|
+
},
|
|
21
|
+
"arbitrum": {
|
|
22
|
+
"agent_registry_contract": "0xa4799B083E0068732456EF45ff9fe5c683658327",
|
|
23
|
+
"service_registry_contract": "0xE3607b00E75f6405248323A9417ff6b39B244b50",
|
|
24
|
+
"mech_marketplace_contract": "0x0000000000000000000000000000000000000000",
|
|
25
|
+
"complementary_metadata_hash_address": "0x0000000000000000000000000000000000000000",
|
|
26
|
+
"rpc_url": "https://arbitrum.llamarpc.com",
|
|
27
|
+
"wss_endpoint": "wss://arbitrum.gateway.tenderly.co",
|
|
28
|
+
"ledger_config": {
|
|
29
|
+
"address": "https://arbitrum.llamarpc.com",
|
|
30
|
+
"chain_id": 42161,
|
|
31
|
+
"poa_chain": false,
|
|
32
|
+
"default_gas_price_strategy": "eip1559",
|
|
33
|
+
"is_gas_estimation_enabled": false
|
|
39
34
|
},
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
35
|
+
"gas_limit": 100000,
|
|
36
|
+
"price": 3000000000000,
|
|
37
|
+
"transaction_url": "https://arbiscan.io/tx/{transaction_digest}",
|
|
38
|
+
"subgraph_url": ""
|
|
39
|
+
},
|
|
40
|
+
"polygon": {
|
|
41
|
+
"agent_registry_contract": "0x984cf72FDe8B5aA910e9e508aC5e007ae5BDcC9C",
|
|
42
|
+
"service_registry_contract": "0xE3607b00E75f6405248323A9417ff6b39B244b50",
|
|
43
|
+
"mech_marketplace_contract": "0x343F2B005cF6D70bA610CD9F1F1927049414B582",
|
|
44
|
+
"complementary_metadata_hash_address": "0xDC175E77d11246c79B23D7088750eb59160DD6b7",
|
|
45
|
+
"rpc_url": "https://polygon-bor-rpc.publicnode.com",
|
|
46
|
+
"wss_endpoint": "wss://polygon.gateway.tenderly.co",
|
|
47
|
+
"ledger_config": {
|
|
48
|
+
"address": "https://polygon-bor-rpc.publicnode.com",
|
|
49
|
+
"chain_id": 137,
|
|
50
|
+
"poa_chain": true,
|
|
51
|
+
"default_gas_price_strategy": "eip1559",
|
|
52
|
+
"is_gas_estimation_enabled": false
|
|
58
53
|
},
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
54
|
+
"gas_limit": 3000000,
|
|
55
|
+
"price": 10000,
|
|
56
|
+
"transaction_url": "https://polygonscan.com/tx/{transaction_digest}",
|
|
57
|
+
"subgraph_url": ""
|
|
58
|
+
},
|
|
59
|
+
"base": {
|
|
60
|
+
"agent_registry_contract": "0x88DE734655184a09B70700aE4F72364d1ad23728",
|
|
61
|
+
"service_registry_contract": "0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE",
|
|
62
|
+
"mech_marketplace_contract": "0xf24eE42edA0fc9b33B7D41B06Ee8ccD2Ef7C5020",
|
|
63
|
+
"complementary_metadata_hash_address": "0x28C1edC7CEd549F7f80B732fDC19f0370160707d",
|
|
64
|
+
"rpc_url": "https://base.llamarpc.com",
|
|
65
|
+
"wss_endpoint": "wss://base.gateway.tenderly.co",
|
|
66
|
+
"ledger_config": {
|
|
67
|
+
"address": "https://base.llamarpc.com",
|
|
68
|
+
"chain_id": 8453,
|
|
69
|
+
"poa_chain": false,
|
|
70
|
+
"default_gas_price_strategy": "eip1559",
|
|
71
|
+
"is_gas_estimation_enabled": false
|
|
77
72
|
},
|
|
78
|
-
"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
73
|
+
"gas_limit": 500000,
|
|
74
|
+
"price": 3000000000000,
|
|
75
|
+
"transaction_url": "https://basescan.org/tx/{transaction_digest}",
|
|
76
|
+
"subgraph_url": "https://api.studio.thegraph.com/query/89372/olas-base-mech-marketplace/v0.0.2"
|
|
77
|
+
},
|
|
78
|
+
"celo": {
|
|
79
|
+
"agent_registry_contract": "0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA",
|
|
80
|
+
"service_registry_contract": "0xE3607b00E75f6405248323A9417ff6b39B244b50",
|
|
81
|
+
"mech_marketplace_contract": "0x0000000000000000000000000000000000000000",
|
|
82
|
+
"complementary_metadata_hash_address": "0x0000000000000000000000000000000000000000",
|
|
83
|
+
"rpc_url": "https://forno.celo.org",
|
|
84
|
+
"wss_endpoint": "wss://forno.celo.org/ws",
|
|
85
|
+
"ledger_config": {
|
|
86
|
+
"address": "https://forno.celo.org",
|
|
87
|
+
"chain_id": 42220,
|
|
88
|
+
"poa_chain": true,
|
|
89
|
+
"default_gas_price_strategy": "eip1559",
|
|
90
|
+
"is_gas_estimation_enabled": false
|
|
96
91
|
},
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
92
|
+
"gas_limit": 250000,
|
|
93
|
+
"price": 10000000000000000,
|
|
94
|
+
"transaction_url": "https://celoscan.io/tx/{transaction_digest}",
|
|
95
|
+
"subgraph_url": ""
|
|
96
|
+
},
|
|
97
|
+
"optimism": {
|
|
98
|
+
"agent_registry_contract": "0x75D529FAe220bC8db714F0202193726b46881B76",
|
|
99
|
+
"service_registry_contract": "0x3d77596beb0f130a4415df3D2D8232B3d3D31e44",
|
|
100
|
+
"mech_marketplace_contract": "0x46C0D07F55d4F9B5Eed2Fc9680B5953e5fd7b461",
|
|
101
|
+
"complementary_metadata_hash_address": "0x11949cBC85d8793B360029E26b18ae759708e28b",
|
|
102
|
+
"rpc_url": "https://mainnet.optimism.io",
|
|
103
|
+
"wss_endpoint": "wss://optimism.gateway.tenderly.co",
|
|
104
|
+
"ledger_config": {
|
|
105
|
+
"address": "https://mainnet.optimism.io",
|
|
106
|
+
"chain_id": 10,
|
|
107
|
+
"poa_chain": false,
|
|
108
|
+
"default_gas_price_strategy": "eip1559",
|
|
109
|
+
"is_gas_estimation_enabled": false
|
|
110
|
+
},
|
|
111
|
+
"gas_limit": 100000,
|
|
112
|
+
"price": 3000000000000,
|
|
113
|
+
"transaction_url": "https://optimistic.etherscan.io/tx/{transaction_digest}",
|
|
114
|
+
"subgraph_url": ""
|
|
115
|
+
}
|
|
116
|
+
}
|
mech_client/interact.py
CHANGED
|
@@ -514,6 +514,7 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
514
514
|
tool: Optional[str] = None,
|
|
515
515
|
extra_attributes: Optional[Dict[str, Any]] = None,
|
|
516
516
|
private_key_path: Optional[str] = None,
|
|
517
|
+
private_key_password: Optional[str] = None,
|
|
517
518
|
confirmation_type: ConfirmationType = ConfirmationType.WAIT_FOR_BOTH,
|
|
518
519
|
retries: Optional[int] = None,
|
|
519
520
|
timeout: Optional[float] = None,
|
|
@@ -533,6 +534,8 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
533
534
|
:type extra_attributes: Optional[Dict[str, Any]]
|
|
534
535
|
:param private_key_path: The path to the private key file (optional).
|
|
535
536
|
:type private_key_path: Optional[str]
|
|
537
|
+
:param private_key_password: Password to decrypt the keystore (if encrypted).
|
|
538
|
+
:type private_key_password: Optional[str]
|
|
536
539
|
:param confirmation_type: The confirmation type for the interaction (default: ConfirmationType.WAIT_FOR_BOTH).
|
|
537
540
|
:type confirmation_type: ConfirmationType
|
|
538
541
|
:return: The data received from on-chain/off-chain.
|
|
@@ -562,7 +565,9 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
562
565
|
)
|
|
563
566
|
|
|
564
567
|
wss = websocket.create_connection(mech_config.wss_endpoint)
|
|
565
|
-
crypto = EthereumCrypto(
|
|
568
|
+
crypto = EthereumCrypto(
|
|
569
|
+
private_key_path=private_key_path, password=private_key_password
|
|
570
|
+
)
|
|
566
571
|
ledger_api = EthereumApi(**asdict(ledger_config))
|
|
567
572
|
|
|
568
573
|
tool = verify_or_retrieve_tool(
|