symbol-sdk-python 3.3.2__py3-none-any.whl → 3.3.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: symbol-sdk-python
3
- Version: 3.3.2
3
+ Version: 3.3.3
4
4
  Summary: Symbol SDK
5
5
  Home-page: https://github.com/symbol/symbol/tree/main/sdk/python
6
6
  License: MIT
@@ -17,9 +17,9 @@ Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
18
  Classifier: Programming Language :: Python :: 3.13
19
19
  Classifier: Programming Language :: Python :: 3.14
20
- Requires-Dist: cryptography (>=49.0.0,<49.1.0)
20
+ Requires-Dist: cryptography (>=50.0.0,<50.1.0)
21
21
  Requires-Dist: mnemonic (>=0.20,<1.0)
22
- Requires-Dist: pillow (>=12.2.0,<12.3.0)
22
+ Requires-Dist: pillow (>=12.3.0,<12.4.0)
23
23
  Requires-Dist: pynacl (>=1.6.0,<1.7.0)
24
24
  Requires-Dist: pyyaml (>=6.0.1,<6.1.0)
25
25
  Requires-Dist: pyzbar (>=0.1.9,<0.2.0)
@@ -17,7 +17,7 @@ symbolchain/Ordered.py,sha256=--tQ_aZpXhZYcsRLgMjUNHPYlAH7BMfuss2CSxMvNhY,397
17
17
  symbolchain/PrivateKeyStorage.py,sha256=dACQnqY1nDtNbfItdrG1iyqbnNnEv8G_sntDCD5crs8,1606
18
18
  symbolchain/QrSignatureStorage.py,sha256=-KM2QdzkBwOrydxyTLttdDBcZ4vk0O-gwZ51PWdwEDQ,1348
19
19
  symbolchain/QrStorage.py,sha256=ch1XsJ-zkZ27hYd_I_ZfChuIyp-k41R3tbTb8LHy6Ik,1494
20
- symbolchain/RuleBasedTransactionFactory.py,sha256=Bd-b3DFmTeEuZrTKwKHGO7Y38FnlfHt65TEEcF3kNRI,5526
20
+ symbolchain/RuleBasedTransactionFactory.py,sha256=LSnFtUbIn_AO8IgnSmMSYnePdpMp4LhZcsGxkRKwwtI,5560
21
21
  symbolchain/SharedKey.py,sha256=cnVwHLznU7RKcqhxDcLc9QfRwSHI9Fm9tzanSjsnQsQ,593
22
22
  symbolchain/TransactionDescriptorProcessor.py,sha256=XeEuWs8EFGKV8SBDm_tG9KWMjWMsvL8G4PHJrTl57uE,1806
23
23
  symbolchain/Transforms.py,sha256=NtSWiq3ntvylwq1VoQ4S1OIeNnVOBekWDK-Vf2uo-ZI,226
@@ -25,8 +25,8 @@ symbolchain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  symbolchain/external/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  symbolchain/external/ed25519.py,sha256=xpq-UOQ3CNCZp4V2uaHsWeyEfXezCfWe44NKsecZCqU,7833
27
27
  symbolchain/facade/BatchOperations.py,sha256=SQR6fXTi1mI7H7ubJsqYEabWQzzVXhbD8BkzgIpoCII,2983
28
- symbolchain/facade/NemFacade.py,sha256=qCaFie17Q1R4wRQqiedKEywJH8yq_CjY_-b9dLgiZQk,4226
29
- symbolchain/facade/SymbolFacade.py,sha256=jUlaHJqWxamJhAnNv367Ja__lf2IM4nNIgIumzcyEd4,7220
28
+ symbolchain/facade/NemFacade.py,sha256=1WpY2Clk-t2wKkMOBVhAGqVzwP0LmwUq-WrfbAsGIiA,4669
29
+ symbolchain/facade/SymbolFacade.py,sha256=BFqu7e-XRAe6Zvc6lvn3vXGU4IdQFzWxCuBp8y_uUDE,8696
30
30
  symbolchain/facade/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  symbolchain/impl/CipherHelpers.py,sha256=KSYH95oie-PxFfGAYfnqHOC1RWIrdxC7Vp6Go-o469Q,2152
32
32
  symbolchain/impl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -40,7 +40,7 @@ symbolchain/nem/TransactionFactory.py,sha256=UKc54dTiT7Q8jYcIOWcv0uT1bkE_05okevY
40
40
  symbolchain/nem/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
41
  symbolchain/ripemd160.py,sha256=u2uv8wJY5FY8tll_EfiGE5o65Ri6E-8HbynvJUPBJa8,429
42
42
  symbolchain/sc/__init__.py,sha256=Po_ezk7y9Rr_xESvHExyq420FRro5un2KvSnojVf3hg,317964
43
- symbolchain/symbol/FeeCalculator.py,sha256=BmWjyGZeAJEW6LJpT2l8aXQcB4KongfKtzQ6CvO1k-0,280
43
+ symbolchain/symbol/FeeCalculator.py,sha256=_R8D6ZoSVNbS7xvmx-WkDSpfPIL2qzRLbNJ7Roi7Ou8,282
44
44
  symbolchain/symbol/IdGenerator.py,sha256=_QCFDtdVrrlEpT7PEOtCtcv-WaLbyi7rg0F9M1JRRNk,1957
