Skip to content

Commit

Permalink
Merge pull request #103 from hyperledger/develop
Browse files Browse the repository at this point in the history
Repeatable transaction status stream
  • Loading branch information
ERussel authored Jul 30, 2019
2 parents 4334cf3 + 78103ff commit feaf902
Show file tree
Hide file tree
Showing 15 changed files with 558 additions and 143 deletions.
13 changes: 5 additions & 8 deletions Example/IrohaCommunication.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
844761EE224A4EFF009ADC0E /* Proposal.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = 844761E2224A4EFF009ADC0E /* Proposal.pbobjc.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
844761EF224A4EFF009ADC0E /* Commands.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = 844761E5224A4EFF009ADC0E /* Commands.pbobjc.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
844761F1224A5133009ADC0E /* IRQueryResponseDeserializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 844761F0224A5133009ADC0E /* IRQueryResponseDeserializationTests.m */; };
84D693FB22EDCDB10059C1FB /* IRAccountRestoreWithBatchTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D693FA22EDCDB10059C1FB /* IRAccountRestoreWithBatchTest.m */; };
8CA1A478927FFA33BA30A5B4 /* Pods_IntegrationTestHost.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 175938D8DE70C85E0CEA25AF /* Pods_IntegrationTestHost.framework */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -170,6 +171,7 @@
844761E5224A4EFF009ADC0E /* Commands.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Commands.pbobjc.m; sourceTree = "<group>"; };
844761E6224A4EFF009ADC0E /* Transaction.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Transaction.pbobjc.h; sourceTree = "<group>"; };
844761F0224A5133009ADC0E /* IRQueryResponseDeserializationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IRQueryResponseDeserializationTests.m; sourceTree = "<group>"; };
84D693FA22EDCDB10059C1FB /* IRAccountRestoreWithBatchTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IRAccountRestoreWithBatchTest.m; sourceTree = "<group>"; };
84EA860F14455E442B5C9B29 /* IrohaCommunication.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = IrohaCommunication.podspec; path = ../IrohaCommunication.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
86F19532265991B547599707 /* Pods-IrohaExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IrohaExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-IrohaExample/Pods-IrohaExample.release.xcconfig"; sourceTree = "<group>"; };
872B4DCAED8E7A58AFC8B200 /* Pods_UnitTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_UnitTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -274,6 +276,7 @@
02D656A021F12DC300AAA66A /* IRCreateAccountTest.m */,
02D656A121F12DC300AAA66A /* IRCreateDomainTest.m */,
02D656BD21F19F6B00AAA66A /* IRCreateRoleTest.m */,
84D693FA22EDCDB10059C1FB /* IRAccountRestoreWithBatchTest.m */,
);
path = Scenarious;
sourceTree = "<group>";
Expand Down Expand Up @@ -595,6 +598,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -743,8 +747,6 @@
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-IntegrationTestHost/Pods-IntegrationTestHost-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/BoringSSL/openssl.framework",
Expand All @@ -758,8 +760,6 @@
"${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IrohaCommunication.framework",
Expand All @@ -781,8 +781,6 @@
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-IrohaExample/Pods-IrohaExample-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/BoringSSL/openssl.framework",
Expand All @@ -796,8 +794,6 @@
"${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IrohaCommunication.framework",
Expand Down Expand Up @@ -825,6 +821,7 @@
02D656B021F12DC300AAA66A /* IRCreateDomainTest.m in Sources */,
02D656BF21F19F7500AAA66A /* IRCreateRoleTest.m in Sources */,
02D656B721F12DC300AAA66A /* IRBaseIrohaContainerTests.m in Sources */,
84D693FB22EDCDB10059C1FB /* IRAccountRestoreWithBatchTest.m in Sources */,
02D656AF21F12DC300AAA66A /* IRCreateAccountTest.m in Sources */,
02D656CD21F285E100AAA66A /* IRCancellableTests.m in Sources */,
02D656AE21F12DC300AAA66A /* IRCreateAssetTest.m in Sources */,
Expand Down
12 changes: 9 additions & 3 deletions Example/IrohaExample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ class ViewController: UIViewController {
}).onThen({ (result) -> IRPromise? in
if let sentTransactionHash = result as? Data {
print("Transaction has been sent \((sentTransactionHash as NSData).toHexString())")
return self.networkService.onTransactionStatus(.committed, withHash: sentTransactionHash)
return IRRepeatableStatusStream.onTransactionStatus(.committed,
withHash: sentTransactionHash,
from: self.networkService);
} else {
return IRPromise(result: result)
}
Expand Down Expand Up @@ -158,7 +160,9 @@ class ViewController: UIViewController {
}).onThen({ (result) -> IRPromise? in
if let sentTransactionHash = result as? Data {
print("Transaction has been sent \((sentTransactionHash as NSData).toHexString())")
return self.networkService.onTransactionStatus(.committed, withHash: sentTransactionHash)
return IRRepeatableStatusStream.onTransactionStatus(.committed,
withHash: sentTransactionHash,
from: self.networkService);
} else {
return IRPromise(result: result)
}
Expand Down Expand Up @@ -216,7 +220,9 @@ class ViewController: UIViewController {
.onThen({ (result) -> IRPromise? in
if let sentTransactionHash = result as? Data {
print("Transaction has been sent \((sentTransactionHash as NSData).toHexString())")
return self.networkService.onTransactionStatus(.committed, withHash: sentTransactionHash)
return IRRepeatableStatusStream.onTransactionStatus(.committed,
withHash: sentTransactionHash,
from: self.networkService);
} else {
return IRPromise(result: result)
}
Expand Down
6 changes: 3 additions & 3 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PODS:
- gRPC/Main (1.11.0):
- gRPC-Core (= 1.11.0)
- gRPC-RxLibrary (= 1.11.0)
- IrohaCommunication (3.1.0):
- IrohaCommunication (3.2.0):
- BoringSSL (= 10.0.3)
- gRPC-ProtoRPC (= 1.11.0)
- IrohaCrypto
Expand Down Expand Up @@ -62,11 +62,11 @@ SPEC CHECKSUMS:
gRPC-Core: 164639cd8ae18ca8b65477fafb2efbaecf4f181a
gRPC-ProtoRPC: bb5fddf3424aa4fad74d76736578a79fe40e244e
gRPC-RxLibrary: 26d53d1b1f306befd4ad4e15bd6de27839a82481
IrohaCommunication: a58daac94b2438f2bd8459b5707e83c3934b9420
IrohaCommunication: 80d8be2565e5bbd3446bdc5d2bdfb0e0849606e8
IrohaCrypto: 4eb85b5edbf7667b5ffcef1b5104357f18ca8e81
nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3
Protobuf: 8a9838fba8dae3389230e1b7f8c104aa32389c03

PODFILE CHECKSUM: 29089a97c3781ec366ef8266addf4289525ff849

COCOAPODS: 1.6.1
COCOAPODS: 1.7.5
39 changes: 1 addition & 38 deletions IntegrationTests/IrohaContainer/IRIrohaContainer.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#import "IRIrohaContainer.h"

static NSString* const DOCKER_HOST = @"http://localhost:49721";
static NSString* const CONTAINER = @"649f761b58de";
static NSString* const CONTAINER = @"iroha";

static NSString * IROHA_IP = @"127.0.0.1";
static NSString * IROHA_PORT = @"50051";
Expand Down Expand Up @@ -79,43 +79,6 @@ - (nullable NSError*)start {
return resultError;
}

__block NSString *taskId;
NSURLRequest *taskCreationRequest = [self createIrohaDaemonTaskPreparationRequest];
NSURLSessionDataTask *daemonTaskCreationTask = [_session dataTaskWithRequest:taskCreationRequest
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
taskId = [self handleTaskPreparationResponse:response
data:data
receivedError:error
resultError:&resultError];
dispatch_semaphore_signal(semaphore);
}];

[daemonTaskCreationTask resume];

dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);

if (resultError) {
return resultError;
}

NSURLRequest *taskExecutionRequest = [self createIrohaDaemonTaskStartRequest:taskId];
NSURLSessionDataTask *daemonTaskExecutionTask = [_session dataTaskWithRequest:taskExecutionRequest
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
resultError = [self handleTaskExecutionResponse:response
data:data
receivedError:error];

dispatch_semaphore_signal(semaphore);
}];

[daemonTaskExecutionTask resume];

dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);

if (resultError) {
return resultError;
}

BOOL connected = NO;

for(NSUInteger tryIndex = 0; tryIndex < CONNECTION_TRIES; tryIndex++) {
Expand Down
Loading

0 comments on commit feaf902

Please sign in to comment.