mech-client 0.6.0__py3-none-any.whl → 0.8.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,294 @@
1
+ {
2
+ "name": "SubscriptionProvider",
3
+ "abi": [
4
+ {
5
+ "inputs": [
6
+ {
7
+ "internalType": "address",
8
+ "name": "_didRegistry",
9
+ "type": "address"
10
+ },
11
+ {
12
+ "internalType": "address",
13
+ "name": "_transferNFTCondition",
14
+ "type": "address"
15
+ },
16
+ {
17
+ "internalType": "address",
18
+ "name": "_escrowPaymentCondition",
19
+ "type": "address"
20
+ }
21
+ ],
22
+ "stateMutability": "nonpayable",
23
+ "type": "constructor"
24
+ },
25
+ {
26
+ "inputs": [
27
+ {
28
+ "internalType": "address",
29
+ "name": "sender",
30
+ "type": "address"
31
+ },
32
+ {
33
+ "internalType": "address",
34
+ "name": "owner",
35
+ "type": "address"
36
+ }
37
+ ],
38
+ "name": "OwnerOnly",
39
+ "type": "error"
40
+ },
41
+ {
42
+ "inputs": [],
43
+ "name": "ZeroAddress",
44
+ "type": "error"
45
+ },
46
+ {
47
+ "anonymous": false,
48
+ "inputs": [
49
+ {
50
+ "indexed": true,
51
+ "internalType": "address",
52
+ "name": "owner",
53
+ "type": "address"
54
+ }
55
+ ],
56
+ "name": "OwnerUpdated",
57
+ "type": "event"
58
+ },
59
+ {
60
+ "inputs": [
61
+ {
62
+ "internalType": "bytes32",
63
+ "name": "did",
64
+ "type": "bytes32"
65
+ },
66
+ {
67
+ "internalType": "address",
68
+ "name": "provider",
69
+ "type": "address"
70
+ }
71
+ ],
72
+ "name": "addDIDProvider",
73
+ "outputs": [],
74
+ "stateMutability": "nonpayable",
75
+ "type": "function"
76
+ },
77
+ {
78
+ "inputs": [
79
+ {
80
+ "internalType": "address",
81
+ "name": "newOwner",
82
+ "type": "address"
83
+ }
84
+ ],
85
+ "name": "changeOwner",
86
+ "outputs": [],
87
+ "stateMutability": "nonpayable",
88
+ "type": "function"
89
+ },
90
+ {
91
+ "inputs": [],
92
+ "name": "didRegistry",
93
+ "outputs": [
94
+ {
95
+ "internalType": "address",
96
+ "name": "",
97
+ "type": "address"
98
+ }
99
+ ],
100
+ "stateMutability": "view",
101
+ "type": "function"
102
+ },
103
+ {
104
+ "inputs": [],
105
+ "name": "escrowPaymentCondition",
106
+ "outputs": [
107
+ {
108
+ "internalType": "address",
109
+ "name": "",
110
+ "type": "address"
111
+ }
112
+ ],
113
+ "stateMutability": "view",
114
+ "type": "function"
115
+ },
116
+ {
117
+ "inputs": [
118
+ {
119
+ "internalType": "bytes32",
120
+ "name": "agreementId",
121
+ "type": "bytes32"
122
+ },
123
+ {
124
+ "internalType": "bytes32",
125
+ "name": "did",
126
+ "type": "bytes32"
127
+ },
128
+ {
129
+ "components": [
130
+ {
131
+ "internalType": "address",
132
+ "name": "nftHolder",
133
+ "type": "address"
134
+ },
135
+ {
136
+ "internalType": "address",
137
+ "name": "nftReceiver",
138
+ "type": "address"
139
+ },
140
+ {
141
+ "internalType": "uint256",
142
+ "name": "nftAmount",
143
+ "type": "uint256"
144
+ },
145
+ {
146
+ "internalType": "bytes32",
147
+ "name": "lockPaymentCondition",
148
+ "type": "bytes32"
149
+ },
150
+ {
151
+ "internalType": "address",
152
+ "name": "nftContractAddress",
153
+ "type": "address"
154
+ },
155
+ {
156
+ "internalType": "bool",
157
+ "name": "transfer",
158
+ "type": "bool"
159
+ },
160
+ {
161
+ "internalType": "uint256",
162
+ "name": "expirationBlock",
163
+ "type": "uint256"
164
+ }
165
+ ],
166
+ "internalType": "struct FulfillForDelegateParams",
167
+ "name": "fulfillForDelegateParams",
168
+ "type": "tuple"
169
+ },
170
+ {
171
+ "components": [
172
+ {
173
+ "internalType": "uint256[]",
174
+ "name": "amounts",
175
+ "type": "uint256[]"
176
+ },
177
+ {
178
+ "internalType": "address[]",
179
+ "name": "receivers",
180
+ "type": "address[]"
181
+ },
182
+ {
183
+ "internalType": "address",
184
+ "name": "returnAddress",
185
+ "type": "address"
186
+ },
187
+ {
188
+ "internalType": "address",
189
+ "name": "lockPaymentAddress",
190
+ "type": "address"
191
+ },
192
+ {
193
+ "internalType": "address",
194
+ "name": "tokenAddress",
195
+ "type": "address"
196
+ },
197
+ {
198
+ "internalType": "bytes32",
199
+ "name": "lockCondition",
200
+ "type": "bytes32"
201
+ },
202
+ {
203
+ "internalType": "bytes32",
204
+ "name": "releaseCondition",
205
+ "type": "bytes32"
206
+ }
207
+ ],
208
+ "internalType": "struct FulfillParams",
209
+ "name": "fulfillParams",
210
+ "type": "tuple"
211
+ }
212
+ ],
213
+ "name": "fulfill",
214
+ "outputs": [
215
+ {
216
+ "internalType": "enum NVM.ConditionState",
217
+ "name": "fulfillForDelegateConditionState",
218
+ "type": "uint8"
219
+ },
220
+ {
221
+ "internalType": "enum NVM.ConditionState",
222
+ "name": "fulfillConditionState",
223
+ "type": "uint8"
224
+ }
225
+ ],
226
+ "stateMutability": "nonpayable",
227
+ "type": "function"
228
+ },
229
+ {
230
+ "inputs": [],
231
+ "name": "owner",
232
+ "outputs": [
233
+ {
234
+ "internalType": "address",
235
+ "name": "",
236
+ "type": "address"
237
+ }
238
+ ],
239
+ "stateMutability": "view",
240
+ "type": "function"
241
+ },
242
+ {
243
+ "inputs": [
244
+ {
245
+ "internalType": "bytes32",
246
+ "name": "did",
247
+ "type": "bytes32"
248
+ },
249
+ {
250
+ "internalType": "address",
251
+ "name": "provider",
252
+ "type": "address"
253
+ }
254
+ ],
255
+ "name": "removeDIDProvider",
256
+ "outputs": [],
257
+ "stateMutability": "nonpayable",
258
+ "type": "function"
259
+ },
260
+ {
261
+ "inputs": [
262
+ {
263
+ "internalType": "bytes32",
264
+ "name": "did",
265
+ "type": "bytes32"
266
+ },
267
+ {
268
+ "internalType": "address",
269
+ "name": "newOwner",
270
+ "type": "address"
271
+ }
272
+ ],
273
+ "name": "transferDIDOwnership",
274
+ "outputs": [],
275
+ "stateMutability": "nonpayable",
276
+ "type": "function"
277
+ },
278
+ {
279
+ "inputs": [],
280
+ "name": "transferNFTCondition",
281
+ "outputs": [
282
+ {
283
+ "internalType": "address",
284
+ "name": "",
285
+ "type": "address"
286
+ }
287
+ ],
288
+ "stateMutability": "view",
289
+ "type": "function"
290
+ }
291
+ ],
292
+ "address": "0x4a2f40E14309c20c0C3803c3CcCd5E9B5F2D4eCA",
293
+ "implementation": "0x4a2f40E14309c20c0C3803c3CcCd5E9B5F2D4eCA"
294
+ }
mech_client/cli.py CHANGED
@@ -31,6 +31,17 @@ from mech_client.interact import interact as interact_
31
31
  from mech_client.marketplace_interact import (
32
32
  marketplace_interact as marketplace_interact_,
33
33
  )
