mech-client 0.14.0__py3-none-any.whl → 0.15.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.
- mech_client/__init__.py +1 -1
- mech_client/cli.py +257 -11
- mech_client/configs/mechs.json +110 -110
- mech_client/interact.py +6 -1
- mech_client/marketplace_interact.py +161 -43
- mech_client/safe.py +73 -0
- mech_client/subgraph.py +0 -11
- {mech_client-0.14.0.dist-info → mech_client-0.15.0.dist-info}/METADATA +264 -219
- {mech_client-0.14.0.dist-info → mech_client-0.15.0.dist-info}/RECORD +22 -48
- scripts/deposit_native.py +48 -16
- scripts/deposit_token.py +107 -31
- scripts/nvm_subscribe.py +14 -6
- scripts/nvm_subscription/contracts/base_contract.py +9 -1
- scripts/nvm_subscription/contracts/nft_sales.py +1 -3
- scripts/nvm_subscription/contracts/subscription_provider.py +2 -4
- scripts/nvm_subscription/contracts/token.py +23 -5
- scripts/nvm_subscription/manager.py +109 -16
- scripts/utils.py +2 -2
- scripts/whitelist.py +9 -1
- mech_client/helpers/acn/README.md +0 -76
- mech_client/helpers/acn/__init__.py +0 -30
- mech_client/helpers/acn/acn.proto +0 -71
- mech_client/helpers/acn/acn_pb2.py +0 -42
- mech_client/helpers/acn/custom_types.py +0 -224
- mech_client/helpers/acn/dialogues.py +0 -126
- mech_client/helpers/acn/message.py +0 -274
- mech_client/helpers/acn/protocol.yaml +0 -24
- mech_client/helpers/acn/serialization.py +0 -149
- mech_client/helpers/acn/tests/__init__.py +0 -20
- mech_client/helpers/acn/tests/test_acn.py +0 -256
- mech_client/helpers/acn/tests/test_acn_dialogues.py +0 -53
- mech_client/helpers/acn/tests/test_acn_messages.py +0 -117
- mech_client/helpers/acn_data_share/README.md +0 -32
- mech_client/helpers/acn_data_share/__init__.py +0 -32
- mech_client/helpers/acn_data_share/acn_data_share.proto +0 -17
- mech_client/helpers/acn_data_share/acn_data_share_pb2.py +0 -29
- mech_client/helpers/acn_data_share/dialogues.py +0 -115
- mech_client/helpers/acn_data_share/message.py +0 -213
- mech_client/helpers/acn_data_share/protocol.yaml +0 -21
- mech_client/helpers/acn_data_share/serialization.py +0 -111
- mech_client/helpers/acn_data_share/tests/test_acn_data_share_dialogues.py +0 -49
- mech_client/helpers/acn_data_share/tests/test_acn_data_share_messages.py +0 -53
- mech_client/helpers/p2p_libp2p_client/README.md +0 -15
- mech_client/helpers/p2p_libp2p_client/__init__.py +0 -21
- mech_client/helpers/p2p_libp2p_client/connection.py +0 -703
- mech_client/helpers/p2p_libp2p_client/connection.yaml +0 -52
- {mech_client-0.14.0.dist-info → mech_client-0.15.0.dist-info}/LICENSE +0 -0
- {mech_client-0.14.0.dist-info → mech_client-0.15.0.dist-info}/WHEEL +0 -0
- {mech_client-0.14.0.dist-info → mech_client-0.15.0.dist-info}/entry_points.txt +0 -0
|
@@ -4,12 +4,10 @@ import json
|
|
|
4
4
|
import logging
|
|
5
5
|
import os
|
|
6
6
|
import sys
|
|
7
|
-
import requests
|
|
8
7
|
|
|
9
8
|
import uuid
|
|
10
|
-
from typing import Any, Dict,
|
|
9
|
+
from typing import Any, Dict, Optional, Tuple
|
|
11
10
|
from web3 import Web3
|
|
12
|
-
from eth_account import Account
|
|
13
11
|
from eth_typing import ChecksumAddress
|
|
14
12
|
|
|
15
13
|
from .contracts.did_registry import DIDRegistryContract
|
|
@@ -22,6 +20,8 @@ from .contracts.token import SubscriptionToken
|
|
|
22
20
|
from .contracts.nft import SubscriptionNFT
|
|
23
21
|
from .contracts.subscription_provider import SubscriptionProvider
|
|
24
22
|
|
|
23
|
+
from mech_client.safe import EthereumClient, get_safe_nonce, send_safe_tx
|
|
24
|
+
|
|
25
25
|
logger = logging.getLogger(__name__)
|
|
26
26
|
|
|
27
27
|
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
@@ -32,6 +32,10 @@ class Network(Enum):
|
|
|
32
32
|
GNOSIS = "GNOSIS"
|
|
33
33
|
BASE = "BASE"
|
|
34
34
|
|
|
35
|
+
class ChainId(Enum):
|
|
36
|
+
GNOSIS = 100
|
|
37
|
+
BASE = 8453
|
|
38
|
+
|
|
35
39
|
|
|
36
40
|
def get_variable_value(variable: str) -> str:
|
|
37
41
|
try:
|
|
@@ -49,16 +53,19 @@ class NVMSubscriptionManager:
|
|
|
49
53
|
using a series of smart contracts.
|
|
50
54
|
"""
|
|
51
55
|
|
|
52
|
-
def __init__(self, network: str,
|
|
56
|
+
def __init__(self, network: str, sender: str, agent_mode: bool, safe_address: Optional[str]):
|
|
53
57
|
"""
|
|
54
58
|
Initialize the SubscriptionManager, including contract instances
|
|
55
59
|
and Web3 connection.
|
|
56
60
|
"""
|
|
57
|
-
self.url = os.getenv("
|
|
61
|
+
self.url = os.getenv("MECHX_RPC_URL", CONFIGS[network]["nvm"]['web3ProviderUri'])
|
|
58
62
|
self.web3 = Web3(Web3.HTTPProvider(self.url))
|
|
63
|
+
self.agent_mode = agent_mode
|
|
64
|
+
if self.agent_mode:
|
|
65
|
+
self.safe_address = str(safe_address)
|
|
66
|
+
self.ethereum_client = EthereumClient(self.url)
|
|
59
67
|
|
|
60
|
-
self.
|
|
61
|
-
self.sender: ChecksumAddress = self.web3.to_checksum_address(self.account.address)
|
|
68
|
+
self.sender: ChecksumAddress = self.web3.to_checksum_address(sender)
|
|
62
69
|
|
|
63
70
|
self.did_registry = DIDRegistryContract(self.web3)
|
|
64
71
|
self.nft_sales = NFTSalesTemplateContract(self.web3)
|
|
@@ -99,6 +106,12 @@ class NVMSubscriptionManager:
|
|
|
99
106
|
Returns:
|
|
100
107
|
Dict[str, Any]: A dictionary containing transaction status and receipt.
|
|
101
108
|
"""
|
|
109
|
+
print(f"Checking {self.sender} balance for purchasing subscription...")
|
|
110
|
+
is_enough, message = self.check_sufficient_sender_balance()
|
|
111
|
+
if not is_enough:
|
|
112
|
+
print(message)
|
|
113
|
+
sys.exit(1)
|
|
114
|
+
|
|
102
115
|
logger.info(f"Creating subscription for DID: {did}")
|
|
103
116
|
|
|
104
117
|
did = did.replace("did:nv:", "0x")
|
|
@@ -152,18 +165,36 @@ class NVMSubscriptionManager:
|
|
|
152
165
|
|
|
153
166
|
# we set value as xdai is used as subscription for gnosis
|
|
154
167
|
value_eth = 1
|
|
155
|
-
if chain_id ==
|
|
168
|
+
if chain_id == ChainId.BASE.value:
|
|
156
169
|
# for base, usdc is used and so we don't send any value
|
|
157
170
|
value_eth = 0
|
|
158
171
|
|
|
172
|
+
if not self.agent_mode:
|
|
173
|
+
nonce = self.web3.eth.get_transaction_count(self.sender)
|
|
174
|
+
else:
|
|
175
|
+
nonce = get_safe_nonce(self.ethereum_client, self.safe_address)
|
|
176
|
+
|
|
159
177
|
approve_tx = self.subscription_token.build_approve_token_tx(
|
|
160
178
|
sender=self.sender,
|
|
161
179
|
to=self.lock_payment.address,
|
|
162
180
|
amount=10**6,
|
|
181
|
+
nonce=nonce,
|
|
163
182
|
chain_id=chain_id,
|
|
164
183
|
)
|
|
165
|
-
|
|
166
|
-
|
|
184
|
+
|
|
185
|
+
if not self.agent_mode:
|
|
186
|
+
signed_tx = self.web3.eth.account.sign_transaction(approve_tx, private_key=wallet_pvt_key)
|
|
187
|
+
tx_hash = self.web3.eth.send_raw_transaction(signed_tx.rawTransaction)
|
|
188
|
+
else:
|
|
189
|
+
tx_hash = send_safe_tx(
|
|
190
|
+
ethereum_client=self.ethereum_client,
|
|
191
|
+
tx_data=approve_tx["data"],
|
|
192
|
+
to_adress=self.subscription_token.address,
|
|
193
|
+
safe_address=self.safe_address,
|
|
194
|
+
signer_pkey=wallet_pvt_key,
|
|
195
|
+
value=0,
|
|
196
|
+
)
|
|
197
|
+
|
|
167
198
|
receipt = self.web3.eth.wait_for_transaction_receipt(tx_hash)
|
|
168
199
|
|
|
169
200
|
if receipt["status"] == 1:
|
|
@@ -173,6 +204,12 @@ class NVMSubscriptionManager:
|
|
|
173
204
|
logger.error("Approve transaction failed")
|
|
174
205
|
return {"status": "failed", "receipt": dict(receipt)}
|
|
175
206
|
|
|
207
|
+
|
|
208
|
+
if not self.agent_mode:
|
|
209
|
+
nonce = self.web3.eth.get_transaction_count(self.sender)
|
|
210
|
+
else:
|
|
211
|
+
nonce = get_safe_nonce(self.ethereum_client, self.safe_address)
|
|
212
|
+
|
|
176
213
|
# Build transaction
|
|
177
214
|
tx = self.nft_sales.build_create_agreement_tx(
|
|
178
215
|
agreement_id_seed=agreement_id_seed,
|
|
@@ -187,12 +224,24 @@ class NVMSubscriptionManager:
|
|
|
187
224
|
amounts=self.amounts,
|
|
188
225
|
receivers=receivers,
|
|
189
226
|
sender=self.sender,
|
|
227
|
+
nonce=nonce,
|
|
190
228
|
value_eth=value_eth,
|
|
191
229
|
chain_id=chain_id
|
|
192
230
|
)
|
|
193
231
|
|
|
194
|
-
|
|
195
|
-
|
|
232
|
+
if not self.agent_mode:
|
|
233
|
+
signed_tx = self.web3.eth.account.sign_transaction(tx, private_key=wallet_pvt_key)
|
|
234
|
+
tx_hash = self.web3.eth.send_raw_transaction(signed_tx.rawTransaction)
|
|
235
|
+
else:
|
|
236
|
+
tx_hash = send_safe_tx(
|
|
237
|
+
ethereum_client=self.ethereum_client,
|
|
238
|
+
tx_data=tx["data"],
|
|
239
|
+
to_adress=self.nft_sales.address,
|
|
240
|
+
safe_address=self.safe_address,
|
|
241
|
+
signer_pkey=wallet_pvt_key,
|
|
242
|
+
value=self.web3.to_wei(value_eth, "ether"),
|
|
243
|
+
)
|
|
244
|
+
|
|
196
245
|
receipt = self.web3.eth.wait_for_transaction_receipt(transaction_hash=tx_hash)
|
|
197
246
|
|
|
198
247
|
if receipt["status"] == 1:
|
|
@@ -236,20 +285,37 @@ class NVMSubscriptionManager:
|
|
|
236
285
|
"0x" + transfer_id.hex(),
|
|
237
286
|
)
|
|
238
287
|
|
|
288
|
+
if not self.agent_mode:
|
|
289
|
+
nonce = self.web3.eth.get_transaction_count(self.sender)
|
|
290
|
+
else:
|
|
291
|
+
nonce = get_safe_nonce(self.ethereum_client, self.safe_address)
|
|
292
|
+
|
|
239
293
|
fulfill_tx = self.subscription_provider.build_create_fulfill_tx(
|
|
240
294
|
agreement_id_seed="0x" + agreement_id.hex(),
|
|
241
295
|
did=did,
|
|
242
296
|
fulfill_for_delegate_params=fulfill_for_delegate_params,
|
|
243
297
|
fulfill_params=fulfill_params,
|
|
244
298
|
sender=self.sender,
|
|
299
|
+
nonce=nonce,
|
|
245
300
|
value_eth=0,
|
|
246
301
|
chain_id=chain_id,
|
|
247
302
|
)
|
|
248
303
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
304
|
+
if not self.agent_mode:
|
|
305
|
+
signed_tx = self.web3.eth.account.sign_transaction(
|
|
306
|
+
fulfill_tx, private_key=wallet_pvt_key
|
|
307
|
+
)
|
|
308
|
+
tx_hash = self.web3.eth.send_raw_transaction(signed_tx.rawTransaction)
|
|
309
|
+
else:
|
|
310
|
+
tx_hash = send_safe_tx(
|
|
311
|
+
ethereum_client=self.ethereum_client,
|
|
312
|
+
tx_data=fulfill_tx["data"],
|
|
313
|
+
to_adress=self.subscription_provider.address,
|
|
314
|
+
safe_address=self.safe_address,
|
|
315
|
+
signer_pkey=wallet_pvt_key,
|
|
316
|
+
value=0,
|
|
317
|
+
)
|
|
318
|
+
|
|
253
319
|
receipt = self.web3.eth.wait_for_transaction_receipt(transaction_hash=tx_hash)
|
|
254
320
|
|
|
255
321
|
user_credit_balance_after = self.subscription_nft.get_balance(
|
|
@@ -263,3 +329,30 @@ class NVMSubscriptionManager:
|
|
|
263
329
|
else:
|
|
264
330
|
logger.error("Subscription purchase transaction failed")
|
|
265
331
|
return {"status": "failed", "receipt": dict(receipt)}
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
def check_sufficient_sender_balance(self) -> Tuple[bool, str]:
|
|
335
|
+
w3 = self.web3
|
|
336
|
+
sender = self.sender
|
|
337
|
+
chain_id = w3.eth.chain_id
|
|
338
|
+
|
|
339
|
+
# For gnosis, native xdai is used for purchase
|
|
340
|
+
if chain_id == ChainId.GNOSIS.value:
|
|
341
|
+
required_balance = w3.from_wei(10**18, unit='ether')
|
|
342
|
+
native_balance = w3.from_wei(w3.eth.get_balance(sender), unit='ether')
|
|
343
|
+
return (
|
|
344
|
+
native_balance >= required_balance,
|
|
345
|
+
f"Not enough balance. Required: {required_balance} xdai, Found: {native_balance} xdai",
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
# For base, usdc is used for purchase (decimal 6)
|
|
349
|
+
if chain_id == ChainId.BASE.value:
|
|
350
|
+
required_balance = w3.from_wei(10**6, unit='mwei')
|
|
351
|
+
usdc_balance = w3.from_wei(self.subscription_token.get_balance(sender), unit='mwei')
|
|
352
|
+
usdc_address = self.subscription_token.address
|
|
353
|
+
return (
|
|
354
|
+
usdc_balance >= required_balance,
|
|
355
|
+
f"Not enough balance. Required: {required_balance} usdc (token {usdc_address}), Found: {usdc_balance} usdc",
|
|
356
|
+
)
|
|
357
|
+
|
|
358
|
+
return False, f"Unsupported chain: {chain_id}"
|
scripts/utils.py
CHANGED
|
@@ -18,7 +18,7 @@ VALID_CHAINS = [
|
|
|
18
18
|
CHAIN_TO_NATIVE_BALANCE_TRACKER = {
|
|
19
19
|
100: "0x21cE6799A22A3Da84B7c44a814a9c79ab1d2A50D",
|
|
20
20
|
42161: "",
|
|
21
|
-
137: "",
|
|
21
|
+
137: "0x0000000000000000000000000000000000001010",
|
|
22
22
|
8453: "0xB3921F8D8215603f0Bd521341Ac45eA8f2d274c1",
|
|
23
23
|
42220: "",
|
|
24
24
|
10: "",
|
|
@@ -27,7 +27,7 @@ CHAIN_TO_NATIVE_BALANCE_TRACKER = {
|
|
|
27
27
|
CHAIN_TO_TOKEN_BALANCE_TRACKER = {
|
|
28
28
|
100: "0x53Bd432516707a5212A70216284a99A563aAC1D1",
|
|
29
29
|
42161: "",
|
|
30
|
-
137: "",
|
|
30
|
+
137: "0x0000000000000000000000000000000000001010",
|
|
31
31
|
8453: "0x43fB32f25dce34EB76c78C7A42C8F40F84BCD237",
|
|
32
32
|
42220: "",
|
|
33
33
|
10: "",
|
scripts/whitelist.py
CHANGED
|
@@ -2,4 +2,12 @@ directory # unused attribute (mech_client/acn.py:85)
|
|
|
2
2
|
directory # unused attribute (mech_client/acn.py:100)
|
|
3
3
|
directory # unused attribute (mech_client/acn.py:116)
|
|
4
4
|
payment_data # unused variable (mech_client/interact.py:111)
|
|
5
|
-
AGENT_QUERY_TEMPLATE # unused variable (mech_client/subgraph.py:30)
|
|
5
|
+
AGENT_QUERY_TEMPLATE # unused variable (mech_client/subgraph.py:30)
|
|
6
|
+
principal_chain # unused variable (mech_client/cli.py:92)
|
|
7
|
+
configure_local_config # unused variable (mech_client/cli.py:162)
|
|
8
|
+
verify_tools #unused function
|
|
9
|
+
|
|
10
|
+
# Existing entries...
|
|
11
|
+
send_marketplace_request_nonblocking # used in tests/locustfile.py
|
|
12
|
+
delivery_consumer_loop_status_only # used in tests/locustfile.py
|
|
13
|
+
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# ACN Protocol
|
|
2
|
-
|
|
3
|
-
## Description
|
|
4
|
-
|
|
5
|
-
This is a protocol for ACN (agent communication network) envelope delivery.
|
|
6
|
-
|
|
7
|
-
## Specification
|
|
8
|
-
|
|
9
|
-
```yaml
|
|
10
|
-
---
|
|
11
|
-
name: acn
|
|
12
|
-
author: valory
|
|
13
|
-
version: 1.1.0
|
|
14
|
-
description: The protocol used for envelope delivery on the ACN.
|
|
15
|
-
license: Apache-2.0
|
|
16
|
-
aea_version: '>=1.0.0, <2.0.0'
|
|
17
|
-
protocol_specification_id: aea/acn:1.0.0
|
|
18
|
-
speech_acts:
|
|
19
|
-
register:
|
|
20
|
-
record: ct:AgentRecord
|
|
21
|
-
lookup_request:
|
|
22
|
-
agent_address: pt:str
|
|
23
|
-
lookup_response:
|
|
24
|
-
record: ct:AgentRecord
|
|
25
|
-
aea_envelope:
|
|
26
|
-
envelope: pt:bytes
|
|
27
|
-
record: ct:AgentRecord
|
|
28
|
-
status:
|
|
29
|
-
body: ct:StatusBody
|
|
30
|
-
...
|
|
31
|
-
---
|
|
32
|
-
ct:AgentRecord:
|
|
33
|
-
string service_id = 1;
|
|
34
|
-
string ledger_id = 2;
|
|
35
|
-
string address = 3;
|
|
36
|
-
string public_key = 4;
|
|
37
|
-
string peer_public_key = 5;
|
|
38
|
-
string signature = 6;
|
|
39
|
-
string not_before = 7;
|
|
40
|
-
string not_after = 8;
|
|
41
|
-
ct:StatusBody: |
|
|
42
|
-
enum StatusCodeEnum {
|
|
43
|
-
// common (0x)
|
|
44
|
-
SUCCESS = 0;
|
|
45
|
-
ERROR_UNSUPPORTED_VERSION = 1;
|
|
46
|
-
ERROR_UNEXPECTED_PAYLOAD = 2;
|
|
47
|
-
ERROR_GENERIC = 3;
|
|
48
|
-
ERROR_DECODE = 4;
|
|
49
|
-
// register (1x)
|
|
50
|
-
ERROR_WRONG_AGENT_ADDRESS = 10;
|
|
51
|
-
ERROR_WRONG_PUBLIC_KEY = 11;
|
|
52
|
-
ERROR_INVALID_PROOF = 12;
|
|
53
|
-
ERROR_UNSUPPORTED_LEDGER = 13;
|
|
54
|
-
// lookup & delivery (2x)
|
|
55
|
-
ERROR_UNKNOWN_AGENT_ADDRESS = 20;
|
|
56
|
-
ERROR_AGENT_NOT_READY = 21;
|
|
57
|
-
}
|
|
58
|
-
StatusCodeEnum code = 1;
|
|
59
|
-
repeated string msgs = 2;
|
|
60
|
-
...
|
|
61
|
-
---
|
|
62
|
-
initiation: [register, lookup_request, aea_envelope]
|
|
63
|
-
reply:
|
|
64
|
-
register: [status]
|
|
65
|
-
lookup_request: [lookup_response, status]
|
|
66
|
-
aea_envelope: [status]
|
|
67
|
-
status: []
|
|
68
|
-
lookup_response: []
|
|
69
|
-
termination: [status, lookup_response]
|
|
70
|
-
roles: {node}
|
|
71
|
-
end_states: [successful, failed]
|
|
72
|
-
keep_terminal_state_dialogues: false
|
|
73
|
-
...
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## Links
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# ------------------------------------------------------------------------------
|
|
3
|
-
#
|
|
4
|
-
# Copyright 2024 valory
|
|
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
|
-
"""
|
|
21
|
-
This module contains the support resources for the acn protocol.
|
|
22
|
-
|
|
23
|
-
It was created with protocol buffer compiler version `libprotoc 24.3` and aea protocol generator version `1.0.0`.
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
from packages.valory.protocols.acn.message import AcnMessage
|
|
27
|
-
from packages.valory.protocols.acn.serialization import AcnSerializer
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
AcnMessage.serializer = AcnSerializer
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
syntax = "proto3";
|
|
2
|
-
|
|
3
|
-
package aea.aea.acn.v1_0_0;
|
|
4
|
-
|
|
5
|
-
message AcnMessage{
|
|
6
|
-
|
|
7
|
-
// Custom Types
|
|
8
|
-
message AgentRecord{
|
|
9
|
-
string service_id = 1;
|
|
10
|
-
string ledger_id = 2;
|
|
11
|
-
string address = 3;
|
|
12
|
-
string public_key = 4;
|
|
13
|
-
string peer_public_key = 5;
|
|
14
|
-
string signature = 6;
|
|
15
|
-
string not_before = 7;
|
|
16
|
-
string not_after = 8;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
message StatusBody{
|
|
20
|
-
enum StatusCodeEnum {
|
|
21
|
-
// common (0x)
|
|
22
|
-
SUCCESS = 0;
|
|
23
|
-
ERROR_UNSUPPORTED_VERSION = 1;
|
|
24
|
-
ERROR_UNEXPECTED_PAYLOAD = 2;
|
|
25
|
-
ERROR_GENERIC = 3;
|
|
26
|
-
ERROR_DECODE = 4;
|
|
27
|
-
// register (1x)
|
|
28
|
-
ERROR_WRONG_AGENT_ADDRESS = 10;
|
|
29
|
-
ERROR_WRONG_PUBLIC_KEY = 11;
|
|
30
|
-
ERROR_INVALID_PROOF = 12;
|
|
31
|
-
ERROR_UNSUPPORTED_LEDGER = 13;
|
|
32
|
-
// lookup & delivery (2x)
|
|
33
|
-
ERROR_UNKNOWN_AGENT_ADDRESS = 20;
|
|
34
|
-
ERROR_AGENT_NOT_READY = 21;
|
|
35
|
-
}
|
|
36
|
-
StatusCodeEnum code = 1;
|
|
37
|
-
repeated string msgs = 2;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// Performatives and contents
|
|
42
|
-
message Register_Performative{
|
|
43
|
-
AgentRecord record = 1;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
message Lookup_Request_Performative{
|
|
47
|
-
string agent_address = 1;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
message Lookup_Response_Performative{
|
|
51
|
-
AgentRecord record = 1;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
message Aea_Envelope_Performative{
|
|
55
|
-
bytes envelope = 1;
|
|
56
|
-
AgentRecord record = 2;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
message Status_Performative{
|
|
60
|
-
StatusBody body = 1;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
oneof performative{
|
|
65
|
-
Aea_Envelope_Performative aea_envelope = 5;
|
|
66
|
-
Lookup_Request_Performative lookup_request = 6;
|
|
67
|
-
Lookup_Response_Performative lookup_response = 7;
|
|
68
|
-
Register_Performative register = 8;
|
|
69
|
-
Status_Performative status = 9;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
-
# source: acn.proto
|
|
4
|
-
"""Generated protocol buffer code."""
|
|
5
|
-
from google.protobuf import descriptor as _descriptor
|
|
6
|
-
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
7
|
-
from google.protobuf import symbol_database as _symbol_database
|
|
8
|
-
from google.protobuf.internal import builder as _builder
|
|
9
|
-
|
|
10
|
-
# @@protoc_insertion_point(imports)
|
|
11
|
-
|
|
12
|
-
_sym_db = _symbol_database.Default()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
|
|
16
|
-
b'\n\tacn.proto\x12\x12\x61\x65\x61.aea.acn.v1_0_0"\x92\x0b\n\nAcnMessage\x12P\n\x0c\x61\x65\x61_envelope\x18\x05 \x01(\x0b\x32\x38.aea.aea.acn.v1_0_0.AcnMessage.Aea_Envelope_PerformativeH\x00\x12T\n\x0elookup_request\x18\x06 \x01(\x0b\x32:.aea.aea.acn.v1_0_0.AcnMessage.Lookup_Request_PerformativeH\x00\x12V\n\x0flookup_response\x18\x07 \x01(\x0b\x32;.aea.aea.acn.v1_0_0.AcnMessage.Lookup_Response_PerformativeH\x00\x12H\n\x08register\x18\x08 \x01(\x0b\x32\x34.aea.aea.acn.v1_0_0.AcnMessage.Register_PerformativeH\x00\x12\x44\n\x06status\x18\t \x01(\x0b\x32\x32.aea.aea.acn.v1_0_0.AcnMessage.Status_PerformativeH\x00\x1a\xac\x01\n\x0b\x41gentRecord\x12\x12\n\nservice_id\x18\x01 \x01(\t\x12\x11\n\tledger_id\x18\x02 \x01(\t\x12\x0f\n\x07\x61\x64\x64ress\x18\x03 \x01(\t\x12\x12\n\npublic_key\x18\x04 \x01(\t\x12\x17\n\x0fpeer_public_key\x18\x05 \x01(\t\x12\x11\n\tsignature\x18\x06 \x01(\t\x12\x12\n\nnot_before\x18\x07 \x01(\t\x12\x11\n\tnot_after\x18\x08 \x01(\t\x1a\x92\x03\n\nStatusBody\x12\x46\n\x04\x63ode\x18\x01 \x01(\x0e\x32\x38.aea.aea.acn.v1_0_0.AcnMessage.StatusBody.StatusCodeEnum\x12\x0c\n\x04msgs\x18\x02 \x03(\t"\xad\x02\n\x0eStatusCodeEnum\x12\x0b\n\x07SUCCESS\x10\x00\x12\x1d\n\x19\x45RROR_UNSUPPORTED_VERSION\x10\x01\x12\x1c\n\x18\x45RROR_UNEXPECTED_PAYLOAD\x10\x02\x12\x11\n\rERROR_GENERIC\x10\x03\x12\x10\n\x0c\x45RROR_DECODE\x10\x04\x12\x1d\n\x19\x45RROR_WRONG_AGENT_ADDRESS\x10\n\x12\x1a\n\x16\x45RROR_WRONG_PUBLIC_KEY\x10\x0b\x12\x17\n\x13\x45RROR_INVALID_PROOF\x10\x0c\x12\x1c\n\x18\x45RROR_UNSUPPORTED_LEDGER\x10\r\x12\x1f\n\x1b\x45RROR_UNKNOWN_AGENT_ADDRESS\x10\x14\x12\x19\n\x15\x45RROR_AGENT_NOT_READY\x10\x15\x1aS\n\x15Register_Performative\x12:\n\x06record\x18\x01 \x01(\x0b\x32*.aea.aea.acn.v1_0_0.AcnMessage.AgentRecord\x1a\x34\n\x1bLookup_Request_Performative\x12\x15\n\ragent_address\x18\x01 \x01(\t\x1aZ\n\x1cLookup_Response_Performative\x12:\n\x06record\x18\x01 \x01(\x0b\x32*.aea.aea.acn.v1_0_0.AcnMessage.AgentRecord\x1ai\n\x19\x41\x65\x61_Envelope_Performative\x12\x10\n\x08\x65nvelope\x18\x01 \x01(\x0c\x12:\n\x06record\x18\x02 \x01(\x0b\x32*.aea.aea.acn.v1_0_0.AcnMessage.AgentRecord\x1aN\n\x13Status_Performative\x12\x37\n\x04\x62ody\x18\x01 \x01(\x0b\x32).aea.aea.acn.v1_0_0.AcnMessage.StatusBodyB\x0e\n\x0cperformativeb\x06proto3'
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
_globals = globals()
|
|
20
|
-
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
21
|
-
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "acn_pb2", _globals)
|
|
22
|
-
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
23
|
-
DESCRIPTOR._options = None
|
|
24
|
-
_globals["_ACNMESSAGE"]._serialized_start = 34
|
|
25
|
-
_globals["_ACNMESSAGE"]._serialized_end = 1460
|
|
26
|
-
_globals["_ACNMESSAGE_AGENTRECORD"]._serialized_start = 449
|
|
27
|
-
_globals["_ACNMESSAGE_AGENTRECORD"]._serialized_end = 621
|
|
28
|
-
_globals["_ACNMESSAGE_STATUSBODY"]._serialized_start = 624
|
|
29
|
-
_globals["_ACNMESSAGE_STATUSBODY"]._serialized_end = 1026
|
|
30
|
-
_globals["_ACNMESSAGE_STATUSBODY_STATUSCODEENUM"]._serialized_start = 725
|
|
31
|
-
_globals["_ACNMESSAGE_STATUSBODY_STATUSCODEENUM"]._serialized_end = 1026
|
|
32
|
-
_globals["_ACNMESSAGE_REGISTER_PERFORMATIVE"]._serialized_start = 1028
|
|
33
|
-
_globals["_ACNMESSAGE_REGISTER_PERFORMATIVE"]._serialized_end = 1111
|
|
34
|
-
_globals["_ACNMESSAGE_LOOKUP_REQUEST_PERFORMATIVE"]._serialized_start = 1113
|
|
35
|
-
_globals["_ACNMESSAGE_LOOKUP_REQUEST_PERFORMATIVE"]._serialized_end = 1165
|
|
36
|
-
_globals["_ACNMESSAGE_LOOKUP_RESPONSE_PERFORMATIVE"]._serialized_start = 1167
|
|
37
|
-
_globals["_ACNMESSAGE_LOOKUP_RESPONSE_PERFORMATIVE"]._serialized_end = 1257
|
|
38
|
-
_globals["_ACNMESSAGE_AEA_ENVELOPE_PERFORMATIVE"]._serialized_start = 1259
|
|
39
|
-
_globals["_ACNMESSAGE_AEA_ENVELOPE_PERFORMATIVE"]._serialized_end = 1364
|
|
40
|
-
_globals["_ACNMESSAGE_STATUS_PERFORMATIVE"]._serialized_start = 1366
|
|
41
|
-
_globals["_ACNMESSAGE_STATUS_PERFORMATIVE"]._serialized_end = 1444
|
|
42
|
-
# @@protoc_insertion_point(module_scope)
|