mech-client 0.11.0__tar.gz → 0.12.1__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.
- {mech_client-0.11.0 → mech_client-0.12.1}/PKG-INFO +1 -1
- mech_client-0.12.1/mech_client/__init__.py +3 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/interact.py +2 -10
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/subgraph.py +1 -79
- {mech_client-0.11.0 → mech_client-0.12.1}/pyproject.toml +1 -1
- mech_client-0.11.0/mech_client/__init__.py +0 -3
- {mech_client-0.11.0 → mech_client-0.12.1}/LICENSE +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/README.md +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/AgentMech.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/AgentRegistry.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/AgreementStoreManager.base.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/AgreementStoreManager.gnosis.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/BalanceTrackerFixedPriceNative.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/BalanceTrackerFixedPriceToken.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/BalanceTrackerNvmSubscriptionNative.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/BalanceTrackerNvmSubscriptionToken.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/ComplementaryServiceMetadata.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/DIDRegistry.base.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/DIDRegistry.gnosis.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/EscrowPaymentCondition.base.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/EscrowPaymentCondition.gnosis.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/IERC1155.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/IMech.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/IToken.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/LockPaymentCondition.base.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/LockPaymentCondition.gnosis.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/MechMarketplace.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/NFTSalesTemplate.base.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/NFTSalesTemplate.gnosis.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/NeverminedConfig.base.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/NeverminedConfig.gnosis.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/SubscriptionNFT.base.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/SubscriptionNFT.gnosis.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/SubscriptionProvider.base.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/SubscriptionProvider.gnosis.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/SubscriptionToken.base.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/TransferNFTCondition.base.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/TransferNFTCondition.gnosis.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/acn.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/cli.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/configs/mechs.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/fetch_ipfs_hash.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/__init__.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn/README.md +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn/__init__.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn/acn.proto +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn/acn_pb2.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn/custom_types.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn/dialogues.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn/message.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn/protocol.yaml +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn/serialization.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn/tests/__init__.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn/tests/test_acn.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn/tests/test_acn_dialogues.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn/tests/test_acn_messages.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn_data_share/README.md +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn_data_share/__init__.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn_data_share/acn_data_share.proto +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn_data_share/acn_data_share_pb2.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn_data_share/dialogues.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn_data_share/message.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn_data_share/protocol.yaml +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn_data_share/serialization.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn_data_share/tests/test_acn_data_share_dialogues.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn_data_share/tests/test_acn_data_share_messages.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/p2p_libp2p_client/README.md +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/p2p_libp2p_client/__init__.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/p2p_libp2p_client/connection.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/p2p_libp2p_client/connection.yaml +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/marketplace_interact.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/mech_marketplace_subgraph.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/mech_marketplace_tool_management.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/mech_tool_management.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/prompt_to_ipfs.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/push_to_ipfs.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/to_png.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/mech_client/wss.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/__init__.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/benchmark.sh +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/bump.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/deposit_native.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/deposit_token.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscribe.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/contracts/agreement_manager.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/contracts/base_contract.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/contracts/did_registry.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/contracts/escrow_payment.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/contracts/lock_payment.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/contracts/nft.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/contracts/nft_sales.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/contracts/subscription_provider.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/contracts/token.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/contracts/transfer_nft.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/envs/base.env +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/envs/gnosis.env +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/manager.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/resources/networks.json +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/utils.py +0 -0
- {mech_client-0.11.0 → mech_client-0.12.1}/scripts/whitelist.py +0 -0
|
@@ -45,7 +45,7 @@ from web3.contract import Contract as Web3Contract
|
|
|
45
45
|
|
|
46
46
|
from mech_client.acn import watch_for_data_url_from_mech
|
|
47
47
|
from mech_client.prompt_to_ipfs import push_metadata_to_ipfs
|
|
48
|
-
from mech_client.subgraph import query_agent_address
|
|
48
|
+
from mech_client.subgraph import query_agent_address
|
|
49
49
|
from mech_client.wss import (
|
|
50
50
|
register_event_handlers,
|
|
51
51
|
watch_for_data_url_from_wss,
|
|
@@ -433,7 +433,7 @@ def send_request( # pylint: disable=too-many-arguments,too-many-locals
|
|
|
433
433
|
return None
|
|
434
434
|
|
|
435
435
|
|
|
436
|
-
def wait_for_data_url( # pylint: disable=too-many-arguments
|
|
436
|
+
def wait_for_data_url( # pylint: disable=too-many-arguments, unused-argument
|
|
437
437
|
request_id: str,
|
|
438
438
|
wss: websocket.WebSocket,
|
|
439
439
|
mech_contract: Web3Contract,
|
|
@@ -492,14 +492,6 @@ def wait_for_data_url( # pylint: disable=too-many-arguments
|
|
|
492
492
|
)
|
|
493
493
|
tasks.append(on_chain_task)
|
|
494
494
|
|
|
495
|
-
if subgraph_url:
|
|
496
|
-
mech_task = loop.create_task(
|
|
497
|
-
watch_for_data_url_from_subgraph(
|
|
498
|
-
request_id=request_id, url=subgraph_url
|
|
499
|
-
)
|
|
500
|
-
)
|
|
501
|
-
tasks.append(mech_task)
|
|
502
|
-
|
|
503
495
|
async def _wait_for_tasks() -> Any: # type: ignore
|
|
504
496
|
"""Wait for tasks to finish."""
|
|
505
497
|
(finished, *_), unfinished = await asyncio.wait(
|
|
@@ -19,13 +19,9 @@
|
|
|
19
19
|
|
|
20
20
|
"""Subgraph client for mech."""
|
|
21
21
|
|
|
22
|
-
import asyncio
|
|
23
22
|
from string import Template
|
|
24
23
|
from typing import Optional
|
|
25
24
|
|
|
26
|
-
from gql import Client, gql
|
|
27
|
-
from gql.transport.aiohttp import AIOHTTPTransport
|
|
28
|
-
|
|
29
25
|
|
|
30
26
|
AGENT_QUERY_TEMPLATE = Template(
|
|
31
27
|
"""{
|
|
@@ -35,18 +31,7 @@ AGENT_QUERY_TEMPLATE = Template(
|
|
|
35
31
|
}
|
|
36
32
|
"""
|
|
37
33
|
)
|
|
38
|
-
|
|
39
|
-
"""{
|
|
40
|
-
delivers(
|
|
41
|
-
orderBy: blockTimestamp
|
|
42
|
-
where: {requestId:"$request_id"}
|
|
43
|
-
orderDirection: desc
|
|
44
|
-
) {
|
|
45
|
-
ipfsHash
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
"""
|
|
49
|
-
)
|
|
34
|
+
|
|
50
35
|
DEFAULT_TIMEOUT = 600.0
|
|
51
36
|
CHAIN_TO_ADDRESSES = {
|
|
52
37
|
"gnosis": {
|
|
@@ -85,66 +70,3 @@ def query_agent_address( # pylint: disable=too-many-return-statements
|
|
|
85
70
|
if not chain_config:
|
|
86
71
|
raise ValueError("Chain config not specified")
|
|
87
72
|
return CHAIN_TO_ADDRESSES.get(chain_config, {}).get(agent_id, None)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
async def query_deliver_hash(
|
|
91
|
-
request_id: str, url: str, timeout: Optional[float] = None
|
|
92
|
-
) -> Optional[str]:
|
|
93
|
-
"""
|
|
94
|
-
Query deliver IPFS hash from subgraph.
|
|
95
|
-
|
|
96
|
-
:param request_id: The ID of the mech request.
|
|
97
|
-
:type request_id: str
|
|
98
|
-
:param url: Subgraph URL.
|
|
99
|
-
:type url: str
|
|
100
|
-
:param timeout: Timeout for the request.
|
|
101
|
-
:type timeout: Optional[float]
|
|
102
|
-
:return: The deliver IPFS hash if found, None otherwise.
|
|
103
|
-
:rtype: Optional[str]
|
|
104
|
-
"""
|
|
105
|
-
client = Client(
|
|
106
|
-
transport=AIOHTTPTransport(url=url),
|
|
107
|
-
execute_timeout=timeout or 30.0,
|
|
108
|
-
)
|
|
109
|
-
response = await client.execute_async(
|
|
110
|
-
document=gql(
|
|
111
|
-
request_string=DELIVER_QUERY_TEMPLATE.substitute({"request_id": request_id})
|
|
112
|
-
)
|
|
113
|
-
)
|
|
114
|
-
delivers = response["delivers"] # pylint: disable=unsubscriptable-object
|
|
115
|
-
if len(delivers) == 0:
|
|
116
|
-
return None
|
|
117
|
-
|
|
118
|
-
(record,) = delivers
|
|
119
|
-
return record["ipfsHash"]
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
async def watch_for_data_url_from_subgraph(
|
|
123
|
-
request_id: str, url: str, timeout: Optional[float] = None
|
|
124
|
-
) -> Optional[str]:
|
|
125
|
-
"""
|
|
126
|
-
Continuously query for data URL until it's available or timeout is reached.
|
|
127
|
-
|
|
128
|
-
:param request_id: The ID of the mech request.
|
|
129
|
-
:type request_id: str
|
|
130
|
-
:param url: Subgraph URL.
|
|
131
|
-
:type url: str
|
|
132
|
-
:param timeout: Maximum time to wait for the data URL in seconds. Defaults to DEFAULT_TIMEOUT.
|
|
133
|
-
:type timeout: Optional[float]
|
|
134
|
-
:return: Data URL if available within timeout, otherwise None.
|
|
135
|
-
:rtype: Optional[str]
|
|
136
|
-
"""
|
|
137
|
-
timeout = timeout or DEFAULT_TIMEOUT
|
|
138
|
-
start_time = asyncio.get_event_loop().time()
|
|
139
|
-
while True:
|
|
140
|
-
response = await query_deliver_hash(request_id=request_id, url=url)
|
|
141
|
-
if response is not None:
|
|
142
|
-
return f"https://gateway.autonolas.tech/ipfs/{response}"
|
|
143
|
-
|
|
144
|
-
if asyncio.get_event_loop().time() - start_time >= timeout:
|
|
145
|
-
print(f"Error: No response received after {timeout} seconds.")
|
|
146
|
-
break
|
|
147
|
-
|
|
148
|
-
await asyncio.sleep(5)
|
|
149
|
-
|
|
150
|
-
return None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/AgreementStoreManager.gnosis.json
RENAMED
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/BalanceTrackerFixedPriceNative.json
RENAMED
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/BalanceTrackerFixedPriceToken.json
RENAMED
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/BalanceTrackerNvmSubscriptionNative.json
RENAMED
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/BalanceTrackerNvmSubscriptionToken.json
RENAMED
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/ComplementaryServiceMetadata.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/mech_client/abis/EscrowPaymentCondition.gnosis.json
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
|
{mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn/tests/test_acn_dialogues.py
RENAMED
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn/tests/test_acn_messages.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn_data_share/acn_data_share.proto
RENAMED
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn_data_share/acn_data_share_pb2.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/acn_data_share/serialization.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/p2p_libp2p_client/connection.py
RENAMED
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/mech_client/helpers/p2p_libp2p_client/connection.yaml
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
|
{mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/contracts/agreement_manager.py
RENAMED
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/contracts/base_contract.py
RENAMED
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/contracts/did_registry.py
RENAMED
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/contracts/escrow_payment.py
RENAMED
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/contracts/lock_payment.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mech_client-0.11.0 → mech_client-0.12.1}/scripts/nvm_subscription/contracts/transfer_nft.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|