diff --git a/IrohaCommunication.podspec b/IrohaCommunication.podspec index bc4d886a1..2b068c7a2 100755 --- a/IrohaCommunication.podspec +++ b/IrohaCommunication.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'IrohaCommunication' - s.version = '3.0.1' + s.version = '3.0.2' s.summary = 'Helper classes to use for communication with Iroha blockchain.' s.homepage = 'https://github.com/hyperledger/iroha-ios' diff --git a/IrohaCommunication/Classes/Private/IRTransactionImpl.m b/IrohaCommunication/Classes/Private/IRTransactionImpl.m index 2465a8f18..d0e7b87a4 100755 --- a/IrohaCommunication/Classes/Private/IRTransactionImpl.m +++ b/IrohaCommunication/Classes/Private/IRTransactionImpl.m @@ -68,6 +68,14 @@ - (nullable id)transform:(NSError*_Nullable*_Nullable)error { return transaction; } +#pragma mark - Transaction data + +- (nullable NSData *)transactionData { + Transaction *transaction = [self transform:nil]; + + return transaction.data; +} + #pragma mark - Signable - (nullable NSData*)transactionHashWithError:(NSError **)error { diff --git a/IrohaCommunication/Classes/Public/Model/IRTransaction.h b/IrohaCommunication/Classes/Public/Model/IRTransaction.h index 6bcb6e7ef..5c4f5b113 100755 --- a/IrohaCommunication/Classes/Public/Model/IRTransaction.h +++ b/IrohaCommunication/Classes/Public/Model/IRTransaction.h @@ -26,6 +26,7 @@ typedef NS_ENUM(NSUInteger, IRTransactionBatchType) { @property(nonatomic, readonly)NSArray>* _Nullable signatures; @property(nonatomic, readonly)NSArray* _Nullable batchHashes; @property(nonatomic, readonly)IRTransactionBatchType batchType; +@property(nonatomic, readonly)NSData* _Nullable transactionData; - (nullable NSData*)transactionHashWithError:(NSError **)error; diff --git a/Tests/Transaction/IRTransactionTests.m b/Tests/Transaction/IRTransactionTests.m index f258cae8b..d899095c3 100755 --- a/Tests/Transaction/IRTransactionTests.m +++ b/Tests/Transaction/IRTransactionTests.m @@ -60,6 +60,10 @@ - (void)testTransactionBuildWithAllCommandsAndSingleSignature { usingPublicKey:resultSignature.publicKey]; XCTAssertTrue(verified); + + NSData *transactionData = transaction.transactionData; + + XCTAssertNotNil(transactionData); } - (void)testInitializationFromRawTransaction { @@ -111,6 +115,10 @@ - (void)testInitializationFromRawTransaction { XCTAssertEqualObjects(originalSignature.signature.rawData, restoredSignature.signature.rawData); XCTAssertEqualObjects(originalSignature.publicKey.rawData, restoredSignature.publicKey.rawData); + + NSData *transactionData = transaction.transactionData; + + XCTAssertNotNil(transactionData); } - (void)testBatchInitialization { @@ -147,6 +155,10 @@ - (void)testBatchInitialization { XCTAssertNil(batchedTransaction.signatures); XCTAssertEqualObjects([batchedTransaction batchHashWithError:nil], batchHash); + + NSData *transactionData = transaction.transactionData; + + XCTAssertNotNil(transactionData); } #pragma mark - Private