olas-operate-middleware 0.6.2__tar.gz → 0.6.3__tar.gz
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.
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/PKG-INFO +3 -3
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/cli.py +44 -0
- olas_operate_middleware-0.6.3/operate/quickstart/reset_configs.py +109 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/quickstart/run_service.py +0 -4
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/quickstart/utils.py +6 -2
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/manage.py +10 -7
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/service.py +10 -2
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/utils/mech.py +6 -4
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/pyproject.toml +3 -3
- olas_operate_middleware-0.6.2/operate/data/contracts/service_staking_token/contract.yaml +0 -23
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/LICENSE +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/README.md +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/account/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/account/user.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/bridge/bridge.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/bridge/providers/bridge_provider.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/bridge/providers/lifi_bridge_provider.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/bridge/providers/native_bridge_provider.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/constants.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/README.md +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/dual_staking_token/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/dual_staking_token/build/DualStakingToken.json +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/dual_staking_token/contract.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/dual_staking_token/contract.yaml +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/foreign_omnibridge/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/foreign_omnibridge/build/ForeignOmnibridge.json +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/foreign_omnibridge/contract.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/foreign_omnibridge/contract.yaml +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/home_omnibridge/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/home_omnibridge/build/HomeOmnibridge.json +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/home_omnibridge/contract.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/home_omnibridge/contract.yaml +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/l1_standard_bridge/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/l1_standard_bridge/build/L1StandardBridge.json +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/l1_standard_bridge/contract.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/l1_standard_bridge/contract.yaml +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/l2_standard_bridge/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/l2_standard_bridge/build/L2StandardBridge.json +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/l2_standard_bridge/contract.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/l2_standard_bridge/contract.yaml +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/mech_activity/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/mech_activity/build/MechActivity.json +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/mech_activity/contract.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/mech_activity/contract.yaml +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/optimism_mintable_erc20/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/optimism_mintable_erc20/build/OptimismMintableERC20.json +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/optimism_mintable_erc20/contract.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/optimism_mintable_erc20/contract.yaml +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/requester_activity_checker/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/requester_activity_checker/build/RequesterActivityChecker.json +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/requester_activity_checker/contract.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/requester_activity_checker/contract.yaml +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/staking_token/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/staking_token/build/StakingToken.json +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/staking_token/contract.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/staking_token/contract.yaml +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/uniswap_v2_erc20/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/uniswap_v2_erc20/build/IUniswapV2ERC20.json +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/uniswap_v2_erc20/contract.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/uniswap_v2_erc20/contract.yaml +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/uniswap_v2_erc20/tests/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/uniswap_v2_erc20/tests/test_contract.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/keys.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/ledger/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/ledger/profiles.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/migration.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/operate_http/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/operate_http/exceptions.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/operate_types.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/pearl.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/quickstart/analyse_logs.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/quickstart/claim_staking_rewards.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/quickstart/reset_password.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/quickstart/reset_staking.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/quickstart/stop_service.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/quickstart/terminate_on_chain_service.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/resource.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/agent_runner.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/deployment_runner.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/health_checker.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/protocol.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/utils/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/utils/tendermint.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/utils/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/utils/gnosis.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/wallet/__init__.py +0 -0
- {olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/wallet/master.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: olas-operate-middleware
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.3
|
|
4
4
|
Summary:
|
|
5
5
|
Author: David Vilela
|
|
6
6
|
Author-email: dvilelaf@gmail.com
|
|
@@ -23,7 +23,7 @@ Requires-Dist: eth-keys (==0.4.0)
|
|
|
23
23
|
Requires-Dist: eth-rlp (==0.3.0)
|
|
24
24
|
Requires-Dist: eth-typing (==3.5.2)
|
|
25
25
|
Requires-Dist: eth-utils (==2.3.1)
|
|
26
|
-
Requires-Dist: fastapi (==0.110.
|
|
26
|
+
Requires-Dist: fastapi (==0.110.3)
|
|
27
27
|
Requires-Dist: frozenlist (==1.4.1)
|
|
28
28
|
Requires-Dist: halo (==0.0.31)
|
|
29
29
|
Requires-Dist: hexbytes (==0.3.1)
|
|
@@ -38,7 +38,7 @@ Requires-Dist: open-autonomy (>=0.19.11,<0.20.0)
|
|
|
38
38
|
Requires-Dist: psutil (>=5.9.8,<6.0.0)
|
|
39
39
|
Requires-Dist: pyinstaller (>=6.8.0,<7.0.0)
|
|
40
40
|
Requires-Dist: requests-toolbelt (==1.0.0)
|
|
41
|
-
Requires-Dist: starlette (==0.
|
|
41
|
+
Requires-Dist: starlette (==0.37.2)
|
|
42
42
|
Requires-Dist: twikit (==2.2.0)
|
|
43
43
|
Requires-Dist: uvicorn (==0.27.0)
|
|
44
44
|
Requires-Dist: web3 (==6.1.0)
|
|
@@ -56,6 +56,7 @@ from operate.migration import MigrationManager
|
|
|
56
56
|
from operate.operate_types import Chain, DeploymentStatus, LedgerType
|
|
57
57
|
from operate.quickstart.analyse_logs import analyse_logs
|
|
58
58
|
from operate.quickstart.claim_staking_rewards import claim_staking_rewards
|
|
59
|
+
from operate.quickstart.reset_configs import reset_configs
|
|
59
60
|
from operate.quickstart.reset_password import reset_password
|
|
60
61
|
from operate.quickstart.reset_staking import reset_staking
|
|
61
62
|
from operate.quickstart.run_service import run_service
|
|
@@ -537,6 +538,35 @@ def create_app( # pylint: disable=too-many-locals, unused-argument, too-many-st
|
|
|
537
538
|
wallet, mnemonic = manager.create(ledger_type=ledger_type)
|
|
538
539
|
return JSONResponse(content={"wallet": wallet.json, "mnemonic": mnemonic})
|
|
539
540
|
|
|
541
|
+
@app.post("/api/wallet/private_key")
|
|
542
|
+
@with_retries
|
|
543
|
+
async def _get_private_key(request: Request) -> t.List[t.Dict]:
|
|
544
|
+
"""Get Master EOA private key."""
|
|
545
|
+
if operate.user_account is None:
|
|
546
|
+
return JSONResponse(
|
|
547
|
+
content={
|
|
548
|
+
"error": "Cannot retrieve private key; User account does not exist!"
|
|
549
|
+
},
|
|
550
|
+
status_code=HTTPStatus.BAD_REQUEST,
|
|
551
|
+
)
|
|
552
|
+
|
|
553
|
+
data = await request.json()
|
|
554
|
+
password = data.get("password")
|
|
555
|
+
error = None
|
|
556
|
+
if operate.password is None:
|
|
557
|
+
error = {"error": "You need to login before retrieving the private key"}
|
|
558
|
+
if operate.password != password:
|
|
559
|
+
error = {"error": "Password is not valid"}
|
|
560
|
+
if error is not None:
|
|
561
|
+
return JSONResponse(
|
|
562
|
+
content=error,
|
|
563
|
+
status_code=HTTPStatus.UNAUTHORIZED,
|
|
564
|
+
)
|
|
565
|
+
|
|
566
|
+
ledger_type = data.get("ledger_type", LedgerType.ETHEREUM.value)
|
|
567
|
+
wallet = operate.wallet_manager.load(ledger_type=LedgerType(ledger_type))
|
|
568
|
+
return JSONResponse(content={"private_key": wallet.crypto.private_key})
|
|
569
|
+
|
|
540
570
|
@app.get("/api/extended/wallet")
|
|
541
571
|
@with_retries
|
|
542
572
|
async def _get_wallet_safe(request: Request) -> t.List[t.Dict]:
|
|
@@ -1145,6 +1175,20 @@ def qs_claim(
|
|
|
1145
1175
|
claim_staking_rewards(operate=operate, config_path=config)
|
|
1146
1176
|
|
|
1147
1177
|
|
|
1178
|
+
@_operate.command(name="reset-configs")
|
|
1179
|
+
def qs_reset_configs(
|
|
1180
|
+
config: Annotated[str, params.String(help="Quickstart config file path")],
|
|
1181
|
+
attended: Annotated[
|
|
1182
|
+
str, params.String(help="Run in attended/unattended mode (default: true")
|
|
1183
|
+
] = "true",
|
|
1184
|
+
) -> None:
|
|
1185
|
+
"""Reset configs."""
|
|
1186
|
+
os.environ["ATTENDED"] = attended.lower()
|
|
1187
|
+
operate = OperateApp()
|
|
1188
|
+
operate.setup()
|
|
1189
|
+
reset_configs(operate=operate, config_path=config)
|
|
1190
|
+
|
|
1191
|
+
|
|
1148
1192
|
@_operate.command(name="reset-staking")
|
|
1149
1193
|
def qs_reset_staking(
|
|
1150
1194
|
config: Annotated[str, params.String(help="Quickstart config file path")],
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# ------------------------------------------------------------------------------
|
|
3
|
+
#
|
|
4
|
+
# Copyright 2023-2024 Valory AG
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#
|
|
18
|
+
# ------------------------------------------------------------------------------
|
|
19
|
+
"""Reset configurations."""
|
|
20
|
+
|
|
21
|
+
import json
|
|
22
|
+
from typing import Callable, Optional, TYPE_CHECKING, cast
|
|
23
|
+
|
|
24
|
+
from operate.quickstart.run_service import load_local_config
|
|
25
|
+
from operate.quickstart.utils import (
|
|
26
|
+
ask_or_get_from_env,
|
|
27
|
+
ask_yes_or_no,
|
|
28
|
+
check_rpc,
|
|
29
|
+
print_section,
|
|
30
|
+
print_title,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
if TYPE_CHECKING:
|
|
35
|
+
from operate.cli import OperateApp
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _ask_to_change(
|
|
39
|
+
name: str,
|
|
40
|
+
env_var: str,
|
|
41
|
+
old_value: str,
|
|
42
|
+
hidden: bool = False,
|
|
43
|
+
validator: Callable[[Optional[str]], bool] = lambda x: False if x is None else True,
|
|
44
|
+
) -> str:
|
|
45
|
+
"""Ask user if they want to change a configuration value."""
|
|
46
|
+
old_value_str = old_value
|
|
47
|
+
if hidden:
|
|
48
|
+
if len(old_value_str) < 4:
|
|
49
|
+
old_value_str = "*" * len(old_value_str)
|
|
50
|
+
else:
|
|
51
|
+
old_value_str = "*" * len(old_value_str[:-4]) + old_value_str[-4:]
|
|
52
|
+
|
|
53
|
+
print(f"\nCurrent '{name}' is set to: {old_value_str}")
|
|
54
|
+
if ask_yes_or_no(f"Do you want to change the '{name}'?"):
|
|
55
|
+
new_value = None
|
|
56
|
+
while not validator(new_value):
|
|
57
|
+
new_value = ask_or_get_from_env(
|
|
58
|
+
prompt=f"Enter new value for '{name}' {'[hidden]' if hidden else ''}: ",
|
|
59
|
+
env_var_name=env_var,
|
|
60
|
+
is_pass=hidden,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
return str(new_value)
|
|
64
|
+
|
|
65
|
+
return old_value
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def reset_configs(operate: "OperateApp", config_path: str) -> None:
|
|
69
|
+
"""Reset configurations."""
|
|
70
|
+
with open(config_path, "r") as config_file:
|
|
71
|
+
template = json.load(config_file)
|
|
72
|
+
|
|
73
|
+
operate.service_manager().migrate_service_configs()
|
|
74
|
+
operate.wallet_manager.migrate_wallet_configs()
|
|
75
|
+
|
|
76
|
+
print_title(f"Reset your {template['name']} configurations")
|
|
77
|
+
|
|
78
|
+
# check if agent was started before
|
|
79
|
+
config = load_local_config(
|
|
80
|
+
operate=operate, service_name=cast(str, template["name"])
|
|
81
|
+
)
|
|
82
|
+
if not config.path.exists():
|
|
83
|
+
print("No previous agent setup found. Exiting.")
|
|
84
|
+
return
|
|
85
|
+
|
|
86
|
+
if config.rpc is None:
|
|
87
|
+
config.rpc = {}
|
|
88
|
+
|
|
89
|
+
for chain_name in config.rpc:
|
|
90
|
+
config.rpc[chain_name] = _ask_to_change(
|
|
91
|
+
name=f"{chain_name.capitalize()} RPC URL",
|
|
92
|
+
env_var=f"{chain_name.upper()}_LEDGER_RPC",
|
|
93
|
+
old_value=config.rpc[chain_name],
|
|
94
|
+
hidden=True,
|
|
95
|
+
validator=check_rpc,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
if config.user_provided_args is None:
|
|
99
|
+
config.user_provided_args = {}
|
|
100
|
+
|
|
101
|
+
for env_var in config.user_provided_args:
|
|
102
|
+
config.user_provided_args[env_var] = _ask_to_change(
|
|
103
|
+
name=env_var,
|
|
104
|
+
env_var=env_var,
|
|
105
|
+
old_value=config.user_provided_args[env_var],
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
config.store()
|
|
109
|
+
print_section("Configurations updated")
|
{olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/quickstart/run_service.py
RENAMED
|
@@ -99,8 +99,6 @@ QS_STAKING_PROGRAMS: t.Dict[Chain, t.Dict[str, str]] = {
|
|
|
99
99
|
"quickstart_beta_mech_marketplace_expert_8": "trader",
|
|
100
100
|
"mech_marketplace": "mech",
|
|
101
101
|
"marketplace_supply_alpha": "mech",
|
|
102
|
-
"marketplace_demand_alpha_1": "mech",
|
|
103
|
-
"marketplace_demand_alpha_2": "mech",
|
|
104
102
|
},
|
|
105
103
|
Chain.OPTIMISTIC: {
|
|
106
104
|
"optimus_alpha_2": "optimus",
|
|
@@ -111,8 +109,6 @@ QS_STAKING_PROGRAMS: t.Dict[Chain, t.Dict[str, str]] = {
|
|
|
111
109
|
Chain.BASE: {
|
|
112
110
|
"meme_base_alpha_2": "memeooorr",
|
|
113
111
|
"marketplace_supply_alpha": "mech",
|
|
114
|
-
"marketplace_demand_alpha_1": "mech",
|
|
115
|
-
"marketplace_demand_alpha_2": "mech",
|
|
116
112
|
"agents_fun_1": "memeooorr",
|
|
117
113
|
"agents_fun_2": "memeooorr",
|
|
118
114
|
"agents_fun_3": "memeooorr",
|
|
@@ -188,8 +188,12 @@ def ask_yes_or_no(question: str) -> bool:
|
|
|
188
188
|
"""Ask a yes/no question."""
|
|
189
189
|
if os.environ.get("ATTENDED", "true").lower() != "true":
|
|
190
190
|
return True
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
while True:
|
|
192
|
+
response = input(f"{question} (yes/no): ").strip().lower()
|
|
193
|
+
if response.lower() in ("yes", "y"):
|
|
194
|
+
return True
|
|
195
|
+
if response.lower() in ("no", "n"):
|
|
196
|
+
return False
|
|
193
197
|
|
|
194
198
|
|
|
195
199
|
def ask_or_get_from_env(
|
|
@@ -106,6 +106,9 @@ HTTP_OK = 200
|
|
|
106
106
|
URI_HASH_POSITION = 7
|
|
107
107
|
IPFS_GATEWAY = "https://gateway.autonolas.tech/ipfs/"
|
|
108
108
|
DEFAULT_TOPUP_THRESHOLD = 0.5
|
|
109
|
+
# At the moment, we only support running one agent per service locally on a machine.
|
|
110
|
+
# If multiple agents are provided in the service.yaml file, only the 0th index config will be used.
|
|
111
|
+
NUM_LOCAL_AGENT_INSTANCES = 1
|
|
109
112
|
|
|
110
113
|
|
|
111
114
|
class ServiceManager:
|
|
@@ -227,7 +230,7 @@ class ServiceManager:
|
|
|
227
230
|
if not service.keys:
|
|
228
231
|
service.keys = [
|
|
229
232
|
self.keys_manager.get(self.keys_manager.create())
|
|
230
|
-
for _ in range(
|
|
233
|
+
for _ in range(NUM_LOCAL_AGENT_INSTANCES)
|
|
231
234
|
]
|
|
232
235
|
service.store()
|
|
233
236
|
|
|
@@ -267,7 +270,7 @@ class ServiceManager:
|
|
|
267
270
|
if not service.keys:
|
|
268
271
|
service.keys = [
|
|
269
272
|
self.keys_manager.get(self.keys_manager.create())
|
|
270
|
-
for _ in range(
|
|
273
|
+
for _ in range(NUM_LOCAL_AGENT_INSTANCES)
|
|
271
274
|
]
|
|
272
275
|
service.store()
|
|
273
276
|
|
|
@@ -437,7 +440,7 @@ class ServiceManager:
|
|
|
437
440
|
ocm.mint(
|
|
438
441
|
package_path=service.package_absolute_path_absolute_path,
|
|
439
442
|
agent_id=staking_params["agent_ids"][0],
|
|
440
|
-
number_of_slots=
|
|
443
|
+
number_of_slots=NUM_LOCAL_AGENT_INSTANCES,
|
|
441
444
|
cost_of_bond=(
|
|
442
445
|
staking_params["min_staking_deposit"]
|
|
443
446
|
if user_params.use_staking
|
|
@@ -709,7 +712,7 @@ class ServiceManager:
|
|
|
709
712
|
)
|
|
710
713
|
protocol_asset_requirements[target_staking_params["staking_token"]] = (
|
|
711
714
|
target_staking_params["min_staking_deposit"]
|
|
712
|
-
*
|
|
715
|
+
* NUM_LOCAL_AGENT_INSTANCES
|
|
713
716
|
)
|
|
714
717
|
else:
|
|
715
718
|
protocol_asset_requirements = {}
|
|
@@ -791,7 +794,7 @@ class ServiceManager:
|
|
|
791
794
|
sftxb.get_mint_tx_data(
|
|
792
795
|
package_path=service.package_absolute_path,
|
|
793
796
|
agent_id=agent_id,
|
|
794
|
-
number_of_slots=
|
|
797
|
+
number_of_slots=NUM_LOCAL_AGENT_INSTANCES,
|
|
795
798
|
cost_of_bond=(
|
|
796
799
|
target_staking_params["min_staking_deposit"]
|
|
797
800
|
if user_params.use_staking
|
|
@@ -841,7 +844,7 @@ class ServiceManager:
|
|
|
841
844
|
sftxb.get_mint_tx_data(
|
|
842
845
|
package_path=service.package_absolute_path,
|
|
843
846
|
agent_id=agent_id,
|
|
844
|
-
number_of_slots=
|
|
847
|
+
number_of_slots=NUM_LOCAL_AGENT_INSTANCES,
|
|
845
848
|
cost_of_bond=(
|
|
846
849
|
target_staking_params["min_staking_deposit"]
|
|
847
850
|
if user_params.use_staking
|
|
@@ -2504,7 +2507,7 @@ class ServiceManager:
|
|
|
2504
2507
|
chain_config = service.chain_configs[chain]
|
|
2505
2508
|
user_params = chain_config.chain_data.user_params
|
|
2506
2509
|
ledger_config = chain_config.ledger_config
|
|
2507
|
-
number_of_agents =
|
|
2510
|
+
number_of_agents = NUM_LOCAL_AGENT_INSTANCES
|
|
2508
2511
|
os.environ["CUSTOM_CHAIN_RPC"] = ledger_config.rpc
|
|
2509
2512
|
sftxb = self.get_eth_safe_tx_builder(ledger_config=ledger_config)
|
|
2510
2513
|
service_asset_requirements: defaultdict = defaultdict(int)
|
|
@@ -320,13 +320,19 @@ class HostDeploymentGenerator(BaseDeploymentGenerator):
|
|
|
320
320
|
tendermint_executable = str(
|
|
321
321
|
Path(os.path.dirname(sys.executable)) / "tendermint"
|
|
322
322
|
)
|
|
323
|
-
|
|
323
|
+
|
|
324
324
|
if platform.system() == "Windows":
|
|
325
325
|
env["PATH"] = os.path.dirname(sys.executable) + ";" + os.environ["PATH"]
|
|
326
326
|
tendermint_executable = str(
|
|
327
327
|
Path(os.path.dirname(sys.executable)) / "tendermint.exe"
|
|
328
328
|
)
|
|
329
|
-
|
|
329
|
+
|
|
330
|
+
if not (getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS")):
|
|
331
|
+
# we dont run inside pyinstaller, mean DEV mode!
|
|
332
|
+
tendermint_executable = "tendermint"
|
|
333
|
+
if platform.system() == "Windows":
|
|
334
|
+
tendermint_executable = "tendermint.exe"
|
|
335
|
+
|
|
330
336
|
subprocess.run( # pylint: disable=subprocess-run-check # nosec
|
|
331
337
|
args=[
|
|
332
338
|
tendermint_executable,
|
|
@@ -1251,6 +1257,8 @@ class Service(LocalResource):
|
|
|
1251
1257
|
config # type: ignore
|
|
1252
1258
|
)
|
|
1253
1259
|
|
|
1260
|
+
self.chain_configs[chain].ledger_config.rpc = config["rpc"]
|
|
1261
|
+
|
|
1254
1262
|
self.store()
|
|
1255
1263
|
|
|
1256
1264
|
def consume_env_variables(self) -> None:
|
{olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/utils/mech.py
RENAMED
|
@@ -26,7 +26,7 @@ from aea_ledger_ethereum import Web3
|
|
|
26
26
|
|
|
27
27
|
from operate.constants import MECH_MARKETPLACE_JSON_URL
|
|
28
28
|
from operate.operate_types import Chain
|
|
29
|
-
from operate.quickstart.utils import print_section
|
|
29
|
+
from operate.quickstart.utils import print_section
|
|
30
30
|
from operate.services.protocol import EthSafeTxBuilder
|
|
31
31
|
from operate.services.service import Service
|
|
32
32
|
from operate.utils.gnosis import SafeOperation
|
|
@@ -74,9 +74,11 @@ def deploy_mech(sftxb: EthSafeTxBuilder, service: Service) -> Tuple[str, str]:
|
|
|
74
74
|
mech_type
|
|
75
75
|
]
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
mech_request_price = int(
|
|
78
|
+
service.env_variables.get("MECH_REQUEST_PRICE", {}).get(
|
|
79
|
+
"value", 10000000000000000
|
|
80
|
+
)
|
|
81
|
+
)
|
|
80
82
|
contract = sftxb.ledger_api.api.eth.contract(
|
|
81
83
|
address=Web3.to_checksum_address(mech_marketplace_address), abi=abi
|
|
82
84
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "olas-operate-middleware"
|
|
3
|
-
version = "0.6.
|
|
3
|
+
version = "0.6.3"
|
|
4
4
|
description = ""
|
|
5
5
|
authors = ["David Vilela <dvilelaf@gmail.com>", "Viraj Patel <vptl185@gmail.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -27,7 +27,7 @@ open-aea-cli-ipfs = "==1.65.0"
|
|
|
27
27
|
clea = "==0.1.0rc4"
|
|
28
28
|
cytoolz = "==0.12.3"
|
|
29
29
|
docker = "6.1.2"
|
|
30
|
-
fastapi = "
|
|
30
|
+
fastapi = "0.110.3"
|
|
31
31
|
eth-hash = "==0.7.0"
|
|
32
32
|
eth-account = "==0.8.0"
|
|
33
33
|
eth-keyfile = "==0.6.1"
|
|
@@ -42,7 +42,7 @@ ipfshttpclient = "==0.8.0a2"
|
|
|
42
42
|
jsonschema = "==4.3.3"
|
|
43
43
|
multidict = "==6.0.5"
|
|
44
44
|
requests-toolbelt = "1.0.0"
|
|
45
|
-
starlette = "
|
|
45
|
+
starlette = "0.37.2"
|
|
46
46
|
uvicorn = "==0.27.0"
|
|
47
47
|
web3 = "==6.1.0"
|
|
48
48
|
psutil = "^5.9.8"
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
name: service_staking_token
|
|
2
|
-
author: valory
|
|
3
|
-
version: 0.1.0
|
|
4
|
-
type: contract
|
|
5
|
-
description: Service staking token contract
|
|
6
|
-
license: Apache-2.0
|
|
7
|
-
aea_version: '>=1.0.0, <2.0.0'
|
|
8
|
-
fingerprint:
|
|
9
|
-
__init__.py: bafybeid3wfzglolebuo6jrrsopswzu4lk77bm76mvw3euizlsjtnt3wmgu
|
|
10
|
-
build/ServiceStakingToken.json: bafybeiclsckyk2kkuwhrmifupugg7ixj2hpwhd3mjghwgcdlrjqbwafwym
|
|
11
|
-
contract.py: bafybeiff62bquzeisbd6iptqdjetrhlkt2ut5d7j6md2kqinrqgmbveceu
|
|
12
|
-
fingerprint_ignore_patterns: []
|
|
13
|
-
contracts: []
|
|
14
|
-
class_name: ServiceStakingTokenContract
|
|
15
|
-
contract_interface_paths:
|
|
16
|
-
ethereum: build/ServiceStakingToken.json
|
|
17
|
-
dependencies:
|
|
18
|
-
open-aea-ledger-ethereum:
|
|
19
|
-
version: ==1.42.0
|
|
20
|
-
open-aea-test-autonomy:
|
|
21
|
-
version: ==0.13.6
|
|
22
|
-
web3:
|
|
23
|
-
version: <7,>=6.0.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/data/contracts/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/operate_http/__init__.py
RENAMED
|
File without changes
|
{olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/operate_http/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/quickstart/analyse_logs.py
RENAMED
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/quickstart/reset_password.py
RENAMED
|
File without changes
|
{olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/quickstart/reset_staking.py
RENAMED
|
File without changes
|
{olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/quickstart/stop_service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/__init__.py
RENAMED
|
File without changes
|
{olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/agent_runner.py
RENAMED
|
File without changes
|
|
File without changes
|
{olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/health_checker.py
RENAMED
|
File without changes
|
{olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/protocol.py
RENAMED
|
File without changes
|
{olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/utils/__init__.py
RENAMED
|
File without changes
|
{olas_operate_middleware-0.6.2 → olas_operate_middleware-0.6.3}/operate/services/utils/tendermint.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|