mech-client 0.11.0__tar.gz → 0.12.0__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.
Files changed (100) hide show
  1. {mech_client-0.11.0 → mech_client-0.12.0}/PKG-INFO +1 -1
  2. mech_client-0.12.0/mech_client/__init__.py +3 -0
  3. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/interact.py +2 -10
  4. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/subgraph.py +1 -79
  5. {mech_client-0.11.0 → mech_client-0.12.0}/pyproject.toml +1 -1
  6. mech_client-0.11.0/mech_client/__init__.py +0 -3
  7. {mech_client-0.11.0 → mech_client-0.12.0}/LICENSE +0 -0
  8. {mech_client-0.11.0 → mech_client-0.12.0}/README.md +0 -0
  9. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/AgentMech.json +0 -0
  10. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/AgentRegistry.json +0 -0
  11. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/AgreementStoreManager.base.json +0 -0
  12. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/AgreementStoreManager.gnosis.json +0 -0
  13. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/BalanceTrackerFixedPriceNative.json +0 -0
  14. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/BalanceTrackerFixedPriceToken.json +0 -0
  15. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/BalanceTrackerNvmSubscriptionNative.json +0 -0
  16. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/BalanceTrackerNvmSubscriptionToken.json +0 -0
  17. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/ComplementaryServiceMetadata.json +0 -0
  18. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/DIDRegistry.base.json +0 -0
  19. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/DIDRegistry.gnosis.json +0 -0
  20. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/EscrowPaymentCondition.base.json +0 -0
  21. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/EscrowPaymentCondition.gnosis.json +0 -0
  22. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/IERC1155.json +0 -0
  23. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/IMech.json +0 -0
  24. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/IToken.json +0 -0
  25. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/LockPaymentCondition.base.json +0 -0
  26. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/LockPaymentCondition.gnosis.json +0 -0
  27. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/MechMarketplace.json +0 -0
  28. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/NFTSalesTemplate.base.json +0 -0
  29. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/NFTSalesTemplate.gnosis.json +0 -0
  30. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/NeverminedConfig.base.json +0 -0
  31. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/NeverminedConfig.gnosis.json +0 -0
  32. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/SubscriptionNFT.base.json +0 -0
  33. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/SubscriptionNFT.gnosis.json +0 -0
  34. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/SubscriptionProvider.base.json +0 -0
  35. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/SubscriptionProvider.gnosis.json +0 -0
  36. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/SubscriptionToken.base.json +0 -0
  37. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/TransferNFTCondition.base.json +0 -0
  38. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/abis/TransferNFTCondition.gnosis.json +0 -0
  39. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/acn.py +0 -0
  40. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/cli.py +0 -0
  41. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/configs/mechs.json +0 -0
  42. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/fetch_ipfs_hash.py +0 -0
  43. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/__init__.py +0 -0
  44. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn/README.md +0 -0
  45. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn/__init__.py +0 -0
  46. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn/acn.proto +0 -0
  47. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn/acn_pb2.py +0 -0
  48. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn/custom_types.py +0 -0
  49. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn/dialogues.py +0 -0
  50. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn/message.py +0 -0
  51. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn/protocol.yaml +0 -0
  52. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn/serialization.py +0 -0
  53. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn/tests/__init__.py +0 -0
  54. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn/tests/test_acn.py +0 -0
  55. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn/tests/test_acn_dialogues.py +0 -0
  56. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn/tests/test_acn_messages.py +0 -0
  57. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn_data_share/README.md +0 -0
  58. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn_data_share/__init__.py +0 -0
  59. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn_data_share/acn_data_share.proto +0 -0
  60. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn_data_share/acn_data_share_pb2.py +0 -0
  61. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn_data_share/dialogues.py +0 -0
  62. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn_data_share/message.py +0 -0
  63. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn_data_share/protocol.yaml +0 -0
  64. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn_data_share/serialization.py +0 -0
  65. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn_data_share/tests/test_acn_data_share_dialogues.py +0 -0
  66. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/acn_data_share/tests/test_acn_data_share_messages.py +0 -0
  67. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/p2p_libp2p_client/README.md +0 -0
  68. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/p2p_libp2p_client/__init__.py +0 -0
  69. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/p2p_libp2p_client/connection.py +0 -0
  70. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/helpers/p2p_libp2p_client/connection.yaml +0 -0
  71. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/marketplace_interact.py +0 -0
  72. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/mech_marketplace_subgraph.py +0 -0
  73. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/mech_marketplace_tool_management.py +0 -0
  74. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/mech_tool_management.py +0 -0
  75. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/prompt_to_ipfs.py +0 -0
  76. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/push_to_ipfs.py +0 -0
  77. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/to_png.py +0 -0
  78. {mech_client-0.11.0 → mech_client-0.12.0}/mech_client/wss.py +0 -0
  79. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/__init__.py +0 -0
  80. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/benchmark.sh +0 -0
  81. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/bump.py +0 -0
  82. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/deposit_native.py +0 -0
  83. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/deposit_token.py +0 -0
  84. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/nvm_subscribe.py +0 -0
  85. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/nvm_subscription/contracts/agreement_manager.py +0 -0
  86. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/nvm_subscription/contracts/base_contract.py +0 -0
  87. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/nvm_subscription/contracts/did_registry.py +0 -0
  88. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/nvm_subscription/contracts/escrow_payment.py +0 -0
  89. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/nvm_subscription/contracts/lock_payment.py +0 -0
  90. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/nvm_subscription/contracts/nft.py +0 -0
  91. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/nvm_subscription/contracts/nft_sales.py +0 -0
  92. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/nvm_subscription/contracts/subscription_provider.py +0 -0
  93. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/nvm_subscription/contracts/token.py +0 -0
  94. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/nvm_subscription/contracts/transfer_nft.py +0 -0
  95. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/nvm_subscription/envs/base.env +0 -0
  96. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/nvm_subscription/envs/gnosis.env +0 -0
  97. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/nvm_subscription/manager.py +0 -0
  98. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/nvm_subscription/resources/networks.json +0 -0
  99. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/utils.py +0 -0
  100. {mech_client-0.11.0 → mech_client-0.12.0}/scripts/whitelist.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mech-client
3
- Version: 0.11.0
3
+ Version: 0.12.0
4
4
  Summary: Basic client to interact with a mech
5
5
  License: Apache-2.0
6
6
  Author: David Minarsch
@@ -0,0 +1,3 @@
1
+ """Mech client."""
2
+
3
+ __version__ = "0.12.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, watch_for_data_url_from_subgraph
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
- DELIVER_QUERY_TEMPLATE = Template(
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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "mech-client"
3
- version = "0.11.0"
3
+ version = "0.12.0"
4
4
  description = "Basic client to interact with a mech"
5
5
  authors = ["David Minarsch <david.minarsch@googlemail.com>"]
6
6
  readme = "README.md"
@@ -1,3 +0,0 @@
1
- """Mech client."""
2
-
3
- __version__ = "0.11.0"
File without changes
File without changes