mech-client 0.14.0__py3-none-any.whl → 0.15.0__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 +257 -11
- mech_client/configs/mechs.json +110 -110
- mech_client/interact.py +6 -1
- mech_client/marketplace_interact.py +161 -43
- mech_client/safe.py +73 -0
- mech_client/subgraph.py +0 -11
- {mech_client-0.14.0.dist-info → mech_client-0.15.0.dist-info}/METADATA +264 -219
- {mech_client-0.14.0.dist-info → mech_client-0.15.0.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 +9 -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.0.dist-info → mech_client-0.15.0.dist-info}/LICENSE +0 -0
- {mech_client-0.14.0.dist-info → mech_client-0.15.0.dist-info}/WHEEL +0 -0
- {mech_client-0.14.0.dist-info → mech_client-0.15.0.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,177 @@ 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
|
+
set_key(str(ENV_PATH), "OPERATE_PASSWORD", os.environ["OPERATE_PASSWORD"])
|
|
118
|
+
os.environ["ATTENDED"] = "false"
|
|
119
|
+
return os.environ["OPERATE_PASSWORD"]
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def mech_client_configure_local_config(
|
|
123
|
+
template: ServiceTemplate, operate: "OperateApp"
|
|
124
|
+
) -> QuickstartConfig:
|
|
125
|
+
"""Configure local quickstart configuration."""
|
|
126
|
+
config = load_local_config(operate=operate, service_name=template["name"])
|
|
127
|
+
|
|
128
|
+
if config.rpc is None:
|
|
129
|
+
config.rpc = {}
|
|
130
|
+
|
|
131
|
+
for chain in template["configurations"]:
|
|
132
|
+
config.rpc[chain] = os.getenv("MECHX_RPC_URL")
|
|
133
|
+
|
|
134
|
+
config.principal_chain = template["home_chain"]
|
|
135
|
+
|
|
136
|
+
# set chain configs in the service template
|
|
137
|
+
for chain in template["configurations"]:
|
|
138
|
+
template["configurations"][chain] |= {
|
|
139
|
+
"staking_program_id": NO_STAKING_PROGRAM_ID,
|
|
140
|
+
"rpc": config.rpc[chain],
|
|
141
|
+
"cost_of_bond": 1,
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if config.user_provided_args is None:
|
|
145
|
+
config.user_provided_args = {}
|
|
146
|
+
|
|
147
|
+
config.store()
|
|
148
|
+
return config
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def fetch_agent_mode_data(
|
|
152
|
+
chain_config: Optional[str],
|
|
153
|
+
) -> Tuple[str, str, Optional[str]]:
|
|
154
|
+
"""Fetches the agent mode data of safe address and the keystore path plus password"""
|
|
155
|
+
chain_config = chain_config or DEFAULT_NETWORK
|
|
156
|
+
|
|
157
|
+
# This is acceptable way to as the main functionality
|
|
158
|
+
# of keys manager is to allow access to the required data.
|
|
159
|
+
operate_path = get_operate_path()
|
|
160
|
+
operate = OperateApp(operate_path)
|
|
161
|
+
# Ensure the password is loaded so keys can be decrypted.
|
|
162
|
+
get_password(operate)
|
|
163
|
+
keys_manager = KeysManager(
|
|
164
|
+
path=operate._keys, # pylint: disable=protected-access
|
|
165
|
+
logger=operate_logger,
|
|
166
|
+
password=operate.password,
|
|
167
|
+
)
|
|
168
|
+
service_manager = operate.service_manager()
|
|
169
|
+
service_config_id = None
|
|
170
|
+
for service in service_manager.json:
|
|
171
|
+
if service["home_chain"] == chain_config:
|
|
172
|
+
service_config_id = service["service_config_id"]
|
|
173
|
+
break
|
|
174
|
+
|
|
175
|
+
if not service_config_id:
|
|
176
|
+
raise ClickException(
|
|
177
|
+
f"""Cannot find deployed service id for chain {chain_config}. Setup agent mode for a chain using mechx setup-agent-mode cli command."""
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
service = operate.service_manager().load(service_config_id)
|
|
181
|
+
|
|
182
|
+
key_path = keys_manager.get_private_key_file(service.agent_addresses[0])
|
|
183
|
+
safe = service.chain_configs[chain_config].chain_data.multisig
|
|
184
|
+
|
|
185
|
+
return safe, str(key_path), os.getenv("OPERATE_PASSWORD")
|
|
186
|
+
|
|
187
|
+
|
|
61
188
|
@click.group(name="mechx") # type: ignore
|
|
62
189
|
@click.version_option(__version__, prog_name="mechx")
|
|
63
|
-
|
|
190
|
+
@click.option(
|
|
191
|
+
"--client-mode",
|
|
192
|
+
is_flag=True,
|
|
193
|
+
help="Enables client mode",
|
|
194
|
+
)
|
|
195
|
+
@click.pass_context
|
|
196
|
+
def cli(ctx: click.Context, client_mode: bool) -> None:
|
|
64
197
|
"""Command-line tool for interacting with mechs."""
|
|
198
|
+
ctx.ensure_object(dict)
|
|
199
|
+
ctx.obj["client_mode"] = client_mode
|
|
200
|
+
|
|
201
|
+
cli_command = ctx.invoked_subcommand if ctx.invoked_subcommand else None
|
|
202
|
+
is_setup_called = cli_command == SETUP_MODE_COMMAND
|
|
203
|
+
|
|
204
|
+
if not is_setup_called and not client_mode:
|
|
205
|
+
click.echo("Agent mode enabled")
|
|
206
|
+
operate_path = get_operate_path()
|
|
207
|
+
if not operate_path.exists():
|
|
208
|
+
raise ClickException(
|
|
209
|
+
f"""Operate path does not exists at: {operate_path}. Setup agent mode for a chain using mechx setup-agent-mode cli command."""
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
@click.command()
|
|
214
|
+
@click.option(
|
|
215
|
+
"--chain-config",
|
|
216
|
+
type=str,
|
|
217
|
+
help="Id of the mech's chain configuration (stored configs/mechs.json)",
|
|
218
|
+
)
|
|
219
|
+
def setup_agent_mode(
|
|
220
|
+
chain_config: str,
|
|
221
|
+
) -> None:
|
|
222
|
+
"""Sets up the agent mode for users"""
|
|
223
|
+
template = CHAIN_TO_TEMPLATE.get(chain_config)
|
|
224
|
+
if template is None:
|
|
225
|
+
supported_chains = list(CHAIN_TO_TEMPLATE.keys())
|
|
226
|
+
raise ClickException(
|
|
227
|
+
f"""{chain_config} chain not supported for agent mode. Supported chains are: {supported_chains}"""
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
operate_path = get_operate_path()
|
|
231
|
+
operate = OperateApp(operate_path)
|
|
232
|
+
operate.setup()
|
|
233
|
+
get_password(operate)
|
|
234
|
+
|
|
235
|
+
sys.modules[
|
|
236
|
+
"operate.quickstart.run_service"
|
|
237
|
+
].configure_local_config = mech_client_configure_local_config # type: ignore
|
|
238
|
+
|
|
239
|
+
print(f"Setting up agent mode using config at {template}...")
|
|
240
|
+
run_service(
|
|
241
|
+
operate=operate,
|
|
242
|
+
config_path=template,
|
|
243
|
+
build_only=True,
|
|
244
|
+
skip_dependency_check=False,
|
|
245
|
+
)
|
|
65
246
|
|
|
66
247
|
|
|
67
248
|
@click.command()
|
|
@@ -133,14 +314,16 @@ def cli() -> None:
|
|
|
133
314
|
type=str,
|
|
134
315
|
help="Id of the mech's chain configuration (stored configs/mechs.json)",
|
|
135
316
|
)
|
|
317
|
+
@click.pass_context
|
|
136
318
|
def interact( # pylint: disable=too-many-arguments,too-many-locals
|
|
319
|
+
ctx: click.Context,
|
|
137
320
|
prompts: tuple,
|
|
138
321
|
agent_id: int,
|
|
139
322
|
priority_mech: str,
|
|
140
323
|
use_prepaid: bool,
|
|
141
324
|
use_offchain: bool,
|
|
142
|
-
key: Optional[str],
|
|
143
325
|
tools: Optional[tuple],
|
|
326
|
+
safe: Optional[str] = None,
|
|
144
327
|
extra_attribute: Optional[List[str]] = None,
|
|
145
328
|
confirm: Optional[str] = None,
|
|
146
329
|
retries: Optional[int] = None,
|
|
@@ -150,6 +333,11 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
150
333
|
) -> None:
|
|
151
334
|
"""Interact with a mech specifying a prompt and tool."""
|
|
152
335
|
try:
|
|
336
|
+
agent_mode = is_agent_mode(ctx)
|
|
337
|
+
click.echo(f"Running interact with agent_mode={agent_mode}")
|
|
338
|
+
key_path: Optional[str] = None
|
|
339
|
+
key_password: Optional[str] = None
|
|
340
|
+
|
|
153
341
|
extra_attributes_dict: Dict[str, Any] = {}
|
|
154
342
|
if extra_attribute:
|
|
155
343
|
for pair in extra_attribute:
|
|
@@ -171,13 +359,23 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
171
359
|
f"The number of prompts ({len(prompts)}) must match the number of tools ({len(tools)})"
|
|
172
360
|
)
|
|
173
361
|
|
|
362
|
+
if agent_mode:
|
|
363
|
+
safe, key_path, key_password = fetch_agent_mode_data(chain_config)
|
|
364
|
+
if not safe or not key_path:
|
|
365
|
+
raise ClickException(
|
|
366
|
+
"Cannot fetch safe or key data for the agent mode."
|
|
367
|
+
)
|
|
368
|
+
|
|
174
369
|
marketplace_interact_(
|
|
175
370
|
prompts=prompts,
|
|
176
371
|
priority_mech=priority_mech,
|
|
372
|
+
agent_mode=agent_mode,
|
|
373
|
+
safe_address=safe,
|
|
177
374
|
use_prepaid=use_prepaid,
|
|
178
375
|
use_offchain=use_offchain,
|
|
179
376
|
mech_offchain_url=mech_offchain_url,
|
|
180
|
-
private_key_path=
|
|
377
|
+
private_key_path=key_path,
|
|
378
|
+
private_key_password=key_password,
|
|
181
379
|
tools=tools,
|
|
182
380
|
extra_attributes=extra_attributes_dict,
|
|
183
381
|
retries=retries,
|
|
@@ -205,7 +403,8 @@ def interact( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
205
403
|
interact_(
|
|
206
404
|
prompt=prompts[0],
|
|
207
405
|
agent_id=agent_id,
|
|
208
|
-
private_key_path=
|
|
406
|
+
private_key_path=key_path,
|
|
407
|
+
private_key_password=key_password,
|
|
209
408
|
tool=tools[0] if tools else None,
|
|
210
409
|
extra_attributes=extra_attributes_dict,
|
|
211
410
|
confirmation_type=(
|
|
@@ -459,14 +658,29 @@ def tool_io_schema_for_marketplace_mech(tool_id: str, chain_config: str) -> None
|
|
|
459
658
|
type=click.Path(exists=True, file_okay=True, dir_okay=False),
|
|
460
659
|
help="Path to private key to use for deposit",
|
|
461
660
|
)
|
|
661
|
+
@click.pass_context
|
|
462
662
|
def deposit_native(
|
|
663
|
+
ctx: click.Context,
|
|
463
664
|
amount_to_deposit: str,
|
|
464
|
-
|
|
665
|
+
safe: Optional[str] = None,
|
|
465
666
|
chain_config: Optional[str] = None,
|
|
466
667
|
) -> None:
|
|
467
668
|
"""Deposits Native balance for prepaid requests."""
|
|
669
|
+
agent_mode = is_agent_mode(ctx)
|
|
670
|
+
click.echo(f"Running deposit native with agent_mode={agent_mode}")
|
|
671
|
+
|
|
672
|
+
if agent_mode:
|
|
673
|
+
safe, key_path, key_password = fetch_agent_mode_data(chain_config)
|
|
674
|
+
if not safe or not key_path:
|
|
675
|
+
raise ClickException("Cannot fetch safe or key data for the agent mode.")
|
|
676
|
+
|
|
468
677
|
deposit_native_main(
|
|
469
|
-
|
|
678
|
+
agent_mode=agent_mode,
|
|
679
|
+
safe_address=safe,
|
|
680
|
+
amount=amount_to_deposit,
|
|
681
|
+
private_key_path=key_path,
|
|
682
|
+
private_key_password=key_password,
|
|
683
|
+
chain_config=chain_config,
|
|
470
684
|
)
|
|
471
685
|
|
|
472
686
|
|
|
@@ -482,14 +696,29 @@ def deposit_native(
|
|
|
482
696
|
type=click.Path(exists=True, file_okay=True, dir_okay=False),
|
|
483
697
|
help="Path to private key to use for deposit",
|
|
484
698
|
)
|
|
699
|
+
@click.pass_context
|
|
485
700
|
def deposit_token(
|
|
701
|
+
ctx: click.Context,
|
|
486
702
|
amount_to_deposit: str,
|
|
487
|
-
|
|
703
|
+
safe: Optional[str] = None,
|
|
488
704
|
chain_config: Optional[str] = None,
|
|
489
705
|
) -> None:
|
|
490
706
|
"""Deposits Token balance for prepaid requests."""
|
|
707
|
+
agent_mode = is_agent_mode(ctx)
|
|
708
|
+
click.echo(f"Running deposit token with agent_mode={agent_mode}")
|
|
709
|
+
|
|
710
|
+
if agent_mode:
|
|
711
|
+
safe, key_path, key_password = fetch_agent_mode_data(chain_config)
|
|
712
|
+
if not safe or not key_path:
|
|
713
|
+
raise ClickException("Cannot fetch safe or key data for the agent mode.")
|
|
714
|
+
|
|
491
715
|
deposit_token_main(
|
|
492
|
-
|
|
716
|
+
agent_mode=agent_mode,
|
|
717
|
+
safe_address=safe,
|
|
718
|
+
amount=amount_to_deposit,
|
|
719
|
+
private_key_path=key_path,
|
|
720
|
+
private_key_password=key_password,
|
|
721
|
+
chain_config=chain_config,
|
|
493
722
|
)
|
|
494
723
|
|
|
495
724
|
|
|
@@ -504,12 +733,28 @@ def deposit_token(
|
|
|
504
733
|
type=click.Path(exists=True, file_okay=True, dir_okay=False),
|
|
505
734
|
help="Path to private key to use for deposit",
|
|
506
735
|
)
|
|
736
|
+
@click.pass_context
|
|
507
737
|
def nvm_subscribe(
|
|
508
|
-
|
|
738
|
+
ctx: click.Context,
|
|
509
739
|
chain_config: str,
|
|
740
|
+
safe: Optional[str] = None,
|
|
510
741
|
) -> None:
|
|
511
742
|
"""Allows to purchase nvm subscription for nvm mech requests."""
|
|
512
|
-
|
|
743
|
+
agent_mode = is_agent_mode(ctx)
|
|
744
|
+
click.echo(f"Running purchase nvm subscription with agent_mode={agent_mode}")
|
|
745
|
+
|
|
746
|
+
if agent_mode:
|
|
747
|
+
safe, key_path, key_password = fetch_agent_mode_data(chain_config)
|
|
748
|
+
if not safe or not key_path:
|
|
749
|
+
raise ClickException("Cannot fetch safe or key data for the agent mode.")
|
|
750
|
+
|
|
751
|
+
nvm_subscribe_main(
|
|
752
|
+
agent_mode=agent_mode,
|
|
753
|
+
safe_address=safe,
|
|
754
|
+
private_key_path=key_path,
|
|
755
|
+
private_key_password=key_password,
|
|
756
|
+
chain_config=chain_config,
|
|
757
|
+
)
|
|
513
758
|
|
|
514
759
|
|
|
515
760
|
@click.command(name="fetch-mm-mechs-info")
|
|
@@ -560,6 +805,7 @@ def query_mm_mechs_info_cli(
|
|
|
560
805
|
return None
|
|
561
806
|
|
|
562
807
|
|
|
808
|
+
cli.add_command(setup_agent_mode)
|
|
563
809
|
cli.add_command(interact)
|
|
564
810
|
cli.add_command(prompt_to_ipfs)
|
|
565
811
|
cli.add_command(push_to_ipfs)
|
|
@@ -577,4 +823,4 @@ cli.add_command(query_mm_mechs_info_cli)
|
|
|
577
823
|
|
|
578
824
|
|
|
579
825
|
if __name__ == "__main__":
|
|
580
|
-
cli()
|
|
826
|
+
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(
|