File tree 2 files changed +13
-0
lines changed
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -315,6 +315,10 @@ def hash(self) -> bytes:
315
315
self .to_cbor (encoding = "bytes" ), TRANSACTION_HASH_SIZE , encoder = RawEncoder
316
316
)
317
317
318
+ @property
319
+ def id (self ) -> TransactionId :
320
+ return TransactionId (self .hash ())
321
+
318
322
319
323
@dataclass (repr = False )
320
324
class Transaction (ArrayCBORSerializable ):
@@ -325,3 +329,7 @@ class Transaction(ArrayCBORSerializable):
325
329
valid : bool = True
326
330
327
331
auxiliary_data : Union [AuxiliaryData , type (None )] = None
332
+
333
+ @property
334
+ def id (self ) -> TransactionId :
335
+ return self .transaction_body .id
Original file line number Diff line number Diff line change @@ -117,6 +117,11 @@ def test_transaction():
117
117
vk_witness = [VerificationKeyWitness (vk , signature )]
118
118
signed_tx = Transaction (tx_body , TransactionWitnessSet (vkey_witnesses = vk_witness ))
119
119
check_two_way_cbor (signed_tx )
120
+ expected_tx_id = TransactionId .from_primitive (
121
+ "4b5b9ed087b596150f8c95f14de821ab066ddb74f00919228acf33b85d9ca6ca"
122
+ )
123
+ assert expected_tx_id == tx_body .id
124
+ assert expected_tx_id == signed_tx .id
120
125
121
126
122
127
def test_multi_asset ():
You can’t perform that action at this time.
0 commit comments