symbol-sdk-python 3.2.3__tar.gz → 3.3.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.
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/PKG-INFO +17 -15
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/README.md +9 -9
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/pyproject.toml +6 -6
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/facade/SymbolFacade.py +7 -2
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/nem/TransactionFactory.py +5 -1
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/sc/__init__.py +220 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/symbol/IdGenerator.py +8 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/symbol/Network.py +6 -1
- symbol_sdk_python-3.3.1/symbolchain/symbol/Restriction.py +10 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/symbol/TransactionFactory.py +4 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/AccountDescriptorRepository.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/ArrayHelpers.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/BaseValue.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/Bip32.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/BlockchainSettings.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/BufferReader.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/BufferWriter.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/ByteArray.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/Cipher.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/CodeWordsEncoder.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/CryptoTypes.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/DiceMnemonicGenerator.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/Network.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/NetworkTimestamp.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/NodeDescriptorRepository.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/Ordered.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/PrivateKeyStorage.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/QrSignatureStorage.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/QrStorage.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/RuleBasedTransactionFactory.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/SharedKey.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/TransactionDescriptorProcessor.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/Transforms.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/__init__.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/external/__init__.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/external/ed25519.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/facade/BatchOperations.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/facade/NemFacade.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/facade/__init__.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/impl/CipherHelpers.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/impl/__init__.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/nc/__init__.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/nem/KeyPair.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/nem/MessageEncoder.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/nem/Network.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/nem/SharedKey.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/nem/__init__.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/ripemd160.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/symbol/KeyPair.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/symbol/Merkle.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/symbol/MessageEncoder.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/symbol/Metadata.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/symbol/SharedKey.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/symbol/VotingKeysGenerator.py +0 -0
- {symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/symbol/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: symbol-sdk-python
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.3.1
|
|
4
4
|
Summary: Symbol SDK
|
|
5
5
|
Home-page: https://github.com/symbol/symbol/tree/main/sdk/python
|
|
6
6
|
License: MIT
|
|
@@ -9,16 +9,18 @@ Author: Symbol Contributors
|
|
|
9
9
|
Author-email: contributors@symbol.dev
|
|
10
10
|
Maintainer: Symbol Contributors
|
|
11
11
|
Maintainer-email: contributors@symbol.dev
|
|
12
|
-
Requires-Python: >=3.
|
|
12
|
+
Requires-Python: >=3.10,<4.0
|
|
13
13
|
Classifier: License :: OSI Approved :: MIT License
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.
|
|
18
|
-
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Requires-Dist: cryptography (>=46.0.1,<46.1.0)
|
|
19
21
|
Requires-Dist: mnemonic (>=0.20,<1.0)
|
|
20
|
-
Requires-Dist: pillow (>=
|
|
21
|
-
Requires-Dist: pynacl (>=1.
|
|
22
|
+
Requires-Dist: pillow (>=12.2.0,<12.3.0)
|
|
23
|
+
Requires-Dist: pynacl (>=1.6.0,<1.7.0)
|
|
22
24
|
Requires-Dist: pyyaml (>=6.0.1,<6.1.0)
|
|
23
25
|
Requires-Dist: pyzbar (>=0.1.9,<0.2.0)
|
|
24
26
|
Requires-Dist: qrcode (>=8.0,<9.0)
|
|
@@ -31,12 +33,12 @@ Description-Content-Type: text/markdown
|
|
|
31
33
|
|
|
32
34
|
[![lint][sdk-python-lint]][sdk-python-job] [![test][sdk-python-test]][sdk-python-job] [![vectors][sdk-python-vectors]][sdk-python-job] [![][sdk-python-cov]][sdk-python-cov-link] [![][sdk-python-package]][sdk-python-package-link]
|
|
33
35
|
|
|
34
|
-
[sdk-python-job]: https://jenkins.
|
|
35
|
-
[sdk-python-lint]: https://jenkins.
|
|
36
|
-
[sdk-python-build]: https://jenkins.
|
|
37
|
-
[sdk-python-test]: https://jenkins.
|
|
38
|
-
[sdk-python-examples]: https://jenkins.
|
|
39
|
-
[sdk-python-vectors]: https://jenkins.
|
|
36
|
+
[sdk-python-job]: https://jenkins.symbolsyndicate.us/blue/organizations/jenkins/Symbol%2Fgenerated%2Fsymbol%2Fpython/activity?branch=dev
|
|
37
|
+
[sdk-python-lint]: https://jenkins.symbolsyndicate.us/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-lint
|
|
38
|
+
[sdk-python-build]: https://jenkins.symbolsyndicate.us/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-build
|
|
39
|
+
[sdk-python-test]: https://jenkins.symbolsyndicate.us/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-test
|
|
40
|
+
[sdk-python-examples]: https://jenkins.symbolsyndicate.us/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-examples
|
|
41
|
+
[sdk-python-vectors]: https://jenkins.symbolsyndicate.us/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-vectors
|
|
40
42
|
[sdk-python-cov]: https://codecov.io/gh/symbol/symbol/branch/dev/graph/badge.svg?token=SSYYBMK0M7&flag=sdk-python
|
|
41
43
|
[sdk-python-cov-link]: https://codecov.io/gh/symbol/symbol/tree/dev/sdk/python
|
|
42
44
|
[sdk-python-package]: https://img.shields.io/pypi/v/symbol-sdk-python
|
|
@@ -62,9 +64,9 @@ facade = SymbolFacade('testnet')
|
|
|
62
64
|
_NEM_
|
|
63
65
|
```python
|
|
64
66
|
from symbolchain.CryptoTypes import PrivateKey
|
|
65
|
-
from symbolchain.facade.
|
|
67
|
+
from symbolchain.facade.NemFacade import NemFacade
|
|
66
68
|
|
|
67
|
-
facade =
|
|
69
|
+
facade = NemFacade('testnet')
|
|
68
70
|
````
|
|
69
71
|
|
|
70
72
|
Second, describe the transaction using a Python dictionary. For example, a transfer transaction can be described as follows:
|
|
@@ -103,7 +105,7 @@ Third, sign the transaction and attach the signature:
|
|
|
103
105
|
private_key = PrivateKey('EDB671EB741BD676969D8A035271D1EE5E75DF33278083D877F23615EB839FEC')
|
|
104
106
|
signature = facade.sign_transaction(facade.KeyPair(private_key), transaction)
|
|
105
107
|
|
|
106
|
-
json_payload = facade.
|
|
108
|
+
json_payload = facade.transaction_factory.attach_signature(transaction, signature)
|
|
107
109
|
```
|
|
108
110
|
|
|
109
111
|
Finally, send the payload to the desired network using the specified node endpoint:
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
[![lint][sdk-python-lint]][sdk-python-job] [![test][sdk-python-test]][sdk-python-job] [![vectors][sdk-python-vectors]][sdk-python-job] [![][sdk-python-cov]][sdk-python-cov-link] [![][sdk-python-package]][sdk-python-package-link]
|
|
4
4
|
|
|
5
|
-
[sdk-python-job]: https://jenkins.
|
|
6
|
-
[sdk-python-lint]: https://jenkins.
|
|
7
|
-
[sdk-python-build]: https://jenkins.
|
|
8
|
-
[sdk-python-test]: https://jenkins.
|
|
9
|
-
[sdk-python-examples]: https://jenkins.
|
|
10
|
-
[sdk-python-vectors]: https://jenkins.
|
|
5
|
+
[sdk-python-job]: https://jenkins.symbolsyndicate.us/blue/organizations/jenkins/Symbol%2Fgenerated%2Fsymbol%2Fpython/activity?branch=dev
|
|
6
|
+
[sdk-python-lint]: https://jenkins.symbolsyndicate.us/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-lint
|
|
7
|
+
[sdk-python-build]: https://jenkins.symbolsyndicate.us/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-build
|
|
8
|
+
[sdk-python-test]: https://jenkins.symbolsyndicate.us/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-test
|
|
9
|
+
[sdk-python-examples]: https://jenkins.symbolsyndicate.us/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-examples
|
|
10
|
+
[sdk-python-vectors]: https://jenkins.symbolsyndicate.us/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-vectors
|
|
11
11
|
[sdk-python-cov]: https://codecov.io/gh/symbol/symbol/branch/dev/graph/badge.svg?token=SSYYBMK0M7&flag=sdk-python
|
|
12
12
|
[sdk-python-cov-link]: https://codecov.io/gh/symbol/symbol/tree/dev/sdk/python
|
|
13
13
|
[sdk-python-package]: https://img.shields.io/pypi/v/symbol-sdk-python
|
|
@@ -33,9 +33,9 @@ facade = SymbolFacade('testnet')
|
|
|
33
33
|
_NEM_
|
|
34
34
|
```python
|
|
35
35
|
from symbolchain.CryptoTypes import PrivateKey
|
|
36
|
-
from symbolchain.facade.
|
|
36
|
+
from symbolchain.facade.NemFacade import NemFacade
|
|
37
37
|
|
|
38
|
-
facade =
|
|
38
|
+
facade = NemFacade('testnet')
|
|
39
39
|
````
|
|
40
40
|
|
|
41
41
|
Second, describe the transaction using a Python dictionary. For example, a transfer transaction can be described as follows:
|
|
@@ -74,7 +74,7 @@ Third, sign the transaction and attach the signature:
|
|
|
74
74
|
private_key = PrivateKey('EDB671EB741BD676969D8A035271D1EE5E75DF33278083D877F23615EB839FEC')
|
|
75
75
|
signature = facade.sign_transaction(facade.KeyPair(private_key), transaction)
|
|
76
76
|
|
|
77
|
-
json_payload = facade.
|
|
77
|
+
json_payload = facade.transaction_factory.attach_signature(transaction, signature)
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
Finally, send the payload to the desired network using the specified node endpoint:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = 'symbol-sdk-python'
|
|
3
|
-
version = '3.
|
|
3
|
+
version = '3.3.1'
|
|
4
4
|
description = 'Symbol SDK'
|
|
5
5
|
authors = ['Symbol Contributors <contributors@symbol.dev>']
|
|
6
6
|
maintainers = ['Symbol Contributors <contributors@symbol.dev>']
|
|
@@ -14,14 +14,14 @@ repository = 'https://github.com/symbol/symbol/tree/main/sdk/python'
|
|
|
14
14
|
|
|
15
15
|
keywords = ['symbol', 'sdk', 'Symbol SDK']
|
|
16
16
|
|
|
17
|
-
classifiers = ['Programming Language :: Python :: 3.
|
|
17
|
+
classifiers = ['Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3.13', 'Programming Language :: Python :: 3.14']
|
|
18
18
|
|
|
19
19
|
[tool.poetry.dependencies]
|
|
20
|
-
python = "^3.
|
|
21
|
-
cryptography = ">=
|
|
20
|
+
python = "^3.10"
|
|
21
|
+
cryptography = ">=46.0.1,<46.1.0"
|
|
22
22
|
mnemonic = ">=0.20,<1.0"
|
|
23
|
-
pillow = ">=
|
|
24
|
-
pynacl = ">=1.
|
|
23
|
+
pillow = ">=12.2.0,<12.3.0"
|
|
24
|
+
pynacl = ">=1.6.0,<1.7.0"
|
|
25
25
|
pyyaml = ">=6.0.1,<6.1.0"
|
|
26
26
|
pyzbar = ">=0.1.9,<0.2.0"
|
|
27
27
|
qrcode = ">=8.0,<9.0"
|
|
@@ -19,13 +19,17 @@ TRANSACTION_HEADER_SIZE = sum(field[1] for field in [
|
|
|
19
19
|
('reserved2', 4)
|
|
20
20
|
])
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
PRE_V3_AGGREGATE_HASHED_SIZE = sum(field[1] for field in [
|
|
23
23
|
('version_network_type', 4),
|
|
24
24
|
('max_fee', 8),
|
|
25
25
|
('deadline', 8),
|
|
26
26
|
('transactions_hash', Hash256.SIZE)
|
|
27
27
|
])
|
|
28
28
|
|
|
29
|
+
AGGREGATE_HASHED_SIZE = PRE_V3_AGGREGATE_HASHED_SIZE + sum(field[1] for field in [
|
|
30
|
+
('payload_size', 4)
|
|
31
|
+
])
|
|
32
|
+
|
|
29
33
|
|
|
30
34
|
# region SymbolPublicAccount / SymbolAccount
|
|
31
35
|
|
|
@@ -181,6 +185,7 @@ class SymbolFacade:
|
|
|
181
185
|
data_buffer_start = TRANSACTION_HEADER_SIZE
|
|
182
186
|
data_buffer_end = len(transaction_buffer)
|
|
183
187
|
if SymbolFacade._is_aggregate_transaction(transaction_buffer):
|
|
184
|
-
|
|
188
|
+
version = transaction_buffer[TRANSACTION_HEADER_SIZE]
|
|
189
|
+
data_buffer_end = TRANSACTION_HEADER_SIZE + (AGGREGATE_HASHED_SIZE if version >= 3 else PRE_V3_AGGREGATE_HASHED_SIZE)
|
|
185
190
|
|
|
186
191
|
return transaction_buffer[data_buffer_start:data_buffer_end]
|
|
@@ -66,9 +66,13 @@ class TransactionFactory:
|
|
|
66
66
|
def attach_signature(transaction, signature):
|
|
67
67
|
"""Attaches a signature to a transaction."""
|
|
68
68
|
transaction.signature = nc.Signature(signature.bytes)
|
|
69
|
+
return TransactionFactory.to_json(transaction)
|
|
69
70
|
|
|
71
|
+
@staticmethod
|
|
72
|
+
def to_json(transaction):
|
|
73
|
+
"""Generates a JSON representation of transaction that can be sent to a node."""
|
|
70
74
|
transaction_hex = hexlify(TransactionFactory.to_non_verifiable_transaction(transaction).serialize()).decode('utf8').upper()
|
|
71
|
-
signature_hex = str(signature)
|
|
75
|
+
signature_hex = str(transaction.signature)
|
|
72
76
|
json_payload = f'{{"data":"{transaction_hex}", "signature":"{signature_hex}"}}'
|
|
73
77
|
return json_payload
|
|
74
78
|
|
|
@@ -4249,6 +4249,114 @@ class AggregateCompleteTransactionV2(Transaction):
|
|
|
4249
4249
|
return result
|
|
4250
4250
|
|
|
4251
4251
|
|
|
4252
|
+
class AggregateCompleteTransactionV3(Transaction):
|
|
4253
|
+
TRANSACTION_VERSION: int = 3
|
|
4254
|
+
TRANSACTION_TYPE: TransactionType = TransactionType.AGGREGATE_COMPLETE
|
|
4255
|
+
TYPE_HINTS = {
|
|
4256
|
+
**Transaction.TYPE_HINTS,
|
|
4257
|
+
'transactions_hash': 'pod:Hash256',
|
|
4258
|
+
'transactions': 'array[EmbeddedTransaction]',
|
|
4259
|
+
'cosignatures': 'array[Cosignature]'
|
|
4260
|
+
}
|
|
4261
|
+
|
|
4262
|
+
def __init__(self):
|
|
4263
|
+
super().__init__()
|
|
4264
|
+
self._version = AggregateCompleteTransactionV3.TRANSACTION_VERSION
|
|
4265
|
+
self._type_ = AggregateCompleteTransactionV3.TRANSACTION_TYPE
|
|
4266
|
+
self._transactions_hash = Hash256()
|
|
4267
|
+
self._transactions = []
|
|
4268
|
+
self._cosignatures = []
|
|
4269
|
+
self._aggregate_transaction_header_reserved_1 = 0 # reserved field
|
|
4270
|
+
|
|
4271
|
+
def sort(self) -> None:
|
|
4272
|
+
pass
|
|
4273
|
+
|
|
4274
|
+
@property
|
|
4275
|
+
def transactions_hash(self) -> Hash256:
|
|
4276
|
+
return self._transactions_hash
|
|
4277
|
+
|
|
4278
|
+
@property
|
|
4279
|
+
def transactions(self) -> List[EmbeddedTransaction]:
|
|
4280
|
+
return self._transactions
|
|
4281
|
+
|
|
4282
|
+
@property
|
|
4283
|
+
def cosignatures(self) -> List[Cosignature]:
|
|
4284
|
+
return self._cosignatures
|
|
4285
|
+
|
|
4286
|
+
@transactions_hash.setter
|
|
4287
|
+
def transactions_hash(self, value: Hash256):
|
|
4288
|
+
self._transactions_hash = value
|
|
4289
|
+
|
|
4290
|
+
@transactions.setter
|
|
4291
|
+
def transactions(self, value: List[EmbeddedTransaction]):
|
|
4292
|
+
self._transactions = value
|
|
4293
|
+
|
|
4294
|
+
@cosignatures.setter
|
|
4295
|
+
def cosignatures(self, value: List[Cosignature]):
|
|
4296
|
+
self._cosignatures = value
|
|
4297
|
+
|
|
4298
|
+
@property
|
|
4299
|
+
def size(self) -> int:
|
|
4300
|
+
size = 0
|
|
4301
|
+
size += super().size
|
|
4302
|
+
size += self.transactions_hash.size
|
|
4303
|
+
size += 4
|
|
4304
|
+
size += 4
|
|
4305
|
+
size += ArrayHelpers.size(self.transactions, 8, skip_last_element_padding=False)
|
|
4306
|
+
size += ArrayHelpers.size(self.cosignatures)
|
|
4307
|
+
return size
|
|
4308
|
+
|
|
4309
|
+
@classmethod
|
|
4310
|
+
def deserialize(cls, payload: bytes | bytearray | memoryview) -> AggregateCompleteTransactionV3:
|
|
4311
|
+
buffer = memoryview(payload)
|
|
4312
|
+
instance = AggregateCompleteTransactionV3()
|
|
4313
|
+
(window_start, window_end) = Transaction._deserialize(buffer, instance)
|
|
4314
|
+
buffer = buffer[window_start:window_end]
|
|
4315
|
+
transactions_hash = Hash256.deserialize(buffer)
|
|
4316
|
+
buffer = buffer[transactions_hash.size:]
|
|
4317
|
+
payload_size = int.from_bytes(buffer[:4], byteorder='little', signed=False)
|
|
4318
|
+
buffer = buffer[4:]
|
|
4319
|
+
aggregate_transaction_header_reserved_1 = int.from_bytes(buffer[:4], byteorder='little', signed=False)
|
|
4320
|
+
buffer = buffer[4:]
|
|
4321
|
+
assert aggregate_transaction_header_reserved_1 == 0, f'Invalid value of reserved field ({aggregate_transaction_header_reserved_1})'
|
|
4322
|
+
transactions = ArrayHelpers.read_variable_size_elements(buffer[:payload_size], EmbeddedTransactionFactory, 8, skip_last_element_padding=False)
|
|
4323
|
+
buffer = buffer[payload_size:]
|
|
4324
|
+
cosignatures = ArrayHelpers.read_array(buffer, Cosignature)
|
|
4325
|
+
buffer = buffer[ArrayHelpers.size(cosignatures):]
|
|
4326
|
+
|
|
4327
|
+
# pylint: disable=protected-access
|
|
4328
|
+
instance._transactions_hash = transactions_hash
|
|
4329
|
+
instance._transactions = transactions
|
|
4330
|
+
instance._cosignatures = cosignatures
|
|
4331
|
+
return instance
|
|
4332
|
+
|
|
4333
|
+
def serialize(self) -> bytes:
|
|
4334
|
+
buffer = bytearray()
|
|
4335
|
+
super()._serialize(buffer)
|
|
4336
|
+
buffer += self._transactions_hash.serialize()
|
|
4337
|
+
buffer += ArrayHelpers.size(self.transactions, 8, skip_last_element_padding=False).to_bytes(4, byteorder='little', signed=False) # payload_size
|
|
4338
|
+
buffer += self._aggregate_transaction_header_reserved_1.to_bytes(4, byteorder='little', signed=False)
|
|
4339
|
+
buffer += ArrayHelpers.write_variable_size_elements(self._transactions, 8, skip_last_element_padding=False)
|
|
4340
|
+
buffer += ArrayHelpers.write_array(self._cosignatures)
|
|
4341
|
+
return buffer
|
|
4342
|
+
|
|
4343
|
+
def __str__(self) -> str:
|
|
4344
|
+
result = '('
|
|
4345
|
+
result += super().__str__()
|
|
4346
|
+
result += f'transactions_hash: {self._transactions_hash.__str__()}, '
|
|
4347
|
+
result += f'transactions: {list(map(str, self._transactions))}, '
|
|
4348
|
+
result += f'cosignatures: {list(map(str, self._cosignatures))}, '
|
|
4349
|
+
result += ')'
|
|
4350
|
+
return result
|
|
4351
|
+
|
|
4352
|
+
def to_json(self):
|
|
4353
|
+
result = {**super().to_json()}
|
|
4354
|
+
result['transactions_hash'] = self._transactions_hash.to_json()
|
|
4355
|
+
result['transactions'] = [e.to_json() for e in self._transactions]
|
|
4356
|
+
result['cosignatures'] = [e.to_json() for e in self._cosignatures]
|
|
4357
|
+
return result
|
|
4358
|
+
|
|
4359
|
+
|
|
4252
4360
|
class AggregateBondedTransactionV1(Transaction):
|
|
4253
4361
|
TRANSACTION_VERSION: int = 1
|
|
4254
4362
|
TRANSACTION_TYPE: TransactionType = TransactionType.AGGREGATE_BONDED
|
|
@@ -4465,6 +4573,114 @@ class AggregateBondedTransactionV2(Transaction):
|
|
|
4465
4573
|
return result
|
|
4466
4574
|
|
|
4467
4575
|
|
|
4576
|
+
class AggregateBondedTransactionV3(Transaction):
|
|
4577
|
+
TRANSACTION_VERSION: int = 3
|
|
4578
|
+
TRANSACTION_TYPE: TransactionType = TransactionType.AGGREGATE_BONDED
|
|
4579
|
+
TYPE_HINTS = {
|
|
4580
|
+
**Transaction.TYPE_HINTS,
|
|
4581
|
+
'transactions_hash': 'pod:Hash256',
|
|
4582
|
+
'transactions': 'array[EmbeddedTransaction]',
|
|
4583
|
+
'cosignatures': 'array[Cosignature]'
|
|
4584
|
+
}
|
|
4585
|
+
|
|
4586
|
+
def __init__(self):
|
|
4587
|
+
super().__init__()
|
|
4588
|
+
self._version = AggregateBondedTransactionV3.TRANSACTION_VERSION
|
|
4589
|
+
self._type_ = AggregateBondedTransactionV3.TRANSACTION_TYPE
|
|
4590
|
+
self._transactions_hash = Hash256()
|
|
4591
|
+
self._transactions = []
|
|
4592
|
+
self._cosignatures = []
|
|
4593
|
+
self._aggregate_transaction_header_reserved_1 = 0 # reserved field
|
|
4594
|
+
|
|
4595
|
+
def sort(self) -> None:
|
|
4596
|
+
pass
|
|
4597
|
+
|
|
4598
|
+
@property
|
|
4599
|
+
def transactions_hash(self) -> Hash256:
|
|
4600
|
+
return self._transactions_hash
|
|
4601
|
+
|
|
4602
|
+
@property
|
|
4603
|
+
def transactions(self) -> List[EmbeddedTransaction]:
|
|
4604
|
+
return self._transactions
|
|
4605
|
+
|
|
4606
|
+
@property
|
|
4607
|
+
def cosignatures(self) -> List[Cosignature]:
|
|
4608
|
+
return self._cosignatures
|
|
4609
|
+
|
|
4610
|
+
@transactions_hash.setter
|
|
4611
|
+
def transactions_hash(self, value: Hash256):
|
|
4612
|
+
self._transactions_hash = value
|
|
4613
|
+
|
|
4614
|
+
@transactions.setter
|
|
4615
|
+
def transactions(self, value: List[EmbeddedTransaction]):
|
|
4616
|
+
self._transactions = value
|
|
4617
|
+
|
|
4618
|
+
@cosignatures.setter
|
|
4619
|
+
def cosignatures(self, value: List[Cosignature]):
|
|
4620
|
+
self._cosignatures = value
|
|
4621
|
+
|
|
4622
|
+
@property
|
|
4623
|
+
def size(self) -> int:
|
|
4624
|
+
size = 0
|
|
4625
|
+
size += super().size
|
|
4626
|
+
size += self.transactions_hash.size
|
|
4627
|
+
size += 4
|
|
4628
|
+
size += 4
|
|
4629
|
+
size += ArrayHelpers.size(self.transactions, 8, skip_last_element_padding=False)
|
|
4630
|
+
size += ArrayHelpers.size(self.cosignatures)
|
|
4631
|
+
return size
|
|
4632
|
+
|
|
4633
|
+
@classmethod
|
|
4634
|
+
def deserialize(cls, payload: bytes | bytearray | memoryview) -> AggregateBondedTransactionV3:
|
|
4635
|
+
buffer = memoryview(payload)
|
|
4636
|
+
instance = AggregateBondedTransactionV3()
|
|
4637
|
+
(window_start, window_end) = Transaction._deserialize(buffer, instance)
|
|
4638
|
+
buffer = buffer[window_start:window_end]
|
|
4639
|
+
transactions_hash = Hash256.deserialize(buffer)
|
|
4640
|
+
buffer = buffer[transactions_hash.size:]
|
|
4641
|
+
payload_size = int.from_bytes(buffer[:4], byteorder='little', signed=False)
|
|
4642
|
+
buffer = buffer[4:]
|
|
4643
|
+
aggregate_transaction_header_reserved_1 = int.from_bytes(buffer[:4], byteorder='little', signed=False)
|
|
4644
|
+
buffer = buffer[4:]
|
|
4645
|
+
assert aggregate_transaction_header_reserved_1 == 0, f'Invalid value of reserved field ({aggregate_transaction_header_reserved_1})'
|
|
4646
|
+
transactions = ArrayHelpers.read_variable_size_elements(buffer[:payload_size], EmbeddedTransactionFactory, 8, skip_last_element_padding=False)
|
|
4647
|
+
buffer = buffer[payload_size:]
|
|
4648
|
+
cosignatures = ArrayHelpers.read_array(buffer, Cosignature)
|
|
4649
|
+
buffer = buffer[ArrayHelpers.size(cosignatures):]
|
|
4650
|
+
|
|
4651
|
+
# pylint: disable=protected-access
|
|
4652
|
+
instance._transactions_hash = transactions_hash
|
|
4653
|
+
instance._transactions = transactions
|
|
4654
|
+
instance._cosignatures = cosignatures
|
|
4655
|
+
return instance
|
|
4656
|
+
|
|
4657
|
+
def serialize(self) -> bytes:
|
|
4658
|
+
buffer = bytearray()
|
|
4659
|
+
super()._serialize(buffer)
|
|
4660
|
+
buffer += self._transactions_hash.serialize()
|
|
4661
|
+
buffer += ArrayHelpers.size(self.transactions, 8, skip_last_element_padding=False).to_bytes(4, byteorder='little', signed=False) # payload_size
|
|
4662
|
+
buffer += self._aggregate_transaction_header_reserved_1.to_bytes(4, byteorder='little', signed=False)
|
|
4663
|
+
buffer += ArrayHelpers.write_variable_size_elements(self._transactions, 8, skip_last_element_padding=False)
|
|
4664
|
+
buffer += ArrayHelpers.write_array(self._cosignatures)
|
|
4665
|
+
return buffer
|
|
4666
|
+
|
|
4667
|
+
def __str__(self) -> str:
|
|
4668
|
+
result = '('
|
|
4669
|
+
result += super().__str__()
|
|
4670
|
+
result += f'transactions_hash: {self._transactions_hash.__str__()}, '
|
|
4671
|
+
result += f'transactions: {list(map(str, self._transactions))}, '
|
|
4672
|
+
result += f'cosignatures: {list(map(str, self._cosignatures))}, '
|
|
4673
|
+
result += ')'
|
|
4674
|
+
return result
|
|
4675
|
+
|
|
4676
|
+
def to_json(self):
|
|
4677
|
+
result = {**super().to_json()}
|
|
4678
|
+
result['transactions_hash'] = self._transactions_hash.to_json()
|
|
4679
|
+
result['transactions'] = [e.to_json() for e in self._transactions]
|
|
4680
|
+
result['cosignatures'] = [e.to_json() for e in self._cosignatures]
|
|
4681
|
+
return result
|
|
4682
|
+
|
|
4683
|
+
|
|
4468
4684
|
class VotingKeyLinkTransactionV1(Transaction):
|
|
4469
4685
|
TRANSACTION_VERSION: int = 1
|
|
4470
4686
|
TRANSACTION_TYPE: TransactionType = TransactionType.VOTING_KEY_LINK
|
|
@@ -9553,8 +9769,10 @@ class TransactionFactory:
|
|
|
9553
9769
|
(NodeKeyLinkTransactionV1.TRANSACTION_TYPE, NodeKeyLinkTransactionV1.TRANSACTION_VERSION): NodeKeyLinkTransactionV1,
|
|
9554
9770
|
(AggregateCompleteTransactionV1.TRANSACTION_TYPE, AggregateCompleteTransactionV1.TRANSACTION_VERSION): AggregateCompleteTransactionV1,
|
|
9555
9771
|
(AggregateCompleteTransactionV2.TRANSACTION_TYPE, AggregateCompleteTransactionV2.TRANSACTION_VERSION): AggregateCompleteTransactionV2,
|
|
9772
|
+
(AggregateCompleteTransactionV3.TRANSACTION_TYPE, AggregateCompleteTransactionV3.TRANSACTION_VERSION): AggregateCompleteTransactionV3,
|
|
9556
9773
|
(AggregateBondedTransactionV1.TRANSACTION_TYPE, AggregateBondedTransactionV1.TRANSACTION_VERSION): AggregateBondedTransactionV1,
|
|
9557
9774
|
(AggregateBondedTransactionV2.TRANSACTION_TYPE, AggregateBondedTransactionV2.TRANSACTION_VERSION): AggregateBondedTransactionV2,
|
|
9775
|
+
(AggregateBondedTransactionV3.TRANSACTION_TYPE, AggregateBondedTransactionV3.TRANSACTION_VERSION): AggregateBondedTransactionV3,
|
|
9558
9776
|
(VotingKeyLinkTransactionV1.TRANSACTION_TYPE, VotingKeyLinkTransactionV1.TRANSACTION_VERSION): VotingKeyLinkTransactionV1,
|
|
9559
9777
|
(VrfKeyLinkTransactionV1.TRANSACTION_TYPE, VrfKeyLinkTransactionV1.TRANSACTION_VERSION): VrfKeyLinkTransactionV1,
|
|
9560
9778
|
(HashLockTransactionV1.TRANSACTION_TYPE, HashLockTransactionV1.TRANSACTION_VERSION): HashLockTransactionV1,
|
|
@@ -9588,8 +9806,10 @@ class TransactionFactory:
|
|
|
9588
9806
|
'node_key_link_transaction_v1': NodeKeyLinkTransactionV1,
|
|
9589
9807
|
'aggregate_complete_transaction_v1': AggregateCompleteTransactionV1,
|
|
9590
9808
|
'aggregate_complete_transaction_v2': AggregateCompleteTransactionV2,
|
|
9809
|
+
'aggregate_complete_transaction_v3': AggregateCompleteTransactionV3,
|
|
9591
9810
|
'aggregate_bonded_transaction_v1': AggregateBondedTransactionV1,
|
|
9592
9811
|
'aggregate_bonded_transaction_v2': AggregateBondedTransactionV2,
|
|
9812
|
+
'aggregate_bonded_transaction_v3': AggregateBondedTransactionV3,
|
|
9593
9813
|
'voting_key_link_transaction_v1': VotingKeyLinkTransactionV1,
|
|
9594
9814
|
'vrf_key_link_transaction_v1': VrfKeyLinkTransactionV1,
|
|
9595
9815
|
'hash_lock_transaction_v1': HashLockTransactionV1,
|
|
@@ -19,6 +19,9 @@ def generate_mosaic_id(owner_address, nonce):
|
|
|
19
19
|
|
|
20
20
|
def generate_namespace_id(name, parent_namespace_id=0):
|
|
21
21
|
"""Generates a namespace id from a name and an optional parent namespace id."""
|
|
22
|
+
if '.' in name:
|
|
23
|
+
raise ValueError(f'\'name\' cannot contain \'.\'; if {name} is a namepace path, consider using generate_namespace_path')
|
|
24
|
+
|
|
22
25
|
hasher = hashlib.sha3_256()
|
|
23
26
|
hasher.update(parent_namespace_id.to_bytes(8, 'little'))
|
|
24
27
|
hasher.update(name.encode('utf8'))
|
|
@@ -33,6 +36,11 @@ def generate_mosaic_alias_id(fully_qualified_name):
|
|
|
33
36
|
return generate_namespace_path(fully_qualified_name)[-1]
|
|
34
37
|
|
|
35
38
|
|
|
39
|
+
def is_mosaic_alias(mosaic_id):
|
|
40
|
+
"""Determines if mosaic_id is an alias."""
|
|
41
|
+
return 0 != (mosaic_id & NAMESPACE_FLAG)
|
|
42
|
+
|
|
43
|
+
|
|
36
44
|
def is_valid_namespace_name(name):
|
|
37
45
|
"""Returns true if a name is a valid namespace name."""
|
|
38
46
|
def is_alphanum(character):
|
|
@@ -41,11 +41,16 @@ class Address(ByteArray):
|
|
|
41
41
|
def to_namespace_id(self):
|
|
42
42
|
"""Attempts to convert this address into a namespace id."""
|
|
43
43
|
|
|
44
|
-
if not self.
|
|
44
|
+
if not self.is_alias():
|
|
45
45
|
return None
|
|
46
46
|
|
|
47
47
|
return NamespaceId(int.from_bytes(self.bytes[1:9], 'little'))
|
|
48
48
|
|
|
49
|
+
def is_alias(self):
|
|
50
|
+
"""Determines if this address is an alias."""
|
|
51
|
+
|
|
52
|
+
return 0 != (self.bytes[0] & 0x01)
|
|
53
|
+
|
|
49
54
|
def __str__(self):
|
|
50
55
|
return base64.b32encode(self.bytes + bytes(0)).decode('utf8')[0:-1]
|
|
51
56
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import hashlib
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def mosaic_restriction_generate_key(seed):
|
|
5
|
+
"""Generates a mosaic restriction key from a string."""
|
|
6
|
+
|
|
7
|
+
hash_result = hashlib.sha3_256(seed.encode('utf8')).digest()
|
|
8
|
+
key_bytes = bytearray(hash_result[:8])
|
|
9
|
+
|
|
10
|
+
return int.from_bytes(key_bytes, 'little')
|
{symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/symbol/TransactionFactory.py
RENAMED
|
@@ -69,7 +69,11 @@ class TransactionFactory:
|
|
|
69
69
|
def attach_signature(transaction, signature):
|
|
70
70
|
"""Attaches a signature to a transaction."""
|
|
71
71
|
transaction.signature = sc.Signature(signature.bytes)
|
|
72
|
+
return TransactionFactory.to_json(transaction)
|
|
72
73
|
|
|
74
|
+
@staticmethod
|
|
75
|
+
def to_json(transaction):
|
|
76
|
+
"""Generates a JSON representation of transaction that can be sent to a node."""
|
|
73
77
|
transaction_buffer = transaction.serialize()
|
|
74
78
|
hex_payload = hexlify(transaction_buffer).decode('utf8').upper()
|
|
75
79
|
json_payload = f'{{"payload": "{hex_payload}"}}'
|
{symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/AccountDescriptorRepository.py
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
|
{symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/RuleBasedTransactionFactory.py
RENAMED
|
File without changes
|
|
File without changes
|
{symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/TransactionDescriptorProcessor.py
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
|
{symbol_sdk_python-3.2.3 → symbol_sdk_python-3.3.1}/symbolchain/symbol/VotingKeysGenerator.py
RENAMED
|
File without changes
|
|
File without changes
|