mech-client 0.10.0__tar.gz → 0.11.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.10.0 → mech_client-0.11.0}/PKG-INFO +40 -13
  2. {mech_client-0.10.0 → mech_client-0.11.0}/README.md +39 -12
  3. mech_client-0.11.0/mech_client/__init__.py +3 -0
  4. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/cli.py +51 -0
  5. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/configs/mechs.json +2 -2
  6. mech_client-0.11.0/mech_client/mech_marketplace_subgraph.py +94 -0
  7. {mech_client-0.10.0 → mech_client-0.11.0}/pyproject.toml +1 -1
  8. mech_client-0.10.0/mech_client/__init__.py +0 -3
  9. {mech_client-0.10.0 → mech_client-0.11.0}/LICENSE +0 -0
  10. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/AgentMech.json +0 -0
  11. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/AgentRegistry.json +0 -0
  12. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/AgreementStoreManager.base.json +0 -0
  13. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/AgreementStoreManager.gnosis.json +0 -0
  14. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/BalanceTrackerFixedPriceNative.json +0 -0
  15. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/BalanceTrackerFixedPriceToken.json +0 -0
  16. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/BalanceTrackerNvmSubscriptionNative.json +0 -0
  17. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/BalanceTrackerNvmSubscriptionToken.json +0 -0
  18. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/ComplementaryServiceMetadata.json +0 -0
  19. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/DIDRegistry.base.json +0 -0
  20. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/DIDRegistry.gnosis.json +0 -0
  21. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/EscrowPaymentCondition.base.json +0 -0
  22. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/EscrowPaymentCondition.gnosis.json +0 -0
  23. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/IERC1155.json +0 -0
  24. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/IMech.json +0 -0
  25. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/IToken.json +0 -0
  26. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/LockPaymentCondition.base.json +0 -0
  27. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/LockPaymentCondition.gnosis.json +0 -0
  28. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/MechMarketplace.json +0 -0
  29. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/NFTSalesTemplate.base.json +0 -0
  30. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/NFTSalesTemplate.gnosis.json +0 -0
  31. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/NeverminedConfig.base.json +0 -0
  32. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/NeverminedConfig.gnosis.json +0 -0
  33. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/SubscriptionNFT.base.json +0 -0
  34. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/SubscriptionNFT.gnosis.json +0 -0
  35. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/SubscriptionProvider.base.json +0 -0
  36. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/SubscriptionProvider.gnosis.json +0 -0
  37. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/SubscriptionToken.base.json +0 -0
  38. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/TransferNFTCondition.base.json +0 -0
  39. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/abis/TransferNFTCondition.gnosis.json +0 -0
  40. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/acn.py +0 -0
  41. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/fetch_ipfs_hash.py +0 -0
  42. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/__init__.py +0 -0
  43. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn/README.md +0 -0
  44. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn/__init__.py +0 -0
  45. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn/acn.proto +0 -0
  46. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn/acn_pb2.py +0 -0
  47. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn/custom_types.py +0 -0
  48. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn/dialogues.py +0 -0
  49. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn/message.py +0 -0
  50. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn/protocol.yaml +0 -0
  51. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn/serialization.py +0 -0
  52. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn/tests/__init__.py +0 -0
  53. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn/tests/test_acn.py +0 -0
  54. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn/tests/test_acn_dialogues.py +0 -0
  55. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn/tests/test_acn_messages.py +0 -0
  56. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn_data_share/README.md +0 -0
  57. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn_data_share/__init__.py +0 -0
  58. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn_data_share/acn_data_share.proto +0 -0
  59. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn_data_share/acn_data_share_pb2.py +0 -0
  60. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn_data_share/dialogues.py +0 -0
  61. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn_data_share/message.py +0 -0
  62. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn_data_share/protocol.yaml +0 -0
  63. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn_data_share/serialization.py +0 -0
  64. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn_data_share/tests/test_acn_data_share_dialogues.py +0 -0
  65. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/acn_data_share/tests/test_acn_data_share_messages.py +0 -0
  66. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/p2p_libp2p_client/README.md +0 -0
  67. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/p2p_libp2p_client/__init__.py +0 -0
  68. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/p2p_libp2p_client/connection.py +0 -0
  69. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/helpers/p2p_libp2p_client/connection.yaml +0 -0
  70. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/interact.py +0 -0
  71. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/marketplace_interact.py +0 -0
  72. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/mech_marketplace_tool_management.py +0 -0
  73. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/mech_tool_management.py +0 -0
  74. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/prompt_to_ipfs.py +0 -0
  75. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/push_to_ipfs.py +0 -0
  76. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/subgraph.py +0 -0
  77. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/to_png.py +0 -0
  78. {mech_client-0.10.0 → mech_client-0.11.0}/mech_client/wss.py +0 -0
  79. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/__init__.py +0 -0
  80. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/benchmark.sh +0 -0
  81. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/bump.py +0 -0
  82. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/deposit_native.py +0 -0
  83. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/deposit_token.py +0 -0
  84. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/nvm_subscribe.py +0 -0
  85. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/nvm_subscription/contracts/agreement_manager.py +0 -0
  86. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/nvm_subscription/contracts/base_contract.py +0 -0
  87. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/nvm_subscription/contracts/did_registry.py +0 -0
  88. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/nvm_subscription/contracts/escrow_payment.py +0 -0
  89. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/nvm_subscription/contracts/lock_payment.py +0 -0
  90. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/nvm_subscription/contracts/nft.py +0 -0
  91. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/nvm_subscription/contracts/nft_sales.py +0 -0
  92. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/nvm_subscription/contracts/subscription_provider.py +0 -0
  93. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/nvm_subscription/contracts/token.py +0 -0
  94. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/nvm_subscription/contracts/transfer_nft.py +0 -0
  95. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/nvm_subscription/envs/base.env +0 -0
  96. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/nvm_subscription/envs/gnosis.env +0 -0
  97. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/nvm_subscription/manager.py +0 -0
  98. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/nvm_subscription/resources/networks.json +0 -0
  99. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/utils.py +0 -0
  100. {mech_client-0.10.0 → mech_client-0.11.0}/scripts/whitelist.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mech-client
