From d27d12010dd58febee74f89a4654a6b223f37de8 Mon Sep 17 00:00:00 2001 From: Russel Date: Fri, 9 Aug 2019 10:57:06 +0300 Subject: [PATCH 1/8] add pagination to account asset query Signed-off-by: Russel --- .../project.pbxproj | 80 ++---- Example/Podfile.lock | 4 +- IrohaCommunication.podspec | 2 +- .../Classes/Private/IRQueryResponse+Proto.m | 15 +- .../Private/Queries/IRGetAccountAssets.h | 3 +- .../Private/Queries/IRGetAccountAssets.m | 13 +- .../Responses/IRAccountAssetsResponse.h | 2 + .../Responses/IRAccountAssetsResponse.m | 8 +- .../Classes/Public/Builder/IRQueryBuilder.h | 5 +- .../Classes/Public/Builder/IRQueryBuilder.m | 8 +- .../Public/Model/Common/IRAssetPagination.h | 26 ++ .../Public/Model/Common/IRAssetPagination.m | 33 +++ .../Classes/Public/Model/IRQuery.h | 2 + .../Classes/Public/Model/IRQueryResponse.h | 2 + ProtoGen/Block.pbobjc.h | 0 ProtoGen/Block.pbobjc.m | 0 ProtoGen/Commands.pbobjc.h | 56 ++++ ProtoGen/Commands.pbobjc.m | 153 +++++++++++ ProtoGen/Endpoint.pbobjc.h | 0 ProtoGen/Endpoint.pbobjc.m | 0 ProtoGen/Endpoint.pbrpc.h | 0 ProtoGen/Endpoint.pbrpc.m | 0 ProtoGen/Primitive.pbobjc.h | 17 ++ ProtoGen/Primitive.pbobjc.m | 98 +++++-- ProtoGen/Proposal.pbobjc.h | 0 ProtoGen/Proposal.pbobjc.m | 0 ProtoGen/QryResponses.pbobjc.h | 94 +++++++ ProtoGen/QryResponses.pbobjc.m | 254 +++++++++++++++++- ProtoGen/Queries.pbobjc.h | 93 +++++++ ProtoGen/Queries.pbobjc.m | 252 ++++++++++++++++- ProtoGen/Transaction.pbobjc.h | 2 +- ProtoGen/Transaction.pbobjc.m | 0 Tests/Model/IRAssetPaginationTests.m | 40 +++ Tests/Query/IRQueryBuilderTests.m | 8 + .../IRQueryResponseDeserializationTests.m | 39 ++- 35 files changed, 1220 insertions(+), 89 deletions(-) create mode 100644 IrohaCommunication/Classes/Public/Model/Common/IRAssetPagination.h create mode 100644 IrohaCommunication/Classes/Public/Model/Common/IRAssetPagination.m mode change 100755 => 100644 ProtoGen/Block.pbobjc.h mode change 100755 => 100644 ProtoGen/Block.pbobjc.m mode change 100755 => 100644 ProtoGen/Commands.pbobjc.h mode change 100755 => 100644 ProtoGen/Commands.pbobjc.m mode change 100755 => 100644 ProtoGen/Endpoint.pbobjc.h mode change 100755 => 100644 ProtoGen/Endpoint.pbobjc.m mode change 100755 => 100644 ProtoGen/Endpoint.pbrpc.h mode change 100755 => 100644 ProtoGen/Endpoint.pbrpc.m mode change 100755 => 100644 ProtoGen/Primitive.pbobjc.h mode change 100755 => 100644 ProtoGen/Primitive.pbobjc.m mode change 100755 => 100644 ProtoGen/Proposal.pbobjc.h mode change 100755 => 100644 ProtoGen/Proposal.pbobjc.m mode change 100755 => 100644 ProtoGen/QryResponses.pbobjc.h mode change 100755 => 100644 ProtoGen/QryResponses.pbobjc.m mode change 100755 => 100644 ProtoGen/Queries.pbobjc.h mode change 100755 => 100644 ProtoGen/Queries.pbobjc.m mode change 100755 => 100644 ProtoGen/Transaction.pbobjc.h mode change 100755 => 100644 ProtoGen/Transaction.pbobjc.m create mode 100644 Tests/Model/IRAssetPaginationTests.m diff --git a/Example/IrohaCommunication.xcodeproj/project.pbxproj b/Example/IrohaCommunication.xcodeproj/project.pbxproj index af14481bd..c2c2aa318 100644 --- a/Example/IrohaCommunication.xcodeproj/project.pbxproj +++ b/Example/IrohaCommunication.xcodeproj/project.pbxproj @@ -51,16 +51,8 @@ 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; }; 7C8964A2BAE86B246752F5D5 /* Pods_UnitTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 872B4DCAED8E7A58AFC8B200 /* Pods_UnitTests.framework */; }; 844761D3224A4946009ADC0E /* IRInvalidSerializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 844761D2224A4946009ADC0E /* IRInvalidSerializationTests.m */; }; - 844761E7224A4EFF009ADC0E /* Block.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = 844761D6224A4EFF009ADC0E /* Block.pbobjc.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 844761E8224A4EFF009ADC0E /* Endpoint.pbrpc.m in Sources */ = {isa = PBXBuildFile; fileRef = 844761D8224A4EFF009ADC0E /* Endpoint.pbrpc.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 844761E9224A4EFF009ADC0E /* QryResponses.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = 844761DA224A4EFF009ADC0E /* QryResponses.pbobjc.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 844761EA224A4EFF009ADC0E /* Queries.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = 844761DC224A4EFF009ADC0E /* Queries.pbobjc.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 844761EB224A4EFF009ADC0E /* Transaction.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = 844761DD224A4EFF009ADC0E /* Transaction.pbobjc.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 844761EC224A4EFF009ADC0E /* Endpoint.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = 844761DE224A4EFF009ADC0E /* Endpoint.pbobjc.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 844761ED224A4EFF009ADC0E /* Primitive.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = 844761E0224A4EFF009ADC0E /* Primitive.pbobjc.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 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 */; }; + 8481A59122FD48800056D3D4 /* IRAssetPaginationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8481A59022FD48800056D3D4 /* IRAssetPaginationTests.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 */ @@ -152,25 +144,17 @@ 6BF3097DA0B1239D7D3C0799 /* Pods-UnitTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-UnitTests/Pods-UnitTests.release.xcconfig"; sourceTree = ""; }; 74D33D817C5F7989BD3071B1 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 844761D2224A4946009ADC0E /* IRInvalidSerializationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IRInvalidSerializationTests.m; sourceTree = ""; }; - 844761D5224A4EFF009ADC0E /* Primitive.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Primitive.pbobjc.h; sourceTree = ""; }; - 844761D6224A4EFF009ADC0E /* Block.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Block.pbobjc.m; sourceTree = ""; }; - 844761D7224A4EFF009ADC0E /* Endpoint.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Endpoint.pbobjc.h; sourceTree = ""; }; - 844761D8224A4EFF009ADC0E /* Endpoint.pbrpc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Endpoint.pbrpc.m; sourceTree = ""; }; - 844761D9224A4EFF009ADC0E /* Proposal.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Proposal.pbobjc.h; sourceTree = ""; }; - 844761DA224A4EFF009ADC0E /* QryResponses.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QryResponses.pbobjc.m; sourceTree = ""; }; - 844761DB224A4EFF009ADC0E /* Commands.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Commands.pbobjc.h; sourceTree = ""; }; - 844761DC224A4EFF009ADC0E /* Queries.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Queries.pbobjc.m; sourceTree = ""; }; - 844761DD224A4EFF009ADC0E /* Transaction.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Transaction.pbobjc.m; sourceTree = ""; }; - 844761DE224A4EFF009ADC0E /* Endpoint.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Endpoint.pbobjc.m; sourceTree = ""; }; - 844761DF224A4EFF009ADC0E /* Block.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Block.pbobjc.h; sourceTree = ""; }; - 844761E0224A4EFF009ADC0E /* Primitive.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Primitive.pbobjc.m; sourceTree = ""; }; - 844761E1224A4EFF009ADC0E /* QryResponses.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QryResponses.pbobjc.h; sourceTree = ""; }; - 844761E2224A4EFF009ADC0E /* Proposal.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Proposal.pbobjc.m; sourceTree = ""; }; - 844761E3224A4EFF009ADC0E /* Endpoint.pbrpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Endpoint.pbrpc.h; sourceTree = ""; }; - 844761E4224A4EFF009ADC0E /* Queries.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Queries.pbobjc.h; sourceTree = ""; }; - 844761E5224A4EFF009ADC0E /* Commands.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Commands.pbobjc.m; sourceTree = ""; }; - 844761E6224A4EFF009ADC0E /* Transaction.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Transaction.pbobjc.h; sourceTree = ""; }; 844761F0224A5133009ADC0E /* IRQueryResponseDeserializationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IRQueryResponseDeserializationTests.m; sourceTree = ""; }; + 8481A59022FD48800056D3D4 /* IRAssetPaginationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IRAssetPaginationTests.m; sourceTree = ""; }; + 8481A59322FD4D780056D3D4 /* Primitive.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Primitive.pbobjc.h; sourceTree = ""; }; + 8481A59522FD4D790056D3D4 /* Endpoint.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Endpoint.pbobjc.h; sourceTree = ""; }; + 8481A59722FD4D790056D3D4 /* Proposal.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Proposal.pbobjc.h; sourceTree = ""; }; + 8481A59922FD4D790056D3D4 /* Commands.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Commands.pbobjc.h; sourceTree = ""; }; + 8481A59D22FD4D790056D3D4 /* Block.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Block.pbobjc.h; sourceTree = ""; }; + 8481A59F22FD4D790056D3D4 /* QryResponses.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QryResponses.pbobjc.h; sourceTree = ""; }; + 8481A5A122FD4D790056D3D4 /* Endpoint.pbrpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Endpoint.pbrpc.h; sourceTree = ""; }; + 8481A5A222FD4D790056D3D4 /* Queries.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Queries.pbobjc.h; sourceTree = ""; }; + 8481A5A422FD4D790056D3D4 /* Transaction.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Transaction.pbobjc.h; sourceTree = ""; }; 84D693FA22EDCDB10059C1FB /* IRAccountRestoreWithBatchTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IRAccountRestoreWithBatchTest.m; sourceTree = ""; }; 84EA860F14455E442B5C9B29 /* IrohaCommunication.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = IrohaCommunication.podspec; path = ../IrohaCommunication.podspec; sourceTree = ""; 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 = ""; }; @@ -241,6 +225,7 @@ 0200347421C8516F001A6A53 /* IRGrantablePermissionTests.m */, 0200347621C853E2001A6A53 /* IRRolePermissionTests.m */, 021C24AE21DCDDE3005D5304 /* IRPaginationTests.m */, + 8481A59022FD48800056D3D4 /* IRAssetPaginationTests.m */, 021C24EF21DDF706005D5304 /* IRAccountAssetTests.m */, ); name = Model; @@ -415,7 +400,7 @@ 6003F5B5195388D20070C39A /* Tests */ = { isa = PBXGroup; children = ( - 844761D4224A4EFF009ADC0E /* ProtoGen */, + 8481A59222FD4D780056D3D4 /* ProtoGen */, 844761D1224A4946009ADC0E /* Serialization */, 021C24E621DD3C90005D5304 /* Query */, 02E319DB21DBB18500B33B66 /* Promise */, @@ -456,27 +441,18 @@ path = ../../Tests/Serialization; sourceTree = ""; }; - 844761D4224A4EFF009ADC0E /* ProtoGen */ = { + 8481A59222FD4D780056D3D4 /* ProtoGen */ = { isa = PBXGroup; children = ( - 844761D5224A4EFF009ADC0E /* Primitive.pbobjc.h */, - 844761D6224A4EFF009ADC0E /* Block.pbobjc.m */, - 844761D7224A4EFF009ADC0E /* Endpoint.pbobjc.h */, - 844761D8224A4EFF009ADC0E /* Endpoint.pbrpc.m */, - 844761D9224A4EFF009ADC0E /* Proposal.pbobjc.h */, - 844761DA224A4EFF009ADC0E /* QryResponses.pbobjc.m */, - 844761DB224A4EFF009ADC0E /* Commands.pbobjc.h */, - 844761DC224A4EFF009ADC0E /* Queries.pbobjc.m */, - 844761DD224A4EFF009ADC0E /* Transaction.pbobjc.m */, - 844761DE224A4EFF009ADC0E /* Endpoint.pbobjc.m */, - 844761DF224A4EFF009ADC0E /* Block.pbobjc.h */, - 844761E0224A4EFF009ADC0E /* Primitive.pbobjc.m */, - 844761E1224A4EFF009ADC0E /* QryResponses.pbobjc.h */, - 844761E2224A4EFF009ADC0E /* Proposal.pbobjc.m */, - 844761E3224A4EFF009ADC0E /* Endpoint.pbrpc.h */, - 844761E4224A4EFF009ADC0E /* Queries.pbobjc.h */, - 844761E5224A4EFF009ADC0E /* Commands.pbobjc.m */, - 844761E6224A4EFF009ADC0E /* Transaction.pbobjc.h */, + 8481A59322FD4D780056D3D4 /* Primitive.pbobjc.h */, + 8481A59522FD4D790056D3D4 /* Endpoint.pbobjc.h */, + 8481A59722FD4D790056D3D4 /* Proposal.pbobjc.h */, + 8481A59922FD4D790056D3D4 /* Commands.pbobjc.h */, + 8481A59D22FD4D790056D3D4 /* Block.pbobjc.h */, + 8481A59F22FD4D790056D3D4 /* QryResponses.pbobjc.h */, + 8481A5A122FD4D790056D3D4 /* Endpoint.pbrpc.h */, + 8481A5A222FD4D790056D3D4 /* Queries.pbobjc.h */, + 8481A5A422FD4D790056D3D4 /* Transaction.pbobjc.h */, ); name = ProtoGen; path = ../../ProtoGen; @@ -854,27 +830,19 @@ files = ( 02E3198B21D0FEF000B33B66 /* IRTransactionTests.m in Sources */, 0200346F21C840D1001A6A53 /* IRAmountTests.m in Sources */, - 844761E7224A4EFF009ADC0E /* Block.pbobjc.m in Sources */, 02E319DD21DBB18500B33B66 /* IRPromiseTests.m in Sources */, - 844761ED224A4EFF009ADC0E /* Primitive.pbobjc.m in Sources */, 0200347521C8516F001A6A53 /* IRGrantablePermissionTests.m in Sources */, - 844761EC224A4EFF009ADC0E /* Endpoint.pbobjc.m in Sources */, 0200347121C849FF001A6A53 /* IRAssetIdTests.m in Sources */, 844761D3224A4946009ADC0E /* IRInvalidSerializationTests.m in Sources */, - 844761EA224A4EFF009ADC0E /* Queries.pbobjc.m in Sources */, + 8481A59122FD48800056D3D4 /* IRAssetPaginationTests.m in Sources */, 021C24E821DD3C90005D5304 /* IRQueryBuilderTests.m in Sources */, - 844761E8224A4EFF009ADC0E /* Endpoint.pbrpc.m in Sources */, - 844761EF224A4EFF009ADC0E /* Commands.pbobjc.m in Sources */, 0200347721C853E2001A6A53 /* IRRolePermissionTests.m in Sources */, 021C24F021DDF706005D5304 /* IRAccountAssetTests.m in Sources */, 0200345E21C62D3F001A6A53 /* IRDomainTests.m in Sources */, - 844761E9224A4EFF009ADC0E /* QryResponses.pbobjc.m in Sources */, 021C843D21EA6E950037F633 /* IRBlockQueryBuilderTests.m in Sources */, - 844761EB224A4EFF009ADC0E /* Transaction.pbobjc.m in Sources */, 0200345F21C62D3F001A6A53 /* IRAccountIdTests.m in Sources */, 844761F1224A5133009ADC0E /* IRQueryResponseDeserializationTests.m in Sources */, 0200346121C63F45001A6A53 /* IRAddressTests.m in Sources */, - 844761EE224A4EFF009ADC0E /* Proposal.pbobjc.m in Sources */, 021C24AF21DCDDE3005D5304 /* IRPaginationTests.m in Sources */, 0200347321C84E5C001A6A53 /* IRRoleNameTests.m in Sources */, ); diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 2d241d88d..f17e4b2a4 100755 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -24,7 +24,7 @@ PODS: - gRPC/Main (1.11.0): - gRPC-Core (= 1.11.0) - gRPC-RxLibrary (= 1.11.0) - - IrohaCommunication (3.2.0): + - IrohaCommunication (3.4.0): - BoringSSL (= 10.0.3) - gRPC-ProtoRPC (= 1.11.0) - IrohaCrypto @@ -62,7 +62,7 @@ SPEC CHECKSUMS: gRPC-Core: 164639cd8ae18ca8b65477fafb2efbaecf4f181a gRPC-ProtoRPC: bb5fddf3424aa4fad74d76736578a79fe40e244e gRPC-RxLibrary: 26d53d1b1f306befd4ad4e15bd6de27839a82481 - IrohaCommunication: 80d8be2565e5bbd3446bdc5d2bdfb0e0849606e8 + IrohaCommunication: 1519ba62909b1d8283244a6b9098b330bae2beab IrohaCrypto: 4eb85b5edbf7667b5ffcef1b5104357f18ca8e81 nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3 Protobuf: 8a9838fba8dae3389230e1b7f8c104aa32389c03 diff --git a/IrohaCommunication.podspec b/IrohaCommunication.podspec index 6c86f3dae..9f23c3eaf 100755 --- a/IrohaCommunication.podspec +++ b/IrohaCommunication.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'IrohaCommunication' - s.version = '3.3.0' + s.version = '3.4.0' 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/IRQueryResponse+Proto.m b/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m index 0cdf078d3..5685a536d 100755 --- a/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m +++ b/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m @@ -315,7 +315,20 @@ @implementation IRQueryResponseProtoFactory [accountAssets addObject:accountAsset]; } + id nextAssetId = nil; + + if (pbResponse.nextAssetId && pbResponse.nextAssetId.length > 0) { + NSError* error = nil; + nextAssetId = [IRAssetIdFactory assetWithIdentifier: pbResponse.nextAssetId error:&error]; + + if (error) { + return nil; + } + } + return [[IRAccountAssetsResponse alloc] initWithAccountAssets:accountAssets + totalCount:pbResponse.totalNumber + nextAssetId:nextAssetId queryHash:queryHash]; } @@ -361,7 +374,7 @@ @implementation IRQueryResponseProtoFactory NSData *nextTransactionHash = nil; - if (pbResponse.nextTxHash) { + if (pbResponse.nextTxHash && pbResponse.nextTxHash.length > 0) { nextTransactionHash = [[NSData alloc] initWithHexString:pbResponse.nextTxHash]; if (!nextTransactionHash) { diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAccountAssets.h b/IrohaCommunication/Classes/Private/Queries/IRGetAccountAssets.h index cdb0d1c12..7ac5d3596 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAccountAssets.h +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAccountAssets.h @@ -9,6 +9,7 @@ @interface IRGetAccountAssets : NSObject -- (nonnull instancetype)initWithAccountId:(nonnull id)accountId; +- (nonnull instancetype)initWithAccountId:(nonnull id)accountId + pagination:(nullable id)pagination; @end diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAccountAssets.m b/IrohaCommunication/Classes/Private/Queries/IRGetAccountAssets.m index 63002f52c..355090d06 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAccountAssets.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAccountAssets.m @@ -8,10 +8,13 @@ @implementation IRGetAccountAssets @synthesize accountId = _accountId; +@synthesize pagination = _pagination; -- (nonnull instancetype)initWithAccountId:(nonnull id)accountId { +- (nonnull instancetype)initWithAccountId:(nonnull id)accountId + pagination:(nullable id)pagination { if (self = [super init]) { _accountId = accountId; + _pagination = pagination; } return self; @@ -23,6 +26,14 @@ - (nullable id)transform:(NSError**)error { GetAccountAssets *query = [[GetAccountAssets alloc] init]; query.accountId = [_accountId identifier]; + if (_pagination) { + AssetPaginationMeta *meta = [[AssetPaginationMeta alloc] init]; + meta.pageSize = _pagination.pageSize; + meta.firstAssetId = [_pagination.startingAssetId identifier]; + + query.paginationMeta = meta; + } + Query_Payload *payload = [[Query_Payload alloc] init]; payload.getAccountAssets = query; diff --git a/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.h b/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.h index f7b2465de..a44687423 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.h +++ b/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.h @@ -9,6 +9,8 @@ @interface IRAccountAssetsResponse : NSObject - (nonnull instancetype)initWithAccountAssets:(nonnull NSArray>*)accountAssets + totalCount:(UInt32)totalCount + nextAssetId:(nullable id)assetId queryHash:(nonnull NSData*)queryHash; @end diff --git a/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.m b/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.m index 5b9c7874f..75adba5b0 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.m +++ b/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.m @@ -7,12 +7,18 @@ @implementation IRAccountAssetsResponse @synthesize accountAssets = _accountAssets; +@synthesize totalCount = _totalCount; +@synthesize nextAssetId = _nextAssetId; @synthesize queryHash = _queryHash; -- (nonnull instancetype)initWithAccountAssets:(NSArray> *)accountAssets +- (nonnull instancetype)initWithAccountAssets:(nonnull NSArray>*)accountAssets + totalCount:(UInt32)totalCount + nextAssetId:(nullable id)assetId queryHash:(nonnull NSData*)queryHash { if (self = [super init]) { _accountAssets = accountAssets; + _totalCount = totalCount; + _nextAssetId = assetId; _queryHash = queryHash; } diff --git a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h index 04107bb0d..349f70987 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h +++ b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h @@ -39,7 +39,10 @@ typedef NS_ENUM(NSUInteger, IRQueryBuilderError) { - (nonnull instancetype)getTransactions:(nonnull NSArray*)hashes; -- (nonnull instancetype)getAccountAssets:(nonnull id)accountId; +- (nonnull instancetype)getAccountAssets:(nonnull id)accountId DEPRECATED_MSG_ATTRIBUTE("use getAccountAsset:pagination:"); + +- (nonnull instancetype)getAccountAssets:(nonnull id)accountId + pagination:(nullable id)pagination; - (nonnull instancetype)getAccountDetail:(nullable id)accountId writer:(nullable id)writer diff --git a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m index 5fe18661d..33eed7df6 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m +++ b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m @@ -73,7 +73,13 @@ - (nonnull instancetype)getTransactions:(nonnull NSArray*)hashes { } - (nonnull instancetype)getAccountAssets:(nonnull id)accountId { - id query = [[IRGetAccountAssets alloc] initWithAccountId:accountId]; + return [self getAccountAssets:accountId pagination:nil]; +} + +- (nonnull instancetype)getAccountAssets:(nonnull id)accountId + pagination:(nullable id)pagination { + id query = [[IRGetAccountAssets alloc] initWithAccountId:accountId + pagination:pagination]; return [self withQuery:query]; } diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAssetPagination.h b/IrohaCommunication/Classes/Public/Model/Common/IRAssetPagination.h new file mode 100644 index 000000000..5e25f6997 --- /dev/null +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAssetPagination.h @@ -0,0 +1,26 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import +#import "IRAssetId.h" + +@protocol IRAssetPagination + +@property(nonatomic, readonly)UInt32 pageSize; + +@property(nonatomic, readonly)id _Nullable startingAssetId; + +@end + +@protocol IRAssetPaginationFactoryProtocol + ++ (nonnull id)assetPagination:(UInt32)pageSize + startingAssetId:(nullable id)assetId; + +@end + +@interface IRAssetPaginationFactory : NSObject + +@end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAssetPagination.m b/IrohaCommunication/Classes/Public/Model/Common/IRAssetPagination.m new file mode 100644 index 000000000..c7d5b15ab --- /dev/null +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAssetPagination.m @@ -0,0 +1,33 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import "IRAssetPagination.h" + +@interface IRAssetPagination: NSObject + +@end + +@implementation IRAssetPagination +@synthesize pageSize = _pageSize; +@synthesize startingAssetId = _startingAssetId; + +- (instancetype)initWithPageSize:(UInt32)pageSize startingAssetId:(nullable id)assetId { + if (self = [super init]) { + _pageSize = pageSize; + _startingAssetId = assetId; + } + + return self; +} + +@end + +@implementation IRAssetPaginationFactory + ++ (nonnull id)assetPagination:(UInt32)pageSize startingAssetId:(nullable id)assetId { + return [[IRAssetPagination alloc] initWithPageSize:pageSize startingAssetId:assetId]; +} + +@end diff --git a/IrohaCommunication/Classes/Public/Model/IRQuery.h b/IrohaCommunication/Classes/Public/Model/IRQuery.h index fe27272a4..d1c3252ec 100755 --- a/IrohaCommunication/Classes/Public/Model/IRQuery.h +++ b/IrohaCommunication/Classes/Public/Model/IRQuery.h @@ -9,6 +9,7 @@ #import "IRAccountId.h" #import "IRAssetId.h" #import "IRPagination.h" +#import "IRAssetPagination.h" #import "IRRoleName.h" @protocol IRQuery @@ -51,6 +52,7 @@ @protocol IRGetAccountAssets @property(nonatomic, readonly)id _Nonnull accountId; +@property(nonatomic, readonly)id _Nullable pagination; @end diff --git a/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h b/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h index 42c8aab6b..fee7e0ebe 100755 --- a/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h +++ b/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h @@ -22,6 +22,8 @@ @protocol IRAccountAssetsResponse @property(nonatomic, readonly)NSArray>* _Nonnull accountAssets; +@property(nonatomic, readonly)UInt32 totalCount; +@property(nonatomic, readonly)id _Nullable nextAssetId; @end diff --git a/ProtoGen/Block.pbobjc.h b/ProtoGen/Block.pbobjc.h old mode 100755 new mode 100644 diff --git a/ProtoGen/Block.pbobjc.m b/ProtoGen/Block.pbobjc.m old mode 100755 new mode 100644 diff --git a/ProtoGen/Commands.pbobjc.h b/ProtoGen/Commands.pbobjc.h old mode 100755 new mode 100644 index e3403536f..489b27366 --- a/ProtoGen/Commands.pbobjc.h +++ b/ProtoGen/Commands.pbobjc.h @@ -31,6 +31,7 @@ CF_EXTERN_C_BEGIN @class AddPeer; @class AddSignatory; @class AppendRole; +@class CompareAndSetAccountDetail; @class CreateAccount; @class CreateAsset; @class CreateDomain; @@ -38,6 +39,7 @@ CF_EXTERN_C_BEGIN @class DetachRole; @class GrantPermission; @class Peer; +@class RemovePeer; @class RemoveSignatory; @class RevokePermission; @class SetAccountDetail; @@ -92,6 +94,19 @@ typedef GPB_ENUM(AddPeer_FieldNumber) { @end +#pragma mark - RemovePeer + +typedef GPB_ENUM(RemovePeer_FieldNumber) { + RemovePeer_FieldNumber_PublicKey = 1, +}; + +@interface RemovePeer : GPBMessage + +/** hex string */ +@property(nonatomic, readwrite, copy, null_resettable) NSString *publicKey; + +@end + #pragma mark - AddSignatory typedef GPB_ENUM(AddSignatory_FieldNumber) { @@ -350,6 +365,39 @@ typedef GPB_ENUM(SubtractAssetQuantity_FieldNumber) { @end +#pragma mark - CompareAndSetAccountDetail + +typedef GPB_ENUM(CompareAndSetAccountDetail_FieldNumber) { + CompareAndSetAccountDetail_FieldNumber_AccountId = 1, + CompareAndSetAccountDetail_FieldNumber_Key = 2, + CompareAndSetAccountDetail_FieldNumber_Value = 3, + CompareAndSetAccountDetail_FieldNumber_OldValue = 4, +}; + +typedef GPB_ENUM(CompareAndSetAccountDetail_OptOldValue_OneOfCase) { + CompareAndSetAccountDetail_OptOldValue_OneOfCase_GPBUnsetOneOfCase = 0, + CompareAndSetAccountDetail_OptOldValue_OneOfCase_OldValue = 4, +}; + +@interface CompareAndSetAccountDetail : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSString *accountId; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *key; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *value; + +@property(nonatomic, readonly) CompareAndSetAccountDetail_OptOldValue_OneOfCase optOldValueOneOfCase; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *oldValue; + +@end + +/** + * Clears whatever value was set for the oneof 'optOldValue'. + **/ +void CompareAndSetAccountDetail_ClearOptOldValueOneOfCase(CompareAndSetAccountDetail *message); + #pragma mark - Command typedef GPB_ENUM(Command_FieldNumber) { @@ -369,6 +417,8 @@ typedef GPB_ENUM(Command_FieldNumber) { Command_FieldNumber_SetAccountQuorum = 14, Command_FieldNumber_SubtractAssetQuantity = 15, Command_FieldNumber_TransferAsset = 16, + Command_FieldNumber_RemovePeer = 17, + Command_FieldNumber_CompareAndSetAccountDetail = 18, }; typedef GPB_ENUM(Command_Command_OneOfCase) { @@ -389,6 +439,8 @@ typedef GPB_ENUM(Command_Command_OneOfCase) { Command_Command_OneOfCase_SetAccountQuorum = 14, Command_Command_OneOfCase_SubtractAssetQuantity = 15, Command_Command_OneOfCase_TransferAsset = 16, + Command_Command_OneOfCase_RemovePeer = 17, + Command_Command_OneOfCase_CompareAndSetAccountDetail = 18, }; @interface Command : GPBMessage @@ -427,6 +479,10 @@ typedef GPB_ENUM(Command_Command_OneOfCase) { @property(nonatomic, readwrite, strong, null_resettable) TransferAsset *transferAsset; +@property(nonatomic, readwrite, strong, null_resettable) RemovePeer *removePeer; + +@property(nonatomic, readwrite, strong, null_resettable) CompareAndSetAccountDetail *compareAndSetAccountDetail; + @end /** diff --git a/ProtoGen/Commands.pbobjc.m b/ProtoGen/Commands.pbobjc.m old mode 100755 new mode 100644 index efd5e359d..faa7f6bb4 --- a/ProtoGen/Commands.pbobjc.m +++ b/ProtoGen/Commands.pbobjc.m @@ -141,6 +141,49 @@ + (GPBDescriptor *)descriptor { @end +#pragma mark - RemovePeer + +@implementation RemovePeer + +@dynamic publicKey; + +typedef struct RemovePeer__storage_ { + uint32_t _has_storage_[1]; + NSString *publicKey; +} RemovePeer__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "publicKey", + .dataTypeSpecific.className = NULL, + .number = RemovePeer_FieldNumber_PublicKey, + .hasIndex = 0, + .offset = (uint32_t)offsetof(RemovePeer__storage_, publicKey), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[RemovePeer class] + rootClass:[CommandsRoot class] + file:CommandsRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(RemovePeer__storage_) + flags:GPBDescriptorInitializationFlag_None]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; +} + +@end + #pragma mark - AddSignatory @implementation AddSignatory @@ -987,6 +1030,94 @@ + (GPBDescriptor *)descriptor { @end +#pragma mark - CompareAndSetAccountDetail + +@implementation CompareAndSetAccountDetail + +@dynamic optOldValueOneOfCase; +@dynamic accountId; +@dynamic key; +@dynamic value; +@dynamic oldValue; + +typedef struct CompareAndSetAccountDetail__storage_ { + uint32_t _has_storage_[2]; + NSString *accountId; + NSString *key; + NSString *value; + NSString *oldValue; +} CompareAndSetAccountDetail__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "accountId", + .dataTypeSpecific.className = NULL, + .number = CompareAndSetAccountDetail_FieldNumber_AccountId, + .hasIndex = 0, + .offset = (uint32_t)offsetof(CompareAndSetAccountDetail__storage_, accountId), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "key", + .dataTypeSpecific.className = NULL, + .number = CompareAndSetAccountDetail_FieldNumber_Key, + .hasIndex = 1, + .offset = (uint32_t)offsetof(CompareAndSetAccountDetail__storage_, key), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "value", + .dataTypeSpecific.className = NULL, + .number = CompareAndSetAccountDetail_FieldNumber_Value, + .hasIndex = 2, + .offset = (uint32_t)offsetof(CompareAndSetAccountDetail__storage_, value), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "oldValue", + .dataTypeSpecific.className = NULL, + .number = CompareAndSetAccountDetail_FieldNumber_OldValue, + .hasIndex = -1, + .offset = (uint32_t)offsetof(CompareAndSetAccountDetail__storage_, oldValue), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[CompareAndSetAccountDetail class] + rootClass:[CommandsRoot class] + file:CommandsRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(CompareAndSetAccountDetail__storage_) + flags:GPBDescriptorInitializationFlag_None]; + static const char *oneofs[] = { + "optOldValue", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void CompareAndSetAccountDetail_ClearOptOldValueOneOfCase(CompareAndSetAccountDetail *message) { + GPBDescriptor *descriptor = [message descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBMaybeClearOneof(message, oneof, -1, 0); +} #pragma mark - Command @implementation Command @@ -1008,6 +1139,8 @@ @implementation Command @dynamic setAccountQuorum; @dynamic subtractAssetQuantity; @dynamic transferAsset; +@dynamic removePeer; +@dynamic compareAndSetAccountDetail; typedef struct Command__storage_ { uint32_t _has_storage_[2]; @@ -1027,6 +1160,8 @@ @implementation Command SetAccountQuorum *setAccountQuorum; SubtractAssetQuantity *subtractAssetQuantity; TransferAsset *transferAsset; + RemovePeer *removePeer; + CompareAndSetAccountDetail *compareAndSetAccountDetail; } Command__storage_; // This method is threadsafe because it is initially called @@ -1179,6 +1314,24 @@ + (GPBDescriptor *)descriptor { .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, + { + .name = "removePeer", + .dataTypeSpecific.className = GPBStringifySymbol(RemovePeer), + .number = Command_FieldNumber_RemovePeer, + .hasIndex = -1, + .offset = (uint32_t)offsetof(Command__storage_, removePeer), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "compareAndSetAccountDetail", + .dataTypeSpecific.className = GPBStringifySymbol(CompareAndSetAccountDetail), + .number = Command_FieldNumber_CompareAndSetAccountDetail, + .hasIndex = -1, + .offset = (uint32_t)offsetof(Command__storage_, compareAndSetAccountDetail), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, }; GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[Command class] diff --git a/ProtoGen/Endpoint.pbobjc.h b/ProtoGen/Endpoint.pbobjc.h old mode 100755 new mode 100644 diff --git a/ProtoGen/Endpoint.pbobjc.m b/ProtoGen/Endpoint.pbobjc.m old mode 100755 new mode 100644 diff --git a/ProtoGen/Endpoint.pbrpc.h b/ProtoGen/Endpoint.pbrpc.h old mode 100755 new mode 100644 diff --git a/ProtoGen/Endpoint.pbrpc.m b/ProtoGen/Endpoint.pbrpc.m old mode 100755 new mode 100644 diff --git a/ProtoGen/Primitive.pbobjc.h b/ProtoGen/Primitive.pbobjc.h old mode 100755 new mode 100644 index 40d2d0401..541f22fd3 --- a/ProtoGen/Primitive.pbobjc.h +++ b/ProtoGen/Primitive.pbobjc.h @@ -57,6 +57,7 @@ typedef GPB_ENUM(RolePermission) { RolePermission_CanAddAssetQty = 3, RolePermission_CanSubtractAssetQty = 4, RolePermission_CanAddPeer = 5, + RolePermission_CanRemovePeer = 46, RolePermission_CanAddSignatory = 6, RolePermission_CanRemoveSignatory = 7, RolePermission_CanSetQuorum = 8, @@ -93,6 +94,7 @@ typedef GPB_ENUM(RolePermission) { RolePermission_CanGetMyTxs = 35, RolePermission_CanGetAllTxs = 36, RolePermission_CanGetBlocks = 42, + RolePermission_CanGetPeers = 45, /** Grant permissions */ RolePermission_CanGrantCanSetMyQuorum = 37, @@ -182,6 +184,21 @@ typedef GPB_ENUM(Peer_FieldNumber) { @end +#pragma mark - AccountDetailRecordId + +typedef GPB_ENUM(AccountDetailRecordId_FieldNumber) { + AccountDetailRecordId_FieldNumber_Writer = 1, + AccountDetailRecordId_FieldNumber_Key = 2, +}; + +@interface AccountDetailRecordId : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSString *writer; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *key; + +@end + NS_ASSUME_NONNULL_END CF_EXTERN_C_END diff --git a/ProtoGen/Primitive.pbobjc.m b/ProtoGen/Primitive.pbobjc.m old mode 100755 new mode 100644 index 6b1d095dc..6ed831b54 --- a/ProtoGen/Primitive.pbobjc.m +++ b/ProtoGen/Primitive.pbobjc.m @@ -50,25 +50,25 @@ @implementation PrimitiveRoot static const char *valueNames = "CanAppendRole\000CanCreateRole\000CanDetachRol" "e\000CanAddAssetQty\000CanSubtractAssetQty\000Can" - "AddPeer\000CanAddSignatory\000CanRemoveSignato" - "ry\000CanSetQuorum\000CanCreateAccount\000CanSetD" - "etail\000CanCreateAsset\000CanTransfer\000CanRece" - "ive\000CanCreateDomain\000CanAddDomainAssetQty" - "\000CanSubtractDomainAssetQty\000CanReadAssets" - "\000CanGetRoles\000CanGetMyAccount\000CanGetAllAc" - "counts\000CanGetDomainAccounts\000CanGetMySign" - "atories\000CanGetAllSignatories\000CanGetDomai" - "nSignatories\000CanGetMyAccAst\000CanGetAllAcc" - "Ast\000CanGetDomainAccAst\000CanGetMyAccDetail" - "\000CanGetAllAccDetail\000CanGetDomainAccDetai" - "l\000CanGetMyAccTxs\000CanGetAllAccTxs\000CanGetD" - "omainAccTxs\000CanGetMyAccAstTxs\000CanGetAllA" - "ccAstTxs\000CanGetDomainAccAstTxs\000CanGetMyT" - "xs\000CanGetAllTxs\000CanGetBlocks\000CanGrantCan" - "SetMyQuorum\000CanGrantCanAddMySignatory\000Ca" - "nGrantCanRemoveMySignatory\000CanGrantCanTr" - "ansferMyAssets\000CanGrantCanSetMyAccountDe" - "tail\000"; + "AddPeer\000CanRemovePeer\000CanAddSignatory\000Ca" + "nRemoveSignatory\000CanSetQuorum\000CanCreateA" + "ccount\000CanSetDetail\000CanCreateAsset\000CanTr" + "ansfer\000CanReceive\000CanCreateDomain\000CanAdd" + "DomainAssetQty\000CanSubtractDomainAssetQty" + "\000CanReadAssets\000CanGetRoles\000CanGetMyAccou" + "nt\000CanGetAllAccounts\000CanGetDomainAccount" + "s\000CanGetMySignatories\000CanGetAllSignatori" + "es\000CanGetDomainSignatories\000CanGetMyAccAs" + "t\000CanGetAllAccAst\000CanGetDomainAccAst\000Can" + "GetMyAccDetail\000CanGetAllAccDetail\000CanGet" + "DomainAccDetail\000CanGetMyAccTxs\000CanGetAll" + "AccTxs\000CanGetDomainAccTxs\000CanGetMyAccAst" + "Txs\000CanGetAllAccAstTxs\000CanGetDomainAccAs" + "tTxs\000CanGetMyTxs\000CanGetAllTxs\000CanGetBloc" + "ks\000CanGetPeers\000CanGrantCanSetMyQuorum\000Ca" + "nGrantCanAddMySignatory\000CanGrantCanRemov" + "eMySignatory\000CanGrantCanTransferMyAssets" + "\000CanGrantCanSetMyAccountDetail\000"; static const int32_t values[] = { RolePermission_CanAppendRole, RolePermission_CanCreateRole, @@ -76,6 +76,7 @@ @implementation PrimitiveRoot RolePermission_CanAddAssetQty, RolePermission_CanSubtractAssetQty, RolePermission_CanAddPeer, + RolePermission_CanRemovePeer, RolePermission_CanAddSignatory, RolePermission_CanRemoveSignatory, RolePermission_CanSetQuorum, @@ -110,13 +111,14 @@ @implementation PrimitiveRoot RolePermission_CanGetMyTxs, RolePermission_CanGetAllTxs, RolePermission_CanGetBlocks, + RolePermission_CanGetPeers, RolePermission_CanGrantCanSetMyQuorum, RolePermission_CanGrantCanAddMySignatory, RolePermission_CanGrantCanRemoveMySignatory, RolePermission_CanGrantCanTransferMyAssets, RolePermission_CanGrantCanSetMyAccountDetail, }; - static const char *extraTextFormatInfo = "-\000#\246\244\000\001#\246\244\000\002#\246\244\000\003#\243\245\243\000\004#\250\245\243\000\005#\243\244\000\006#\243\251\000\007#\246\251\000\010#\243\246\000\t#\246\247\000\n#\243\246\000\013#\246\245\000\014#\250\000\r#\247\000\016#\246\246\000\017#\243\246\245\243\000\020#\250\246\245\243\000\021#\244\246\000\022#\243\245\000\023#\243\242\247\000\024#\243\243\250\000\025#\243\246\250\000\026#\243\242\253\000\027#\243\243\253\000\030#\243\246\253\000\031#\243\242\243\243\000\032#\243\243\243\243\000\033#\243\246\243\243\000\034#\243\242\243\246\000\035#\243\243\243\246\000\036#\243\246\243\246\000\037#\243\242\243\243\000 #\243\243\243\243\000!#\243\246\243\243\000\"#\243\242\243\243\243\000##\243\243\243\243\243\000$#\243\246\243\243\243\000%#\243\242\243\000&#\243\243\243\000\'#\243\246\000(#\245\243\243\242\246\000)#\245\243\243\242\251\000*#\245\243\246\242\251\000+#\245\243\250\242\246\000,#\245\243\243\242\247\246\000"; + static const char *extraTextFormatInfo = "/\000#\246\244\000\001#\246\244\000\002#\246\244\000\003#\243\245\243\000\004#\250\245\243\000\005#\243\244\000\006#\246\244\000\007#\243\251\000\010#\246\251\000\t#\243\246\000\n#\246\247\000\013#\243\246\000\014#\246\245\000\r#\250\000\016#\247\000\017#\246\246\000\020#\243\246\245\243\000\021#\250\246\245\243\000\022#\244\246\000\023#\243\245\000\024#\243\242\247\000\025#\243\243\250\000\026#\243\246\250\000\027#\243\242\253\000\030#\243\243\253\000\031#\243\246\253\000\032#\243\242\243\243\000\033#\243\243\243\243\000\034#\243\246\243\243\000\035#\243\242\243\246\000\036#\243\243\243\246\000\037#\243\246\243\246\000 #\243\242\243\243\000!#\243\243\243\243\000\"#\243\246\243\243\000##\243\242\243\243\243\000$#\243\243\243\243\243\000%#\243\246\243\243\243\000&#\243\242\243\000\'#\243\243\243\000(#\243\246\000)#\243\245\000*#\245\243\243\242\246\000+#\245\243\243\242\251\000,#\245\243\246\242\251\000-#\245\243\250\242\246\000.#\245\243\243\242\247\246\000"; GPBEnumDescriptor *worker = [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(RolePermission) valueNames:valueNames @@ -139,6 +141,7 @@ BOOL RolePermission_IsValidValue(int32_t value__) { case RolePermission_CanAddAssetQty: case RolePermission_CanSubtractAssetQty: case RolePermission_CanAddPeer: + case RolePermission_CanRemovePeer: case RolePermission_CanAddSignatory: case RolePermission_CanRemoveSignatory: case RolePermission_CanSetQuorum: @@ -173,6 +176,7 @@ BOOL RolePermission_IsValidValue(int32_t value__) { case RolePermission_CanGetMyTxs: case RolePermission_CanGetAllTxs: case RolePermission_CanGetBlocks: + case RolePermission_CanGetPeers: case RolePermission_CanGrantCanSetMyQuorum: case RolePermission_CanGrantCanAddMySignatory: case RolePermission_CanGrantCanRemoveMySignatory: @@ -336,6 +340,60 @@ + (GPBDescriptor *)descriptor { @end +#pragma mark - AccountDetailRecordId + +@implementation AccountDetailRecordId + +@dynamic writer; +@dynamic key; + +typedef struct AccountDetailRecordId__storage_ { + uint32_t _has_storage_[1]; + NSString *writer; + NSString *key; +} AccountDetailRecordId__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "writer", + .dataTypeSpecific.className = NULL, + .number = AccountDetailRecordId_FieldNumber_Writer, + .hasIndex = 0, + .offset = (uint32_t)offsetof(AccountDetailRecordId__storage_, writer), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "key", + .dataTypeSpecific.className = NULL, + .number = AccountDetailRecordId_FieldNumber_Key, + .hasIndex = 1, + .offset = (uint32_t)offsetof(AccountDetailRecordId__storage_, key), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[AccountDetailRecordId class] + rootClass:[PrimitiveRoot class] + file:PrimitiveRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(AccountDetailRecordId__storage_) + flags:GPBDescriptorInitializationFlag_None]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; +} + +@end + #pragma clang diagnostic pop diff --git a/ProtoGen/Proposal.pbobjc.h b/ProtoGen/Proposal.pbobjc.h old mode 100755 new mode 100644 diff --git a/ProtoGen/Proposal.pbobjc.m b/ProtoGen/Proposal.pbobjc.m old mode 100755 new mode 100644 diff --git a/ProtoGen/QryResponses.pbobjc.h b/ProtoGen/QryResponses.pbobjc.h old mode 100755 new mode 100644 index cd3abe223..155538818 --- a/ProtoGen/QryResponses.pbobjc.h +++ b/ProtoGen/QryResponses.pbobjc.h @@ -30,6 +30,7 @@ CF_EXTERN_C_BEGIN @class Account; @class AccountAsset; @class AccountAssetResponse; +@class AccountDetailRecordId; @class AccountDetailResponse; @class AccountResponse; @class Asset; @@ -38,6 +39,10 @@ CF_EXTERN_C_BEGIN @class BlockErrorResponse; @class BlockResponse; @class ErrorResponse; +@class Peer; +@class PeersResponse; +@class PendingTransactionsPageResponse; +@class PendingTransactionsPageResponse_BatchInfo; @class RolePermissionsResponse; @class RolesResponse; @class SignatoriesResponse; @@ -183,6 +188,13 @@ typedef GPB_ENUM(AccountAsset_FieldNumber) { typedef GPB_ENUM(AccountAssetResponse_FieldNumber) { AccountAssetResponse_FieldNumber_AccountAssetsArray = 1, + AccountAssetResponse_FieldNumber_TotalNumber = 2, + AccountAssetResponse_FieldNumber_NextAssetId = 3, +}; + +typedef GPB_ENUM(AccountAssetResponse_OptNextAssetId_OneOfCase) { + AccountAssetResponse_OptNextAssetId_OneOfCase_GPBUnsetOneOfCase = 0, + AccountAssetResponse_OptNextAssetId_OneOfCase_NextAssetId = 3, }; /** @@ -194,18 +206,37 @@ typedef GPB_ENUM(AccountAssetResponse_FieldNumber) { /** The number of items in @c accountAssetsArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger accountAssetsArray_Count; +@property(nonatomic, readwrite) uint32_t totalNumber; + +@property(nonatomic, readonly) AccountAssetResponse_OptNextAssetId_OneOfCase optNextAssetIdOneOfCase; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *nextAssetId; + @end +/** + * Clears whatever value was set for the oneof 'optNextAssetId'. + **/ +void AccountAssetResponse_ClearOptNextAssetIdOneOfCase(AccountAssetResponse *message); + #pragma mark - AccountDetailResponse typedef GPB_ENUM(AccountDetailResponse_FieldNumber) { AccountDetailResponse_FieldNumber_Detail = 1, + AccountDetailResponse_FieldNumber_TotalNumber = 2, + AccountDetailResponse_FieldNumber_NextRecordId = 3, }; @interface AccountDetailResponse : GPBMessage @property(nonatomic, readwrite, copy, null_resettable) NSString *detail; +@property(nonatomic, readwrite) uint64_t totalNumber; + +@property(nonatomic, readwrite, strong, null_resettable) AccountDetailRecordId *nextRecordId; +/** Test to see if @c nextRecordId has been set. */ +@property(nonatomic, readwrite) BOOL hasNextRecordId; + @end #pragma mark - AccountResponse @@ -360,6 +391,57 @@ typedef GPB_ENUM(TransactionsPageResponse_NextPageTag_OneOfCase) { **/ void TransactionsPageResponse_ClearNextPageTagOneOfCase(TransactionsPageResponse *message); +#pragma mark - PendingTransactionsPageResponse + +typedef GPB_ENUM(PendingTransactionsPageResponse_FieldNumber) { + PendingTransactionsPageResponse_FieldNumber_TransactionsArray = 1, + PendingTransactionsPageResponse_FieldNumber_AllTransactionsSize = 2, + PendingTransactionsPageResponse_FieldNumber_NextBatchInfo = 3, +}; + +@interface PendingTransactionsPageResponse : GPBMessage + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *transactionsArray; +/** The number of items in @c transactionsArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger transactionsArray_Count; + +@property(nonatomic, readwrite) uint32_t allTransactionsSize; + +@property(nonatomic, readwrite, strong, null_resettable) PendingTransactionsPageResponse_BatchInfo *nextBatchInfo; +/** Test to see if @c nextBatchInfo has been set. */ +@property(nonatomic, readwrite) BOOL hasNextBatchInfo; + +@end + +#pragma mark - PendingTransactionsPageResponse_BatchInfo + +typedef GPB_ENUM(PendingTransactionsPageResponse_BatchInfo_FieldNumber) { + PendingTransactionsPageResponse_BatchInfo_FieldNumber_FirstTxHash = 1, + PendingTransactionsPageResponse_BatchInfo_FieldNumber_BatchSize = 2, +}; + +@interface PendingTransactionsPageResponse_BatchInfo : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSString *firstTxHash; + +@property(nonatomic, readwrite) uint32_t batchSize; + +@end + +#pragma mark - PeersResponse + +typedef GPB_ENUM(PeersResponse_FieldNumber) { + PeersResponse_FieldNumber_PeersArray = 1, +}; + +@interface PeersResponse : GPBMessage + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *peersArray; +/** The number of items in @c peersArray without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger peersArray_Count; + +@end + #pragma mark - QueryResponse typedef GPB_ENUM(QueryResponse_FieldNumber) { @@ -374,6 +456,9 @@ typedef GPB_ENUM(QueryResponse_FieldNumber) { QueryResponse_FieldNumber_RolePermissionsResponse = 9, QueryResponse_FieldNumber_QueryHash = 10, QueryResponse_FieldNumber_TransactionsPageResponse = 11, + QueryResponse_FieldNumber_BlockResponse = 12, + QueryResponse_FieldNumber_PendingTransactionsPageResponse = 13, + QueryResponse_FieldNumber_PeersResponse = 14, }; typedef GPB_ENUM(QueryResponse_Response_OneOfCase) { @@ -388,6 +473,9 @@ typedef GPB_ENUM(QueryResponse_Response_OneOfCase) { QueryResponse_Response_OneOfCase_RolesResponse = 8, QueryResponse_Response_OneOfCase_RolePermissionsResponse = 9, QueryResponse_Response_OneOfCase_TransactionsPageResponse = 11, + QueryResponse_Response_OneOfCase_PendingTransactionsPageResponse = 13, + QueryResponse_Response_OneOfCase_BlockResponse = 12, + QueryResponse_Response_OneOfCase_PeersResponse = 14, }; @interface QueryResponse : GPBMessage @@ -414,6 +502,12 @@ typedef GPB_ENUM(QueryResponse_Response_OneOfCase) { @property(nonatomic, readwrite, strong, null_resettable) TransactionsPageResponse *transactionsPageResponse; +@property(nonatomic, readwrite, strong, null_resettable) PendingTransactionsPageResponse *pendingTransactionsPageResponse; + +@property(nonatomic, readwrite, strong, null_resettable) BlockResponse *blockResponse; + +@property(nonatomic, readwrite, strong, null_resettable) PeersResponse *peersResponse; + @property(nonatomic, readwrite, copy, null_resettable) NSString *queryHash; @end diff --git a/ProtoGen/QryResponses.pbobjc.m b/ProtoGen/QryResponses.pbobjc.m old mode 100755 new mode 100644 index 91bcd123c..efc39afc8 --- a/ProtoGen/QryResponses.pbobjc.m +++ b/ProtoGen/QryResponses.pbobjc.m @@ -310,11 +310,16 @@ + (GPBDescriptor *)descriptor { @implementation AccountAssetResponse +@dynamic optNextAssetIdOneOfCase; @dynamic accountAssetsArray, accountAssetsArray_Count; +@dynamic totalNumber; +@dynamic nextAssetId; typedef struct AccountAssetResponse__storage_ { - uint32_t _has_storage_[1]; + uint32_t _has_storage_[2]; + uint32_t totalNumber; NSMutableArray *accountAssetsArray; + NSString *nextAssetId; } AccountAssetResponse__storage_; // This method is threadsafe because it is initially called @@ -332,6 +337,24 @@ + (GPBDescriptor *)descriptor { .flags = GPBFieldRepeated, .dataType = GPBDataTypeMessage, }, + { + .name = "totalNumber", + .dataTypeSpecific.className = NULL, + .number = AccountAssetResponse_FieldNumber_TotalNumber, + .hasIndex = 0, + .offset = (uint32_t)offsetof(AccountAssetResponse__storage_, totalNumber), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt32, + }, + { + .name = "nextAssetId", + .dataTypeSpecific.className = NULL, + .number = AccountAssetResponse_FieldNumber_NextAssetId, + .hasIndex = -1, + .offset = (uint32_t)offsetof(AccountAssetResponse__storage_, nextAssetId), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, }; GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[AccountAssetResponse class] @@ -341,6 +364,12 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(AccountAssetResponse__storage_) flags:GPBDescriptorInitializationFlag_None]; + static const char *oneofs[] = { + "optNextAssetId", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; NSAssert(descriptor == nil, @"Startup recursed!"); descriptor = localDescriptor; } @@ -349,15 +378,24 @@ + (GPBDescriptor *)descriptor { @end +void AccountAssetResponse_ClearOptNextAssetIdOneOfCase(AccountAssetResponse *message) { + GPBDescriptor *descriptor = [message descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBMaybeClearOneof(message, oneof, -1, 0); +} #pragma mark - AccountDetailResponse @implementation AccountDetailResponse @dynamic detail; +@dynamic totalNumber; +@dynamic hasNextRecordId, nextRecordId; typedef struct AccountDetailResponse__storage_ { uint32_t _has_storage_[1]; NSString *detail; + AccountDetailRecordId *nextRecordId; + uint64_t totalNumber; } AccountDetailResponse__storage_; // This method is threadsafe because it is initially called @@ -375,6 +413,24 @@ + (GPBDescriptor *)descriptor { .flags = GPBFieldOptional, .dataType = GPBDataTypeString, }, + { + .name = "totalNumber", + .dataTypeSpecific.className = NULL, + .number = AccountDetailResponse_FieldNumber_TotalNumber, + .hasIndex = 1, + .offset = (uint32_t)offsetof(AccountDetailResponse__storage_, totalNumber), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt64, + }, + { + .name = "nextRecordId", + .dataTypeSpecific.className = GPBStringifySymbol(AccountDetailRecordId), + .number = AccountDetailResponse_FieldNumber_NextRecordId, + .hasIndex = 2, + .offset = (uint32_t)offsetof(AccountDetailResponse__storage_, nextRecordId), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, }; GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[AccountDetailResponse class] @@ -865,6 +921,169 @@ void TransactionsPageResponse_ClearNextPageTagOneOfCase(TransactionsPageResponse GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBMaybeClearOneof(message, oneof, -1, 0); } +#pragma mark - PendingTransactionsPageResponse + +@implementation PendingTransactionsPageResponse + +@dynamic transactionsArray, transactionsArray_Count; +@dynamic allTransactionsSize; +@dynamic hasNextBatchInfo, nextBatchInfo; + +typedef struct PendingTransactionsPageResponse__storage_ { + uint32_t _has_storage_[1]; + uint32_t allTransactionsSize; + NSMutableArray *transactionsArray; + PendingTransactionsPageResponse_BatchInfo *nextBatchInfo; +} PendingTransactionsPageResponse__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "transactionsArray", + .dataTypeSpecific.className = GPBStringifySymbol(Transaction), + .number = PendingTransactionsPageResponse_FieldNumber_TransactionsArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(PendingTransactionsPageResponse__storage_, transactionsArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + { + .name = "allTransactionsSize", + .dataTypeSpecific.className = NULL, + .number = PendingTransactionsPageResponse_FieldNumber_AllTransactionsSize, + .hasIndex = 0, + .offset = (uint32_t)offsetof(PendingTransactionsPageResponse__storage_, allTransactionsSize), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt32, + }, + { + .name = "nextBatchInfo", + .dataTypeSpecific.className = GPBStringifySymbol(PendingTransactionsPageResponse_BatchInfo), + .number = PendingTransactionsPageResponse_FieldNumber_NextBatchInfo, + .hasIndex = 1, + .offset = (uint32_t)offsetof(PendingTransactionsPageResponse__storage_, nextBatchInfo), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[PendingTransactionsPageResponse class] + rootClass:[QryResponsesRoot class] + file:QryResponsesRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(PendingTransactionsPageResponse__storage_) + flags:GPBDescriptorInitializationFlag_None]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - PendingTransactionsPageResponse_BatchInfo + +@implementation PendingTransactionsPageResponse_BatchInfo + +@dynamic firstTxHash; +@dynamic batchSize; + +typedef struct PendingTransactionsPageResponse_BatchInfo__storage_ { + uint32_t _has_storage_[1]; + uint32_t batchSize; + NSString *firstTxHash; +} PendingTransactionsPageResponse_BatchInfo__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "firstTxHash", + .dataTypeSpecific.className = NULL, + .number = PendingTransactionsPageResponse_BatchInfo_FieldNumber_FirstTxHash, + .hasIndex = 0, + .offset = (uint32_t)offsetof(PendingTransactionsPageResponse_BatchInfo__storage_, firstTxHash), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "batchSize", + .dataTypeSpecific.className = NULL, + .number = PendingTransactionsPageResponse_BatchInfo_FieldNumber_BatchSize, + .hasIndex = 1, + .offset = (uint32_t)offsetof(PendingTransactionsPageResponse_BatchInfo__storage_, batchSize), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt32, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[PendingTransactionsPageResponse_BatchInfo class] + rootClass:[QryResponsesRoot class] + file:QryResponsesRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(PendingTransactionsPageResponse_BatchInfo__storage_) + flags:GPBDescriptorInitializationFlag_None]; + [localDescriptor setupContainingMessageClassName:GPBStringifySymbol(PendingTransactionsPageResponse)]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - PeersResponse + +@implementation PeersResponse + +@dynamic peersArray, peersArray_Count; + +typedef struct PeersResponse__storage_ { + uint32_t _has_storage_[1]; + NSMutableArray *peersArray; +} PeersResponse__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "peersArray", + .dataTypeSpecific.className = GPBStringifySymbol(Peer), + .number = PeersResponse_FieldNumber_PeersArray, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(PeersResponse__storage_, peersArray), + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[PeersResponse class] + rootClass:[QryResponsesRoot class] + file:QryResponsesRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(PeersResponse__storage_) + flags:GPBDescriptorInitializationFlag_None]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; +} + +@end + #pragma mark - QueryResponse @implementation QueryResponse @@ -880,6 +1099,9 @@ @implementation QueryResponse @dynamic rolesResponse; @dynamic rolePermissionsResponse; @dynamic transactionsPageResponse; +@dynamic pendingTransactionsPageResponse; +@dynamic blockResponse; +@dynamic peersResponse; @dynamic queryHash; typedef struct QueryResponse__storage_ { @@ -895,6 +1117,9 @@ @implementation QueryResponse RolePermissionsResponse *rolePermissionsResponse; NSString *queryHash; TransactionsPageResponse *transactionsPageResponse; + BlockResponse *blockResponse; + PendingTransactionsPageResponse *pendingTransactionsPageResponse; + PeersResponse *peersResponse; } QueryResponse__storage_; // This method is threadsafe because it is initially called @@ -1002,6 +1227,33 @@ + (GPBDescriptor *)descriptor { .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, + { + .name = "blockResponse", + .dataTypeSpecific.className = GPBStringifySymbol(BlockResponse), + .number = QueryResponse_FieldNumber_BlockResponse, + .hasIndex = -1, + .offset = (uint32_t)offsetof(QueryResponse__storage_, blockResponse), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "pendingTransactionsPageResponse", + .dataTypeSpecific.className = GPBStringifySymbol(PendingTransactionsPageResponse), + .number = QueryResponse_FieldNumber_PendingTransactionsPageResponse, + .hasIndex = -1, + .offset = (uint32_t)offsetof(QueryResponse__storage_, pendingTransactionsPageResponse), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "peersResponse", + .dataTypeSpecific.className = GPBStringifySymbol(PeersResponse), + .number = QueryResponse_FieldNumber_PeersResponse, + .hasIndex = -1, + .offset = (uint32_t)offsetof(QueryResponse__storage_, peersResponse), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, }; GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[QueryResponse class] diff --git a/ProtoGen/Queries.pbobjc.h b/ProtoGen/Queries.pbobjc.h old mode 100755 new mode 100644 index 8876b1420..6947b474f --- a/ProtoGen/Queries.pbobjc.h +++ b/ProtoGen/Queries.pbobjc.h @@ -27,12 +27,17 @@ CF_EXTERN_C_BEGIN +@class AccountDetailPaginationMeta; +@class AccountDetailRecordId; +@class AssetPaginationMeta; @class GetAccount; @class GetAccountAssetTransactions; @class GetAccountAssets; @class GetAccountDetail; @class GetAccountTransactions; @class GetAssetInfo; +@class GetBlock; +@class GetPeers; @class GetPendingTransactions; @class GetRolePermissions; @class GetRoles; @@ -87,6 +92,33 @@ typedef GPB_ENUM(TxPaginationMeta_OptFirstTxHash_OneOfCase) { **/ void TxPaginationMeta_ClearOptFirstTxHashOneOfCase(TxPaginationMeta *message); +#pragma mark - AssetPaginationMeta + +typedef GPB_ENUM(AssetPaginationMeta_FieldNumber) { + AssetPaginationMeta_FieldNumber_PageSize = 1, + AssetPaginationMeta_FieldNumber_FirstAssetId = 2, +}; + +typedef GPB_ENUM(AssetPaginationMeta_OptFirstAssetId_OneOfCase) { + AssetPaginationMeta_OptFirstAssetId_OneOfCase_GPBUnsetOneOfCase = 0, + AssetPaginationMeta_OptFirstAssetId_OneOfCase_FirstAssetId = 2, +}; + +@interface AssetPaginationMeta : GPBMessage + +@property(nonatomic, readwrite) uint32_t pageSize; + +@property(nonatomic, readonly) AssetPaginationMeta_OptFirstAssetId_OneOfCase optFirstAssetIdOneOfCase; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *firstAssetId; + +@end + +/** + * Clears whatever value was set for the oneof 'optFirstAssetId'. + **/ +void AssetPaginationMeta_ClearOptFirstAssetIdOneOfCase(AssetPaginationMeta *message); + #pragma mark - GetAccount typedef GPB_ENUM(GetAccount_FieldNumber) { @@ -99,6 +131,18 @@ typedef GPB_ENUM(GetAccount_FieldNumber) { @end +#pragma mark - GetBlock + +typedef GPB_ENUM(GetBlock_FieldNumber) { + GetBlock_FieldNumber_Height = 1, +}; + +@interface GetBlock : GPBMessage + +@property(nonatomic, readwrite) uint64_t height; + +@end + #pragma mark - GetSignatories typedef GPB_ENUM(GetSignatories_FieldNumber) { @@ -166,12 +210,34 @@ typedef GPB_ENUM(GetTransactions_FieldNumber) { typedef GPB_ENUM(GetAccountAssets_FieldNumber) { GetAccountAssets_FieldNumber_AccountId = 1, + GetAccountAssets_FieldNumber_PaginationMeta = 2, }; @interface GetAccountAssets : GPBMessage @property(nonatomic, readwrite, copy, null_resettable) NSString *accountId; +@property(nonatomic, readwrite, strong, null_resettable) AssetPaginationMeta *paginationMeta; +/** Test to see if @c paginationMeta has been set. */ +@property(nonatomic, readwrite) BOOL hasPaginationMeta; + +@end + +#pragma mark - AccountDetailPaginationMeta + +typedef GPB_ENUM(AccountDetailPaginationMeta_FieldNumber) { + AccountDetailPaginationMeta_FieldNumber_PageSize = 1, + AccountDetailPaginationMeta_FieldNumber_FirstRecordId = 2, +}; + +@interface AccountDetailPaginationMeta : GPBMessage + +@property(nonatomic, readwrite) uint32_t pageSize; + +@property(nonatomic, readwrite, strong, null_resettable) AccountDetailRecordId *firstRecordId; +/** Test to see if @c firstRecordId has been set. */ +@property(nonatomic, readwrite) BOOL hasFirstRecordId; + @end #pragma mark - GetAccountDetail @@ -180,6 +246,7 @@ typedef GPB_ENUM(GetAccountDetail_FieldNumber) { GetAccountDetail_FieldNumber_AccountId = 1, GetAccountDetail_FieldNumber_Key = 2, GetAccountDetail_FieldNumber_Writer = 3, + GetAccountDetail_FieldNumber_PaginationMeta = 4, }; typedef GPB_ENUM(GetAccountDetail_OptAccountId_OneOfCase) { @@ -211,6 +278,10 @@ typedef GPB_ENUM(GetAccountDetail_OptWriter_OneOfCase) { @property(nonatomic, readwrite, copy, null_resettable) NSString *writer; +@property(nonatomic, readwrite, strong, null_resettable) AccountDetailPaginationMeta *paginationMeta; +/** Test to see if @c paginationMeta has been set. */ +@property(nonatomic, readwrite) BOOL hasPaginationMeta; + @end /** @@ -258,8 +329,22 @@ typedef GPB_ENUM(GetRolePermissions_FieldNumber) { #pragma mark - GetPendingTransactions +typedef GPB_ENUM(GetPendingTransactions_FieldNumber) { + GetPendingTransactions_FieldNumber_PaginationMeta = 1, +}; + @interface GetPendingTransactions : GPBMessage +@property(nonatomic, readwrite, strong, null_resettable) TxPaginationMeta *paginationMeta; +/** Test to see if @c paginationMeta has been set. */ +@property(nonatomic, readwrite) BOOL hasPaginationMeta; + +@end + +#pragma mark - GetPeers + +@interface GetPeers : GPBMessage + @end #pragma mark - QueryPayloadMeta @@ -315,6 +400,8 @@ typedef GPB_ENUM(Query_Payload_FieldNumber) { Query_Payload_FieldNumber_GetRolePermissions = 11, Query_Payload_FieldNumber_GetAssetInfo = 12, Query_Payload_FieldNumber_GetPendingTransactions = 13, + Query_Payload_FieldNumber_GetBlock = 14, + Query_Payload_FieldNumber_GetPeers = 15, }; typedef GPB_ENUM(Query_Payload_Query_OneOfCase) { @@ -330,6 +417,8 @@ typedef GPB_ENUM(Query_Payload_Query_OneOfCase) { Query_Payload_Query_OneOfCase_GetRolePermissions = 11, Query_Payload_Query_OneOfCase_GetAssetInfo = 12, Query_Payload_Query_OneOfCase_GetPendingTransactions = 13, + Query_Payload_Query_OneOfCase_GetBlock = 14, + Query_Payload_Query_OneOfCase_GetPeers = 15, }; @interface Query_Payload : GPBMessage @@ -362,6 +451,10 @@ typedef GPB_ENUM(Query_Payload_Query_OneOfCase) { @property(nonatomic, readwrite, strong, null_resettable) GetPendingTransactions *getPendingTransactions; +@property(nonatomic, readwrite, strong, null_resettable) GetBlock *getBlock; + +@property(nonatomic, readwrite, strong, null_resettable) GetPeers *getPeers; + @end /** diff --git a/ProtoGen/Queries.pbobjc.m b/ProtoGen/Queries.pbobjc.m old mode 100755 new mode 100644 index 1b194db2b..6e55db19a --- a/ProtoGen/Queries.pbobjc.m +++ b/ProtoGen/Queries.pbobjc.m @@ -110,6 +110,72 @@ void TxPaginationMeta_ClearOptFirstTxHashOneOfCase(TxPaginationMeta *message) { GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; GPBMaybeClearOneof(message, oneof, -1, 0); } +#pragma mark - AssetPaginationMeta + +@implementation AssetPaginationMeta + +@dynamic optFirstAssetIdOneOfCase; +@dynamic pageSize; +@dynamic firstAssetId; + +typedef struct AssetPaginationMeta__storage_ { + uint32_t _has_storage_[2]; + uint32_t pageSize; + NSString *firstAssetId; +} AssetPaginationMeta__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "pageSize", + .dataTypeSpecific.className = NULL, + .number = AssetPaginationMeta_FieldNumber_PageSize, + .hasIndex = 0, + .offset = (uint32_t)offsetof(AssetPaginationMeta__storage_, pageSize), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt32, + }, + { + .name = "firstAssetId", + .dataTypeSpecific.className = NULL, + .number = AssetPaginationMeta_FieldNumber_FirstAssetId, + .hasIndex = -1, + .offset = (uint32_t)offsetof(AssetPaginationMeta__storage_, firstAssetId), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[AssetPaginationMeta class] + rootClass:[QueriesRoot class] + file:QueriesRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(AssetPaginationMeta__storage_) + flags:GPBDescriptorInitializationFlag_None]; + static const char *oneofs[] = { + "optFirstAssetId", + }; + [localDescriptor setupOneofs:oneofs + count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) + firstHasIndex:-1]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +void AssetPaginationMeta_ClearOptFirstAssetIdOneOfCase(AssetPaginationMeta *message) { + GPBDescriptor *descriptor = [message descriptor]; + GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0]; + GPBMaybeClearOneof(message, oneof, -1, 0); +} #pragma mark - GetAccount @implementation GetAccount @@ -153,6 +219,49 @@ + (GPBDescriptor *)descriptor { @end +#pragma mark - GetBlock + +@implementation GetBlock + +@dynamic height; + +typedef struct GetBlock__storage_ { + uint32_t _has_storage_[1]; + uint64_t height; +} GetBlock__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "height", + .dataTypeSpecific.className = NULL, + .number = GetBlock_FieldNumber_Height, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetBlock__storage_, height), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt64, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetBlock class] + rootClass:[QueriesRoot class] + file:QueriesRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetBlock__storage_) + flags:GPBDescriptorInitializationFlag_None]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; +} + +@end + #pragma mark - GetSignatories @implementation GetSignatories @@ -363,10 +472,12 @@ + (GPBDescriptor *)descriptor { @implementation GetAccountAssets @dynamic accountId; +@dynamic hasPaginationMeta, paginationMeta; typedef struct GetAccountAssets__storage_ { uint32_t _has_storage_[1]; NSString *accountId; + AssetPaginationMeta *paginationMeta; } GetAccountAssets__storage_; // This method is threadsafe because it is initially called @@ -384,6 +495,15 @@ + (GPBDescriptor *)descriptor { .flags = GPBFieldOptional, .dataType = GPBDataTypeString, }, + { + .name = "paginationMeta", + .dataTypeSpecific.className = GPBStringifySymbol(AssetPaginationMeta), + .number = GetAccountAssets_FieldNumber_PaginationMeta, + .hasIndex = 1, + .offset = (uint32_t)offsetof(GetAccountAssets__storage_, paginationMeta), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, }; GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[GetAccountAssets class] @@ -401,6 +521,60 @@ + (GPBDescriptor *)descriptor { @end +#pragma mark - AccountDetailPaginationMeta + +@implementation AccountDetailPaginationMeta + +@dynamic pageSize; +@dynamic hasFirstRecordId, firstRecordId; + +typedef struct AccountDetailPaginationMeta__storage_ { + uint32_t _has_storage_[1]; + uint32_t pageSize; + AccountDetailRecordId *firstRecordId; +} AccountDetailPaginationMeta__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "pageSize", + .dataTypeSpecific.className = NULL, + .number = AccountDetailPaginationMeta_FieldNumber_PageSize, + .hasIndex = 0, + .offset = (uint32_t)offsetof(AccountDetailPaginationMeta__storage_, pageSize), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeUInt32, + }, + { + .name = "firstRecordId", + .dataTypeSpecific.className = GPBStringifySymbol(AccountDetailRecordId), + .number = AccountDetailPaginationMeta_FieldNumber_FirstRecordId, + .hasIndex = 1, + .offset = (uint32_t)offsetof(AccountDetailPaginationMeta__storage_, firstRecordId), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[AccountDetailPaginationMeta class] + rootClass:[QueriesRoot class] + file:QueriesRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(AccountDetailPaginationMeta__storage_) + flags:GPBDescriptorInitializationFlag_None]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; +} + +@end + #pragma mark - GetAccountDetail @implementation GetAccountDetail @@ -411,12 +585,14 @@ @implementation GetAccountDetail @dynamic accountId; @dynamic key; @dynamic writer; +@dynamic hasPaginationMeta, paginationMeta; typedef struct GetAccountDetail__storage_ { uint32_t _has_storage_[4]; NSString *accountId; NSString *key; NSString *writer; + AccountDetailPaginationMeta *paginationMeta; } GetAccountDetail__storage_; // This method is threadsafe because it is initially called @@ -452,6 +628,15 @@ + (GPBDescriptor *)descriptor { .flags = GPBFieldOptional, .dataType = GPBDataTypeString, }, + { + .name = "paginationMeta", + .dataTypeSpecific.className = GPBStringifySymbol(AccountDetailPaginationMeta), + .number = GetAccountDetail_FieldNumber_PaginationMeta, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetAccountDetail__storage_, paginationMeta), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, }; GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[GetAccountDetail class] @@ -612,9 +797,11 @@ + (GPBDescriptor *)descriptor { @implementation GetPendingTransactions +@dynamic hasPaginationMeta, paginationMeta; typedef struct GetPendingTransactions__storage_ { uint32_t _has_storage_[1]; + TxPaginationMeta *paginationMeta; } GetPendingTransactions__storage_; // This method is threadsafe because it is initially called @@ -622,13 +809,54 @@ @implementation GetPendingTransactions + (GPBDescriptor *)descriptor { static GPBDescriptor *descriptor = nil; if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "paginationMeta", + .dataTypeSpecific.className = GPBStringifySymbol(TxPaginationMeta), + .number = GetPendingTransactions_FieldNumber_PaginationMeta, + .hasIndex = 0, + .offset = (uint32_t)offsetof(GetPendingTransactions__storage_, paginationMeta), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + }; GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[GetPendingTransactions class] + rootClass:[QueriesRoot class] + file:QueriesRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(GetPendingTransactions__storage_) + flags:GPBDescriptorInitializationFlag_None]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GetPeers + +@implementation GetPeers + + +typedef struct GetPeers__storage_ { + uint32_t _has_storage_[1]; +} GetPeers__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GetPeers class] rootClass:[QueriesRoot class] file:QueriesRoot_FileDescriptor() fields:NULL fieldCount:0 - storageSize:sizeof(GetPendingTransactions__storage_) + storageSize:sizeof(GetPeers__storage_) flags:GPBDescriptorInitializationFlag_None]; NSAssert(descriptor == nil, @"Startup recursed!"); descriptor = localDescriptor; @@ -774,6 +1002,8 @@ @implementation Query_Payload @dynamic getRolePermissions; @dynamic getAssetInfo; @dynamic getPendingTransactions; +@dynamic getBlock; +@dynamic getPeers; typedef struct Query_Payload__storage_ { uint32_t _has_storage_[2]; @@ -789,6 +1019,8 @@ @implementation Query_Payload GetRolePermissions *getRolePermissions; GetAssetInfo *getAssetInfo; GetPendingTransactions *getPendingTransactions; + GetBlock *getBlock; + GetPeers *getPeers; } Query_Payload__storage_; // This method is threadsafe because it is initially called @@ -905,6 +1137,24 @@ + (GPBDescriptor *)descriptor { .flags = GPBFieldOptional, .dataType = GPBDataTypeMessage, }, + { + .name = "getBlock", + .dataTypeSpecific.className = GPBStringifySymbol(GetBlock), + .number = Query_Payload_FieldNumber_GetBlock, + .hasIndex = -1, + .offset = (uint32_t)offsetof(Query_Payload__storage_, getBlock), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, + { + .name = "getPeers", + .dataTypeSpecific.className = GPBStringifySymbol(GetPeers), + .number = Query_Payload_FieldNumber_GetPeers, + .hasIndex = -1, + .offset = (uint32_t)offsetof(Query_Payload__storage_, getPeers), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeMessage, + }, }; GPBDescriptor *localDescriptor = [GPBDescriptor allocDescriptorForClass:[Query_Payload class] diff --git a/ProtoGen/Transaction.pbobjc.h b/ProtoGen/Transaction.pbobjc.h old mode 100755 new mode 100644 index 02b9e84ba..3d20cafff --- a/ProtoGen/Transaction.pbobjc.h +++ b/ProtoGen/Transaction.pbobjc.h @@ -104,7 +104,7 @@ typedef GPB_ENUM(Transaction_Payload_OptionalBatchMeta_OneOfCase) { @interface Transaction_Payload : GPBMessage -/** transcation fields */ +/** transaction fields */ @property(nonatomic, readwrite, strong, null_resettable) Transaction_Payload_ReducedPayload *reducedPayload; /** Test to see if @c reducedPayload has been set. */ @property(nonatomic, readwrite) BOOL hasReducedPayload; diff --git a/ProtoGen/Transaction.pbobjc.m b/ProtoGen/Transaction.pbobjc.m old mode 100755 new mode 100644 diff --git a/Tests/Model/IRAssetPaginationTests.m b/Tests/Model/IRAssetPaginationTests.m new file mode 100644 index 000000000..cd58f1248 --- /dev/null +++ b/Tests/Model/IRAssetPaginationTests.m @@ -0,0 +1,40 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +@import XCTest; +@import IrohaCommunication; + +static NSString* const ASSET_ID = @"test#test"; + +@interface IRAssetPaginationTests : XCTestCase + +@end + +@implementation IRAssetPaginationTests + +- (void)testNonnilStartingAssetId { + id assetId = [IRAssetIdFactory assetWithIdentifier:ASSET_ID + error:nil]; + + UInt32 pageSize = 10; + + id pagination = [IRAssetPaginationFactory assetPagination:pageSize startingAssetId:assetId]; + + XCTAssertNotNil(pagination); + XCTAssertEqual(pagination.pageSize, pageSize); + XCTAssertEqualObjects(pagination.startingAssetId.identifier, assetId.identifier); +} + +- (void)testNilStartingAssetId { + UInt32 pageSize = 10; + + id pagination = [IRAssetPaginationFactory assetPagination:pageSize startingAssetId:nil]; + + XCTAssertNotNil(pagination); + XCTAssertEqual(pagination.pageSize, pageSize); + XCTAssertNil(pagination.startingAssetId); +} + +@end diff --git a/Tests/Query/IRQueryBuilderTests.m b/Tests/Query/IRQueryBuilderTests.m index 69b3b54e5..65a75fa41 100755 --- a/Tests/Query/IRQueryBuilderTests.m +++ b/Tests/Query/IRQueryBuilderTests.m @@ -135,6 +135,9 @@ - (void)testQueries { firstItemHash:nil error:nil]; + id assetPagination = [IRAssetPaginationFactory assetPagination:10 + startingAssetId:assetId]; + NSData *itemHash = [@"Test Data" dataUsingEncoding:NSUTF8StringEncoding]; IRQueryTestCase *getAccountTestCase = [[IRQueryTestCase alloc] initWithSelector:@selector(getAccount:) @@ -161,6 +164,10 @@ - (void)testQueries { arguments:@[accountId] protocol:@protocol(IRGetAccountAssets)]; + IRQueryTestCase *getAccountAssetsPaginated = [[IRQueryTestCase alloc] initWithSelector:@selector(getAccountAssets:pagination:) + arguments:@[accountId, assetPagination] + protocol:@protocol(IRGetAccountAssets)]; + IRQueryTestCase *getAccountDetail = [[IRQueryTestCase alloc] initWithSelector:@selector(getAccountDetail:writer:key:) arguments:@[accountId, accountId] protocol:@protocol(IRGetAccountDetail)]; @@ -187,6 +194,7 @@ - (void)testQueries { getAccountAssetTransactions, getTransactions, getAccountAssets, + getAccountAssetsPaginated, getAccountDetail, getRoles, getRolePermission, diff --git a/Tests/Serialization/IRQueryResponseDeserializationTests.m b/Tests/Serialization/IRQueryResponseDeserializationTests.m index 0fab55fba..6d19fb725 100644 --- a/Tests/Serialization/IRQueryResponseDeserializationTests.m +++ b/Tests/Serialization/IRQueryResponseDeserializationTests.m @@ -18,7 +18,7 @@ @interface IRQueryResponseDeserializationTests : XCTestCase @implementation IRQueryResponseDeserializationTests -- (void)testAssetResponseDeserialization { +- (void)testAssetResponseDeserializationWithoutNextPage { // given AccountAsset *accountAsset = [[AccountAsset alloc] init]; accountAsset.accountId = VALID_ACCOUNT_IDENTIFIER; @@ -27,6 +27,43 @@ - (void)testAssetResponseDeserialization { AccountAssetResponse *assetResponse = [[AccountAssetResponse alloc] init]; [assetResponse setAccountAssetsArray:[NSMutableArray arrayWithObject:accountAsset]]; + [assetResponse setTotalNumber:1]; + [assetResponse setNextAssetId:nil]; + + NSString *queryHash = [assetResponse.data toHexString]; + + QueryResponse *response = [[QueryResponse alloc] init]; + [response setQueryHash:queryHash]; + [response setAccountAssetsResponse:assetResponse]; + + // when + + NSError *error = nil; + id irQueryResponse = [IRSerializationFactory deserializeQueryResponseFromData:response.data error:&error]; + + // then + + if (!irQueryResponse || ![irQueryResponse conformsToProtocol:@protocol(IRAccountAssetsResponse)]) { + XCTFail("Unexpected empty response"); + return; + } + + XCTAssertEqualObjects(irQueryResponse.queryHash, assetResponse.data); + + XCTAssertNil(error); +} + +- (void)testAssetResponseDeserializationWithNextPage { + // given + AccountAsset *accountAsset = [[AccountAsset alloc] init]; + accountAsset.accountId = VALID_ACCOUNT_IDENTIFIER; + accountAsset.assetId = VALID_ASSET_IDENTIFIER; + accountAsset.balance = VALID_BALANCE; + + AccountAssetResponse *assetResponse = [[AccountAssetResponse alloc] init]; + [assetResponse setAccountAssetsArray:[NSMutableArray arrayWithObject:accountAsset]]; + [assetResponse setTotalNumber:1]; + [assetResponse setNextAssetId:VALID_ASSET_IDENTIFIER]; NSString *queryHash = [assetResponse.data toHexString]; From bc17ed8df030fa19f9298c83e926f4719b92a951 Mon Sep 17 00:00:00 2001 From: Andrei Marin Date: Wed, 28 Aug 2019 09:23:11 +0300 Subject: [PATCH 2/8] Update to Iroha 1.1 account details pagination remove peer command compare and set account detail command get peers query role permissions Signed-off-by: Russel --- .../project.pbxproj | 4 ++ .../xcshareddata/xcschemes/UnitTests.xcscheme | 1 + Example/Podfile.lock | 2 +- .../Classes/Private/Commands/IRCommandAll.h | 2 + .../Commands/IRCompareAndSetAccountDetail.h | 18 ++++++ .../Commands/IRCompareAndSetAccountDetail.m | 46 +++++++++++++++ .../Classes/Private/Commands/IRRemovePeer.h | 15 +++++ .../Classes/Private/Commands/IRRemovePeer.m | 37 ++++++++++++ .../Classes/Private/IRQueryResponse+Proto.m | 57 +++++++++++++++++++ .../Classes/Private/Models/IRCommand+Proto.m | 48 ++++++++++++++++ .../Private/Queries/IRGetAccountDetail.h | 3 +- .../Private/Queries/IRGetAccountDetail.m | 23 +++++++- .../Classes/Private/Queries/IRGetPeers.h | 13 +++++ .../Classes/Private/Queries/IRGetPeers.m | 23 ++++++++ .../Classes/Private/Queries/IRQueryAll.h | 1 + .../Responses/IRAccountDetailResponse.h | 3 + .../Responses/IRAccountDetailResponse.m | 7 +++ .../Private/Responses/IRPeersResponse.h | 15 +++++ .../Private/Responses/IRPeersResponse.m | 21 +++++++ .../Private/Responses/IRQueryResponseAll.h | 1 + .../Classes/Public/Builder/IRQueryBuilder.h | 10 +++- .../Classes/Public/Builder/IRQueryBuilder.m | 19 ++++++- .../Public/Builder/IRTransactionBuilder.h | 7 +++ .../Public/Builder/IRTransactionBuilder.m | 20 +++++++ .../Model/Common/IRAccountDetailPagination.h | 26 +++++++++ .../Model/Common/IRAccountDetailPagination.m | 42 ++++++++++++++ .../Model/Common/IRAccountDetailRecordId.h | 26 +++++++++ .../Model/Common/IRAccountDetailRecordId.m | 37 ++++++++++++ .../Classes/Public/Model/Common/IRPeer.h | 29 ++++++++++ .../Classes/Public/Model/Common/IRPeer.m | 44 ++++++++++++++ .../Public/Model/Common/IRRolePermission.h | 2 + .../Public/Model/Common/IRRolePermission.m | 8 +++ .../Classes/Public/Model/IRCommand.h | 34 +++++++++++ .../Classes/Public/Model/IRQuery.h | 19 ++++++- .../Classes/Public/Model/IRQueryResponse.h | 23 ++++++++ Tests/Model/IRAccountDetailPaginationTests.m | 44 ++++++++++++++ Tests/Query/IRQueryBuilderTests.m | 17 +++++- 37 files changed, 736 insertions(+), 11 deletions(-) create mode 100644 IrohaCommunication/Classes/Private/Commands/IRCompareAndSetAccountDetail.h create mode 100644 IrohaCommunication/Classes/Private/Commands/IRCompareAndSetAccountDetail.m create mode 100644 IrohaCommunication/Classes/Private/Commands/IRRemovePeer.h create mode 100644 IrohaCommunication/Classes/Private/Commands/IRRemovePeer.m create mode 100644 IrohaCommunication/Classes/Private/Queries/IRGetPeers.h create mode 100644 IrohaCommunication/Classes/Private/Queries/IRGetPeers.m create mode 100644 IrohaCommunication/Classes/Private/Responses/IRPeersResponse.h create mode 100644 IrohaCommunication/Classes/Private/Responses/IRPeersResponse.m create mode 100644 IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailPagination.h create mode 100644 IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailPagination.m create mode 100644 IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailRecordId.h create mode 100644 IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailRecordId.m create mode 100644 IrohaCommunication/Classes/Public/Model/Common/IRPeer.h create mode 100644 IrohaCommunication/Classes/Public/Model/Common/IRPeer.m create mode 100644 Tests/Model/IRAccountDetailPaginationTests.m diff --git a/Example/IrohaCommunication.xcodeproj/project.pbxproj b/Example/IrohaCommunication.xcodeproj/project.pbxproj index c2c2aa318..88a571ef4 100644 --- a/Example/IrohaCommunication.xcodeproj/project.pbxproj +++ b/Example/IrohaCommunication.xcodeproj/project.pbxproj @@ -54,6 +54,7 @@ 844761F1224A5133009ADC0E /* IRQueryResponseDeserializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 844761F0224A5133009ADC0E /* IRQueryResponseDeserializationTests.m */; }; 8481A59122FD48800056D3D4 /* IRAssetPaginationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8481A59022FD48800056D3D4 /* IRAssetPaginationTests.m */; }; 84D693FB22EDCDB10059C1FB /* IRAccountRestoreWithBatchTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D693FA22EDCDB10059C1FB /* IRAccountRestoreWithBatchTest.m */; }; + 8BB6C2BF23164E04009B7AEA /* IRAccountDetailPaginationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BB6C2BE23164E04009B7AEA /* IRAccountDetailPaginationTests.m */; }; 8CA1A478927FFA33BA30A5B4 /* Pods_IntegrationTestHost.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 175938D8DE70C85E0CEA25AF /* Pods_IntegrationTestHost.framework */; }; /* End PBXBuildFile section */ @@ -159,6 +160,7 @@ 84EA860F14455E442B5C9B29 /* IrohaCommunication.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = IrohaCommunication.podspec; path = ../IrohaCommunication.podspec; sourceTree = ""; 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 = ""; }; 872B4DCAED8E7A58AFC8B200 /* Pods_UnitTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_UnitTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 8BB6C2BE23164E04009B7AEA /* IRAccountDetailPaginationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IRAccountDetailPaginationTests.m; sourceTree = ""; }; 9CA67C26A81EB59902096272 /* Pods_IntegrationTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_IntegrationTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; B877F0064619F03D2B560C12 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; BE1A149366A65576BDC46228 /* Pods-IntegrationTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IntegrationTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-IntegrationTests/Pods-IntegrationTests.debug.xcconfig"; sourceTree = ""; }; @@ -226,6 +228,7 @@ 0200347621C853E2001A6A53 /* IRRolePermissionTests.m */, 021C24AE21DCDDE3005D5304 /* IRPaginationTests.m */, 8481A59022FD48800056D3D4 /* IRAssetPaginationTests.m */, + 8BB6C2BE23164E04009B7AEA /* IRAccountDetailPaginationTests.m */, 021C24EF21DDF706005D5304 /* IRAccountAssetTests.m */, ); name = Model; @@ -838,6 +841,7 @@ 021C24E821DD3C90005D5304 /* IRQueryBuilderTests.m in Sources */, 0200347721C853E2001A6A53 /* IRRolePermissionTests.m in Sources */, 021C24F021DDF706005D5304 /* IRAccountAssetTests.m in Sources */, + 8BB6C2BF23164E04009B7AEA /* IRAccountDetailPaginationTests.m in Sources */, 0200345E21C62D3F001A6A53 /* IRDomainTests.m in Sources */, 021C843D21EA6E950037F633 /* IRBlockQueryBuilderTests.m in Sources */, 0200345F21C62D3F001A6A53 /* IRAccountIdTests.m in Sources */, diff --git a/Example/IrohaCommunication.xcodeproj/xcshareddata/xcschemes/UnitTests.xcscheme b/Example/IrohaCommunication.xcodeproj/xcshareddata/xcschemes/UnitTests.xcscheme index 62f85e1ec..471b1f189 100755 --- a/Example/IrohaCommunication.xcodeproj/xcshareddata/xcschemes/UnitTests.xcscheme +++ b/Example/IrohaCommunication.xcodeproj/xcshareddata/xcschemes/UnitTests.xcscheme @@ -29,6 +29,7 @@ enableAddressSanitizer = "YES" enableASanStackUseAfterReturn = "YES" enableUBSanitizer = "YES" + codeCoverageEnabled = "YES" shouldUseLaunchSchemeArgsEnv = "YES"> +#import "IRCommand.h" +#import "IRProtobufTransformable.h" + + +@interface IRCompareAndSetAccountDetail : NSObject + +- (nonnull instancetype)initWithAccountId:(nonnull id)accountId + key:(nonnull NSString *)key + value:(nonnull NSString *)value + oldValue:(nullable NSString *)oldValue; + +@end diff --git a/IrohaCommunication/Classes/Private/Commands/IRCompareAndSetAccountDetail.m b/IrohaCommunication/Classes/Private/Commands/IRCompareAndSetAccountDetail.m new file mode 100644 index 000000000..d4a659b4a --- /dev/null +++ b/IrohaCommunication/Classes/Private/Commands/IRCompareAndSetAccountDetail.m @@ -0,0 +1,46 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import "IRCompareAndSetAccountDetail.h" +#import "Commands.pbobjc.h" + +@implementation IRCompareAndSetAccountDetail + +@synthesize accountId = _accountId; +@synthesize key = _key; +@synthesize value = _value; +@synthesize oldValue = _oldValue; + +- (instancetype)initWithAccountId:(id)accountId + key:(NSString *)key + value:(NSString *)value + oldValue:(NSString *)oldValue { + if (self = [super init]) { + _accountId = accountId; + _key = key; + _value = value; + _oldValue = oldValue; + } + + return self; +} + + +#pragma mark - Protobuf Transformable + +- (nullable id)transform:(NSError *__autoreleasing *)error { + CompareAndSetAccountDetail *compare = [CompareAndSetAccountDetail new]; + compare.accountId = _accountId.identifier; + compare.key = _key; + compare.value = _value; + compare.oldValue = _oldValue; + + Command *command = [[Command alloc] init]; + command.compareAndSetAccountDetail = compare; + + return command; +} + +@end diff --git a/IrohaCommunication/Classes/Private/Commands/IRRemovePeer.h b/IrohaCommunication/Classes/Private/Commands/IRRemovePeer.h new file mode 100644 index 000000000..66b55baa0 --- /dev/null +++ b/IrohaCommunication/Classes/Private/Commands/IRRemovePeer.h @@ -0,0 +1,15 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import +#import "IRCommand.h" +#import "IRProtobufTransformable.h" + + +@interface IRRemovePeer : NSObject + +- (nonnull instancetype)initWithPeerKey:(nonnull id)peerKey; + +@end diff --git a/IrohaCommunication/Classes/Private/Commands/IRRemovePeer.m b/IrohaCommunication/Classes/Private/Commands/IRRemovePeer.m new file mode 100644 index 000000000..b81cb406b --- /dev/null +++ b/IrohaCommunication/Classes/Private/Commands/IRRemovePeer.m @@ -0,0 +1,37 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import "IRRemovePeer.h" +#import "Commands.pbobjc.h" +#import + + +@implementation IRRemovePeer + +@synthesize peerKey = _peerKey; + +- (nonnull instancetype)initWithPeerKey:(nonnull id)peerKey { + + if (self = [super init]) { + _peerKey = peerKey; + } + + return self; +} + + +#pragma mark - Protobuf Transformable + +- (nullable id)transform:(NSError *__autoreleasing *)error { + RemovePeer *removePeer = [RemovePeer new]; + removePeer.publicKey = [_peerKey.rawData toHexString]; + + Command *command = [[Command alloc] init]; + command.removePeer = removePeer; + + return command; +} + +@end diff --git a/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m b/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m index 5685a536d..7c18b03fc 100755 --- a/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m +++ b/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m @@ -8,6 +8,7 @@ #import "IRQueryResponseAll.h" #import "IrohaCrypto/NSData+Hex.h" #import "IRTransactionImpl+Proto.h" +#import "Primitive.pbobjc.h" @implementation IRQueryResponseProtoFactory @@ -89,6 +90,9 @@ @implementation IRQueryResponseProtoFactory queryHash:queryHash error:error]; break; + case QueryResponse_Response_OneOfCase_PeersResponse: + return [self peersResponseFromPbResponse:pbResponse.peersResponse queryHash:queryHash error:error]; + break; default: if (error) { NSString *message = [NSString stringWithFormat:@"Unexpected query response type %@", @(pbResponse.responseOneOfCase)]; @@ -337,8 +341,17 @@ @implementation IRQueryResponseProtoFactory error:(NSError**)error { NSString *detail = pbResponse.detail ? pbResponse.detail : @""; + + id nextRecordId = nil; + + if (pbResponse.hasNextRecordId && pbResponse.nextRecordId) { + nextRecordId = [IRAccountDetailRecordIdFactory accountDetailRecordIdWithWriter:pbResponse.nextRecordId.writer + key:pbResponse.nextRecordId.key]; + } return [[IRAccountDetailResponse alloc] initWithDetail:detail + totalCount:pbResponse.totalNumber + nextRecordId:nextRecordId queryHash:queryHash]; } @@ -414,4 +427,48 @@ @implementation IRQueryResponseProtoFactory return transactions; } ++ (nullable id)peersResponseFromPbResponse:(nonnull PeersResponse*)pbResponse + queryHash:(nonnull NSData*)queryHash + error:(NSError**)error { + NSMutableArray> *peers = [NSMutableArray array]; + + for (Peer *pbPeer in pbResponse.peersArray) { + id address = [IRAddressFactory addressWithValue:pbPeer.address error:error]; + + if (!address) { + return nil; + } + + NSData *rawPublicKey = [[NSData alloc] initWithHexString:pbPeer.peerKey]; + + if (!rawPublicKey) { + if (error) { + NSString *message = [NSString stringWithFormat:@"Invalid public key hex string %@", pbPeer.peerKey]; + *error = [NSError errorWithDomain:NSStringFromClass([IRQueryResponseProtoFactory class]) + code:IRQueryResponseFactoryErrorInvalidAgrument + userInfo:@{NSLocalizedDescriptionKey: message}]; + } + return nil; + } + + id publicKey = [[IREd25519PublicKey alloc] initWithRawData:rawPublicKey]; + + if (!publicKey) { + if (error) { + NSString *message = [NSString stringWithFormat:@"Invalid public key %@", [queryHash toHexString]]; + *error = [NSError errorWithDomain:NSStringFromClass([IRQueryResponseProtoFactory class]) + code:IRQueryResponseFactoryErrorInvalidAgrument + userInfo:@{NSLocalizedDescriptionKey: message}]; + } + return nil; + } + + id peer = [IRPeerFactory peerWithAddress:address key:publicKey error:error]; + + [peers addObject:peer]; + } + + return [[IRPeersResponse alloc] initWithPeers:peers queryHash:queryHash]; +} + @end diff --git a/IrohaCommunication/Classes/Private/Models/IRCommand+Proto.m b/IrohaCommunication/Classes/Private/Models/IRCommand+Proto.m index e803ded44..b1a6a179f 100755 --- a/IrohaCommunication/Classes/Private/Models/IRCommand+Proto.m +++ b/IrohaCommunication/Classes/Private/Models/IRCommand+Proto.m @@ -77,6 +77,12 @@ @implementation IRCommandProtoFactory return [self subtractAssetQuantityCommandFromPbCommand:command.subtractAssetQuantity error:error]; break; + case Command_Command_OneOfCase_RemovePeer: + return [self removePeerCommandFromPbCommand:command.removePeer error:error]; + break; + case Command_Command_OneOfCase_CompareAndSetAccountDetail: + return [self compareAndSetAccountDetailCommandFromPbCommand:command.compareAndSetAccountDetail error:error]; + break; default: if (error) { NSString *message = [NSString stringWithFormat:@"Invalid transaction command %@", @(command.commandOneOfCase)]; @@ -480,6 +486,48 @@ @implementation IRCommandProtoFactory amount:amount]; } ++ (nullable id)removePeerCommandFromPbCommand:(nonnull RemovePeer *)pbCommand + error:(NSError **)error { + NSData *rawPeerKey = [[NSData alloc] initWithHexString:pbCommand.publicKey]; + + if (!rawPeerKey) { + if (error) { + NSString *message = [NSString stringWithFormat:@"Invalid public key hex %@", pbCommand.publicKey]; + *error = [NSError errorWithDomain:NSStringFromClass([IRCommandProtoFactory class]) + code:IRCommandProtoFactoryErrorInvalidArgument + userInfo:@{NSLocalizedDescriptionKey: message}]; + } + return nil; + } + + id peerKey = [self createPublicKeyFromRawData:rawPeerKey error:error]; + + if (!peerKey) { + return nil; + } + + return [[IRRemovePeer alloc] initWithPeerKey:peerKey]; +} + ++ (nullable id)compareAndSetAccountDetailCommandFromPbCommand:(nonnull CompareAndSetAccountDetail *)pbCommand + error:(NSError **)error { + id accountId = [IRAccountIdFactory accountWithIdentifier:pbCommand.accountId + error:error]; + + if (!accountId) { + return nil; + } + + if (!pbCommand.key || !pbCommand.value) { + return nil; + } + + return [[IRCompareAndSetAccountDetail alloc] initWithAccountId:accountId + key:pbCommand.key + value:pbCommand.value + oldValue:pbCommand.oldValue]; +} + + (nullable id)createPublicKeyFromRawData:(nonnull NSData*)rawData error:(NSError**)error { id publicKey = [[IREd25519PublicKey alloc] initWithRawData:rawData]; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h index 5123ffca6..30cb374d0 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h @@ -11,6 +11,7 @@ - (nonnull instancetype)initWithAccountId:(nullable id)accountId writer:(nullable id)writer - key:(nullable NSString*)key; + key:(nullable NSString*)key + pagination:(nullable id)pagination; @end diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m index 5618c7265..fd61bc85a 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m @@ -5,19 +5,24 @@ #import "IRGetAccountDetail.h" #import "Queries.pbobjc.h" +#import "Primitive.pbobjc.h" @implementation IRGetAccountDetail + @synthesize accountId = _accountId; @synthesize writer = _writer; @synthesize key = _key; +@synthesize pagination = _pagination; - (nonnull instancetype)initWithAccountId:(nullable id)accountId writer:(nullable id)writer - key:(nullable NSString*)key { + key:(nullable NSString*)key + pagination:(nullable id)pagination { if (self = [super init]) { _accountId = accountId; _writer = writer; _key = key; + _pagination = pagination; } return self; @@ -30,10 +35,22 @@ - (nullable id)transform:(NSError**)error { query.accountId = [_accountId identifier]; query.writer = [_writer identifier]; query.key = _key; - + + if (_pagination) { + AccountDetailRecordId *recordId = [AccountDetailRecordId new]; + recordId.writer = _pagination.nextRecordId.writer; + recordId.key = _pagination.nextRecordId.key; + + AccountDetailPaginationMeta *meta = [AccountDetailPaginationMeta new]; + meta.pageSize = _pagination.pageSize; + meta.firstRecordId = recordId; + + query.paginationMeta = meta; + } + Query_Payload *payload = [[Query_Payload alloc] init]; payload.getAccountDetail = query; - + return payload; } diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetPeers.h b/IrohaCommunication/Classes/Private/Queries/IRGetPeers.h new file mode 100644 index 000000000..72ff6610c --- /dev/null +++ b/IrohaCommunication/Classes/Private/Queries/IRGetPeers.h @@ -0,0 +1,13 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import +#import "IRQuery.h" +#import "IRProtobufTransformable.h" + + +@interface IRGetPeers : NSObject + +@end diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetPeers.m b/IrohaCommunication/Classes/Private/Queries/IRGetPeers.m new file mode 100644 index 000000000..63db0279a --- /dev/null +++ b/IrohaCommunication/Classes/Private/Queries/IRGetPeers.m @@ -0,0 +1,23 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import "IRGetPeers.h" +#import "Queries.pbobjc.h" + +@implementation IRGetPeers + + +#pragma mark - Protobuf Transformable + +- (nullable id)transform:(NSError**)error { + GetPeers *query = [GetPeers new]; + + Query_Payload *payload = [[Query_Payload alloc] init]; + payload.getPeers = query; + + return payload; +} + +@end diff --git a/IrohaCommunication/Classes/Private/Queries/IRQueryAll.h b/IrohaCommunication/Classes/Private/Queries/IRQueryAll.h index e5ec513aa..109539a14 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRQueryAll.h +++ b/IrohaCommunication/Classes/Private/Queries/IRQueryAll.h @@ -12,5 +12,6 @@ #import "IRGetRolePermissions.h" #import "IRGetAssetInfo.h" #import "IRGetPendingTransactions.h" +#import "IRGetPeers.h" #endif /* IRQueryAll_h */ diff --git a/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.h b/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.h index af4af7f97..c3bfea1df 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.h +++ b/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.h @@ -5,10 +5,13 @@ #import #import "IRQueryResponse.h" +#import "IRAccountDetailRecordId.h" @interface IRAccountDetailResponse : NSObject - (nonnull instancetype)initWithDetail:(nonnull NSString*)detail + totalCount:(UInt64)totalCount + nextRecordId:(nullable id)nextRecordId queryHash:(nonnull NSData*)queryHash; @end diff --git a/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.m b/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.m index 0324fe6b1..95005f902 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.m +++ b/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.m @@ -6,13 +6,20 @@ #import "IRAccountDetailResponse.h" @implementation IRAccountDetailResponse + @synthesize detail = _detail; @synthesize queryHash = _queryHash; +@synthesize totalCount = _totalCount; +@synthesize nextRecordId = _nextRecordId; - (nonnull instancetype)initWithDetail:(nonnull NSString*)detail + totalCount:(UInt64)totalCount + nextRecordId:(nullable id)nextRecordId queryHash:(nonnull NSData*)queryHash { if (self = [super init]) { _detail = detail; + _totalCount = totalCount; + _nextRecordId = nextRecordId; _queryHash = queryHash; } diff --git a/IrohaCommunication/Classes/Private/Responses/IRPeersResponse.h b/IrohaCommunication/Classes/Private/Responses/IRPeersResponse.h new file mode 100644 index 000000000..66cd8df7c --- /dev/null +++ b/IrohaCommunication/Classes/Private/Responses/IRPeersResponse.h @@ -0,0 +1,15 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import +#import "IRQueryResponse.h" +#import "IRPeer.h" + + +@interface IRPeersResponse : NSObject + +- (nonnull instancetype)initWithPeers:(nonnull NSArray>*)peers queryHash:(nonnull NSData*)queryHash; + +@end diff --git a/IrohaCommunication/Classes/Private/Responses/IRPeersResponse.m b/IrohaCommunication/Classes/Private/Responses/IRPeersResponse.m new file mode 100644 index 000000000..532d6bcfd --- /dev/null +++ b/IrohaCommunication/Classes/Private/Responses/IRPeersResponse.m @@ -0,0 +1,21 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import "IRPeersResponse.h" + +@implementation IRPeersResponse + +@synthesize peers = _peers; +@synthesize queryHash = _queryHash; + +- (instancetype)initWithPeers:(NSArray> *)peers queryHash:(NSData *)queryHash { + if (self = [super init]) { + _peers = peers; + _queryHash = queryHash; + } + return self; +} + +@end diff --git a/IrohaCommunication/Classes/Private/Responses/IRQueryResponseAll.h b/IrohaCommunication/Classes/Private/Responses/IRQueryResponseAll.h index 4637ed0b2..add2ddaa0 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRQueryResponseAll.h +++ b/IrohaCommunication/Classes/Private/Responses/IRQueryResponseAll.h @@ -11,5 +11,6 @@ #import "IRErrorResponse.h" #import "IRAssetResponse.h" #import "IRTransactionsPageResponse.h" +#import "IRPeersResponse.h" #endif /* IRQueryResponseAll_h */ diff --git a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h index 349f70987..dcf977999 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h +++ b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h @@ -6,6 +6,7 @@ #import #import "IRQueryRequest.h" +#import "IRAccountDetailPagination.h" @protocol IRQueryBuilderProtocol @@ -46,7 +47,12 @@ typedef NS_ENUM(NSUInteger, IRQueryBuilderError) { - (nonnull instancetype)getAccountDetail:(nullable id)accountId writer:(nullable id)writer - key:(nullable NSString*)key; + key:(nullable NSString*)key DEPRECATED_MSG_ATTRIBUTE("use getAccountDetail:writer:key:pagination:"); + +- (nonnull instancetype)getAccountDetail:(nullable id)accountId + writer:(nullable id)writer + key:(nullable NSString*)key + pagination:(nullable id)pagination; - (nonnull instancetype)getRoles; @@ -56,4 +62,6 @@ typedef NS_ENUM(NSUInteger, IRQueryBuilderError) { - (nonnull instancetype)getPendingTransactions; +- (nonnull instancetype)getPeers; + @end diff --git a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m index 33eed7df6..3e74b0747 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m +++ b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m @@ -87,13 +87,22 @@ - (nonnull instancetype)getAccountAssets:(nonnull id)accountId - (nonnull instancetype)getAccountDetail:(nullable id)accountId writer:(nullable id)writer key:(nullable NSString*)key { + return [self getAccountDetail:accountId writer:writer key:key pagination:nil]; +} + +- (nonnull instancetype)getAccountDetail:(nullable id)accountId + writer:(nullable id)writer + key:(nullable NSString*)key + pagination:(nullable id)pagination { id query = [[IRGetAccountDetail alloc] initWithAccountId:accountId writer:writer - key:key]; - + key:key + pagination:pagination]; + return [self withQuery:query]; } + - (nonnull instancetype)getRoles { id query = [[IRGetRoles alloc] init]; @@ -118,6 +127,12 @@ - (nonnull instancetype)getPendingTransactions { return [self withQuery:query]; } +-(nonnull instancetype)getPeers { + id query = [IRGetPeers new]; + + return [self withQuery:query]; +} + #pragma mark - IRQueryBuilderProtocol - (nonnull instancetype)withCreatorAccountId:(nonnull id)creatorAccountId { diff --git a/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.h b/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.h index 341c4f3d1..d49b40b2e 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.h +++ b/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.h @@ -79,4 +79,11 @@ typedef NS_ENUM(NSUInteger, IRTransactionBuilderError) { description:(nonnull NSString*)transferDescription amount:(nonnull id)amount; +- (nonnull instancetype)removePeer:(nonnull id)peerKey; + +- (nonnull instancetype)compareAndSet:(nonnull id)accountId + key:(nonnull NSString *)key + value:(nonnull NSString *)value + oldValue:(nullable NSString *)oldValue; + @end diff --git a/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.m b/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.m index 42bd4e573..6d7e7ca40 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.m +++ b/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.m @@ -223,6 +223,26 @@ - (nonnull instancetype)transferAsset:(nonnull id)sourceAccountId return self; } +- (instancetype)removePeer:(id)peerKey { + [self addCommand:[[IRRemovePeer alloc] initWithPeerKey:peerKey]]; + + return self; +} + +- (nonnull instancetype)compareAndSet:(nonnull id)accountId + key:(nonnull NSString *)key + value:(nonnull NSString *)value + oldValue:(nullable NSString *)oldValue { + IRCompareAndSetAccountDetail *command = [[IRCompareAndSetAccountDetail alloc] initWithAccountId:accountId + key:key + value:value + oldValue:oldValue]; + [self addCommand:command]; + + return self; +} + + #pragma mark - Protocol - (nonnull instancetype)withCreatorAccountId:(nonnull id)creatorAccountId { diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailPagination.h b/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailPagination.h new file mode 100644 index 000000000..f4c19595a --- /dev/null +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailPagination.h @@ -0,0 +1,26 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import +#import "IRAccountDetailRecordId.h" + + +@protocol IRAccountDetailPagination + +@property(nonatomic, readonly)UInt32 pageSize; +@property(nonatomic, readonly)id nextRecordId; + +@end + +@protocol IRAccountDetailPaginationFactoryProtocol + ++ (nonnull id)accountDetailPagination:(UInt32)pageSize + nextRecordId:(nonnull id)nextRecordId; + +@end + +@interface IRAccountDetailPaginationFactory : NSObject + +@end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailPagination.m b/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailPagination.m new file mode 100644 index 000000000..da24193e3 --- /dev/null +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailPagination.m @@ -0,0 +1,42 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import "IRAccountDetailPagination.h" + + +@interface IRAccountDetailPagination: NSObject +@end + + +@implementation IRAccountDetailPagination + +@synthesize pageSize = _pageSize; +@synthesize nextRecordId = _nextRecordId; + +- (instancetype)initWithPageSize:(UInt32)pageSize + nextRecordId:(nonnull id)nextRecordId { + if (self = [super init]) { + _pageSize = pageSize; + _nextRecordId = nextRecordId; + } + + return self; +} + +@end + + +@implementation IRAccountDetailPaginationFactory + ++ (nonnull id)accountDetailPagination:(UInt32)pageSize + nextRecordId:(nonnull id)nextRecordId { + if (!nextRecordId) { + return nil; + } + + return [[IRAccountDetailPagination alloc] initWithPageSize:pageSize nextRecordId:nextRecordId]; +} + +@end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailRecordId.h b/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailRecordId.h new file mode 100644 index 000000000..5c07541dc --- /dev/null +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailRecordId.h @@ -0,0 +1,26 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import + + +@protocol IRAccountDetailRecordId + +@property(nonatomic, readonly)NSString * _Nonnull writer; +@property(nonatomic, readonly)NSString * _Nonnull key; + +@end + + +@protocol IRAccountDetailRecordIdFactoryProtocol + ++ (nullable id)accountDetailRecordIdWithWriter:(nonnull NSString *)writer + key:(nonnull NSString *)key; + +@end + + +@interface IRAccountDetailRecordIdFactory : NSObject +@end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailRecordId.m b/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailRecordId.m new file mode 100644 index 000000000..0c7ac85b4 --- /dev/null +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailRecordId.m @@ -0,0 +1,37 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import "IRAccountDetailRecordId.h" + + +@interface IRAccountDetailRecordId: NSObject +@end + + +@implementation IRAccountDetailRecordId + +@synthesize writer = _writer; +@synthesize key = _key; + +- (instancetype)initWithWriter:(nonnull NSString *)writer key:(nonnull NSString *)key { + if (self = [super init]) { + _writer = writer; + _key = key; + } + + return self; +} + +@end + + +@implementation IRAccountDetailRecordIdFactory + ++ (nullable id)accountDetailRecordIdWithWriter:(nonnull NSString *)writer + key:(nonnull NSString *)key { + return [[IRAccountDetailRecordId alloc] initWithWriter:writer key:key]; +} + +@end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRPeer.h b/IrohaCommunication/Classes/Public/Model/Common/IRPeer.h new file mode 100644 index 000000000..b9d06d4b7 --- /dev/null +++ b/IrohaCommunication/Classes/Public/Model/Common/IRPeer.h @@ -0,0 +1,29 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import +#import "IRAddress.h" +#import "IrohaCrypto/IRPublicKey.h" + + +@protocol IRPeer + +@property (nonatomic, readonly, nonnull) id address; +@property (nonatomic, readonly, nonnull) id peerKey; + +@end + + +@protocol IRPeerFactoryProtocol + ++ (nullable id)peerWithAddress:(nonnull id)address + key:(nonnull id)key + error:(NSError *_Nullable *_Nullable)error; + +@end + + +@interface IRPeerFactory : NSObject +@end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRPeer.m b/IrohaCommunication/Classes/Public/Model/Common/IRPeer.m new file mode 100644 index 000000000..444c66657 --- /dev/null +++ b/IrohaCommunication/Classes/Public/Model/Common/IRPeer.m @@ -0,0 +1,44 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import "IRPeer.h" + + +@interface IRPeer : NSObject + +- (nonnull instancetype)initWithAddress:(nonnull id)address + peerKey:(nonnull id)peerKey; + +@end + + +@implementation IRPeer + +@synthesize address = _address; +@synthesize peerKey = _peerKey; + +- (nonnull instancetype)initWithAddress:(nonnull id)address + peerKey:(nonnull id)peerKey { + if (self = [super init]) { + _address = address; + _peerKey = peerKey; + } + + return self; +} + +@end + + +@implementation IRPeerFactory + ++ (nullable id)peerWithAddress:(nonnull id)address + key:(nonnull id)key + error:(NSError *_Nullable *_Nullable)error { + + return [[IRPeer alloc] initWithAddress:address peerKey:key]; +} + +@end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRRolePermission.h b/IrohaCommunication/Classes/Public/Model/Common/IRRolePermission.h index 320b4911b..77784a8cd 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRRolePermission.h +++ b/IrohaCommunication/Classes/Public/Model/Common/IRRolePermission.h @@ -31,6 +31,7 @@ typedef NS_ENUM(NSUInteger, IRRolePermissionError) { + (nonnull id)canAddAssetQuantity; + (nonnull id)canSubtractAssetQuantity; + (nonnull id)canAddPeer; ++ (nonnull id)canRemovePeer; + (nonnull id)canAddSignatory; + (nonnull id)canRemoveSignatory; + (nonnull id)canSetQuorum; @@ -68,6 +69,7 @@ typedef NS_ENUM(NSUInteger, IRRolePermissionError) { + (nonnull id)canGetMyTransactions; + (nonnull id)canGetAllTransactions; + (nonnull id)canGetBlocks; ++ (nonnull id)canGetPeers; #pragma mark - Grant permissions diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRRolePermission.m b/IrohaCommunication/Classes/Public/Model/Common/IRRolePermission.m index a4973b745..0f98cbc1e 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRRolePermission.m +++ b/IrohaCommunication/Classes/Public/Model/Common/IRRolePermission.m @@ -79,6 +79,10 @@ @implementation IRRolePermissionFactory return [self permissionWithValue:RolePermission_CanAddPeer error:nil]; } ++ (id)canRemovePeer { + return [self permissionWithValue:RolePermission_CanRemovePeer error:nil]; +} + + (nonnull id)canAddSignatory { return [self permissionWithValue:RolePermission_CanAddSignatory error:nil]; } @@ -217,6 +221,10 @@ @implementation IRRolePermissionFactory return [self permissionWithValue:RolePermission_CanGetBlocks error:nil]; } ++ (id)canGetPeers { + return [self permissionWithValue:RolePermission_CanGetPeers error:nil]; +} + #pragma mark - Grant permissions + (nonnull id)canGrantCanSetMyQuorum { diff --git a/IrohaCommunication/Classes/Public/Model/IRCommand.h b/IrohaCommunication/Classes/Public/Model/IRCommand.h index d6d4c4d43..ae327b30d 100755 --- a/IrohaCommunication/Classes/Public/Model/IRCommand.h +++ b/IrohaCommunication/Classes/Public/Model/IRCommand.h @@ -20,6 +20,7 @@ @end + @protocol IRAddAssetQuantity @property(nonatomic, readonly)id _Nonnull assetId; @@ -27,6 +28,7 @@ @end + @protocol IRAddPeer @property(nonatomic, readonly)id _Nonnull address; @@ -34,6 +36,7 @@ @end + @protocol IRAddSignatory @property(nonatomic, readonly)id _Nonnull accountId; @@ -41,6 +44,7 @@ @end + @protocol IRAppendRole @property(nonatomic, readonly)id _Nonnull accountId; @@ -48,6 +52,7 @@ @end + @protocol IRCreateAccount @property(nonatomic, readonly)id _Nonnull accountId; @@ -55,6 +60,7 @@ @end + @protocol IRCreateAsset @property(nonatomic, readonly)id _Nonnull assetId; @@ -62,6 +68,7 @@ @end + @protocol IRCreateDomain @property(nonatomic, readonly)id _Nonnull domainId; @@ -69,6 +76,7 @@ @end + @protocol IRCreateRole @property(nonatomic, readonly)id _Nonnull roleName; @@ -76,6 +84,7 @@ @end + @protocol IRDetachRole @property(nonatomic, readonly)id _Nonnull accountId; @@ -83,6 +92,7 @@ @end + @protocol IRGrantPermission @property(nonatomic, readonly)id _Nonnull accountId; @@ -90,6 +100,7 @@ @end + @protocol IRRemoveSignatory @property(nonatomic, readonly)id _Nonnull accountId; @@ -97,6 +108,7 @@ @end + @protocol IRRevokePermission @property(nonatomic, readonly)id _Nonnull accountId; @@ -104,6 +116,7 @@ @end + @protocol IRSetAccountDetail @property(nonatomic, readonly)id _Nonnull accountId; @@ -112,6 +125,7 @@ @end + @protocol IRSetAccountQuorum @property(nonatomic, readonly)id _Nonnull accountId; @@ -119,6 +133,7 @@ @end + @protocol IRSubtractAssetQuantity @property(nonatomic, readonly)id _Nonnull assetId; @@ -126,6 +141,7 @@ @end + @protocol IRTransferAsset @property(nonatomic, readonly)id _Nonnull sourceAccountId; @@ -136,4 +152,22 @@ @end + +@protocol IRRemovePeer + +@property(nonatomic, readonly)id _Nonnull peerKey; + +@end + + +@protocol IRCompareAndSetAccountDetail + +@property(nonatomic, readonly)id _Nonnull accountId; +@property(nonatomic, readonly)NSString* _Nonnull key; +@property(nonatomic, readonly)NSString* _Nonnull value; +@property(nonatomic, readonly)NSString* _Nullable oldValue; + +@end + + #endif diff --git a/IrohaCommunication/Classes/Public/Model/IRQuery.h b/IrohaCommunication/Classes/Public/Model/IRQuery.h index d1c3252ec..6d78e7c62 100755 --- a/IrohaCommunication/Classes/Public/Model/IRQuery.h +++ b/IrohaCommunication/Classes/Public/Model/IRQuery.h @@ -11,23 +11,27 @@ #import "IRPagination.h" #import "IRAssetPagination.h" #import "IRRoleName.h" +#import "IRAccountDetailPagination.h" -@protocol IRQuery +@protocol IRQuery @end + @protocol IRGetAccount @property(nonatomic, readonly)id _Nonnull accountId; @end + @protocol IRGetSignatories @property(nonatomic, readonly)id _Nonnull accountId; @end + @protocol IRGetAccountTransactions @property(nonatomic, readonly)id _Nonnull accountId; @@ -35,6 +39,7 @@ @end + @protocol IRGetAccountAssetTransactions @property(nonatomic, readonly)id _Nonnull accountId; @@ -43,12 +48,14 @@ @end + @protocol IRGetTransactions @property(nonatomic, readonly)NSArray * _Nonnull transactionHashes; @end + @protocol IRGetAccountAssets @property(nonatomic, readonly)id _Nonnull accountId; @@ -56,32 +63,40 @@ @end + @protocol IRGetAccountDetail @property(nonatomic, readonly)id _Nullable accountId; @property(nonatomic, readonly)id _Nullable writer; @property(nonatomic, readonly)NSString * _Nullable key; +@property(nonatomic, readonly)id _Nullable pagination; @end -@protocol IRGetRoles +@protocol IRGetRoles @end + @protocol IRGetRolePermissions @property(nonatomic, readonly)id _Nonnull roleName; @end + @protocol IRGetAssetInfo @property(nonatomic, readonly)id _Nonnull assetId; @end + @protocol IRGetPendingTransactions +@end + +@protocol IRGetPeers @end #endif diff --git a/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h b/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h index fee7e0ebe..94d399efa 100755 --- a/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h +++ b/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h @@ -12,6 +12,9 @@ #import "IRRolePermission.h" #import "IRTransaction.h" #import "IrohaCrypto/IRPublicKey.h" +#import "IRAccountDetailRecordId.h" +#import "IRPeer.h" + @protocol IRQueryResponse @@ -19,6 +22,7 @@ @end + @protocol IRAccountAssetsResponse @property(nonatomic, readonly)NSArray>* _Nonnull accountAssets; @@ -27,36 +31,44 @@ @end + @protocol IRAccountDetailResponse @property(nonatomic, readonly)NSString* _Nonnull detail; +@property(nonatomic, readonly)UInt64 totalCount; +@property(nonatomic, readonly)id _Nullable nextRecordId; @end + @protocol IRSignatoriesResponse @property(nonatomic, readonly)NSArray>* _Nonnull publicKeys; @end + @protocol IRTransactionsResponse @property(nonatomic, readonly)NSArray>* _Nonnull transactions; @end + @protocol IRRolesResponse @property(nonatomic, readonly)NSArray>* _Nonnull roles; @end + @protocol IRRolePermissionsResponse @property(nonatomic, readonly)NSArray>* _Nonnull permissions; @end + @protocol IRAccountResponse @property(nonatomic, readonly)id _Nonnull accountId; @@ -66,6 +78,7 @@ @end + typedef NS_ENUM(NSUInteger, IRErrorResponseReason) { IRErrorResponseReasonStatelessInvalid, IRErrorResponseReasonStatefulInvalid, @@ -78,6 +91,7 @@ typedef NS_ENUM(NSUInteger, IRErrorResponseReason) { IRErrorResponseReasonNoRoles }; + @protocol IRErrorResponse @property(nonatomic, readonly)IRErrorResponseReason reason; @@ -86,6 +100,7 @@ typedef NS_ENUM(NSUInteger, IRErrorResponseReason) { @end + @protocol IRAssetResponse @property(nonatomic, readonly)id _Nonnull assetId; @@ -93,6 +108,7 @@ typedef NS_ENUM(NSUInteger, IRErrorResponseReason) { @end + @protocol IRTransactionsPageResponse @property(nonatomic, readonly)NSArray>* _Nonnull transactions; @@ -101,4 +117,11 @@ typedef NS_ENUM(NSUInteger, IRErrorResponseReason) { @end + +@protocol IRPeersResponse + +@property(nonatomic, readonly)NSArray>* _Nonnull peers; + +@end + #endif diff --git a/Tests/Model/IRAccountDetailPaginationTests.m b/Tests/Model/IRAccountDetailPaginationTests.m new file mode 100644 index 000000000..26b84d0c4 --- /dev/null +++ b/Tests/Model/IRAccountDetailPaginationTests.m @@ -0,0 +1,44 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import +@import IrohaCommunication; + + +@interface IRAccountDetailPaginationTests : XCTestCase + +@end + + +@implementation IRAccountDetailPaginationTests + +- (void)testNonnilStartingAssetId { + UInt32 pageSize = 10; + + NSString *writer = @"writer"; + NSString *key = @"key"; + + id nextRecordId = [IRAccountDetailRecordIdFactory accountDetailRecordIdWithWriter:writer + key:key]; + + id pagination = [IRAccountDetailPaginationFactory accountDetailPagination:pageSize + nextRecordId:nextRecordId]; + + XCTAssertNotNil(pagination); + XCTAssertEqual(pagination.pageSize, pageSize); + XCTAssertEqualObjects(pagination.nextRecordId.writer, writer); + XCTAssertEqualObjects(pagination.nextRecordId.key, key); +} + +- (void)testNilStartingAssetId { + UInt32 pageSize = 10; + + id pagination = [IRAccountDetailPaginationFactory accountDetailPagination:pageSize + nextRecordId:nil]; + XCTAssertNil(pagination); +} + + +@end diff --git a/Tests/Query/IRQueryBuilderTests.m b/Tests/Query/IRQueryBuilderTests.m index 65a75fa41..838f321bd 100755 --- a/Tests/Query/IRQueryBuilderTests.m +++ b/Tests/Query/IRQueryBuilderTests.m @@ -137,6 +137,11 @@ - (void)testQueries { id assetPagination = [IRAssetPaginationFactory assetPagination:10 startingAssetId:assetId]; + + id accountDetailRecordId = [IRAccountDetailRecordIdFactory accountDetailRecordIdWithWriter:@"writer" + key:@"key"]; + id accountDetailPagination = [IRAccountDetailPaginationFactory accountDetailPagination:10 + nextRecordId:accountDetailRecordId]; NSData *itemHash = [@"Test Data" dataUsingEncoding:NSUTF8StringEncoding]; @@ -171,6 +176,10 @@ - (void)testQueries { IRQueryTestCase *getAccountDetail = [[IRQueryTestCase alloc] initWithSelector:@selector(getAccountDetail:writer:key:) arguments:@[accountId, accountId] protocol:@protocol(IRGetAccountDetail)]; + + IRQueryTestCase *getAccountDetailPaginated = [[IRQueryTestCase alloc] initWithSelector:@selector(getAccountDetail:writer:key:pagination:) + arguments:@[accountId, accountId, @"key", accountDetailPagination] + protocol:@protocol(IRGetAccountDetail)]; IRQueryTestCase *getRoles = [[IRQueryTestCase alloc] initWithSelector:@selector(getRoles) arguments:nil @@ -187,6 +196,10 @@ - (void)testQueries { IRQueryTestCase *getPendingTransaction = [[IRQueryTestCase alloc] initWithSelector:@selector(getPendingTransactions) arguments:nil protocol:@protocol(IRGetPendingTransactions)]; + + IRQueryTestCase *getPeers = [[IRQueryTestCase alloc] initWithSelector:@selector(getPeers) + arguments:nil + protocol:@protocol(IRGetPeers)]; return @[getAccountTestCase, getSignatories, @@ -196,10 +209,12 @@ - (void)testQueries { getAccountAssets, getAccountAssetsPaginated, getAccountDetail, + getAccountDetailPaginated, getRoles, getRolePermission, getAssetInfo, - getPendingTransaction]; + getPendingTransaction, + getPeers]; } @end From b45cf187df7e21bd233afda2beb40471ee503d64 Mon Sep 17 00:00:00 2001 From: Andrei Marin Date: Sun, 8 Sep 2019 21:46:29 +0300 Subject: [PATCH 3/8] integration tests Signed-off-by: Russel --- .../project.pbxproj | 20 +- .../IRBaseIrohaContainerTests.h | 15 +- .../IrohaContainer/IRIrohaContainer.h | 4 +- .../IrohaContainer/IRIrohaContainer.m | 13 +- .../Scenarious/IRCreateAssetTest.m | 5 + .../Scenarious/IRCreateRoleTest.m | 10 +- .../Scenarious/IRGetAccountDetailTest.m | 121 ++++++++ IntegrationTests/Scenarious/IRGetAssetsTest.m | 272 ++++++++++++++++++ .../Classes/Private/IRQueryResponse+Proto.m | 2 +- .../Classes/Private/Models/IRCommand+Proto.m | 4 - .../Private/Queries/IRGetAccountDetail.h | 5 +- .../Private/Queries/IRGetAccountDetail.m | 27 +- .../Responses/IRAccountAssetsResponse.m | 5 + .../Responses/IRAccountDetailResponse.m | 4 + .../Classes/Public/Builder/IRQueryBuilder.h | 7 +- .../Classes/Public/Builder/IRQueryBuilder.m | 16 +- .../Public/Model/Common/IRAccountAsset.m | 9 +- .../Model/Common/IRAccountDetailRecordId.m | 4 + .../Classes/Public/Model/Common/IRAccountId.m | 23 +- .../Classes/Public/Model/Common/IRAmount.m | 17 +- .../Classes/Public/Model/Common/IRAssetId.m | 9 + .../Classes/Public/Model/IRQueryResponse.h | 2 +- Tests/Model/IRAccountDetailPaginationTests.m | 4 +- Tests/Query/IRQueryBuilderTests.m | 23 +- 24 files changed, 552 insertions(+), 69 deletions(-) create mode 100644 IntegrationTests/Scenarious/IRGetAccountDetailTest.m create mode 100644 IntegrationTests/Scenarious/IRGetAssetsTest.m diff --git a/Example/IrohaCommunication.xcodeproj/project.pbxproj b/Example/IrohaCommunication.xcodeproj/project.pbxproj index 88a571ef4..7671cd20a 100644 --- a/Example/IrohaCommunication.xcodeproj/project.pbxproj +++ b/Example/IrohaCommunication.xcodeproj/project.pbxproj @@ -54,7 +54,9 @@ 844761F1224A5133009ADC0E /* IRQueryResponseDeserializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 844761F0224A5133009ADC0E /* IRQueryResponseDeserializationTests.m */; }; 8481A59122FD48800056D3D4 /* IRAssetPaginationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8481A59022FD48800056D3D4 /* IRAssetPaginationTests.m */; }; 84D693FB22EDCDB10059C1FB /* IRAccountRestoreWithBatchTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D693FA22EDCDB10059C1FB /* IRAccountRestoreWithBatchTest.m */; }; + 8BA6158423255099002C33D8 /* IRGetAccountDetailTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BA6158323255099002C33D8 /* IRGetAccountDetailTest.m */; }; 8BB6C2BF23164E04009B7AEA /* IRAccountDetailPaginationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BB6C2BE23164E04009B7AEA /* IRAccountDetailPaginationTests.m */; }; + 8BF9E1DE2321976F00A1257A /* IRGetAssetsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BF9E1DD2321976F00A1257A /* IRGetAssetsTest.m */; }; 8CA1A478927FFA33BA30A5B4 /* Pods_IntegrationTestHost.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 175938D8DE70C85E0CEA25AF /* Pods_IntegrationTestHost.framework */; }; /* End PBXBuildFile section */ @@ -160,7 +162,9 @@ 84EA860F14455E442B5C9B29 /* IrohaCommunication.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = IrohaCommunication.podspec; path = ../IrohaCommunication.podspec; sourceTree = ""; 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 = ""; }; 872B4DCAED8E7A58AFC8B200 /* Pods_UnitTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_UnitTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 8BA6158323255099002C33D8 /* IRGetAccountDetailTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IRGetAccountDetailTest.m; sourceTree = ""; }; 8BB6C2BE23164E04009B7AEA /* IRAccountDetailPaginationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IRAccountDetailPaginationTests.m; sourceTree = ""; }; + 8BF9E1DD2321976F00A1257A /* IRGetAssetsTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IRGetAssetsTest.m; sourceTree = ""; }; 9CA67C26A81EB59902096272 /* Pods_IntegrationTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_IntegrationTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; B877F0064619F03D2B560C12 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; BE1A149366A65576BDC46228 /* Pods-IntegrationTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IntegrationTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-IntegrationTests/Pods-IntegrationTests.debug.xcconfig"; sourceTree = ""; }; @@ -265,6 +269,8 @@ 02D656A121F12DC300AAA66A /* IRCreateDomainTest.m */, 02D656BD21F19F6B00AAA66A /* IRCreateRoleTest.m */, 84D693FA22EDCDB10059C1FB /* IRAccountRestoreWithBatchTest.m */, + 8BF9E1DD2321976F00A1257A /* IRGetAssetsTest.m */, + 8BA6158323255099002C33D8 /* IRGetAccountDetailTest.m */, ); path = Scenarious; sourceTree = ""; @@ -272,10 +278,10 @@ 02D656A921F12DC300AAA66A /* IrohaContainer */ = { isa = PBXGroup; children = ( - 02D656AA21F12DC300AAA66A /* IRBaseIrohaContainerTests.m */, - 02D656AB21F12DC300AAA66A /* IRIrohaContainer.m */, 02D656AC21F12DC300AAA66A /* IRBaseIrohaContainerTests.h */, + 02D656AA21F12DC300AAA66A /* IRBaseIrohaContainerTests.m */, 02D656AD21F12DC300AAA66A /* IRIrohaContainer.h */, + 02D656AB21F12DC300AAA66A /* IRIrohaContainer.m */, ); path = IrohaContainer; sourceTree = ""; @@ -555,6 +561,7 @@ TargetAttributes = { 021C844621ED12B40037F633 = { DevelopmentTeam = YLWWUD25VZ; + LastSwiftMigration = 1020; TestTargetID = 02ED8DC121EE8DD80068AF05; }; 02E31A2321DC050E00B33B66 = { @@ -797,8 +804,10 @@ buildActionMask = 2147483647; files = ( 02D656B821F12DC300AAA66A /* IRIrohaContainer.m in Sources */, + 8BF9E1DE2321976F00A1257A /* IRGetAssetsTest.m in Sources */, 02D656B021F12DC300AAA66A /* IRCreateDomainTest.m in Sources */, 02D656BF21F19F7500AAA66A /* IRCreateRoleTest.m in Sources */, + 8BA6158423255099002C33D8 /* IRGetAccountDetailTest.m in Sources */, 02D656B721F12DC300AAA66A /* IRBaseIrohaContainerTests.m in Sources */, 84D693FB22EDCDB10059C1FB /* IRAccountRestoreWithBatchTest.m in Sources */, 02D656AF21F12DC300AAA66A /* IRCreateAccountTest.m in Sources */, @@ -910,6 +919,7 @@ baseConfigurationReference = BE1A149366A65576BDC46228 /* Pods-IntegrationTests.debug.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CLANG_ENABLE_MODULES = YES; DEVELOPMENT_TEAM = YLWWUD25VZ; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -923,8 +933,11 @@ ); INFOPLIST_FILE = "IntegrationTests-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/IntegrationTestHost.app/IntegrationTestHost"; WRAPPER_EXTENSION = xctest; }; @@ -935,6 +948,7 @@ baseConfigurationReference = 55D980CEB7E9C5BA9DA95FC2 /* Pods-IntegrationTests.release.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CLANG_ENABLE_MODULES = YES; DEVELOPMENT_TEAM = YLWWUD25VZ; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -944,8 +958,10 @@ GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; INFOPLIST_FILE = "IntegrationTests-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/IntegrationTestHost.app/IntegrationTestHost"; WRAPPER_EXTENSION = xctest; }; diff --git a/IntegrationTests/IrohaContainer/IRBaseIrohaContainerTests.h b/IntegrationTests/IrohaContainer/IRBaseIrohaContainerTests.h index 1ec48eadc..ae48be06e 100755 --- a/IntegrationTests/IrohaContainer/IRBaseIrohaContainerTests.h +++ b/IntegrationTests/IrohaContainer/IRBaseIrohaContainerTests.h @@ -7,13 +7,16 @@ @import IrohaCommunication; @import IrohaCrypto; -@interface IRBaseIrohaContainerTests : XCTestCase +NS_ASSUME_NONNULL_BEGIN -@property(strong, nonatomic)IRNetworkService * _Nonnull iroha; +@interface IRBaseIrohaContainerTests : XCTestCase -@property(strong, nonatomic)id _Nonnull adminAccountId; -@property(strong, nonatomic)id _Nonnull adminPublicKey; -@property(strong, nonatomic)id _Nonnull adminSigner; -@property(strong, nonatomic)id _Nonnull domain; +@property (strong, nonatomic) IRNetworkService *iroha; +@property (strong, nonatomic) id adminAccountId; +@property (strong, nonatomic) id adminPublicKey; +@property (strong, nonatomic) id adminSigner; +@property (strong, nonatomic) id domain; @end + +NS_ASSUME_NONNULL_END diff --git a/IntegrationTests/IrohaContainer/IRIrohaContainer.h b/IntegrationTests/IrohaContainer/IRIrohaContainer.h index e32f48d49..95ffb5caa 100755 --- a/IntegrationTests/IrohaContainer/IRIrohaContainer.h +++ b/IntegrationTests/IrohaContainer/IRIrohaContainer.h @@ -6,12 +6,12 @@ #import @import IrohaCommunication; -@interface IRIrohaContainer : NSObject -+ (nonnull instancetype)shared; +@interface IRIrohaContainer : NSObject @property(nonatomic, readonly)IRNetworkService * _Nonnull iroha; ++ (nonnull instancetype)shared; - (nullable NSError*)start; - (nullable NSError*)stop; diff --git a/IntegrationTests/IrohaContainer/IRIrohaContainer.m b/IntegrationTests/IrohaContainer/IRIrohaContainer.m index bdf2cbcee..3212217d0 100755 --- a/IntegrationTests/IrohaContainer/IRIrohaContainer.m +++ b/IntegrationTests/IrohaContainer/IRIrohaContainer.m @@ -5,15 +5,16 @@ #import "IRIrohaContainer.h" -static NSString* const DOCKER_HOST = @"http://localhost:49721"; -static NSString* const CONTAINER = @"iroha"; +static NSString * const DOCKER_HOST = @"http://localhost:49721"; +static NSString * const CONTAINER = @"iroha"; -static NSString * IROHA_IP = @"127.0.0.1"; -static NSString * IROHA_PORT = @"50051"; +static NSString *IROHA_IP = @"127.0.0.1"; +static NSString *IROHA_PORT = @"50051"; static NSUInteger CONNECTION_TRIES = 10; static NSTimeInterval CONNECTION_TRY_DELAY = 1.0; + @interface IRIrohaContainer() @property(strong, nonatomic)NSURLSession *session; @@ -21,6 +22,7 @@ @interface IRIrohaContainer() @end + @implementation IRIrohaContainer #pragma mark - Initialization @@ -55,9 +57,10 @@ + (nonnull instancetype)shared { return sharedContainer; } + #pragma mark - Interface -- (nullable NSError*)start { +- (nullable NSError *)start { dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); __block NSError *resultError; diff --git a/IntegrationTests/Scenarious/IRCreateAssetTest.m b/IntegrationTests/Scenarious/IRCreateAssetTest.m index bdee68cf4..e292b7ff9 100755 --- a/IntegrationTests/Scenarious/IRCreateAssetTest.m +++ b/IntegrationTests/Scenarious/IRCreateAssetTest.m @@ -65,6 +65,7 @@ - (void)testCreateAddSubtractQueryAsset { withHash:result from:self.iroha]; }).onThen(^IRPromise * _Nullable (id result) { + NSLog(@"%@", result); IRQueryBuilder *queryBuilder = [IRQueryBuilder builderWithCreatorAccountId:self.adminAccountId]; queryBuilder = [queryBuilder getAccountAssets:self.adminAccountId]; @@ -79,6 +80,7 @@ - (void)testCreateAddSubtractQueryAsset { return [self.iroha executeQueryRequest:request]; }).onThen(^IRPromise * _Nullable (id result) { + NSLog(@"%@", result); if ([result conformsToProtocol:@protocol(IRAccountAssetsResponse)]) { id accountAssetsResult = result; @@ -112,6 +114,7 @@ - (void)testCreateAddSubtractQueryAsset { return [IRPromise promiseWithResult:error]; } }).onThen(^IRPromise * _Nullable (id result) { + NSLog(@"%@", result); IRQueryBuilder *queryBuilder = [IRQueryBuilder builderWithCreatorAccountId:self.adminAccountId]; queryBuilder = [queryBuilder getAssetInfo:assetId]; @@ -126,6 +129,7 @@ - (void)testCreateAddSubtractQueryAsset { return [self.iroha executeQueryRequest:request]; }).onThen(^IRPromise * _Nullable (id result) { + NSLog(@"%@", result); if ([result conformsToProtocol:@protocol(IRAssetResponse)]) { id assetResponse = result; @@ -142,6 +146,7 @@ - (void)testCreateAddSubtractQueryAsset { return [IRPromise promiseWithResult:error]; } }).onThen(^IRPromise * _Nullable (id result) { + NSLog(@"%@", result); [expectation fulfill]; return nil; }).onError(^IRPromise * _Nullable (NSError *error) { diff --git a/IntegrationTests/Scenarious/IRCreateRoleTest.m b/IntegrationTests/Scenarious/IRCreateRoleTest.m index 773da4c5a..4cc867778 100755 --- a/IntegrationTests/Scenarious/IRCreateRoleTest.m +++ b/IntegrationTests/Scenarious/IRCreateRoleTest.m @@ -14,16 +14,18 @@ @implementation IRCreateRoleTest - (void)testCreateRoleRejected { NSError *error = nil; - id role = [IRRoleNameFactory roleWithName:@"superadmintest" error:&error]; + id role = [IRRoleNameFactory roleWithName:@"superadmcdddintest" error:&error]; if (error) { XCTFail(); return; } - NSArray>* permissions = @[[IRRolePermissionFactory canAddSignatory], + NSArray>* permissions = @[ + [IRRolePermissionFactory canAddSignatory], [IRRolePermissionFactory canRemoveSignatory], - [IRRolePermissionFactory canSetQuorum]]; +// [IRRolePermissionFactory canSetQuorum] + ]; IRTransactionBuilder *transactionBuilder = [IRTransactionBuilder builderWithCreatorAccountId:self.adminAccountId]; transactionBuilder = [transactionBuilder createRole:role permissions:permissions]; @@ -35,6 +37,8 @@ - (void)testCreateRoleRejected { XCTFail(); return; } + + NSLog(@"%@", [[transaction transactionHashWithError:nil] toHexString]); XCTestExpectation *expectation = [[XCTestExpectation alloc] init]; diff --git a/IntegrationTests/Scenarious/IRGetAccountDetailTest.m b/IntegrationTests/Scenarious/IRGetAccountDetailTest.m new file mode 100644 index 000000000..9503d6bfc --- /dev/null +++ b/IntegrationTests/Scenarious/IRGetAccountDetailTest.m @@ -0,0 +1,121 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import +#import "IRBaseIrohaContainerTests.h" + + +@interface IRGetAccountDetailTest : IRBaseIrohaContainerTests +@end + + +@implementation IRGetAccountDetailTest + +- (void)testGetAccountDetailInSeveralPages { + id newAccountId = [IRAccountIdFactory accountIdWithName:@"new" + domain:self.domain + error:nil]; + + id keypair = [[[IREd25519KeyFactory alloc] init] createRandomKeypair]; + + id newAccountSigner = [[IREd25519Sha512Signer alloc] initWithPrivateKey:keypair.privateKey]; + + IRTransactionBuilder *builder = [IRTransactionBuilder builderWithCreatorAccountId:self.adminAccountId]; + builder = [builder createAccount:newAccountId publicKey:keypair.publicKey]; + + NSError *error = nil; + id transaction = [[builder build:&error] signedWithSignatories:@[self.adminSigner] + signatoryPublicKeys:@[self.adminPublicKey] + error:&error]; + + NSString *firstDetailKey = @"key"; + NSString *firstDetailValue = @"value"; + + NSString *secondDetailKey = @"otherkey"; + NSString *secondDetailValue = @"othervalue"; + + if (!transaction) { + XCTFail(); + return; + } + + XCTestExpectation *expectation = [[XCTestExpectation alloc] init]; + + UInt32 quorum = 2; + + [self.iroha executeTransaction:transaction].onThen(^IRPromise * _Nullable(id result) { + return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted + withHash:result + from:self.iroha]; + }).onThen(^IRPromise * _Nullable(id result) { + IRTransactionBuilder *transactionBuilder = [IRTransactionBuilder builderWithCreatorAccountId:newAccountId]; + transactionBuilder = [transactionBuilder addSignatory:newAccountId publicKey:self.adminPublicKey]; + transactionBuilder = [transactionBuilder setAccountQuorum:newAccountId quorum:quorum]; + + NSError *error = nil; + id transaction = [[transactionBuilder build:&error] signedWithSignatories:@[newAccountSigner] + signatoryPublicKeys:@[keypair.publicKey] + error:&error]; + + return [self.iroha executeTransaction:transaction]; + }).onThen(^IRPromise * _Nullable(id result) { + return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted + withHash:result + from:self.iroha]; + }).onThen(^IRPromise * _Nullable(id result) { + IRTransactionBuilder *transactionBuilder = [IRTransactionBuilder builderWithCreatorAccountId:newAccountId]; + transactionBuilder = [transactionBuilder setAccountDetail:self.adminAccountId key:firstDetailKey + value:firstDetailValue]; + transactionBuilder = [transactionBuilder setAccountDetail:self.adminAccountId key:secondDetailKey + value:secondDetailValue]; + + NSError *error = nil; + id transaction = [[transactionBuilder build:&error] signedWithSignatories:@[newAccountSigner] + signatoryPublicKeys:@[keypair.publicKey] + error:&error]; + + return [self.iroha executeTransaction:transaction]; + }).onThen(^IRPromise * _Nullable(id result) { + return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted + withHash:result + from:self.iroha]; + }).onThen(^IRPromise * _Nullable(id result) { + IRQueryBuilder *queryBuilder = [IRQueryBuilder builderWithCreatorAccountId:self.adminAccountId]; + queryBuilder = [queryBuilder getAccountDetail:newAccountId writer:nil key:nil]; + + NSError *queryError = nil; + id queryRequest = [[queryBuilder build:&queryError] signedWithSignatory:self.adminSigner + signatoryPublicKey:self.adminPublicKey + error:&queryError]; + + return [self.iroha executeQueryRequest:queryRequest]; + }).onThen(^IRPromise * _Nullable(id result) { + NSLog(@"%@", result); + if (![result conformsToProtocol:@protocol(IRAccountDetailResponse)]) { + XCTFail(); + } else { + id detailResponse = result; + + XCTAssertEqual(detailResponse.totalCount, 2); + XCTAssertNotNil(detailResponse.nextRecordId); + } + + [expectation fulfill]; + + return nil; + }).onError(^IRPromise * _Nullable(NSError* error) { + XCTFail(); + NSLog(@"%@",error); + + [expectation fulfill]; + + return nil; + }); + + [self waitForExpectations:@[expectation] timeout:120.0]; +} + + +@end diff --git a/IntegrationTests/Scenarious/IRGetAssetsTest.m b/IntegrationTests/Scenarious/IRGetAssetsTest.m new file mode 100644 index 000000000..de8524da9 --- /dev/null +++ b/IntegrationTests/Scenarious/IRGetAssetsTest.m @@ -0,0 +1,272 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import +#import "IRBaseIrohaContainerTests.h" + + +@interface IRGetAssetsTest : IRBaseIrohaContainerTests +@end + + +@implementation IRGetAssetsTest + +- (void)testGetAssetsInSinglePage { + NSError *error = nil; + id assetId = [IRAssetIdFactory assetIdWithName:@"dummycoin" + domain:self.domain + error:&error]; + + if (error) { + XCTFail(); + return; + } + + UInt32 assetPrecision = 2; + IRTransactionBuilder *assetTransactionBuilder = [IRTransactionBuilder + builderWithCreatorAccountId:self.adminAccountId]; + assetTransactionBuilder = [assetTransactionBuilder createAsset:assetId precision:assetPrecision]; + + id assetTransaction = [[assetTransactionBuilder build:&error] + signedWithSignatories:@[self.adminSigner] + signatoryPublicKeys:@[self.adminPublicKey] + error:&error]; + + id addAmount = [IRAmountFactory amountFromUnsignedInteger:200 error:&error]; + + if (error) { + XCTFail(); + return; + } + + XCTestExpectation *expectation = [XCTestExpectation new]; + + [self.iroha executeTransaction:assetTransaction].onThen(^IRPromise * _Nullable (id result) { + return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted + withHash:result + from:self.iroha]; + }).onThen(^IRPromise * _Nullable (id result) { + IRTransactionBuilder *transactionBuilder = [IRTransactionBuilder builderWithCreatorAccountId:self.adminAccountId]; + transactionBuilder = [transactionBuilder addAssetQuantity:assetId + amount:addAmount]; + + NSError *error = nil; + id transaction = [[transactionBuilder build:&error] + signedWithSignatories:@[self.adminSigner] + signatoryPublicKeys:@[self.adminPublicKey] error:&error]; + + if (error) { + return [IRPromise promiseWithResult:error]; + } + + return [self.iroha executeTransaction:transaction]; + }).onThen(^IRPromise * _Nullable (id result) { + return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted + withHash:result + from:self.iroha]; + }).onThen(^IRPromise * _Nullable (id result) { + IRQueryBuilder *queryBuilder = [IRQueryBuilder builderWithCreatorAccountId:self.adminAccountId]; + id pagination = [IRAssetPaginationFactory assetPagination:1 startingAssetId:assetId]; + queryBuilder = [queryBuilder getAccountAssets:self.adminAccountId pagination:pagination]; + + NSError *error = nil; + id request = [[queryBuilder build:&error] signedWithSignatory:self.adminSigner + signatoryPublicKey:self.adminPublicKey + error:&error]; + + if (error) { + return [IRPromise promiseWithResult:error]; + } + + return [self.iroha executeQueryRequest:request]; + }).onThen(^IRPromise * _Nullable (id result) { + NSLog(@"%@", result); + if ([result conformsToProtocol:@protocol(IRAccountAssetsResponse)]) { + id assetsResponse = result; + + id asset = [assetsResponse.accountAssets firstObject]; + + XCTAssertEqual(assetsResponse.totalCount, 1); + XCTAssertNil(assetsResponse.nextAssetId); + XCTAssertEqualObjects(asset.assetId.identifier, assetId.identifier); + + return [IRPromise promiseWithResult:nil]; + } else { + NSString *message = [NSString stringWithFormat:@"Invalid get assets response %@", NSStringFromClass([result class])]; + NSError *error = [NSError errorWithDomain:@"co.jp.getassetstest" + code:0 + userInfo:@{NSLocalizedDescriptionKey: message}]; + + return [IRPromise promiseWithResult:error]; + } + }).onThen(^IRPromise * _Nullable (id result) { + NSLog(@"%@", result); + + [expectation fulfill]; + + return nil; + }).onError(^IRPromise * _Nullable (NSError *error) { + XCTFail(); + NSLog(@"%@", error); + + [expectation fulfill]; + return nil; + }); + + [self waitForExpectations:@[expectation] timeout:120.0]; +} + +- (void)testGetAssetsInSeveralPages { + NSError *error = nil; + id firstAssetId = [IRAssetIdFactory assetIdWithName:@"dummycoin" + domain:self.domain + error:&error]; + + if (error) { + XCTFail(); + return; + } + + id secondAssetId = [IRAssetIdFactory assetIdWithName:@"gummycoin" + domain:self.domain + error:&error]; + + if (error) { + XCTFail(); + return; + } + + UInt32 assetPrecision = 2; + IRTransactionBuilder *assetTransactionBuilder = [IRTransactionBuilder + builderWithCreatorAccountId:self.adminAccountId]; + assetTransactionBuilder = [assetTransactionBuilder createAsset:firstAssetId precision:assetPrecision]; + + id assetTransaction = [[assetTransactionBuilder build:&error] + signedWithSignatories:@[self.adminSigner] + signatoryPublicKeys:@[self.adminPublicKey] + error:&error]; + + id addAmount = [IRAmountFactory amountFromUnsignedInteger:200 error:&error]; + + if (error) { + XCTFail(); + return; + } + + XCTestExpectation *expectation = [XCTestExpectation new]; + + [self.iroha executeTransaction:assetTransaction].onThen(^IRPromise * _Nullable (id result) { + return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted + withHash:result + from:self.iroha]; + }).onThen(^IRPromise * _Nullable (id result) { + IRTransactionBuilder *transactionBuilder = [IRTransactionBuilder builderWithCreatorAccountId:self.adminAccountId]; + transactionBuilder = [transactionBuilder addAssetQuantity:firstAssetId + amount:addAmount]; + + NSError *error = nil; + id transaction = [[transactionBuilder build:&error] + signedWithSignatories:@[self.adminSigner] + signatoryPublicKeys:@[self.adminPublicKey] error:&error]; + + if (error) { + return [IRPromise promiseWithResult:error]; + } + + return [self.iroha executeTransaction:transaction]; + }).onThen(^IRPromise * _Nullable (id result) { + return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted + withHash:result + from:self.iroha]; + }).onThen(^IRPromise * _Nullable (id result) { + IRTransactionBuilder *transactionBuilder = [IRTransactionBuilder builderWithCreatorAccountId:self.adminAccountId]; + transactionBuilder = [transactionBuilder createAsset:secondAssetId precision:assetPrecision]; + + NSError *error = nil; + id transaction = [[transactionBuilder build:&error] + signedWithSignatories:@[self.adminSigner] + signatoryPublicKeys:@[self.adminPublicKey] error:&error]; + + if (error) { + return [IRPromise promiseWithResult:error]; + } + + return [self.iroha executeTransaction:transaction]; + }).onThen(^IRPromise * _Nullable (id result) { + return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted + withHash:result + from:self.iroha]; + }).onThen(^IRPromise * _Nullable (id result) { + IRTransactionBuilder *transactionBuilder = [IRTransactionBuilder builderWithCreatorAccountId:self.adminAccountId]; + transactionBuilder = [transactionBuilder addAssetQuantity:secondAssetId + amount:addAmount]; + + NSError *error = nil; + id transaction = [[transactionBuilder build:&error] + signedWithSignatories:@[self.adminSigner] + signatoryPublicKeys:@[self.adminPublicKey] error:&error]; + + if (error) { + return [IRPromise promiseWithResult:error]; + } + + return [self.iroha executeTransaction:transaction]; + }).onThen(^IRPromise * _Nullable (id result) { + return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted + withHash:result + from:self.iroha]; + }).onThen(^IRPromise * _Nullable (id result) { + IRQueryBuilder *queryBuilder = [IRQueryBuilder builderWithCreatorAccountId:self.adminAccountId]; + id pagination = [IRAssetPaginationFactory assetPagination:1 startingAssetId:firstAssetId]; + queryBuilder = [queryBuilder getAccountAssets:self.adminAccountId pagination:pagination]; + + NSError *error = nil; + id request = [[queryBuilder build:&error] signedWithSignatory:self.adminSigner + signatoryPublicKey:self.adminPublicKey + error:&error]; + + if (error) { + return [IRPromise promiseWithResult:error]; + } + + return [self.iroha executeQueryRequest:request]; + }).onThen(^IRPromise * _Nullable (id result) { + NSLog(@"%@", result); + if ([result conformsToProtocol:@protocol(IRAccountAssetsResponse)]) { + id assetsResponse = result; + + id firstAsset = [assetsResponse.accountAssets firstObject]; + + XCTAssertEqual(assetsResponse.totalCount, 2); + XCTAssertEqualObjects(assetsResponse.nextAssetId.identifier, secondAssetId.identifier); + XCTAssertEqualObjects(firstAsset.assetId.identifier, firstAssetId.identifier); + + return [IRPromise promiseWithResult:nil]; + } else { + NSString *message = [NSString stringWithFormat:@"Invalid get assets response %@", NSStringFromClass([result class])]; + NSError *error = [NSError errorWithDomain:@"co.jp.getassetstest" + code:0 + userInfo:@{NSLocalizedDescriptionKey: message}]; + + return [IRPromise promiseWithResult:error]; + } + }).onThen(^IRPromise * _Nullable (id result) { + NSLog(@"%@", result); + + [expectation fulfill]; + + return nil; + }).onError(^IRPromise * _Nullable (NSError *error) { + XCTFail(); + NSLog(@"%@", error); + + [expectation fulfill]; + return nil; + }); + + [self waitForExpectations:@[expectation] timeout:120.0]; +} + +@end diff --git a/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m b/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m index 7c18b03fc..97c225d14 100755 --- a/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m +++ b/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m @@ -344,7 +344,7 @@ @implementation IRQueryResponseProtoFactory id nextRecordId = nil; - if (pbResponse.hasNextRecordId && pbResponse.nextRecordId) { + if (pbResponse.hasNextRecordId) { nextRecordId = [IRAccountDetailRecordIdFactory accountDetailRecordIdWithWriter:pbResponse.nextRecordId.writer key:pbResponse.nextRecordId.key]; } diff --git a/IrohaCommunication/Classes/Private/Models/IRCommand+Proto.m b/IrohaCommunication/Classes/Private/Models/IRCommand+Proto.m index b1a6a179f..f55f065c3 100755 --- a/IrohaCommunication/Classes/Private/Models/IRCommand+Proto.m +++ b/IrohaCommunication/Classes/Private/Models/IRCommand+Proto.m @@ -518,10 +518,6 @@ @implementation IRCommandProtoFactory return nil; } - if (!pbCommand.key || !pbCommand.value) { - return nil; - } - return [[IRCompareAndSetAccountDetail alloc] initWithAccountId:accountId key:pbCommand.key value:pbCommand.value diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h index 30cb374d0..ae8f8d973 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h @@ -11,7 +11,8 @@ - (nonnull instancetype)initWithAccountId:(nullable id)accountId writer:(nullable id)writer - key:(nullable NSString*)key - pagination:(nullable id)pagination; + key:(nullable NSString*)key; + +- (nonnull instancetype)initWithPagination:(nonnull id)pagination; @end diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m index fd61bc85a..109f836f6 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m @@ -16,25 +16,30 @@ @implementation IRGetAccountDetail - (nonnull instancetype)initWithAccountId:(nullable id)accountId writer:(nullable id)writer - key:(nullable NSString*)key - pagination:(nullable id)pagination { + key:(nullable NSString*)key { if (self = [super init]) { _accountId = accountId; _writer = writer; _key = key; - _pagination = pagination; } return self; } +- (nonnull instancetype)initWithPagination:(nonnull id)pagination { + + if (self = [super init]) { + _pagination = pagination; + } + + return self; +} + + #pragma mark - Protobuf Transformable -- (nullable id)transform:(NSError**)error { - GetAccountDetail *query = [[GetAccountDetail alloc] init]; - query.accountId = [_accountId identifier]; - query.writer = [_writer identifier]; - query.key = _key; +- (nullable id)transform:(NSError **)error { + GetAccountDetail *query = [GetAccountDetail new]; if (_pagination) { AccountDetailRecordId *recordId = [AccountDetailRecordId new]; @@ -46,9 +51,13 @@ - (nullable id)transform:(NSError**)error { meta.firstRecordId = recordId; query.paginationMeta = meta; + } else { + query.accountId = [_accountId identifier]; + query.writer = [_writer identifier]; + query.key = _key; } - Query_Payload *payload = [[Query_Payload alloc] init]; + Query_Payload *payload = [Query_Payload new]; payload.getAccountDetail = query; return payload; diff --git a/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.m b/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.m index 75adba5b0..7b4bf10f7 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.m +++ b/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.m @@ -6,6 +6,7 @@ #import "IRAccountAssetsResponse.h" @implementation IRAccountAssetsResponse + @synthesize accountAssets = _accountAssets; @synthesize totalCount = _totalCount; @synthesize nextAssetId = _nextAssetId; @@ -25,4 +26,8 @@ - (nonnull instancetype)initWithAccountAssets:(nonnull NSArray)accountId writer:(nullable id)writer - key:(nullable NSString*)key DEPRECATED_MSG_ATTRIBUTE("use getAccountDetail:writer:key:pagination:"); + key:(nullable NSString*)key; -- (nonnull instancetype)getAccountDetail:(nullable id)accountId - writer:(nullable id)writer - key:(nullable NSString*)key - pagination:(nullable id)pagination; +- (nonnull instancetype)getAccountDetailWithPagination:(nonnull id)pagination; - (nonnull instancetype)getRoles; diff --git a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m index 3e74b0747..9fd6a6c15 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m +++ b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m @@ -87,17 +87,15 @@ - (nonnull instancetype)getAccountAssets:(nonnull id)accountId - (nonnull instancetype)getAccountDetail:(nullable id)accountId writer:(nullable id)writer key:(nullable NSString*)key { - return [self getAccountDetail:accountId writer:writer key:key pagination:nil]; + id record = [IRAccountDetailRecordIdFactory accountDetailRecordIdWithWriter:writer + key:key]; + id pagination = [IRAccountDetailPaginationFactory accountDetailPagination:1 + nextRecordId:record]; + return [self getAccountDetailWithPagination:pagination]; } -- (nonnull instancetype)getAccountDetail:(nullable id)accountId - writer:(nullable id)writer - key:(nullable NSString*)key - pagination:(nullable id)pagination { - id query = [[IRGetAccountDetail alloc] initWithAccountId:accountId - writer:writer - key:key - pagination:pagination]; +- (nonnull instancetype)getAccountDetailWithPagination:(id)pagination { + id query = [[IRGetAccountDetail alloc] initWithPagination:pagination]; return [self withQuery:query]; } diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAccountAsset.m b/IrohaCommunication/Classes/Public/Model/Common/IRAccountAsset.m index 6930814f2..dff39151c 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRAccountAsset.m +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAccountAsset.m @@ -5,11 +5,13 @@ #import "IRAccountAsset.h" -@interface IRAccountAsset : NSObject +@interface IRAccountAsset : NSObject @end + @implementation IRAccountAsset + @synthesize accountId = _accountId; @synthesize assetId = _assetId; @synthesize balance = _balance; @@ -26,8 +28,13 @@ - (nonnull instancetype)initWithAccountId:(nonnull id)accountId return self; } +- (NSString *)description { + return [NSString stringWithFormat:@"Account id: %@\nAsset id:%@\nBalance: %@\n", _accountId, _assetId, _balance]; +} + @end + @implementation IRAccountAssetFactory + (nullable id)accountAssetWithAccountId:(nonnull id)accountId diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailRecordId.m b/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailRecordId.m index 0c7ac85b4..2533f0dce 100644 --- a/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailRecordId.m +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailRecordId.m @@ -24,6 +24,10 @@ - (instancetype)initWithWriter:(nonnull NSString *)writer key:(nonnull NSString return self; } +- (NSString *)description { + return [NSString stringWithFormat:@"Writer: %@\nKey:%@", _writer, _key]; +} + @end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAccountId.m b/IrohaCommunication/Classes/Public/Model/Common/IRAccountId.m index 0fc4ff0a0..6e5d74820 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRAccountId.m +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAccountId.m @@ -5,20 +5,24 @@ #import "IRAccountId.h" + static NSString * const ACCOUNT_NAME_FORMAT = @"[a-z_0-9]{1,32}"; static NSString * const ACCOUNT_SEPARATOR = @"@"; + @interface IRAccountId : NSObject -- (instancetype)initWithName:(nonnull NSString*)name inDomain:(nonnull id)domain; +- (instancetype)initWithName:(nonnull NSString *)name inDomain:(nonnull id)domain; @end + @implementation IRAccountId + @synthesize name = _name; @synthesize domain = _domain; -- (instancetype)initWithName:(nonnull NSString*)name inDomain:(nonnull id)domain { +- (instancetype)initWithName:(nonnull NSString *)name inDomain:(nonnull id)domain { if (self = [super init]) { _name = name; _domain = domain; @@ -27,17 +31,22 @@ - (instancetype)initWithName:(nonnull NSString*)name inDomain:(nonnull id)accountIdWithName:(nonnull NSString*)name ++ (nullable id)accountIdWithName:(nonnull NSString *)name domain:(nonnull id)domain - error:(NSError*_Nullable*_Nullable)error { + error:(NSError *_Nullable*_Nullable)error { NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", ACCOUNT_NAME_FORMAT]; if ([predicate evaluateWithObject:name]) { @@ -53,8 +62,8 @@ @implementation IRAccountIdFactory } } -+ (nullable id)accountWithIdentifier:(nonnull NSString*)accountId - error:(NSError*_Nullable*_Nullable)error { ++ (nullable id)accountWithIdentifier:(nonnull NSString *)accountId + error:(NSError *_Nullable*_Nullable)error { NSArray *components = [accountId componentsSeparatedByString:ACCOUNT_SEPARATOR]; if ([components count] != 2) { diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAmount.m b/IrohaCommunication/Classes/Public/Model/Common/IRAmount.m index de6fa96bd..caec5ba66 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRAmount.m +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAmount.m @@ -5,18 +5,22 @@ #import "IRAmount.h" + static NSString * const DECIMAL_SEPARATOR = @"."; + @interface IRAmount : NSObject -- (instancetype)initWithString:(nonnull NSString*)amountString; +- (instancetype)initWithString:(nonnull NSString *)amountString; @end + @implementation IRAmount + @synthesize value = _value; -- (instancetype)initWithString:(nonnull NSString*)amountString { +- (instancetype)initWithString:(nonnull NSString *)amountString { if (self = [super init]) { _value = amountString; } @@ -24,11 +28,16 @@ - (instancetype)initWithString:(nonnull NSString*)amountString { return self; } +- (NSString *)description { + return [NSString stringWithFormat:@"%@", _value]; +} + @end + @implementation IRAmountFactory -+ (nullable id)amountFromString:(nonnull NSString*)amount error:(NSError*_Nullable*_Nullable)error { ++ (nullable id)amountFromString:(nonnull NSString *)amount error:(NSError *_Nullable*_Nullable)error { NSCharacterSet *invalidSymbols = [[NSCharacterSet characterSetWithCharactersInString:@"0123456789."] invertedSet]; if ([amount rangeOfCharacterFromSet:invalidSymbols].location != NSNotFound) { @@ -57,7 +66,7 @@ @implementation IRAmountFactory return [[IRAmount alloc] initWithString:[decimalNumber stringValue]]; } -+ (nullable id)amountFromUnsignedInteger:(NSUInteger)amount error:(NSError*_Nullable*_Nullable)error { ++ (nullable id)amountFromUnsignedInteger:(NSUInteger)amount error:(NSError *_Nullable*_Nullable)error { return [self amountFromString:[@(amount) stringValue] error:error]; } diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAssetId.m b/IrohaCommunication/Classes/Public/Model/Common/IRAssetId.m index c6622d827..f4414a092 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRAssetId.m +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAssetId.m @@ -5,16 +5,20 @@ #import "IRAssetId.h" + static NSString * const ASSET_NAME_FORMAT = @"[a-z_0-9]{1,32}"; static NSString * const ASSET_ID_SEPARATOR = @"#"; + @interface IRAssetId : NSObject - (instancetype)initWithName:(nonnull NSString*)name inDomain:(nonnull id)domain; @end + @implementation IRAssetId + @synthesize name = _name; @synthesize domain = _domain; @@ -31,8 +35,13 @@ - (nonnull NSString*)identifier { return [NSString stringWithFormat:@"%@%@%@", _name, ASSET_ID_SEPARATOR, _domain.identifier]; } +- (NSString *)description { + return [NSString stringWithFormat:@"%@", [self identifier]]; +} + @end + @implementation IRAssetIdFactory + (nullable id)assetIdWithName:(nonnull NSString*)name diff --git a/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h b/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h index 94d399efa..74a160ac2 100755 --- a/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h +++ b/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h @@ -18,7 +18,7 @@ @protocol IRQueryResponse -@property(nonatomic, readonly)NSData* _Nonnull queryHash; +@property (nonatomic, readonly) NSData* _Nonnull queryHash; @end diff --git a/Tests/Model/IRAccountDetailPaginationTests.m b/Tests/Model/IRAccountDetailPaginationTests.m index 26b84d0c4..ac0152ac2 100644 --- a/Tests/Model/IRAccountDetailPaginationTests.m +++ b/Tests/Model/IRAccountDetailPaginationTests.m @@ -14,7 +14,7 @@ @interface IRAccountDetailPaginationTests : XCTestCase @implementation IRAccountDetailPaginationTests -- (void)testNonnilStartingAssetId { +- (void)testNonnilStartingRecordId { UInt32 pageSize = 10; NSString *writer = @"writer"; @@ -32,7 +32,7 @@ - (void)testNonnilStartingAssetId { XCTAssertEqualObjects(pagination.nextRecordId.key, key); } -- (void)testNilStartingAssetId { +- (void)testNilStartingRecordId { UInt32 pageSize = 10; id pagination = [IRAccountDetailPaginationFactory accountDetailPagination:pageSize diff --git a/Tests/Query/IRQueryBuilderTests.m b/Tests/Query/IRQueryBuilderTests.m index 838f321bd..5ca515cbc 100755 --- a/Tests/Query/IRQueryBuilderTests.m +++ b/Tests/Query/IRQueryBuilderTests.m @@ -6,10 +6,15 @@ @import XCTest; @import IrohaCommunication; + static NSString * const VALID_ACCOUNT_IDENTIFIER = @"bob@gmail.com"; +static NSString * const VALID_WRITER_IDENTIFIER = @"writer@test"; static NSString * const VALID_ASSET_IDENTIFIER = @"testcoin#gmail.com"; static NSString * const VALID_ROLE = @"admin"; +static NSString * const DETAIL_KEY = @"key"; static UInt64 VALID_QUERY_COUNTER = 10; +static UInt64 DETAIL_PAGE_SIZE = 10; + @interface IRQueryTestCase : NSObject @@ -19,6 +24,7 @@ @interface IRQueryTestCase : NSObject @end + @implementation IRQueryTestCase - (nonnull instancetype)initWithSelector:(nonnull SEL)selector @@ -127,20 +133,25 @@ - (void)testQueries { - (nonnull NSArray*)createTestCases { id accountId = [IRAccountIdFactory accountWithIdentifier:VALID_ACCOUNT_IDENTIFIER error:nil]; + id assetId = [IRAssetIdFactory assetWithIdentifier:VALID_ASSET_IDENTIFIER error:nil]; + id roleName = [IRRoleNameFactory roleWithName:VALID_ROLE error:nil]; + id pagination = [IRPaginationFactory pagination:10 firstItemHash:nil error:nil]; - id assetPagination = [IRAssetPaginationFactory assetPagination:10 - startingAssetId:assetId]; + id assetPagination = [IRAssetPaginationFactory assetPagination:DETAIL_PAGE_SIZE startingAssetId:assetId]; + + NSString + + id accountDetailRecordId = [IRAccountDetailRecordIdFactory accountDetailRecordIdWithWriter:VALID_WRITER_IDENTIFIER + key:DETAIL_KEY]; - id accountDetailRecordId = [IRAccountDetailRecordIdFactory accountDetailRecordIdWithWriter:@"writer" - key:@"key"]; - id accountDetailPagination = [IRAccountDetailPaginationFactory accountDetailPagination:10 + id accountDetailPagination = [IRAccountDetailPaginationFactory accountDetailPagination:DETAIL_PAGE_SIZE nextRecordId:accountDetailRecordId]; NSData *itemHash = [@"Test Data" dataUsingEncoding:NSUTF8StringEncoding]; @@ -178,7 +189,7 @@ - (void)testQueries { protocol:@protocol(IRGetAccountDetail)]; IRQueryTestCase *getAccountDetailPaginated = [[IRQueryTestCase alloc] initWithSelector:@selector(getAccountDetail:writer:key:pagination:) - arguments:@[accountId, accountId, @"key", accountDetailPagination] + arguments:@[accountId, accountId, DETAIL_KEY, accountDetailPagination] protocol:@protocol(IRGetAccountDetail)]; IRQueryTestCase *getRoles = [[IRQueryTestCase alloc] initWithSelector:@selector(getRoles) From 885f81eade6603c18b0c961552707b368b9a7db6 Mon Sep 17 00:00:00 2001 From: Andrei Marin Date: Mon, 9 Sep 2019 10:57:49 +0300 Subject: [PATCH 4/8] style fixes Signed-off-by: Russel --- .../IrohaContainer/IRIrohaContainer.h | 6 +- .../IrohaContainer/IRIrohaContainer.m | 20 +-- .../IRAccountRestoreWithBatchTest.m | 22 ++-- .../Scenarious/IRCreateAccountTest.m | 2 +- .../Scenarious/IRCreateDomainTest.m | 2 +- .../Scenarious/IRCreateRoleTest.m | 2 +- .../Scenarious/IRGetAccountDetailTest.m | 2 +- .../Private/Commands/IRAddAssetQuantity.m | 2 +- .../Private/Commands/IRSetAccountDetail.h | 4 +- .../Private/Commands/IRSetAccountDetail.m | 4 +- .../Private/Commands/IRTransferAsset.h | 2 +- .../Private/Commands/IRTransferAsset.m | 2 +- .../Classes/Private/IRBlockQueryRequestImpl.h | 2 +- .../Classes/Private/IRBlockQueryRequestImpl.m | 12 +- .../Classes/Private/IRProtobufTransformable.h | 2 +- .../Classes/Private/IRQueryRequestImpl.h | 2 +- .../Classes/Private/IRQueryRequestImpl.m | 12 +- .../Classes/Private/IRQueryResponse+Proto.h | 2 +- .../Classes/Private/IRQueryResponse+Proto.m | 48 ++++---- .../Classes/Private/IRTransactionImpl+Proto.h | 2 +- .../Classes/Private/IRTransactionImpl+Proto.m | 4 +- .../Classes/Private/IRTransactionImpl.h | 4 +- .../Classes/Private/IRTransactionImpl.m | 28 ++--- .../Private/IRTransactionStatusResponseImpl.h | 4 +- .../Private/IRTransactionStatusResponseImpl.m | 4 +- .../Classes/Private/Models/IRBlock+Proto.h | 2 +- .../Classes/Private/Models/IRBlock+Proto.m | 6 +- .../Classes/Private/Models/IRBlockImpl.h | 6 +- .../Classes/Private/Models/IRBlockImpl.m | 6 +- .../Classes/Private/Models/IRCommand+Proto.h | 2 +- .../Classes/Private/Models/IRCommand+Proto.m | 36 +++--- .../Private/Models/IRPeerSignature+Proto.h | 2 +- .../Private/Models/IRPeerSignature+Proto.m | 2 +- .../Classes/Private/Queries/IRGetAccount.m | 2 +- .../Queries/IRGetAccountAssetTransactions.m | 2 +- .../Private/Queries/IRGetAccountAssets.m | 2 +- .../Private/Queries/IRGetAccountDetail.h | 2 +- .../Private/Queries/IRGetAccountDetail.m | 2 +- .../Queries/IRGetAccountTransactions.m | 2 +- .../Classes/Private/Queries/IRGetAssetInfo.m | 2 +- .../Classes/Private/Queries/IRGetPeers.m | 2 +- .../Queries/IRGetPendingTransactions.m | 2 +- .../Private/Queries/IRGetRolePermissions.m | 2 +- .../Classes/Private/Queries/IRGetRoles.m | 2 +- .../Private/Queries/IRGetSignatories.m | 2 +- .../Private/Queries/IRGetTransactions.h | 2 +- .../Private/Queries/IRGetTransactions.m | 6 +- .../Responses/IRAccountAssetsResponse.h | 2 +- .../Responses/IRAccountAssetsResponse.m | 2 +- .../Responses/IRAccountDetailResponse.h | 4 +- .../Responses/IRAccountDetailResponse.m | 4 +- .../Private/Responses/IRAccountResponse.h | 4 +- .../Private/Responses/IRAccountResponse.m | 4 +- .../Private/Responses/IRAssetResponse.h | 2 +- .../Private/Responses/IRAssetResponse.m | 2 +- .../Responses/IRBlockQueryResponse+Proto.h | 2 +- .../Responses/IRBlockQueryResponse+Proto.m | 4 +- .../Responses/IRBlockQueryResponseImpl.h | 2 +- .../Responses/IRBlockQueryResponseImpl.m | 2 +- .../Private/Responses/IRErrorResponse.h | 4 +- .../Private/Responses/IRErrorResponse.m | 4 +- .../Private/Responses/IRPeersResponse.h | 2 +- .../Responses/IRRolePermissionsResponse.h | 2 +- .../Responses/IRRolePermissionsResponse.m | 2 +- .../Private/Responses/IRRolesResponse.h | 2 +- .../Private/Responses/IRRolesResponse.m | 2 +- .../Private/Responses/IRSignatoriesResponse.h | 2 +- .../Private/Responses/IRSignatoriesResponse.m | 2 +- .../Responses/IRTransactionsPageResponse.h | 4 +- .../Responses/IRTransactionsPageResponse.m | 4 +- .../Responses/IRTransactionsResponse.h | 2 +- .../Responses/IRTransactionsResponse.m | 2 +- .../Public/Builder/IRBlockQueryBuilder.h | 4 +- .../Public/Builder/IRBlockQueryBuilder.m | 10 +- .../Classes/Public/Builder/IRQueryBuilder.h | 8 +- .../Classes/Public/Builder/IRQueryBuilder.m | 16 +-- .../Public/Builder/IRTransactionBuilder.h | 10 +- .../Public/Builder/IRTransactionBuilder.m | 22 ++-- .../Public/Model/Common/IRAccountAsset.h | 6 +- .../Model/Common/IRAccountDetailPagination.h | 4 +- .../Model/Common/IRAccountDetailRecordId.h | 4 +- .../Classes/Public/Model/Common/IRAccountId.h | 14 +-- .../Classes/Public/Model/Common/IRAccountId.m | 2 +- .../Classes/Public/Model/Common/IRAddress.h | 8 +- .../Classes/Public/Model/Common/IRAddress.m | 20 +-- .../Classes/Public/Model/Common/IRAmount.h | 6 +- .../Classes/Public/Model/Common/IRAssetId.h | 14 +-- .../Classes/Public/Model/Common/IRAssetId.m | 16 +-- .../Public/Model/Common/IRAssetPagination.h | 4 +- .../Classes/Public/Model/Common/IRDomain.h | 6 +- .../Classes/Public/Model/Common/IRDomain.m | 8 +- .../Model/Common/IRGrantablePermission.h | 4 +- .../Model/Common/IRGrantablePermission.m | 2 +- .../Public/Model/Common/IRPagination.h | 20 +-- .../Public/Model/Common/IRPagination.m | 4 +- .../Public/Model/Common/IRPeerSignature.h | 6 +- .../Public/Model/Common/IRPeerSignature.m | 2 +- .../Classes/Public/Model/Common/IRRoleName.h | 4 +- .../Classes/Public/Model/Common/IRRoleName.m | 6 +- .../Public/Model/Common/IRRolePermission.h | 116 ++++++++++-------- .../Public/Model/Common/IRRolePermission.m | 2 +- .../Public/Model/IRBlockQueryRequest.h | 10 +- .../Public/Model/IRBlockQueryResponse.h | 16 +-- .../Classes/Public/Model/IRCommand.h | 82 ++++++------- .../Classes/Public/Model/IRQuery.h | 32 ++--- .../Classes/Public/Model/IRQueryRequest.h | 12 +- .../Classes/Public/Model/IRQueryResponse.h | 48 ++++---- .../Classes/Public/Model/IRSignable.h | 2 +- .../Classes/Public/Model/IRTransaction.h | 26 ++-- .../Model/IRTransactionStatusResponse.h | 6 +- .../Classes/Public/Promise/IRPromise.h | 20 +-- .../Classes/Public/Promise/IRPromise.m | 8 +- .../Serializers/IRSerializationFactory.h | 8 +- .../Serializers/IRSerializationFactory.m | 8 +- .../Classes/Public/Service/IRNetworkService.h | 4 +- .../Classes/Public/Service/IRNetworkService.m | 12 +- .../Public/Service/IRRepeatableStatusStream.h | 4 +- .../Public/Service/IRRepeatableStatusStream.m | 29 ++--- .../Service/IRTransactionStatusStreamable.h | 2 +- ProtoGen/Block.pbobjc.h | 2 +- ProtoGen/QryResponses.pbobjc.h | 6 +- ProtoGen/Queries.pbobjc.h | 2 +- ProtoGen/Transaction.pbobjc.h | 2 +- Tests/Model/IRAccountIdTests.m | 6 +- Tests/Model/IRAddressTests.m | 8 +- Tests/Model/IRAssetIdTests.m | 6 +- Tests/Model/IRAssetPaginationTests.m | 2 +- Tests/Model/IRRoleNameTests.m | 4 +- Tests/Promise/IRPromiseTests.m | 2 +- Tests/Query/IRQueryBuilderTests.m | 6 +- Tests/Transaction/IRTransactionTests.m | 4 +- 131 files changed, 547 insertions(+), 538 deletions(-) diff --git a/IntegrationTests/IrohaContainer/IRIrohaContainer.h b/IntegrationTests/IrohaContainer/IRIrohaContainer.h index 95ffb5caa..c519c6601 100755 --- a/IntegrationTests/IrohaContainer/IRIrohaContainer.h +++ b/IntegrationTests/IrohaContainer/IRIrohaContainer.h @@ -9,10 +9,10 @@ @interface IRIrohaContainer : NSObject -@property(nonatomic, readonly)IRNetworkService * _Nonnull iroha; +@property (nonatomic, readonly) IRNetworkService * _Nonnull iroha; + (nonnull instancetype)shared; -- (nullable NSError*)start; -- (nullable NSError*)stop; +- (nullable NSError *)start; +- (nullable NSError *)stop; @end diff --git a/IntegrationTests/IrohaContainer/IRIrohaContainer.m b/IntegrationTests/IrohaContainer/IRIrohaContainer.m index 3212217d0..35a5358b5 100755 --- a/IntegrationTests/IrohaContainer/IRIrohaContainer.m +++ b/IntegrationTests/IrohaContainer/IRIrohaContainer.m @@ -17,8 +17,8 @@ @interface IRIrohaContainer() -@property(strong, nonatomic)NSURLSession *session; -@property(strong, nonatomic)IRNetworkService *irohaService; +@property (nonatomic, strong) NSURLSession *session; +@property (nonatomic, strong) IRNetworkService *irohaService; @end @@ -101,7 +101,7 @@ - (nullable NSError *)start { return resultError; } -- (nullable NSError*)stop { +- (nullable NSError *)stop { dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); __block NSError *resultError; @@ -180,7 +180,7 @@ - (nonnull NSURLRequest*)createContainerStopRequest { #pragma mark - Response -- (nullable NSError*)handleRestartResponse:(nonnull NSURLResponse *)response +- (nullable NSError *)handleRestartResponse:(nonnull NSURLResponse *)response data:(nullable NSData *)data receivedError:(nullable NSError *)receivedError { if ([response isKindOfClass:[NSHTTPURLResponse class]]) { @@ -209,10 +209,10 @@ - (nullable NSError*)handleRestartResponse:(nonnull NSURLResponse *)response return [IRIrohaContainer errorForMessage:@"Unexpected response received during restart"]; } -- (nullable NSString*)handleTaskPreparationResponse:(nonnull NSURLResponse *)response +- (nullable NSString *)handleTaskPreparationResponse:(nonnull NSURLResponse *)response data:(nullable NSData *)data receivedError:(nullable NSError *)receivedError - resultError:(NSError*_Nullable*_Nullable)resultError { + resultError:(NSError *_Nullable*_Nullable)resultError { if (data) { NSDictionary *result = [NSJSONSerialization JSONObjectWithData:data options:0 @@ -239,7 +239,7 @@ - (nullable NSString*)handleTaskPreparationResponse:(nonnull NSURLResponse *)res } } -- (nullable NSError*)handleTaskExecutionResponse:(nonnull NSURLResponse *)response +- (nullable NSError *)handleTaskExecutionResponse:(nonnull NSURLResponse *)response data:(nullable NSData *)data receivedError:(nullable NSError *)receivedError { if ([response isKindOfClass:[NSHTTPURLResponse class]]) { @@ -268,7 +268,7 @@ - (nullable NSError*)handleTaskExecutionResponse:(nonnull NSURLResponse *)respon return [IRIrohaContainer errorForMessage:@"Unexpected response received on try to run iroha daemon"]; } -- (nullable NSError*)handleStopResponse:(nonnull NSURLResponse *)response +- (nullable NSError *)handleStopResponse:(nonnull NSURLResponse *)response data:(nullable NSData *)data receivedError:(nullable NSError *)receivedError { if ([response isKindOfClass:[NSHTTPURLResponse class]]) { @@ -312,7 +312,7 @@ - (BOOL)checkConnectivity { dispatch_semaphore_signal(semaphore); return nil; - }).onError(^IRPromise * _Nullable(NSError* error) { + }).onError(^IRPromise * _Nullable(NSError * error) { dispatch_semaphore_signal(semaphore); return nil; @@ -325,7 +325,7 @@ - (BOOL)checkConnectivity { #pragma mark - Helper -+ (nonnull NSError *)errorForMessage:(nonnull NSString*)message { ++ (nonnull NSError *)errorForMessage:(nonnull NSString *)message { NSString *domain = [NSString stringWithFormat:@"co.jp.soramitsu.iroha.%@", NSStringFromClass([IRIrohaContainer class])]; return [NSError errorWithDomain:domain code:0 diff --git a/IntegrationTests/Scenarious/IRAccountRestoreWithBatchTest.m b/IntegrationTests/Scenarious/IRAccountRestoreWithBatchTest.m index b5fa6f5dd..1bb4035d3 100644 --- a/IntegrationTests/Scenarious/IRAccountRestoreWithBatchTest.m +++ b/IntegrationTests/Scenarious/IRAccountRestoreWithBatchTest.m @@ -8,15 +8,15 @@ @interface IRAccountRestoreWithBatchTest : IRBaseIrohaContainerTests -@property(strong, nonatomic)id userRole; -@property(strong, nonatomic)id bankDomain; -@property(strong, nonatomic)id recoveryDomain; -@property(strong, nonatomic)id recoveryAccount; -@property(strong, nonatomic)id recoveryKeypair; -@property(strong, nonatomic)id recoverySigner; -@property(strong, nonatomic)id clientAccount; -@property(strong, nonatomic)id clientKeypair; -@property(strong, nonatomic)id clientSigner; +@property (strong, nonatomic) id userRole; +@property (strong, nonatomic) id bankDomain; +@property (strong, nonatomic) id recoveryDomain; +@property (strong, nonatomic) id recoveryAccount; +@property (strong, nonatomic) id recoveryKeypair; +@property (strong, nonatomic) id recoverySigner; +@property (strong, nonatomic) id clientAccount; +@property (strong, nonatomic) id clientKeypair; +@property (strong, nonatomic) id clientSigner; @end @@ -71,7 +71,7 @@ - (void)testAccountRestoreScenarioWithoutBatch { [expectation fulfill]; return nil; - }).onError(^IRPromise* _Nullable (NSError* error) { + }).onError(^IRPromise* _Nullable (NSError * error) { XCTFail(@"%@", error); [expectation fulfill]; @@ -105,7 +105,7 @@ - (void)testAccountRestoreScenarioWithBatch { [expectation fulfill]; return nil; - }).onError(^IRPromise* _Nullable (NSError* error) { + }).onError(^IRPromise* _Nullable (NSError * error) { XCTFail(@"%@", error); [expectation fulfill]; diff --git a/IntegrationTests/Scenarious/IRCreateAccountTest.m b/IntegrationTests/Scenarious/IRCreateAccountTest.m index ecdd49d27..3245e04c3 100755 --- a/IntegrationTests/Scenarious/IRCreateAccountTest.m +++ b/IntegrationTests/Scenarious/IRCreateAccountTest.m @@ -78,7 +78,7 @@ - (void)testCreateAccount { [expectation fulfill]; return nil; - }).onError(^IRPromise * _Nullable(NSError* error) { + }).onError(^IRPromise * _Nullable(NSError * error) { XCTFail(); NSLog(@"%@",error); diff --git a/IntegrationTests/Scenarious/IRCreateDomainTest.m b/IntegrationTests/Scenarious/IRCreateDomainTest.m index ea75ce59d..1e8b05924 100755 --- a/IntegrationTests/Scenarious/IRCreateDomainTest.m +++ b/IntegrationTests/Scenarious/IRCreateDomainTest.m @@ -46,7 +46,7 @@ - (void)testCreateDomain { }).onThen(^IRPromise * _Nullable(id result) { [expectation fulfill]; return nil; - }).onError(^IRPromise * _Nullable(NSError* error) { + }).onError(^IRPromise * _Nullable(NSError * error) { NSLog(@"%@", error); XCTFail(); diff --git a/IntegrationTests/Scenarious/IRCreateRoleTest.m b/IntegrationTests/Scenarious/IRCreateRoleTest.m index 4cc867778..f929673a7 100755 --- a/IntegrationTests/Scenarious/IRCreateRoleTest.m +++ b/IntegrationTests/Scenarious/IRCreateRoleTest.m @@ -63,7 +63,7 @@ - (void)testCreateRoleRejected { [expectation fulfill]; return nil; - }).onError(^IRPromise* _Nullable (NSError* error) { + }).onError(^IRPromise* _Nullable (NSError * error) { XCTFail(); NSLog(@"%@",error); diff --git a/IntegrationTests/Scenarious/IRGetAccountDetailTest.m b/IntegrationTests/Scenarious/IRGetAccountDetailTest.m index 9503d6bfc..93383b04d 100644 --- a/IntegrationTests/Scenarious/IRGetAccountDetailTest.m +++ b/IntegrationTests/Scenarious/IRGetAccountDetailTest.m @@ -105,7 +105,7 @@ - (void)testGetAccountDetailInSeveralPages { [expectation fulfill]; return nil; - }).onError(^IRPromise * _Nullable(NSError* error) { + }).onError(^IRPromise * _Nullable(NSError * error) { XCTFail(); NSLog(@"%@",error); diff --git a/IrohaCommunication/Classes/Private/Commands/IRAddAssetQuantity.m b/IrohaCommunication/Classes/Private/Commands/IRAddAssetQuantity.m index edd5e9395..c8230b417 100755 --- a/IrohaCommunication/Classes/Private/Commands/IRAddAssetQuantity.m +++ b/IrohaCommunication/Classes/Private/Commands/IRAddAssetQuantity.m @@ -22,7 +22,7 @@ - (nonnull instancetype)initWithAssetId:(nonnull id)assetId #pragma mark - Protobuf Transformable -- (nullable id)transform:(NSError**)error { +- (nullable id)transform:(NSError **)error { AddAssetQuantity *assetQuantity = [[AddAssetQuantity alloc] init]; assetQuantity.assetId = [_assetId identifier]; assetQuantity.amount = [_amount value]; diff --git a/IrohaCommunication/Classes/Private/Commands/IRSetAccountDetail.h b/IrohaCommunication/Classes/Private/Commands/IRSetAccountDetail.h index 35d65ed38..6d8ee3308 100755 --- a/IrohaCommunication/Classes/Private/Commands/IRSetAccountDetail.h +++ b/IrohaCommunication/Classes/Private/Commands/IRSetAccountDetail.h @@ -10,7 +10,7 @@ @interface IRSetAccountDetail : NSObject - (nonnull instancetype)initWithAccountId:(nonnull id)accountId - key:(nonnull NSString*)key - value:(nonnull NSString*)value; + key:(nonnull NSString *)key + value:(nonnull NSString *)value; @end diff --git a/IrohaCommunication/Classes/Private/Commands/IRSetAccountDetail.m b/IrohaCommunication/Classes/Private/Commands/IRSetAccountDetail.m index cc605c578..6d78af59b 100755 --- a/IrohaCommunication/Classes/Private/Commands/IRSetAccountDetail.m +++ b/IrohaCommunication/Classes/Private/Commands/IRSetAccountDetail.m @@ -12,8 +12,8 @@ @implementation IRSetAccountDetail @synthesize value = _value; - (nonnull instancetype)initWithAccountId:(nonnull id)accountId - key:(nonnull NSString*)key - value:(nonnull NSString*)value { + key:(nonnull NSString *)key + value:(nonnull NSString *)value { if (self = [super init]) { _accountId = accountId; diff --git a/IrohaCommunication/Classes/Private/Commands/IRTransferAsset.h b/IrohaCommunication/Classes/Private/Commands/IRTransferAsset.h index abcdcd7fd..f3ddb0ded 100755 --- a/IrohaCommunication/Classes/Private/Commands/IRTransferAsset.h +++ b/IrohaCommunication/Classes/Private/Commands/IRTransferAsset.h @@ -12,7 +12,7 @@ - (nonnull instancetype)initWithSourceAccountId:(nonnull id)sourceAccountId destinationAccountId:(nonnull id)destinationAccountId assetId:(nonnull id)assetId - transferDescription:(nonnull NSString*)transferDescription + transferDescription:(nonnull NSString *)transferDescription amount:(nonnull id)amount; @end diff --git a/IrohaCommunication/Classes/Private/Commands/IRTransferAsset.m b/IrohaCommunication/Classes/Private/Commands/IRTransferAsset.m index 6a0150294..d7acaeb87 100755 --- a/IrohaCommunication/Classes/Private/Commands/IRTransferAsset.m +++ b/IrohaCommunication/Classes/Private/Commands/IRTransferAsset.m @@ -16,7 +16,7 @@ @implementation IRTransferAsset - (nonnull instancetype)initWithSourceAccountId:(nonnull id)sourceAccountId destinationAccountId:(nonnull id)destinationAccountId assetId:(nonnull id)assetId - transferDescription:(nonnull NSString*)transferDescription + transferDescription:(nonnull NSString *)transferDescription amount:(nonnull id)amount { if (self = [super init]) { diff --git a/IrohaCommunication/Classes/Private/IRBlockQueryRequestImpl.h b/IrohaCommunication/Classes/Private/IRBlockQueryRequestImpl.h index ecce1cfc0..3c3ee2002 100755 --- a/IrohaCommunication/Classes/Private/IRBlockQueryRequestImpl.h +++ b/IrohaCommunication/Classes/Private/IRBlockQueryRequestImpl.h @@ -15,7 +15,7 @@ typedef NS_ENUM(NSUInteger, IRQueryRequestError) { @interface IRBlockQueryRequest : NSObject - (nonnull instancetype)initWithCreator:(nonnull id)creator - createdAt:(nonnull NSDate*)createdAt + createdAt:(nonnull NSDate *)createdAt queryCounter:(UInt64)queryCounter peerSignature:(nullable id)peerSignature; diff --git a/IrohaCommunication/Classes/Private/IRBlockQueryRequestImpl.m b/IrohaCommunication/Classes/Private/IRBlockQueryRequestImpl.m index 240e510cb..c8ebadc63 100755 --- a/IrohaCommunication/Classes/Private/IRBlockQueryRequestImpl.m +++ b/IrohaCommunication/Classes/Private/IRBlockQueryRequestImpl.m @@ -17,7 +17,7 @@ @implementation IRBlockQueryRequest @synthesize peerSignature = _peerSignature; - (nonnull instancetype)initWithCreator:(nonnull id)creator - createdAt:(nonnull NSDate*)createdAt + createdAt:(nonnull NSDate *)createdAt queryCounter:(UInt64)queryCounter peerSignature:(nullable id)peerSignature { @@ -35,7 +35,7 @@ - (nonnull instancetype)initWithCreator:(nonnull id)creator - (nullable instancetype)signedWithSignatory:(nonnull id)signatory signatoryPublicKey:(nonnull id)signatoryPublicKey - error:(NSError**)error { + error:(NSError **)error { id peerSignature = [self signWithSignatory:signatory signatoryPublicKey:signatoryPublicKey @@ -78,7 +78,7 @@ - (nullable instancetype)signedWithSignatory:(nonnull id)signPayload:(nonnull QueryPayloadMeta*)payload signatory:(nonnull id)signatory - error:(NSError**)error { + error:(NSError **)error { NSData *payloadData = [payload data]; if (!payloadData) { @@ -151,7 +151,7 @@ - (nullable QueryPayloadMeta*)createPayload:(NSError**)error { #pragma mark - Helpers -+ (nonnull NSError*)errorWithType:(IRQueryRequestError)errorType message:(nonnull NSString*)message { ++ (nonnull NSError *)errorWithType:(IRQueryRequestError)errorType message:(nonnull NSString *)message { return [NSError errorWithDomain:NSStringFromClass([IRBlockQueryRequest class]) code:errorType userInfo:@{NSLocalizedDescriptionKey: message}]; diff --git a/IrohaCommunication/Classes/Private/IRProtobufTransformable.h b/IrohaCommunication/Classes/Private/IRProtobufTransformable.h index b6005b41a..0209bb7d7 100755 --- a/IrohaCommunication/Classes/Private/IRProtobufTransformable.h +++ b/IrohaCommunication/Classes/Private/IRProtobufTransformable.h @@ -8,7 +8,7 @@ @protocol IRProtobufTransformable -- (nullable id)transform:(NSError*_Nullable*_Nullable)error; +- (nullable id)transform:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Private/IRQueryRequestImpl.h b/IrohaCommunication/Classes/Private/IRQueryRequestImpl.h index 660906962..f8e9a3315 100755 --- a/IrohaCommunication/Classes/Private/IRQueryRequestImpl.h +++ b/IrohaCommunication/Classes/Private/IRQueryRequestImpl.h @@ -15,7 +15,7 @@ typedef NS_ENUM(NSUInteger, IRQueryRequestError) { @interface IRQueryRequest : NSObject - (nonnull instancetype)initWithCreator:(nonnull id)creator - createdAt:(nonnull NSDate*)createdAt + createdAt:(nonnull NSDate *)createdAt query:(nonnull id)query queryCounter:(UInt64)queryCounter peerSignature:(nullable id)peerSignature; diff --git a/IrohaCommunication/Classes/Private/IRQueryRequestImpl.m b/IrohaCommunication/Classes/Private/IRQueryRequestImpl.m index b99ddf970..248c905a7 100755 --- a/IrohaCommunication/Classes/Private/IRQueryRequestImpl.m +++ b/IrohaCommunication/Classes/Private/IRQueryRequestImpl.m @@ -18,7 +18,7 @@ @implementation IRQueryRequest @synthesize peerSignature = _peerSignature; - (nonnull instancetype)initWithCreator:(nonnull id)creator - createdAt:(nonnull NSDate*)createdAt + createdAt:(nonnull NSDate *)createdAt query:(nonnull id)query queryCounter:(UInt64)queryCounter peerSignature:(nullable id)peerSignature { @@ -38,7 +38,7 @@ - (nonnull instancetype)initWithCreator:(nonnull id)creator - (nullable instancetype)signedWithSignatory:(nonnull id)signatory signatoryPublicKey:(nonnull id)signatoryPublicKey - error:(NSError**)error { + error:(NSError **)error { id peerSignature = [self signWithSignatory:signatory signatoryPublicKey:signatoryPublicKey @@ -82,7 +82,7 @@ - (nullable instancetype)signedWithSignatory:(nonnull id)signPayload:(nonnull Query_Payload*)payload signatory:(nonnull id)signatory - error:(NSError**)error { + error:(NSError **)error { NSData *payloadData = [payload data]; if (!payloadData) { @@ -175,7 +175,7 @@ - (nullable Query_Payload*)createPayload:(NSError**)error { #pragma mark - Helpers -+ (nonnull NSError*)errorWithType:(IRQueryRequestError)errorType message:(nonnull NSString*)message { ++ (nonnull NSError *)errorWithType:(IRQueryRequestError)errorType message:(nonnull NSString *)message { return [NSError errorWithDomain:NSStringFromClass([IRQueryRequest class]) code:errorType userInfo:@{NSLocalizedDescriptionKey: message}]; diff --git a/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.h b/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.h index 0ef7b68e2..c5b157e47 100755 --- a/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.h +++ b/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.h @@ -18,6 +18,6 @@ typedef NS_ENUM(NSUInteger, IRQueryResponseFactoryError) { @interface IRQueryResponseProtoFactory : NSObject + (nullable id)responseFromProtobuf:(nonnull QueryResponse*)pbResponse - error:(NSError*_Nullable*_Nullable)error; + error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m b/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m index 97c225d14..a44fbb098 100755 --- a/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m +++ b/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m @@ -13,7 +13,7 @@ @implementation IRQueryResponseProtoFactory + (nullable id)responseFromProtobuf:(nonnull QueryResponse*)pbResponse - error:(NSError*_Nullable*_Nullable)error { + error:(NSError *_Nullable*_Nullable)error { if (!pbResponse.queryHash) { if (error) { @@ -108,7 +108,7 @@ @implementation IRQueryResponseProtoFactory #pragma mark - Responses + (nullable id)assetResponseFromProtobuf:(nonnull AssetResponse*)pbResponse - queryHash:(nonnull NSData*)queryHash + queryHash:(nonnull NSData *)queryHash error:(NSError **)error { id assetId = [IRAssetIdFactory assetWithIdentifier:pbResponse.asset.assetId error:error]; @@ -123,8 +123,8 @@ @implementation IRQueryResponseProtoFactory } + (nullable id)accountResponseFromProtobuf:(nonnull AccountResponse*)pbResponse - queryHash:(nonnull NSData*)queryHash - error:(NSError**)error { + queryHash:(nonnull NSData *)queryHash + error:(NSError **)error { id accountId = [IRAccountIdFactory accountWithIdentifier:pbResponse.account.accountId error:error]; @@ -153,8 +153,8 @@ @implementation IRQueryResponseProtoFactory } + (nullable id)errorResponseFromProtobuf:(nonnull ErrorResponse*)pbResponse - queryHash:(nonnull NSData*)queryHash - error:(NSError**)error { + queryHash:(nonnull NSData *)queryHash + error:(NSError **)error { IRErrorResponseReason reason; @@ -206,8 +206,8 @@ @implementation IRQueryResponseProtoFactory } + (nullable id)rolesResponseFromPbResponse:(nonnull RolesResponse*)pbResponse - queryHash:(nonnull NSData*)queryHash - error:(NSError**)error { + queryHash:(nonnull NSData *)queryHash + error:(NSError **)error { NSMutableArray> *roles = [NSMutableArray array]; @@ -227,8 +227,8 @@ @implementation IRQueryResponseProtoFactory } + (nullable id)signatoriesResponseFromPbResponse:(nonnull SignatoriesResponse*)pbResponse - queryHash:(nonnull NSData*)queryHash - error:(NSError**)error { + queryHash:(nonnull NSData *)queryHash + error:(NSError **)error { NSMutableArray> *publicKeys = [NSMutableArray array]; @@ -265,8 +265,8 @@ @implementation IRQueryResponseProtoFactory } + (nullable id)transactionsResponseFromPbResponse:(nonnull TransactionsResponse*)pbResponse - queryHash:(nonnull NSData*)queryHash - error:(NSError**)error { + queryHash:(nonnull NSData *)queryHash + error:(NSError **)error { NSArray> *transactions = [self transactionsFromPbTransactions:pbResponse.transactionsArray error:error]; @@ -280,8 +280,8 @@ @implementation IRQueryResponseProtoFactory } + (nullable id)accountAssetsResponseFromPbResponse:(nonnull AccountAssetResponse*)pbResponse - queryHash:(nonnull NSData*)queryHash - error:(NSError**)error { + queryHash:(nonnull NSData *)queryHash + error:(NSError **)error { NSMutableArray> *accountAssets = [NSMutableArray array]; @@ -322,7 +322,7 @@ @implementation IRQueryResponseProtoFactory id nextAssetId = nil; if (pbResponse.nextAssetId && pbResponse.nextAssetId.length > 0) { - NSError* error = nil; + NSError * error = nil; nextAssetId = [IRAssetIdFactory assetWithIdentifier: pbResponse.nextAssetId error:&error]; if (error) { @@ -337,8 +337,8 @@ @implementation IRQueryResponseProtoFactory } + (nullable id)accountDetailResponseFromPbResponse:(nonnull AccountDetailResponse*)pbResponse - queryHash:(nonnull NSData*)queryHash - error:(NSError**)error { + queryHash:(nonnull NSData *)queryHash + error:(NSError **)error { NSString *detail = pbResponse.detail ? pbResponse.detail : @""; @@ -356,8 +356,8 @@ @implementation IRQueryResponseProtoFactory } + (nullable id)rolePermissionsResponseFromPbResponse:(nonnull RolePermissionsResponse*)pbResponse - queryHash:(nonnull NSData*)queryHash - error:(NSError**)error { + queryHash:(nonnull NSData *)queryHash + error:(NSError **)error { NSMutableArray>* permissions = [NSMutableArray array]; for (NSUInteger i = 0; i < pbResponse.permissionsArray.count; i++) { id permission = [IRRolePermissionFactory permissionWithValue:[pbResponse.permissionsArray valueAtIndex:i] @@ -375,8 +375,8 @@ @implementation IRQueryResponseProtoFactory } + (nullable id)transactionPageResponseFromPbResponse:(nonnull TransactionsPageResponse*)pbResponse - queryHash:(nonnull NSData*)queryHash - error:(NSError**)error { + queryHash:(nonnull NSData *)queryHash + error:(NSError **)error { NSArray> *transactions = [self transactionsFromPbTransactions:pbResponse.transactionsArray error:error]; @@ -409,7 +409,7 @@ @implementation IRQueryResponseProtoFactory } + (nullable NSArray>*)transactionsFromPbTransactions:(nonnull NSArray*)pbTransactions - error:(NSError**)error { + error:(NSError **)error { NSMutableArray> *transactions = [NSMutableArray array]; @@ -428,8 +428,8 @@ @implementation IRQueryResponseProtoFactory } + (nullable id)peersResponseFromPbResponse:(nonnull PeersResponse*)pbResponse - queryHash:(nonnull NSData*)queryHash - error:(NSError**)error { + queryHash:(nonnull NSData *)queryHash + error:(NSError **)error { NSMutableArray> *peers = [NSMutableArray array]; for (Peer *pbPeer in pbResponse.peersArray) { diff --git a/IrohaCommunication/Classes/Private/IRTransactionImpl+Proto.h b/IrohaCommunication/Classes/Private/IRTransactionImpl+Proto.h index 18ecf182b..a8abc9040 100755 --- a/IrohaCommunication/Classes/Private/IRTransactionImpl+Proto.h +++ b/IrohaCommunication/Classes/Private/IRTransactionImpl+Proto.h @@ -14,6 +14,6 @@ typedef NS_ENUM(NSUInteger, IRTransactionProtoError) { @interface IRTransaction(Proto) + (nullable IRTransaction*)transactionFromPbTransaction:(nonnull Transaction*)pbTransaction - error:(NSError*_Nullable*_Nullable)error; + error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Private/IRTransactionImpl+Proto.m b/IrohaCommunication/Classes/Private/IRTransactionImpl+Proto.m index f37fce2f4..15e5bd7d3 100755 --- a/IrohaCommunication/Classes/Private/IRTransactionImpl+Proto.m +++ b/IrohaCommunication/Classes/Private/IRTransactionImpl+Proto.m @@ -13,7 +13,7 @@ @implementation IRTransaction(Proto) + (nullable IRTransaction*)transactionFromPbTransaction:(nonnull Transaction*)pbTransaction - error:(NSError*_Nullable*_Nullable)error { + error:(NSError *_Nullable*_Nullable)error { NSMutableArray> *signatures = [NSMutableArray array]; for (Signature *pbSignature in pbTransaction.signaturesArray) { @@ -67,7 +67,7 @@ + (nullable IRTransaction*)transactionFromPbTransaction:(nonnull Transaction*)pb [commands addObject:command]; } - NSMutableArray *batchHashes = [NSMutableArray array]; + NSMutableArray *batchHashes = [NSMutableArray array]; IRTransactionBatchType batchType = IRTransactionBatchTypeNone; if (pbTransaction.payload.optionalBatchMetaOneOfCase == Transaction_Payload_OptionalBatchMeta_OneOfCase_Batch) { diff --git a/IrohaCommunication/Classes/Private/IRTransactionImpl.h b/IrohaCommunication/Classes/Private/IRTransactionImpl.h index 07d972872..ca54d12dc 100755 --- a/IrohaCommunication/Classes/Private/IRTransactionImpl.h +++ b/IrohaCommunication/Classes/Private/IRTransactionImpl.h @@ -17,11 +17,11 @@ typedef NS_ENUM(NSUInteger, IRTransactionError) { @interface IRTransaction : NSObject - (nonnull instancetype)initWithCreatorAccountId:(nonnull id)creatorAccountId - createdAt:(nonnull NSDate*)createdAt + createdAt:(nonnull NSDate *)createdAt commands:(nonnull NSArray>*)commands quorum:(NSUInteger)quorum signatures:(nullable NSArray>*)signatures - batchHashes:(nullable NSArray*)batchHashes + batchHashes:(nullable NSArray*)batchHashes batchType:(IRTransactionBatchType)batchType; @end diff --git a/IrohaCommunication/Classes/Private/IRTransactionImpl.m b/IrohaCommunication/Classes/Private/IRTransactionImpl.m index 2465a8f18..72265bd8e 100755 --- a/IrohaCommunication/Classes/Private/IRTransactionImpl.m +++ b/IrohaCommunication/Classes/Private/IRTransactionImpl.m @@ -22,11 +22,11 @@ @implementation IRTransaction @synthesize batchType = _batchType; - (nonnull instancetype)initWithCreatorAccountId:(nonnull id)creatorAccountId - createdAt:(nonnull NSDate*)createdAt + createdAt:(nonnull NSDate *)createdAt commands:(nonnull NSArray>*)commands quorum:(NSUInteger)quorum signatures:(nullable NSArray>*)signatures - batchHashes:(nullable NSArray*)batchHashes + batchHashes:(nullable NSArray*)batchHashes batchType:(IRTransactionBatchType)batchType { if (self = [super init]) { @@ -44,7 +44,7 @@ - (nonnull instancetype)initWithCreatorAccountId:(nonnull id)creato #pragma mark - Protobuf Transformable -- (nullable id)transform:(NSError*_Nullable*_Nullable)error { +- (nullable id)transform:(NSError *_Nullable*_Nullable)error { Transaction_Payload *payload = [self createPayload:error]; if (!payload) { @@ -70,7 +70,7 @@ - (nullable id)transform:(NSError*_Nullable*_Nullable)error { #pragma mark - Signable -- (nullable NSData*)transactionHashWithError:(NSError **)error { +- (nullable NSData *)transactionHashWithError:(NSError **)error { Transaction_Payload *payload = [self createPayload:error]; if (!payload) { @@ -104,7 +104,7 @@ - (nullable NSData*)transactionHashWithError:(NSError **)error { - (nullable id)signWithSignatory:(nonnull id)signatory signatoryPublicKey:(nonnull id)signatoryPublicKey - error:(NSError**)error { + error:(NSError **)error { Transaction_Payload *payload = [self createPayload:error]; @@ -125,7 +125,7 @@ - (nullable NSData*)transactionHashWithError:(NSError **)error { - (nullable instancetype)signedWithSignatories:(nonnull NSArray>*)signatories signatoryPublicKeys:(nonnull NSArray> *)signatoryPublicKeys - error:(NSError**)error { + error:(NSError **)error { if ([signatories count] == 0) { if (error) { @@ -189,9 +189,9 @@ - (nullable instancetype)signedWithSignatories:(nonnull NSArray*)transactionBatchHashes +- (nullable instancetype)batched:(nullable NSArray*)transactionBatchHashes batchType:(IRTransactionBatchType)batchType - error:(NSError**)error { + error:(NSError **)error { if (batchType == IRTransactionBatchTypeNone) { return [[IRTransaction alloc] initWithCreatorAccountId:_creator @@ -221,7 +221,7 @@ - (nullable instancetype)batched:(nullable NSArray*)transactionBatchHas batchType:batchType]; } -- (nullable NSData*)batchHashWithError:(NSError **)error { +- (nullable NSData *)batchHashWithError:(NSError **)error { Transaction_Payload_ReducedPayload *reducedPayload = [self createReducedPayload:error]; if (!reducedPayload) { @@ -255,7 +255,7 @@ - (nullable NSData*)batchHashWithError:(NSError **)error { #pragma mark - Private -- (nullable Transaction_Payload_ReducedPayload*)createReducedPayload:(NSError**)error { +- (nullable Transaction_Payload_ReducedPayload*)createReducedPayload:(NSError **)error { NSMutableArray *protobufCommands = [NSMutableArray array]; for (id command in _commands) { @@ -297,7 +297,7 @@ - (nullable Transaction_Payload_ReducedPayload*)createReducedPayload:(NSError**) return reducedPayload; } -- (nullable Transaction_Payload*)createPayload:(NSError**)error { +- (nullable Transaction_Payload*)createPayload:(NSError **)error { Transaction_Payload_ReducedPayload *reducedPayload = [self createReducedPayload:error]; if (!reducedPayload) { @@ -324,7 +324,7 @@ - (nullable Transaction_Payload*)createPayload:(NSError**)error { Transaction_Payload_BatchMeta *pbBatchMeta = [[Transaction_Payload_BatchMeta alloc] init]; pbBatchMeta.type = pbBatchType; - NSMutableArray *pbReducedHashes = [NSMutableArray array]; + NSMutableArray *pbReducedHashes = [NSMutableArray array]; for (NSData *batchHash in _batchHashes) { [pbReducedHashes addObject:[batchHash toHexString]]; @@ -340,7 +340,7 @@ - (nullable Transaction_Payload*)createPayload:(NSError**)error { - (nullable id)signPayload:(nonnull Transaction_Payload*)payload signatory:(nonnull id)signatory - error:(NSError**)error { + error:(NSError **)error { NSData *payloadData = [payload data]; if (!payloadData) { @@ -379,7 +379,7 @@ - (nullable Transaction_Payload*)createPayload:(NSError**)error { #pragma mark - Helpers -+ (nonnull NSError*)errorWithType:(IRTransactionError)errorType message:(nonnull NSString*)message { ++ (nonnull NSError *)errorWithType:(IRTransactionError)errorType message:(nonnull NSString *)message { return [NSError errorWithDomain:NSStringFromClass([IRTransaction class]) code:errorType userInfo:@{NSLocalizedDescriptionKey: message}]; diff --git a/IrohaCommunication/Classes/Private/IRTransactionStatusResponseImpl.h b/IrohaCommunication/Classes/Private/IRTransactionStatusResponseImpl.h index f1f125379..2cf6f6e35 100755 --- a/IrohaCommunication/Classes/Private/IRTransactionStatusResponseImpl.h +++ b/IrohaCommunication/Classes/Private/IRTransactionStatusResponseImpl.h @@ -9,7 +9,7 @@ @interface IRTransactionStatusResponse : NSObject - (nonnull instancetype)initWithStatus:(IRTransactionStatus)status - transactionHash:(nonnull NSData*)transactionHash - description:(nullable NSString*)statusDescription; + transactionHash:(nonnull NSData *)transactionHash + description:(nullable NSString *)statusDescription; @end diff --git a/IrohaCommunication/Classes/Private/IRTransactionStatusResponseImpl.m b/IrohaCommunication/Classes/Private/IRTransactionStatusResponseImpl.m index 0d66e32f0..ec1dd743f 100755 --- a/IrohaCommunication/Classes/Private/IRTransactionStatusResponseImpl.m +++ b/IrohaCommunication/Classes/Private/IRTransactionStatusResponseImpl.m @@ -11,8 +11,8 @@ @implementation IRTransactionStatusResponse @synthesize statusDescription = _statusDescription; - (nonnull instancetype)initWithStatus:(IRTransactionStatus)status - transactionHash:(nonnull NSData*)transactionHash - description:(nullable NSString*)statusDescription { + transactionHash:(nonnull NSData *)transactionHash + description:(nullable NSString *)statusDescription { if (self = [super init]) { _status = status; diff --git a/IrohaCommunication/Classes/Private/Models/IRBlock+Proto.h b/IrohaCommunication/Classes/Private/Models/IRBlock+Proto.h index 7bc06f144..de7bc6fd8 100755 --- a/IrohaCommunication/Classes/Private/Models/IRBlock+Proto.h +++ b/IrohaCommunication/Classes/Private/Models/IRBlock+Proto.h @@ -13,6 +13,6 @@ typedef NS_ENUM(NSUInteger, IRBlockProtoError) { @interface IRBlock (Proto) -+ (nullable id)blockFromPbBlock:(nonnull Block*)block error:(NSError*_Nullable*_Nullable)error; ++ (nullable id)blockFromPbBlock:(nonnull Block*)block error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Private/Models/IRBlock+Proto.m b/IrohaCommunication/Classes/Private/Models/IRBlock+Proto.m index 74769da18..9405c8c04 100755 --- a/IrohaCommunication/Classes/Private/Models/IRBlock+Proto.m +++ b/IrohaCommunication/Classes/Private/Models/IRBlock+Proto.m @@ -13,7 +13,7 @@ @implementation IRBlock (Proto) -+ (nullable id)blockFromPbBlock:(nonnull Block*)block error:(NSError*_Nullable*_Nullable)error { ++ (nullable id)blockFromPbBlock:(nonnull Block*)block error:(NSError *_Nullable*_Nullable)error { if (!block.blockV1) { if (error) { *error = [IRBlock errorWithMessage:@"Versioned block expected but nil found."]; @@ -58,7 +58,7 @@ @implementation IRBlock (Proto) NSDate *createdAt = [NSDate dateWithTimestampInMilliseconds:block.blockV1.payload.createdTime]; - NSMutableArray *rejectedHashes = [NSMutableArray array]; + NSMutableArray *rejectedHashes = [NSMutableArray array]; if (!block.blockV1.payload.rejectedTransactionsHashesArray) { if (error) { @@ -101,7 +101,7 @@ @implementation IRBlock (Proto) #pragma mark - Helper -+ (nonnull NSError*)errorWithMessage:(NSString*)message { ++ (nonnull NSError *)errorWithMessage:(NSString *)message { return [NSError errorWithDomain:NSStringFromClass([IRBlock class]) code:IRBlockProtoErrorInvalidField userInfo:@{NSLocalizedDescriptionKey: message}]; diff --git a/IrohaCommunication/Classes/Private/Models/IRBlockImpl.h b/IrohaCommunication/Classes/Private/Models/IRBlockImpl.h index c06f563f6..1ee1834fb 100755 --- a/IrohaCommunication/Classes/Private/Models/IRBlockImpl.h +++ b/IrohaCommunication/Classes/Private/Models/IRBlockImpl.h @@ -9,10 +9,10 @@ @interface IRBlock : NSObject - (nonnull instancetype)initWithHeight:(UInt64)height - previousBlockHash:(nullable NSData*)previousBlockHash - createdAt:(nonnull NSDate*)createdAt + previousBlockHash:(nullable NSData *)previousBlockHash + createdAt:(nonnull NSDate *)createdAt transactions:(nonnull NSArray*)transactions - rejectedTransactionHashes:(nonnull NSArray*)rejectedTransactionHashes + rejectedTransactionHashes:(nonnull NSArray*)rejectedTransactionHashes peerSignatures:(nonnull NSArray>*)peerSignatures; @end diff --git a/IrohaCommunication/Classes/Private/Models/IRBlockImpl.m b/IrohaCommunication/Classes/Private/Models/IRBlockImpl.m index 3f5f16e98..763725642 100755 --- a/IrohaCommunication/Classes/Private/Models/IRBlockImpl.m +++ b/IrohaCommunication/Classes/Private/Models/IRBlockImpl.m @@ -14,10 +14,10 @@ @implementation IRBlock @synthesize peerSignatures = _peerSignatures; - (nonnull instancetype)initWithHeight:(UInt64)height - previousBlockHash:(nullable NSData*)previousBlockHash - createdAt:(nonnull NSDate*)createdAt + previousBlockHash:(nullable NSData *)previousBlockHash + createdAt:(nonnull NSDate *)createdAt transactions:(nonnull NSArray*)transactions - rejectedTransactionHashes:(nonnull NSArray*)rejectedTransactionHashes + rejectedTransactionHashes:(nonnull NSArray*)rejectedTransactionHashes peerSignatures:(nonnull NSArray>*)peerSignatures { if (self = [super init]) { _height = height; diff --git a/IrohaCommunication/Classes/Private/Models/IRCommand+Proto.h b/IrohaCommunication/Classes/Private/Models/IRCommand+Proto.h index 565e93a0e..060507149 100755 --- a/IrohaCommunication/Classes/Private/Models/IRCommand+Proto.h +++ b/IrohaCommunication/Classes/Private/Models/IRCommand+Proto.h @@ -15,6 +15,6 @@ typedef NS_ENUM(NSUInteger, IRCommandProtoFactoryError){ @interface IRCommandProtoFactory : NSObject + (nullable id)commandFromPbCommand:(nonnull Command*)command - error:(NSError*_Nullable*_Nullable)error; + error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Private/Models/IRCommand+Proto.m b/IrohaCommunication/Classes/Private/Models/IRCommand+Proto.m index f55f065c3..f28c94516 100755 --- a/IrohaCommunication/Classes/Private/Models/IRCommand+Proto.m +++ b/IrohaCommunication/Classes/Private/Models/IRCommand+Proto.m @@ -11,7 +11,7 @@ @implementation IRCommandProtoFactory + (nullable id)commandFromPbCommand:(nonnull Command*)command - error:(NSError*_Nullable*_Nullable)error { + error:(NSError *_Nullable*_Nullable)error { switch (command.commandOneOfCase) { case Command_Command_OneOfCase_AddPeer: return [self addPeerCommandFromPbCommand:command.addPeer @@ -96,7 +96,7 @@ @implementation IRCommandProtoFactory } + (nullable id)addPeerCommandFromPbCommand:(nonnull AddPeer*)pbCommand - error:(NSError*_Nullable*_Nullable)error { + error:(NSError *_Nullable*_Nullable)error { id address = [IRAddressFactory addressWithValue:pbCommand.peer.address error:error]; @@ -129,7 +129,7 @@ @implementation IRCommandProtoFactory } + (nullable id)appendRoleCommandFromPbCommand:(nonnull AppendRole*)pbCommand - error:(NSError**)error { + error:(NSError **)error { id accountId = [IRAccountIdFactory accountWithIdentifier:pbCommand.accountId error:error]; if (!accountId) { @@ -147,7 +147,7 @@ @implementation IRCommandProtoFactory roleName:roleName]; } -+ (nullable id)createRoleCommandFromPbCommand:(nonnull CreateRole*)pbCommand error:(NSError**)error { ++ (nullable id)createRoleCommandFromPbCommand:(nonnull CreateRole*)pbCommand error:(NSError **)error { id roleName = [IRRoleNameFactory roleWithName:pbCommand.roleName error:error]; @@ -172,7 +172,7 @@ @implementation IRCommandProtoFactory permissions:permissions]; } -+ (nullable id)detachRoleCommandFromPbCommand:(nonnull DetachRole*)pbCommand error:(NSError**)error { ++ (nullable id)detachRoleCommandFromPbCommand:(nonnull DetachRole*)pbCommand error:(NSError **)error { id accountId = [IRAccountIdFactory accountWithIdentifier:pbCommand.accountId error:error]; @@ -192,7 +192,7 @@ @implementation IRCommandProtoFactory } + (nullable id)createAssetCommandFromPbCommand:(nonnull CreateAsset*)pbCommand - error:(NSError**)error { + error:(NSError **)error { id domain = [IRDomainFactory domainWithIdentitifer:pbCommand.domainId error:error]; @@ -214,7 +214,7 @@ @implementation IRCommandProtoFactory } + (nullable id)addSignatoryCommandFromPbCommand:(nonnull AddSignatory*)pbCommand - error:(NSError**)error { + error:(NSError **)error { id accountId = [IRAccountIdFactory accountWithIdentifier:pbCommand.accountId error:error]; @@ -246,7 +246,7 @@ @implementation IRCommandProtoFactory publicKey:publicKey]; } -+ (nullable id)createDomainCommandFromPbCommand:(nonnull CreateDomain*)pbCommand error:(NSError**)error { ++ (nullable id)createDomainCommandFromPbCommand:(nonnull CreateDomain*)pbCommand error:(NSError **)error { id domain = [IRDomainFactory domainWithIdentitifer:pbCommand.domainId error:error]; @@ -269,7 +269,7 @@ @implementation IRCommandProtoFactory } + (nullable id)createAccountCommandFromPbCommand:(nonnull CreateAccount*)pbCommand - error:(NSError**)error { + error:(NSError **)error { id domain = [IRDomainFactory domainWithIdentitifer:pbCommand.domainId error:error]; @@ -306,7 +306,7 @@ @implementation IRCommandProtoFactory } + (nullable id)transferAssetCommandWithPbCommand:(nonnull TransferAsset*)pbCommand - error:(NSError**)error { + error:(NSError **)error { id sourceAccountId = [IRAccountIdFactory accountWithIdentifier:pbCommand.srcAccountId error:error]; @@ -345,7 +345,7 @@ @implementation IRCommandProtoFactory } + (nullable id)grantPermissionCommandFromPbCommand:(nonnull GrantPermission*)pbCommand - error:(NSError**)error { + error:(NSError **)error { id accountId = [IRAccountIdFactory accountWithIdentifier:pbCommand.accountId error:error]; @@ -365,7 +365,7 @@ @implementation IRCommandProtoFactory } + (nullable id)removeSignatoryCommandFromPbCommand:(nonnull RemoveSignatory*)pbCommand - error:(NSError**)error { + error:(NSError **)error { id accountId = [IRAccountIdFactory accountWithIdentifier:pbCommand.accountId error:error]; @@ -398,7 +398,7 @@ @implementation IRCommandProtoFactory } + (nullable id)addAssetQuantityCommandFromPbCommand:(nonnull AddAssetQuantity*)pbCommand - error:(NSError**)error { + error:(NSError **)error { id assetId = [IRAssetIdFactory assetWithIdentifier:pbCommand.assetId error:error]; @@ -418,7 +418,7 @@ @implementation IRCommandProtoFactory amount:amount]; } -+ (nullable id)revokePermissionCommandFromPbCommand:(nonnull RevokePermission*)pbCommand error:(NSError**)error { ++ (nullable id)revokePermissionCommandFromPbCommand:(nonnull RevokePermission*)pbCommand error:(NSError **)error { id accountId = [IRAccountIdFactory accountWithIdentifier:pbCommand.accountId error:error]; @@ -438,7 +438,7 @@ @implementation IRCommandProtoFactory } + (nullable id)setAccountDetailCommandFromPbCommand:(nonnull SetAccountDetail*)pbCommand - error:(NSError**)error { + error:(NSError **)error { id accountId = [IRAccountIdFactory accountWithIdentifier:pbCommand.accountId error:error]; @@ -453,7 +453,7 @@ @implementation IRCommandProtoFactory } + (nullable id)setAccountQuorumCommandPbCommand:(nonnull SetAccountQuorum*)pbCommand - error:(NSError**)error { + error:(NSError **)error { id accountId = [IRAccountIdFactory accountWithIdentifier:pbCommand.accountId error:error]; @@ -466,7 +466,7 @@ @implementation IRCommandProtoFactory quorum:pbCommand.quorum]; } -+ (nullable id)subtractAssetQuantityCommandFromPbCommand:(nonnull SubtractAssetQuantity*)pbCommand error:(NSError**)error { ++ (nullable id)subtractAssetQuantityCommandFromPbCommand:(nonnull SubtractAssetQuantity*)pbCommand error:(NSError **)error { id assetId = [IRAssetIdFactory assetWithIdentifier:pbCommand.assetId error:error]; @@ -524,7 +524,7 @@ @implementation IRCommandProtoFactory oldValue:pbCommand.oldValue]; } -+ (nullable id)createPublicKeyFromRawData:(nonnull NSData*)rawData error:(NSError**)error { ++ (nullable id)createPublicKeyFromRawData:(nonnull NSData *)rawData error:(NSError **)error { id publicKey = [[IREd25519PublicKey alloc] initWithRawData:rawData]; if (!publicKey) { diff --git a/IrohaCommunication/Classes/Private/Models/IRPeerSignature+Proto.h b/IrohaCommunication/Classes/Private/Models/IRPeerSignature+Proto.h index 4171f9a64..46d50c3e7 100755 --- a/IrohaCommunication/Classes/Private/Models/IRPeerSignature+Proto.h +++ b/IrohaCommunication/Classes/Private/Models/IRPeerSignature+Proto.h @@ -14,6 +14,6 @@ typedef NS_ENUM(NSUInteger, IRPeerSignatureFactoryProtoError) { @interface IRPeerSignatureFactory (Proto) + (nullable id)peerSignatureFromPbSignature:(nonnull Signature *)pbSignature - error:(NSError*_Nullable*_Nullable)error; + error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Private/Models/IRPeerSignature+Proto.m b/IrohaCommunication/Classes/Private/Models/IRPeerSignature+Proto.m index 3870e541c..4e6a2af6a 100755 --- a/IrohaCommunication/Classes/Private/Models/IRPeerSignature+Proto.m +++ b/IrohaCommunication/Classes/Private/Models/IRPeerSignature+Proto.m @@ -10,7 +10,7 @@ @implementation IRPeerSignatureFactory (Proto) + (nullable id)peerSignatureFromPbSignature:(nonnull Signature *)pbSignature - error:(NSError*_Nullable*_Nullable)error { + error:(NSError *_Nullable*_Nullable)error { NSData *rawSignature = [[NSData alloc] initWithHexString:pbSignature.signature]; if (!rawSignature) { diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAccount.m b/IrohaCommunication/Classes/Private/Queries/IRGetAccount.m index e69035713..bbd9fe5f1 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAccount.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAccount.m @@ -19,7 +19,7 @@ - (nonnull instancetype)initWithAccountId:(nonnull id)accountId { #pragma mark - Protobuf Transformable -- (nullable id)transform:(NSError**)error { +- (nullable id)transform:(NSError **)error { GetAccount *query = [[GetAccount alloc] init]; query.accountId = [_accountId identifier]; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAccountAssetTransactions.m b/IrohaCommunication/Classes/Private/Queries/IRGetAccountAssetTransactions.m index 2211abd17..0067413be 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAccountAssetTransactions.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAccountAssetTransactions.m @@ -26,7 +26,7 @@ - (nonnull instancetype)initWithAccountId:(nonnull id)accountId #pragma mark - Protobuf Transformable -- (nullable id)transform:(NSError**)error { +- (nullable id)transform:(NSError **)error { GetAccountAssetTransactions *query = [[GetAccountAssetTransactions alloc] init]; query.accountId = [_accountId identifier]; query.assetId = [_assetId identifier]; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAccountAssets.m b/IrohaCommunication/Classes/Private/Queries/IRGetAccountAssets.m index 355090d06..cc35f74b5 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAccountAssets.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAccountAssets.m @@ -22,7 +22,7 @@ - (nonnull instancetype)initWithAccountId:(nonnull id)accountId #pragma mark - Protobuf Transformable -- (nullable id)transform:(NSError**)error { +- (nullable id)transform:(NSError **)error { GetAccountAssets *query = [[GetAccountAssets alloc] init]; query.accountId = [_accountId identifier]; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h index ae8f8d973..98bac944a 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h @@ -11,7 +11,7 @@ - (nonnull instancetype)initWithAccountId:(nullable id)accountId writer:(nullable id)writer - key:(nullable NSString*)key; + key:(nullable NSString *)key; - (nonnull instancetype)initWithPagination:(nonnull id)pagination; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m index 109f836f6..cc2a1ad70 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m @@ -16,7 +16,7 @@ @implementation IRGetAccountDetail - (nonnull instancetype)initWithAccountId:(nullable id)accountId writer:(nullable id)writer - key:(nullable NSString*)key { + key:(nullable NSString *)key { if (self = [super init]) { _accountId = accountId; _writer = writer; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAccountTransactions.m b/IrohaCommunication/Classes/Private/Queries/IRGetAccountTransactions.m index 0dc40d661..0e86d354e 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAccountTransactions.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAccountTransactions.m @@ -23,7 +23,7 @@ - (nonnull instancetype)initWithAccountId:(nonnull id)accountId #pragma mark - Protobuf Transformable -- (nullable id)transform:(NSError**)error { +- (nullable id)transform:(NSError **)error { GetAccountTransactions *query = [[GetAccountTransactions alloc] init]; query.accountId = [_accountId identifier]; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAssetInfo.m b/IrohaCommunication/Classes/Private/Queries/IRGetAssetInfo.m index bfe487448..ad8677ade 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAssetInfo.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAssetInfo.m @@ -19,7 +19,7 @@ - (nonnull instancetype)initWithAssetId:(nonnull id)assetId { #pragma mark - Protobuf Transformable -- (nullable id)transform:(NSError**)error { +- (nullable id)transform:(NSError **)error { GetAssetInfo *query = [[GetAssetInfo alloc] init]; query.assetId = [_assetId identifier]; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetPeers.m b/IrohaCommunication/Classes/Private/Queries/IRGetPeers.m index 63db0279a..76b8405d7 100644 --- a/IrohaCommunication/Classes/Private/Queries/IRGetPeers.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetPeers.m @@ -11,7 +11,7 @@ @implementation IRGetPeers #pragma mark - Protobuf Transformable -- (nullable id)transform:(NSError**)error { +- (nullable id)transform:(NSError **)error { GetPeers *query = [GetPeers new]; Query_Payload *payload = [[Query_Payload alloc] init]; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetPendingTransactions.m b/IrohaCommunication/Classes/Private/Queries/IRGetPendingTransactions.m index 17a2b4309..3636bc364 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetPendingTransactions.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetPendingTransactions.m @@ -10,7 +10,7 @@ @implementation IRGetPendingTransactions #pragma mark - Protobuf Transformable -- (nullable id)transform:(NSError**)error { +- (nullable id)transform:(NSError **)error { GetPendingTransactions *query = [[GetPendingTransactions alloc] init]; Query_Payload *payload = [[Query_Payload alloc] init]; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetRolePermissions.m b/IrohaCommunication/Classes/Private/Queries/IRGetRolePermissions.m index 6d12521ab..9fd8304d8 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetRolePermissions.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetRolePermissions.m @@ -19,7 +19,7 @@ - (nonnull instancetype)initWithRoleName:(nonnull id)roleName { #pragma mark - Protobuf Transformable -- (nullable id)transform:(NSError**)error { +- (nullable id)transform:(NSError **)error { GetRolePermissions *query = [[GetRolePermissions alloc] init]; query.roleId = [_roleName value]; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetRoles.m b/IrohaCommunication/Classes/Private/Queries/IRGetRoles.m index d6547098c..7fab0df48 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetRoles.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetRoles.m @@ -10,7 +10,7 @@ @implementation IRGetRoles #pragma mark - Protobuf Transformable -- (nullable id)transform:(NSError**)error { +- (nullable id)transform:(NSError **)error { GetRoles *query = [[GetRoles alloc] init]; Query_Payload *payload = [[Query_Payload alloc] init]; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetSignatories.m b/IrohaCommunication/Classes/Private/Queries/IRGetSignatories.m index bb82416a9..8c0160d3b 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetSignatories.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetSignatories.m @@ -19,7 +19,7 @@ - (nonnull instancetype)initWithAccountId:(nonnull id)accountId { #pragma mark - Protobuf Transformable -- (nullable id)transform:(NSError**)error { +- (nullable id)transform:(NSError **)error { GetSignatories *query = [[GetSignatories alloc] init]; query.accountId = [_accountId identifier]; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetTransactions.h b/IrohaCommunication/Classes/Private/Queries/IRGetTransactions.h index e1e76dff8..b1620b6dd 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetTransactions.h +++ b/IrohaCommunication/Classes/Private/Queries/IRGetTransactions.h @@ -9,6 +9,6 @@ @interface IRGetTransactions : NSObject -- (nonnull instancetype)initWithTransactionHashes:(nonnull NSArray *)hashes; +- (nonnull instancetype)initWithTransactionHashes:(nonnull NSArray *)hashes; @end diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetTransactions.m b/IrohaCommunication/Classes/Private/Queries/IRGetTransactions.m index 2c936bf6e..0ac6622e1 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetTransactions.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetTransactions.m @@ -10,7 +10,7 @@ @implementation IRGetTransactions @synthesize transactionHashes = _transactionHashes; -- (nonnull instancetype)initWithTransactionHashes:(nonnull NSArray *)hashes { +- (nonnull instancetype)initWithTransactionHashes:(nonnull NSArray *)hashes { if (self = [super init]) { _transactionHashes = hashes; } @@ -20,10 +20,10 @@ - (nonnull instancetype)initWithTransactionHashes:(nonnull NSArray *)ha #pragma mark - Protobuf Transformable -- (nullable id)transform:(NSError**)error { +- (nullable id)transform:(NSError **)error { GetTransactions *query = [[GetTransactions alloc] init]; - NSMutableArray *pbHashes = [NSMutableArray array]; + NSMutableArray *pbHashes = [NSMutableArray array]; for (NSData *transactionHash in _transactionHashes) { [pbHashes addObject:[transactionHash toHexString]]; diff --git a/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.h b/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.h index a44687423..b5cbe3b22 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.h +++ b/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.h @@ -11,6 +11,6 @@ - (nonnull instancetype)initWithAccountAssets:(nonnull NSArray>*)accountAssets totalCount:(UInt32)totalCount nextAssetId:(nullable id)assetId - queryHash:(nonnull NSData*)queryHash; + queryHash:(nonnull NSData *)queryHash; @end diff --git a/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.m b/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.m index 7b4bf10f7..99f456ea7 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.m +++ b/IrohaCommunication/Classes/Private/Responses/IRAccountAssetsResponse.m @@ -15,7 +15,7 @@ @implementation IRAccountAssetsResponse - (nonnull instancetype)initWithAccountAssets:(nonnull NSArray>*)accountAssets totalCount:(UInt32)totalCount nextAssetId:(nullable id)assetId - queryHash:(nonnull NSData*)queryHash { + queryHash:(nonnull NSData *)queryHash { if (self = [super init]) { _accountAssets = accountAssets; _totalCount = totalCount; diff --git a/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.h b/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.h index c3bfea1df..f04095f66 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.h +++ b/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.h @@ -9,9 +9,9 @@ @interface IRAccountDetailResponse : NSObject -- (nonnull instancetype)initWithDetail:(nonnull NSString*)detail +- (nonnull instancetype)initWithDetail:(nonnull NSString *)detail totalCount:(UInt64)totalCount nextRecordId:(nullable id)nextRecordId - queryHash:(nonnull NSData*)queryHash; + queryHash:(nonnull NSData *)queryHash; @end diff --git a/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.m b/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.m index 3b54d7977..440459b38 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.m +++ b/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.m @@ -12,10 +12,10 @@ @implementation IRAccountDetailResponse @synthesize totalCount = _totalCount; @synthesize nextRecordId = _nextRecordId; -- (nonnull instancetype)initWithDetail:(nonnull NSString*)detail +- (nonnull instancetype)initWithDetail:(nonnull NSString *)detail totalCount:(UInt64)totalCount nextRecordId:(nullable id)nextRecordId - queryHash:(nonnull NSData*)queryHash { + queryHash:(nonnull NSData *)queryHash { if (self = [super init]) { _detail = detail; _totalCount = totalCount; diff --git a/IrohaCommunication/Classes/Private/Responses/IRAccountResponse.h b/IrohaCommunication/Classes/Private/Responses/IRAccountResponse.h index 0e1f35bc7..effbae4b1 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRAccountResponse.h +++ b/IrohaCommunication/Classes/Private/Responses/IRAccountResponse.h @@ -10,8 +10,8 @@ - (nonnull instancetype)initWithAccountId:(nonnull id)accountId quorum:(UInt32)quorum - details:(nullable NSString*)details + details:(nullable NSString *)details roles:(nonnull NSArray>*)roles - queryHash:(nonnull NSData*)queryHash; + queryHash:(nonnull NSData *)queryHash; @end diff --git a/IrohaCommunication/Classes/Private/Responses/IRAccountResponse.m b/IrohaCommunication/Classes/Private/Responses/IRAccountResponse.m index 0d70d1280..1ecb67b67 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRAccountResponse.m +++ b/IrohaCommunication/Classes/Private/Responses/IRAccountResponse.m @@ -14,9 +14,9 @@ @implementation IRAccountResponse - (nonnull instancetype)initWithAccountId:(nonnull id)accountId quorum:(UInt32)quorum - details:(nullable NSString*)details + details:(nullable NSString *)details roles:(nonnull NSArray>*)roles - queryHash:(nonnull NSData*)queryHash { + queryHash:(nonnull NSData *)queryHash { if (self = [super init]) { _accountId = accountId; diff --git a/IrohaCommunication/Classes/Private/Responses/IRAssetResponse.h b/IrohaCommunication/Classes/Private/Responses/IRAssetResponse.h index ee44b3aa6..775f7cd8d 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRAssetResponse.h +++ b/IrohaCommunication/Classes/Private/Responses/IRAssetResponse.h @@ -10,6 +10,6 @@ - (nonnull instancetype)initWithAssetId:(nonnull id)assetId precision:(UInt32)precision - queryHash:(nonnull NSData*)queryHash; + queryHash:(nonnull NSData *)queryHash; @end diff --git a/IrohaCommunication/Classes/Private/Responses/IRAssetResponse.m b/IrohaCommunication/Classes/Private/Responses/IRAssetResponse.m index 68cd8527b..76ff1917d 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRAssetResponse.m +++ b/IrohaCommunication/Classes/Private/Responses/IRAssetResponse.m @@ -12,7 +12,7 @@ @implementation IRAssetResponse - (nonnull instancetype)initWithAssetId:(nonnull id)assetId precision:(UInt32)precision - queryHash:(nonnull NSData*)queryHash { + queryHash:(nonnull NSData *)queryHash { if (self = [super init]) { _assetId = assetId; diff --git a/IrohaCommunication/Classes/Private/Responses/IRBlockQueryResponse+Proto.h b/IrohaCommunication/Classes/Private/Responses/IRBlockQueryResponse+Proto.h index 57c669494..d20467a63 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRBlockQueryResponse+Proto.h +++ b/IrohaCommunication/Classes/Private/Responses/IRBlockQueryResponse+Proto.h @@ -14,6 +14,6 @@ typedef NS_ENUM(NSUInteger, IRBlockQueryResponseProtoError) { @interface IRBlockQueryResponse (Proto) + (nullable IRBlockQueryResponse*)responseFromPbResponse:(nonnull BlockQueryResponse*)queryResponse - error:(NSError*_Nullable*_Nullable)error; + error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Private/Responses/IRBlockQueryResponse+Proto.m b/IrohaCommunication/Classes/Private/Responses/IRBlockQueryResponse+Proto.m index 764e04364..9e9b18430 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRBlockQueryResponse+Proto.m +++ b/IrohaCommunication/Classes/Private/Responses/IRBlockQueryResponse+Proto.m @@ -10,7 +10,7 @@ @implementation IRBlockQueryResponse (Proto) + (nullable IRBlockQueryResponse*)responseFromPbResponse:(nonnull BlockQueryResponse*)queryResponse - error:(NSError*_Nullable*_Nullable)error { + error:(NSError *_Nullable*_Nullable)error { if (queryResponse.responseOneOfCase == BlockQueryResponse_Response_OneOfCase_BlockResponse) { Block *pbBlock = queryResponse.blockResponse.block; if (!pbBlock) { @@ -42,7 +42,7 @@ + (nullable IRBlockQueryResponse*)responseFromPbResponse:(nonnull BlockQueryResp #pragma mark - Helper -+ (nonnull NSError*)errorWithMessage:(NSString*)message { ++ (nonnull NSError *)errorWithMessage:(NSString *)message { return [NSError errorWithDomain:NSStringFromClass([IRBlockQueryResponse class]) code:IRBlockQueryResponseProtoErrorInvalidField userInfo:@{NSLocalizedDescriptionKey: message}]; diff --git a/IrohaCommunication/Classes/Private/Responses/IRBlockQueryResponseImpl.h b/IrohaCommunication/Classes/Private/Responses/IRBlockQueryResponseImpl.h index d7e0277e6..5ae67438f 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRBlockQueryResponseImpl.h +++ b/IrohaCommunication/Classes/Private/Responses/IRBlockQueryResponseImpl.h @@ -9,6 +9,6 @@ @interface IRBlockQueryResponse : NSObject - (nonnull instancetype)initWithBlock:(nonnull id)block; -- (nonnull instancetype)initWithError:(nonnull NSError*)error; +- (nonnull instancetype)initWithError:(nonnull NSError *)error; @end diff --git a/IrohaCommunication/Classes/Private/Responses/IRBlockQueryResponseImpl.m b/IrohaCommunication/Classes/Private/Responses/IRBlockQueryResponseImpl.m index b75ad77e9..44bf6741f 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRBlockQueryResponseImpl.m +++ b/IrohaCommunication/Classes/Private/Responses/IRBlockQueryResponseImpl.m @@ -17,7 +17,7 @@ - (nonnull instancetype)initWithBlock:(nonnull id)block { return self; } -- (nonnull instancetype)initWithError:(nonnull NSError*)error { +- (nonnull instancetype)initWithError:(nonnull NSError *)error { if (self = [super init]) { _error = error; } diff --git a/IrohaCommunication/Classes/Private/Responses/IRErrorResponse.h b/IrohaCommunication/Classes/Private/Responses/IRErrorResponse.h index 322d77608..10f13d965 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRErrorResponse.h +++ b/IrohaCommunication/Classes/Private/Responses/IRErrorResponse.h @@ -9,8 +9,8 @@ @interface IRErrorResponse : NSObject - (nonnull instancetype)initWithReason:(IRErrorResponseReason)reason - message:(nonnull NSString*)message + message:(nonnull NSString *)message code:(UInt32)code - queryHash:(nonnull NSData*)queryHash; + queryHash:(nonnull NSData *)queryHash; @end diff --git a/IrohaCommunication/Classes/Private/Responses/IRErrorResponse.m b/IrohaCommunication/Classes/Private/Responses/IRErrorResponse.m index b8f77e04e..0ab0feb49 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRErrorResponse.m +++ b/IrohaCommunication/Classes/Private/Responses/IRErrorResponse.m @@ -12,9 +12,9 @@ @implementation IRErrorResponse @synthesize queryHash = _queryHash; - (nonnull instancetype)initWithReason:(IRErrorResponseReason)reason - message:(nonnull NSString*)message + message:(nonnull NSString *)message code:(UInt32)code - queryHash:(nonnull NSData*)queryHash { + queryHash:(nonnull NSData *)queryHash { if (self = [super init]) { _reason = reason; diff --git a/IrohaCommunication/Classes/Private/Responses/IRPeersResponse.h b/IrohaCommunication/Classes/Private/Responses/IRPeersResponse.h index 66cd8df7c..d3368cd0f 100644 --- a/IrohaCommunication/Classes/Private/Responses/IRPeersResponse.h +++ b/IrohaCommunication/Classes/Private/Responses/IRPeersResponse.h @@ -10,6 +10,6 @@ @interface IRPeersResponse : NSObject -- (nonnull instancetype)initWithPeers:(nonnull NSArray>*)peers queryHash:(nonnull NSData*)queryHash; +- (nonnull instancetype)initWithPeers:(nonnull NSArray>*)peers queryHash:(nonnull NSData *)queryHash; @end diff --git a/IrohaCommunication/Classes/Private/Responses/IRRolePermissionsResponse.h b/IrohaCommunication/Classes/Private/Responses/IRRolePermissionsResponse.h index ab60794ee..1345620a1 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRRolePermissionsResponse.h +++ b/IrohaCommunication/Classes/Private/Responses/IRRolePermissionsResponse.h @@ -9,6 +9,6 @@ @interface IRRolePermissionsResponse : NSObject - (nonnull instancetype)initWithPermissions:(nonnull NSArray>*)permissions - queryHash:(nonnull NSData*)queryHash; + queryHash:(nonnull NSData *)queryHash; @end diff --git a/IrohaCommunication/Classes/Private/Responses/IRRolePermissionsResponse.m b/IrohaCommunication/Classes/Private/Responses/IRRolePermissionsResponse.m index c287fbcb8..5f893b827 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRRolePermissionsResponse.m +++ b/IrohaCommunication/Classes/Private/Responses/IRRolePermissionsResponse.m @@ -10,7 +10,7 @@ @implementation IRRolePermissionsResponse @synthesize queryHash = _queryHash; - (nonnull instancetype)initWithPermissions:(nonnull NSArray>*)permissions - queryHash:(nonnull NSData*)queryHash { + queryHash:(nonnull NSData *)queryHash { if (self = [super init]) { _permissions = permissions; _queryHash = queryHash; diff --git a/IrohaCommunication/Classes/Private/Responses/IRRolesResponse.h b/IrohaCommunication/Classes/Private/Responses/IRRolesResponse.h index c01844da3..06a996ceb 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRRolesResponse.h +++ b/IrohaCommunication/Classes/Private/Responses/IRRolesResponse.h @@ -9,6 +9,6 @@ @interface IRRolesResponse : NSObject - (nonnull instancetype)initWithRoles:(nonnull NSArray>*)roles - queryHash:(nonnull NSData*)queryHash; + queryHash:(nonnull NSData *)queryHash; @end diff --git a/IrohaCommunication/Classes/Private/Responses/IRRolesResponse.m b/IrohaCommunication/Classes/Private/Responses/IRRolesResponse.m index f3d832710..b85659b52 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRRolesResponse.m +++ b/IrohaCommunication/Classes/Private/Responses/IRRolesResponse.m @@ -10,7 +10,7 @@ @implementation IRRolesResponse @synthesize queryHash = _queryHash; - (nonnull instancetype)initWithRoles:(nonnull NSArray>*)roles - queryHash:(nonnull NSData*)queryHash { + queryHash:(nonnull NSData *)queryHash { if (self = [super init]) { _roles = roles; _queryHash = queryHash; diff --git a/IrohaCommunication/Classes/Private/Responses/IRSignatoriesResponse.h b/IrohaCommunication/Classes/Private/Responses/IRSignatoriesResponse.h index e92eb6a29..d71011b45 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRSignatoriesResponse.h +++ b/IrohaCommunication/Classes/Private/Responses/IRSignatoriesResponse.h @@ -9,6 +9,6 @@ @interface IRSignatoriesResponse : NSObject - (nonnull instancetype)initWithPublicKeys:(nonnull NSArray>*)publicKeys - queryHash:(nonnull NSData*)queryHash; + queryHash:(nonnull NSData *)queryHash; @end diff --git a/IrohaCommunication/Classes/Private/Responses/IRSignatoriesResponse.m b/IrohaCommunication/Classes/Private/Responses/IRSignatoriesResponse.m index 1f46d0aaa..c119913cb 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRSignatoriesResponse.m +++ b/IrohaCommunication/Classes/Private/Responses/IRSignatoriesResponse.m @@ -10,7 +10,7 @@ @implementation IRSignatoriesResponse @synthesize queryHash = _queryHash; - (nonnull instancetype)initWithPublicKeys:(nonnull NSArray>*)publicKeys - queryHash:(nonnull NSData*)queryHash { + queryHash:(nonnull NSData *)queryHash { if (self = [super init]) { _publicKeys = publicKeys; _queryHash = queryHash; diff --git a/IrohaCommunication/Classes/Private/Responses/IRTransactionsPageResponse.h b/IrohaCommunication/Classes/Private/Responses/IRTransactionsPageResponse.h index c5ca222b2..c87f65097 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRTransactionsPageResponse.h +++ b/IrohaCommunication/Classes/Private/Responses/IRTransactionsPageResponse.h @@ -10,7 +10,7 @@ - (nonnull instancetype)initWithTransactions:(nonnull NSArray>*)transactions totalCount:(UInt32)totalCount - nextTransactionHash:(nullable NSData*)nextTransactionHash - queryHash:(nonnull NSData*)queryHash; + nextTransactionHash:(nullable NSData *)nextTransactionHash + queryHash:(nonnull NSData *)queryHash; @end diff --git a/IrohaCommunication/Classes/Private/Responses/IRTransactionsPageResponse.m b/IrohaCommunication/Classes/Private/Responses/IRTransactionsPageResponse.m index 10f5d3f01..770274867 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRTransactionsPageResponse.m +++ b/IrohaCommunication/Classes/Private/Responses/IRTransactionsPageResponse.m @@ -13,8 +13,8 @@ @implementation IRTransactionsPageResponse - (nonnull instancetype)initWithTransactions:(nonnull NSArray>*)transactions totalCount:(UInt32)totalCount - nextTransactionHash:(nullable NSData*)nextTransactionHash - queryHash:(nonnull NSData*)queryHash { + nextTransactionHash:(nullable NSData *)nextTransactionHash + queryHash:(nonnull NSData *)queryHash { if (self = [super init]) { _transactions = transactions; diff --git a/IrohaCommunication/Classes/Private/Responses/IRTransactionsResponse.h b/IrohaCommunication/Classes/Private/Responses/IRTransactionsResponse.h index f1518ef35..668da4dad 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRTransactionsResponse.h +++ b/IrohaCommunication/Classes/Private/Responses/IRTransactionsResponse.h @@ -9,6 +9,6 @@ @interface IRTransactionsResponse : NSObject - (nonnull instancetype)initWithTransactions:(nonnull NSArray>*)transactions - queryHash:(nonnull NSData*)queryHash; + queryHash:(nonnull NSData *)queryHash; @end diff --git a/IrohaCommunication/Classes/Private/Responses/IRTransactionsResponse.m b/IrohaCommunication/Classes/Private/Responses/IRTransactionsResponse.m index f32826282..ab6c74dea 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRTransactionsResponse.m +++ b/IrohaCommunication/Classes/Private/Responses/IRTransactionsResponse.m @@ -10,7 +10,7 @@ @implementation IRTransactionsResponse @synthesize queryHash = _queryHash; - (nonnull instancetype)initWithTransactions:(nonnull NSArray>*)transactions - queryHash:(nonnull NSData*)queryHash { + queryHash:(nonnull NSData *)queryHash { if (self = [super init]) { _transactions = transactions; diff --git a/IrohaCommunication/Classes/Public/Builder/IRBlockQueryBuilder.h b/IrohaCommunication/Classes/Public/Builder/IRBlockQueryBuilder.h index e8096af98..b656e33a0 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRBlockQueryBuilder.h +++ b/IrohaCommunication/Classes/Public/Builder/IRBlockQueryBuilder.h @@ -9,9 +9,9 @@ @protocol IRBlockQueryBuilderProtocol - (nonnull instancetype)withCreatorAccountId:(nonnull id)creatorAccountId; -- (nonnull instancetype)withCreatedDate:(nonnull NSDate*)date; +- (nonnull instancetype)withCreatedDate:(nonnull NSDate *)date; - (nonnull instancetype)withQueryCounter:(UInt64)queryCounter; -- (nullable id)build:(NSError*_Nullable*_Nullable)error; +- (nullable id)build:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Public/Builder/IRBlockQueryBuilder.m b/IrohaCommunication/Classes/Public/Builder/IRBlockQueryBuilder.m index a89460508..454bbe0b9 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRBlockQueryBuilder.m +++ b/IrohaCommunication/Classes/Public/Builder/IRBlockQueryBuilder.m @@ -10,9 +10,9 @@ @interface IRBlockQueryBuilder() -@property(strong, nonatomic)id _Nullable creator; -@property(strong, nonatomic)NSDate* _Nullable createdAt; -@property(nonatomic, readwrite)UInt64 queryCounter; +@property (nonatomic, strong) id _Nullable creator; +@property (nonatomic, strong) NSDate * _Nullable createdAt; +@property (nonatomic, readwrite) UInt64 queryCounter; @end @@ -40,7 +40,7 @@ - (nonnull instancetype)withCreatorAccountId:(nonnull id)creatorAcc return self; } -- (nonnull instancetype)withCreatedDate:(nonnull NSDate*)date { +- (nonnull instancetype)withCreatedDate:(nonnull NSDate *)date { _createdAt = date; return self; @@ -52,7 +52,7 @@ - (nonnull instancetype)withQueryCounter:(UInt64)queryCounter { return self; } -- (nullable id)build:(NSError*_Nullable*_Nullable)error { +- (nullable id)build:(NSError *_Nullable*_Nullable)error { if (!_creator) { if (error) { NSString *message = @"Creator's account id is required!"; diff --git a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h index 64cde0d40..4bba073d7 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h +++ b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h @@ -11,10 +11,10 @@ @protocol IRQueryBuilderProtocol - (nonnull instancetype)withCreatorAccountId:(nonnull id)creatorAccountId; -- (nonnull instancetype)withCreatedDate:(nonnull NSDate*)date; +- (nonnull instancetype)withCreatedDate:(nonnull NSDate *)date; - (nonnull instancetype)withQueryCounter:(UInt64)queryCounter; - (nonnull instancetype)withQuery:(nonnull id)query; -- (nullable id)build:(NSError*_Nullable*_Nullable)error; +- (nullable id)build:(NSError *_Nullable*_Nullable)error; @end @@ -38,7 +38,7 @@ typedef NS_ENUM(NSUInteger, IRQueryBuilderError) { assetId:(nonnull id)assetId pagination:(nullable id)pagination; -- (nonnull instancetype)getTransactions:(nonnull NSArray*)hashes; +- (nonnull instancetype)getTransactions:(nonnull NSArray*)hashes; - (nonnull instancetype)getAccountAssets:(nonnull id)accountId DEPRECATED_MSG_ATTRIBUTE("use getAccountAsset:pagination:"); @@ -47,7 +47,7 @@ typedef NS_ENUM(NSUInteger, IRQueryBuilderError) { - (nonnull instancetype)getAccountDetail:(nullable id)accountId writer:(nullable id)writer - key:(nullable NSString*)key; + key:(nullable NSString *)key; - (nonnull instancetype)getAccountDetailWithPagination:(nonnull id)pagination; diff --git a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m index 9fd6a6c15..dce87ba0f 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m +++ b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m @@ -11,10 +11,10 @@ @interface IRQueryBuilder() -@property(strong, nonatomic)id _Nullable creator; -@property(strong, nonatomic)NSDate* _Nullable createdAt; -@property(strong, nonatomic)id _Nullable query; -@property(nonatomic, readwrite)UInt64 queryCounter; +@property (nonatomic, strong) id _Nullable creator; +@property (nonatomic, strong) NSDate * _Nullable createdAt; +@property (nonatomic, strong) id _Nullable query; +@property (nonatomic, readwrite) UInt64 queryCounter; @end @@ -66,7 +66,7 @@ - (nonnull instancetype)getAccountAssetTransactions:(nonnull id)acc return [self withQuery:query]; } -- (nonnull instancetype)getTransactions:(nonnull NSArray*)hashes { +- (nonnull instancetype)getTransactions:(nonnull NSArray*)hashes { id query = [[IRGetTransactions alloc] initWithTransactionHashes:hashes]; return [self withQuery:query]; @@ -86,7 +86,7 @@ - (nonnull instancetype)getAccountAssets:(nonnull id)accountId - (nonnull instancetype)getAccountDetail:(nullable id)accountId writer:(nullable id)writer - key:(nullable NSString*)key { + key:(nullable NSString *)key { id record = [IRAccountDetailRecordIdFactory accountDetailRecordIdWithWriter:writer key:key]; id pagination = [IRAccountDetailPaginationFactory accountDetailPagination:1 @@ -139,7 +139,7 @@ - (nonnull instancetype)withCreatorAccountId:(nonnull id)creatorAcc return self; } -- (nonnull instancetype)withCreatedDate:(nonnull NSDate*)date { +- (nonnull instancetype)withCreatedDate:(nonnull NSDate *)date { _createdAt = date; return self; @@ -157,7 +157,7 @@ - (nonnull instancetype)withQuery:(nonnull id)query { return self; } -- (nullable id)build:(NSError*_Nullable*_Nullable)error { +- (nullable id)build:(NSError *_Nullable*_Nullable)error { if (!_creator) { if (error) { NSString *message = @"Creator's account id is required!"; diff --git a/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.h b/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.h index d49b40b2e..8e0b24843 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.h +++ b/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.h @@ -12,10 +12,10 @@ @protocol IRTransactionBuilderProtocol - (nonnull instancetype)withCreatorAccountId:(nonnull id)creatorAccountId; -- (nonnull instancetype)withCreatedDate:(nonnull NSDate*)date; +- (nonnull instancetype)withCreatedDate:(nonnull NSDate *)date; - (nonnull instancetype)withQuorum:(NSUInteger)quorum; - (nonnull instancetype)addCommand:(nonnull id)command; -- (nullable id)build:(NSError*_Nullable*_Nullable)error; +- (nullable id)build:(NSError *_Nullable*_Nullable)error; @end @@ -67,8 +67,8 @@ typedef NS_ENUM(NSUInteger, IRTransactionBuilderError) { permission:(nonnull id)grantablePermission; - (nonnull instancetype)setAccountDetail:(nonnull id)accountId - key:(nonnull NSString*)key - value:(nonnull NSString*)value; + key:(nonnull NSString *)key + value:(nonnull NSString *)value; - (nonnull instancetype)setAccountQuorum:(nonnull id)accountId quorum:(UInt32)quorum; @@ -76,7 +76,7 @@ typedef NS_ENUM(NSUInteger, IRTransactionBuilderError) { - (nonnull instancetype)transferAsset:(nonnull id)sourceAccountId destinationAccount:(nonnull id)destinationAccountId assetId:(nonnull id)assetId - description:(nonnull NSString*)transferDescription + description:(nonnull NSString *)transferDescription amount:(nonnull id)amount; - (nonnull instancetype)removePeer:(nonnull id)peerKey; diff --git a/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.m b/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.m index 6d7e7ca40..a02f195ab 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.m +++ b/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.m @@ -9,15 +9,17 @@ static const NSUInteger DEFAULT_QUORUM = 1; -@interface IRTransactionBuilder() -@property(strong, nonatomic)id accountId; -@property(strong, readwrite)NSDate *date; -@property(nonatomic, readwrite)NSUInteger quorum; -@property(strong, nonatomic)NSMutableArray> *commands; +@interface IRTransactionBuilder () + +@property (nonatomic, strong) id accountId; +@property (strong, readwrite) NSDate *date; +@property (nonatomic, readwrite) NSUInteger quorum; +@property (nonatomic, strong) NSMutableArray> *commands; @end + @implementation IRTransactionBuilder #pragma mark - Initialization @@ -183,8 +185,8 @@ - (nonnull instancetype)revokePermission:(nonnull id)accountId } - (nonnull instancetype)setAccountDetail:(nonnull id)accountId - key:(nonnull NSString*)key - value:(nonnull NSString*)value { + key:(nonnull NSString *)key + value:(nonnull NSString *)value { IRSetAccountDetail *command = [[IRSetAccountDetail alloc] initWithAccountId:accountId key:key @@ -209,7 +211,7 @@ - (nonnull instancetype)setAccountQuorum:(nonnull id)accountId - (nonnull instancetype)transferAsset:(nonnull id)sourceAccountId destinationAccount:(nonnull id)destinationAccountId assetId:(nonnull id)assetId - description:(nonnull NSString*)transferDescription + description:(nonnull NSString *)transferDescription amount:(nonnull id)amount { IRTransferAsset *command = [[IRTransferAsset alloc] initWithSourceAccountId:sourceAccountId @@ -251,7 +253,7 @@ - (nonnull instancetype)withCreatorAccountId:(nonnull id)creatorAcc return self; } -- (nonnull instancetype)withCreatedDate:(nonnull NSDate*)date { +- (nonnull instancetype)withCreatedDate:(nonnull NSDate *)date { _date = date; return self; @@ -269,7 +271,7 @@ - (nonnull instancetype)addCommand:(nonnull id)command { return self; } -- (nullable id)build:(NSError*_Nullable*_Nullable)error { +- (nullable id)build:(NSError *_Nullable*_Nullable)error { if (!_accountId) { if (error) { NSString *message = @"Creator's account id is required!"; diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAccountAsset.h b/IrohaCommunication/Classes/Public/Model/Common/IRAccountAsset.h index 732366356..966970482 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRAccountAsset.h +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAccountAsset.h @@ -10,9 +10,9 @@ @protocol IRAccountAsset -@property(nonatomic, readonly)id _Nonnull accountId; -@property(nonatomic, readonly)id _Nonnull assetId; -@property(nonatomic, readonly)id _Nonnull balance; +@property (nonatomic, readonly) id _Nonnull accountId; +@property (nonatomic, readonly) id _Nonnull assetId; +@property (nonatomic, readonly) id _Nonnull balance; @end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailPagination.h b/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailPagination.h index f4c19595a..761b5a1f5 100644 --- a/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailPagination.h +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailPagination.h @@ -9,8 +9,8 @@ @protocol IRAccountDetailPagination -@property(nonatomic, readonly)UInt32 pageSize; -@property(nonatomic, readonly)id nextRecordId; +@property (nonatomic, readonly) UInt32 pageSize; +@property (nonatomic, readonly, nullable) id nextRecordId; @end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailRecordId.h b/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailRecordId.h index 5c07541dc..40ff19af3 100644 --- a/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailRecordId.h +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAccountDetailRecordId.h @@ -8,8 +8,8 @@ @protocol IRAccountDetailRecordId -@property(nonatomic, readonly)NSString * _Nonnull writer; -@property(nonatomic, readonly)NSString * _Nonnull key; +@property (nonatomic, readonly) NSString * _Nonnull writer; +@property (nonatomic, readonly) NSString * _Nonnull key; @end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAccountId.h b/IrohaCommunication/Classes/Public/Model/Common/IRAccountId.h index d28abeeeb..887005fd3 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRAccountId.h +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAccountId.h @@ -8,10 +8,10 @@ @protocol IRAccountId -@property(nonatomic, readonly)NSString * _Nonnull name; -@property(nonatomic, readonly)id _Nonnull domain; +@property (nonatomic, readonly) NSString * _Nonnull name; +@property (nonatomic, readonly) id _Nonnull domain; -- (nonnull NSString*)identifier; +- (nonnull NSString *)identifier; @end @@ -22,12 +22,12 @@ typedef NS_ENUM(NSUInteger, IRAccountIdFactoryError) { @protocol IRAccountIdFactoryProtocol -+ (nullable id)accountIdWithName:(nonnull NSString*)name ++ (nullable id)accountIdWithName:(nonnull NSString *)name domain:(nonnull id)domain - error:(NSError*_Nullable*_Nullable)error; + error:(NSError *_Nullable*_Nullable)error; -+ (nullable id)accountWithIdentifier:(nonnull NSString*)accountId - error:(NSError*_Nullable*_Nullable)error; ++ (nullable id)accountWithIdentifier:(nonnull NSString *)accountId + error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAccountId.m b/IrohaCommunication/Classes/Public/Model/Common/IRAccountId.m index 6e5d74820..5e74794f9 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRAccountId.m +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAccountId.m @@ -64,7 +64,7 @@ @implementation IRAccountIdFactory + (nullable id)accountWithIdentifier:(nonnull NSString *)accountId error:(NSError *_Nullable*_Nullable)error { - NSArray *components = [accountId componentsSeparatedByString:ACCOUNT_SEPARATOR]; + NSArray *components = [accountId componentsSeparatedByString:ACCOUNT_SEPARATOR]; if ([components count] != 2) { if (error) { diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAddress.h b/IrohaCommunication/Classes/Public/Model/Common/IRAddress.h index aada79d3c..d3fff5b83 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRAddress.h +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAddress.h @@ -7,7 +7,7 @@ @protocol IRAddress -@property(nonatomic, readonly)NSString * _Nonnull value; +@property (nonatomic, readonly) NSString * _Nonnull value; @end @@ -20,9 +20,9 @@ typedef NS_ENUM(NSUInteger, IRAddressError) { @protocol IRAddressFactoryProtocol -+ (nullable id)addressWithIp:(nonnull NSString*)ipV4 port:(nonnull NSString*)port error:(NSError*_Nullable*_Nullable)error; -+ (nullable id)addressWithDomain:(nonnull NSString*)domain port:(nonnull NSString*)port error:(NSError*_Nullable*_Nullable)error; -+ (nullable id)addressWithValue:(nonnull NSString*)value error:(NSError*_Nullable*_Nullable)error; ++ (nullable id)addressWithIp:(nonnull NSString *)ipV4 port:(nonnull NSString *)port error:(NSError *_Nullable*_Nullable)error; ++ (nullable id)addressWithDomain:(nonnull NSString *)domain port:(nonnull NSString *)port error:(NSError *_Nullable*_Nullable)error; ++ (nullable id)addressWithValue:(nonnull NSString *)value error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAddress.m b/IrohaCommunication/Classes/Public/Model/Common/IRAddress.m index 6c6276c36..11d129371 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRAddress.m +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAddress.m @@ -16,14 +16,14 @@ @interface IRAddress : NSObject -- (instancetype)initWithString:(nonnull NSString*)value; +- (instancetype)initWithString:(nonnull NSString *)value; @end @implementation IRAddress @synthesize value = _value; -- (instancetype)initWithString:(nonnull NSString*)value { +- (instancetype)initWithString:(nonnull NSString *)value { if (self = [super init]) { _value = value; } @@ -41,7 +41,7 @@ - (instancetype)copyWithZone:(NSZone *)zone { @implementation IRAddressFactory -+ (nullable id)addressWithIp:(nonnull NSString*)ipV4 port:(nonnull NSString*)port error:(NSError*_Nullable*_Nullable)error { ++ (nullable id)addressWithIp:(nonnull NSString *)ipV4 port:(nonnull NSString *)port error:(NSError *_Nullable*_Nullable)error { if (![self isValidIpV4:ipV4]) { if (error) { NSString *message = [NSString stringWithFormat:@"IP address %@ is invalid. Expected: %@", ipV4, IP_V4_FORMAT]; @@ -67,7 +67,7 @@ @implementation IRAddressFactory return [[IRAddress alloc] initWithString:value]; } -+ (nullable id)addressWithDomain:(nonnull NSString*)domain port:(nonnull NSString*)port error:(NSError*_Nullable*_Nullable)error { ++ (nullable id)addressWithDomain:(nonnull NSString *)domain port:(nonnull NSString *)port error:(NSError *_Nullable*_Nullable)error { if (![self isValidDomain:domain]) { if (error) { NSString *message = [NSString stringWithFormat:@"Domain %@ is invalid. Expected: %@", domain, DOMAIN_FORMAT]; @@ -94,8 +94,8 @@ @implementation IRAddressFactory return [[IRAddress alloc] initWithString:value]; } -+ (nullable id)addressWithValue:(nonnull NSString*)value error:(NSError*_Nullable*_Nullable)error { - NSArray *components = [value componentsSeparatedByString:ADDRESS_PORT_SEPARATOR]; ++ (nullable id)addressWithValue:(nonnull NSString *)value error:(NSError *_Nullable*_Nullable)error { + NSArray *components = [value componentsSeparatedByString:ADDRESS_PORT_SEPARATOR]; if ([components count] != 2) { if (error) { @@ -123,19 +123,19 @@ @implementation IRAddressFactory return address; } -+ (BOOL)isValidIpV4:(nonnull NSString*)ipV4 { ++ (BOOL)isValidIpV4:(nonnull NSString *)ipV4 { return [[NSPredicate predicateWithFormat:@"SELF MATCHES %@", IP_V4_FORMAT] evaluateWithObject:ipV4]; } -+ (BOOL)isValidPort:(nonnull NSString*)port { ++ (BOOL)isValidPort:(nonnull NSString *)port { return [[NSPredicate predicateWithFormat:@"SELF MATCHES %@", PORT_FORMAT] evaluateWithObject:port]; } -+ (BOOL)isValidDomain:(nonnull NSString*)domain { ++ (BOOL)isValidDomain:(nonnull NSString *)domain { return [[NSPredicate predicateWithFormat:@"SELF MATCHES %@", DOMAIN_FORMAT] evaluateWithObject:domain]; } -+ (nonnull NSError*)invalidValueError:(nonnull NSString*)value { ++ (nonnull NSError *)invalidValueError:(nonnull NSString *)value { NSString *message = [NSString stringWithFormat:@"Invalid address value: %@", value]; return [NSError errorWithDomain:NSStringFromClass([IRAddressFactory class]) code:IRInvalidAddressValue diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAmount.h b/IrohaCommunication/Classes/Public/Model/Common/IRAmount.h index 5d165ccbc..d498e8d2c 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRAmount.h +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAmount.h @@ -7,7 +7,7 @@ @protocol IRAmount -@property(nonatomic, readonly)NSString* _Nonnull value; +@property (nonatomic, readonly) NSString * _Nonnull value; @end @@ -17,8 +17,8 @@ typedef NS_ENUM(NSUInteger, IRAmountError) { @protocol IRAmountFactoryProtocol -+ (nullable id)amountFromString:(nonnull NSString*)amount error:(NSError*_Nullable*_Nullable)error; -+ (nullable id)amountFromUnsignedInteger:(NSUInteger)amount error:(NSError*_Nullable*_Nullable)error; ++ (nullable id)amountFromString:(nonnull NSString *)amount error:(NSError *_Nullable*_Nullable)error; ++ (nullable id)amountFromUnsignedInteger:(NSUInteger)amount error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAssetId.h b/IrohaCommunication/Classes/Public/Model/Common/IRAssetId.h index db00df805..2a1051890 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRAssetId.h +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAssetId.h @@ -8,10 +8,10 @@ @protocol IRAssetId -@property(nonatomic, readonly)NSString * _Nonnull name; -@property(nonatomic, readonly)id _Nonnull domain; +@property (nonatomic, readonly) NSString * _Nonnull name; +@property (nonatomic, readonly) id _Nonnull domain; -- (nonnull NSString*)identifier; +- (nonnull NSString *)identifier; @end @@ -22,12 +22,12 @@ typedef NS_ENUM(NSUInteger, IRAssetIdFactoryError) { @protocol IRAssetIdFactoryProtocol -+ (nullable id)assetIdWithName:(nonnull NSString*)name ++ (nullable id)assetIdWithName:(nonnull NSString *)name domain:(nonnull id)domain - error:(NSError*_Nullable*_Nullable)error; + error:(NSError *_Nullable*_Nullable)error; -+ (nullable id)assetWithIdentifier:(nonnull NSString*)assetId - error:(NSError*_Nullable*_Nullable)error; ++ (nullable id)assetWithIdentifier:(nonnull NSString *)assetId + error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAssetId.m b/IrohaCommunication/Classes/Public/Model/Common/IRAssetId.m index f4414a092..87cdc0926 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRAssetId.m +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAssetId.m @@ -12,7 +12,7 @@ @interface IRAssetId : NSObject -- (instancetype)initWithName:(nonnull NSString*)name inDomain:(nonnull id)domain; +- (instancetype)initWithName:(nonnull NSString *)name inDomain:(nonnull id)domain; @end @@ -22,7 +22,7 @@ @implementation IRAssetId @synthesize name = _name; @synthesize domain = _domain; -- (instancetype)initWithName:(nonnull NSString*)name inDomain:(nonnull id)domain { +- (instancetype)initWithName:(nonnull NSString *)name inDomain:(nonnull id)domain { if (self = [super init]) { _name = name; _domain = domain; @@ -31,7 +31,7 @@ - (instancetype)initWithName:(nonnull NSString*)name inDomain:(nonnull id)assetIdWithName:(nonnull NSString*)name ++ (nullable id)assetIdWithName:(nonnull NSString *)name domain:(nonnull id)domain - error:(NSError*_Nullable*_Nullable)error { + error:(NSError *_Nullable*_Nullable)error { NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", ASSET_NAME_FORMAT]; if ([predicate evaluateWithObject:name]) { @@ -63,9 +63,9 @@ @implementation IRAssetIdFactory } } -+ (nullable id)assetWithIdentifier:(nonnull NSString*)assetId - error:(NSError*_Nullable*_Nullable)error { - NSArray *components = [assetId componentsSeparatedByString:ASSET_ID_SEPARATOR]; ++ (nullable id)assetWithIdentifier:(nonnull NSString *)assetId + error:(NSError *_Nullable*_Nullable)error { + NSArray *components = [assetId componentsSeparatedByString:ASSET_ID_SEPARATOR]; if ([components count] != 2) { if (error) { diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRAssetPagination.h b/IrohaCommunication/Classes/Public/Model/Common/IRAssetPagination.h index 5e25f6997..b68a1644b 100644 --- a/IrohaCommunication/Classes/Public/Model/Common/IRAssetPagination.h +++ b/IrohaCommunication/Classes/Public/Model/Common/IRAssetPagination.h @@ -8,9 +8,9 @@ @protocol IRAssetPagination -@property(nonatomic, readonly)UInt32 pageSize; +@property (nonatomic, readonly) UInt32 pageSize; -@property(nonatomic, readonly)id _Nullable startingAssetId; +@property (nonatomic, readonly) id _Nullable startingAssetId; @end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRDomain.h b/IrohaCommunication/Classes/Public/Model/Common/IRDomain.h index d04feaa97..97d799bf4 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRDomain.h +++ b/IrohaCommunication/Classes/Public/Model/Common/IRDomain.h @@ -7,7 +7,7 @@ @protocol IRDomain -@property(nonatomic, readonly)NSString * _Nonnull identifier; +@property (nonatomic, readonly) NSString * _Nonnull identifier; @end @@ -17,8 +17,8 @@ typedef NS_ENUM(NSUInteger, IRDomainFactoryError) { @protocol IRDomainFactoryProtocol -+ (nullable id)domainWithIdentitifer:(nonnull NSString*)identifier - error:(NSError*_Nullable*_Nullable)error; ++ (nullable id)domainWithIdentitifer:(nonnull NSString *)identifier + error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRDomain.m b/IrohaCommunication/Classes/Public/Model/Common/IRDomain.m index f0a96affb..5cf961ab6 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRDomain.m +++ b/IrohaCommunication/Classes/Public/Model/Common/IRDomain.m @@ -9,14 +9,14 @@ @interface IRDomain : NSObject -- (instancetype)initWithIdentifier:(nonnull NSString*)identifier; +- (instancetype)initWithIdentifier:(nonnull NSString *)identifier; @end @implementation IRDomain @synthesize identifier = _identifier; -- (instancetype)initWithIdentifier:(nonnull NSString*)identifier { +- (instancetype)initWithIdentifier:(nonnull NSString *)identifier { if (self = [super init]) { _identifier = identifier; } @@ -28,8 +28,8 @@ - (instancetype)initWithIdentifier:(nonnull NSString*)identifier { @implementation IRDomainFactory -+ (nullable id)domainWithIdentitifer:(nonnull NSString*)identifier - error:(NSError*_Nullable*_Nullable)error { ++ (nullable id)domainWithIdentitifer:(nonnull NSString *)identifier + error:(NSError *_Nullable*_Nullable)error { NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", DOMAIN_FORMAT]; if ([predicate evaluateWithObject:identifier]) { diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRGrantablePermission.h b/IrohaCommunication/Classes/Public/Model/Common/IRGrantablePermission.h index 2b9250354..9fc4901b8 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRGrantablePermission.h +++ b/IrohaCommunication/Classes/Public/Model/Common/IRGrantablePermission.h @@ -7,7 +7,7 @@ @protocol IRGrantablePermission -@property(nonatomic, readonly)int32_t value; +@property (nonatomic, readonly) int32_t value; @end @@ -17,7 +17,7 @@ typedef NS_ENUM(NSUInteger, IRGrantablePermissionError) { @protocol IRGrantablePermissionFactoryProtocol -+ (nullable id)permissionWithValue:(int32_t)value error:(NSError*_Nullable*_Nullable)error; ++ (nullable id)permissionWithValue:(int32_t)value error:(NSError *_Nullable *_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRGrantablePermission.m b/IrohaCommunication/Classes/Public/Model/Common/IRGrantablePermission.m index 877226183..5ccb77100 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRGrantablePermission.m +++ b/IrohaCommunication/Classes/Public/Model/Common/IRGrantablePermission.m @@ -39,7 +39,7 @@ - (BOOL)isEqual:(id)object { @implementation IRGrantablePermissionFactory -+ (nullable id)permissionWithValue:(int32_t)value error:(NSError*_Nullable*_Nullable)error { ++ (nullable id)permissionWithValue:(int32_t)value error:(NSError *_Nullable*_Nullable)error { if (!GrantablePermission_IsValidValue(value)) { if (error) { NSString *message = @"Invalid grantable permission value passed."; diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRPagination.h b/IrohaCommunication/Classes/Public/Model/Common/IRPagination.h index fab5d81b0..aa84746dd 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRPagination.h +++ b/IrohaCommunication/Classes/Public/Model/Common/IRPagination.h @@ -5,26 +5,28 @@ #import -@protocol IRPagination -@property(nonatomic, readonly)UInt32 pageSize; +typedef NS_ENUM(NSUInteger, IRPaginationFactoryError) { + IRPaginationFactoryErrorInvalidHash +}; + + +@protocol IRPagination -@property(nonatomic, readonly)NSData * _Nullable firstItemHash; +@property (nonatomic, readonly) UInt32 pageSize; +@property (nonatomic, readonly) NSData * _Nullable firstItemHash; @end -typedef NS_ENUM(NSUInteger, IRPaginationFactoryError) { - IRPaginationFactoryErrorInvalidHash -}; @protocol IRPaginationFactoryProtocol + (nullable id)pagination:(UInt32)pageSize - firstItemHash:(nullable NSData*)firstItemHash - error:(NSError*_Nullable*_Nullable)error; + firstItemHash:(nullable NSData *)firstItemHash + error:(NSError *_Nullable*_Nullable)error; @end -@interface IRPaginationFactory : NSObject +@interface IRPaginationFactory : NSObject @end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRPagination.m b/IrohaCommunication/Classes/Public/Model/Common/IRPagination.m index e54462ce4..38aaa4822 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRPagination.m +++ b/IrohaCommunication/Classes/Public/Model/Common/IRPagination.m @@ -14,7 +14,7 @@ @implementation IRPagination @synthesize firstItemHash = _firstItemHash; - (nonnull instancetype)initWithPageSize:(UInt32)pageSize - firstItemHash:(nullable NSData*)firstItemHash { + firstItemHash:(nullable NSData *)firstItemHash { if (self = [super init]) { _pageSize = pageSize; _firstItemHash = firstItemHash; @@ -28,7 +28,7 @@ - (nonnull instancetype)initWithPageSize:(UInt32)pageSize @implementation IRPaginationFactory + (nullable id)pagination:(UInt32)pageSize - firstItemHash:(nullable NSData*)firstItemHash + firstItemHash:(nullable NSData *)firstItemHash error:(NSError **)error { if (firstItemHash && firstItemHash.length != 32) { if (error) { diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRPeerSignature.h b/IrohaCommunication/Classes/Public/Model/Common/IRPeerSignature.h index 5d15435c0..ca8fea2d4 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRPeerSignature.h +++ b/IrohaCommunication/Classes/Public/Model/Common/IRPeerSignature.h @@ -9,8 +9,8 @@ @protocol IRPeerSignature -@property(nonatomic, readonly)id _Nonnull signature; -@property(nonatomic, readonly)id _Nonnull publicKey; +@property (nonatomic, readonly) id _Nonnull signature; +@property (nonatomic, readonly) id _Nonnull publicKey; @end @@ -18,7 +18,7 @@ + (nullable id)peerSignature:(nonnull id)signature publicKey:(nonnull id)publicKey - error:(NSError*_Nullable*_Nullable)error; + error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRPeerSignature.m b/IrohaCommunication/Classes/Public/Model/Common/IRPeerSignature.m index d1c98dbf7..cd5618436 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRPeerSignature.m +++ b/IrohaCommunication/Classes/Public/Model/Common/IRPeerSignature.m @@ -33,7 +33,7 @@ @implementation IRPeerSignatureFactory + (nullable id)peerSignature:(nonnull id)signature publicKey:(nonnull id)publicKey - error:(NSError*_Nullable*_Nullable)error { + error:(NSError *_Nullable*_Nullable)error { return [[IRPeerSignature alloc] initWithSignature:signature publicKey:publicKey]; diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRRoleName.h b/IrohaCommunication/Classes/Public/Model/Common/IRRoleName.h index 8c8b355ab..824487845 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRRoleName.h +++ b/IrohaCommunication/Classes/Public/Model/Common/IRRoleName.h @@ -7,7 +7,7 @@ @protocol IRRoleName -@property(nonatomic, readonly)NSString * _Nonnull value; +@property (nonatomic, readonly) NSString * _Nonnull value; @end @@ -17,7 +17,7 @@ typedef NS_ENUM(NSUInteger, IRRoleNameFactoryError) { @protocol IRRoleNameFactoryProtocol -+ (nullable id)roleWithName:(nonnull NSString*)name error:(NSError*_Nullable*_Nullable)error; ++ (nullable id)roleWithName:(nonnull NSString *)name error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRRoleName.m b/IrohaCommunication/Classes/Public/Model/Common/IRRoleName.m index 8b0d52032..21466c652 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRRoleName.m +++ b/IrohaCommunication/Classes/Public/Model/Common/IRRoleName.m @@ -9,14 +9,14 @@ @interface IRRoleName : NSObject -- (instancetype)initWithName:(nonnull NSString*)name; +- (instancetype)initWithName:(nonnull NSString *)name; @end @implementation IRRoleName @synthesize value = _value; -- (instancetype)initWithName:(nonnull NSString*)name { +- (instancetype)initWithName:(nonnull NSString *)name { if (self = [super init]) { _value = name; } @@ -28,7 +28,7 @@ - (instancetype)initWithName:(nonnull NSString*)name { @implementation IRRoleNameFactory -+ (nullable id)roleWithName:(nonnull NSString*)name error:(NSError**)error { ++ (nullable id)roleWithName:(nonnull NSString *)name error:(NSError **)error { NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", ROLE_NAME_FORMAT]; if ([predicate evaluateWithObject:name]) { diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRRolePermission.h b/IrohaCommunication/Classes/Public/Model/Common/IRRolePermission.h index 77784a8cd..5e7b29bd4 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRRolePermission.h +++ b/IrohaCommunication/Classes/Public/Model/Common/IRRolePermission.h @@ -5,78 +5,90 @@ #import -@protocol IRRolePermission - -@property(nonatomic, readonly)int32_t value; +NS_ASSUME_NONNULL_BEGIN -@end typedef NS_ENUM(NSUInteger, IRRolePermissionError) { IRInvalidRolePermissionValue }; + +@protocol IRRolePermission + +@property (nonatomic, readonly) int32_t value; + +@end + + @protocol IRRolePermissionFactoryProtocol -+ (nullable id)permissionWithValue:(int32_t)value error:(NSError*_Nullable*_Nullable)error; ++ (nullable id)permissionWithValue:(int32_t)value error:(NSError *_Nullable*_Nullable)error; @end + @interface IRRolePermissionFactory : NSObject + #pragma mark - Command Permissions -+ (nonnull id)canAppendRole; -+ (nonnull id)canCreateRole; -+ (nonnull id)canDetachRole; -+ (nonnull id)canAddAssetQuantity; -+ (nonnull id)canSubtractAssetQuantity; -+ (nonnull id)canAddPeer; -+ (nonnull id)canRemovePeer; -+ (nonnull id)canAddSignatory; -+ (nonnull id)canRemoveSignatory; -+ (nonnull id)canSetQuorum; -+ (nonnull id)canCreateAccount; -+ (nonnull id)canSetDetail; -+ (nonnull id)canCreateAsset; -+ (nonnull id)canTransfer; -+ (nonnull id)canReceive; -+ (nonnull id)canCreateDomain; -+ (nonnull id)canAddDomainAssetQuantity; -+ (nonnull id)canSubtractDomainAssetQuantity; ++ (id)canAppendRole; ++ (id)canCreateRole; ++ (id)canDetachRole; ++ (id)canAddAssetQuantity; ++ (id)canSubtractAssetQuantity; ++ (id)canAddPeer; ++ (id)canRemovePeer; ++ (id)canAddSignatory; ++ (id)canRemoveSignatory; ++ (id)canSetQuorum; ++ (id)canCreateAccount; ++ (id)canSetDetail; ++ (id)canCreateAsset; ++ (id)canTransfer; ++ (id)canReceive; ++ (id)canCreateDomain; ++ (id)canAddDomainAssetQuantity; ++ (id)canSubtractDomainAssetQuantity; + #pragma mark - Query permissions -+ (nonnull id)canReadAssets; -+ (nonnull id)canGetRoles; -+ (nonnull id)canGetMyAccount; -+ (nonnull id)canGetAllAccounts; -+ (nonnull id)canGetDomainAccounts; -+ (nonnull id)canGetMySignatories; -+ (nonnull id)canGetAllSignatories; -+ (nonnull id)canGetDomainSignatories; -+ (nonnull id)canGetMyAccountAssets; -+ (nonnull id)canGetAllAccountAssets; -+ (nonnull id)canGetDomainAccountAssets; -+ (nonnull id)canGetMyAccountDetail; -+ (nonnull id)canGetAllAccountDetail; -+ (nonnull id)canGetDomainAccountDetail; -+ (nonnull id)canGetMyAccountTransactions; -+ (nonnull id)canGetAllAccountTransactions; -+ (nonnull id)canGetDomainAccountTransactions; -+ (nonnull id)canGetMyAccountAssetTransactions; -+ (nonnull id)canGetAllAccountAssetTransactions; -+ (nonnull id)canGetDomainAccountAsssetTransactions; -+ (nonnull id)canGetMyTransactions; -+ (nonnull id)canGetAllTransactions; -+ (nonnull id)canGetBlocks; -+ (nonnull id)canGetPeers; ++ (id)canReadAssets; ++ (id)canGetRoles; ++ (id)canGetMyAccount; ++ (id)canGetAllAccounts; ++ (id)canGetDomainAccounts; ++ (id)canGetMySignatories; ++ (id)canGetAllSignatories; ++ (id)canGetDomainSignatories; ++ (id)canGetMyAccountAssets; ++ (id)canGetAllAccountAssets; ++ (id)canGetDomainAccountAssets; ++ (id)canGetMyAccountDetail; ++ (id)canGetAllAccountDetail; ++ (id)canGetDomainAccountDetail; ++ (id)canGetMyAccountTransactions; ++ (id)canGetAllAccountTransactions; ++ (id)canGetDomainAccountTransactions; ++ (id)canGetMyAccountAssetTransactions; ++ (id)canGetAllAccountAssetTransactions; ++ (id)canGetDomainAccountAsssetTransactions; ++ (id)canGetMyTransactions; ++ (id)canGetAllTransactions; ++ (id)canGetBlocks; ++ (id)canGetPeers; + #pragma mark - Grant permissions -+ (nonnull id)canGrantCanSetMyQuorum; -+ (nonnull id)canGrantCanAddMySignatory; -+ (nonnull id)canGrantCanRemoveMySignatory; -+ (nonnull id)canGrantCanTransferMyAssets; -+ (nonnull id)canGrantCanSetMyAccountDetail; ++ (id)canGrantCanSetMyQuorum; ++ (id)canGrantCanAddMySignatory; ++ (id)canGrantCanRemoveMySignatory; ++ (id)canGrantCanTransferMyAssets; ++ (id)canGrantCanSetMyAccountDetail; @end + + +NS_ASSUME_NONNULL_END diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRRolePermission.m b/IrohaCommunication/Classes/Public/Model/Common/IRRolePermission.m index 0f98cbc1e..c3567b9b2 100755 --- a/IrohaCommunication/Classes/Public/Model/Common/IRRolePermission.m +++ b/IrohaCommunication/Classes/Public/Model/Common/IRRolePermission.m @@ -39,7 +39,7 @@ - (BOOL)isEqual:(id)object { @implementation IRRolePermissionFactory -+ (nullable id)permissionWithValue:(int32_t)value error:(NSError*_Nullable*_Nullable)error { ++ (nullable id)permissionWithValue:(int32_t)value error:(NSError *_Nullable*_Nullable)error { if (!RolePermission_IsValidValue(value)) { if (error) { NSString *message = @"Invalid role permission value passed."; diff --git a/IrohaCommunication/Classes/Public/Model/IRBlockQueryRequest.h b/IrohaCommunication/Classes/Public/Model/IRBlockQueryRequest.h index a4c7b36c1..390b57bf2 100755 --- a/IrohaCommunication/Classes/Public/Model/IRBlockQueryRequest.h +++ b/IrohaCommunication/Classes/Public/Model/IRBlockQueryRequest.h @@ -13,14 +13,14 @@ @protocol IRBlockQueryRequest -@property(nonatomic, readonly)id _Nonnull creator; -@property(nonatomic, readonly)NSDate* _Nonnull createdAt; -@property(nonatomic, readonly)UInt64 queryCounter; -@property(nonatomic, readonly)id _Nullable peerSignature; +@property (nonatomic, readonly) id _Nonnull creator; +@property (nonatomic, readonly) NSDate * _Nonnull createdAt; +@property (nonatomic, readonly) UInt64 queryCounter; +@property (nonatomic, readonly) id _Nullable peerSignature; - (nullable instancetype)signedWithSignatory:(nonnull id)signatory signatoryPublicKey:(nonnull id)signatoryPublicKey - error:(NSError*_Nullable*_Nullable)error; + error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Public/Model/IRBlockQueryResponse.h b/IrohaCommunication/Classes/Public/Model/IRBlockQueryResponse.h index f473a8fa8..67dc26a97 100755 --- a/IrohaCommunication/Classes/Public/Model/IRBlockQueryResponse.h +++ b/IrohaCommunication/Classes/Public/Model/IRBlockQueryResponse.h @@ -11,19 +11,19 @@ @protocol IRBlock -@property(nonatomic, readonly)UInt64 height; -@property(nonatomic, readonly)NSData * _Nullable previousBlockHash; -@property(nonatomic, readonly)NSDate * _Nonnull createdAt; -@property(nonatomic, readonly)NSArray> * _Nonnull transactions; -@property(nonatomic, readonly)NSArray * _Nonnull rejectedTransactionHashes; -@property(nonatomic, readonly)NSArray> * _Nonnull peerSignatures; +@property (nonatomic, readonly) UInt64 height; +@property (nonatomic, readonly) NSData * _Nullable previousBlockHash; +@property (nonatomic, readonly) NSDate * _Nonnull createdAt; +@property (nonatomic, readonly) NSArray> * _Nonnull transactions; +@property (nonatomic, readonly) NSArray * _Nonnull rejectedTransactionHashes; +@property (nonatomic, readonly) NSArray> * _Nonnull peerSignatures; @end @protocol IRBlockQueryResponse -@property(nonatomic, readonly)id _Nullable block; -@property(nonatomic, readonly)NSError * _Nullable error; +@property (nonatomic, readonly) id _Nullable block; +@property (nonatomic, readonly) NSError * _Nullable error; @end diff --git a/IrohaCommunication/Classes/Public/Model/IRCommand.h b/IrohaCommunication/Classes/Public/Model/IRCommand.h index ae327b30d..4ef7a7563 100755 --- a/IrohaCommunication/Classes/Public/Model/IRCommand.h +++ b/IrohaCommunication/Classes/Public/Model/IRCommand.h @@ -23,149 +23,149 @@ @protocol IRAddAssetQuantity -@property(nonatomic, readonly)id _Nonnull assetId; -@property(nonatomic, readonly)id _Nonnull amount; +@property (nonatomic, readonly) id _Nonnull assetId; +@property (nonatomic, readonly) id _Nonnull amount; @end @protocol IRAddPeer -@property(nonatomic, readonly)id _Nonnull address; -@property(nonatomic, readonly)id _Nonnull publicKey; +@property (nonatomic, readonly) id _Nonnull address; +@property (nonatomic, readonly) id _Nonnull publicKey; @end @protocol IRAddSignatory -@property(nonatomic, readonly)id _Nonnull accountId; -@property(nonatomic, readonly)id _Nonnull publicKey; +@property (nonatomic, readonly) id _Nonnull accountId; +@property (nonatomic, readonly) id _Nonnull publicKey; @end @protocol IRAppendRole -@property(nonatomic, readonly)id _Nonnull accountId; -@property(nonatomic, readonly)id _Nonnull roleName; +@property (nonatomic, readonly) id _Nonnull accountId; +@property (nonatomic, readonly) id _Nonnull roleName; @end @protocol IRCreateAccount -@property(nonatomic, readonly)id _Nonnull accountId; -@property(nonatomic, readonly)id _Nonnull publicKey; +@property (nonatomic, readonly) id _Nonnull accountId; +@property (nonatomic, readonly) id _Nonnull publicKey; @end @protocol IRCreateAsset -@property(nonatomic, readonly)id _Nonnull assetId; -@property(nonatomic, readonly)UInt32 precision; +@property (nonatomic, readonly) id _Nonnull assetId; +@property (nonatomic, readonly) UInt32 precision; @end @protocol IRCreateDomain -@property(nonatomic, readonly)id _Nonnull domainId; -@property(nonatomic, readonly)id _Nullable defaultRole; +@property (nonatomic, readonly) id _Nonnull domainId; +@property (nonatomic, readonly) id _Nullable defaultRole; @end @protocol IRCreateRole -@property(nonatomic, readonly)id _Nonnull roleName; -@property(nonatomic, readonly)NSArray> * _Nonnull permissions; +@property (nonatomic, readonly) id _Nonnull roleName; +@property (nonatomic, readonly) NSArray> * _Nonnull permissions; @end @protocol IRDetachRole -@property(nonatomic, readonly)id _Nonnull accountId; -@property(nonatomic, readonly)id _Nonnull roleName; +@property (nonatomic, readonly) id _Nonnull accountId; +@property (nonatomic, readonly) id _Nonnull roleName; @end @protocol IRGrantPermission -@property(nonatomic, readonly)id _Nonnull accountId; -@property(nonatomic, readonly)id _Nonnull permission; +@property (nonatomic, readonly) id _Nonnull accountId; +@property (nonatomic, readonly) id _Nonnull permission; @end @protocol IRRemoveSignatory -@property(nonatomic, readonly)id _Nonnull accountId; -@property(nonatomic, readonly)id _Nonnull publicKey; +@property (nonatomic, readonly) id _Nonnull accountId; +@property (nonatomic, readonly) id _Nonnull publicKey; @end @protocol IRRevokePermission -@property(nonatomic, readonly)id _Nonnull accountId; -@property(nonatomic, readonly)id _Nonnull permission; +@property (nonatomic, readonly) id _Nonnull accountId; +@property (nonatomic, readonly) id _Nonnull permission; @end @protocol IRSetAccountDetail -@property(nonatomic, readonly)id _Nonnull accountId; -@property(nonatomic, readonly)NSString* _Nonnull key; -@property(nonatomic, readonly)NSString* _Nonnull value; +@property (nonatomic, readonly) id _Nonnull accountId; +@property (nonatomic, readonly) NSString * _Nonnull key; +@property (nonatomic, readonly) NSString * _Nonnull value; @end @protocol IRSetAccountQuorum -@property(nonatomic, readonly)id _Nonnull accountId; -@property(nonatomic, readonly)UInt32 quorum; +@property (nonatomic, readonly) id _Nonnull accountId; +@property (nonatomic, readonly) UInt32 quorum; @end @protocol IRSubtractAssetQuantity -@property(nonatomic, readonly)id _Nonnull assetId; -@property(nonatomic, readonly)id _Nonnull amount; +@property (nonatomic, readonly) id _Nonnull assetId; +@property (nonatomic, readonly) id _Nonnull amount; @end @protocol IRTransferAsset -@property(nonatomic, readonly)id _Nonnull sourceAccountId; -@property(nonatomic, readonly)id _Nonnull destinationAccountId; -@property(nonatomic, readonly)id _Nonnull assetId; -@property(nonatomic, readonly)NSString* _Nonnull transferDescription; -@property(nonatomic, readonly)id _Nonnull amount; +@property (nonatomic, readonly) id _Nonnull sourceAccountId; +@property (nonatomic, readonly) id _Nonnull destinationAccountId; +@property (nonatomic, readonly) id _Nonnull assetId; +@property (nonatomic, readonly) NSString * _Nonnull transferDescription; +@property (nonatomic, readonly) id _Nonnull amount; @end @protocol IRRemovePeer -@property(nonatomic, readonly)id _Nonnull peerKey; +@property (nonatomic, readonly) id _Nonnull peerKey; @end @protocol IRCompareAndSetAccountDetail -@property(nonatomic, readonly)id _Nonnull accountId; -@property(nonatomic, readonly)NSString* _Nonnull key; -@property(nonatomic, readonly)NSString* _Nonnull value; -@property(nonatomic, readonly)NSString* _Nullable oldValue; +@property (nonatomic, readonly) id _Nonnull accountId; +@property (nonatomic, readonly) NSString * _Nonnull key; +@property (nonatomic, readonly) NSString * _Nonnull value; +@property (nonatomic, readonly) NSString * _Nullable oldValue; @end diff --git a/IrohaCommunication/Classes/Public/Model/IRQuery.h b/IrohaCommunication/Classes/Public/Model/IRQuery.h index 6d78e7c62..9a078ef5d 100755 --- a/IrohaCommunication/Classes/Public/Model/IRQuery.h +++ b/IrohaCommunication/Classes/Public/Model/IRQuery.h @@ -20,56 +20,56 @@ @protocol IRGetAccount -@property(nonatomic, readonly)id _Nonnull accountId; +@property (nonatomic, readonly) id _Nonnull accountId; @end @protocol IRGetSignatories -@property(nonatomic, readonly)id _Nonnull accountId; +@property (nonatomic, readonly) id _Nonnull accountId; @end @protocol IRGetAccountTransactions -@property(nonatomic, readonly)id _Nonnull accountId; -@property(nonatomic, readonly)id _Nullable pagination; +@property (nonatomic, readonly) id _Nonnull accountId; +@property (nonatomic, readonly) id _Nullable pagination; @end @protocol IRGetAccountAssetTransactions -@property(nonatomic, readonly)id _Nonnull accountId; -@property(nonatomic, readonly)id _Nonnull assetId; -@property(nonatomic, readonly)id _Nullable pagination; +@property (nonatomic, readonly) id _Nonnull accountId; +@property (nonatomic, readonly) id _Nonnull assetId; +@property (nonatomic, readonly) id _Nullable pagination; @end @protocol IRGetTransactions -@property(nonatomic, readonly)NSArray * _Nonnull transactionHashes; +@property (nonatomic, readonly) NSArray * _Nonnull transactionHashes; @end @protocol IRGetAccountAssets -@property(nonatomic, readonly)id _Nonnull accountId; -@property(nonatomic, readonly)id _Nullable pagination; +@property (nonatomic, readonly) id _Nonnull accountId; +@property (nonatomic, readonly) id _Nullable pagination; @end @protocol IRGetAccountDetail -@property(nonatomic, readonly)id _Nullable accountId; -@property(nonatomic, readonly)id _Nullable writer; -@property(nonatomic, readonly)NSString * _Nullable key; -@property(nonatomic, readonly)id _Nullable pagination; +@property (nonatomic, readonly) id _Nullable accountId; +@property (nonatomic, readonly) id _Nullable writer; +@property (nonatomic, readonly) NSString * _Nullable key; +@property (nonatomic, readonly) id _Nullable pagination; @end @@ -80,14 +80,14 @@ @protocol IRGetRolePermissions -@property(nonatomic, readonly)id _Nonnull roleName; +@property (nonatomic, readonly) id _Nonnull roleName; @end @protocol IRGetAssetInfo -@property(nonatomic, readonly)id _Nonnull assetId; +@property (nonatomic, readonly) id _Nonnull assetId; @end diff --git a/IrohaCommunication/Classes/Public/Model/IRQueryRequest.h b/IrohaCommunication/Classes/Public/Model/IRQueryRequest.h index 978699a98..1d8b78f40 100755 --- a/IrohaCommunication/Classes/Public/Model/IRQueryRequest.h +++ b/IrohaCommunication/Classes/Public/Model/IRQueryRequest.h @@ -13,15 +13,15 @@ @protocol IRQueryRequest -@property(nonatomic, readonly)id _Nonnull creator; -@property(nonatomic, readonly)NSDate* _Nonnull createdAt; -@property(nonatomic, readonly)UInt64 queryCounter; -@property(nonatomic, readonly)id _Nonnull query; -@property(nonatomic, readonly)id _Nullable peerSignature; +@property (nonatomic, readonly) id _Nonnull creator; +@property (nonatomic, readonly) NSDate * _Nonnull createdAt; +@property (nonatomic, readonly) UInt64 queryCounter; +@property (nonatomic, readonly) id _Nonnull query; +@property (nonatomic, readonly) id _Nullable peerSignature; - (nullable instancetype)signedWithSignatory:(nonnull id)signatory signatoryPublicKey:(nonnull id)signatoryPublicKey - error:(NSError*_Nullable*_Nullable)error; + error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h b/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h index 74a160ac2..df9698365 100755 --- a/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h +++ b/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h @@ -18,63 +18,63 @@ @protocol IRQueryResponse -@property (nonatomic, readonly) NSData* _Nonnull queryHash; +@property (nonatomic, readonly) NSData * _Nonnull queryHash; @end @protocol IRAccountAssetsResponse -@property(nonatomic, readonly)NSArray>* _Nonnull accountAssets; -@property(nonatomic, readonly)UInt32 totalCount; -@property(nonatomic, readonly)id _Nullable nextAssetId; +@property (nonatomic, readonly) NSArray> * _Nonnull accountAssets; +@property (nonatomic, readonly) UInt32 totalCount; +@property (nonatomic, readonly) id _Nullable nextAssetId; @end @protocol IRAccountDetailResponse -@property(nonatomic, readonly)NSString* _Nonnull detail; -@property(nonatomic, readonly)UInt64 totalCount; -@property(nonatomic, readonly)id _Nullable nextRecordId; +@property (nonatomic, readonly) NSString * _Nonnull detail; +@property (nonatomic, readonly) UInt64 totalCount; +@property (nonatomic, readonly) id _Nullable nextRecordId; @end @protocol IRSignatoriesResponse -@property(nonatomic, readonly)NSArray>* _Nonnull publicKeys; +@property (nonatomic, readonly) NSArray> * _Nonnull publicKeys; @end @protocol IRTransactionsResponse -@property(nonatomic, readonly)NSArray>* _Nonnull transactions; +@property (nonatomic, readonly) NSArray> * _Nonnull transactions; @end @protocol IRRolesResponse -@property(nonatomic, readonly)NSArray>* _Nonnull roles; +@property (nonatomic, readonly) NSArray> * _Nonnull roles; @end @protocol IRRolePermissionsResponse -@property(nonatomic, readonly)NSArray>* _Nonnull permissions; +@property (nonatomic, readonly) NSArray> * _Nonnull permissions; @end @protocol IRAccountResponse -@property(nonatomic, readonly)id _Nonnull accountId; -@property(nonatomic, readonly)UInt32 quorum; -@property(nonatomic, readonly)NSString * _Nullable details; -@property(nonatomic, readonly)NSArray> * _Nonnull roles; +@property (nonatomic, readonly) id _Nonnull accountId; +@property (nonatomic, readonly) UInt32 quorum; +@property (nonatomic, readonly) NSString * _Nullable details; +@property (nonatomic, readonly) NSArray> * _Nonnull roles; @end @@ -94,33 +94,33 @@ typedef NS_ENUM(NSUInteger, IRErrorResponseReason) { @protocol IRErrorResponse -@property(nonatomic, readonly)IRErrorResponseReason reason; -@property(nonatomic, readonly)NSString * _Nonnull message; -@property(nonatomic, readonly)UInt32 code; +@property (nonatomic, readonly) IRErrorResponseReason reason; +@property (nonatomic, readonly) NSString * _Nonnull message; +@property (nonatomic, readonly) UInt32 code; @end @protocol IRAssetResponse -@property(nonatomic, readonly)id _Nonnull assetId; -@property(nonatomic, readonly)UInt32 precision; +@property (nonatomic, readonly) id _Nonnull assetId; +@property (nonatomic, readonly) UInt32 precision; @end @protocol IRTransactionsPageResponse -@property(nonatomic, readonly)NSArray>* _Nonnull transactions; -@property(nonatomic, readonly)UInt32 totalCount; -@property(nonatomic, readonly)NSData * _Nullable nextTransactionHash; +@property (nonatomic, readonly) NSArray> * _Nonnull transactions; +@property (nonatomic, readonly) UInt32 totalCount; +@property (nonatomic, readonly) NSData * _Nullable nextTransactionHash; @end @protocol IRPeersResponse -@property(nonatomic, readonly)NSArray>* _Nonnull peers; +@property (nonatomic, readonly) NSArray> * _Nonnull peers; @end diff --git a/IrohaCommunication/Classes/Public/Model/IRSignable.h b/IrohaCommunication/Classes/Public/Model/IRSignable.h index c5f61c3b5..b6068f5ad 100755 --- a/IrohaCommunication/Classes/Public/Model/IRSignable.h +++ b/IrohaCommunication/Classes/Public/Model/IRSignable.h @@ -13,7 +13,7 @@ - (nullable id)signWithSignatory:(nonnull id)signatory signatoryPublicKey:(nonnull id)signatoryPublicKey - error:(NSError*_Nullable*_Nullable)error; + error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Public/Model/IRTransaction.h b/IrohaCommunication/Classes/Public/Model/IRTransaction.h index 972f51f86..0b8128e70 100755 --- a/IrohaCommunication/Classes/Public/Model/IRTransaction.h +++ b/IrohaCommunication/Classes/Public/Model/IRTransaction.h @@ -19,25 +19,25 @@ typedef NS_ENUM(NSUInteger, IRTransactionBatchType) { @protocol IRTransaction -@property(nonatomic, readonly)id _Nonnull creator; -@property(nonatomic, readonly)NSDate* _Nonnull createdAt; -@property(nonatomic, readonly)NSArray>* _Nonnull commands; -@property(nonatomic, readonly)NSUInteger quorum; -@property(nonatomic, readonly)NSArray>* _Nullable signatures; -@property(nonatomic, readonly)NSArray* _Nullable batchHashes; -@property(nonatomic, readonly)IRTransactionBatchType batchType; +@property (nonatomic, readonly) id _Nonnull creator; +@property (nonatomic, readonly) NSDate * _Nonnull createdAt; +@property (nonatomic, readonly) NSArray> * _Nonnull commands; +@property (nonatomic, readonly) NSUInteger quorum; +@property (nonatomic, readonly) NSArray> * _Nullable signatures; +@property (nonatomic, readonly) NSArray * _Nullable batchHashes; +@property (nonatomic, readonly) IRTransactionBatchType batchType; -- (nullable NSData*)transactionHashWithError:(NSError*_Nullable*_Nullable)error; +- (nullable NSData *)transactionHashWithError:(NSError *_Nullable*_Nullable)error; -- (nullable NSData*)batchHashWithError:(NSError*_Nullable*_Nullable)error; +- (nullable NSData *)batchHashWithError:(NSError *_Nullable*_Nullable)error; -- (nullable instancetype)signedWithSignatories:(nonnull NSArray>*)signatories +- (nullable instancetype)signedWithSignatories:(nonnull NSArray> *)signatories signatoryPublicKeys:(nonnull NSArray> *)signatoryPublicKeys - error:(NSError*_Nullable*_Nullable)error; + error:(NSError *_Nullable*_Nullable)error; -- (nullable instancetype)batched:(nullable NSArray*)transactionBatchHashes +- (nullable instancetype)batched:(nullable NSArray *)transactionBatchHashes batchType:(IRTransactionBatchType)batchType - error:(NSError*_Nullable*_Nullable)error; + error:(NSError *_Nullable *_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Public/Model/IRTransactionStatusResponse.h b/IrohaCommunication/Classes/Public/Model/IRTransactionStatusResponse.h index e77ef8dd1..0ab380623 100755 --- a/IrohaCommunication/Classes/Public/Model/IRTransactionStatusResponse.h +++ b/IrohaCommunication/Classes/Public/Model/IRTransactionStatusResponse.h @@ -20,8 +20,8 @@ typedef NS_ENUM(NSUInteger, IRTransactionStatus) { @protocol IRTransactionStatusResponse -@property(nonatomic, readonly)IRTransactionStatus status; -@property(nonatomic, readonly)NSData * _Nonnull transactionHash; -@property(nonatomic, readonly)NSString * _Nullable statusDescription; +@property (nonatomic, readonly) IRTransactionStatus status; +@property (nonatomic, readonly) NSData * _Nonnull transactionHash; +@property (nonatomic, readonly) NSString * _Nullable statusDescription; @end diff --git a/IrohaCommunication/Classes/Public/Promise/IRPromise.h b/IrohaCommunication/Classes/Public/Promise/IRPromise.h index 490d48b44..6cff9635c 100755 --- a/IrohaCommunication/Classes/Public/Promise/IRPromise.h +++ b/IrohaCommunication/Classes/Public/Promise/IRPromise.h @@ -5,24 +5,24 @@ #import + @class IRPromise; -typedef IRPromise* _Nullable (^IRPromiseResultHandler)(id _Nullable); -typedef IRPromise* _Nullable (^IRPromiseErrorHandler)(NSError* _Nonnull); -@interface IRPromise : NSObject +typedef IRPromise *_Nullable (^IRPromiseResultHandler)(id _Nullable); +typedef IRPromise *_Nullable (^IRPromiseErrorHandler)(NSError * _Nonnull); + -@property(nonatomic, readonly)BOOL isFulfilled; -@property(nonatomic, readonly)BOOL isProcessed; +@interface IRPromise : NSObject -@property(nonatomic, readonly)id _Nullable result; +@property (nonatomic, readonly) BOOL isFulfilled; +@property (nonatomic, readonly) BOOL isProcessed; +@property (nonatomic, readonly) id _Nullable result; +@property (nonatomic, readonly) IRPromise* _Nonnull (^ _Nonnull onThen)(IRPromiseResultHandler _Nonnull); +@property (nonatomic, readonly) IRPromise* _Nonnull (^ _Nonnull onError)(IRPromiseErrorHandler _Nonnull); + (nonnull instancetype)promise; + (nonnull instancetype)promiseWithResult:(nullable id)result; - -@property(nonatomic, readonly)IRPromise* _Nonnull (^ _Nonnull onThen)(IRPromiseResultHandler _Nonnull); -@property(nonatomic, readonly)IRPromise* _Nonnull (^ _Nonnull onError)(IRPromiseErrorHandler _Nonnull); - - (void)fulfillWithResult:(id _Nullable)result; @end diff --git a/IrohaCommunication/Classes/Public/Promise/IRPromise.m b/IrohaCommunication/Classes/Public/Promise/IRPromise.m index ea69cde8a..455909da9 100755 --- a/IrohaCommunication/Classes/Public/Promise/IRPromise.m +++ b/IrohaCommunication/Classes/Public/Promise/IRPromise.m @@ -7,13 +7,13 @@ @interface IRPromise() -@property(strong, nonatomic)IRPromise* _Nullable next; +@property (nonatomic, strong) IRPromise* _Nullable next; -@property(strong, nonatomic)IRPromiseResultHandler _Nullable resultHandler; +@property (nonatomic, strong) IRPromiseResultHandler _Nullable resultHandler; -@property(strong, nonatomic)IRPromiseErrorHandler _Nullable errorHandler; +@property (nonatomic, strong) IRPromiseErrorHandler _Nullable errorHandler; -@property(strong, nonatomic)dispatch_semaphore_t semaphore; +@property (nonatomic, strong) dispatch_semaphore_t semaphore; @end diff --git a/IrohaCommunication/Classes/Public/Serializers/IRSerializationFactory.h b/IrohaCommunication/Classes/Public/Serializers/IRSerializationFactory.h index 9bc7d3d04..e600d99b2 100644 --- a/IrohaCommunication/Classes/Public/Serializers/IRSerializationFactory.h +++ b/IrohaCommunication/Classes/Public/Serializers/IRSerializationFactory.h @@ -10,11 +10,11 @@ @protocol IRSerializationFactoryProtocol -+ (nullable NSData*)serializeTransaction:(nonnull id)transaction error:(NSError*_Nullable*_Nullable)error; -+ (nullable NSData*)serializeQueryRequest:(nonnull id)queryRequest error:(NSError*_Nullable*_Nullable)error; ++ (nullable NSData *)serializeTransaction:(nonnull id)transaction error:(NSError *_Nullable*_Nullable)error; ++ (nullable NSData *)serializeQueryRequest:(nonnull id)queryRequest error:(NSError *_Nullable*_Nullable)error; -+ (nullable id)deserializeTransactionFromData:(nonnull NSData*)data error:(NSError*_Nullable*_Nullable)error; -+ (nullable id)deserializeQueryResponseFromData:(nonnull NSData*)data error:(NSError*_Nullable*_Nullable)error; ++ (nullable id)deserializeTransactionFromData:(nonnull NSData *)data error:(NSError *_Nullable*_Nullable)error; ++ (nullable id)deserializeQueryResponseFromData:(nonnull NSData *)data error:(NSError *_Nullable*_Nullable)error; @end diff --git a/IrohaCommunication/Classes/Public/Serializers/IRSerializationFactory.m b/IrohaCommunication/Classes/Public/Serializers/IRSerializationFactory.m index ee2e40951..7f97b652d 100644 --- a/IrohaCommunication/Classes/Public/Serializers/IRSerializationFactory.m +++ b/IrohaCommunication/Classes/Public/Serializers/IRSerializationFactory.m @@ -14,7 +14,7 @@ @implementation IRSerializationFactory -+ (nullable NSData*)serializeTransaction:(nonnull id)transaction error:(NSError**)error { ++ (nullable NSData *)serializeTransaction:(nonnull id)transaction error:(NSError **)error { if (![transaction conformsToProtocol:@protocol(IRProtobufTransformable)]) { if (error) { @@ -36,7 +36,7 @@ + (nullable NSData*)serializeTransaction:(nonnull id)transaction return [pbTransaction data]; } -+ (nullable NSData*)serializeQueryRequest:(nonnull id)queryRequest error:(NSError**)error { ++ (nullable NSData *)serializeQueryRequest:(nonnull id)queryRequest error:(NSError **)error { if (![queryRequest conformsToProtocol:@protocol(IRProtobufTransformable)]) { if (error) { @@ -58,7 +58,7 @@ + (nullable NSData*)serializeQueryRequest:(nonnull id)queryReque return [protobufQuery data]; } -+ (nullable id)deserializeTransactionFromData:(nonnull NSData*)data error:(NSError**)error { ++ (nullable id)deserializeTransactionFromData:(nonnull NSData *)data error:(NSError **)error { Transaction *transaction = [[Transaction alloc] initWithData:data error:error]; if (!transaction) { @@ -68,7 +68,7 @@ + (nullable NSData*)serializeQueryRequest:(nonnull id)queryReque return [IRTransaction transactionFromPbTransaction:transaction error:error]; } -+ (nullable id)deserializeQueryResponseFromData:(nonnull NSData*)data error:(NSError**)error { ++ (nullable id)deserializeQueryResponseFromData:(nonnull NSData *)data error:(NSError **)error { QueryResponse *response = [[QueryResponse alloc] initWithData:data error:error]; if (!response) { diff --git a/IrohaCommunication/Classes/Public/Service/IRNetworkService.h b/IrohaCommunication/Classes/Public/Service/IRNetworkService.h index 948785d08..1bd8323bf 100755 --- a/IrohaCommunication/Classes/Public/Service/IRNetworkService.h +++ b/IrohaCommunication/Classes/Public/Service/IRNetworkService.h @@ -21,7 +21,7 @@ typedef NS_ENUM(NSUInteger, IRNetworkServiceError) { @interface IRNetworkService : NSObject -@property(strong, nonatomic)dispatch_queue_t _Nonnull responseSerialQueue; +@property (nonatomic, strong) dispatch_queue_t _Nonnull responseSerialQueue; - (nonnull instancetype)initWithAddress:(nonnull id)address; @@ -31,7 +31,7 @@ typedef NS_ENUM(NSUInteger, IRNetworkServiceError) { - (nonnull IRPromise *)executeBatchTransactions:(nonnull NSArray>*)transactions; -- (nonnull IRPromise *)fetchTransactionStatus:(nonnull NSData*)transactionHash; +- (nonnull IRPromise *)fetchTransactionStatus:(nonnull NSData *)transactionHash; - (nonnull IRPromise*)executeQueryRequest:(nonnull id)queryRequest; diff --git a/IrohaCommunication/Classes/Public/Service/IRNetworkService.m b/IrohaCommunication/Classes/Public/Service/IRNetworkService.m index 179ad662d..7fa7d3563 100755 --- a/IrohaCommunication/Classes/Public/Service/IRNetworkService.m +++ b/IrohaCommunication/Classes/Public/Service/IRNetworkService.m @@ -18,8 +18,8 @@ @interface IRNetworkService() -@property(strong, nonatomic)CommandService_v1 *commandService; -@property(strong, nonatomic)QueryService_v1 *queryService; +@property (nonatomic, strong) CommandService_v1 *commandService; +@property (nonatomic, strong) QueryService_v1 *queryService; @end @@ -97,7 +97,7 @@ - (nonnull IRPromise *)executeBatchTransactions:(nonnull NSArray *pbTransactions = [NSMutableArray array]; - NSMutableArray *transactionHashes = [NSMutableArray array]; + NSMutableArray *transactionHashes = [NSMutableArray array]; for (NSUInteger i = 0; i < transactions.count; i++) { if (![transactions[i] conformsToProtocol:@protocol(IRProtobufTransformable)]) { @@ -149,7 +149,7 @@ - (nonnull IRPromise *)executeBatchTransactions:(nonnull NSArray)streamTransactionStatus:(nonnull NSData*)transactionHash +- (id)streamTransactionStatus:(nonnull NSData *)transactionHash withBlock:(nonnull IRTransactionStatusBlock)block { TxStatusRequest *statusRequest = [[TxStatusRequest alloc] init]; statusRequest.txHash = [transactionHash toHexString]; @@ -224,7 +224,7 @@ - (nonnull IRPromise*)executeQueryRequest:(nonnull id)queryReque } GRPCProtoCall *call = [_queryService RPCToFindWithRequest:protobufQuery - handler:^(QueryResponse* _Nullable response, NSError* _Nullable error) { + handler:^(QueryResponse* _Nullable response, NSError * _Nullable error) { if (response) { NSError *parsingError = nil; id queryResponse = [IRQueryResponseProtoFactory responseFromProtobuf:response diff --git a/IrohaCommunication/Classes/Public/Service/IRRepeatableStatusStream.h b/IrohaCommunication/Classes/Public/Service/IRRepeatableStatusStream.h index 313224a5d..4a4247656 100644 --- a/IrohaCommunication/Classes/Public/Service/IRRepeatableStatusStream.h +++ b/IrohaCommunication/Classes/Public/Service/IRRepeatableStatusStream.h @@ -17,7 +17,7 @@ typedef NS_ENUM(NSUInteger, IRTransactionStatusStreamError) { @protocol IRRepeatableStatusStreamProtocol + (nonnull IRPromise*)onTransactionStatus:(IRTransactionStatus)transactionStatus - withHash:(nonnull NSData*)transactionHash + withHash:(nonnull NSData *)transactionHash from:(nonnull id)streamable maxReconnection:(NSUInteger)trialsCount; @@ -26,7 +26,7 @@ typedef NS_ENUM(NSUInteger, IRTransactionStatusStreamError) { @interface IRRepeatableStatusStream : NSObject + (nonnull IRPromise*)onTransactionStatus:(IRTransactionStatus)transactionStatus - withHash:(nonnull NSData*)transactionHash + withHash:(nonnull NSData *)transactionHash from:(nonnull id)streamable; @end diff --git a/IrohaCommunication/Classes/Public/Service/IRRepeatableStatusStream.m b/IrohaCommunication/Classes/Public/Service/IRRepeatableStatusStream.m index d874c4d9d..32265ece5 100644 --- a/IrohaCommunication/Classes/Public/Service/IRRepeatableStatusStream.m +++ b/IrohaCommunication/Classes/Public/Service/IRRepeatableStatusStream.m @@ -10,27 +10,20 @@ @interface IRRepeatableStatusStream() -@property(strong, nonatomic)NSData * _Nonnull transactionHash; - -@property(weak, nonatomic)id _Nullable streamable; - -@property(strong, nonatomic)IRPromise * _Nullable promise; - -@property(strong, nonatomic)id _Nullable operation; - -@property(nonatomic, readonly)IRTransactionStatus expectedTransactionStatus; - -@property(nonatomic, readonly)NSUInteger maxTrialsCount; - -@property(nonatomic, readwrite)NSUInteger currentTrial; - -@property(nonatomic, strong)NSMutableArray *receivedStatuses; +@property (nonatomic, strong) NSData * _Nonnull transactionHash; +@property (nonatomic, weak) id _Nullable streamable; +@property (nonatomic, strong) IRPromise * _Nullable promise; +@property (nonatomic, strong) id _Nullable operation; +@property (nonatomic, readonly) IRTransactionStatus expectedTransactionStatus; +@property (nonatomic, readonly) NSUInteger maxTrialsCount; +@property (nonatomic, readwrite) NSUInteger currentTrial; +@property (nonatomic, strong) NSMutableArray *receivedStatuses; @end @implementation IRRepeatableStatusStream -- (instancetype)initWithTransactionHash:(nonnull NSData*)transactionHash +- (instancetype)initWithTransactionHash:(nonnull NSData *)transactionHash streamingFrom:(nonnull id)streamable expecting:(IRTransactionStatus)transactionStatus maxTrials:(NSUInteger)trialsCount { @@ -67,7 +60,7 @@ - (void)performAttempt { _operation = [_streamable streamTransactionStatus:_transactionHash withBlock:eventHandler]; } -- (void)handle:(nullable id)response done:(BOOL)done error:(nullable NSError*)error { +- (void)handle:(nullable id)response done:(BOOL)done error:(nullable NSError *)error { if (response) { if ([_receivedStatuses containsObject:@(response.status)]) { @@ -113,7 +106,7 @@ - (BOOL)isFinal:(IRTransactionStatus)status { } } -- (nonnull NSError*)prepareNotReceivedError { +- (nonnull NSError *)prepareNotReceivedError { NSString *message = [NSString stringWithFormat:@"Received statuses [%@], but waited for %@. Streaming closed", [_receivedStatuses componentsJoinedByString:@","], @(_expectedTransactionStatus)]; return [NSError errorWithDomain:NSStringFromClass([IRRepeatableStatusStream class]) diff --git a/IrohaCommunication/Classes/Public/Service/IRTransactionStatusStreamable.h b/IrohaCommunication/Classes/Public/Service/IRTransactionStatusStreamable.h index d40a25bc0..22612cd19 100644 --- a/IrohaCommunication/Classes/Public/Service/IRTransactionStatusStreamable.h +++ b/IrohaCommunication/Classes/Public/Service/IRTransactionStatusStreamable.h @@ -13,7 +13,7 @@ typedef void (^IRTransactionStatusBlock)(id _Nullab @protocol IRTransactionStatusStreamable -- (nullable id)streamTransactionStatus:(nonnull NSData*)transactionHash +- (nullable id)streamTransactionStatus:(nonnull NSData *)transactionHash withBlock:(nonnull IRTransactionStatusBlock)block; @end diff --git a/ProtoGen/Block.pbobjc.h b/ProtoGen/Block.pbobjc.h index fc25404d9..4f39f04cf 100644 --- a/ProtoGen/Block.pbobjc.h +++ b/ProtoGen/Block.pbobjc.h @@ -104,7 +104,7 @@ typedef GPB_ENUM(Block_v1_Payload_FieldNumber) { * / Needed here to be able to guarantee the client that this transaction * / was not and will never be executed. **/ -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *rejectedTransactionsHashesArray; +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *rejectedTransactionsHashesArray; /** The number of items in @c rejectedTransactionsHashesArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger rejectedTransactionsHashesArray_Count; diff --git a/ProtoGen/QryResponses.pbobjc.h b/ProtoGen/QryResponses.pbobjc.h index 155538818..c4c99d8ca 100644 --- a/ProtoGen/QryResponses.pbobjc.h +++ b/ProtoGen/QryResponses.pbobjc.h @@ -252,7 +252,7 @@ typedef GPB_ENUM(AccountResponse_FieldNumber) { /** Test to see if @c account has been set. */ @property(nonatomic, readwrite) BOOL hasAccount; -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *accountRolesArray; +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *accountRolesArray; /** The number of items in @c accountRolesArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger accountRolesArray_Count; @@ -280,7 +280,7 @@ typedef GPB_ENUM(RolesResponse_FieldNumber) { @interface RolesResponse : GPBMessage -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *rolesArray; +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *rolesArray; /** The number of items in @c rolesArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger rolesArray_Count; @@ -339,7 +339,7 @@ typedef GPB_ENUM(SignatoriesResponse_FieldNumber) { @interface SignatoriesResponse : GPBMessage -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *keysArray; +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *keysArray; /** The number of items in @c keysArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger keysArray_Count; diff --git a/ProtoGen/Queries.pbobjc.h b/ProtoGen/Queries.pbobjc.h index 6947b474f..1ad9fe3a9 100644 --- a/ProtoGen/Queries.pbobjc.h +++ b/ProtoGen/Queries.pbobjc.h @@ -200,7 +200,7 @@ typedef GPB_ENUM(GetTransactions_FieldNumber) { @interface GetTransactions : GPBMessage -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *txHashesArray; +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *txHashesArray; /** The number of items in @c txHashesArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger txHashesArray_Count; diff --git a/ProtoGen/Transaction.pbobjc.h b/ProtoGen/Transaction.pbobjc.h index 3d20cafff..92f471384 100644 --- a/ProtoGen/Transaction.pbobjc.h +++ b/ProtoGen/Transaction.pbobjc.h @@ -133,7 +133,7 @@ typedef GPB_ENUM(Transaction_Payload_BatchMeta_FieldNumber) { @property(nonatomic, readwrite) Transaction_Payload_BatchMeta_BatchType type; /** array of reduced hashes of all txs from the batch */ -@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *reducedHashesArray; +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *reducedHashesArray; /** The number of items in @c reducedHashesArray without causing the array to be created. */ @property(nonatomic, readonly) NSUInteger reducedHashesArray_Count; diff --git a/Tests/Model/IRAccountIdTests.m b/Tests/Model/IRAccountIdTests.m index 287e6b5cc..87df9c531 100755 --- a/Tests/Model/IRAccountIdTests.m +++ b/Tests/Model/IRAccountIdTests.m @@ -7,7 +7,7 @@ @import IrohaCommunication; static const NSUInteger VALID_ACCOUNT_NAMES_COUNT = 5; -static NSString* const VALID_ACCOUNT_NAMES[] = { +static NSString * const VALID_ACCOUNT_NAMES[] = { @"bob", @"123", @"bob123bob123bob123bob123bob__123", @@ -16,7 +16,7 @@ }; static const NSUInteger INVALID_ACCOUNT_NAMES_COUNT = 5; -static NSString* const INVALID_ACCOUNT_NAMES[] = { +static NSString * const INVALID_ACCOUNT_NAMES[] = { @"", @"-", @"bOb", @@ -25,7 +25,7 @@ }; static const NSUInteger INVALID_ACCOUNT_IDENTIFIERS_COUNT = 4; -static NSString* const INVALID_ACCOUNT_IDENTIFIERS[] = { +static NSString * const INVALID_ACCOUNT_IDENTIFIERS[] = { @"", @"-", @"bOb@gmail.com", diff --git a/Tests/Model/IRAddressTests.m b/Tests/Model/IRAddressTests.m index 10bae3d9e..14d51e83b 100755 --- a/Tests/Model/IRAddressTests.m +++ b/Tests/Model/IRAddressTests.m @@ -7,7 +7,7 @@ @import IrohaCommunication; static const NSUInteger VALID_ADDRESSES_COUNT = 4; -static NSString* const VALID_IPV4[] = { +static NSString * const VALID_IPV4[] = { @"255.255.255.255", @"192.168.0.1", @"3.222.2.250", @@ -15,7 +15,7 @@ }; static const NSUInteger INVALID_ADDRESSES_COUNT = 5; -static NSString* const INVALID_IPV4[] = { +static NSString * const INVALID_IPV4[] = { @"", @"255.255.255", @"00.168.0.1", @@ -23,10 +23,10 @@ @"1.1111.1.1" }; -static NSString* const VALID_PORT = @"8080"; +static NSString * const VALID_PORT = @"8080"; static const NSUInteger INVALID_PORTS_COUNT = 4; -static NSString* const INVALID_PORTS[] = { +static NSString * const INVALID_PORTS[] = { @"", @"65356666", @"68678", diff --git a/Tests/Model/IRAssetIdTests.m b/Tests/Model/IRAssetIdTests.m index 97ea36419..794615818 100755 --- a/Tests/Model/IRAssetIdTests.m +++ b/Tests/Model/IRAssetIdTests.m @@ -7,7 +7,7 @@ @import IrohaCommunication; static const NSUInteger VALID_ASSET_NAMES_COUNT = 5; -static NSString* const VALID_ASSET_NAMES[] = { +static NSString * const VALID_ASSET_NAMES[] = { @"bob", @"123", @"bob123bob123bob123bob123bob__123", @@ -16,7 +16,7 @@ }; static const NSUInteger INVALID_ASSET_NAMES_COUNT = 5; -static NSString* const INVALID_ASSET_NAMES[] = { +static NSString * const INVALID_ASSET_NAMES[] = { @"", @"-", @"bOb", @@ -25,7 +25,7 @@ }; static const NSUInteger INVALID_ASSET_IDENTIFIERS_COUNT = 4; -static NSString* const INVALID_ASSET_IDENTIFIERS[] = { +static NSString * const INVALID_ASSET_IDENTIFIERS[] = { @"", @"-", @"bOb@gmail.com", diff --git a/Tests/Model/IRAssetPaginationTests.m b/Tests/Model/IRAssetPaginationTests.m index cd58f1248..2efff2cec 100644 --- a/Tests/Model/IRAssetPaginationTests.m +++ b/Tests/Model/IRAssetPaginationTests.m @@ -6,7 +6,7 @@ @import XCTest; @import IrohaCommunication; -static NSString* const ASSET_ID = @"test#test"; +static NSString * const ASSET_ID = @"test#test"; @interface IRAssetPaginationTests : XCTestCase diff --git a/Tests/Model/IRRoleNameTests.m b/Tests/Model/IRRoleNameTests.m index c33d74a52..84772070e 100755 --- a/Tests/Model/IRRoleNameTests.m +++ b/Tests/Model/IRRoleNameTests.m @@ -7,7 +7,7 @@ @import IrohaCommunication; static const NSUInteger VALID_ROLE_NAMES_COUNT = 6; -static NSString* const VALID_ROLE_NAMES[] = { +static NSString * const VALID_ROLE_NAMES[] = { @"test", @"admin", @"admin_test", @@ -17,7 +17,7 @@ }; static const NSUInteger INVALID_ROLE_NAMES_COUNT = 6; -static NSString* const INVALID_ROLE_NAMES[] = { +static NSString * const INVALID_ROLE_NAMES[] = { @"", @"a@dmin", @"admin-test", diff --git a/Tests/Promise/IRPromiseTests.m b/Tests/Promise/IRPromiseTests.m index ce343611f..49579eae3 100755 --- a/Tests/Promise/IRPromiseTests.m +++ b/Tests/Promise/IRPromiseTests.m @@ -93,7 +93,7 @@ - (void)testWithErrorFullfiled { }); } - currentPromise.onError(^IRPromise*(NSError* error) { + currentPromise.onError(^IRPromise*(NSError * error) { [expectation fulfill]; return nil; diff --git a/Tests/Query/IRQueryBuilderTests.m b/Tests/Query/IRQueryBuilderTests.m index 5ca515cbc..4ae19efeb 100755 --- a/Tests/Query/IRQueryBuilderTests.m +++ b/Tests/Query/IRQueryBuilderTests.m @@ -18,9 +18,9 @@ @interface IRQueryTestCase : NSObject -@property(nonatomic, readonly)SEL selector; -@property(nonatomic, readonly)NSArray *arguments; -@property(nonatomic, readonly)Protocol* protocol; +@property (nonatomic, readonly) SEL selector; +@property (nonatomic, readonly) NSArray *arguments; +@property (nonatomic, readonly) Protocol *protocol; @end diff --git a/Tests/Transaction/IRTransactionTests.m b/Tests/Transaction/IRTransactionTests.m index 0aadbae09..02f571554 100755 --- a/Tests/Transaction/IRTransactionTests.m +++ b/Tests/Transaction/IRTransactionTests.m @@ -164,7 +164,7 @@ - (void)testBatchInitialization { #pragma mark - Private -- (nullable id)createTransactionWithAllCommands:(NSError**)error { +- (nullable id)createTransactionWithAllCommands:(NSError **)error { id domain = [IRDomainFactory domainWithIdentitifer:VALID_DOMAIN error:nil]; id accountId = [IRAccountIdFactory accountIdWithName:VALID_ACCOUNT_NAME @@ -216,7 +216,7 @@ - (void)testBatchInitialization { - (nullable id)createSignedFromTransaction:(id)transaction keypair:(id)keypair - error:(NSError**)error { + error:(NSError **)error { id signatory = [[IREd25519Sha512Signer alloc] initWithPrivateKey:[keypair privateKey]]; return [transaction signedWithSignatories:@[signatory] From da5ab51576134dd567c66fc72e0bbdd7b29b493e Mon Sep 17 00:00:00 2001 From: Andrei Marin Date: Mon, 9 Sep 2019 11:39:00 +0300 Subject: [PATCH 5/8] pending transactions pagination Signed-off-by: Russel --- .../Classes/Private/IRQueryResponse+Proto.m | 49 ++++++++++++++++++- .../Queries/IRGetPendingTransactions.h | 3 ++ .../Queries/IRGetPendingTransactions.m | 19 +++++++ .../Private/Queries/IRGetTransactions.m | 2 + .../IRPendingTransactionsPageResponse.h | 18 +++++++ .../IRPendingTransactionsPageResponse.m | 30 ++++++++++++ .../Private/Responses/IRQueryResponseAll.h | 1 + .../Responses/IRTransactionsPageResponse.m | 4 +- .../Classes/Public/Builder/IRQueryBuilder.h | 3 +- .../Classes/Public/Builder/IRQueryBuilder.m | 8 ++- .../Classes/Public/Model/Common/IRBatchInfo.h | 16 ++++++ .../Classes/Public/Model/Common/IRBatchInfo.m | 29 +++++++++++ .../Classes/Public/Model/IRQuery.h | 3 ++ .../Classes/Public/Model/IRQueryResponse.h | 10 ++++ 14 files changed, 191 insertions(+), 4 deletions(-) create mode 100644 IrohaCommunication/Classes/Private/Responses/IRPendingTransactionsPageResponse.h create mode 100644 IrohaCommunication/Classes/Private/Responses/IRPendingTransactionsPageResponse.m create mode 100644 IrohaCommunication/Classes/Public/Model/Common/IRBatchInfo.h create mode 100644 IrohaCommunication/Classes/Public/Model/Common/IRBatchInfo.m diff --git a/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m b/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m index a44fbb098..02e25b014 100755 --- a/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m +++ b/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m @@ -9,6 +9,7 @@ #import "IrohaCrypto/NSData+Hex.h" #import "IRTransactionImpl+Proto.h" #import "Primitive.pbobjc.h" +#import "IRBatchInfo.h" @implementation IRQueryResponseProtoFactory @@ -90,6 +91,11 @@ @implementation IRQueryResponseProtoFactory queryHash:queryHash error:error]; break; + case QueryResponse_Response_OneOfCase_PendingTransactionsPageResponse: + return [self pendingTransactionPageResponseFromPbResponse:pbResponse.pendingTransactionsPageResponse + queryHash:queryHash + error:error]; + break; case QueryResponse_Response_OneOfCase_PeersResponse: return [self peersResponseFromPbResponse:pbResponse.peersResponse queryHash:queryHash error:error]; break; @@ -408,7 +414,48 @@ @implementation IRQueryResponseProtoFactory queryHash:queryHash]; } -+ (nullable NSArray>*)transactionsFromPbTransactions:(nonnull NSArray*)pbTransactions ++ (nullable id)pendingTransactionPageResponseFromPbResponse:(nonnull PendingTransactionsPageResponse *)pbResponse + queryHash:(nonnull NSData *)queryHash + error:(NSError **)error { + + NSArray> *transactions = [self transactionsFromPbTransactions:pbResponse.transactionsArray + error:error]; + + if (!transactions) { + if (error) { + NSString *message = [NSString stringWithFormat:@"Invalid transactions %@", pbResponse.transactionsArray]; + *error = [NSError errorWithDomain:NSStringFromClass([IRQueryResponseProtoFactory class]) + code:IRQueryResponseFactoryErrorInvalidAgrument + userInfo:@{NSLocalizedDescriptionKey: message}]; + } + return nil; + } + + IRBatchInfo *nextBatch = nil; + + if (pbResponse.nextBatchInfo && pbResponse.nextBatchInfo.batchSize > 0) { + nextBatch = [[IRBatchInfo alloc] initWithNextHash:pbResponse.nextBatchInfo.firstTxHash + batchSize:pbResponse.nextBatchInfo.batchSize]; + + if (!nextBatch) { + if (error) { + NSString *message = [NSString stringWithFormat:@"Invalid transaction batch info %@", pbResponse.nextBatchInfo]; + *error = [NSError errorWithDomain:NSStringFromClass([IRQueryResponseProtoFactory class]) + code:IRQueryResponseFactoryErrorInvalidAgrument + userInfo:@{NSLocalizedDescriptionKey: message}]; + } + + return nil; + } + } + + return [[IRPendingTransactionsPageResponse alloc] initWithTransactions:transactions + totalCount:pbResponse.allTransactionsSize + nextBatch:nextBatch + queryHash:queryHash]; +} + ++ (nullable NSArray> *)transactionsFromPbTransactions:(nonnull NSArray *)pbTransactions error:(NSError **)error { NSMutableArray> *transactions = [NSMutableArray array]; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetPendingTransactions.h b/IrohaCommunication/Classes/Private/Queries/IRGetPendingTransactions.h index 935f4f0f5..d8df7723a 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetPendingTransactions.h +++ b/IrohaCommunication/Classes/Private/Queries/IRGetPendingTransactions.h @@ -7,6 +7,9 @@ #import "IRQuery.h" #import "IRProtobufTransformable.h" + @interface IRGetPendingTransactions : NSObject +- (instancetype)initWithPagination:(nonnull id)pagination; + @end diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetPendingTransactions.m b/IrohaCommunication/Classes/Private/Queries/IRGetPendingTransactions.m index 3636bc364..79299e4e0 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetPendingTransactions.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetPendingTransactions.m @@ -5,13 +5,32 @@ #import "IRGetPendingTransactions.h" #import "Queries.pbobjc.h" +@import IrohaCrypto; @implementation IRGetPendingTransactions +@synthesize pagination = _pagination; + +- (instancetype)initWithPagination:(id)pagination { + if (self = [super init]) { + _pagination = pagination; + } + + return self; +} + #pragma mark - Protobuf Transformable - (nullable id)transform:(NSError **)error { GetPendingTransactions *query = [[GetPendingTransactions alloc] init]; + + if (_pagination) { + TxPaginationMeta *meta = [TxPaginationMeta new]; + meta.pageSize = _pagination.pageSize; + meta.firstTxHash = [_pagination.firstItemHash toHexString]; + + query.paginationMeta = meta; + } Query_Payload *payload = [[Query_Payload alloc] init]; payload.getPendingTransactions = query; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetTransactions.m b/IrohaCommunication/Classes/Private/Queries/IRGetTransactions.m index 0ac6622e1..8a5724bc6 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetTransactions.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetTransactions.m @@ -7,7 +7,9 @@ #import "Queries.pbobjc.h" #import + @implementation IRGetTransactions + @synthesize transactionHashes = _transactionHashes; - (nonnull instancetype)initWithTransactionHashes:(nonnull NSArray *)hashes { diff --git a/IrohaCommunication/Classes/Private/Responses/IRPendingTransactionsPageResponse.h b/IrohaCommunication/Classes/Private/Responses/IRPendingTransactionsPageResponse.h new file mode 100644 index 000000000..6163c562a --- /dev/null +++ b/IrohaCommunication/Classes/Private/Responses/IRPendingTransactionsPageResponse.h @@ -0,0 +1,18 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import +#import "IRQueryResponse.h" +#import "IRBatchInfo.h" + + +@interface IRPendingTransactionsPageResponse : NSObject + +- (nonnull instancetype)initWithTransactions:(nonnull NSArray> *)transactions + totalCount:(UInt32)totalCount + nextBatch:(nullable IRBatchInfo *)batchInfo + queryHash:(nonnull NSData *)queryHash; + +@end diff --git a/IrohaCommunication/Classes/Private/Responses/IRPendingTransactionsPageResponse.m b/IrohaCommunication/Classes/Private/Responses/IRPendingTransactionsPageResponse.m new file mode 100644 index 000000000..c54c6c0fe --- /dev/null +++ b/IrohaCommunication/Classes/Private/Responses/IRPendingTransactionsPageResponse.m @@ -0,0 +1,30 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import "IRPendingTransactionsPageResponse.h" + + +@implementation IRPendingTransactionsPageResponse + +@synthesize transactions = _transactions; +@synthesize totalCount = _totalCount; +@synthesize nextBatch = _nextBatch; +@synthesize queryHash = _queryHash; + +- (instancetype)initWithTransactions:(NSArray> *)transactions + totalCount:(UInt32)totalCount + nextBatch:(IRBatchInfo *)batchInfo + queryHash:(NSData *)queryHash { + if (self = [super init]) { + _transactions = transactions; + _totalCount = totalCount; + _nextBatch = batchInfo; + _queryHash = queryHash; + } + + return self; +} + +@end diff --git a/IrohaCommunication/Classes/Private/Responses/IRQueryResponseAll.h b/IrohaCommunication/Classes/Private/Responses/IRQueryResponseAll.h index add2ddaa0..40e8e5437 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRQueryResponseAll.h +++ b/IrohaCommunication/Classes/Private/Responses/IRQueryResponseAll.h @@ -11,6 +11,7 @@ #import "IRErrorResponse.h" #import "IRAssetResponse.h" #import "IRTransactionsPageResponse.h" +#import "IRPendingTransactionsPageResponse.h" #import "IRPeersResponse.h" #endif /* IRQueryResponseAll_h */ diff --git a/IrohaCommunication/Classes/Private/Responses/IRTransactionsPageResponse.m b/IrohaCommunication/Classes/Private/Responses/IRTransactionsPageResponse.m index 770274867..4b2f521c4 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRTransactionsPageResponse.m +++ b/IrohaCommunication/Classes/Private/Responses/IRTransactionsPageResponse.m @@ -5,13 +5,15 @@ #import "IRTransactionsPageResponse.h" + @implementation IRTransactionsPageResponse + @synthesize transactions = _transactions; @synthesize totalCount = _totalCount; @synthesize nextTransactionHash = _nextTransactionHash; @synthesize queryHash = _queryHash; -- (nonnull instancetype)initWithTransactions:(nonnull NSArray>*)transactions +- (nonnull instancetype)initWithTransactions:(nonnull NSArray> *)transactions totalCount:(UInt32)totalCount nextTransactionHash:(nullable NSData *)nextTransactionHash queryHash:(nonnull NSData *)queryHash { diff --git a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h index 4bba073d7..a4aa07e12 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h +++ b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h @@ -57,7 +57,8 @@ typedef NS_ENUM(NSUInteger, IRQueryBuilderError) { - (nonnull instancetype)getAssetInfo:(nonnull id)assetId; -- (nonnull instancetype)getPendingTransactions; +- (nonnull instancetype)getPendingTransactions DEPRECATED_MSG_ATTRIBUTE("use getPendingTransactions:"); +- (nonnull instancetype)getPendingTransactions:(nonnull id)pagination; - (nonnull instancetype)getPeers; diff --git a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m index dce87ba0f..1cb4bd2c9 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m +++ b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m @@ -125,7 +125,13 @@ - (nonnull instancetype)getPendingTransactions { return [self withQuery:query]; } --(nonnull instancetype)getPeers { +- (nonnull instancetype)getPendingTransactions:(nonnull id)pagination { + id query = [[IRGetPendingTransactions alloc] initWithPagination:pagination]; + + return [self withQuery:query]; +} + +- (nonnull instancetype)getPeers { id query = [IRGetPeers new]; return [self withQuery:query]; diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRBatchInfo.h b/IrohaCommunication/Classes/Public/Model/Common/IRBatchInfo.h new file mode 100644 index 000000000..5e04e7a2b --- /dev/null +++ b/IrohaCommunication/Classes/Public/Model/Common/IRBatchInfo.h @@ -0,0 +1,16 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import + + +@interface IRBatchInfo : NSObject + +@property (nonatomic, readonly) NSString *nextHash; +@property (nonatomic, readonly) UInt32 batchSize; + +- (instancetype)initWithNextHash:(NSString *)nextHash batchSize:(UInt32)batchSize; + +@end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRBatchInfo.m b/IrohaCommunication/Classes/Public/Model/Common/IRBatchInfo.m new file mode 100644 index 000000000..982fba9dc --- /dev/null +++ b/IrohaCommunication/Classes/Public/Model/Common/IRBatchInfo.m @@ -0,0 +1,29 @@ +/** + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#import "IRBatchInfo.h" + + +@interface IRBatchInfo () + +@property (nonatomic, strong) NSString *nextHash; +@property (nonatomic, assign) UInt32 batchSize; + + +@end + + +@implementation IRBatchInfo + +- (instancetype)initWithNextHash:(NSString *)nextHash batchSize:(UInt32)batchSize { + if (self = [super init]) { + _nextHash = nextHash; + _batchSize = batchSize; + } + + return self; +} + +@end diff --git a/IrohaCommunication/Classes/Public/Model/IRQuery.h b/IrohaCommunication/Classes/Public/Model/IRQuery.h index 9a078ef5d..30ec370fb 100755 --- a/IrohaCommunication/Classes/Public/Model/IRQuery.h +++ b/IrohaCommunication/Classes/Public/Model/IRQuery.h @@ -93,6 +93,9 @@ @protocol IRGetPendingTransactions + +@property (nonatomic, readonly, nullable) id pagination; + @end diff --git a/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h b/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h index df9698365..3e437e1ca 100755 --- a/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h +++ b/IrohaCommunication/Classes/Public/Model/IRQueryResponse.h @@ -14,6 +14,7 @@ #import "IrohaCrypto/IRPublicKey.h" #import "IRAccountDetailRecordId.h" #import "IRPeer.h" +#import "IRBatchInfo.h" @protocol IRQueryResponse @@ -118,6 +119,15 @@ typedef NS_ENUM(NSUInteger, IRErrorResponseReason) { @end +@protocol IRPendingTransactionsPageResponse + +@property (nonatomic, readonly, nonnull) NSArray> *transactions; +@property (nonatomic, readonly) UInt32 totalCount; +@property (nonatomic, readonly, nullable) IRBatchInfo *nextBatch; + +@end + + @protocol IRPeersResponse @property (nonatomic, readonly) NSArray> * _Nonnull peers; From e88bf553db72cba54be584c9ecf17158472b5c73 Mon Sep 17 00:00:00 2001 From: Russel Date: Thu, 12 Sep 2019 00:30:35 +0300 Subject: [PATCH 6/8] fix account details interface and tests Signed-off-by: Russel --- Example/Podfile.lock | 2 +- .../Private/Queries/IRGetAccountDetail.h | 5 +-- .../Private/Queries/IRGetAccountDetail.m | 43 ++++++------------- .../Classes/Public/Builder/IRQueryBuilder.h | 7 +-- .../Classes/Public/Builder/IRQueryBuilder.m | 12 +++--- .../Classes/Public/Model/IRQuery.h | 6 +-- Tests/Model/IRAccountDetailPaginationTests.m | 6 ++- Tests/Query/IRQueryBuilderTests.m | 12 +++--- 8 files changed, 37 insertions(+), 56 deletions(-) diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 519f67fcb..f17e4b2a4 100755 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -69,4 +69,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 29089a97c3781ec366ef8266addf4289525ff849 -COCOAPODS: 1.6.1 +COCOAPODS: 1.7.5 diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h index 98bac944a..7feb6305a 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h @@ -10,9 +10,6 @@ @interface IRGetAccountDetail : NSObject - (nonnull instancetype)initWithAccountId:(nullable id)accountId - writer:(nullable id)writer - key:(nullable NSString *)key; - -- (nonnull instancetype)initWithPagination:(nonnull id)pagination; + pagination:(nonnull id)pagination; @end diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m index cc2a1ad70..6085344a2 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m @@ -10,52 +10,33 @@ @implementation IRGetAccountDetail @synthesize accountId = _accountId; -@synthesize writer = _writer; -@synthesize key = _key; @synthesize pagination = _pagination; - (nonnull instancetype)initWithAccountId:(nullable id)accountId - writer:(nullable id)writer - key:(nullable NSString *)key { + pagination:(nonnull id)pagination { if (self = [super init]) { _accountId = accountId; - _writer = writer; - _key = key; - } - - return self; -} - -- (nonnull instancetype)initWithPagination:(nonnull id)pagination { - - if (self = [super init]) { _pagination = pagination; } - + return self; } - #pragma mark - Protobuf Transformable - (nullable id)transform:(NSError **)error { GetAccountDetail *query = [GetAccountDetail new]; - if (_pagination) { - AccountDetailRecordId *recordId = [AccountDetailRecordId new]; - recordId.writer = _pagination.nextRecordId.writer; - recordId.key = _pagination.nextRecordId.key; - - AccountDetailPaginationMeta *meta = [AccountDetailPaginationMeta new]; - meta.pageSize = _pagination.pageSize; - meta.firstRecordId = recordId; - - query.paginationMeta = meta; - } else { - query.accountId = [_accountId identifier]; - query.writer = [_writer identifier]; - query.key = _key; - } + AccountDetailRecordId *recordId = [AccountDetailRecordId new]; + recordId.writer = _pagination.nextRecordId.writer; + recordId.key = _pagination.nextRecordId.key; + + AccountDetailPaginationMeta *meta = [AccountDetailPaginationMeta new]; + meta.pageSize = _pagination.pageSize; + meta.firstRecordId = recordId; + + query.accountId = [_accountId identifier]; + query.paginationMeta = meta; Query_Payload *payload = [Query_Payload new]; payload.getAccountDetail = query; diff --git a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h index a4aa07e12..da1c670fe 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h +++ b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h @@ -46,10 +46,11 @@ typedef NS_ENUM(NSUInteger, IRQueryBuilderError) { pagination:(nullable id)pagination; - (nonnull instancetype)getAccountDetail:(nullable id)accountId - writer:(nullable id)writer - key:(nullable NSString *)key; + writer:(nonnull NSString *)writer + key:(nonnull NSString *)key; -- (nonnull instancetype)getAccountDetailWithPagination:(nonnull id)pagination; +- (nonnull instancetype)getAccountDetail:(nullable id)accountId + pagination:(nonnull id)pagination; - (nonnull instancetype)getRoles; diff --git a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m index 1cb4bd2c9..a86af3029 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m +++ b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m @@ -85,17 +85,19 @@ - (nonnull instancetype)getAccountAssets:(nonnull id)accountId } - (nonnull instancetype)getAccountDetail:(nullable id)accountId - writer:(nullable id)writer - key:(nullable NSString *)key { + writer:(nonnull NSString *)writer + key:(nonnull NSString *)key { id record = [IRAccountDetailRecordIdFactory accountDetailRecordIdWithWriter:writer key:key]; id pagination = [IRAccountDetailPaginationFactory accountDetailPagination:1 nextRecordId:record]; - return [self getAccountDetailWithPagination:pagination]; + return [self getAccountDetail:accountId pagination:pagination]; } -- (nonnull instancetype)getAccountDetailWithPagination:(id)pagination { - id query = [[IRGetAccountDetail alloc] initWithPagination:pagination]; +- (nonnull instancetype)getAccountDetail:(nullable id)accountId + pagination:(nonnull id)pagination { + id query = [[IRGetAccountDetail alloc] initWithAccountId:accountId + pagination:pagination]; return [self withQuery:query]; } diff --git a/IrohaCommunication/Classes/Public/Model/IRQuery.h b/IrohaCommunication/Classes/Public/Model/IRQuery.h index 30ec370fb..6906cf381 100755 --- a/IrohaCommunication/Classes/Public/Model/IRQuery.h +++ b/IrohaCommunication/Classes/Public/Model/IRQuery.h @@ -67,9 +67,9 @@ @protocol IRGetAccountDetail @property (nonatomic, readonly) id _Nullable accountId; -@property (nonatomic, readonly) id _Nullable writer; -@property (nonatomic, readonly) NSString * _Nullable key; -@property (nonatomic, readonly) id _Nullable pagination; +@property (nonatomic, readonly) id _Nullable writer DEPRECATED_ATTRIBUTE; +@property (nonatomic, readonly) NSString * _Nullable key DEPRECATED_ATTRIBUTE; +@property (nonatomic, readonly) id _Nonnull pagination; @end diff --git a/Tests/Model/IRAccountDetailPaginationTests.m b/Tests/Model/IRAccountDetailPaginationTests.m index ac0152ac2..fd543ac0a 100644 --- a/Tests/Model/IRAccountDetailPaginationTests.m +++ b/Tests/Model/IRAccountDetailPaginationTests.m @@ -34,9 +34,11 @@ - (void)testNonnilStartingRecordId { - (void)testNilStartingRecordId { UInt32 pageSize = 10; - + + id recordId = nil; + id pagination = [IRAccountDetailPaginationFactory accountDetailPagination:pageSize - nextRecordId:nil]; + nextRecordId:recordId]; XCTAssertNil(pagination); } diff --git a/Tests/Query/IRQueryBuilderTests.m b/Tests/Query/IRQueryBuilderTests.m index 4ae19efeb..b74d5611f 100755 --- a/Tests/Query/IRQueryBuilderTests.m +++ b/Tests/Query/IRQueryBuilderTests.m @@ -13,7 +13,7 @@ static NSString * const VALID_ROLE = @"admin"; static NSString * const DETAIL_KEY = @"key"; static UInt64 VALID_QUERY_COUNTER = 10; -static UInt64 DETAIL_PAGE_SIZE = 10; +static UInt32 DETAIL_PAGE_SIZE = 10; @interface IRQueryTestCase : NSObject @@ -146,8 +146,6 @@ - (void)testQueries { id assetPagination = [IRAssetPaginationFactory assetPagination:DETAIL_PAGE_SIZE startingAssetId:assetId]; - NSString - id accountDetailRecordId = [IRAccountDetailRecordIdFactory accountDetailRecordIdWithWriter:VALID_WRITER_IDENTIFIER key:DETAIL_KEY]; @@ -184,12 +182,12 @@ - (void)testQueries { arguments:@[accountId, assetPagination] protocol:@protocol(IRGetAccountAssets)]; - IRQueryTestCase *getAccountDetail = [[IRQueryTestCase alloc] initWithSelector:@selector(getAccountDetail:writer:key:) - arguments:@[accountId, accountId] + IRQueryTestCase *getAccountDetail = [[IRQueryTestCase alloc] initWithSelector:@selector(getAccountDetail:pagination:) + arguments:@[accountId, accountDetailPagination] protocol:@protocol(IRGetAccountDetail)]; - IRQueryTestCase *getAccountDetailPaginated = [[IRQueryTestCase alloc] initWithSelector:@selector(getAccountDetail:writer:key:pagination:) - arguments:@[accountId, accountId, DETAIL_KEY, accountDetailPagination] + IRQueryTestCase *getAccountDetailPaginated = [[IRQueryTestCase alloc] initWithSelector:@selector(getAccountDetail:writer:key:) + arguments:@[accountId, [accountId identifier], DETAIL_KEY] protocol:@protocol(IRGetAccountDetail)]; IRQueryTestCase *getRoles = [[IRQueryTestCase alloc] initWithSelector:@selector(getRoles) From e41582387cef9da76857c7e88f2bb715102da77a Mon Sep 17 00:00:00 2001 From: Russel Date: Thu, 12 Sep 2019 23:57:52 +0300 Subject: [PATCH 7/8] fix integration tests Signed-off-by: Russel --- .../IrohaContainer/IRIrohaContainer.m | 4 +- .../IRAccountRestoreWithBatchTest.m | 30 ++++----- .../Scenarious/IRCreateRoleTest.m | 4 +- .../Scenarious/IRGetAccountDetailTest.m | 67 +++++-------------- .../Classes/Private/IRQueryResponse+Proto.m | 6 -- .../Classes/Public/Builder/IRQueryBuilder.m | 6 +- .../Public/Builder/IRTransactionBuilder.m | 4 +- .../Classes/Public/Model/Common/IRBatchInfo.h | 4 +- .../Classes/Public/Model/Common/IRBatchInfo.m | 4 +- 9 files changed, 43 insertions(+), 86 deletions(-) diff --git a/IntegrationTests/IrohaContainer/IRIrohaContainer.m b/IntegrationTests/IrohaContainer/IRIrohaContainer.m index 35a5358b5..ba8673573 100755 --- a/IntegrationTests/IrohaContainer/IRIrohaContainer.m +++ b/IntegrationTests/IrohaContainer/IRIrohaContainer.m @@ -17,8 +17,8 @@ @interface IRIrohaContainer() -@property (nonatomic, strong) NSURLSession *session; -@property (nonatomic, strong) IRNetworkService *irohaService; +@property (strong, nonatomic) NSURLSession *session; +@property (strong, nonatomic) IRNetworkService *irohaService; @end diff --git a/IntegrationTests/Scenarious/IRAccountRestoreWithBatchTest.m b/IntegrationTests/Scenarious/IRAccountRestoreWithBatchTest.m index 1bb4035d3..26e1f1f69 100644 --- a/IntegrationTests/Scenarious/IRAccountRestoreWithBatchTest.m +++ b/IntegrationTests/Scenarious/IRAccountRestoreWithBatchTest.m @@ -43,31 +43,31 @@ - (void)testAccountRestoreScenarioWithoutBatch { return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted withHash:result from:self.iroha]; - }).onThen(^IRPromise* _Nullable (id result) { + }).onThen(^IRPromise * _Nullable (id result) { return [self createAccounts]; - }).onThen(^IRPromise* _Nullable (id result) { + }).onThen(^IRPromise * _Nullable (id result) { return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted withHash:result from:self.iroha]; - }).onThen(^IRPromise* _Nullable (id result) { + }).onThen(^IRPromise * _Nullable (id result) { return [self grandClientToRecoveryPermissions]; - }).onThen(^IRPromise* _Nullable (id result) { + }).onThen(^IRPromise * _Nullable (id result) { return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted withHash:result from:self.iroha]; - }).onThen(^IRPromise* _Nullable (id result) { + }).onThen(^IRPromise * _Nullable (id result) { return [self grandRecoveryToAdminPermissions]; - }).onThen(^IRPromise* _Nullable (id result) { + }).onThen(^IRPromise * _Nullable (id result) { return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted withHash:result from:self.iroha]; - }).onThen(^IRPromise* _Nullable (id result) { + }).onThen(^IRPromise * _Nullable (id result) { return [self setupRecoveryAccount]; - }).onThen(^IRPromise* _Nullable (id result) { + }).onThen(^IRPromise * _Nullable (id result) { return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted withHash:result from:self.iroha]; - }).onThen(^IRPromise* _Nullable (id result) { + }).onThen(^IRPromise * _Nullable (id result) { [expectation fulfill]; return nil; @@ -85,27 +85,27 @@ - (void)testAccountRestoreScenarioWithoutBatch { - (void)testAccountRestoreScenarioWithBatch { XCTestExpectation *expectation = [[XCTestExpectation alloc] init]; - [self createDomains].onThen(^IRPromise* _Nullable (id result) { + [self createDomains].onThen(^IRPromise * _Nullable (id result) { return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted withHash:result from:self.iroha]; - }).onThen(^IRPromise* _Nullable (id result) { + }).onThen(^IRPromise * _Nullable (id result) { return [self createAccounts]; }).onThen(^IRPromise* _Nullable (id result) { return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted withHash:result from:self.iroha]; - }).onThen(^IRPromise* _Nullable (id result) { + }).onThen(^IRPromise * _Nullable (id result) { return [self sendRecoverySetupBatch]; - }).onThen(^IRPromise* _Nullable (id result) { + }).onThen(^IRPromise * _Nullable (id result) { return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted withHash:[result objectAtIndex:0] from:self.iroha]; - }).onThen(^IRPromise* _Nullable (id result) { + }).onThen(^IRPromise * _Nullable (id result) { [expectation fulfill]; return nil; - }).onError(^IRPromise* _Nullable (NSError * error) { + }).onError(^IRPromise * _Nullable (NSError *error) { XCTFail(@"%@", error); [expectation fulfill]; diff --git a/IntegrationTests/Scenarious/IRCreateRoleTest.m b/IntegrationTests/Scenarious/IRCreateRoleTest.m index f929673a7..674e3fed7 100755 --- a/IntegrationTests/Scenarious/IRCreateRoleTest.m +++ b/IntegrationTests/Scenarious/IRCreateRoleTest.m @@ -14,7 +14,7 @@ @implementation IRCreateRoleTest - (void)testCreateRoleRejected { NSError *error = nil; - id role = [IRRoleNameFactory roleWithName:@"superadmcdddintest" error:&error]; + id role = [IRRoleNameFactory roleWithName:@"superadmintest" error:&error]; if (error) { XCTFail(); @@ -24,7 +24,7 @@ - (void)testCreateRoleRejected { NSArray>* permissions = @[ [IRRolePermissionFactory canAddSignatory], [IRRolePermissionFactory canRemoveSignatory], -// [IRRolePermissionFactory canSetQuorum] + [IRRolePermissionFactory canSetQuorum] ]; IRTransactionBuilder *transactionBuilder = [IRTransactionBuilder builderWithCreatorAccountId:self.adminAccountId]; diff --git a/IntegrationTests/Scenarious/IRGetAccountDetailTest.m b/IntegrationTests/Scenarious/IRGetAccountDetailTest.m index 93383b04d..b27114596 100644 --- a/IntegrationTests/Scenarious/IRGetAccountDetailTest.m +++ b/IntegrationTests/Scenarious/IRGetAccountDetailTest.m @@ -14,28 +14,23 @@ @interface IRGetAccountDetailTest : IRBaseIrohaContainerTests @implementation IRGetAccountDetailTest - (void)testGetAccountDetailInSeveralPages { - id newAccountId = [IRAccountIdFactory accountIdWithName:@"new" - domain:self.domain - error:nil]; - - id keypair = [[[IREd25519KeyFactory alloc] init] createRandomKeypair]; - - id newAccountSigner = [[IREd25519Sha512Signer alloc] initWithPrivateKey:keypair.privateKey]; - - IRTransactionBuilder *builder = [IRTransactionBuilder builderWithCreatorAccountId:self.adminAccountId]; - builder = [builder createAccount:newAccountId publicKey:keypair.publicKey]; - - NSError *error = nil; - id transaction = [[builder build:&error] signedWithSignatories:@[self.adminSigner] - signatoryPublicKeys:@[self.adminPublicKey] - error:&error]; - NSString *firstDetailKey = @"key"; NSString *firstDetailValue = @"value"; NSString *secondDetailKey = @"otherkey"; NSString *secondDetailValue = @"othervalue"; - + + IRTransactionBuilder *transactionBuilder = [IRTransactionBuilder builderWithCreatorAccountId:self.adminAccountId]; + transactionBuilder = [transactionBuilder setAccountDetail:self.adminAccountId key:firstDetailKey + value:firstDetailValue]; + transactionBuilder = [transactionBuilder setAccountDetail:self.adminAccountId key:secondDetailKey + value:secondDetailValue]; + + NSError *error = nil; + id transaction = [[transactionBuilder build:&error] signedWithSignatories:@[self.adminSigner] + signatoryPublicKeys:@[self.adminPublicKey] + error:&error]; + if (!transaction) { XCTFail(); return; @@ -43,47 +38,15 @@ - (void)testGetAccountDetailInSeveralPages { XCTestExpectation *expectation = [[XCTestExpectation alloc] init]; - UInt32 quorum = 2; - [self.iroha executeTransaction:transaction].onThen(^IRPromise * _Nullable(id result) { return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted withHash:result from:self.iroha]; - }).onThen(^IRPromise * _Nullable(id result) { - IRTransactionBuilder *transactionBuilder = [IRTransactionBuilder builderWithCreatorAccountId:newAccountId]; - transactionBuilder = [transactionBuilder addSignatory:newAccountId publicKey:self.adminPublicKey]; - transactionBuilder = [transactionBuilder setAccountQuorum:newAccountId quorum:quorum]; - - NSError *error = nil; - id transaction = [[transactionBuilder build:&error] signedWithSignatories:@[newAccountSigner] - signatoryPublicKeys:@[keypair.publicKey] - error:&error]; - - return [self.iroha executeTransaction:transaction]; - }).onThen(^IRPromise * _Nullable(id result) { - return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted - withHash:result - from:self.iroha]; - }).onThen(^IRPromise * _Nullable(id result) { - IRTransactionBuilder *transactionBuilder = [IRTransactionBuilder builderWithCreatorAccountId:newAccountId]; - transactionBuilder = [transactionBuilder setAccountDetail:self.adminAccountId key:firstDetailKey - value:firstDetailValue]; - transactionBuilder = [transactionBuilder setAccountDetail:self.adminAccountId key:secondDetailKey - value:secondDetailValue]; - - NSError *error = nil; - id transaction = [[transactionBuilder build:&error] signedWithSignatories:@[newAccountSigner] - signatoryPublicKeys:@[keypair.publicKey] - error:&error]; - - return [self.iroha executeTransaction:transaction]; - }).onThen(^IRPromise * _Nullable(id result) { - return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted - withHash:result - from:self.iroha]; }).onThen(^IRPromise * _Nullable(id result) { IRQueryBuilder *queryBuilder = [IRQueryBuilder builderWithCreatorAccountId:self.adminAccountId]; - queryBuilder = [queryBuilder getAccountDetail:newAccountId writer:nil key:nil]; + queryBuilder = [queryBuilder getAccountDetail:self.adminAccountId + writer:[self.adminAccountId identifier] + key:firstDetailKey]; NSError *queryError = nil; id queryRequest = [[queryBuilder build:&queryError] signedWithSignatory:self.adminSigner diff --git a/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m b/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m index 02e25b014..317f026d1 100755 --- a/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m +++ b/IrohaCommunication/Classes/Private/IRQueryResponse+Proto.m @@ -422,12 +422,6 @@ @implementation IRQueryResponseProtoFactory error:error]; if (!transactions) { - if (error) { - NSString *message = [NSString stringWithFormat:@"Invalid transactions %@", pbResponse.transactionsArray]; - *error = [NSError errorWithDomain:NSStringFromClass([IRQueryResponseProtoFactory class]) - code:IRQueryResponseFactoryErrorInvalidAgrument - userInfo:@{NSLocalizedDescriptionKey: message}]; - } return nil; } diff --git a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m index a86af3029..4f185b34c 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m +++ b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m @@ -11,9 +11,9 @@ @interface IRQueryBuilder() -@property (nonatomic, strong) id _Nullable creator; -@property (nonatomic, strong) NSDate * _Nullable createdAt; -@property (nonatomic, strong) id _Nullable query; +@property (strong, nonatomic) id _Nullable creator; +@property (strong, nonatomic) NSDate * _Nullable createdAt; +@property (strong, nonatomic) id _Nullable query; @property (nonatomic, readwrite) UInt64 queryCounter; @end diff --git a/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.m b/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.m index a02f195ab..19f137e03 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.m +++ b/IrohaCommunication/Classes/Public/Builder/IRTransactionBuilder.m @@ -12,10 +12,10 @@ @interface IRTransactionBuilder () -@property (nonatomic, strong) id accountId; +@property (strong, nonatomic) id accountId; @property (strong, readwrite) NSDate *date; @property (nonatomic, readwrite) NSUInteger quorum; -@property (nonatomic, strong) NSMutableArray> *commands; +@property (strong, nonatomic) NSMutableArray> *commands; @end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRBatchInfo.h b/IrohaCommunication/Classes/Public/Model/Common/IRBatchInfo.h index 5e04e7a2b..d3cd1fac4 100644 --- a/IrohaCommunication/Classes/Public/Model/Common/IRBatchInfo.h +++ b/IrohaCommunication/Classes/Public/Model/Common/IRBatchInfo.h @@ -8,9 +8,9 @@ @interface IRBatchInfo : NSObject -@property (nonatomic, readonly) NSString *nextHash; +@property (nonatomic, readonly, nonnull) NSString *nextHash; @property (nonatomic, readonly) UInt32 batchSize; -- (instancetype)initWithNextHash:(NSString *)nextHash batchSize:(UInt32)batchSize; +- (nonnull instancetype)initWithNextHash:(nonnull NSString *)nextHash batchSize:(UInt32)batchSize; @end diff --git a/IrohaCommunication/Classes/Public/Model/Common/IRBatchInfo.m b/IrohaCommunication/Classes/Public/Model/Common/IRBatchInfo.m index 982fba9dc..eca6af033 100644 --- a/IrohaCommunication/Classes/Public/Model/Common/IRBatchInfo.m +++ b/IrohaCommunication/Classes/Public/Model/Common/IRBatchInfo.m @@ -8,7 +8,7 @@ @interface IRBatchInfo () -@property (nonatomic, strong) NSString *nextHash; +@property (strong, nonatomic, nonnull) NSString *nextHash; @property (nonatomic, assign) UInt32 batchSize; @@ -17,7 +17,7 @@ @interface IRBatchInfo () @implementation IRBatchInfo -- (instancetype)initWithNextHash:(NSString *)nextHash batchSize:(UInt32)batchSize { +- (nonnull instancetype)initWithNextHash:(nonnull NSString *)nextHash batchSize:(UInt32)batchSize { if (self = [super init]) { _nextHash = nextHash; _batchSize = batchSize; From 448fe78d5c6338db2b5d0fd2de78547b01b02ceb Mon Sep 17 00:00:00 2001 From: Russel Date: Fri, 13 Sep 2019 01:56:33 +0300 Subject: [PATCH 8/8] fix get account details compatability Signed-off-by: Russel --- .../Scenarious/IRGetAccountDetailTest.m | 77 ++++++++++++++++++- .../Private/Queries/IRGetAccountDetail.h | 4 + .../Private/Queries/IRGetAccountDetail.m | 39 +++++++--- .../Queries/IRGetPendingTransactions.h | 2 +- .../Responses/IRAccountDetailResponse.m | 2 +- .../Classes/Public/Builder/IRQueryBuilder.h | 2 +- .../Classes/Public/Builder/IRQueryBuilder.m | 9 +-- .../Classes/Public/Model/IRQuery.h | 4 +- 8 files changed, 117 insertions(+), 22 deletions(-) diff --git a/IntegrationTests/Scenarious/IRGetAccountDetailTest.m b/IntegrationTests/Scenarious/IRGetAccountDetailTest.m index b27114596..988d71c08 100644 --- a/IntegrationTests/Scenarious/IRGetAccountDetailTest.m +++ b/IntegrationTests/Scenarious/IRGetAccountDetailTest.m @@ -44,9 +44,12 @@ - (void)testGetAccountDetailInSeveralPages { from:self.iroha]; }).onThen(^IRPromise * _Nullable(id result) { IRQueryBuilder *queryBuilder = [IRQueryBuilder builderWithCreatorAccountId:self.adminAccountId]; + id recordId = [IRAccountDetailRecordIdFactory accountDetailRecordIdWithWriter:[self.adminAccountId identifier] + key:firstDetailKey]; + id pagination = [IRAccountDetailPaginationFactory accountDetailPagination:1 + nextRecordId:recordId]; queryBuilder = [queryBuilder getAccountDetail:self.adminAccountId - writer:[self.adminAccountId identifier] - key:firstDetailKey]; + pagination:pagination]; NSError *queryError = nil; id queryRequest = [[queryBuilder build:&queryError] signedWithSignatory:self.adminSigner @@ -80,5 +83,75 @@ - (void)testGetAccountDetailInSeveralPages { [self waitForExpectations:@[expectation] timeout:120.0]; } +- (void)testGetAccountDetailCompatability { + NSString *firstDetailKey = @"key"; + NSString *firstDetailValue = @"value"; + + NSString *secondDetailKey = @"otherkey"; + NSString *secondDetailValue = @"othervalue"; + + IRTransactionBuilder *transactionBuilder = [IRTransactionBuilder builderWithCreatorAccountId:self.adminAccountId]; + transactionBuilder = [transactionBuilder setAccountDetail:self.adminAccountId key:firstDetailKey + value:firstDetailValue]; + transactionBuilder = [transactionBuilder setAccountDetail:self.adminAccountId key:secondDetailKey + value:secondDetailValue]; + + NSError *error = nil; + id transaction = [[transactionBuilder build:&error] signedWithSignatories:@[self.adminSigner] + signatoryPublicKeys:@[self.adminPublicKey] + error:&error]; + + if (!transaction) { + XCTFail(); + return; + } + + XCTestExpectation *expectation = [[XCTestExpectation alloc] init]; + + [self.iroha executeTransaction:transaction].onThen(^IRPromise * _Nullable(id result) { + return [IRRepeatableStatusStream onTransactionStatus:IRTransactionStatusCommitted + withHash:result + from:self.iroha]; + }).onThen(^IRPromise * _Nullable(id result) { + IRQueryBuilder *queryBuilder = [IRQueryBuilder builderWithCreatorAccountId:self.adminAccountId]; + + queryBuilder = [queryBuilder getAccountDetail:self.adminAccountId + writer:[self.adminAccountId identifier] + key:firstDetailKey]; + + NSError *queryError = nil; + id queryRequest = [[queryBuilder build:&queryError] signedWithSignatory:self.adminSigner + signatoryPublicKey:self.adminPublicKey + error:&queryError]; + + return [self.iroha executeQueryRequest:queryRequest]; + }).onThen(^IRPromise * _Nullable(id result) { + NSLog(@"%@", result); + if (![result conformsToProtocol:@protocol(IRAccountDetailResponse)]) { + XCTFail(); + } else { + id detailResponse = result; + + NSString *expectedDetails = [NSString stringWithFormat:@"{ \"%@\" : { \"%@\" : \"%@\" } }", + [self.adminAccountId identifier], firstDetailKey, firstDetailValue]; + + XCTAssertEqualObjects(detailResponse.detail, expectedDetails); + } + + [expectation fulfill]; + + return nil; + }).onError(^IRPromise * _Nullable(NSError * error) { + XCTFail(); + NSLog(@"%@",error); + + [expectation fulfill]; + + return nil; + }); + + [self waitForExpectations:@[expectation] timeout:120.0]; +} + @end diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h index 7feb6305a..ea1951482 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.h @@ -9,6 +9,10 @@ @interface IRGetAccountDetail : NSObject +- (nonnull instancetype)initWithAccountId:(nullable id)accountId + writer:(nonnull NSString*)writer + key:(nonnull NSString*)key; + - (nonnull instancetype)initWithAccountId:(nullable id)accountId pagination:(nonnull id)pagination; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m index 6085344a2..df6b41c7c 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m +++ b/IrohaCommunication/Classes/Private/Queries/IRGetAccountDetail.m @@ -11,6 +11,20 @@ @implementation IRGetAccountDetail @synthesize accountId = _accountId; @synthesize pagination = _pagination; +@synthesize writer = _writer; +@synthesize key = _key; + +- (nonnull instancetype)initWithAccountId:(nullable id)accountId + writer:(nonnull NSString*)writer + key:(nonnull NSString*)key { + if (self = [super init]) { + _accountId = accountId; + _writer = writer; + _key = key; + } + + return self; +} - (nonnull instancetype)initWithAccountId:(nullable id)accountId pagination:(nonnull id)pagination { @@ -26,18 +40,23 @@ - (nonnull instancetype)initWithAccountId:(nullable id)accountId - (nullable id)transform:(NSError **)error { GetAccountDetail *query = [GetAccountDetail new]; - - AccountDetailRecordId *recordId = [AccountDetailRecordId new]; - recordId.writer = _pagination.nextRecordId.writer; - recordId.key = _pagination.nextRecordId.key; + query.accountId = [_accountId identifier]; - AccountDetailPaginationMeta *meta = [AccountDetailPaginationMeta new]; - meta.pageSize = _pagination.pageSize; - meta.firstRecordId = recordId; + if (_pagination != nil) { + AccountDetailRecordId *recordId = [AccountDetailRecordId new]; + recordId.writer = _pagination.nextRecordId.writer; + recordId.key = _pagination.nextRecordId.key; + + AccountDetailPaginationMeta *meta = [AccountDetailPaginationMeta new]; + meta.pageSize = _pagination.pageSize; + meta.firstRecordId = recordId; + + query.paginationMeta = meta; + } else { + query.writer = _writer; + query.key = _key; + } - query.accountId = [_accountId identifier]; - query.paginationMeta = meta; - Query_Payload *payload = [Query_Payload new]; payload.getAccountDetail = query; diff --git a/IrohaCommunication/Classes/Private/Queries/IRGetPendingTransactions.h b/IrohaCommunication/Classes/Private/Queries/IRGetPendingTransactions.h index d8df7723a..ccad6b118 100755 --- a/IrohaCommunication/Classes/Private/Queries/IRGetPendingTransactions.h +++ b/IrohaCommunication/Classes/Private/Queries/IRGetPendingTransactions.h @@ -10,6 +10,6 @@ @interface IRGetPendingTransactions : NSObject -- (instancetype)initWithPagination:(nonnull id)pagination; +- (nonnull instancetype)initWithPagination:(nonnull id)pagination; @end diff --git a/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.m b/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.m index 440459b38..63fb0d85e 100755 --- a/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.m +++ b/IrohaCommunication/Classes/Private/Responses/IRAccountDetailResponse.m @@ -27,7 +27,7 @@ - (nonnull instancetype)initWithDetail:(nonnull NSString *)detail } - (NSString *)description { - return [NSString stringWithFormat:@"Detail: %@\nTotal count:%u\nNext record id:%@", _detail, _totalCount, _nextRecordId]; + return [NSString stringWithFormat:@"Detail: %@\nTotal count:%@\nNext record id:%@", _detail, @(_totalCount), _nextRecordId]; } @end diff --git a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h index da1c670fe..76b24e0cc 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h +++ b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.h @@ -47,7 +47,7 @@ typedef NS_ENUM(NSUInteger, IRQueryBuilderError) { - (nonnull instancetype)getAccountDetail:(nullable id)accountId writer:(nonnull NSString *)writer - key:(nonnull NSString *)key; + key:(nonnull NSString *)key DEPRECATED_MSG_ATTRIBUTE("use getAccountDetail:pagination:"); - (nonnull instancetype)getAccountDetail:(nullable id)accountId pagination:(nonnull id)pagination; diff --git a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m index 4f185b34c..2cb021f64 100755 --- a/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m +++ b/IrohaCommunication/Classes/Public/Builder/IRQueryBuilder.m @@ -87,11 +87,10 @@ - (nonnull instancetype)getAccountAssets:(nonnull id)accountId - (nonnull instancetype)getAccountDetail:(nullable id)accountId writer:(nonnull NSString *)writer key:(nonnull NSString *)key { - id record = [IRAccountDetailRecordIdFactory accountDetailRecordIdWithWriter:writer - key:key]; - id pagination = [IRAccountDetailPaginationFactory accountDetailPagination:1 - nextRecordId:record]; - return [self getAccountDetail:accountId pagination:pagination]; + id query = [[IRGetAccountDetail alloc] initWithAccountId:accountId + writer:writer + key:key]; + return [self withQuery:query]; } - (nonnull instancetype)getAccountDetail:(nullable id)accountId diff --git a/IrohaCommunication/Classes/Public/Model/IRQuery.h b/IrohaCommunication/Classes/Public/Model/IRQuery.h index 6906cf381..6e587ccd2 100755 --- a/IrohaCommunication/Classes/Public/Model/IRQuery.h +++ b/IrohaCommunication/Classes/Public/Model/IRQuery.h @@ -67,9 +67,9 @@ @protocol IRGetAccountDetail @property (nonatomic, readonly) id _Nullable accountId; -@property (nonatomic, readonly) id _Nullable writer DEPRECATED_ATTRIBUTE; +@property (nonatomic, readonly) NSString * _Nullable writer DEPRECATED_ATTRIBUTE; @property (nonatomic, readonly) NSString * _Nullable key DEPRECATED_ATTRIBUTE; -@property (nonatomic, readonly) id _Nonnull pagination; +@property (nonatomic, readonly) id _Nullable pagination; @end