File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 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:
315315 self .to_cbor (encoding = "bytes" ), TRANSACTION_HASH_SIZE , encoder = RawEncoder
316316 )
317317
318+ @property
319+ def id (self ) -> TransactionId :
320+ return TransactionId (self .hash ())
321+
318322
319323@dataclass (repr = False )
320324class Transaction (ArrayCBORSerializable ):
@@ -325,3 +329,7 @@ class Transaction(ArrayCBORSerializable):
325329 valid : bool = True
326330
327331 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():
117117 vk_witness = [VerificationKeyWitness (vk , signature )]
118118 signed_tx = Transaction (tx_body , TransactionWitnessSet (vkey_witnesses = vk_witness ))
119119 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
120125
121126
122127def test_multi_asset ():
You can’t perform that action at this time.
0 commit comments