34
+ from mech_client.mech_marketplace_tool_management import (
35
+ extract_input_schema,
36
+ extract_output_schema,
37
+ )
38
+ from mech_client.mech_marketplace_tool_management import (
39
+ get_tool_description as get_tool_description_for_marketplace_mech,
40
+ )
41
+ from mech_client.mech_marketplace_tool_management import (
42
+ get_tool_io_schema as get_tool_io_schema_for_marketplace_mech,
43
+ )
44
+ from mech_client.mech_marketplace_tool_management import get_tools_for_marketplace_mech
34
45
  from mech_client.mech_tool_management import (
35
46
  get_tool_description,
36
47
  get_tool_io_schema,
@@ -353,6 +364,84 @@ def tool_io_schema(tool_id: str, chain_config: str) -> None:
353
364
  click.echo(f"Network or I/O error: {str(e)}")
354
365
 
355
366
 
367
+ @click.command(name="tools-for-marketplace-mech")
368
+ @click.argument(
369
+ "service-id",
370
+ type=int,
371
+ )
372
+ @click.option("--chain-config", default="gnosis", help="Chain configuration to use.")
373
+ def tools_for_marketplace_mech(service_id: int, chain_config: str) -> None:
374
+ """Fetch and display tools for marketplace mechs."""
375
+ try:
376
+ result = get_tools_for_marketplace_mech(service_id, chain_config)
377
+
378
+ headers = ["Tool Name", "Unique Identifier"]
379
+ data: List[Tuple[str, ...]] = [
380
+ (
381
+ str(tool.tool_name),
382
+ str(tool.unique_identifier),
383
+ )
384
+ for tool in result.tools
385
+ ]
386
+
387
+ click.echo(tabulate(data, headers=headers, tablefmt="grid"))
388
+
389
+ except (KeyError, TypeError) as e:
390
+ click.echo(f"Error processing tool data: {str(e)}")
391
+ except IOError as e:
392
+ click.echo(f"Network or I/O error: {str(e)}")
393
+
394
+
395
+ @click.command(name="tool-description-for-marketplace-mech")
396
+ @click.argument("tool_id")
397
+ @click.option("--chain-config", default="gnosis", help="Chain configuration to use.")
398
+ def tool_description_for_marketplace_mech(tool_id: str, chain_config: str) -> None:
399
+ """Fetch and display the description of a specific tool for marketplace mechs."""
400
+ try:
401
+ description = get_tool_description_for_marketplace_mech(tool_id, chain_config)
402
+ click.echo(f"Description for tool {tool_id}: {description}")
403
+ except KeyError as e:
404
+ click.echo(f"Tool not found or missing description: {str(e)}")
405
+ except IOError as e:
406
+ click.echo(f"Network or I/O error: {str(e)}")
407
+
408
+
409
+ @click.command(name="tool-io-schema-for-marketplace-mech")
410
+ @click.argument("tool_id")
411
+ @click.option("--chain-config", default="gnosis", help="Chain configuration to use.")
412
+ def tool_io_schema_for_marketplace_mech(tool_id: str, chain_config: str) -> None:
413
+ """Fetch and display the tool's name and description along with the input/output schema for a specific tool for marketplace mechs."""
414
+ try:
415
+ result = get_tool_io_schema_for_marketplace_mech(tool_id, chain_config)
416
+
417
+ name = result["name"]
418
+ description = result["description"]
419
+ input_schema = extract_input_schema(result["input"])
420
+ output_schema = extract_output_schema(result["output"])
421
+
422
+ click.echo("Tool Details:")
423
+ click.echo(
424
+ tabulate(
425
+ [[name, description]],
426
+ headers=["Tool Name", "Tool Description"],
427
+ tablefmt="grid",
428
+ )
429
+ )
430
+
431
+ click.echo("Input Schema:")
432
+ click.echo(tabulate(input_schema, headers=["Field", "Value"], tablefmt="grid"))
433
+ click.echo("Output Schema:")
434
+ click.echo(
435
+ tabulate(
436
+ output_schema, headers=["Field", "Type", "Description"], tablefmt="grid"
437
+ )
438
+ )
439
+ except KeyError as e:
440
+ click.echo(f"Error accessing schema data: {str(e)}")
441
+ except IOError as e:
442
+ click.echo(f"Network or I/O error: {str(e)}")
443
+
444
+
356
445
  @click.command(name="deposit-native")
357
446
  @click.argument("amount_to_deposit")
358
447
  @click.option(
@@ -414,7 +503,7 @@ def nvm_subscribe(
414
503
  key: str,
415
504
  chain_config: str,
416
505
  ) -> None:
417
- """Deposits Token balance for prepaid requests."""
506
+ """Allows to purchase nvm subscription for nvm mech requests."""
418
507
  nvm_subscribe_main(private_key_path=key, chain_config=chain_config)
419
508
 
420
509
 
@@ -423,8 +512,11 @@ cli.add_command(prompt_to_ipfs)
423
512
  cli.add_command(push_to_ipfs)
424
513
  cli.add_command(to_png)
425
514
  cli.add_command(tools_for_agents)
515
+ cli.add_command(tools_for_marketplace_mech)
426
516
  cli.add_command(tool_io_schema)
517
+ cli.add_command(tool_io_schema_for_marketplace_mech)
427
518
  cli.add_command(tool_description)
519
+ cli.add_command(tool_description_for_marketplace_mech)
428
520
  cli.add_command(deposit_native)
429
521
  cli.add_command(deposit_token)
430
522
  cli.add_command(nvm_subscribe)
@@ -3,6 +3,7 @@
3
3
  "agent_registry_contract": "0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA",
4
4
  "service_registry_contract": "0x9338b5153AE39BB89f50468E608eD9d764B755fD",
5
5
  "mech_marketplace_contract": "0x735FAAb1c4Ec41128c367AFb5c3baC73509f70bB",
6
+ "complementary_metadata_hash_address": "0x0598081D48FB80B0A7E52FAD2905AE9beCd6fC69",
6
7
  "rpc_url": "https://rpc.eu-central-2.gateway.fm/v4/gnosis/non-archival/mainnet",
7
8
  "wss_endpoint": "wss://rpc.gnosischain.com/wss",
8
9
  "ledger_config": {
@@ -21,6 +22,7 @@
21
22
  "agent_registry_contract": "0xa4799B083E0068732456EF45ff9fe5c683658327",
22
23
  "service_registry_contract": "0xE3607b00E75f6405248323A9417ff6b39B244b50",
23
24
  "mech_marketplace_contract": "0x0000000000000000000000000000000000000000",
25
+ "complementary_metadata_hash_address": "0x0000000000000000000000000000000000000000",
24
26
  "rpc_url": "https://arbitrum.llamarpc.com",
25
27
  "wss_endpoint": "wss://arbitrum.gateway.tenderly.co",
26
28
  "ledger_config": {
@@ -39,6 +41,7 @@
39
41
  "agent_registry_contract": "0x984cf72FDe8B5aA910e9e508aC5e007ae5BDcC9C",
40
42
  "service_registry_contract": "0xE3607b00E75f6405248323A9417ff6b39B244b50",
41
43
  "mech_marketplace_contract": "0x0000000000000000000000000000000000000000",
44
+ "complementary_metadata_hash_address": "0x0000000000000000000000000000000000000000",
42
45
  "rpc_url": "https://polygon-bor-rpc.publicnode.com",
43
46
  "wss_endpoint": "wss://polygon.gateway.tenderly.co",
44
47
  "ledger_config": {
@@ -57,6 +60,7 @@
57
60
  "agent_registry_contract": "0x88DE734655184a09B70700aE4F72364d1ad23728",
58
61
  "service_registry_contract": "0x3C1fF68f5aa342D296d4DEe4Bb1cACCA912D95fE",
59
62
  "mech_marketplace_contract": "0xf24eE42edA0fc9b33B7D41B06Ee8ccD2Ef7C5020",
63
+ "complementary_metadata_hash_address": "0x28C1edC7CEd549F7f80B732fDC19f0370160707d",
60
64
  "rpc_url": "https://base.llamarpc.com",
61
65
  "wss_endpoint": "wss://base.gateway.tenderly.co",
62
66
  "ledger_config": {
@@ -75,6 +79,7 @@
75
79
  "agent_registry_contract": "0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA",
76
80
  "service_registry_contract": "0xE3607b00E75f6405248323A9417ff6b39B244b50",
77
81
  "mech_marketplace_contract": "0x0000000000000000000000000000000000000000",
82
+ "complementary_metadata_hash_address": "0x0000000000000000000000000000000000000000",
78
83
  "rpc_url": "https://forno.celo.org",
79
84
  "wss_endpoint": "wss://forno.celo.org/ws",
80
85
  "ledger_config": {
@@ -93,6 +98,7 @@
93
98
  "agent_registry_contract": "0x75D529FAe220bC8db714F0202193726b46881B76",
94
99
  "service_registry_contract": "0x3d77596beb0f130a4415df3D2D8232B3d3D31e44",
95
100
  "mech_marketplace_contract": "0x0000000000000000000000000000000000000000",
101
+ "complementary_metadata_hash_address": "0x0000000000000000000000000000000000000000",
96
102
  "rpc_url": "https://mainnet.optimism.io",
97
103
  "wss_endpoint": "wss://optimism.gateway.tenderly.co",
98
104
  "ledger_config": {
mech_client/interact.py CHANGED
@@ -120,6 +120,7 @@ class MechConfig: # pylint: disable=too-many-instance-attributes
120
120
 
121
121
  agent_registry_contract: str
122
122
  service_registry_contract: str
123
+ complementary_metadata_hash_address: str
123
124
  rpc_url: str
124
125
  wss_endpoint: str
125
126
  ledger_config: LedgerConfig