45
45
  symbolchain/symbol/KeyPair.py,sha256=CkQh7oOeVRbjKewTfln0t1PZckcTuIXb2roY1zZjVrc,1506
46
46
  symbolchain/symbol/Merkle.py,sha256=FrCwnveXEoXEx7xFP4UC_htjAVuVeUNbvnh8YDdy3z0,7243
@@ -52,6 +52,6 @@ symbolchain/symbol/SharedKey.py,sha256=Bg1qYW_iMNYKtokep5S1m9b7GfywM5OGaCrVUdt01
52
52
  symbolchain/symbol/TransactionFactory.py,sha256=YkQC2yBI5pSuSTc7-Aivh9kIKt32-Ho9XYWbbye2syw,4131
53
53
  symbolchain/symbol/VotingKeysGenerator.py,sha256=tuJ6yl2CqqQ9uupAw3z-GJIW20WOsblcLQb2_fPUCDE,1686
54
54
  symbolchain/symbol/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
- symbol_sdk_python-3.3.2.dist-info/METADATA,sha256=uFFkPwbCBMS07zX1E3xPmtuH6s_y3fOIPSzFY368EdA,5707
56
- symbol_sdk_python-3.3.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
57
- symbol_sdk_python-3.3.2.dist-info/RECORD,,
55
+ symbol_sdk_python-3.3.3.dist-info/METADATA,sha256=ZwDfPFuT_w-3QeLVbvW62TIwXr5jWQnzdKmGfunvPPI,5707
56
+ symbol_sdk_python-3.3.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
57
+ symbol_sdk_python-3.3.3.dist-info/RECORD,,
@@ -165,7 +165,7 @@ class RuleBasedTransactionFactory:
165
165
  return
166
166
 
167
167
  for key, value in vars(entity).items():
168
- if '_' == key[0] and '_' == key[-1]: # skip system properties
168
+ if '_' == key[0] and '_' == key[-1] and key[1:-1] not in ('property'): # skip system properties
169
169
  continue
170
170
 
171
171
  if isinstance(value, str):
@@ -86,6 +86,17 @@ class NemFacade:
86
86
  """Creates a NEM account from a private key."""
87
87
  return NemAccount(self, KeyPair(private_key))
88
88
 
89
+ def create_transaction_from_descriptor(self, descriptor, signer_public_key, fee, deadline_seconds):
90
+ """Creates a transaction from a descriptor, adding signer, fee, timestamp and deadline to a copy of it."""
91
+ now = self.now()
92
+ return self.transaction_factory.create({
93
+ **descriptor,
94
+ 'signer_public_key': signer_public_key,
95
+ 'fee': fee,
96
+ 'timestamp': now.timestamp,
97
+ 'deadline': now.add_seconds(deadline_seconds).timestamp
98
+ })
99
+
89
100
  @staticmethod
90
101
  def hash_transaction(transaction):
91
102
  """Hashes a NEM transaction."""
@@ -115,6 +115,33 @@ class SymbolFacade:
115
115
  """Creates a Symbol account from a private key."""
116
116
  return SymbolAccount(self, KeyPair(private_key))
117
117
 
118
+ def create_transaction_from_descriptor(self, descriptor, signer_public_key, fee_multiplier, deadline_seconds, cosignature_count=0):
119
+ """
120
+ Creates a transaction from a descriptor, adding signer and deadline to a copy of it, with the fee computed as
121
+ (size + reserved cosignatures size) * fee_multiplier.
122
+ """
123
+ raw_descriptor = {
124
+ **descriptor,
125
+ 'signer_public_key': signer_public_key,
126
+ 'deadline': self.now().add_seconds(deadline_seconds).timestamp
127
+ }
128
+ transaction = self.transaction_factory.create(raw_descriptor)
129
+
130
+ # if cosignatures are specified in the descriptor, use the max of them and cosignature_count
131
+ cosignature_count_adjustment = cosignature_count
132
+ explicit_cosignatures = raw_descriptor.get('cosignatures')
133
+ if isinstance(explicit_cosignatures, list):
134
+ explicit_count = len(explicit_cosignatures)
135
+ cosignature_count_adjustment = 0 if explicit_count > cosignature_count else cosignature_count - explicit_count
136
+
137
+ transaction_with_cosignatures_size = transaction.size + cosignature_count_adjustment * sc.Cosignature().size
138
+ transaction.fee = sc.Amount(transaction_with_cosignatures_size * fee_multiplier)
139
+ return transaction
140
+
141
+ def create_embedded_transaction_from_descriptor(self, descriptor, signer_public_key): # pylint: disable=invalid-name
142
+ """Creates an embedded transaction from a descriptor, adding signer to a copy of it."""
143
+ return self.transaction_factory.create_embedded({**descriptor, 'signer_public_key': signer_public_key})
144
+
118
145
  def hash_transaction(self, transaction):
119
146
  """Hashes a Symbol transaction."""
120
147
  hasher = hashlib.sha3_256()
@@ -4,4 +4,4 @@ from symbolchain.sc import Cosignature
4
4
  def calculate_transaction_fee(transaction, fee_multiplier, cosignature_count=0):
5
5
  """Calculates the minimum required transaction fee for a transaction."""
6
6
 
7
- return transaction.size * fee_multiplier + Cosignature().size * cosignature_count
7
+ return (transaction.size + Cosignature().size * cosignature_count) * fee_multiplier