3
- Version: 0.10.0
3
+ Version: 0.11.0
4
4
  Summary: Basic client to interact with a mech
5
5
  License: Apache-2.0
6
6
  Author: David Minarsch
@@ -32,6 +32,12 @@ A basic client to interact with an AI Mech. [AI Mechs](https://github.com/valory
32
32
 
33
33
  - Python >=3.10
34
34
 
35
+ ## Developing, running and deploying Mechs and Mech tools
36
+
37
+ The easiest way to create, run, deploy and test your own Mech and Mech tools is to follow the Mech and Mech tool docs [here](https://open-autonomy.docs.autonolas.tech/mech-tools-dev/). The [Mech tools dev repo](https://github.com/valory-xyz/mech-tools-dev) used in those docs greatly simplifies the development flow and dev experience.
38
+
39
+ Only continue reading this README if you know what you are doing and you are specifically interested in this repo.
40
+
35
41
  ## Installation
36
42
 
37
43
  Find the latest available release on [PyPi](https://pypi.org/project/mech-client/#description).
@@ -120,9 +126,9 @@ The EOA you use must have enough funds to pay for the Mech requests, or alternat
120
126
 
121
127
  In order to fetch on-chain data for Gnosis and Base, mech client requires an API key from a blockchain data provider. You can find them here for [GnosisScan](https://gnosisscan.io/) and [BaseScan](https://basescan.org/). Follow these steps to generate your API key if you are planning to use mech client for gnosis and base:
122
128
 
123
- 1. Sign up or log in
129
+ 1. Sign up or log in
124
130
  2. Go to API Dashboard on the left menu
125
- 3. Add a new API key
131
+ 3. Add a new API key
126
132
  4. Once generated copy your API key
127
133
 
128
134
  Once you have your API key, you'll need to configure it in your environment. Use the following command to set it for your environment.
@@ -135,7 +141,7 @@ export MECHX_API_KEY=<your api key>
135
141
 
136
142
  #### Select the mech you are going to send requests to
137
143
 
138
- Mechs can receive requests via the [Mech Marketplace](https://github.com/valory-xyz/ai-registry-mech/) or directly. We call the last ones _Legacy Mechs_.
144
+ Mechs can receive requests via the [Mech Marketplace](https://github.com/valory-xyz/ai-registry-mech/) or directly. We call the last ones _Legacy Mechs_.
139
145
  Mechs are deployed on several networks. Find the list of supported networks and corresponding mech addresses [here](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs). Additionally, you can find more available Mechs [here](https://mech.olas.network/) (click on the tab "Legacy Mech" in order to see Legacy Mech (available only on Gnosis) and "Mech Marketplace" for the ones which receive requests via the Mech Marketplace).
140
146
 
141
147
  #### Legacy Mechs
@@ -201,22 +207,22 @@ Data from agent: {'requestId': 1004074058566339663950817114309409628095686850319
201
207
 
202
208
  #### With the Mech Marketplace
203
209
 
204
- With the Mech Marketplace, in order to pay for the Mech fees, you can make a deposit before sending requests. The deposit depends on the
205
- payment model of the Mech. For a fixed price Mech receiving payments in native token, use the following:
210
+ With the Mech Marketplace, in order to pay for the Mech fees, you can make a deposit before sending requests. The deposit depends on the
211
+ payment model of the Mech. For a fixed price Mech receiving payments in native token, use the following:
206
212
 
207
213
  ```bash
208
214
  mechx deposit-native --chain-config <chain_config> <amount>
209
215
  ```
210
216
 
211
- For a fixed price Mech receiving payments in OLAS, use the following (the amount is in ether):
217
+ For a fixed price Mech receiving payments in OLAS, use the following (the amount is in ether):
212
218
 
213
219
  ```bash
214
220
  mechx deposit-token --chain-config <chain_config> <amount>
215
221
  ```
216
222
 
217
- For a Mech using Nevermined subscriptions, to make requests, it is necessary to buy a subscription. To do that you can use the following command:
223
+ For a Mech using Nevermined subscriptions, to make requests, it is necessary to buy a subscription. To do that you can use the following command:
218
224
 
219
- ```bash
225
+ ```bash
220
226
  mechx purchase-nvm-subscription --chain-config <chain_config>
221
227
  ```
222
228
 
@@ -244,11 +250,11 @@ export MECHX_MECH_OFFCHAIN_URL="http://localhost:8000/"
244
250
  If you want to use a Valory mech for offchain requests, below is the list of mechs and their address and offchain urls.
245
251
 
246
252
  | Service ID | Priority Mech Address | Offchain URL |
247
- | :---: | :---: | :---: |
253
+ | :---: | :---: | :---: |
248
254
  | 2182 | 0xB3C6319962484602b00d5587e965946890b82101 | https://d19715222af5b940.agent.propel.autonolas.tech/ |
249
255
 
250
256
 
251
- The Mech Client can also be used to send batch requests. There are couple of different ways to achieve this:
257
+ The Mech Client can also be used to send batch requests. There are couple of different ways to achieve this:
252
258
 
253
259
  ```bash
254
260
  mechx interact --prompts={<prompt-1>,<prompt-2>} --priority-mech <priority mech address> --tools={<tool-1>,<tool-2>} --chain-config <chain_config>
@@ -260,6 +266,27 @@ or <br>
260
266
  mechx interact --prompts <prompt-1> --prompts <prompt-2> --priority-mech <priority mech address> --tools <tool-1> --tools <tool-2> --chain-config <chain_config>
261
267
  ```
262
268
 
269
+ ### List marketplace mechs
270
+ To list the top marketplace mechs based on deliveries, use the `fetch-mm-mechs-info` command. You can specify the chain you want to query. Please note that only the first 20 mechs sorted by number of deliveries will be shown.
271
+ Currently supported chains are gnosis and base
272
+ ```bash
273
+ mechx fetch-mm-mechs-info --chain-config gnosis
274
+ ```
275
+ ```bash
276
+ +--------------+--------------------+--------------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------+
277
+ | Service Id | Mech Type | Mech Address | Total Deliveries | Metadata Link |
278
+ +==============+====================+============================================+====================+===============================================================================================================+
279
+ | 2182 | Fixed Price Native | 0xc05e7412439bd7e91730a6880e18d5d5873f632c | 41246 | https://gateway.autonolas.tech/ipfs/f01701220157d3b106831e2713b86af1b52af76a3ef28c52ae0853e9638180902ebee41d4 |
280
+ +--------------+--------------------+--------------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------+
281
+ | 2235 | Fixed Price Native | 0xb3c6319962484602b00d5587e965946890b82101 | 10127 | https://gateway.autonolas.tech/ipfs/f01701220157d3b106831e2713b86af1b52af76a3ef28c52ae0853e9638180902ebee41d4 |
282
+ +--------------+--------------------+--------------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------+
283
+ | 2198 | Fixed Price Native | 0x601024e27f1c67b28209e24272ced8a31fc8151f | 5714 | https://gateway.autonolas.tech/ipfs/f01701220157d3b106831e2713b86af1b52af76a3ef28c52ae0853e9638180902ebee41d4 |
284
+ +--------------+--------------------+--------------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------+
285
+ | 1722 | Fixed Price Token | 0x13f36b1a516290b7563b1de574a02ebeb48926a1 | 399 | https://gateway.autonolas.tech/ipfs/f01701220157d3b106831e2713b86af1b52af76a3ef28c52ae0853e9638180902ebee41d4 |
286
+ +--------------+--------------------+--------------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------+
287
+ | 2135 | Fixed Price Native | 0xbead38e4c4777341bb3fd44e8cd4d1ba1a7ad9d7 | 353 | https://gateway.autonolas.tech/ipfs/f01701220157d3b106831e2713b86af1b52af76a3ef28c52ae0853e9638180902ebee41d4 |
288
+ +--------------+--------------------+--------------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------+
289
+ ```
263
290
 
264
291
  ### List tools available for legacy mechs and marketplace mechs
265
292
 
@@ -287,7 +314,7 @@ You will see an output like this:
287
314
  ```bash
288
315
  mechx tools-for-agents --agent-id "agent_id"
289
316
  ```
290
- Eaxmple usage
317
+ Eaxmple usage
291
318
  ```bash
292
319
  mechx tools-for-agents --agent-id 6
293
320
  ```
@@ -545,7 +572,7 @@ This script will:
545
572
 
546
573
  #### For Mechs receiving requests via the Mech Marketplace
547
574
 
548
- In this case, the script is the same, except for the function result. When this function has no argument agent_id,
575
+ In this case, the script is the same, except for the function result. When this function has no argument agent_id,
549
576
  the request is sent to the Mech Marketplace. The target Mech to which the request is relayed should be in the chain_config file (key `priority_mech_address`).
550
577
 
551
578
  ## Developer installation
@@ -9,6 +9,12 @@ A basic client to interact with an AI Mech. [AI Mechs](https://github.com/valory
9
9
 
10
10
  - Python >=3.10
11
11
 
12
+ ## Developing, running and deploying Mechs and Mech tools
13
+
14
+ The easiest way to create, run, deploy and test your own Mech and Mech tools is to follow the Mech and Mech tool docs [here](https://open-autonomy.docs.autonolas.tech/mech-tools-dev/). The [Mech tools dev repo](https://github.com/valory-xyz/mech-tools-dev) used in those docs greatly simplifies the development flow and dev experience.
15
+
16
+ Only continue reading this README if you know what you are doing and you are specifically interested in this repo.
17
+
12
18
  ## Installation
13
19
 
14
20
  Find the latest available release on [PyPi](https://pypi.org/project/mech-client/#description).
@@ -97,9 +103,9 @@ The EOA you use must have enough funds to pay for the Mech requests, or alternat
97
103
 
98
104
  In order to fetch on-chain data for Gnosis and Base, mech client requires an API key from a blockchain data provider. You can find them here for [GnosisScan](https://gnosisscan.io/) and [BaseScan](https://basescan.org/). Follow these steps to generate your API key if you are planning to use mech client for gnosis and base:
99
105
 
100
- 1. Sign up or log in
106
+ 1. Sign up or log in
101
107
  2. Go to API Dashboard on the left menu
102
- 3. Add a new API key
108
+ 3. Add a new API key
103
109
  4. Once generated copy your API key
104
110
 
105
111
  Once you have your API key, you'll need to configure it in your environment. Use the following command to set it for your environment.
@@ -112,7 +118,7 @@ export MECHX_API_KEY=<your api key>
112
118
 
113
119
  #### Select the mech you are going to send requests to
114
120
 
115
- Mechs can receive requests via the [Mech Marketplace](https://github.com/valory-xyz/ai-registry-mech/) or directly. We call the last ones _Legacy Mechs_.
121
+ Mechs can receive requests via the [Mech Marketplace](https://github.com/valory-xyz/ai-registry-mech/) or directly. We call the last ones _Legacy Mechs_.
116
122
  Mechs are deployed on several networks. Find the list of supported networks and corresponding mech addresses [here](https://github.com/valory-xyz/mech?tab=readme-ov-file#examples-of-deployed-mechs). Additionally, you can find more available Mechs [here](https://mech.olas.network/) (click on the tab "Legacy Mech" in order to see Legacy Mech (available only on Gnosis) and "Mech Marketplace" for the ones which receive requests via the Mech Marketplace).
117
123
 
118
124
  #### Legacy Mechs
@@ -178,22 +184,22 @@ Data from agent: {'requestId': 1004074058566339663950817114309409628095686850319
178
184
 
179
185
  #### With the Mech Marketplace
180
186
 
181
- With the Mech Marketplace, in order to pay for the Mech fees, you can make a deposit before sending requests. The deposit depends on the
182
- payment model of the Mech. For a fixed price Mech receiving payments in native token, use the following:
187
+ With the Mech Marketplace, in order to pay for the Mech fees, you can make a deposit before sending requests. The deposit depends on the
188
+ payment model of the Mech. For a fixed price Mech receiving payments in native token, use the following:
183
189
 
184
190
  ```bash
185
191
  mechx deposit-native --chain-config <chain_config> <amount>
186
192
  ```
187
193
 
188
- For a fixed price Mech receiving payments in OLAS, use the following (the amount is in ether):
194
+ For a fixed price Mech receiving payments in OLAS, use the following (the amount is in ether):
189
195
 
190
196
  ```bash
191
197
  mechx deposit-token --chain-config <chain_config> <amount>
192
198
  ```
193
199
 
194
- For a Mech using Nevermined subscriptions, to make requests, it is necessary to buy a subscription. To do that you can use the following command:
200
+ For a Mech using Nevermined subscriptions, to make requests, it is necessary to buy a subscription. To do that you can use the following command:
195
201
 
196
- ```bash
202
+ ```bash
197
203
  mechx purchase-nvm-subscription --chain-config <chain_config>
198
204
  ```
199
205
 
@@ -221,11 +227,11 @@ export MECHX_MECH_OFFCHAIN_URL="http://localhost:8000/"
221
227
  If you want to use a Valory mech for offchain requests, below is the list of mechs and their address and offchain urls.
222
228
 
223
229
  | Service ID | Priority Mech Address | Offchain URL |
224
- | :---: | :---: | :---: |
230
+ | :---: | :---: | :---: |
225
231
  | 2182 | 0xB3C6319962484602b00d5587e965946890b82101 | https://d19715222af5b940.agent.propel.autonolas.tech/ |
226
232
 
227
233
 
228
- The Mech Client can also be used to send batch requests. There are couple of different ways to achieve this:
234
+ The Mech Client can also be used to send batch requests. There are couple of different ways to achieve this:
229
235
 
230
236
  ```bash
231
237
  mechx interact --prompts={<prompt-1>,<prompt-2>} --priority-mech <priority mech address> --tools={<tool-1>,<tool-2>} --chain-config <chain_config>
@@ -237,6 +243,27 @@ or <br>
237
243
  mechx interact --prompts <prompt-1> --prompts <prompt-2> --priority-mech <priority mech address> --tools <tool-1> --tools <tool-2> --chain-config <chain_config>
238
244
  ```
239
245
 
246
+ ### List marketplace mechs
247
+ To list the top marketplace mechs based on deliveries, use the `fetch-mm-mechs-info` command. You can specify the chain you want to query. Please note that only the first 20 mechs sorted by number of deliveries will be shown.
248
+ Currently supported chains are gnosis and base
249
+ ```bash
250
+ mechx fetch-mm-mechs-info --chain-config gnosis
251
+ ```
252
+ ```bash
253
+ +--------------+--------------------+--------------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------+
254
+ | Service Id | Mech Type | Mech Address | Total Deliveries | Metadata Link |
255
+ +==============+====================+============================================+====================+===============================================================================================================+
256
+ | 2182 | Fixed Price Native | 0xc05e7412439bd7e91730a6880e18d5d5873f632c | 41246 | https://gateway.autonolas.tech/ipfs/f01701220157d3b106831e2713b86af1b52af76a3ef28c52ae0853e9638180902ebee41d4 |
257
+ +--------------+--------------------+--------------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------+
258
+ | 2235 | Fixed Price Native | 0xb3c6319962484602b00d5587e965946890b82101 | 10127 | https://gateway.autonolas.tech/ipfs/f01701220157d3b106831e2713b86af1b52af76a3ef28c52ae0853e9638180902ebee41d4 |
259
+ +--------------+--------------------+--------------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------+
260
+ | 2198 | Fixed Price Native | 0x601024e27f1c67b28209e24272ced8a31fc8151f | 5714 | https://gateway.autonolas.tech/ipfs/f01701220157d3b106831e2713b86af1b52af76a3ef28c52ae0853e9638180902ebee41d4 |
261
+ +--------------+--------------------+--------------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------+
262
+ | 1722 | Fixed Price Token | 0x13f36b1a516290b7563b1de574a02ebeb48926a1 | 399 | https://gateway.autonolas.tech/ipfs/f01701220157d3b106831e2713b86af1b52af76a3ef28c52ae0853e9638180902ebee41d4 |
263
+ +--------------+--------------------+--------------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------+
264
+ | 2135 | Fixed Price Native | 0xbead38e4c4777341bb3fd44e8cd4d1ba1a7ad9d7 | 353 | https://gateway.autonolas.tech/ipfs/f01701220157d3b106831e2713b86af1b52af76a3ef28c52ae0853e9638180902ebee41d4 |
265
+ +--------------+--------------------+--------------------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------+
266
+ ```
240
267
 
241
268
  ### List tools available for legacy mechs and marketplace mechs
242
269
 
@@ -264,7 +291,7 @@ You will see an output like this:
264
291
  ```bash
265
292
  mechx tools-for-agents --agent-id "agent_id"
266
293
  ```
267
- Eaxmple usage
294
+ Eaxmple usage
268
295
  ```bash
269
296
  mechx tools-for-agents --agent-id 6
270
297
  ```
@@ -522,7 +549,7 @@ This script will:
522
549
 
523
550
  #### For Mechs receiving requests via the Mech Marketplace
524
551
 
525
- In this case, the script is the same, except for the function result. When this function has no argument agent_id,
552
+ In this case, the script is the same, except for the function result. When this function has no argument agent_id,
526
553
  the request is sent to the Mech Marketplace. The target Mech to which the request is relayed should be in the chain_config file (key `priority_mech_address`).
527
554
 
528
555
  ## Developer installation
@@ -0,0 +1,3 @@
1
+ """Mech client."""
2
+
3
+ __version__ = "0.11.0"
@@ -29,9 +29,11 @@ from tabulate import tabulate # type: ignore
29
29
  from mech_client import __version__
30
30
  from mech_client.interact import ConfirmationType
31
31
  from mech_client.interact import interact as interact_
32
+ from mech_client.marketplace_interact import IPFS_URL_TEMPLATE
32
33
  from mech_client.marketplace_interact import (
33
34
  marketplace_interact as marketplace_interact_,
34
35
  )
36
+ from mech_client.mech_marketplace_subgraph import query_mm_mechs_info
35
37
  from mech_client.mech_marketplace_tool_management import (
36
38
  extract_input_schema,
37
39
  extract_output_schema,
@@ -515,6 +517,54 @@ def nvm_subscribe(
515
517
  nvm_subscribe_main(private_key_path=key, chain_config=chain_config)
516
518
 
517
519
 
520
+ @click.command(name="fetch-mm-mechs-info")
521
+ @click.option(
522
+ "--chain-config",
523
+ type=str,
524
+ help="Id of the mech's chain configuration (stored configs/mechs.json)",
525
+ )
526
+ def query_mm_mechs_info_cli(
527
+ chain_config: str,
528
+ ) -> None:
529
+ """Fetches info of mm mechs"""
530
+ try:
531
+ mech_list = query_mm_mechs_info(chain_config=chain_config)
532
+ if mech_list is None:
533
+ print("No mechs found")
534
+ return None
535
+
536
+ headers = [
537
+ "Service Id",
538
+ "Mech Type",
539
+ "Mech Address",
540
+ "Total Deliveries",
541
+ "Metadata Link",
542
+ ]
543
+
544
+ data = [
545
+ (
546
+ items["service"]["id"],
547
+ items["mech_type"],
548
+ items["address"],
549
+ items["service"]["totalDeliveries"],
550
+ (
551
+ IPFS_URL_TEMPLATE.format(
552
+ items["service"]["metadata"]["metadata"][2:]
553
+ )
554
+ if items["service"].get("metadata") is not None
555
+ else None
556
+ ),
557
+ )
558
+ for items in mech_list
559
+ ]
560
+
561
+ click.echo(tabulate(data, headers=headers, tablefmt="grid"))
562
+ return None
563
+ except Exception as e: # pylint: disable=broad-except
564
+ click.echo(f"Error: {str(e)}")
565
+ return None
566
+
567
+
518
568
  cli.add_command(interact)
519
569
  cli.add_command(prompt_to_ipfs)
520
570
  cli.add_command(push_to_ipfs)
@@ -528,6 +578,7 @@ cli.add_command(tool_description_for_marketplace_mech)
528
578
  cli.add_command(deposit_native)
529
579
  cli.add_command(deposit_token)
530
580
  cli.add_command(nvm_subscribe)
581
+ cli.add_command(query_mm_mechs_info_cli)
531
582
 
532
583
 
533
584
  if __name__ == "__main__":
@@ -16,7 +16,7 @@
16
16
  "gas_limit": 500000,
17
17
  "price": 10000000000000000,
18
18
  "transaction_url": "https://gnosisscan.io/tx/{transaction_digest}",
19
- "subgraph_url": ""
19
+ "subgraph_url": "https://api.studio.thegraph.com/query/89372/olas-gnosis-mech-marketplace/v0.0.2"
20
20
  },
21
21
  "arbitrum": {
22
22
  "agent_registry_contract": "0xa4799B083E0068732456EF45ff9fe5c683658327",
@@ -73,7 +73,7 @@
73
73
  "gas_limit": 500000,
74
74
  "price": 3000000000000,
75
75
  "transaction_url": "https://basescan.org/tx/{transaction_digest}",
76
- "subgraph_url": ""
76
+ "subgraph_url": "https://api.studio.thegraph.com/query/89372/olas-base-mech-marketplace/v0.0.2"
77
77
  },
78
78
  "celo": {
79
79
  "agent_registry_contract": "0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA",
@@ -0,0 +1,94 @@
1
+ # -*- coding: utf-8 -*-
2
+ # ------------------------------------------------------------------------------
3
+ #
4
+ # Copyright 2025 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
+
20
+ """Subgraph client for mech."""
21
+
22
+ from typing import List, Optional
23
+
24
+ from gql import Client, gql
25
+ from gql.transport.aiohttp import AIOHTTPTransport
26
+
27
+ from mech_client.interact import get_mech_config
28
+
29
+
30
+ RESULTS_LIMIT = 20
31
+ CHAIN_TO_MECH_FACTORY_TO_MECH_TYPE = {
32
+ "gnosis": {
33
+ "0x8b299c20F87e3fcBfF0e1B86dC0acC06AB6993EF": "Fixed Price Native",
34
+ "0x31ffDC795FDF36696B8eDF7583A3D115995a45FA": "Fixed Price Token",
35
+ "0x65fd74C29463afe08c879a3020323DD7DF02DA57": "NvmSubscription Native",
36
+ },
37
+ "base": {
38
+ "0x2E008211f34b25A7d7c102403c6C2C3B665a1abe": "Fixed Price Native",
39
+ "0x97371B1C0cDA1D04dFc43DFb50a04645b7Bc9BEe": "Fixed Price Token",
40
+ "0x847bBE8b474e0820215f818858e23F5f5591855A": "NvmSubscription Native",
41
+ "0x7beD01f8482fF686F025628e7780ca6C1f0559fc": "NvmSubscription Token USDC",
42
+ },
43
+ }
44
+
45
+
46
+ MM_MECHS_INFO_QUERY = """
47
+ query MechsOrderedByServiceDeliveries {
48
+ meches(orderBy: service__totalDeliveries, orderDirection: desc) {
49
+ address
50
+ mechFactory
51
+ service {
52
+ id
53
+ totalDeliveries
54
+ metadata {
55
+ metadata
56
+ }
57
+ }
58
+ }
59
+ }
60
+ """
61
+
62
+ DEFAULT_TIMEOUT = 600.0
63
+
64
+
65
+ def query_mm_mechs_info(chain_config: str) -> Optional[List]:
66
+ """
67
+ Query MM mechs and related info from subgraph.
68
+
69
+ :param chain_config: Id of the mech's chain configuration (stored configs/mechs.json)
70
+ :type chain_config: str
71
+ :return: The return list of data if found, None otherwise.
72
+ :rtype: Optional[List]
73
+ """
74
+ mech_config = get_mech_config(chain_config)
75
+ if not mech_config.subgraph_url:
76
+ raise Exception(f"Subgraph URL not set for chain config: {chain_config}")
77
+
78
+ client = Client(
79
+ transport=AIOHTTPTransport(url=mech_config.subgraph_url),
80
+ execute_timeout=DEFAULT_TIMEOUT,
81
+ )
82
+ response = client.execute(document=gql(request_string=MM_MECHS_INFO_QUERY))
83
+
84
+ mech_factory_to_mech_type = {
85
+ k.lower(): v
86
+ for k, v in CHAIN_TO_MECH_FACTORY_TO_MECH_TYPE[chain_config].items()
87
+ }
88
+ filtered_mechs_data = []
89
+ for item in response["meches"]: # pylint: disable=unsubscriptable-object
90
+ if item.get("service") and int(item["service"]["totalDeliveries"]) > 0:
91
+ item["mech_type"] = mech_factory_to_mech_type[item["mechFactory"].lower()]
92
+ filtered_mechs_data.append(item)
93
+
94
+ return filtered_mechs_data[:RESULTS_LIMIT]
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "mech-client"
3
- version = "0.10.0"
3
+ version = "0.11.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.10.0"
File without changes