diff --git a/SwiftyIroha copy-Info.plist b/SwiftyIroha copy-Info.plist new file mode 100644 index 000000000..1007fd9dd --- /dev/null +++ b/SwiftyIroha copy-Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/SwiftyIroha.xcodeproj/project.pbxproj b/SwiftyIroha.xcodeproj/project.pbxproj index 59c40bdb8..e14593656 100644 --- a/SwiftyIroha.xcodeproj/project.pbxproj +++ b/SwiftyIroha.xcodeproj/project.pbxproj @@ -25,7 +25,6 @@ 8A287EA620CD4FDA009D7E7B /* endpoint.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A287E9C20CD4FDA009D7E7B /* endpoint.pb.swift */; }; 8A287EA720CD4FDA009D7E7B /* mst.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A287E9D20CD4FDA009D7E7B /* mst.pb.swift */; }; 8A287EA820CD4FDA009D7E7B /* primitive.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A287E9E20CD4FDA009D7E7B /* primitive.pb.swift */; }; - 8A287EA920CD4FDA009D7E7B /* loader.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A287E9F20CD4FDA009D7E7B /* loader.pb.swift */; }; 8A287EBA20CD62BB009D7E7B /* libhash.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8A287EAD20CD62B9009D7E7B /* libhash.a */; }; 8A287EBB20CD62BB009D7E7B /* libiroha_amount.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8A287EAE20CD62BA009D7E7B /* libiroha_amount.a */; }; 8A287EBC20CD62BB009D7E7B /* libshared_model_stateless_validation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8A287EAF20CD62BA009D7E7B /* libshared_model_stateless_validation.a */; }; @@ -128,7 +127,6 @@ 8A287E9C20CD4FDA009D7E7B /* endpoint.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = endpoint.pb.swift; sourceTree = ""; }; 8A287E9D20CD4FDA009D7E7B /* mst.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = mst.pb.swift; sourceTree = ""; }; 8A287E9E20CD4FDA009D7E7B /* primitive.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = primitive.pb.swift; sourceTree = ""; }; - 8A287E9F20CD4FDA009D7E7B /* loader.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = loader.pb.swift; sourceTree = ""; }; 8A287EAD20CD62B9009D7E7B /* libhash.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libhash.a; sourceTree = ""; }; 8A287EAE20CD62BA009D7E7B /* libiroha_amount.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libiroha_amount.a; sourceTree = ""; }; 8A287EAF20CD62BA009D7E7B /* libshared_model_stateless_validation.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libshared_model_stateless_validation.a; sourceTree = ""; }; @@ -171,6 +169,7 @@ 8AE1B0302066C05600F412E4 /* IrohaModelCryptoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IrohaModelCryptoTests.swift; sourceTree = ""; }; 8AE1B0422066DCED00F412E4 /* IrohaTransactionBuilderError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IrohaTransactionBuilderError.swift; sourceTree = ""; }; 8AE1B0452066E22E00F412E4 /* IrohaQueryBuilderError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IrohaQueryBuilderError.swift; sourceTree = ""; }; + 8AE283EA20CE749600E6D8A1 /* SwiftyIroha copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "SwiftyIroha copy-Info.plist"; path = "/Users/alexey/Documents/projects/iroha-ios-main/iroha-ios/SwiftyIroha copy-Info.plist"; sourceTree = ""; }; 8AEDF20D203CA1AF001D7448 /* SwiftyIroha.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftyIroha.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8AEDF210203CA1AF001D7448 /* SwiftyIroha.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwiftyIroha.h; sourceTree = ""; }; 8AEDF211203CA1AF001D7448 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -331,7 +330,6 @@ 8A287E9B20CD4FDA009D7E7B /* block.pb.swift */, 8A287E9720CD4FDA009D7E7B /* commands.pb.swift */, 8A287E9C20CD4FDA009D7E7B /* endpoint.pb.swift */, - 8A287E9F20CD4FDA009D7E7B /* loader.pb.swift */, 8A287E9D20CD4FDA009D7E7B /* mst.pb.swift */, 8A287E9620CD4FDA009D7E7B /* ordering.pb.swift */, 8A287E9E20CD4FDA009D7E7B /* primitive.pb.swift */, @@ -452,6 +450,7 @@ 8AF2C8BD205D18B2001288C6 /* README.md */, 8A5EFCE220487764004ACDD4 /* SwiftyIroha.podspec */, 21A5AE2EB4B7B8E3CFC32366 /* Pods */, + 8AE283EA20CE749600E6D8A1 /* SwiftyIroha copy-Info.plist */, ); sourceTree = ""; }; @@ -931,7 +930,6 @@ 8A287EA020CD4FDA009D7E7B /* ordering.pb.swift in Sources */, 8A287EA820CD4FDA009D7E7B /* primitive.pb.swift in Sources */, 8A287EA220CD4FDA009D7E7B /* queries.pb.swift in Sources */, - 8A287EA920CD4FDA009D7E7B /* loader.pb.swift in Sources */, 8A287EA520CD4FDA009D7E7B /* block.pb.swift in Sources */, 8A287EA120CD4FDA009D7E7B /* commands.pb.swift in Sources */, 8A287EA620CD4FDA009D7E7B /* endpoint.pb.swift in Sources */, diff --git a/SwiftyIrohaExample/GRPC/block.pb.swift b/SwiftyIrohaExample/GRPC/block.pb.swift index a4b895f2e..0303b3c13 100644 --- a/SwiftyIrohaExample/GRPC/block.pb.swift +++ b/SwiftyIrohaExample/GRPC/block.pb.swift @@ -19,8 +19,10 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -struct Iroha_Protocol_Header: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".Header" +struct Iroha_Protocol_Header { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var createdTime: UInt64 = 0 @@ -29,38 +31,12 @@ struct Iroha_Protocol_Header: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularUInt64Field(value: &self.createdTime) - case 2: try decoder.decodeRepeatedMessageField(value: &self.signatures) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if self.createdTime != 0 { - try visitor.visitSingularUInt64Field(value: self.createdTime, fieldNumber: 1) - } - if !self.signatures.isEmpty { - try visitor.visitRepeatedMessageField(value: self.signatures, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_Transaction: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".Transaction" +struct Iroha_Protocol_Transaction { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var payload: Iroha_Protocol_Transaction.Payload { get {return _storage._payload ?? Iroha_Protocol_Transaction.Payload()} @@ -71,105 +47,40 @@ struct Iroha_Protocol_Transaction: SwiftProtobuf.Message { /// Clears the value of `payload`. Subsequent reads from it will return its default value. mutating func clearPayload() {_storage._payload = nil} - var signature: [Iroha_Protocol_Signature] { - get {return _storage._signature} - set {_uniqueStorage()._signature = newValue} + var signatures: [Iroha_Protocol_Signature] { + get {return _storage._signatures} + set {_uniqueStorage()._signatures = newValue} } var unknownFields = SwiftProtobuf.UnknownStorage() - struct Payload: SwiftProtobuf.Message { - static let protoMessageName: String = Iroha_Protocol_Transaction.protoMessageName + ".Payload" + struct Payload { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var commands: [Iroha_Protocol_Command] = [] var creatorAccountID: String = String() - var txCounter: UInt64 = 0 - var createdTime: UInt64 = 0 + var quorum: UInt32 = 0 + var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeRepeatedMessageField(value: &self.commands) - case 2: try decoder.decodeSingularStringField(value: &self.creatorAccountID) - case 3: try decoder.decodeSingularUInt64Field(value: &self.txCounter) - case 4: try decoder.decodeSingularUInt64Field(value: &self.createdTime) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.commands.isEmpty { - try visitor.visitRepeatedMessageField(value: self.commands, fieldNumber: 1) - } - if !self.creatorAccountID.isEmpty { - try visitor.visitSingularStringField(value: self.creatorAccountID, fieldNumber: 2) - } - if self.txCounter != 0 { - try visitor.visitSingularUInt64Field(value: self.txCounter, fieldNumber: 3) - } - if self.createdTime != 0 { - try visitor.visitSingularUInt64Field(value: self.createdTime, fieldNumber: 4) - } - try unknownFields.traverse(visitor: &visitor) - } } init() {} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_storage._payload) - case 2: try decoder.decodeRepeatedMessageField(value: &_storage._signature) - default: break - } - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if let v = _storage._payload { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } - if !_storage._signature.isEmpty { - try visitor.visitRepeatedMessageField(value: _storage._signature, fieldNumber: 2) - } - } - try unknownFields.traverse(visitor: &visitor) - } - fileprivate var _storage = _StorageClass.defaultInstance } -struct Iroha_Protocol_Block: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".Block" +struct Iroha_Protocol_Block { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var payload: Iroha_Protocol_Block.Payload { get {return _storage._payload ?? Iroha_Protocol_Block.Payload()} @@ -188,8 +99,10 @@ struct Iroha_Protocol_Block: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() /// everything that should be signed: - struct Payload: SwiftProtobuf.Message { - static let protoMessageName: String = Iroha_Protocol_Block.protoMessageName + ".Payload" + struct Payload { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var transactions: [Iroha_Protocol_Transaction] = [] @@ -207,83 +120,10 @@ struct Iroha_Protocol_Block: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeRepeatedMessageField(value: &self.transactions) - case 2: try decoder.decodeSingularUInt32Field(value: &self.txNumber) - case 3: try decoder.decodeSingularUInt64Field(value: &self.height) - case 5: try decoder.decodeSingularBytesField(value: &self.prevBlockHash) - case 6: try decoder.decodeSingularUInt64Field(value: &self.createdTime) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.transactions.isEmpty { - try visitor.visitRepeatedMessageField(value: self.transactions, fieldNumber: 1) - } - if self.txNumber != 0 { - try visitor.visitSingularUInt32Field(value: self.txNumber, fieldNumber: 2) - } - if self.height != 0 { - try visitor.visitSingularUInt64Field(value: self.height, fieldNumber: 3) - } - if !self.prevBlockHash.isEmpty { - try visitor.visitSingularBytesField(value: self.prevBlockHash, fieldNumber: 5) - } - if self.createdTime != 0 { - try visitor.visitSingularUInt64Field(value: self.createdTime, fieldNumber: 6) - } - try unknownFields.traverse(visitor: &visitor) - } } init() {} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_storage._payload) - case 2: try decoder.decodeRepeatedMessageField(value: &_storage._signatures) - default: break - } - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if let v = _storage._payload { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } - if !_storage._signatures.isEmpty { - try visitor.visitRepeatedMessageField(value: _storage._signatures, fieldNumber: 2) - } - } - try unknownFields.traverse(visitor: &visitor) - } - fileprivate var _storage = _StorageClass.defaultInstance } @@ -291,12 +131,33 @@ struct Iroha_Protocol_Block: SwiftProtobuf.Message { fileprivate let _protobuf_package = "iroha.protocol" -extension Iroha_Protocol_Header: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_Header: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Header" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "created_time"), 2: .same(proto: "signatures"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.createdTime) + case 2: try decoder.decodeRepeatedMessageField(value: &self.signatures) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.createdTime != 0 { + try visitor.visitSingularUInt64Field(value: self.createdTime, fieldNumber: 1) + } + if !self.signatures.isEmpty { + try visitor.visitRepeatedMessageField(value: self.signatures, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_Header) -> Bool { if self.createdTime != other.createdTime {return false} if self.signatures != other.signatures {return false} @@ -305,15 +166,16 @@ extension Iroha_Protocol_Header: SwiftProtobuf._MessageImplementationBase, Swift } } -extension Iroha_Protocol_Transaction: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_Transaction: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Transaction" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "payload"), - 2: .same(proto: "signature"), + 2: .same(proto: "signatures"), ] fileprivate class _StorageClass { var _payload: Iroha_Protocol_Transaction.Payload? = nil - var _signature: [Iroha_Protocol_Signature] = [] + var _signatures: [Iroha_Protocol_Signature] = [] static let defaultInstance = _StorageClass() @@ -321,7 +183,7 @@ extension Iroha_Protocol_Transaction: SwiftProtobuf._MessageImplementationBase, init(copying source: _StorageClass) { _payload = source._payload - _signature = source._signature + _signatures = source._signatures } } @@ -332,11 +194,38 @@ extension Iroha_Protocol_Transaction: SwiftProtobuf._MessageImplementationBase, return _storage } + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._payload) + case 2: try decoder.decodeRepeatedMessageField(value: &_storage._signatures) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._payload { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if !_storage._signatures.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._signatures, fieldNumber: 2) + } + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_Transaction) -> Bool { if _storage !== other._storage { - let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 if _storage._payload != other_storage._payload {return false} - if _storage._signature != other_storage._signature {return false} + if _storage._signatures != other_storage._signatures {return false} return true } if !storagesAreEqual {return false} @@ -346,25 +235,55 @@ extension Iroha_Protocol_Transaction: SwiftProtobuf._MessageImplementationBase, } } -extension Iroha_Protocol_Transaction.Payload: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_Transaction.Payload: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Iroha_Protocol_Transaction.protoMessageName + ".Payload" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "commands"), 2: .standard(proto: "creator_account_id"), - 3: .standard(proto: "tx_counter"), - 4: .standard(proto: "created_time"), + 3: .standard(proto: "created_time"), + 4: .same(proto: "quorum"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.commands) + case 2: try decoder.decodeSingularStringField(value: &self.creatorAccountID) + case 3: try decoder.decodeSingularUInt64Field(value: &self.createdTime) + case 4: try decoder.decodeSingularUInt32Field(value: &self.quorum) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.commands.isEmpty { + try visitor.visitRepeatedMessageField(value: self.commands, fieldNumber: 1) + } + if !self.creatorAccountID.isEmpty { + try visitor.visitSingularStringField(value: self.creatorAccountID, fieldNumber: 2) + } + if self.createdTime != 0 { + try visitor.visitSingularUInt64Field(value: self.createdTime, fieldNumber: 3) + } + if self.quorum != 0 { + try visitor.visitSingularUInt32Field(value: self.quorum, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_Transaction.Payload) -> Bool { if self.commands != other.commands {return false} if self.creatorAccountID != other.creatorAccountID {return false} - if self.txCounter != other.txCounter {return false} if self.createdTime != other.createdTime {return false} + if self.quorum != other.quorum {return false} if unknownFields != other.unknownFields {return false} return true } } -extension Iroha_Protocol_Block: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_Block: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Block" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "payload"), 2: .same(proto: "signatures"), @@ -391,9 +310,36 @@ extension Iroha_Protocol_Block: SwiftProtobuf._MessageImplementationBase, SwiftP return _storage } + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._payload) + case 2: try decoder.decodeRepeatedMessageField(value: &_storage._signatures) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._payload { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if !_storage._signatures.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._signatures, fieldNumber: 2) + } + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_Block) -> Bool { if _storage !== other._storage { - let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 if _storage._payload != other_storage._payload {return false} if _storage._signatures != other_storage._signatures {return false} return true @@ -405,7 +351,8 @@ extension Iroha_Protocol_Block: SwiftProtobuf._MessageImplementationBase, SwiftP } } -extension Iroha_Protocol_Block.Payload: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_Block.Payload: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Iroha_Protocol_Block.protoMessageName + ".Payload" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "transactions"), 2: .standard(proto: "tx_number"), @@ -414,6 +361,38 @@ extension Iroha_Protocol_Block.Payload: SwiftProtobuf._MessageImplementationBase 6: .standard(proto: "created_time"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.transactions) + case 2: try decoder.decodeSingularUInt32Field(value: &self.txNumber) + case 3: try decoder.decodeSingularUInt64Field(value: &self.height) + case 5: try decoder.decodeSingularBytesField(value: &self.prevBlockHash) + case 6: try decoder.decodeSingularUInt64Field(value: &self.createdTime) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.transactions.isEmpty { + try visitor.visitRepeatedMessageField(value: self.transactions, fieldNumber: 1) + } + if self.txNumber != 0 { + try visitor.visitSingularUInt32Field(value: self.txNumber, fieldNumber: 2) + } + if self.height != 0 { + try visitor.visitSingularUInt64Field(value: self.height, fieldNumber: 3) + } + if !self.prevBlockHash.isEmpty { + try visitor.visitSingularBytesField(value: self.prevBlockHash, fieldNumber: 5) + } + if self.createdTime != 0 { + try visitor.visitSingularUInt64Field(value: self.createdTime, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_Block.Payload) -> Bool { if self.transactions != other.transactions {return false} if self.txNumber != other.txNumber {return false} diff --git a/SwiftyIrohaExample/GRPC/commands.pb.swift b/SwiftyIrohaExample/GRPC/commands.pb.swift index 6dd9b6f7c..fc1e26175 100644 --- a/SwiftyIrohaExample/GRPC/commands.pb.swift +++ b/SwiftyIrohaExample/GRPC/commands.pb.swift @@ -19,8 +19,10 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -struct Iroha_Protocol_AddAssetQuantity: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".AddAssetQuantity" +struct Iroha_Protocol_AddAssetQuantity { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String { get {return _storage._accountID} @@ -45,48 +47,13 @@ struct Iroha_Protocol_AddAssetQuantity: SwiftProtobuf.Message { init() {} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &_storage._accountID) - case 2: try decoder.decodeSingularStringField(value: &_storage._assetID) - case 3: try decoder.decodeSingularMessageField(value: &_storage._amount) - default: break - } - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if !_storage._accountID.isEmpty { - try visitor.visitSingularStringField(value: _storage._accountID, fieldNumber: 1) - } - if !_storage._assetID.isEmpty { - try visitor.visitSingularStringField(value: _storage._assetID, fieldNumber: 2) - } - if let v = _storage._amount { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } - } - try unknownFields.traverse(visitor: &visitor) - } - fileprivate var _storage = _StorageClass.defaultInstance } -struct Iroha_Protocol_AddPeer: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".AddPeer" +struct Iroha_Protocol_AddPeer { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var peer: Iroha_Protocol_Peer { get {return _storage._peer ?? Iroha_Protocol_Peer()} @@ -101,40 +68,13 @@ struct Iroha_Protocol_AddPeer: SwiftProtobuf.Message { init() {} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_storage._peer) - default: break - } - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if let v = _storage._peer { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } - } - try unknownFields.traverse(visitor: &visitor) - } - fileprivate var _storage = _StorageClass.defaultInstance } -struct Iroha_Protocol_AddSignatory: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".AddSignatory" +struct Iroha_Protocol_AddSignatory { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String = String() @@ -143,38 +83,12 @@ struct Iroha_Protocol_AddSignatory: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.accountID) - case 2: try decoder.decodeSingularBytesField(value: &self.publicKey) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.accountID.isEmpty { - try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) - } - if !self.publicKey.isEmpty { - try visitor.visitSingularBytesField(value: self.publicKey, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_CreateAsset: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".CreateAsset" +struct Iroha_Protocol_CreateAsset { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var assetName: String = String() @@ -185,42 +99,12 @@ struct Iroha_Protocol_CreateAsset: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.assetName) - case 2: try decoder.decodeSingularStringField(value: &self.domainID) - case 3: try decoder.decodeSingularUInt32Field(value: &self.precision) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.assetName.isEmpty { - try visitor.visitSingularStringField(value: self.assetName, fieldNumber: 1) - } - if !self.domainID.isEmpty { - try visitor.visitSingularStringField(value: self.domainID, fieldNumber: 2) - } - if self.precision != 0 { - try visitor.visitSingularUInt32Field(value: self.precision, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_CreateAccount: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".CreateAccount" +struct Iroha_Protocol_CreateAccount { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountName: String = String() @@ -231,42 +115,12 @@ struct Iroha_Protocol_CreateAccount: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.accountName) - case 2: try decoder.decodeSingularStringField(value: &self.domainID) - case 3: try decoder.decodeSingularBytesField(value: &self.mainPubkey) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.accountName.isEmpty { - try visitor.visitSingularStringField(value: self.accountName, fieldNumber: 1) - } - if !self.domainID.isEmpty { - try visitor.visitSingularStringField(value: self.domainID, fieldNumber: 2) - } - if !self.mainPubkey.isEmpty { - try visitor.visitSingularBytesField(value: self.mainPubkey, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_SetAccountDetail: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".SetAccountDetail" +struct Iroha_Protocol_SetAccountDetail { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String = String() @@ -277,42 +131,12 @@ struct Iroha_Protocol_SetAccountDetail: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.accountID) - case 2: try decoder.decodeSingularStringField(value: &self.key) - case 3: try decoder.decodeSingularStringField(value: &self.value) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.accountID.isEmpty { - try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) - } - if !self.key.isEmpty { - try visitor.visitSingularStringField(value: self.key, fieldNumber: 2) - } - if !self.value.isEmpty { - try visitor.visitSingularStringField(value: self.value, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_CreateDomain: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".CreateDomain" +struct Iroha_Protocol_CreateDomain { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var domainID: String = String() @@ -321,38 +145,12 @@ struct Iroha_Protocol_CreateDomain: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.domainID) - case 2: try decoder.decodeSingularStringField(value: &self.defaultRole) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.domainID.isEmpty { - try visitor.visitSingularStringField(value: self.domainID, fieldNumber: 1) - } - if !self.defaultRole.isEmpty { - try visitor.visitSingularStringField(value: self.defaultRole, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_RemoveSignatory: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".RemoveSignatory" +struct Iroha_Protocol_RemoveSignatory { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String = String() @@ -361,38 +159,12 @@ struct Iroha_Protocol_RemoveSignatory: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.accountID) - case 2: try decoder.decodeSingularBytesField(value: &self.publicKey) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.accountID.isEmpty { - try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) - } - if !self.publicKey.isEmpty { - try visitor.visitSingularBytesField(value: self.publicKey, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_SetAccountQuorum: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".SetAccountQuorum" +struct Iroha_Protocol_SetAccountQuorum { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String = String() @@ -401,38 +173,12 @@ struct Iroha_Protocol_SetAccountQuorum: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.accountID) - case 2: try decoder.decodeSingularUInt32Field(value: &self.quorum) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.accountID.isEmpty { - try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) - } - if self.quorum != 0 { - try visitor.visitSingularUInt32Field(value: self.quorum, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_TransferAsset: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".TransferAsset" +struct Iroha_Protocol_TransferAsset { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var srcAccountID: String { get {return _storage._srcAccountID} @@ -467,56 +213,13 @@ struct Iroha_Protocol_TransferAsset: SwiftProtobuf.Message { init() {} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &_storage._srcAccountID) - case 2: try decoder.decodeSingularStringField(value: &_storage._destAccountID) - case 3: try decoder.decodeSingularStringField(value: &_storage._assetID) - case 4: try decoder.decodeSingularStringField(value: &_storage._description_p) - case 5: try decoder.decodeSingularMessageField(value: &_storage._amount) - default: break - } - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if !_storage._srcAccountID.isEmpty { - try visitor.visitSingularStringField(value: _storage._srcAccountID, fieldNumber: 1) - } - if !_storage._destAccountID.isEmpty { - try visitor.visitSingularStringField(value: _storage._destAccountID, fieldNumber: 2) - } - if !_storage._assetID.isEmpty { - try visitor.visitSingularStringField(value: _storage._assetID, fieldNumber: 3) - } - if !_storage._description_p.isEmpty { - try visitor.visitSingularStringField(value: _storage._description_p, fieldNumber: 4) - } - if let v = _storage._amount { - try visitor.visitSingularMessageField(value: v, fieldNumber: 5) - } - } - try unknownFields.traverse(visitor: &visitor) - } - fileprivate var _storage = _StorageClass.defaultInstance } -struct Iroha_Protocol_AppendRole: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".AppendRole" +struct Iroha_Protocol_AppendRole { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String = String() @@ -525,38 +228,12 @@ struct Iroha_Protocol_AppendRole: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} +} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.accountID) - case 2: try decoder.decodeSingularStringField(value: &self.roleName) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.accountID.isEmpty { - try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) - } - if !self.roleName.isEmpty { - try visitor.visitSingularStringField(value: self.roleName, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } -} - -struct Iroha_Protocol_DetachRole: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".DetachRole" +struct Iroha_Protocol_DetachRole { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String = String() @@ -565,38 +242,12 @@ struct Iroha_Protocol_DetachRole: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.accountID) - case 2: try decoder.decodeSingularStringField(value: &self.roleName) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.accountID.isEmpty { - try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) - } - if !self.roleName.isEmpty { - try visitor.visitSingularStringField(value: self.roleName, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_CreateRole: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".CreateRole" +struct Iroha_Protocol_CreateRole { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var roleName: String = String() @@ -605,38 +256,12 @@ struct Iroha_Protocol_CreateRole: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.roleName) - case 2: try decoder.decodeRepeatedEnumField(value: &self.permissions) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.roleName.isEmpty { - try visitor.visitSingularStringField(value: self.roleName, fieldNumber: 1) - } - if !self.permissions.isEmpty { - try visitor.visitPackedEnumField(value: self.permissions, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_GrantPermission: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".GrantPermission" +struct Iroha_Protocol_GrantPermission { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String = String() @@ -645,38 +270,12 @@ struct Iroha_Protocol_GrantPermission: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.accountID) - case 2: try decoder.decodeSingularEnumField(value: &self.permission) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.accountID.isEmpty { - try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) - } - if self.permission != .canAddMySignatory { - try visitor.visitSingularEnumField(value: self.permission, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_RevokePermission: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".RevokePermission" +struct Iroha_Protocol_RevokePermission { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String = String() @@ -685,38 +284,12 @@ struct Iroha_Protocol_RevokePermission: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.accountID) - case 2: try decoder.decodeSingularEnumField(value: &self.permission) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.accountID.isEmpty { - try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) - } - if self.permission != .canAddMySignatory { - try visitor.visitSingularEnumField(value: self.permission, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_SubtractAssetQuantity: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".SubtractAssetQuantity" +struct Iroha_Protocol_SubtractAssetQuantity { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String { get {return _storage._accountID} @@ -741,48 +314,13 @@ struct Iroha_Protocol_SubtractAssetQuantity: SwiftProtobuf.Message { init() {} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &_storage._accountID) - case 2: try decoder.decodeSingularStringField(value: &_storage._assetID) - case 3: try decoder.decodeSingularMessageField(value: &_storage._amount) - default: break - } - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if !_storage._accountID.isEmpty { - try visitor.visitSingularStringField(value: _storage._accountID, fieldNumber: 1) - } - if !_storage._assetID.isEmpty { - try visitor.visitSingularStringField(value: _storage._assetID, fieldNumber: 2) - } - if let v = _storage._amount { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } - } - try unknownFields.traverse(visitor: &visitor) - } - fileprivate var _storage = _StorageClass.defaultInstance } -struct Iroha_Protocol_Command: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".Command" +struct Iroha_Protocol_Command { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var command: OneOf_Command? { get {return _storage._command} @@ -962,234 +500,78 @@ struct Iroha_Protocol_Command: SwiftProtobuf.Message { init() {} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. + fileprivate var _storage = _StorageClass.defaultInstance +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "iroha.protocol" + +extension Iroha_Protocol_AddAssetQuantity: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AddAssetQuantity" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "account_id"), + 2: .standard(proto: "asset_id"), + 3: .same(proto: "amount"), + ] + + fileprivate class _StorageClass { + var _accountID: String = String() + var _assetID: String = String() + var _amount: Iroha_Protocol_Amount? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _accountID = source._accountID + _assetID = source._assetID + _amount = source._amount + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + mutating func decodeMessage(decoder: inout D) throws { _ = _uniqueStorage() try withExtendedLifetime(_storage) { (_storage: _StorageClass) in while let fieldNumber = try decoder.nextFieldNumber() { switch fieldNumber { - case 1: - var v: Iroha_Protocol_AddAssetQuantity? - if let current = _storage._command { - try decoder.handleConflictingOneOf() - if case .addAssetQuantity(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._command = .addAssetQuantity(v)} - case 2: - var v: Iroha_Protocol_AddPeer? - if let current = _storage._command { - try decoder.handleConflictingOneOf() - if case .addPeer(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._command = .addPeer(v)} - case 3: - var v: Iroha_Protocol_AddSignatory? - if let current = _storage._command { - try decoder.handleConflictingOneOf() - if case .addSignatory(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._command = .addSignatory(v)} - case 4: - var v: Iroha_Protocol_AppendRole? - if let current = _storage._command { - try decoder.handleConflictingOneOf() - if case .appendRole(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._command = .appendRole(v)} - case 5: - var v: Iroha_Protocol_CreateAccount? - if let current = _storage._command { - try decoder.handleConflictingOneOf() - if case .createAccount(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._command = .createAccount(v)} - case 6: - var v: Iroha_Protocol_CreateAsset? - if let current = _storage._command { - try decoder.handleConflictingOneOf() - if case .createAsset(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._command = .createAsset(v)} - case 7: - var v: Iroha_Protocol_CreateDomain? - if let current = _storage._command { - try decoder.handleConflictingOneOf() - if case .createDomain(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._command = .createDomain(v)} - case 8: - var v: Iroha_Protocol_CreateRole? - if let current = _storage._command { - try decoder.handleConflictingOneOf() - if case .createRole(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._command = .createRole(v)} - case 9: - var v: Iroha_Protocol_DetachRole? - if let current = _storage._command { - try decoder.handleConflictingOneOf() - if case .detachRole(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._command = .detachRole(v)} - case 10: - var v: Iroha_Protocol_GrantPermission? - if let current = _storage._command { - try decoder.handleConflictingOneOf() - if case .grantPermission(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._command = .grantPermission(v)} - case 11: - var v: Iroha_Protocol_RemoveSignatory? - if let current = _storage._command { - try decoder.handleConflictingOneOf() - if case .removeSign(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._command = .removeSign(v)} - case 12: - var v: Iroha_Protocol_RevokePermission? - if let current = _storage._command { - try decoder.handleConflictingOneOf() - if case .revokePermission(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._command = .revokePermission(v)} - case 13: - var v: Iroha_Protocol_SetAccountDetail? - if let current = _storage._command { - try decoder.handleConflictingOneOf() - if case .setAccountDetail(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._command = .setAccountDetail(v)} - case 14: - var v: Iroha_Protocol_SetAccountQuorum? - if let current = _storage._command { - try decoder.handleConflictingOneOf() - if case .setQuorum(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._command = .setQuorum(v)} - case 15: - var v: Iroha_Protocol_SubtractAssetQuantity? - if let current = _storage._command { - try decoder.handleConflictingOneOf() - if case .subtractAssetQuantity(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._command = .subtractAssetQuantity(v)} - case 16: - var v: Iroha_Protocol_TransferAsset? - if let current = _storage._command { - try decoder.handleConflictingOneOf() - if case .transferAsset(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._command = .transferAsset(v)} + case 1: try decoder.decodeSingularStringField(value: &_storage._accountID) + case 2: try decoder.decodeSingularStringField(value: &_storage._assetID) + case 3: try decoder.decodeSingularMessageField(value: &_storage._amount) default: break } } } } - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. func traverse(visitor: inout V) throws { try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - switch _storage._command { - case .addAssetQuantity(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - case .addPeer(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - case .addSignatory(let v)?: + if !_storage._accountID.isEmpty { + try visitor.visitSingularStringField(value: _storage._accountID, fieldNumber: 1) + } + if !_storage._assetID.isEmpty { + try visitor.visitSingularStringField(value: _storage._assetID, fieldNumber: 2) + } + if let v = _storage._amount { try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - case .appendRole(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 4) - case .createAccount(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 5) - case .createAsset(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 6) - case .createDomain(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 7) - case .createRole(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 8) - case .detachRole(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 9) - case .grantPermission(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 10) - case .removeSign(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 11) - case .revokePermission(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 12) - case .setAccountDetail(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 13) - case .setQuorum(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 14) - case .subtractAssetQuantity(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 15) - case .transferAsset(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 16) - case nil: break } } try unknownFields.traverse(visitor: &visitor) } - fileprivate var _storage = _StorageClass.defaultInstance -} - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -fileprivate let _protobuf_package = "iroha.protocol" - -extension Iroha_Protocol_AddAssetQuantity: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "account_id"), - 2: .standard(proto: "asset_id"), - 3: .same(proto: "amount"), - ] - - fileprivate class _StorageClass { - var _accountID: String = String() - var _assetID: String = String() - var _amount: Iroha_Protocol_Amount? = nil - - static let defaultInstance = _StorageClass() - - private init() {} - - init(copying source: _StorageClass) { - _accountID = source._accountID - _assetID = source._assetID - _amount = source._amount - } - } - - fileprivate mutating func _uniqueStorage() -> _StorageClass { - if !isKnownUniquelyReferenced(&_storage) { - _storage = _StorageClass(copying: _storage) - } - return _storage - } - func _protobuf_generated_isEqualTo(other: Iroha_Protocol_AddAssetQuantity) -> Bool { if _storage !== other._storage { - let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 if _storage._accountID != other_storage._accountID {return false} if _storage._assetID != other_storage._assetID {return false} if _storage._amount != other_storage._amount {return false} @@ -1202,7 +584,8 @@ extension Iroha_Protocol_AddAssetQuantity: SwiftProtobuf._MessageImplementationB } } -extension Iroha_Protocol_AddPeer: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_AddPeer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AddPeer" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "peer"), ] @@ -1226,9 +609,32 @@ extension Iroha_Protocol_AddPeer: SwiftProtobuf._MessageImplementationBase, Swif return _storage } + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._peer) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._peer { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_AddPeer) -> Bool { if _storage !== other._storage { - let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 if _storage._peer != other_storage._peer {return false} return true } @@ -1239,12 +645,33 @@ extension Iroha_Protocol_AddPeer: SwiftProtobuf._MessageImplementationBase, Swif } } -extension Iroha_Protocol_AddSignatory: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_AddSignatory: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AddSignatory" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_id"), 2: .standard(proto: "public_key"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.accountID) + case 2: try decoder.decodeSingularBytesField(value: &self.publicKey) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.accountID.isEmpty { + try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) + } + if !self.publicKey.isEmpty { + try visitor.visitSingularBytesField(value: self.publicKey, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_AddSignatory) -> Bool { if self.accountID != other.accountID {return false} if self.publicKey != other.publicKey {return false} @@ -1253,13 +680,38 @@ extension Iroha_Protocol_AddSignatory: SwiftProtobuf._MessageImplementationBase, } } -extension Iroha_Protocol_CreateAsset: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_CreateAsset: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CreateAsset" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "asset_name"), 2: .standard(proto: "domain_id"), 3: .same(proto: "precision"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.assetName) + case 2: try decoder.decodeSingularStringField(value: &self.domainID) + case 3: try decoder.decodeSingularUInt32Field(value: &self.precision) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.assetName.isEmpty { + try visitor.visitSingularStringField(value: self.assetName, fieldNumber: 1) + } + if !self.domainID.isEmpty { + try visitor.visitSingularStringField(value: self.domainID, fieldNumber: 2) + } + if self.precision != 0 { + try visitor.visitSingularUInt32Field(value: self.precision, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_CreateAsset) -> Bool { if self.assetName != other.assetName {return false} if self.domainID != other.domainID {return false} @@ -1269,13 +721,38 @@ extension Iroha_Protocol_CreateAsset: SwiftProtobuf._MessageImplementationBase, } } -extension Iroha_Protocol_CreateAccount: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_CreateAccount: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CreateAccount" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_name"), 2: .standard(proto: "domain_id"), 3: .standard(proto: "main_pubkey"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.accountName) + case 2: try decoder.decodeSingularStringField(value: &self.domainID) + case 3: try decoder.decodeSingularBytesField(value: &self.mainPubkey) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.accountName.isEmpty { + try visitor.visitSingularStringField(value: self.accountName, fieldNumber: 1) + } + if !self.domainID.isEmpty { + try visitor.visitSingularStringField(value: self.domainID, fieldNumber: 2) + } + if !self.mainPubkey.isEmpty { + try visitor.visitSingularBytesField(value: self.mainPubkey, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_CreateAccount) -> Bool { if self.accountName != other.accountName {return false} if self.domainID != other.domainID {return false} @@ -1285,13 +762,38 @@ extension Iroha_Protocol_CreateAccount: SwiftProtobuf._MessageImplementationBase } } -extension Iroha_Protocol_SetAccountDetail: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_SetAccountDetail: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SetAccountDetail" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_id"), 2: .same(proto: "key"), 3: .same(proto: "value"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.accountID) + case 2: try decoder.decodeSingularStringField(value: &self.key) + case 3: try decoder.decodeSingularStringField(value: &self.value) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.accountID.isEmpty { + try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) + } + if !self.key.isEmpty { + try visitor.visitSingularStringField(value: self.key, fieldNumber: 2) + } + if !self.value.isEmpty { + try visitor.visitSingularStringField(value: self.value, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_SetAccountDetail) -> Bool { if self.accountID != other.accountID {return false} if self.key != other.key {return false} @@ -1301,25 +803,67 @@ extension Iroha_Protocol_SetAccountDetail: SwiftProtobuf._MessageImplementationB } } -extension Iroha_Protocol_CreateDomain: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_CreateDomain: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CreateDomain" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "domain_id"), 2: .standard(proto: "default_role"), ] - func _protobuf_generated_isEqualTo(other: Iroha_Protocol_CreateDomain) -> Bool { - if self.domainID != other.domainID {return false} - if self.defaultRole != other.defaultRole {return false} - if unknownFields != other.unknownFields {return false} - return true + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.domainID) + case 2: try decoder.decodeSingularStringField(value: &self.defaultRole) + default: break + } + } } -} -extension Iroha_Protocol_RemoveSignatory: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "account_id"), - 2: .standard(proto: "public_key"), - ] + func traverse(visitor: inout V) throws { + if !self.domainID.isEmpty { + try visitor.visitSingularStringField(value: self.domainID, fieldNumber: 1) + } + if !self.defaultRole.isEmpty { + try visitor.visitSingularStringField(value: self.defaultRole, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_CreateDomain) -> Bool { + if self.domainID != other.domainID {return false} + if self.defaultRole != other.defaultRole {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension Iroha_Protocol_RemoveSignatory: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".RemoveSignatory" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "account_id"), + 2: .standard(proto: "public_key"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.accountID) + case 2: try decoder.decodeSingularBytesField(value: &self.publicKey) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.accountID.isEmpty { + try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) + } + if !self.publicKey.isEmpty { + try visitor.visitSingularBytesField(value: self.publicKey, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } func _protobuf_generated_isEqualTo(other: Iroha_Protocol_RemoveSignatory) -> Bool { if self.accountID != other.accountID {return false} @@ -1329,12 +873,33 @@ extension Iroha_Protocol_RemoveSignatory: SwiftProtobuf._MessageImplementationBa } } -extension Iroha_Protocol_SetAccountQuorum: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_SetAccountQuorum: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SetAccountQuorum" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_id"), 2: .same(proto: "quorum"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.accountID) + case 2: try decoder.decodeSingularUInt32Field(value: &self.quorum) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.accountID.isEmpty { + try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) + } + if self.quorum != 0 { + try visitor.visitSingularUInt32Field(value: self.quorum, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_SetAccountQuorum) -> Bool { if self.accountID != other.accountID {return false} if self.quorum != other.quorum {return false} @@ -1343,7 +908,8 @@ extension Iroha_Protocol_SetAccountQuorum: SwiftProtobuf._MessageImplementationB } } -extension Iroha_Protocol_TransferAsset: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_TransferAsset: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".TransferAsset" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "src_account_id"), 2: .standard(proto: "dest_account_id"), @@ -1379,9 +945,48 @@ extension Iroha_Protocol_TransferAsset: SwiftProtobuf._MessageImplementationBase return _storage } + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &_storage._srcAccountID) + case 2: try decoder.decodeSingularStringField(value: &_storage._destAccountID) + case 3: try decoder.decodeSingularStringField(value: &_storage._assetID) + case 4: try decoder.decodeSingularStringField(value: &_storage._description_p) + case 5: try decoder.decodeSingularMessageField(value: &_storage._amount) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if !_storage._srcAccountID.isEmpty { + try visitor.visitSingularStringField(value: _storage._srcAccountID, fieldNumber: 1) + } + if !_storage._destAccountID.isEmpty { + try visitor.visitSingularStringField(value: _storage._destAccountID, fieldNumber: 2) + } + if !_storage._assetID.isEmpty { + try visitor.visitSingularStringField(value: _storage._assetID, fieldNumber: 3) + } + if !_storage._description_p.isEmpty { + try visitor.visitSingularStringField(value: _storage._description_p, fieldNumber: 4) + } + if let v = _storage._amount { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_TransferAsset) -> Bool { if _storage !== other._storage { - let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 if _storage._srcAccountID != other_storage._srcAccountID {return false} if _storage._destAccountID != other_storage._destAccountID {return false} if _storage._assetID != other_storage._assetID {return false} @@ -1396,12 +1001,33 @@ extension Iroha_Protocol_TransferAsset: SwiftProtobuf._MessageImplementationBase } } -extension Iroha_Protocol_AppendRole: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_AppendRole: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AppendRole" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_id"), 2: .standard(proto: "role_name"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.accountID) + case 2: try decoder.decodeSingularStringField(value: &self.roleName) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.accountID.isEmpty { + try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) + } + if !self.roleName.isEmpty { + try visitor.visitSingularStringField(value: self.roleName, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_AppendRole) -> Bool { if self.accountID != other.accountID {return false} if self.roleName != other.roleName {return false} @@ -1410,12 +1036,33 @@ extension Iroha_Protocol_AppendRole: SwiftProtobuf._MessageImplementationBase, S } } -extension Iroha_Protocol_DetachRole: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_DetachRole: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".DetachRole" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_id"), 2: .standard(proto: "role_name"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.accountID) + case 2: try decoder.decodeSingularStringField(value: &self.roleName) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.accountID.isEmpty { + try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) + } + if !self.roleName.isEmpty { + try visitor.visitSingularStringField(value: self.roleName, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_DetachRole) -> Bool { if self.accountID != other.accountID {return false} if self.roleName != other.roleName {return false} @@ -1424,12 +1071,33 @@ extension Iroha_Protocol_DetachRole: SwiftProtobuf._MessageImplementationBase, S } } -extension Iroha_Protocol_CreateRole: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_CreateRole: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CreateRole" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "role_name"), 2: .same(proto: "permissions"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.roleName) + case 2: try decoder.decodeRepeatedEnumField(value: &self.permissions) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.roleName.isEmpty { + try visitor.visitSingularStringField(value: self.roleName, fieldNumber: 1) + } + if !self.permissions.isEmpty { + try visitor.visitPackedEnumField(value: self.permissions, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_CreateRole) -> Bool { if self.roleName != other.roleName {return false} if self.permissions != other.permissions {return false} @@ -1438,12 +1106,33 @@ extension Iroha_Protocol_CreateRole: SwiftProtobuf._MessageImplementationBase, S } } -extension Iroha_Protocol_GrantPermission: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_GrantPermission: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GrantPermission" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_id"), 2: .same(proto: "permission"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.accountID) + case 2: try decoder.decodeSingularEnumField(value: &self.permission) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.accountID.isEmpty { + try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) + } + if self.permission != .canAddMySignatory { + try visitor.visitSingularEnumField(value: self.permission, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_GrantPermission) -> Bool { if self.accountID != other.accountID {return false} if self.permission != other.permission {return false} @@ -1452,12 +1141,33 @@ extension Iroha_Protocol_GrantPermission: SwiftProtobuf._MessageImplementationBa } } -extension Iroha_Protocol_RevokePermission: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_RevokePermission: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".RevokePermission" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_id"), 2: .same(proto: "permission"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.accountID) + case 2: try decoder.decodeSingularEnumField(value: &self.permission) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.accountID.isEmpty { + try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) + } + if self.permission != .canAddMySignatory { + try visitor.visitSingularEnumField(value: self.permission, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_RevokePermission) -> Bool { if self.accountID != other.accountID {return false} if self.permission != other.permission {return false} @@ -1466,7 +1176,8 @@ extension Iroha_Protocol_RevokePermission: SwiftProtobuf._MessageImplementationB } } -extension Iroha_Protocol_SubtractAssetQuantity: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_SubtractAssetQuantity: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SubtractAssetQuantity" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_id"), 2: .standard(proto: "asset_id"), @@ -1496,9 +1207,40 @@ extension Iroha_Protocol_SubtractAssetQuantity: SwiftProtobuf._MessageImplementa return _storage } + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &_storage._accountID) + case 2: try decoder.decodeSingularStringField(value: &_storage._assetID) + case 3: try decoder.decodeSingularMessageField(value: &_storage._amount) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if !_storage._accountID.isEmpty { + try visitor.visitSingularStringField(value: _storage._accountID, fieldNumber: 1) + } + if !_storage._assetID.isEmpty { + try visitor.visitSingularStringField(value: _storage._assetID, fieldNumber: 2) + } + if let v = _storage._amount { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_SubtractAssetQuantity) -> Bool { if _storage !== other._storage { - let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 if _storage._accountID != other_storage._accountID {return false} if _storage._assetID != other_storage._assetID {return false} if _storage._amount != other_storage._amount {return false} @@ -1511,7 +1253,8 @@ extension Iroha_Protocol_SubtractAssetQuantity: SwiftProtobuf._MessageImplementa } } -extension Iroha_Protocol_Command: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_Command: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Command" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "add_asset_quantity"), 2: .standard(proto: "add_peer"), @@ -1550,9 +1293,191 @@ extension Iroha_Protocol_Command: SwiftProtobuf._MessageImplementationBase, Swif return _storage } + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: + var v: Iroha_Protocol_AddAssetQuantity? + if let current = _storage._command { + try decoder.handleConflictingOneOf() + if case .addAssetQuantity(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._command = .addAssetQuantity(v)} + case 2: + var v: Iroha_Protocol_AddPeer? + if let current = _storage._command { + try decoder.handleConflictingOneOf() + if case .addPeer(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._command = .addPeer(v)} + case 3: + var v: Iroha_Protocol_AddSignatory? + if let current = _storage._command { + try decoder.handleConflictingOneOf() + if case .addSignatory(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._command = .addSignatory(v)} + case 4: + var v: Iroha_Protocol_AppendRole? + if let current = _storage._command { + try decoder.handleConflictingOneOf() + if case .appendRole(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._command = .appendRole(v)} + case 5: + var v: Iroha_Protocol_CreateAccount? + if let current = _storage._command { + try decoder.handleConflictingOneOf() + if case .createAccount(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._command = .createAccount(v)} + case 6: + var v: Iroha_Protocol_CreateAsset? + if let current = _storage._command { + try decoder.handleConflictingOneOf() + if case .createAsset(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._command = .createAsset(v)} + case 7: + var v: Iroha_Protocol_CreateDomain? + if let current = _storage._command { + try decoder.handleConflictingOneOf() + if case .createDomain(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._command = .createDomain(v)} + case 8: + var v: Iroha_Protocol_CreateRole? + if let current = _storage._command { + try decoder.handleConflictingOneOf() + if case .createRole(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._command = .createRole(v)} + case 9: + var v: Iroha_Protocol_DetachRole? + if let current = _storage._command { + try decoder.handleConflictingOneOf() + if case .detachRole(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._command = .detachRole(v)} + case 10: + var v: Iroha_Protocol_GrantPermission? + if let current = _storage._command { + try decoder.handleConflictingOneOf() + if case .grantPermission(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._command = .grantPermission(v)} + case 11: + var v: Iroha_Protocol_RemoveSignatory? + if let current = _storage._command { + try decoder.handleConflictingOneOf() + if case .removeSign(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._command = .removeSign(v)} + case 12: + var v: Iroha_Protocol_RevokePermission? + if let current = _storage._command { + try decoder.handleConflictingOneOf() + if case .revokePermission(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._command = .revokePermission(v)} + case 13: + var v: Iroha_Protocol_SetAccountDetail? + if let current = _storage._command { + try decoder.handleConflictingOneOf() + if case .setAccountDetail(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._command = .setAccountDetail(v)} + case 14: + var v: Iroha_Protocol_SetAccountQuorum? + if let current = _storage._command { + try decoder.handleConflictingOneOf() + if case .setQuorum(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._command = .setQuorum(v)} + case 15: + var v: Iroha_Protocol_SubtractAssetQuantity? + if let current = _storage._command { + try decoder.handleConflictingOneOf() + if case .subtractAssetQuantity(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._command = .subtractAssetQuantity(v)} + case 16: + var v: Iroha_Protocol_TransferAsset? + if let current = _storage._command { + try decoder.handleConflictingOneOf() + if case .transferAsset(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._command = .transferAsset(v)} + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + switch _storage._command { + case .addAssetQuantity(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + case .addPeer(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + case .addSignatory(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + case .appendRole(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + case .createAccount(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + case .createAsset(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + case .createDomain(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + case .createRole(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + case .detachRole(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 9) + case .grantPermission(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 10) + case .removeSign(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 11) + case .revokePermission(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 12) + case .setAccountDetail(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 13) + case .setQuorum(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 14) + case .subtractAssetQuantity(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 15) + case .transferAsset(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 16) + case nil: break + } + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_Command) -> Bool { if _storage !== other._storage { - let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 if _storage._command != other_storage._command {return false} return true } diff --git a/SwiftyIrohaExample/GRPC/endpoint.pb.swift b/SwiftyIrohaExample/GRPC/endpoint.pb.swift index 41ae146a9..5d8e3bda3 100644 --- a/SwiftyIrohaExample/GRPC/endpoint.pb.swift +++ b/SwiftyIrohaExample/GRPC/endpoint.pb.swift @@ -26,7 +26,7 @@ enum Iroha_Protocol_TxStatus: SwiftProtobuf.Enum { case statefulValidationFailed // = 2 case statefulValidationSuccess // = 3 case committed // = 4 - case inProgress // = 5 + case mstExpired // = 5 case notReceived // = 6 case UNRECOGNIZED(Int) @@ -41,7 +41,7 @@ enum Iroha_Protocol_TxStatus: SwiftProtobuf.Enum { case 2: self = .statefulValidationFailed case 3: self = .statefulValidationSuccess case 4: self = .committed - case 5: self = .inProgress + case 5: self = .mstExpired case 6: self = .notReceived default: self = .UNRECOGNIZED(rawValue) } @@ -54,7 +54,7 @@ enum Iroha_Protocol_TxStatus: SwiftProtobuf.Enum { case .statefulValidationFailed: return 2 case .statefulValidationSuccess: return 3 case .committed: return 4 - case .inProgress: return 5 + case .mstExpired: return 5 case .notReceived: return 6 case .UNRECOGNIZED(let i): return i } @@ -62,78 +62,32 @@ enum Iroha_Protocol_TxStatus: SwiftProtobuf.Enum { } -struct Iroha_Protocol_ToriiResponse: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".ToriiResponse" +struct Iroha_Protocol_ToriiResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var txStatus: Iroha_Protocol_TxStatus = .statelessValidationFailed var txHash: Data = SwiftProtobuf.Internal.emptyData + var errorMessage: String = String() + var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularEnumField(value: &self.txStatus) - case 2: try decoder.decodeSingularBytesField(value: &self.txHash) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if self.txStatus != .statelessValidationFailed { - try visitor.visitSingularEnumField(value: self.txStatus, fieldNumber: 1) - } - if !self.txHash.isEmpty { - try visitor.visitSingularBytesField(value: self.txHash, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_TxStatusRequest: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".TxStatusRequest" +struct Iroha_Protocol_TxStatusRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var txHash: Data = SwiftProtobuf.Internal.emptyData var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularBytesField(value: &self.txHash) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.txHash.isEmpty { - try visitor.visitSingularBytesField(value: self.txHash, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } } // MARK: - Code below here is support for the SwiftProtobuf runtime. @@ -147,30 +101,74 @@ extension Iroha_Protocol_TxStatus: SwiftProtobuf._ProtoNameProviding { 2: .same(proto: "STATEFUL_VALIDATION_FAILED"), 3: .same(proto: "STATEFUL_VALIDATION_SUCCESS"), 4: .same(proto: "COMMITTED"), - 5: .same(proto: "IN_PROGRESS"), + 5: .same(proto: "MST_EXPIRED"), 6: .same(proto: "NOT_RECEIVED"), ] } -extension Iroha_Protocol_ToriiResponse: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_ToriiResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ToriiResponse" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "tx_status"), 2: .standard(proto: "tx_hash"), + 3: .standard(proto: "error_message"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self.txStatus) + case 2: try decoder.decodeSingularBytesField(value: &self.txHash) + case 3: try decoder.decodeSingularStringField(value: &self.errorMessage) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.txStatus != .statelessValidationFailed { + try visitor.visitSingularEnumField(value: self.txStatus, fieldNumber: 1) + } + if !self.txHash.isEmpty { + try visitor.visitSingularBytesField(value: self.txHash, fieldNumber: 2) + } + if !self.errorMessage.isEmpty { + try visitor.visitSingularStringField(value: self.errorMessage, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_ToriiResponse) -> Bool { if self.txStatus != other.txStatus {return false} if self.txHash != other.txHash {return false} + if self.errorMessage != other.errorMessage {return false} if unknownFields != other.unknownFields {return false} return true } } -extension Iroha_Protocol_TxStatusRequest: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_TxStatusRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".TxStatusRequest" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "tx_hash"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.txHash) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.txHash.isEmpty { + try visitor.visitSingularBytesField(value: self.txHash, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_TxStatusRequest) -> Bool { if self.txHash != other.txHash {return false} if unknownFields != other.unknownFields {return false} diff --git a/SwiftyIrohaExample/GRPC/iroha.protocol.client.pb.swift b/SwiftyIrohaExample/GRPC/iroha.protocol.client.pb.swift deleted file mode 100644 index 81f2118e0..000000000 --- a/SwiftyIrohaExample/GRPC/iroha.protocol.client.pb.swift +++ /dev/null @@ -1,306 +0,0 @@ -/* - * DO NOT EDIT. - * - * Generated by the protocol buffer compiler. - * Source: endpoint.proto - * - */ - -/* - * Copyright 2017, gRPC Authors All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import Foundation -import Dispatch -import SwiftGRPC -import SwiftProtobuf - -/// Type for errors thrown from generated client code. -internal enum Iroha_Protocol_CommandServiceClientError : Error { - case endOfStream - case invalidMessageReceived - case error(c: CallResult) -} - -/// Torii (Unary) -internal class Iroha_Protocol_CommandServiceToriiCall { - private var call : Call - - /// Create a call. - fileprivate init(_ channel: Channel) { - self.call = channel.makeCall("/iroha.protocol.CommandService/Torii") - } - - /// Run the call. Blocks until the reply is received. - fileprivate func run(request: Iroha_Protocol_Transaction, - metadata: Metadata) throws -> Google_Protobuf_Empty { - let sem = DispatchSemaphore(value: 0) - var returnCallResult : CallResult! - var returnResponse : Google_Protobuf_Empty? - _ = try start(request:request, metadata:metadata) {response, callResult in - returnResponse = response - returnCallResult = callResult - sem.signal() - } - _ = sem.wait(timeout: DispatchTime.distantFuture) - if let returnResponse = returnResponse { - return returnResponse - } else { - throw Iroha_Protocol_CommandServiceClientError.error(c: returnCallResult) - } - } - - /// Start the call. Nonblocking. - fileprivate func start(request: Iroha_Protocol_Transaction, - metadata: Metadata, - completion: @escaping (Google_Protobuf_Empty?, CallResult)->()) - throws -> Iroha_Protocol_CommandServiceToriiCall { - - let requestData = try request.serializedData() - try call.start(.unary, - metadata:metadata, - message:requestData) - {(callResult) in - if let responseData = callResult.resultData, - let response = try? Google_Protobuf_Empty(serializedData:responseData) { - completion(response, callResult) - } else { - completion(nil, callResult) - } - } - return self - } -} - -/// Status (Unary) -internal class Iroha_Protocol_CommandServiceStatusCall { - private var call : Call - - /// Create a call. - fileprivate init(_ channel: Channel) { - self.call = channel.makeCall("/iroha.protocol.CommandService/Status") - } - - /// Run the call. Blocks until the reply is received. - fileprivate func run(request: Iroha_Protocol_TxStatusRequest, - metadata: Metadata) throws -> Iroha_Protocol_ToriiResponse { - let sem = DispatchSemaphore(value: 0) - var returnCallResult : CallResult! - var returnResponse : Iroha_Protocol_ToriiResponse? - _ = try start(request:request, metadata:metadata) {response, callResult in - returnResponse = response - returnCallResult = callResult - sem.signal() - } - _ = sem.wait(timeout: DispatchTime.distantFuture) - if let returnResponse = returnResponse { - return returnResponse - } else { - throw Iroha_Protocol_CommandServiceClientError.error(c: returnCallResult) - } - } - - /// Start the call. Nonblocking. - fileprivate func start(request: Iroha_Protocol_TxStatusRequest, - metadata: Metadata, - completion: @escaping (Iroha_Protocol_ToriiResponse?, CallResult)->()) - throws -> Iroha_Protocol_CommandServiceStatusCall { - - let requestData = try request.serializedData() - try call.start(.unary, - metadata:metadata, - message:requestData) - {(callResult) in - if let responseData = callResult.resultData, - let response = try? Iroha_Protocol_ToriiResponse(serializedData:responseData) { - completion(response, callResult) - } else { - completion(nil, callResult) - } - } - return self - } -} - -/// Call methods of this class to make API calls. -internal class Iroha_Protocol_CommandServiceService { - private var channel: Channel - - /// This metadata will be sent with all requests. - internal var metadata : Metadata - - /// This property allows the service host name to be overridden. - /// For example, it can be used to make calls to "localhost:8080" - /// appear to be to "example.com". - internal var host : String { - get { - return self.channel.host - } - set { - self.channel.host = newValue - } - } - - /// Create a client that makes insecure connections. - internal init(address: String) { - gRPC.initialize() - channel = Channel(address:address, secure: false) - metadata = Metadata() - } - - /// Create a client that makes secure connections. - internal init(address: String, certificates: String?, host: String?) { - gRPC.initialize() - channel = Channel(address:address, certificates:certificates!, host:host) - metadata = Metadata() - } - - /// Synchronous. Unary. - internal func torii(_ request: Iroha_Protocol_Transaction) - throws - -> Google_Protobuf_Empty { - return try Iroha_Protocol_CommandServiceToriiCall(channel).run(request:request, metadata:metadata) - } - /// Asynchronous. Unary. - internal func torii(_ request: Iroha_Protocol_Transaction, - completion: @escaping (Google_Protobuf_Empty?, CallResult)->()) - throws - -> Iroha_Protocol_CommandServiceToriiCall { - return try Iroha_Protocol_CommandServiceToriiCall(channel).start(request:request, - metadata:metadata, - completion:completion) - } - /// Synchronous. Unary. - internal func status(_ request: Iroha_Protocol_TxStatusRequest) - throws - -> Iroha_Protocol_ToriiResponse { - return try Iroha_Protocol_CommandServiceStatusCall(channel).run(request:request, metadata:metadata) - } - /// Asynchronous. Unary. - internal func status(_ request: Iroha_Protocol_TxStatusRequest, - completion: @escaping (Iroha_Protocol_ToriiResponse?, CallResult)->()) - throws - -> Iroha_Protocol_CommandServiceStatusCall { - return try Iroha_Protocol_CommandServiceStatusCall(channel).start(request:request, - metadata:metadata, - completion:completion) - } -} - -/// Type for errors thrown from generated client code. -internal enum Iroha_Protocol_QueryServiceClientError : Error { - case endOfStream - case invalidMessageReceived - case error(c: CallResult) -} - -/// Find (Unary) -internal class Iroha_Protocol_QueryServiceFindCall { - private var call : Call - - /// Create a call. - fileprivate init(_ channel: Channel) { - self.call = channel.makeCall("/iroha.protocol.QueryService/Find") - } - - /// Run the call. Blocks until the reply is received. - fileprivate func run(request: Iroha_Protocol_Query, - metadata: Metadata) throws -> Iroha_Protocol_QueryResponse { - let sem = DispatchSemaphore(value: 0) - var returnCallResult : CallResult! - var returnResponse : Iroha_Protocol_QueryResponse? - _ = try start(request:request, metadata:metadata) {response, callResult in - returnResponse = response - returnCallResult = callResult - sem.signal() - } - _ = sem.wait(timeout: DispatchTime.distantFuture) - if let returnResponse = returnResponse { - return returnResponse - } else { - throw Iroha_Protocol_QueryServiceClientError.error(c: returnCallResult) - } - } - - /// Start the call. Nonblocking. - fileprivate func start(request: Iroha_Protocol_Query, - metadata: Metadata, - completion: @escaping (Iroha_Protocol_QueryResponse?, CallResult)->()) - throws -> Iroha_Protocol_QueryServiceFindCall { - - let requestData = try request.serializedData() - try call.start(.unary, - metadata:metadata, - message:requestData) - {(callResult) in - if let responseData = callResult.resultData, - let response = try? Iroha_Protocol_QueryResponse(serializedData:responseData) { - completion(response, callResult) - } else { - completion(nil, callResult) - } - } - return self - } -} - -/// Call methods of this class to make API calls. -internal class Iroha_Protocol_QueryServiceService { - private var channel: Channel - - /// This metadata will be sent with all requests. - internal var metadata : Metadata - - /// This property allows the service host name to be overridden. - /// For example, it can be used to make calls to "localhost:8080" - /// appear to be to "example.com". - internal var host : String { - get { - return self.channel.host - } - set { - self.channel.host = newValue - } - } - - /// Create a client that makes insecure connections. - internal init(address: String) { - gRPC.initialize() - channel = Channel(address:address, secure: false) - metadata = Metadata() - } - - /// Create a client that makes secure connections. - internal init(address: String, certificates: String?, host: String?) { - gRPC.initialize() - channel = Channel(address:address, certificates:certificates!, host:host) - metadata = Metadata() - } - - /// Synchronous. Unary. - internal func find(_ request: Iroha_Protocol_Query) - throws - -> Iroha_Protocol_QueryResponse { - return try Iroha_Protocol_QueryServiceFindCall(channel).run(request:request, metadata:metadata) - } - /// Asynchronous. Unary. - internal func find(_ request: Iroha_Protocol_Query, - completion: @escaping (Iroha_Protocol_QueryResponse?, CallResult)->()) - throws - -> Iroha_Protocol_QueryServiceFindCall { - return try Iroha_Protocol_QueryServiceFindCall(channel).start(request:request, - metadata:metadata, - completion:completion) - } -} diff --git a/SwiftyIrohaExample/GRPC/loader.pb.swift b/SwiftyIrohaExample/GRPC/loader.pb.swift deleted file mode 100644 index 04a505151..000000000 --- a/SwiftyIrohaExample/GRPC/loader.pb.swift +++ /dev/null @@ -1,132 +0,0 @@ -// DO NOT EDIT. -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: loader.proto -// -// For information on using the generated types, please see the documenation: -// https://github.com/apple/swift-protobuf/ - -// -// Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved. -// http://soramitsu.co.jp -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import Foundation -import SwiftProtobuf - -// If the compiler emits an error on this type, it is because this file -// was generated by a version of the `protoc` Swift plug-in that is -// incompatible with the version of SwiftProtobuf to which you are linking. -// Please ensure that your are building against the same version of the API -// that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { - struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} - typealias Version = _2 -} - -struct Iroha_Network_Proto_BlocksRequest: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".BlocksRequest" - - var height: UInt64 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularUInt64Field(value: &self.height) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if self.height != 0 { - try visitor.visitSingularUInt64Field(value: self.height, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } -} - -struct Iroha_Network_Proto_BlockRequest: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".BlockRequest" - - var hash: Data = SwiftProtobuf.Internal.emptyData - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularBytesField(value: &self.hash) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.hash.isEmpty { - try visitor.visitSingularBytesField(value: self.hash, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } -} - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -fileprivate let _protobuf_package = "iroha.network.proto" - -extension Iroha_Network_Proto_BlocksRequest: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "height"), - ] - - func _protobuf_generated_isEqualTo(other: Iroha_Network_Proto_BlocksRequest) -> Bool { - if self.height != other.height {return false} - if unknownFields != other.unknownFields {return false} - return true - } -} - -extension Iroha_Network_Proto_BlockRequest: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "hash"), - ] - - func _protobuf_generated_isEqualTo(other: Iroha_Network_Proto_BlockRequest) -> Bool { - if self.hash != other.hash {return false} - if unknownFields != other.unknownFields {return false} - return true - } -} diff --git a/SwiftyIrohaExample/GRPC/mst.pb.swift b/SwiftyIrohaExample/GRPC/mst.pb.swift index e47065bde..364a5d9a4 100644 --- a/SwiftyIrohaExample/GRPC/mst.pb.swift +++ b/SwiftyIrohaExample/GRPC/mst.pb.swift @@ -20,8 +20,10 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP } /// TODO: @l4l (04/05/18) remove in favor of primitive.proto IR-1321 -struct Iroha_Network_Transport_Peer: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".Peer" +struct Iroha_Network_Transport_Peer { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var pubkey: Data = SwiftProtobuf.Internal.emptyData @@ -30,38 +32,12 @@ struct Iroha_Network_Transport_Peer: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularBytesField(value: &self.pubkey) - case 2: try decoder.decodeSingularStringField(value: &self.address) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.pubkey.isEmpty { - try visitor.visitSingularBytesField(value: self.pubkey, fieldNumber: 1) - } - if !self.address.isEmpty { - try visitor.visitSingularStringField(value: self.address, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Network_Transport_MstState: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".MstState" +struct Iroha_Network_Transport_MstState { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var transactions: [Iroha_Protocol_Transaction] { get {return _storage._transactions} @@ -81,39 +57,6 @@ struct Iroha_Network_Transport_MstState: SwiftProtobuf.Message { init() {} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeRepeatedMessageField(value: &_storage._transactions) - case 2: try decoder.decodeSingularMessageField(value: &_storage._peer) - default: break - } - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if !_storage._transactions.isEmpty { - try visitor.visitRepeatedMessageField(value: _storage._transactions, fieldNumber: 1) - } - if let v = _storage._peer { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } - } - try unknownFields.traverse(visitor: &visitor) - } - fileprivate var _storage = _StorageClass.defaultInstance } @@ -121,12 +64,33 @@ struct Iroha_Network_Transport_MstState: SwiftProtobuf.Message { fileprivate let _protobuf_package = "iroha.network.transport" -extension Iroha_Network_Transport_Peer: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Network_Transport_Peer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Peer" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pubkey"), 2: .same(proto: "address"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.pubkey) + case 2: try decoder.decodeSingularStringField(value: &self.address) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pubkey.isEmpty { + try visitor.visitSingularBytesField(value: self.pubkey, fieldNumber: 1) + } + if !self.address.isEmpty { + try visitor.visitSingularStringField(value: self.address, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Network_Transport_Peer) -> Bool { if self.pubkey != other.pubkey {return false} if self.address != other.address {return false} @@ -135,7 +99,8 @@ extension Iroha_Network_Transport_Peer: SwiftProtobuf._MessageImplementationBase } } -extension Iroha_Network_Transport_MstState: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Network_Transport_MstState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".MstState" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "transactions"), 2: .same(proto: "peer"), @@ -162,6 +127,31 @@ extension Iroha_Network_Transport_MstState: SwiftProtobuf._MessageImplementation return _storage } + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &_storage._transactions) + case 2: try decoder.decodeSingularMessageField(value: &_storage._peer) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if !_storage._transactions.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._transactions, fieldNumber: 1) + } + if let v = _storage._peer { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Network_Transport_MstState) -> Bool { if _storage !== other._storage { let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in diff --git a/SwiftyIrohaExample/GRPC/ordering.grpc.swift b/SwiftyIrohaExample/GRPC/ordering.grpc.swift new file mode 100644 index 000000000..c2135bea0 --- /dev/null +++ b/SwiftyIrohaExample/GRPC/ordering.grpc.swift @@ -0,0 +1,180 @@ +// +// DO NOT EDIT. +// +// Generated by the protocol buffer compiler. +// Source: ordering.proto +// + +// +// Copyright 2018, gRPC Authors All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +import Foundation +import Dispatch +import SwiftGRPC +import SwiftProtobuf + +internal protocol Iroha_Ordering_Proto_OrderingGateTransportGrpconProposalCall: ClientCallUnary {} + +fileprivate final class Iroha_Ordering_Proto_OrderingGateTransportGrpconProposalCallBase: ClientCallUnaryBase, Iroha_Ordering_Proto_OrderingGateTransportGrpconProposalCall { + override class var method: String { return "/iroha.ordering.proto.OrderingGateTransportGrpc/onProposal" } +} + + +/// Instantiate Iroha_Ordering_Proto_OrderingGateTransportGrpcServiceClient, then call methods of this protocol to make API calls. +internal protocol Iroha_Ordering_Proto_OrderingGateTransportGrpcService: ServiceClient { + /// Synchronous. Unary. + func onProposal(_ request: Iroha_Protocol_Proposal) throws -> SwiftProtobuf.Google_Protobuf_Empty + /// Asynchronous. Unary. + func onProposal(_ request: Iroha_Protocol_Proposal, completion: @escaping (SwiftProtobuf.Google_Protobuf_Empty?, CallResult) -> Void) throws -> Iroha_Ordering_Proto_OrderingGateTransportGrpconProposalCall + +} + +internal final class Iroha_Ordering_Proto_OrderingGateTransportGrpcServiceClient: ServiceClientBase, Iroha_Ordering_Proto_OrderingGateTransportGrpcService { + /// Synchronous. Unary. + internal func onProposal(_ request: Iroha_Protocol_Proposal) throws -> SwiftProtobuf.Google_Protobuf_Empty { + return try Iroha_Ordering_Proto_OrderingGateTransportGrpconProposalCallBase(channel) + .run(request: request, metadata: metadata) + } + /// Asynchronous. Unary. + internal func onProposal(_ request: Iroha_Protocol_Proposal, completion: @escaping (SwiftProtobuf.Google_Protobuf_Empty?, CallResult) -> Void) throws -> Iroha_Ordering_Proto_OrderingGateTransportGrpconProposalCall { + return try Iroha_Ordering_Proto_OrderingGateTransportGrpconProposalCallBase(channel) + .start(request: request, metadata: metadata, completion: completion) + } + +} +internal protocol Iroha_Ordering_Proto_OrderingServiceTransportGrpconTransactionCall: ClientCallUnary {} + +fileprivate final class Iroha_Ordering_Proto_OrderingServiceTransportGrpconTransactionCallBase: ClientCallUnaryBase, Iroha_Ordering_Proto_OrderingServiceTransportGrpconTransactionCall { + override class var method: String { return "/iroha.ordering.proto.OrderingServiceTransportGrpc/onTransaction" } +} + + +/// Instantiate Iroha_Ordering_Proto_OrderingServiceTransportGrpcServiceClient, then call methods of this protocol to make API calls. +internal protocol Iroha_Ordering_Proto_OrderingServiceTransportGrpcService: ServiceClient { + /// Synchronous. Unary. + func onTransaction(_ request: Iroha_Protocol_Transaction) throws -> SwiftProtobuf.Google_Protobuf_Empty + /// Asynchronous. Unary. + func onTransaction(_ request: Iroha_Protocol_Transaction, completion: @escaping (SwiftProtobuf.Google_Protobuf_Empty?, CallResult) -> Void) throws -> Iroha_Ordering_Proto_OrderingServiceTransportGrpconTransactionCall + +} + +internal final class Iroha_Ordering_Proto_OrderingServiceTransportGrpcServiceClient: ServiceClientBase, Iroha_Ordering_Proto_OrderingServiceTransportGrpcService { + /// Synchronous. Unary. + internal func onTransaction(_ request: Iroha_Protocol_Transaction) throws -> SwiftProtobuf.Google_Protobuf_Empty { + return try Iroha_Ordering_Proto_OrderingServiceTransportGrpconTransactionCallBase(channel) + .run(request: request, metadata: metadata) + } + /// Asynchronous. Unary. + internal func onTransaction(_ request: Iroha_Protocol_Transaction, completion: @escaping (SwiftProtobuf.Google_Protobuf_Empty?, CallResult) -> Void) throws -> Iroha_Ordering_Proto_OrderingServiceTransportGrpconTransactionCall { + return try Iroha_Ordering_Proto_OrderingServiceTransportGrpconTransactionCallBase(channel) + .start(request: request, metadata: metadata, completion: completion) + } + +} + +/// To build a server, implement a class that conforms to this protocol. +/// If one of the methods returning `ServerStatus?` returns nil, +/// it is expected that you have already returned a status to the client by means of `session.close`. +internal protocol Iroha_Ordering_Proto_OrderingGateTransportGrpcProvider { + func onProposal(request: Iroha_Protocol_Proposal, session: Iroha_Ordering_Proto_OrderingGateTransportGrpconProposalSession) throws -> SwiftProtobuf.Google_Protobuf_Empty +} + +internal protocol Iroha_Ordering_Proto_OrderingGateTransportGrpconProposalSession: ServerSessionUnary {} + +fileprivate final class Iroha_Ordering_Proto_OrderingGateTransportGrpconProposalSessionBase: ServerSessionUnaryBase, Iroha_Ordering_Proto_OrderingGateTransportGrpconProposalSession {} + + +/// Main server for generated service +internal final class Iroha_Ordering_Proto_OrderingGateTransportGrpcServer: ServiceServer { + private let provider: Iroha_Ordering_Proto_OrderingGateTransportGrpcProvider + + internal init(address: String, provider: Iroha_Ordering_Proto_OrderingGateTransportGrpcProvider) { + self.provider = provider + super.init(address: address) + } + + internal init?(address: String, certificateURL: URL, keyURL: URL, provider: Iroha_Ordering_Proto_OrderingGateTransportGrpcProvider) { + self.provider = provider + super.init(address: address, certificateURL: certificateURL, keyURL: keyURL) + } + + internal init?(address: String, certificateString: String, keyString: String, provider: Iroha_Ordering_Proto_OrderingGateTransportGrpcProvider) { + self.provider = provider + super.init(address: address, certificateString: certificateString, keyString: keyString) + } + + /// Determines and calls the appropriate request handler, depending on the request's method. + /// Throws `HandleMethodError.unknownMethod` for methods not handled by this service. + internal override func handleMethod(_ method: String, handler: Handler) throws -> ServerStatus? { + let provider = self.provider + switch method { + case "/iroha.ordering.proto.OrderingGateTransportGrpc/onProposal": + return try Iroha_Ordering_Proto_OrderingGateTransportGrpconProposalSessionBase( + handler: handler, + providerBlock: { try provider.onProposal(request: $0, session: $1 as! Iroha_Ordering_Proto_OrderingGateTransportGrpconProposalSessionBase) }) + .run() + default: + throw HandleMethodError.unknownMethod + } + } +} + +/// To build a server, implement a class that conforms to this protocol. +/// If one of the methods returning `ServerStatus?` returns nil, +/// it is expected that you have already returned a status to the client by means of `session.close`. +internal protocol Iroha_Ordering_Proto_OrderingServiceTransportGrpcProvider { + func onTransaction(request: Iroha_Protocol_Transaction, session: Iroha_Ordering_Proto_OrderingServiceTransportGrpconTransactionSession) throws -> SwiftProtobuf.Google_Protobuf_Empty +} + +internal protocol Iroha_Ordering_Proto_OrderingServiceTransportGrpconTransactionSession: ServerSessionUnary {} + +fileprivate final class Iroha_Ordering_Proto_OrderingServiceTransportGrpconTransactionSessionBase: ServerSessionUnaryBase, Iroha_Ordering_Proto_OrderingServiceTransportGrpconTransactionSession {} + + +/// Main server for generated service +internal final class Iroha_Ordering_Proto_OrderingServiceTransportGrpcServer: ServiceServer { + private let provider: Iroha_Ordering_Proto_OrderingServiceTransportGrpcProvider + + internal init(address: String, provider: Iroha_Ordering_Proto_OrderingServiceTransportGrpcProvider) { + self.provider = provider + super.init(address: address) + } + + internal init?(address: String, certificateURL: URL, keyURL: URL, provider: Iroha_Ordering_Proto_OrderingServiceTransportGrpcProvider) { + self.provider = provider + super.init(address: address, certificateURL: certificateURL, keyURL: keyURL) + } + + internal init?(address: String, certificateString: String, keyString: String, provider: Iroha_Ordering_Proto_OrderingServiceTransportGrpcProvider) { + self.provider = provider + super.init(address: address, certificateString: certificateString, keyString: keyString) + } + + /// Determines and calls the appropriate request handler, depending on the request's method. + /// Throws `HandleMethodError.unknownMethod` for methods not handled by this service. + internal override func handleMethod(_ method: String, handler: Handler) throws -> ServerStatus? { + let provider = self.provider + switch method { + case "/iroha.ordering.proto.OrderingServiceTransportGrpc/onTransaction": + return try Iroha_Ordering_Proto_OrderingServiceTransportGrpconTransactionSessionBase( + handler: handler, + providerBlock: { try provider.onTransaction(request: $0, session: $1 as! Iroha_Ordering_Proto_OrderingServiceTransportGrpconTransactionSessionBase) }) + .run() + default: + throw HandleMethodError.unknownMethod + } + } +} + diff --git a/SwiftyIrohaExample/GRPC/ordering.pb.swift b/SwiftyIrohaExample/GRPC/ordering.pb.swift index 69c8fc61a..c4d790619 100644 --- a/SwiftyIrohaExample/GRPC/ordering.pb.swift +++ b/SwiftyIrohaExample/GRPC/ordering.pb.swift @@ -18,69 +18,3 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } - -struct Iroha_Ordering_Proto_Proposal: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".Proposal" - - var height: UInt64 = 0 - - var transactions: [Iroha_Protocol_Transaction] = [] - - var createdTime: UInt64 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularUInt64Field(value: &self.height) - case 2: try decoder.decodeRepeatedMessageField(value: &self.transactions) - case 3: try decoder.decodeSingularUInt64Field(value: &self.createdTime) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if self.height != 0 { - try visitor.visitSingularUInt64Field(value: self.height, fieldNumber: 1) - } - if !self.transactions.isEmpty { - try visitor.visitRepeatedMessageField(value: self.transactions, fieldNumber: 2) - } - if self.createdTime != 0 { - try visitor.visitSingularUInt64Field(value: self.createdTime, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } -} - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -fileprivate let _protobuf_package = "iroha.ordering.proto" - -extension Iroha_Ordering_Proto_Proposal: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "height"), - 2: .same(proto: "transactions"), - 3: .standard(proto: "created_time"), - ] - - func _protobuf_generated_isEqualTo(other: Iroha_Ordering_Proto_Proposal) -> Bool { - if self.height != other.height {return false} - if self.transactions != other.transactions {return false} - if self.createdTime != other.createdTime {return false} - if unknownFields != other.unknownFields {return false} - return true - } -} diff --git a/SwiftyIrohaExample/GRPC/primitive.pb.swift b/SwiftyIrohaExample/GRPC/primitive.pb.swift index 535cea624..1a87f8748 100644 --- a/SwiftyIrohaExample/GRPC/primitive.pb.swift +++ b/SwiftyIrohaExample/GRPC/primitive.pb.swift @@ -6,6 +6,12 @@ // For information on using the generated types, please see the documenation: // https://github.com/apple/swift-protobuf/ +//* +// Messages related to primitive types, used in Commands and Queries +// +// Contains RolePermission, GrantablePermission, Signature, +// uint256, Amount, and Peer. + import Foundation import SwiftProtobuf @@ -19,48 +25,67 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } +///* +/// Represents any possible value for permission field, +/// then the account is capable of performing such action. +/// +/// Command and Query related permissions are included in the role, +/// which an Account can have. +/// +/// Grantable permission is set as a relation between two accounts: +/// Account A is granting Permission to Account B, +/// so that Account B can perform actions over Account A. enum Iroha_Protocol_RolePermission: SwiftProtobuf.Enum { typealias RawValue = Int /// Command Permissions case canAppendRole // = 0 - case canDetachRole // = 31 case canCreateRole // = 1 - case canAddAssetQty // = 2 - case canAddPeer // = 3 - case canAddSignatory // = 4 - case canCreateAccount // = 5 - case canCreateAsset // = 6 - case canCreateDomain // = 7 - case canRemoveSignatory // = 8 - case canSetQuorum // = 9 - case canTransfer // = 10 - case canReceive // = 11 - case canSubtractAssetQty // = 12 + case canDetachRole // = 2 + case canAddAssetQty // = 3 + case canSubtractAssetQty // = 4 + case canAddPeer // = 5 + case canAddSignatory // = 6 + case canRemoveSignatory // = 7 + case canSetQuorum // = 8 + case canCreateAccount // = 9 + case canSetDetail // = 10 + case canCreateAsset // = 11 + case canTransfer // = 12 + case canReceive // = 13 + case canCreateDomain // = 14 /// Query permissions - case canReadAssets // = 13 - case canGetRoles // = 14 - case canGetMyAccount // = 15 - case canGetAllAccounts // = 16 - case canGetMySignatories // = 17 - case canGetAllSignatories // = 18 - case canGetMyAccAst // = 19 - case canGetMyAccDetail // = 20 - case canGetAllAccAst // = 21 - case canGetMyAccTxs // = 22 - case canGetAllAccTxs // = 23 - case canGetMyAccAstTxs // = 24 - case canGetAllAccAstTxs // = 25 - case canGetMyTxs // = 32 - case canGetAllTxs // = 33 + case canReadAssets // = 15 + case canGetRoles // = 16 + case canGetMyAccount // = 17 + case canGetAllAccounts // = 18 + case canGetDomainAccounts // = 19 + case canGetMySignatories // = 20 + case canGetAllSignatories // = 21 + case canGetDomainSignatories // = 22 + case canGetMyAccAst // = 23 + case canGetAllAccAst // = 24 + case canGetDomainAccAst // = 25 + case canGetMyAccDetail // = 26 + case canGetAllAccDetail // = 27 + case canGetDomainAccDetail // = 28 + case canGetMyAccTxs // = 29 + case canGetAllAccTxs // = 30 + case canGetDomainAccTxs // = 31 + case canGetMyAccAstTxs // = 32 + case canGetAllAccAstTxs // = 33 + case canGetDomainAccAstTxs // = 34 + case canGetMyTxs // = 35 + case canGetAllTxs // = 36 + case canGetBlocks // = 42 /// Grant permissions - case canGrantAddSignatory // = 26 - case canGrantRemoveSignatory // = 27 - case canGrantSetQuorum // = 28 - case canGrantCanTransfer // = 29 - case canGrantCanSetDetail // = 30 + case canGrantCanSetMyQuorum // = 37 + case canGrantCanAddMySignatory // = 38 + case canGrantCanRemoveMySignatory // = 39 + case canGrantCanTransferMyAssets // = 40 + case canGrantCanSetMyAccountDetail // = 41 case UNRECOGNIZED(Int) init() { @@ -71,38 +96,47 @@ enum Iroha_Protocol_RolePermission: SwiftProtobuf.Enum { switch rawValue { case 0: self = .canAppendRole case 1: self = .canCreateRole - case 2: self = .canAddAssetQty - case 3: self = .canAddPeer - case 4: self = .canAddSignatory - case 5: self = .canCreateAccount - case 6: self = .canCreateAsset - case 7: self = .canCreateDomain - case 8: self = .canRemoveSignatory - case 9: self = .canSetQuorum - case 10: self = .canTransfer - case 11: self = .canReceive - case 12: self = .canSubtractAssetQty - case 13: self = .canReadAssets - case 14: self = .canGetRoles - case 15: self = .canGetMyAccount - case 16: self = .canGetAllAccounts - case 17: self = .canGetMySignatories - case 18: self = .canGetAllSignatories - case 19: self = .canGetMyAccAst - case 20: self = .canGetMyAccDetail - case 21: self = .canGetAllAccAst - case 22: self = .canGetMyAccTxs - case 23: self = .canGetAllAccTxs - case 24: self = .canGetMyAccAstTxs - case 25: self = .canGetAllAccAstTxs - case 26: self = .canGrantAddSignatory - case 27: self = .canGrantRemoveSignatory - case 28: self = .canGrantSetQuorum - case 29: self = .canGrantCanTransfer - case 30: self = .canGrantCanSetDetail - case 31: self = .canDetachRole - case 32: self = .canGetMyTxs - case 33: self = .canGetAllTxs + case 2: self = .canDetachRole + case 3: self = .canAddAssetQty + case 4: self = .canSubtractAssetQty + case 5: self = .canAddPeer + case 6: self = .canAddSignatory + case 7: self = .canRemoveSignatory + case 8: self = .canSetQuorum + case 9: self = .canCreateAccount + case 10: self = .canSetDetail + case 11: self = .canCreateAsset + case 12: self = .canTransfer + case 13: self = .canReceive + case 14: self = .canCreateDomain + case 15: self = .canReadAssets + case 16: self = .canGetRoles + case 17: self = .canGetMyAccount + case 18: self = .canGetAllAccounts + case 19: self = .canGetDomainAccounts + case 20: self = .canGetMySignatories + case 21: self = .canGetAllSignatories + case 22: self = .canGetDomainSignatories + case 23: self = .canGetMyAccAst + case 24: self = .canGetAllAccAst + case 25: self = .canGetDomainAccAst + case 26: self = .canGetMyAccDetail + case 27: self = .canGetAllAccDetail + case 28: self = .canGetDomainAccDetail + case 29: self = .canGetMyAccTxs + case 30: self = .canGetAllAccTxs + case 31: self = .canGetDomainAccTxs + case 32: self = .canGetMyAccAstTxs + case 33: self = .canGetAllAccAstTxs + case 34: self = .canGetDomainAccAstTxs + case 35: self = .canGetMyTxs + case 36: self = .canGetAllTxs + case 37: self = .canGrantCanSetMyQuorum + case 38: self = .canGrantCanAddMySignatory + case 39: self = .canGrantCanRemoveMySignatory + case 40: self = .canGrantCanTransferMyAssets + case 41: self = .canGrantCanSetMyAccountDetail + case 42: self = .canGetBlocks default: self = .UNRECOGNIZED(rawValue) } } @@ -111,38 +145,47 @@ enum Iroha_Protocol_RolePermission: SwiftProtobuf.Enum { switch self { case .canAppendRole: return 0 case .canCreateRole: return 1 - case .canAddAssetQty: return 2 - case .canAddPeer: return 3 - case .canAddSignatory: return 4 - case .canCreateAccount: return 5 - case .canCreateAsset: return 6 - case .canCreateDomain: return 7 - case .canRemoveSignatory: return 8 - case .canSetQuorum: return 9 - case .canTransfer: return 10 - case .canReceive: return 11 - case .canSubtractAssetQty: return 12 - case .canReadAssets: return 13 - case .canGetRoles: return 14 - case .canGetMyAccount: return 15 - case .canGetAllAccounts: return 16 - case .canGetMySignatories: return 17 - case .canGetAllSignatories: return 18 - case .canGetMyAccAst: return 19 - case .canGetMyAccDetail: return 20 - case .canGetAllAccAst: return 21 - case .canGetMyAccTxs: return 22 - case .canGetAllAccTxs: return 23 - case .canGetMyAccAstTxs: return 24 - case .canGetAllAccAstTxs: return 25 - case .canGrantAddSignatory: return 26 - case .canGrantRemoveSignatory: return 27 - case .canGrantSetQuorum: return 28 - case .canGrantCanTransfer: return 29 - case .canGrantCanSetDetail: return 30 - case .canDetachRole: return 31 - case .canGetMyTxs: return 32 - case .canGetAllTxs: return 33 + case .canDetachRole: return 2 + case .canAddAssetQty: return 3 + case .canSubtractAssetQty: return 4 + case .canAddPeer: return 5 + case .canAddSignatory: return 6 + case .canRemoveSignatory: return 7 + case .canSetQuorum: return 8 + case .canCreateAccount: return 9 + case .canSetDetail: return 10 + case .canCreateAsset: return 11 + case .canTransfer: return 12 + case .canReceive: return 13 + case .canCreateDomain: return 14 + case .canReadAssets: return 15 + case .canGetRoles: return 16 + case .canGetMyAccount: return 17 + case .canGetAllAccounts: return 18 + case .canGetDomainAccounts: return 19 + case .canGetMySignatories: return 20 + case .canGetAllSignatories: return 21 + case .canGetDomainSignatories: return 22 + case .canGetMyAccAst: return 23 + case .canGetAllAccAst: return 24 + case .canGetDomainAccAst: return 25 + case .canGetMyAccDetail: return 26 + case .canGetAllAccDetail: return 27 + case .canGetDomainAccDetail: return 28 + case .canGetMyAccTxs: return 29 + case .canGetAllAccTxs: return 30 + case .canGetDomainAccTxs: return 31 + case .canGetMyAccAstTxs: return 32 + case .canGetAllAccAstTxs: return 33 + case .canGetDomainAccAstTxs: return 34 + case .canGetMyTxs: return 35 + case .canGetAllTxs: return 36 + case .canGrantCanSetMyQuorum: return 37 + case .canGrantCanAddMySignatory: return 38 + case .canGrantCanRemoveMySignatory: return 39 + case .canGrantCanTransferMyAssets: return 40 + case .canGrantCanSetMyAccountDetail: return 41 + case .canGetBlocks: return 42 case .UNRECOGNIZED(let i): return i } } @@ -155,6 +198,9 @@ enum Iroha_Protocol_GrantablePermission: SwiftProtobuf.Enum { case canRemoveMySignatory // = 1 case canSetMyQuorum // = 2 case canSetMyAccountDetail // = 3 + + /// not implemented now + case canTransferMyAssets // = 4 case UNRECOGNIZED(Int) init() { @@ -167,6 +213,7 @@ enum Iroha_Protocol_GrantablePermission: SwiftProtobuf.Enum { case 1: self = .canRemoveMySignatory case 2: self = .canSetMyQuorum case 3: self = .canSetMyAccountDetail + case 4: self = .canTransferMyAssets default: self = .UNRECOGNIZED(rawValue) } } @@ -177,14 +224,17 @@ enum Iroha_Protocol_GrantablePermission: SwiftProtobuf.Enum { case .canRemoveMySignatory: return 1 case .canSetMyQuorum: return 2 case .canSetMyAccountDetail: return 3 + case .canTransferMyAssets: return 4 case .UNRECOGNIZED(let i): return i } } } -struct Iroha_Protocol_Signature: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".Signature" +struct Iroha_Protocol_Signature { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var pubkey: Data = SwiftProtobuf.Internal.emptyData @@ -193,38 +243,12 @@ struct Iroha_Protocol_Signature: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularBytesField(value: &self.pubkey) - case 2: try decoder.decodeSingularBytesField(value: &self.signature) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.pubkey.isEmpty { - try visitor.visitSingularBytesField(value: self.pubkey, fieldNumber: 1) - } - if !self.signature.isEmpty { - try visitor.visitSingularBytesField(value: self.signature, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_uint256: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".uint256" +struct Iroha_Protocol_uint256 { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var first: UInt64 = 0 @@ -237,46 +261,12 @@ struct Iroha_Protocol_uint256: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularUInt64Field(value: &self.first) - case 2: try decoder.decodeSingularUInt64Field(value: &self.second) - case 3: try decoder.decodeSingularUInt64Field(value: &self.third) - case 4: try decoder.decodeSingularUInt64Field(value: &self.fourth) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if self.first != 0 { - try visitor.visitSingularUInt64Field(value: self.first, fieldNumber: 1) - } - if self.second != 0 { - try visitor.visitSingularUInt64Field(value: self.second, fieldNumber: 2) - } - if self.third != 0 { - try visitor.visitSingularUInt64Field(value: self.third, fieldNumber: 3) - } - if self.fourth != 0 { - try visitor.visitSingularUInt64Field(value: self.fourth, fieldNumber: 4) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_Amount: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".Amount" +struct Iroha_Protocol_Amount { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var value: Iroha_Protocol_uint256 { get {return _storage._value ?? Iroha_Protocol_uint256()} @@ -296,44 +286,13 @@ struct Iroha_Protocol_Amount: SwiftProtobuf.Message { init() {} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_storage._value) - case 2: try decoder.decodeSingularUInt32Field(value: &_storage._precision) - default: break - } - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if let v = _storage._value { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } - if _storage._precision != 0 { - try visitor.visitSingularUInt32Field(value: _storage._precision, fieldNumber: 2) - } - } - try unknownFields.traverse(visitor: &visitor) - } - fileprivate var _storage = _StorageClass.defaultInstance } -struct Iroha_Protocol_Peer: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".Peer" +struct Iroha_Protocol_Peer { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var address: String = String() @@ -342,34 +301,6 @@ struct Iroha_Protocol_Peer: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.address) - case 2: try decoder.decodeSingularBytesField(value: &self.peerKey) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.address.isEmpty { - try visitor.visitSingularStringField(value: self.address, fieldNumber: 1) - } - if !self.peerKey.isEmpty { - try visitor.visitSingularBytesField(value: self.peerKey, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } } // MARK: - Code below here is support for the SwiftProtobuf runtime. @@ -380,38 +311,47 @@ extension Iroha_Protocol_RolePermission: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "can_append_role"), 1: .same(proto: "can_create_role"), - 2: .same(proto: "can_add_asset_qty"), - 3: .same(proto: "can_add_peer"), - 4: .same(proto: "can_add_signatory"), - 5: .same(proto: "can_create_account"), - 6: .same(proto: "can_create_asset"), - 7: .same(proto: "can_create_domain"), - 8: .same(proto: "can_remove_signatory"), - 9: .same(proto: "can_set_quorum"), - 10: .same(proto: "can_transfer"), - 11: .same(proto: "can_receive"), - 12: .same(proto: "can_subtract_asset_qty"), - 13: .same(proto: "can_read_assets"), - 14: .same(proto: "can_get_roles"), - 15: .same(proto: "can_get_my_account"), - 16: .same(proto: "can_get_all_accounts"), - 17: .same(proto: "can_get_my_signatories"), - 18: .same(proto: "can_get_all_signatories"), - 19: .same(proto: "can_get_my_acc_ast"), - 20: .same(proto: "can_get_my_acc_detail"), - 21: .same(proto: "can_get_all_acc_ast"), - 22: .same(proto: "can_get_my_acc_txs"), - 23: .same(proto: "can_get_all_acc_txs"), - 24: .same(proto: "can_get_my_acc_ast_txs"), - 25: .same(proto: "can_get_all_acc_ast_txs"), - 26: .same(proto: "can_grant_add_signatory"), - 27: .same(proto: "can_grant_remove_signatory"), - 28: .same(proto: "can_grant_set_quorum"), - 29: .same(proto: "can_grant_can_transfer"), - 30: .same(proto: "can_grant_can_set_detail"), - 31: .same(proto: "can_detach_role"), - 32: .same(proto: "can_get_my_txs"), - 33: .same(proto: "can_get_all_txs"), + 2: .same(proto: "can_detach_role"), + 3: .same(proto: "can_add_asset_qty"), + 4: .same(proto: "can_subtract_asset_qty"), + 5: .same(proto: "can_add_peer"), + 6: .same(proto: "can_add_signatory"), + 7: .same(proto: "can_remove_signatory"), + 8: .same(proto: "can_set_quorum"), + 9: .same(proto: "can_create_account"), + 10: .same(proto: "can_set_detail"), + 11: .same(proto: "can_create_asset"), + 12: .same(proto: "can_transfer"), + 13: .same(proto: "can_receive"), + 14: .same(proto: "can_create_domain"), + 15: .same(proto: "can_read_assets"), + 16: .same(proto: "can_get_roles"), + 17: .same(proto: "can_get_my_account"), + 18: .same(proto: "can_get_all_accounts"), + 19: .same(proto: "can_get_domain_accounts"), + 20: .same(proto: "can_get_my_signatories"), + 21: .same(proto: "can_get_all_signatories"), + 22: .same(proto: "can_get_domain_signatories"), + 23: .same(proto: "can_get_my_acc_ast"), + 24: .same(proto: "can_get_all_acc_ast"), + 25: .same(proto: "can_get_domain_acc_ast"), + 26: .same(proto: "can_get_my_acc_detail"), + 27: .same(proto: "can_get_all_acc_detail"), + 28: .same(proto: "can_get_domain_acc_detail"), + 29: .same(proto: "can_get_my_acc_txs"), + 30: .same(proto: "can_get_all_acc_txs"), + 31: .same(proto: "can_get_domain_acc_txs"), + 32: .same(proto: "can_get_my_acc_ast_txs"), + 33: .same(proto: "can_get_all_acc_ast_txs"), + 34: .same(proto: "can_get_domain_acc_ast_txs"), + 35: .same(proto: "can_get_my_txs"), + 36: .same(proto: "can_get_all_txs"), + 37: .same(proto: "can_grant_can_set_my_quorum"), + 38: .same(proto: "can_grant_can_add_my_signatory"), + 39: .same(proto: "can_grant_can_remove_my_signatory"), + 40: .same(proto: "can_grant_can_transfer_my_assets"), + 41: .same(proto: "can_grant_can_set_my_account_detail"), + 42: .same(proto: "can_get_blocks"), ] } @@ -421,15 +361,37 @@ extension Iroha_Protocol_GrantablePermission: SwiftProtobuf._ProtoNameProviding 1: .same(proto: "can_remove_my_signatory"), 2: .same(proto: "can_set_my_quorum"), 3: .same(proto: "can_set_my_account_detail"), + 4: .same(proto: "can_transfer_my_assets"), ] } -extension Iroha_Protocol_Signature: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_Signature: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Signature" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "pubkey"), 2: .same(proto: "signature"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.pubkey) + case 2: try decoder.decodeSingularBytesField(value: &self.signature) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pubkey.isEmpty { + try visitor.visitSingularBytesField(value: self.pubkey, fieldNumber: 1) + } + if !self.signature.isEmpty { + try visitor.visitSingularBytesField(value: self.signature, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_Signature) -> Bool { if self.pubkey != other.pubkey {return false} if self.signature != other.signature {return false} @@ -438,7 +400,8 @@ extension Iroha_Protocol_Signature: SwiftProtobuf._MessageImplementationBase, Sw } } -extension Iroha_Protocol_uint256: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_uint256: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".uint256" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "first"), 2: .same(proto: "second"), @@ -446,6 +409,34 @@ extension Iroha_Protocol_uint256: SwiftProtobuf._MessageImplementationBase, Swif 4: .same(proto: "fourth"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.first) + case 2: try decoder.decodeSingularUInt64Field(value: &self.second) + case 3: try decoder.decodeSingularUInt64Field(value: &self.third) + case 4: try decoder.decodeSingularUInt64Field(value: &self.fourth) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.first != 0 { + try visitor.visitSingularUInt64Field(value: self.first, fieldNumber: 1) + } + if self.second != 0 { + try visitor.visitSingularUInt64Field(value: self.second, fieldNumber: 2) + } + if self.third != 0 { + try visitor.visitSingularUInt64Field(value: self.third, fieldNumber: 3) + } + if self.fourth != 0 { + try visitor.visitSingularUInt64Field(value: self.fourth, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_uint256) -> Bool { if self.first != other.first {return false} if self.second != other.second {return false} @@ -456,7 +447,8 @@ extension Iroha_Protocol_uint256: SwiftProtobuf._MessageImplementationBase, Swif } } -extension Iroha_Protocol_Amount: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_Amount: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Amount" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "value"), 2: .same(proto: "precision"), @@ -483,9 +475,36 @@ extension Iroha_Protocol_Amount: SwiftProtobuf._MessageImplementationBase, Swift return _storage } + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._value) + case 2: try decoder.decodeSingularUInt32Field(value: &_storage._precision) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._value { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if _storage._precision != 0 { + try visitor.visitSingularUInt32Field(value: _storage._precision, fieldNumber: 2) + } + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_Amount) -> Bool { if _storage !== other._storage { - let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 if _storage._value != other_storage._value {return false} if _storage._precision != other_storage._precision {return false} return true @@ -497,12 +516,33 @@ extension Iroha_Protocol_Amount: SwiftProtobuf._MessageImplementationBase, Swift } } -extension Iroha_Protocol_Peer: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_Peer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Peer" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "address"), 2: .standard(proto: "peer_key"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.address) + case 2: try decoder.decodeSingularBytesField(value: &self.peerKey) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.address.isEmpty { + try visitor.visitSingularStringField(value: self.address, fieldNumber: 1) + } + if !self.peerKey.isEmpty { + try visitor.visitSingularBytesField(value: self.peerKey, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_Peer) -> Bool { if self.address != other.address {return false} if self.peerKey != other.peerKey {return false} diff --git a/SwiftyIrohaExample/GRPC/proposal.pb.swift b/SwiftyIrohaExample/GRPC/proposal.pb.swift new file mode 100644 index 000000000..65a8e338a --- /dev/null +++ b/SwiftyIrohaExample/GRPC/proposal.pb.swift @@ -0,0 +1,81 @@ +// DO NOT EDIT. +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: proposal.proto +// +// For information on using the generated types, please see the documenation: +// https://github.com/apple/swift-protobuf/ + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that your are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct Iroha_Protocol_Proposal { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var height: UInt64 = 0 + + var transactions: [Iroha_Protocol_Transaction] = [] + + var createdTime: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "iroha.protocol" + +extension Iroha_Protocol_Proposal: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Proposal" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "height"), + 2: .same(proto: "transactions"), + 3: .standard(proto: "created_time"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.height) + case 2: try decoder.decodeRepeatedMessageField(value: &self.transactions) + case 3: try decoder.decodeSingularUInt64Field(value: &self.createdTime) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.height != 0 { + try visitor.visitSingularUInt64Field(value: self.height, fieldNumber: 1) + } + if !self.transactions.isEmpty { + try visitor.visitRepeatedMessageField(value: self.transactions, fieldNumber: 2) + } + if self.createdTime != 0 { + try visitor.visitSingularUInt64Field(value: self.createdTime, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_Proposal) -> Bool { + if self.height != other.height {return false} + if self.transactions != other.transactions {return false} + if self.createdTime != other.createdTime {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} diff --git a/SwiftyIrohaExample/GRPC/queries.pb.swift b/SwiftyIrohaExample/GRPC/queries.pb.swift index 0baddf1ba..bf445b81b 100644 --- a/SwiftyIrohaExample/GRPC/queries.pb.swift +++ b/SwiftyIrohaExample/GRPC/queries.pb.swift @@ -19,110 +19,46 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -struct Iroha_Protocol_GetAccount: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".GetAccount" +struct Iroha_Protocol_GetAccount { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String = String() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.accountID) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.accountID.isEmpty { - try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_GetSignatories: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".GetSignatories" +struct Iroha_Protocol_GetSignatories { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String = String() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.accountID) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.accountID.isEmpty { - try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_GetAccountTransactions: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".GetAccountTransactions" +struct Iroha_Protocol_GetAccountTransactions { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String = String() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.accountID) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.accountID.isEmpty { - try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_GetAccountAssetTransactions: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".GetAccountAssetTransactions" +struct Iroha_Protocol_GetAccountAssetTransactions { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String = String() @@ -131,245 +67,99 @@ struct Iroha_Protocol_GetAccountAssetTransactions: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.accountID) - case 2: try decoder.decodeSingularStringField(value: &self.assetID) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.accountID.isEmpty { - try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) - } - if !self.assetID.isEmpty { - try visitor.visitSingularStringField(value: self.assetID, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_GetTransactions: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".GetTransactions" +struct Iroha_Protocol_GetTransactions { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var txHashes: [Data] = [] var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeRepeatedBytesField(value: &self.txHashes) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.txHashes.isEmpty { - try visitor.visitRepeatedBytesField(value: self.txHashes, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_GetAccountAssets: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".GetAccountAssets" +struct Iroha_Protocol_GetAccountAssets { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String = String() - var assetID: String = String() - var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.accountID) - case 2: try decoder.decodeSingularStringField(value: &self.assetID) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.accountID.isEmpty { - try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) - } - if !self.assetID.isEmpty { - try visitor.visitSingularStringField(value: self.assetID, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_GetAccountDetail: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".GetAccountDetail" +struct Iroha_Protocol_GetAccountDetail { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String = String() - var detail: String = String() - var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.accountID) - case 2: try decoder.decodeSingularStringField(value: &self.detail) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.accountID.isEmpty { - try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) - } - if !self.detail.isEmpty { - try visitor.visitSingularStringField(value: self.detail, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_GetAssetInfo: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".GetAssetInfo" +struct Iroha_Protocol_GetAssetInfo { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var assetID: String = String() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.assetID) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.assetID.isEmpty { - try visitor.visitSingularStringField(value: self.assetID, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_GetRoles: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".GetRoles" +struct Iroha_Protocol_GetRoles { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let _ = try decoder.nextFieldNumber() { - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_GetRolePermissions: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".GetRolePermissions" +struct Iroha_Protocol_GetRolePermissions { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var roleID: String = String() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} +} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.roleID) - default: break - } - } - } +struct Iroha_Protocol_QueryPayloadMeta { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.roleID.isEmpty { - try visitor.visitSingularStringField(value: self.roleID, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } + var createdTime: UInt64 = 0 + + var creatorAccountID: String = String() + + /// used to prevent replay attacks. + var queryCounter: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} } -struct Iroha_Protocol_Query: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".Query" +struct Iroha_Protocol_Query { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var payload: Iroha_Protocol_Query.Payload { get {return _storage._payload ?? Iroha_Protocol_Query.Payload()} @@ -391,18 +181,19 @@ struct Iroha_Protocol_Query: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() - struct Payload: SwiftProtobuf.Message { - static let protoMessageName: String = Iroha_Protocol_Query.protoMessageName + ".Payload" - - var createdTime: UInt64 { - get {return _storage._createdTime} - set {_uniqueStorage()._createdTime = newValue} - } + struct Payload { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. - var creatorAccountID: String { - get {return _storage._creatorAccountID} - set {_uniqueStorage()._creatorAccountID = newValue} + var meta: Iroha_Protocol_QueryPayloadMeta { + get {return _storage._meta ?? Iroha_Protocol_QueryPayloadMeta()} + set {_uniqueStorage()._meta = newValue} } + /// Returns true if `meta` has been explicitly set. + var hasMeta: Bool {return _storage._meta != nil} + /// Clears the value of `meta`. Subsequent reads from it will return its default value. + mutating func clearMeta() {_storage._meta = nil} var query: OneOf_Query? { get {return _storage._query} @@ -489,12 +280,6 @@ struct Iroha_Protocol_Query: SwiftProtobuf.Message { set {_uniqueStorage()._query = .getAssetInfo(newValue)} } - /// used to prevent replay attacks. - var queryCounter: UInt64 { - get {return _storage._queryCounter} - set {_uniqueStorage()._queryCounter = newValue} - } - var unknownFields = SwiftProtobuf.UnknownStorage() enum OneOf_Query: Equatable { @@ -528,183 +313,40 @@ struct Iroha_Protocol_Query: SwiftProtobuf.Message { init() {} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularUInt64Field(value: &_storage._createdTime) - case 2: try decoder.decodeSingularStringField(value: &_storage._creatorAccountID) - case 3: - var v: Iroha_Protocol_GetAccount? - if let current = _storage._query { - try decoder.handleConflictingOneOf() - if case .getAccount(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._query = .getAccount(v)} - case 4: - var v: Iroha_Protocol_GetSignatories? - if let current = _storage._query { - try decoder.handleConflictingOneOf() - if case .getAccountSignatories(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._query = .getAccountSignatories(v)} - case 5: - var v: Iroha_Protocol_GetAccountTransactions? - if let current = _storage._query { - try decoder.handleConflictingOneOf() - if case .getAccountTransactions(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._query = .getAccountTransactions(v)} - case 6: - var v: Iroha_Protocol_GetAccountAssetTransactions? - if let current = _storage._query { - try decoder.handleConflictingOneOf() - if case .getAccountAssetTransactions(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._query = .getAccountAssetTransactions(v)} - case 7: - var v: Iroha_Protocol_GetTransactions? - if let current = _storage._query { - try decoder.handleConflictingOneOf() - if case .getTransactions(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._query = .getTransactions(v)} - case 8: - var v: Iroha_Protocol_GetAccountAssets? - if let current = _storage._query { - try decoder.handleConflictingOneOf() - if case .getAccountAssets(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._query = .getAccountAssets(v)} - case 9: - var v: Iroha_Protocol_GetAccountDetail? - if let current = _storage._query { - try decoder.handleConflictingOneOf() - if case .getAccountDetail(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._query = .getAccountDetail(v)} - case 10: - var v: Iroha_Protocol_GetRoles? - if let current = _storage._query { - try decoder.handleConflictingOneOf() - if case .getRoles(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._query = .getRoles(v)} - case 11: - var v: Iroha_Protocol_GetRolePermissions? - if let current = _storage._query { - try decoder.handleConflictingOneOf() - if case .getRolePermissions(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._query = .getRolePermissions(v)} - case 12: - var v: Iroha_Protocol_GetAssetInfo? - if let current = _storage._query { - try decoder.handleConflictingOneOf() - if case .getAssetInfo(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._query = .getAssetInfo(v)} - case 13: try decoder.decodeSingularUInt64Field(value: &_storage._queryCounter) - default: break - } - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if _storage._createdTime != 0 { - try visitor.visitSingularUInt64Field(value: _storage._createdTime, fieldNumber: 1) - } - if !_storage._creatorAccountID.isEmpty { - try visitor.visitSingularStringField(value: _storage._creatorAccountID, fieldNumber: 2) - } - switch _storage._query { - case .getAccount(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - case .getAccountSignatories(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 4) - case .getAccountTransactions(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 5) - case .getAccountAssetTransactions(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 6) - case .getTransactions(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 7) - case .getAccountAssets(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 8) - case .getAccountDetail(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 9) - case .getRoles(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 10) - case .getRolePermissions(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 11) - case .getAssetInfo(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 12) - case nil: break - } - if _storage._queryCounter != 0 { - try visitor.visitSingularUInt64Field(value: _storage._queryCounter, fieldNumber: 13) - } - } - try unknownFields.traverse(visitor: &visitor) - } - fileprivate var _storage = _StorageClass.defaultInstance } init() {} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_storage._payload) - case 2: try decoder.decodeSingularMessageField(value: &_storage._signature) - default: break - } - } - } + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct Iroha_Protocol_BlocksQuery { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var meta: Iroha_Protocol_QueryPayloadMeta { + get {return _storage._meta ?? Iroha_Protocol_QueryPayloadMeta()} + set {_uniqueStorage()._meta = newValue} } + /// Returns true if `meta` has been explicitly set. + var hasMeta: Bool {return _storage._meta != nil} + /// Clears the value of `meta`. Subsequent reads from it will return its default value. + mutating func clearMeta() {_storage._meta = nil} - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if let v = _storage._payload { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } - if let v = _storage._signature { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } - } - try unknownFields.traverse(visitor: &visitor) + var signature: Iroha_Protocol_Signature { + get {return _storage._signature ?? Iroha_Protocol_Signature()} + set {_uniqueStorage()._signature = newValue} } + /// Returns true if `signature` has been explicitly set. + var hasSignature: Bool {return _storage._signature != nil} + /// Clears the value of `signature`. Subsequent reads from it will return its default value. + mutating func clearSignature() {_storage._signature = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} fileprivate var _storage = _StorageClass.defaultInstance } @@ -713,11 +355,28 @@ struct Iroha_Protocol_Query: SwiftProtobuf.Message { fileprivate let _protobuf_package = "iroha.protocol" -extension Iroha_Protocol_GetAccount: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_GetAccount: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetAccount" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_id"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.accountID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.accountID.isEmpty { + try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_GetAccount) -> Bool { if self.accountID != other.accountID {return false} if unknownFields != other.unknownFields {return false} @@ -725,23 +384,57 @@ extension Iroha_Protocol_GetAccount: SwiftProtobuf._MessageImplementationBase, S } } -extension Iroha_Protocol_GetSignatories: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_GetSignatories: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetSignatories" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_id"), ] - func _protobuf_generated_isEqualTo(other: Iroha_Protocol_GetSignatories) -> Bool { - if self.accountID != other.accountID {return false} - if unknownFields != other.unknownFields {return false} - return true - } + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.accountID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.accountID.isEmpty { + try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_GetSignatories) -> Bool { + if self.accountID != other.accountID {return false} + if unknownFields != other.unknownFields {return false} + return true + } } -extension Iroha_Protocol_GetAccountTransactions: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_GetAccountTransactions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetAccountTransactions" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_id"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.accountID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.accountID.isEmpty { + try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_GetAccountTransactions) -> Bool { if self.accountID != other.accountID {return false} if unknownFields != other.unknownFields {return false} @@ -749,12 +442,33 @@ extension Iroha_Protocol_GetAccountTransactions: SwiftProtobuf._MessageImplement } } -extension Iroha_Protocol_GetAccountAssetTransactions: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_GetAccountAssetTransactions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetAccountAssetTransactions" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_id"), 2: .standard(proto: "asset_id"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.accountID) + case 2: try decoder.decodeSingularStringField(value: &self.assetID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.accountID.isEmpty { + try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) + } + if !self.assetID.isEmpty { + try visitor.visitSingularStringField(value: self.assetID, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_GetAccountAssetTransactions) -> Bool { if self.accountID != other.accountID {return false} if self.assetID != other.assetID {return false} @@ -763,11 +477,28 @@ extension Iroha_Protocol_GetAccountAssetTransactions: SwiftProtobuf._MessageImpl } } -extension Iroha_Protocol_GetTransactions: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_GetTransactions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetTransactions" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "tx_hashes"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedBytesField(value: &self.txHashes) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.txHashes.isEmpty { + try visitor.visitRepeatedBytesField(value: self.txHashes, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_GetTransactions) -> Bool { if self.txHashes != other.txHashes {return false} if unknownFields != other.unknownFields {return false} @@ -775,39 +506,86 @@ extension Iroha_Protocol_GetTransactions: SwiftProtobuf._MessageImplementationBa } } -extension Iroha_Protocol_GetAccountAssets: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_GetAccountAssets: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetAccountAssets" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_id"), - 2: .standard(proto: "asset_id"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.accountID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.accountID.isEmpty { + try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_GetAccountAssets) -> Bool { if self.accountID != other.accountID {return false} - if self.assetID != other.assetID {return false} if unknownFields != other.unknownFields {return false} return true } } -extension Iroha_Protocol_GetAccountDetail: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_GetAccountDetail: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetAccountDetail" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_id"), - 2: .same(proto: "detail"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.accountID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.accountID.isEmpty { + try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_GetAccountDetail) -> Bool { if self.accountID != other.accountID {return false} - if self.detail != other.detail {return false} if unknownFields != other.unknownFields {return false} return true } } -extension Iroha_Protocol_GetAssetInfo: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_GetAssetInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetAssetInfo" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "asset_id"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.assetID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.assetID.isEmpty { + try visitor.visitSingularStringField(value: self.assetID, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_GetAssetInfo) -> Bool { if self.assetID != other.assetID {return false} if unknownFields != other.unknownFields {return false} @@ -815,20 +593,47 @@ extension Iroha_Protocol_GetAssetInfo: SwiftProtobuf._MessageImplementationBase, } } -extension Iroha_Protocol_GetRoles: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_GetRoles: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetRoles" static let _protobuf_nameMap = SwiftProtobuf._NameMap() + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_GetRoles) -> Bool { if unknownFields != other.unknownFields {return false} return true } } -extension Iroha_Protocol_GetRolePermissions: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_GetRolePermissions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetRolePermissions" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "role_id"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.roleID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.roleID.isEmpty { + try visitor.visitSingularStringField(value: self.roleID, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_GetRolePermissions) -> Bool { if self.roleID != other.roleID {return false} if unknownFields != other.unknownFields {return false} @@ -836,7 +641,49 @@ extension Iroha_Protocol_GetRolePermissions: SwiftProtobuf._MessageImplementatio } } -extension Iroha_Protocol_Query: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_QueryPayloadMeta: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".QueryPayloadMeta" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "created_time"), + 2: .standard(proto: "creator_account_id"), + 3: .standard(proto: "query_counter"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.createdTime) + case 2: try decoder.decodeSingularStringField(value: &self.creatorAccountID) + case 3: try decoder.decodeSingularUInt64Field(value: &self.queryCounter) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.createdTime != 0 { + try visitor.visitSingularUInt64Field(value: self.createdTime, fieldNumber: 1) + } + if !self.creatorAccountID.isEmpty { + try visitor.visitSingularStringField(value: self.creatorAccountID, fieldNumber: 2) + } + if self.queryCounter != 0 { + try visitor.visitSingularUInt64Field(value: self.queryCounter, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_QueryPayloadMeta) -> Bool { + if self.createdTime != other.createdTime {return false} + if self.creatorAccountID != other.creatorAccountID {return false} + if self.queryCounter != other.queryCounter {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension Iroha_Protocol_Query: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Query" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "payload"), 2: .same(proto: "signature"), @@ -863,9 +710,36 @@ extension Iroha_Protocol_Query: SwiftProtobuf._MessageImplementationBase, SwiftP return _storage } + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._payload) + case 2: try decoder.decodeSingularMessageField(value: &_storage._signature) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._payload { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = _storage._signature { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_Query) -> Bool { if _storage !== other._storage { - let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 if _storage._payload != other_storage._payload {return false} if _storage._signature != other_storage._signature {return false} return true @@ -877,10 +751,10 @@ extension Iroha_Protocol_Query: SwiftProtobuf._MessageImplementationBase, SwiftP } } -extension Iroha_Protocol_Query.Payload: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_Query.Payload: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Iroha_Protocol_Query.protoMessageName + ".Payload" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "created_time"), - 2: .standard(proto: "creator_account_id"), + 1: .same(proto: "meta"), 3: .standard(proto: "get_account"), 4: .standard(proto: "get_account_signatories"), 5: .standard(proto: "get_account_transactions"), @@ -891,24 +765,19 @@ extension Iroha_Protocol_Query.Payload: SwiftProtobuf._MessageImplementationBase 10: .standard(proto: "get_roles"), 11: .standard(proto: "get_role_permissions"), 12: .standard(proto: "get_asset_info"), - 13: .standard(proto: "query_counter"), ] fileprivate class _StorageClass { - var _createdTime: UInt64 = 0 - var _creatorAccountID: String = String() + var _meta: Iroha_Protocol_QueryPayloadMeta? = nil var _query: Iroha_Protocol_Query.Payload.OneOf_Query? - var _queryCounter: UInt64 = 0 static let defaultInstance = _StorageClass() private init() {} init(copying source: _StorageClass) { - _createdTime = source._createdTime - _creatorAccountID = source._creatorAccountID + _meta = source._meta _query = source._query - _queryCounter = source._queryCounter } } @@ -919,13 +788,206 @@ extension Iroha_Protocol_Query.Payload: SwiftProtobuf._MessageImplementationBase return _storage } + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._meta) + case 3: + var v: Iroha_Protocol_GetAccount? + if let current = _storage._query { + try decoder.handleConflictingOneOf() + if case .getAccount(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._query = .getAccount(v)} + case 4: + var v: Iroha_Protocol_GetSignatories? + if let current = _storage._query { + try decoder.handleConflictingOneOf() + if case .getAccountSignatories(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._query = .getAccountSignatories(v)} + case 5: + var v: Iroha_Protocol_GetAccountTransactions? + if let current = _storage._query { + try decoder.handleConflictingOneOf() + if case .getAccountTransactions(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._query = .getAccountTransactions(v)} + case 6: + var v: Iroha_Protocol_GetAccountAssetTransactions? + if let current = _storage._query { + try decoder.handleConflictingOneOf() + if case .getAccountAssetTransactions(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._query = .getAccountAssetTransactions(v)} + case 7: + var v: Iroha_Protocol_GetTransactions? + if let current = _storage._query { + try decoder.handleConflictingOneOf() + if case .getTransactions(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._query = .getTransactions(v)} + case 8: + var v: Iroha_Protocol_GetAccountAssets? + if let current = _storage._query { + try decoder.handleConflictingOneOf() + if case .getAccountAssets(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._query = .getAccountAssets(v)} + case 9: + var v: Iroha_Protocol_GetAccountDetail? + if let current = _storage._query { + try decoder.handleConflictingOneOf() + if case .getAccountDetail(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._query = .getAccountDetail(v)} + case 10: + var v: Iroha_Protocol_GetRoles? + if let current = _storage._query { + try decoder.handleConflictingOneOf() + if case .getRoles(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._query = .getRoles(v)} + case 11: + var v: Iroha_Protocol_GetRolePermissions? + if let current = _storage._query { + try decoder.handleConflictingOneOf() + if case .getRolePermissions(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._query = .getRolePermissions(v)} + case 12: + var v: Iroha_Protocol_GetAssetInfo? + if let current = _storage._query { + try decoder.handleConflictingOneOf() + if case .getAssetInfo(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._query = .getAssetInfo(v)} + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._meta { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + switch _storage._query { + case .getAccount(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + case .getAccountSignatories(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + case .getAccountTransactions(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + case .getAccountAssetTransactions(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + case .getTransactions(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + case .getAccountAssets(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + case .getAccountDetail(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 9) + case .getRoles(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 10) + case .getRolePermissions(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 11) + case .getAssetInfo(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 12) + case nil: break + } + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_Query.Payload) -> Bool { if _storage !== other._storage { - let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in - if _storage._createdTime != other_storage._createdTime {return false} - if _storage._creatorAccountID != other_storage._creatorAccountID {return false} + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._meta != other_storage._meta {return false} if _storage._query != other_storage._query {return false} - if _storage._queryCounter != other_storage._queryCounter {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension Iroha_Protocol_BlocksQuery: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".BlocksQuery" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "meta"), + 2: .same(proto: "signature"), + ] + + fileprivate class _StorageClass { + var _meta: Iroha_Protocol_QueryPayloadMeta? = nil + var _signature: Iroha_Protocol_Signature? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _meta = source._meta + _signature = source._signature + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._meta) + case 2: try decoder.decodeSingularMessageField(value: &_storage._signature) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._meta { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = _storage._signature { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_BlocksQuery) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._meta != other_storage._meta {return false} + if _storage._signature != other_storage._signature {return false} return true } if !storagesAreEqual {return false} diff --git a/SwiftyIrohaExample/GRPC/responses.pb.swift b/SwiftyIrohaExample/GRPC/responses.pb.swift index 78ffeac82..91bc2f74e 100644 --- a/SwiftyIrohaExample/GRPC/responses.pb.swift +++ b/SwiftyIrohaExample/GRPC/responses.pb.swift @@ -20,8 +20,10 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP } /// *** WSV data structure *** // -struct Iroha_Protocol_Asset: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".Asset" +struct Iroha_Protocol_Asset { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var assetID: String = String() @@ -32,42 +34,26 @@ struct Iroha_Protocol_Asset: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} +} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.assetID) - case 2: try decoder.decodeSingularStringField(value: &self.domainID) - case 3: try decoder.decodeSingularUInt32Field(value: &self.precision) - default: break - } - } - } +struct Iroha_Protocol_Domain { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.assetID.isEmpty { - try visitor.visitSingularStringField(value: self.assetID, fieldNumber: 1) - } - if !self.domainID.isEmpty { - try visitor.visitSingularStringField(value: self.domainID, fieldNumber: 2) - } - if self.precision != 0 { - try visitor.visitSingularUInt32Field(value: self.precision, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } + var domainID: String = String() + + var defaultRole: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} } -struct Iroha_Protocol_Account: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".Account" +struct Iroha_Protocol_Account { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var accountID: String = String() @@ -80,46 +66,12 @@ struct Iroha_Protocol_Account: SwiftProtobuf.Message { var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.accountID) - case 2: try decoder.decodeSingularStringField(value: &self.domainID) - case 3: try decoder.decodeSingularUInt32Field(value: &self.quorum) - case 4: try decoder.decodeSingularStringField(value: &self.jsonData) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.accountID.isEmpty { - try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) - } - if !self.domainID.isEmpty { - try visitor.visitSingularStringField(value: self.domainID, fieldNumber: 2) - } - if self.quorum != 0 { - try visitor.visitSingularUInt32Field(value: self.quorum, fieldNumber: 3) - } - if !self.jsonData.isEmpty { - try visitor.visitSingularStringField(value: self.jsonData, fieldNumber: 4) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_AccountAsset: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".AccountAsset" +struct Iroha_Protocol_AccountAsset { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var assetID: String { get {return _storage._assetID} @@ -144,131 +96,38 @@ struct Iroha_Protocol_AccountAsset: SwiftProtobuf.Message { init() {} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &_storage._assetID) - case 2: try decoder.decodeSingularStringField(value: &_storage._accountID) - case 3: try decoder.decodeSingularMessageField(value: &_storage._balance) - default: break - } - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if !_storage._assetID.isEmpty { - try visitor.visitSingularStringField(value: _storage._assetID, fieldNumber: 1) - } - if !_storage._accountID.isEmpty { - try visitor.visitSingularStringField(value: _storage._accountID, fieldNumber: 2) - } - if let v = _storage._balance { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } - } - try unknownFields.traverse(visitor: &visitor) - } - fileprivate var _storage = _StorageClass.defaultInstance } /// *** Responses *** // -struct Iroha_Protocol_AccountAssetResponse: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".AccountAssetResponse" +struct Iroha_Protocol_AccountAssetResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. - var accountAsset: Iroha_Protocol_AccountAsset { - get {return _storage._accountAsset ?? Iroha_Protocol_AccountAsset()} - set {_uniqueStorage()._accountAsset = newValue} - } - /// Returns true if `accountAsset` has been explicitly set. - var hasAccountAsset: Bool {return _storage._accountAsset != nil} - /// Clears the value of `accountAsset`. Subsequent reads from it will return its default value. - mutating func clearAccountAsset() {_storage._accountAsset = nil} + var accountAssets: [Iroha_Protocol_AccountAsset] = [] var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_storage._accountAsset) - default: break - } - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if let v = _storage._accountAsset { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } - } - try unknownFields.traverse(visitor: &visitor) - } - - fileprivate var _storage = _StorageClass.defaultInstance } -struct Iroha_Protocol_AccountDetailResponse: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".AccountDetailResponse" +struct Iroha_Protocol_AccountDetailResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var detail: String = String() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularStringField(value: &self.detail) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.detail.isEmpty { - try visitor.visitSingularStringField(value: self.detail, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_AccountResponse: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".AccountResponse" +struct Iroha_Protocol_AccountResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var account: Iroha_Protocol_Account { get {return _storage._account ?? Iroha_Protocol_Account()} @@ -288,44 +147,13 @@ struct Iroha_Protocol_AccountResponse: SwiftProtobuf.Message { init() {} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_storage._account) - case 2: try decoder.decodeRepeatedStringField(value: &_storage._accountRoles) - default: break - } - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if let v = _storage._account { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } - if !_storage._accountRoles.isEmpty { - try visitor.visitRepeatedStringField(value: _storage._accountRoles, fieldNumber: 2) - } - } - try unknownFields.traverse(visitor: &visitor) - } - fileprivate var _storage = _StorageClass.defaultInstance } -struct Iroha_Protocol_AssetResponse: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".AssetResponse" +struct Iroha_Protocol_AssetResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var asset: Iroha_Protocol_Asset { get {return _storage._asset ?? Iroha_Protocol_Asset()} @@ -340,111 +168,42 @@ struct Iroha_Protocol_AssetResponse: SwiftProtobuf.Message { init() {} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularMessageField(value: &_storage._asset) - default: break - } - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if let v = _storage._asset { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } - } - try unknownFields.traverse(visitor: &visitor) - } - fileprivate var _storage = _StorageClass.defaultInstance } -struct Iroha_Protocol_RolesResponse: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".RolesResponse" +struct Iroha_Protocol_RolesResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var roles: [String] = [] var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeRepeatedStringField(value: &self.roles) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.roles.isEmpty { - try visitor.visitRepeatedStringField(value: self.roles, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_RolePermissionsResponse: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".RolePermissionsResponse" +struct Iroha_Protocol_RolePermissionsResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var permissions: [String] = [] var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeRepeatedStringField(value: &self.permissions) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.permissions.isEmpty { - try visitor.visitRepeatedStringField(value: self.permissions, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_ErrorResponse: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".ErrorResponse" +struct Iroha_Protocol_ErrorResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var reason: Iroha_Protocol_ErrorResponse.Reason = .statelessInvalid + var message: String = String() + var unknownFields = SwiftProtobuf.UnknownStorage() enum Reason: SwiftProtobuf.Enum { @@ -511,102 +270,36 @@ struct Iroha_Protocol_ErrorResponse: SwiftProtobuf.Message { } init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeSingularEnumField(value: &self.reason) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if self.reason != .statelessInvalid { - try visitor.visitSingularEnumField(value: self.reason, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_SignatoriesResponse: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".SignatoriesResponse" +struct Iroha_Protocol_SignatoriesResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var keys: [Data] = [] var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeRepeatedBytesField(value: &self.keys) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.keys.isEmpty { - try visitor.visitRepeatedBytesField(value: self.keys, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } } -struct Iroha_Protocol_TransactionsResponse: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".TransactionsResponse" +struct Iroha_Protocol_TransactionsResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var transactions: [Iroha_Protocol_Transaction] = [] var unknownFields = SwiftProtobuf.UnknownStorage() init() {} +} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: try decoder.decodeRepeatedMessageField(value: &self.transactions) - default: break - } - } - } - - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - if !self.transactions.isEmpty { - try visitor.visitRepeatedMessageField(value: self.transactions, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } -} - -struct Iroha_Protocol_QueryResponse: SwiftProtobuf.Message { - static let protoMessageName: String = _protobuf_package + ".QueryResponse" +struct Iroha_Protocol_QueryResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. var response: OneOf_Response? { get {return _storage._response} @@ -685,7 +378,7 @@ struct Iroha_Protocol_QueryResponse: SwiftProtobuf.Message { set {_uniqueStorage()._response = .rolePermissionsResponse(newValue)} } - var queryHash: Data { + var queryHash: String { get {return _storage._queryHash} set {_uniqueStorage()._queryHash = newValue} } @@ -721,128 +414,85 @@ struct Iroha_Protocol_QueryResponse: SwiftProtobuf.Message { init() {} - /// Used by the decoding initializers in the SwiftProtobuf library, not generally - /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding - /// initializers are defined in the SwiftProtobuf library. See the Message and - /// Message+*Additions` files. - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - switch fieldNumber { - case 1: - var v: Iroha_Protocol_AccountAssetResponse? - if let current = _storage._response { - try decoder.handleConflictingOneOf() - if case .accountAssetsResponse(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._response = .accountAssetsResponse(v)} - case 2: - var v: Iroha_Protocol_AccountDetailResponse? - if let current = _storage._response { - try decoder.handleConflictingOneOf() - if case .accountDetailResponse(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._response = .accountDetailResponse(v)} - case 3: - var v: Iroha_Protocol_AccountResponse? - if let current = _storage._response { - try decoder.handleConflictingOneOf() - if case .accountResponse(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._response = .accountResponse(v)} - case 4: - var v: Iroha_Protocol_ErrorResponse? - if let current = _storage._response { - try decoder.handleConflictingOneOf() - if case .errorResponse(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._response = .errorResponse(v)} - case 5: - var v: Iroha_Protocol_SignatoriesResponse? - if let current = _storage._response { - try decoder.handleConflictingOneOf() - if case .signatoriesResponse(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._response = .signatoriesResponse(v)} - case 6: - var v: Iroha_Protocol_TransactionsResponse? - if let current = _storage._response { - try decoder.handleConflictingOneOf() - if case .transactionsResponse(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._response = .transactionsResponse(v)} - case 7: - var v: Iroha_Protocol_AssetResponse? - if let current = _storage._response { - try decoder.handleConflictingOneOf() - if case .assetResponse(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._response = .assetResponse(v)} - case 8: - var v: Iroha_Protocol_RolesResponse? - if let current = _storage._response { - try decoder.handleConflictingOneOf() - if case .rolesResponse(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._response = .rolesResponse(v)} - case 9: - var v: Iroha_Protocol_RolePermissionsResponse? - if let current = _storage._response { - try decoder.handleConflictingOneOf() - if case .rolePermissionsResponse(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v {_storage._response = .rolePermissionsResponse(v)} - case 10: try decoder.decodeSingularBytesField(value: &_storage._queryHash) - default: break - } - } + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct Iroha_Protocol_BlockResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var block: Iroha_Protocol_Block { + get {return _storage._block ?? Iroha_Protocol_Block()} + set {_uniqueStorage()._block = newValue} + } + /// Returns true if `block` has been explicitly set. + var hasBlock: Bool {return _storage._block != nil} + /// Clears the value of `block`. Subsequent reads from it will return its default value. + mutating func clearBlock() {_storage._block = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct Iroha_Protocol_BlockErrorResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var message: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Iroha_Protocol_BlockQueryResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var response: OneOf_Response? { + get {return _storage._response} + set {_uniqueStorage()._response = newValue} + } + + var blockResponse: Iroha_Protocol_BlockResponse { + get { + if case .blockResponse(let v)? = _storage._response {return v} + return Iroha_Protocol_BlockResponse() } + set {_uniqueStorage()._response = .blockResponse(newValue)} } - /// Used by the encoding methods of the SwiftProtobuf library, not generally - /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and - /// other serializer methods are defined in the SwiftProtobuf library. See the - /// `Message` and `Message+*Additions` files. - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - switch _storage._response { - case .accountAssetsResponse(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - case .accountDetailResponse(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - case .accountResponse(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - case .errorResponse(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 4) - case .signatoriesResponse(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 5) - case .transactionsResponse(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 6) - case .assetResponse(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 7) - case .rolesResponse(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 8) - case .rolePermissionsResponse(let v)?: - try visitor.visitSingularMessageField(value: v, fieldNumber: 9) - case nil: break - } - if !_storage._queryHash.isEmpty { - try visitor.visitSingularBytesField(value: _storage._queryHash, fieldNumber: 10) + var errorResponse: Iroha_Protocol_BlockErrorResponse { + get { + if case .errorResponse(let v)? = _storage._response {return v} + return Iroha_Protocol_BlockErrorResponse() + } + set {_uniqueStorage()._response = .errorResponse(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Response: Equatable { + case blockResponse(Iroha_Protocol_BlockResponse) + case errorResponse(Iroha_Protocol_BlockErrorResponse) + + static func ==(lhs: Iroha_Protocol_BlockQueryResponse.OneOf_Response, rhs: Iroha_Protocol_BlockQueryResponse.OneOf_Response) -> Bool { + switch (lhs, rhs) { + case (.blockResponse(let l), .blockResponse(let r)): return l == r + case (.errorResponse(let l), .errorResponse(let r)): return l == r + default: return false } } - try unknownFields.traverse(visitor: &visitor) } + init() {} + fileprivate var _storage = _StorageClass.defaultInstance } @@ -850,13 +500,38 @@ struct Iroha_Protocol_QueryResponse: SwiftProtobuf.Message { fileprivate let _protobuf_package = "iroha.protocol" -extension Iroha_Protocol_Asset: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_Asset: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Asset" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "asset_id"), 2: .standard(proto: "domain_id"), 3: .same(proto: "precision"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.assetID) + case 2: try decoder.decodeSingularStringField(value: &self.domainID) + case 3: try decoder.decodeSingularUInt32Field(value: &self.precision) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.assetID.isEmpty { + try visitor.visitSingularStringField(value: self.assetID, fieldNumber: 1) + } + if !self.domainID.isEmpty { + try visitor.visitSingularStringField(value: self.domainID, fieldNumber: 2) + } + if self.precision != 0 { + try visitor.visitSingularUInt32Field(value: self.precision, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_Asset) -> Bool { if self.assetID != other.assetID {return false} if self.domainID != other.domainID {return false} @@ -866,7 +541,43 @@ extension Iroha_Protocol_Asset: SwiftProtobuf._MessageImplementationBase, SwiftP } } -extension Iroha_Protocol_Account: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_Domain: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Domain" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "domain_id"), + 2: .standard(proto: "default_role"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.domainID) + case 2: try decoder.decodeSingularStringField(value: &self.defaultRole) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.domainID.isEmpty { + try visitor.visitSingularStringField(value: self.domainID, fieldNumber: 1) + } + if !self.defaultRole.isEmpty { + try visitor.visitSingularStringField(value: self.defaultRole, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_Domain) -> Bool { + if self.domainID != other.domainID {return false} + if self.defaultRole != other.defaultRole {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension Iroha_Protocol_Account: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Account" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_id"), 2: .standard(proto: "domain_id"), @@ -874,6 +585,34 @@ extension Iroha_Protocol_Account: SwiftProtobuf._MessageImplementationBase, Swif 4: .standard(proto: "json_data"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.accountID) + case 2: try decoder.decodeSingularStringField(value: &self.domainID) + case 3: try decoder.decodeSingularUInt32Field(value: &self.quorum) + case 4: try decoder.decodeSingularStringField(value: &self.jsonData) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.accountID.isEmpty { + try visitor.visitSingularStringField(value: self.accountID, fieldNumber: 1) + } + if !self.domainID.isEmpty { + try visitor.visitSingularStringField(value: self.domainID, fieldNumber: 2) + } + if self.quorum != 0 { + try visitor.visitSingularUInt32Field(value: self.quorum, fieldNumber: 3) + } + if !self.jsonData.isEmpty { + try visitor.visitSingularStringField(value: self.jsonData, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_Account) -> Bool { if self.accountID != other.accountID {return false} if self.domainID != other.domainID {return false} @@ -884,7 +623,8 @@ extension Iroha_Protocol_Account: SwiftProtobuf._MessageImplementationBase, Swif } } -extension Iroha_Protocol_AccountAsset: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_AccountAsset: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AccountAsset" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "asset_id"), 2: .standard(proto: "account_id"), @@ -914,63 +654,103 @@ extension Iroha_Protocol_AccountAsset: SwiftProtobuf._MessageImplementationBase, return _storage } - func _protobuf_generated_isEqualTo(other: Iroha_Protocol_AccountAsset) -> Bool { - if _storage !== other._storage { - let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in - if _storage._assetID != other_storage._assetID {return false} - if _storage._accountID != other_storage._accountID {return false} - if _storage._balance != other_storage._balance {return false} - return true + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &_storage._assetID) + case 2: try decoder.decodeSingularStringField(value: &_storage._accountID) + case 3: try decoder.decodeSingularMessageField(value: &_storage._balance) + default: break + } } - if !storagesAreEqual {return false} } - if unknownFields != other.unknownFields {return false} - return true } -} -extension Iroha_Protocol_AccountAssetResponse: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "account_asset"), - ] - - fileprivate class _StorageClass { - var _accountAsset: Iroha_Protocol_AccountAsset? = nil + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if !_storage._assetID.isEmpty { + try visitor.visitSingularStringField(value: _storage._assetID, fieldNumber: 1) + } + if !_storage._accountID.isEmpty { + try visitor.visitSingularStringField(value: _storage._accountID, fieldNumber: 2) + } + if let v = _storage._balance { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + } + try unknownFields.traverse(visitor: &visitor) + } - static let defaultInstance = _StorageClass() + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_AccountAsset) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._assetID != other_storage._assetID {return false} + if _storage._accountID != other_storage._accountID {return false} + if _storage._balance != other_storage._balance {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} - private init() {} +extension Iroha_Protocol_AccountAssetResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AccountAssetResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "account_assets"), + ] - init(copying source: _StorageClass) { - _accountAsset = source._accountAsset + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.accountAssets) + default: break + } } } - fileprivate mutating func _uniqueStorage() -> _StorageClass { - if !isKnownUniquelyReferenced(&_storage) { - _storage = _StorageClass(copying: _storage) + func traverse(visitor: inout V) throws { + if !self.accountAssets.isEmpty { + try visitor.visitRepeatedMessageField(value: self.accountAssets, fieldNumber: 1) } - return _storage + try unknownFields.traverse(visitor: &visitor) } func _protobuf_generated_isEqualTo(other: Iroha_Protocol_AccountAssetResponse) -> Bool { - if _storage !== other._storage { - let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in - if _storage._accountAsset != other_storage._accountAsset {return false} - return true - } - if !storagesAreEqual {return false} - } + if self.accountAssets != other.accountAssets {return false} if unknownFields != other.unknownFields {return false} return true } } -extension Iroha_Protocol_AccountDetailResponse: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_AccountDetailResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AccountDetailResponse" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "detail"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.detail) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.detail.isEmpty { + try visitor.visitSingularStringField(value: self.detail, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_AccountDetailResponse) -> Bool { if self.detail != other.detail {return false} if unknownFields != other.unknownFields {return false} @@ -978,7 +758,8 @@ extension Iroha_Protocol_AccountDetailResponse: SwiftProtobuf._MessageImplementa } } -extension Iroha_Protocol_AccountResponse: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_AccountResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AccountResponse" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "account"), 2: .standard(proto: "account_roles"), @@ -1005,9 +786,36 @@ extension Iroha_Protocol_AccountResponse: SwiftProtobuf._MessageImplementationBa return _storage } + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._account) + case 2: try decoder.decodeRepeatedStringField(value: &_storage._accountRoles) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._account { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if !_storage._accountRoles.isEmpty { + try visitor.visitRepeatedStringField(value: _storage._accountRoles, fieldNumber: 2) + } + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_AccountResponse) -> Bool { if _storage !== other._storage { - let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 if _storage._account != other_storage._account {return false} if _storage._accountRoles != other_storage._accountRoles {return false} return true @@ -1019,7 +827,8 @@ extension Iroha_Protocol_AccountResponse: SwiftProtobuf._MessageImplementationBa } } -extension Iroha_Protocol_AssetResponse: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_AssetResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AssetResponse" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "asset"), ] @@ -1043,9 +852,32 @@ extension Iroha_Protocol_AssetResponse: SwiftProtobuf._MessageImplementationBase return _storage } + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._asset) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._asset { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_AssetResponse) -> Bool { if _storage !== other._storage { - let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 if _storage._asset != other_storage._asset {return false} return true } @@ -1056,11 +888,28 @@ extension Iroha_Protocol_AssetResponse: SwiftProtobuf._MessageImplementationBase } } -extension Iroha_Protocol_RolesResponse: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_RolesResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".RolesResponse" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "roles"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedStringField(value: &self.roles) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.roles.isEmpty { + try visitor.visitRepeatedStringField(value: self.roles, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_RolesResponse) -> Bool { if self.roles != other.roles {return false} if unknownFields != other.unknownFields {return false} @@ -1068,11 +917,28 @@ extension Iroha_Protocol_RolesResponse: SwiftProtobuf._MessageImplementationBase } } -extension Iroha_Protocol_RolePermissionsResponse: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_RolePermissionsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".RolePermissionsResponse" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "permissions"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedStringField(value: &self.permissions) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.permissions.isEmpty { + try visitor.visitRepeatedStringField(value: self.permissions, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_RolePermissionsResponse) -> Bool { if self.permissions != other.permissions {return false} if unknownFields != other.unknownFields {return false} @@ -1080,13 +946,36 @@ extension Iroha_Protocol_RolePermissionsResponse: SwiftProtobuf._MessageImplemen } } -extension Iroha_Protocol_ErrorResponse: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_ErrorResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ErrorResponse" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "reason"), + 2: .same(proto: "message"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self.reason) + case 2: try decoder.decodeSingularStringField(value: &self.message) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.reason != .statelessInvalid { + try visitor.visitSingularEnumField(value: self.reason, fieldNumber: 1) + } + if !self.message.isEmpty { + try visitor.visitSingularStringField(value: self.message, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_ErrorResponse) -> Bool { if self.reason != other.reason {return false} + if self.message != other.message {return false} if unknownFields != other.unknownFields {return false} return true } @@ -1106,11 +995,28 @@ extension Iroha_Protocol_ErrorResponse.Reason: SwiftProtobuf._ProtoNameProviding ] } -extension Iroha_Protocol_SignatoriesResponse: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_SignatoriesResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SignatoriesResponse" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "keys"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedBytesField(value: &self.keys) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.keys.isEmpty { + try visitor.visitRepeatedBytesField(value: self.keys, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_SignatoriesResponse) -> Bool { if self.keys != other.keys {return false} if unknownFields != other.unknownFields {return false} @@ -1118,11 +1024,28 @@ extension Iroha_Protocol_SignatoriesResponse: SwiftProtobuf._MessageImplementati } } -extension Iroha_Protocol_TransactionsResponse: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_TransactionsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".TransactionsResponse" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .same(proto: "transactions"), ] + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.transactions) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.transactions.isEmpty { + try visitor.visitRepeatedMessageField(value: self.transactions, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_TransactionsResponse) -> Bool { if self.transactions != other.transactions {return false} if unknownFields != other.unknownFields {return false} @@ -1130,7 +1053,8 @@ extension Iroha_Protocol_TransactionsResponse: SwiftProtobuf._MessageImplementat } } -extension Iroha_Protocol_QueryResponse: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { +extension Iroha_Protocol_QueryResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".QueryResponse" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "account_assets_response"), 2: .standard(proto: "account_detail_response"), @@ -1146,7 +1070,7 @@ extension Iroha_Protocol_QueryResponse: SwiftProtobuf._MessageImplementationBase fileprivate class _StorageClass { var _response: Iroha_Protocol_QueryResponse.OneOf_Response? - var _queryHash: Data = SwiftProtobuf.Internal.emptyData + var _queryHash: String = String() static let defaultInstance = _StorageClass() @@ -1165,9 +1089,125 @@ extension Iroha_Protocol_QueryResponse: SwiftProtobuf._MessageImplementationBase return _storage } + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: + var v: Iroha_Protocol_AccountAssetResponse? + if let current = _storage._response { + try decoder.handleConflictingOneOf() + if case .accountAssetsResponse(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._response = .accountAssetsResponse(v)} + case 2: + var v: Iroha_Protocol_AccountDetailResponse? + if let current = _storage._response { + try decoder.handleConflictingOneOf() + if case .accountDetailResponse(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._response = .accountDetailResponse(v)} + case 3: + var v: Iroha_Protocol_AccountResponse? + if let current = _storage._response { + try decoder.handleConflictingOneOf() + if case .accountResponse(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._response = .accountResponse(v)} + case 4: + var v: Iroha_Protocol_ErrorResponse? + if let current = _storage._response { + try decoder.handleConflictingOneOf() + if case .errorResponse(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._response = .errorResponse(v)} + case 5: + var v: Iroha_Protocol_SignatoriesResponse? + if let current = _storage._response { + try decoder.handleConflictingOneOf() + if case .signatoriesResponse(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._response = .signatoriesResponse(v)} + case 6: + var v: Iroha_Protocol_TransactionsResponse? + if let current = _storage._response { + try decoder.handleConflictingOneOf() + if case .transactionsResponse(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._response = .transactionsResponse(v)} + case 7: + var v: Iroha_Protocol_AssetResponse? + if let current = _storage._response { + try decoder.handleConflictingOneOf() + if case .assetResponse(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._response = .assetResponse(v)} + case 8: + var v: Iroha_Protocol_RolesResponse? + if let current = _storage._response { + try decoder.handleConflictingOneOf() + if case .rolesResponse(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._response = .rolesResponse(v)} + case 9: + var v: Iroha_Protocol_RolePermissionsResponse? + if let current = _storage._response { + try decoder.handleConflictingOneOf() + if case .rolePermissionsResponse(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._response = .rolePermissionsResponse(v)} + case 10: try decoder.decodeSingularStringField(value: &_storage._queryHash) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + switch _storage._response { + case .accountAssetsResponse(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + case .accountDetailResponse(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + case .accountResponse(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + case .errorResponse(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + case .signatoriesResponse(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + case .transactionsResponse(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + case .assetResponse(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + case .rolesResponse(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + case .rolePermissionsResponse(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 9) + case nil: break + } + if !_storage._queryHash.isEmpty { + try visitor.visitSingularStringField(value: _storage._queryHash, fieldNumber: 10) + } + } + try unknownFields.traverse(visitor: &visitor) + } + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_QueryResponse) -> Bool { if _storage !== other._storage { - let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 if _storage._response != other_storage._response {return false} if _storage._queryHash != other_storage._queryHash {return false} return true @@ -1178,3 +1218,174 @@ extension Iroha_Protocol_QueryResponse: SwiftProtobuf._MessageImplementationBase return true } } + +extension Iroha_Protocol_BlockResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".BlockResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "block"), + ] + + fileprivate class _StorageClass { + var _block: Iroha_Protocol_Block? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _block = source._block + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._block) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._block { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_BlockResponse) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._block != other_storage._block {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension Iroha_Protocol_BlockErrorResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".BlockErrorResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "message"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.message) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.message.isEmpty { + try visitor.visitSingularStringField(value: self.message, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_BlockErrorResponse) -> Bool { + if self.message != other.message {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension Iroha_Protocol_BlockQueryResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".BlockQueryResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "block_response"), + 2: .standard(proto: "error_response"), + ] + + fileprivate class _StorageClass { + var _response: Iroha_Protocol_BlockQueryResponse.OneOf_Response? + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _response = source._response + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: + var v: Iroha_Protocol_BlockResponse? + if let current = _storage._response { + try decoder.handleConflictingOneOf() + if case .blockResponse(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._response = .blockResponse(v)} + case 2: + var v: Iroha_Protocol_BlockErrorResponse? + if let current = _storage._response { + try decoder.handleConflictingOneOf() + if case .errorResponse(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {_storage._response = .errorResponse(v)} + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + switch _storage._response { + case .blockResponse(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + case .errorResponse(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + case nil: break + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: Iroha_Protocol_BlockQueryResponse) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._response != other_storage._response {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} diff --git a/SwiftyIrohaExample/GRPC/yac.grpc.swift b/SwiftyIrohaExample/GRPC/yac.grpc.swift new file mode 100644 index 000000000..bf7bd469e --- /dev/null +++ b/SwiftyIrohaExample/GRPC/yac.grpc.swift @@ -0,0 +1,168 @@ +// +// DO NOT EDIT. +// +// Generated by the protocol buffer compiler. +// Source: yac.proto +// + +// +// Copyright 2018, gRPC Authors All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +import Foundation +import Dispatch +import SwiftGRPC +import SwiftProtobuf + +internal protocol Iroha_Consensus_Yac_Proto_YacSendVoteCall: ClientCallUnary {} + +fileprivate final class Iroha_Consensus_Yac_Proto_YacSendVoteCallBase: ClientCallUnaryBase, Iroha_Consensus_Yac_Proto_YacSendVoteCall { + override class var method: String { return "/iroha.consensus.yac.proto.Yac/SendVote" } +} + +internal protocol Iroha_Consensus_Yac_Proto_YacSendCommitCall: ClientCallUnary {} + +fileprivate final class Iroha_Consensus_Yac_Proto_YacSendCommitCallBase: ClientCallUnaryBase, Iroha_Consensus_Yac_Proto_YacSendCommitCall { + override class var method: String { return "/iroha.consensus.yac.proto.Yac/SendCommit" } +} + +internal protocol Iroha_Consensus_Yac_Proto_YacSendRejectCall: ClientCallUnary {} + +fileprivate final class Iroha_Consensus_Yac_Proto_YacSendRejectCallBase: ClientCallUnaryBase, Iroha_Consensus_Yac_Proto_YacSendRejectCall { + override class var method: String { return "/iroha.consensus.yac.proto.Yac/SendReject" } +} + + +/// Instantiate Iroha_Consensus_Yac_Proto_YacServiceClient, then call methods of this protocol to make API calls. +internal protocol Iroha_Consensus_Yac_Proto_YacService: ServiceClient { + /// Synchronous. Unary. + func sendVote(_ request: Iroha_Consensus_Yac_Proto_Vote) throws -> SwiftProtobuf.Google_Protobuf_Empty + /// Asynchronous. Unary. + func sendVote(_ request: Iroha_Consensus_Yac_Proto_Vote, completion: @escaping (SwiftProtobuf.Google_Protobuf_Empty?, CallResult) -> Void) throws -> Iroha_Consensus_Yac_Proto_YacSendVoteCall + + /// Synchronous. Unary. + func sendCommit(_ request: Iroha_Consensus_Yac_Proto_Commit) throws -> SwiftProtobuf.Google_Protobuf_Empty + /// Asynchronous. Unary. + func sendCommit(_ request: Iroha_Consensus_Yac_Proto_Commit, completion: @escaping (SwiftProtobuf.Google_Protobuf_Empty?, CallResult) -> Void) throws -> Iroha_Consensus_Yac_Proto_YacSendCommitCall + + /// Synchronous. Unary. + func sendReject(_ request: Iroha_Consensus_Yac_Proto_Reject) throws -> SwiftProtobuf.Google_Protobuf_Empty + /// Asynchronous. Unary. + func sendReject(_ request: Iroha_Consensus_Yac_Proto_Reject, completion: @escaping (SwiftProtobuf.Google_Protobuf_Empty?, CallResult) -> Void) throws -> Iroha_Consensus_Yac_Proto_YacSendRejectCall + +} + +internal final class Iroha_Consensus_Yac_Proto_YacServiceClient: ServiceClientBase, Iroha_Consensus_Yac_Proto_YacService { + /// Synchronous. Unary. + internal func sendVote(_ request: Iroha_Consensus_Yac_Proto_Vote) throws -> SwiftProtobuf.Google_Protobuf_Empty { + return try Iroha_Consensus_Yac_Proto_YacSendVoteCallBase(channel) + .run(request: request, metadata: metadata) + } + /// Asynchronous. Unary. + internal func sendVote(_ request: Iroha_Consensus_Yac_Proto_Vote, completion: @escaping (SwiftProtobuf.Google_Protobuf_Empty?, CallResult) -> Void) throws -> Iroha_Consensus_Yac_Proto_YacSendVoteCall { + return try Iroha_Consensus_Yac_Proto_YacSendVoteCallBase(channel) + .start(request: request, metadata: metadata, completion: completion) + } + + /// Synchronous. Unary. + internal func sendCommit(_ request: Iroha_Consensus_Yac_Proto_Commit) throws -> SwiftProtobuf.Google_Protobuf_Empty { + return try Iroha_Consensus_Yac_Proto_YacSendCommitCallBase(channel) + .run(request: request, metadata: metadata) + } + /// Asynchronous. Unary. + internal func sendCommit(_ request: Iroha_Consensus_Yac_Proto_Commit, completion: @escaping (SwiftProtobuf.Google_Protobuf_Empty?, CallResult) -> Void) throws -> Iroha_Consensus_Yac_Proto_YacSendCommitCall { + return try Iroha_Consensus_Yac_Proto_YacSendCommitCallBase(channel) + .start(request: request, metadata: metadata, completion: completion) + } + + /// Synchronous. Unary. + internal func sendReject(_ request: Iroha_Consensus_Yac_Proto_Reject) throws -> SwiftProtobuf.Google_Protobuf_Empty { + return try Iroha_Consensus_Yac_Proto_YacSendRejectCallBase(channel) + .run(request: request, metadata: metadata) + } + /// Asynchronous. Unary. + internal func sendReject(_ request: Iroha_Consensus_Yac_Proto_Reject, completion: @escaping (SwiftProtobuf.Google_Protobuf_Empty?, CallResult) -> Void) throws -> Iroha_Consensus_Yac_Proto_YacSendRejectCall { + return try Iroha_Consensus_Yac_Proto_YacSendRejectCallBase(channel) + .start(request: request, metadata: metadata, completion: completion) + } + +} + +/// To build a server, implement a class that conforms to this protocol. +/// If one of the methods returning `ServerStatus?` returns nil, +/// it is expected that you have already returned a status to the client by means of `session.close`. +internal protocol Iroha_Consensus_Yac_Proto_YacProvider { + func sendVote(request: Iroha_Consensus_Yac_Proto_Vote, session: Iroha_Consensus_Yac_Proto_YacSendVoteSession) throws -> SwiftProtobuf.Google_Protobuf_Empty + func sendCommit(request: Iroha_Consensus_Yac_Proto_Commit, session: Iroha_Consensus_Yac_Proto_YacSendCommitSession) throws -> SwiftProtobuf.Google_Protobuf_Empty + func sendReject(request: Iroha_Consensus_Yac_Proto_Reject, session: Iroha_Consensus_Yac_Proto_YacSendRejectSession) throws -> SwiftProtobuf.Google_Protobuf_Empty +} + +internal protocol Iroha_Consensus_Yac_Proto_YacSendVoteSession: ServerSessionUnary {} + +fileprivate final class Iroha_Consensus_Yac_Proto_YacSendVoteSessionBase: ServerSessionUnaryBase, Iroha_Consensus_Yac_Proto_YacSendVoteSession {} + +internal protocol Iroha_Consensus_Yac_Proto_YacSendCommitSession: ServerSessionUnary {} + +fileprivate final class Iroha_Consensus_Yac_Proto_YacSendCommitSessionBase: ServerSessionUnaryBase, Iroha_Consensus_Yac_Proto_YacSendCommitSession {} + +internal protocol Iroha_Consensus_Yac_Proto_YacSendRejectSession: ServerSessionUnary {} + +fileprivate final class Iroha_Consensus_Yac_Proto_YacSendRejectSessionBase: ServerSessionUnaryBase, Iroha_Consensus_Yac_Proto_YacSendRejectSession {} + + +/// Main server for generated service +internal final class Iroha_Consensus_Yac_Proto_YacServer: ServiceServer { + private let provider: Iroha_Consensus_Yac_Proto_YacProvider + + internal init(address: String, provider: Iroha_Consensus_Yac_Proto_YacProvider) { + self.provider = provider + super.init(address: address) + } + + internal init?(address: String, certificateURL: URL, keyURL: URL, provider: Iroha_Consensus_Yac_Proto_YacProvider) { + self.provider = provider + super.init(address: address, certificateURL: certificateURL, keyURL: keyURL) + } + + internal init?(address: String, certificateString: String, keyString: String, provider: Iroha_Consensus_Yac_Proto_YacProvider) { + self.provider = provider + super.init(address: address, certificateString: certificateString, keyString: keyString) + } + + /// Determines and calls the appropriate request handler, depending on the request's method. + /// Throws `HandleMethodError.unknownMethod` for methods not handled by this service. + internal override func handleMethod(_ method: String, handler: Handler) throws -> ServerStatus? { + let provider = self.provider + switch method { + case "/iroha.consensus.yac.proto.Yac/SendVote": + return try Iroha_Consensus_Yac_Proto_YacSendVoteSessionBase( + handler: handler, + providerBlock: { try provider.sendVote(request: $0, session: $1 as! Iroha_Consensus_Yac_Proto_YacSendVoteSessionBase) }) + .run() + case "/iroha.consensus.yac.proto.Yac/SendCommit": + return try Iroha_Consensus_Yac_Proto_YacSendCommitSessionBase( + handler: handler, + providerBlock: { try provider.sendCommit(request: $0, session: $1 as! Iroha_Consensus_Yac_Proto_YacSendCommitSessionBase) }) + .run() + case "/iroha.consensus.yac.proto.Yac/SendReject": + return try Iroha_Consensus_Yac_Proto_YacSendRejectSessionBase( + handler: handler, + providerBlock: { try provider.sendReject(request: $0, session: $1 as! Iroha_Consensus_Yac_Proto_YacSendRejectSessionBase) }) + .run() + default: + throw HandleMethodError.unknownMethod + } + } +} + diff --git a/SwiftyIrohaExample/GRPC/yac.pb.swift b/SwiftyIrohaExample/GRPC/yac.pb.swift new file mode 100644 index 000000000..0c853fc14 --- /dev/null +++ b/SwiftyIrohaExample/GRPC/yac.pb.swift @@ -0,0 +1,362 @@ +// DO NOT EDIT. +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: yac.proto +// +// For information on using the generated types, please see the documenation: +// https://github.com/apple/swift-protobuf/ + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that your are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct Iroha_Consensus_Yac_Proto_Signature { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var pubkey: Data = SwiftProtobuf.Internal.emptyData + + var signature: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Iroha_Consensus_Yac_Proto_Hash { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var proposal: Data { + get {return _storage._proposal} + set {_uniqueStorage()._proposal = newValue} + } + + var block: Data { + get {return _storage._block} + set {_uniqueStorage()._block = newValue} + } + + var blockSignature: Iroha_Consensus_Yac_Proto_Signature { + get {return _storage._blockSignature ?? Iroha_Consensus_Yac_Proto_Signature()} + set {_uniqueStorage()._blockSignature = newValue} + } + /// Returns true if `blockSignature` has been explicitly set. + var hasBlockSignature: Bool {return _storage._blockSignature != nil} + /// Clears the value of `blockSignature`. Subsequent reads from it will return its default value. + mutating func clearBlockSignature() {_storage._blockSignature = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct Iroha_Consensus_Yac_Proto_Vote { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var hash: Iroha_Consensus_Yac_Proto_Hash { + get {return _storage._hash ?? Iroha_Consensus_Yac_Proto_Hash()} + set {_uniqueStorage()._hash = newValue} + } + /// Returns true if `hash` has been explicitly set. + var hasHash: Bool {return _storage._hash != nil} + /// Clears the value of `hash`. Subsequent reads from it will return its default value. + mutating func clearHash() {_storage._hash = nil} + + var signature: Iroha_Consensus_Yac_Proto_Signature { + get {return _storage._signature ?? Iroha_Consensus_Yac_Proto_Signature()} + set {_uniqueStorage()._signature = newValue} + } + /// Returns true if `signature` has been explicitly set. + var hasSignature: Bool {return _storage._signature != nil} + /// Clears the value of `signature`. Subsequent reads from it will return its default value. + mutating func clearSignature() {_storage._signature = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct Iroha_Consensus_Yac_Proto_Commit { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var votes: [Iroha_Consensus_Yac_Proto_Vote] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Iroha_Consensus_Yac_Proto_Reject { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var votes: [Iroha_Consensus_Yac_Proto_Vote] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "iroha.consensus.yac.proto" + +extension Iroha_Consensus_Yac_Proto_Signature: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Signature" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "pubkey"), + 2: .same(proto: "signature"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.pubkey) + case 2: try decoder.decodeSingularBytesField(value: &self.signature) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pubkey.isEmpty { + try visitor.visitSingularBytesField(value: self.pubkey, fieldNumber: 1) + } + if !self.signature.isEmpty { + try visitor.visitSingularBytesField(value: self.signature, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: Iroha_Consensus_Yac_Proto_Signature) -> Bool { + if self.pubkey != other.pubkey {return false} + if self.signature != other.signature {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension Iroha_Consensus_Yac_Proto_Hash: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Hash" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "proposal"), + 2: .same(proto: "block"), + 3: .standard(proto: "block_signature"), + ] + + fileprivate class _StorageClass { + var _proposal: Data = SwiftProtobuf.Internal.emptyData + var _block: Data = SwiftProtobuf.Internal.emptyData + var _blockSignature: Iroha_Consensus_Yac_Proto_Signature? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _proposal = source._proposal + _block = source._block + _blockSignature = source._blockSignature + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &_storage._proposal) + case 2: try decoder.decodeSingularBytesField(value: &_storage._block) + case 3: try decoder.decodeSingularMessageField(value: &_storage._blockSignature) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if !_storage._proposal.isEmpty { + try visitor.visitSingularBytesField(value: _storage._proposal, fieldNumber: 1) + } + if !_storage._block.isEmpty { + try visitor.visitSingularBytesField(value: _storage._block, fieldNumber: 2) + } + if let v = _storage._blockSignature { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: Iroha_Consensus_Yac_Proto_Hash) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._proposal != other_storage._proposal {return false} + if _storage._block != other_storage._block {return false} + if _storage._blockSignature != other_storage._blockSignature {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension Iroha_Consensus_Yac_Proto_Vote: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Vote" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "hash"), + 2: .same(proto: "signature"), + ] + + fileprivate class _StorageClass { + var _hash: Iroha_Consensus_Yac_Proto_Hash? = nil + var _signature: Iroha_Consensus_Yac_Proto_Signature? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _hash = source._hash + _signature = source._signature + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &_storage._hash) + case 2: try decoder.decodeSingularMessageField(value: &_storage._signature) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._hash { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = _storage._signature { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: Iroha_Consensus_Yac_Proto_Vote) -> Bool { + if _storage !== other._storage { + let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let other_storage = _args.1 + if _storage._hash != other_storage._hash {return false} + if _storage._signature != other_storage._signature {return false} + return true + } + if !storagesAreEqual {return false} + } + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension Iroha_Consensus_Yac_Proto_Commit: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Commit" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "votes"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.votes) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.votes.isEmpty { + try visitor.visitRepeatedMessageField(value: self.votes, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: Iroha_Consensus_Yac_Proto_Commit) -> Bool { + if self.votes != other.votes {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} + +extension Iroha_Consensus_Yac_Proto_Reject: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Reject" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "votes"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.votes) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.votes.isEmpty { + try visitor.visitRepeatedMessageField(value: self.votes, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + func _protobuf_generated_isEqualTo(other: Iroha_Consensus_Yac_Proto_Reject) -> Bool { + if self.votes != other.votes {return false} + if unknownFields != other.unknownFields {return false} + return true + } +} diff --git a/SwiftyIrohaExample/proto_file/GENERATE_PROTO.md b/SwiftyIrohaExample/proto_file/GENERATE_PROTO.md index 44886aaf3..3773c9c33 100644 --- a/SwiftyIrohaExample/proto_file/GENERATE_PROTO.md +++ b/SwiftyIrohaExample/proto_file/GENERATE_PROTO.md @@ -2,5 +2,5 @@ $export GOPATH=/Users/username/go $export PATH=$GOPATH/bin:$PATH $cd path/to/proto/files - $protoc --swift_out=. *.proto + $protoc --swift_out=. --swiftgrpc_out=. *.proto ``` diff --git a/SwiftyIrohaExample/proto_file/yac.proto b/SwiftyIrohaExample/proto_file/yac.proto new file mode 100644 index 000000000..7b96eaf6a --- /dev/null +++ b/SwiftyIrohaExample/proto_file/yac.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; +package iroha.consensus.yac.proto; + +import "google/protobuf/empty.proto"; + +message Signature { + bytes pubkey = 1; + bytes signature = 2; +} + +message Hash { + bytes proposal = 1; + bytes block = 2; + Signature block_signature = 3; +} + +message Vote { + Hash hash = 1; + Signature signature = 2; +} + +message Commit { + repeated Vote votes = 1; +} + +message Reject { + repeated Vote votes = 1; +} + +service Yac { + rpc SendVote (Vote) returns (google.protobuf.Empty); + rpc SendCommit (Commit) returns (google.protobuf.Empty); + rpc SendReject (Reject) returns (google.protobuf.Empty); +} diff --git a/headers/backend/protobuf/query_responses/proto_account_asset_response.hpp b/headers/backend/protobuf/query_responses/proto_account_asset_response.hpp index b169c0c48..217a5d705 100644 --- a/headers/backend/protobuf/query_responses/proto_account_asset_response.hpp +++ b/headers/backend/protobuf/query_responses/proto_account_asset_response.hpp @@ -36,32 +36,21 @@ namespace shared_model { AccountAssetResponse> { public: template - explicit AccountAssetResponse(QueryResponseType &&queryResponse) - : CopyableProto(std::forward(queryResponse)) {} + explicit AccountAssetResponse(QueryResponseType &&queryResponse); - AccountAssetResponse(const AccountAssetResponse &o) - : AccountAssetResponse(o.proto_) {} + AccountAssetResponse(const AccountAssetResponse &o); - AccountAssetResponse(AccountAssetResponse &&o) - : AccountAssetResponse(std::move(o.proto_)) {} + AccountAssetResponse(AccountAssetResponse &&o); - const interface::types::AccountAssetCollectionType accountAssets() const override { - return *accountAssets_; - } + const interface::types::AccountAssetCollectionType accountAssets() const override; private: template using Lazy = detail::LazyInitializer; - const iroha::protocol::AccountAssetResponse &accountAssetResponse_{ - proto_->account_assets_response()}; + const iroha::protocol::AccountAssetResponse &accountAssetResponse_; - const Lazy> accountAssets_{ - [this] { - return std::vector( - accountAssetResponse_.account_assets().begin(), - accountAssetResponse_.account_assets().end()); - }}; + const Lazy> accountAssets_; }; } // namespace proto } // namespace shared_model diff --git a/headers/backend/protobuf/query_responses/proto_account_detail_response.hpp b/headers/backend/protobuf/query_responses/proto_account_detail_response.hpp index 73d95306c..f6df0be1d 100644 --- a/headers/backend/protobuf/query_responses/proto_account_detail_response.hpp +++ b/headers/backend/protobuf/query_responses/proto_account_detail_response.hpp @@ -32,22 +32,16 @@ namespace shared_model { AccountDetailResponse> { public: template - explicit AccountDetailResponse(QueryResponseType &&queryResponse) - : CopyableProto(std::forward(queryResponse)) {} + explicit AccountDetailResponse(QueryResponseType &&queryResponse); - AccountDetailResponse(const AccountDetailResponse &o) - : AccountDetailResponse(o.proto_) {} + AccountDetailResponse(const AccountDetailResponse &o); - AccountDetailResponse(AccountDetailResponse &&o) - : AccountDetailResponse(std::move(o.proto_)) {} + AccountDetailResponse(AccountDetailResponse &&o); - const DetailType &detail() const override { - return account_detail_response_.detail(); - } + const interface::types::DetailType &detail() const override; private: - const iroha::protocol::AccountDetailResponse &account_detail_response_{ - proto_->account_detail_response()}; + const iroha::protocol::AccountDetailResponse &account_detail_response_; }; } // namespace proto } // namespace shared_model diff --git a/headers/backend/protobuf/query_responses/proto_account_response.hpp b/headers/backend/protobuf/query_responses/proto_account_response.hpp index d7da7cace..a6be1d2f2 100644 --- a/headers/backend/protobuf/query_responses/proto_account_response.hpp +++ b/headers/backend/protobuf/query_responses/proto_account_response.hpp @@ -34,41 +34,25 @@ namespace shared_model { AccountResponse> { public: template - explicit AccountResponse(QueryResponseType &&queryResponse) - : CopyableProto(std::forward(queryResponse)) {} + explicit AccountResponse(QueryResponseType &&queryResponse); - AccountResponse(const AccountResponse &o) : AccountResponse(o.proto_) {} + AccountResponse(const AccountResponse &o); - AccountResponse(AccountResponse &&o) - : AccountResponse(std::move(o.proto_)) {} + AccountResponse(AccountResponse &&o); - const interface::Account &account() const override { - return *account_; - } + const interface::Account &account() const override; - const AccountRolesIdType &roles() const override { - return *accountRoles_; - } + const AccountRolesIdType &roles() const override; private: template using Lazy = detail::LazyInitializer; - const iroha::protocol::AccountResponse &accountResponse_{ - proto_->account_response()}; + const iroha::protocol::AccountResponse &accountResponse_; - const Lazy accountRoles_{[this] { - return boost::accumulate( - accountResponse_.account_roles(), - AccountRolesIdType{}, - [](auto &&roles, const auto &role) { - roles.push_back(interface::types::RoleIdType(role)); - return std::move(roles); - }); - }}; + const Lazy accountRoles_; - const Lazy account_{ - [this] { return Account(accountResponse_.account()); }}; + const Lazy account_; }; } // namespace proto } // namespace shared_model diff --git a/headers/backend/protobuf/query_responses/proto_asset_response.hpp b/headers/backend/protobuf/query_responses/proto_asset_response.hpp index 00a0658f8..695d61a82 100644 --- a/headers/backend/protobuf/query_responses/proto_asset_response.hpp +++ b/headers/backend/protobuf/query_responses/proto_asset_response.hpp @@ -32,26 +32,21 @@ namespace shared_model { AssetResponse> { public: template - explicit AssetResponse(QueryResponseType &&queryResponse) - : CopyableProto(std::forward(queryResponse)) {} + explicit AssetResponse(QueryResponseType &&queryResponse); - AssetResponse(const AssetResponse &o) : AssetResponse(o.proto_) {} + AssetResponse(const AssetResponse &o); - AssetResponse(AssetResponse &&o) : AssetResponse(std::move(o.proto_)) {} + AssetResponse(AssetResponse &&o); - const Asset &asset() const override { - return *asset_; - } + const Asset &asset() const override; private: template using Lazy = detail::LazyInitializer; - const iroha::protocol::AssetResponse &assetResponse_{ - proto_->asset_response()}; + const iroha::protocol::AssetResponse &assetResponse_; - const Lazy asset_{ - [this] { return Asset(assetResponse_.asset()); }}; + const Lazy asset_; }; } // namespace proto } // namespace shared_model diff --git a/headers/backend/protobuf/query_responses/proto_error_query_response.hpp b/headers/backend/protobuf/query_responses/proto_error_query_response.hpp index e8a03549e..1526d9804 100644 --- a/headers/backend/protobuf/query_responses/proto_error_query_response.hpp +++ b/headers/backend/protobuf/query_responses/proto_error_query_response.hpp @@ -23,7 +23,6 @@ #include "interfaces/query_responses/error_query_response.hpp" #include "responses.pb.h" #include "utils/lazy_initializer.hpp" -#include "utils/variant_deserializer.hpp" namespace shared_model { namespace proto { @@ -49,18 +48,13 @@ namespace shared_model { ProtoQueryErrorResponseVariantType::types; template - explicit ErrorQueryResponse(QueryResponseType &&response) - : CopyableProto(std::forward(response)) {} + explicit ErrorQueryResponse(QueryResponseType &&response); - ErrorQueryResponse(const ErrorQueryResponse &o) - : ErrorQueryResponse(o.proto_) {} + ErrorQueryResponse(const ErrorQueryResponse &o); - ErrorQueryResponse(ErrorQueryResponse &&o) noexcept - : ErrorQueryResponse(std::move(o.proto_)) {} + ErrorQueryResponse(ErrorQueryResponse &&o) noexcept; - const QueryErrorResponseVariantType &get() const override { - return *ivariant_; - } + const QueryErrorResponseVariantType &get() const override; private: /// lazy variant shortcut @@ -69,23 +63,9 @@ namespace shared_model { using LazyVariantType = Lazy; - const LazyVariantType variant_{[this] { - auto &&ar = proto_->error_response(); + const LazyVariantType variant_; - unsigned which = ar.GetDescriptor() - ->FindFieldByName("reason") - ->enum_type() - ->FindValueByNumber(ar.reason()) - ->index(); - return shared_model::detail:: - variant_impl::template load< - ProtoQueryErrorResponseVariantType>( - std::forward(ar), which); - }}; - - const Lazy ivariant_{ - detail::makeLazyInitializer( - [this] { return QueryErrorResponseVariantType(*variant_); })}; + const Lazy ivariant_; }; } // namespace proto } // namespace shared_model diff --git a/headers/backend/protobuf/query_responses/proto_query_response.hpp b/headers/backend/protobuf/query_responses/proto_query_response.hpp index b02a1ac44..eb79b93c0 100644 --- a/headers/backend/protobuf/query_responses/proto_query_response.hpp +++ b/headers/backend/protobuf/query_responses/proto_query_response.hpp @@ -29,12 +29,9 @@ #include "backend/protobuf/query_responses/proto_transaction_response.hpp" #include "backend/protobuf/common_objects/trivial_proto.hpp" -#include "common/byteutils.hpp" -#include "interfaces/queries/query.hpp" #include "interfaces/query_responses/query_response.hpp" #include "responses.pb.h" #include "utils/lazy_initializer.hpp" -#include "utils/variant_deserializer.hpp" namespace shared_model { namespace proto { @@ -59,21 +56,15 @@ namespace shared_model { using ProtoQueryResponseListType = ProtoQueryResponseVariantType::types; template - explicit QueryResponse(QueryResponseType &&queryResponse) - : CopyableProto(std::forward(queryResponse)) {} + explicit QueryResponse(QueryResponseType &&queryResponse); - QueryResponse(const QueryResponse &o) : QueryResponse(o.proto_) {} + QueryResponse(const QueryResponse &o); - QueryResponse(QueryResponse &&o) noexcept - : QueryResponse(std::move(o.proto_)) {} + QueryResponse(QueryResponse &&o) noexcept; - const QueryResponseVariantType &get() const override { - return *ivariant_; - } + const QueryResponseVariantType &get() const override; - const interface::types::HashType &queryHash() const override { - return *hash_; - } + const interface::types::HashType &queryHash() const override; private: template @@ -81,23 +72,11 @@ namespace shared_model { using LazyVariantType = Lazy; - const LazyVariantType variant_{[this] { - auto &&ar = *proto_; - int which = - ar.GetDescriptor()->FindFieldByNumber(ar.response_case())->index(); - return shared_model::detail::variant_impl:: - template load( - std::forward(ar), which); - }}; - - const Lazy ivariant_{ - detail::makeLazyInitializer( - [this] { return QueryResponseVariantType(*variant_); })}; - - const Lazy hash_{[this] { - return interface::types::HashType( - iroha::hexstringToBytestring(proto_->query_hash()).get()); - }}; + const LazyVariantType variant_; + + const Lazy ivariant_; + + const Lazy hash_; }; } // namespace proto } // namespace shared_model diff --git a/headers/backend/protobuf/query_responses/proto_role_permissions_response.hpp b/headers/backend/protobuf/query_responses/proto_role_permissions_response.hpp index 83a3a73be..a4d2bbb86 100644 --- a/headers/backend/protobuf/query_responses/proto_role_permissions_response.hpp +++ b/headers/backend/protobuf/query_responses/proto_role_permissions_response.hpp @@ -31,35 +31,21 @@ namespace shared_model { RolePermissionsResponse> { public: template - explicit RolePermissionsResponse(QueryResponseType &&queryResponse) - : CopyableProto(std::forward(queryResponse)) {} + explicit RolePermissionsResponse(QueryResponseType &&queryResponse); - RolePermissionsResponse(const RolePermissionsResponse &o) - : RolePermissionsResponse(o.proto_) {} + RolePermissionsResponse(const RolePermissionsResponse &o); - RolePermissionsResponse(RolePermissionsResponse &&o) - : RolePermissionsResponse(std::move(o.proto_)) {} + RolePermissionsResponse(RolePermissionsResponse &&o); - const PermissionNameCollectionType &rolePermissions() const override { - return *rolePermissions_; - } + const PermissionNameCollectionType &rolePermissions() const override; private: template using Lazy = detail::LazyInitializer; - const iroha::protocol::RolePermissionsResponse &rolePermissionsResponse_{ - proto_->role_permissions_response()}; + const iroha::protocol::RolePermissionsResponse &rolePermissionsResponse_; - const Lazy rolePermissions_{[this] { - return boost::accumulate( - rolePermissionsResponse_.permissions(), - PermissionNameCollectionType{}, - [](auto &&permissions, const auto &permission) { - permissions.emplace_back(permission); - return std::move(permissions); - }); - }}; + const Lazy rolePermissions_; }; } // namespace proto } // namespace shared_model diff --git a/headers/backend/protobuf/query_responses/proto_roles_response.hpp b/headers/backend/protobuf/query_responses/proto_roles_response.hpp index b7e417df8..f141e1fa3 100644 --- a/headers/backend/protobuf/query_responses/proto_roles_response.hpp +++ b/headers/backend/protobuf/query_responses/proto_roles_response.hpp @@ -31,32 +31,21 @@ namespace shared_model { RolesResponse> { public: template - explicit RolesResponse(QueryResponseType &&queryResponse) - : CopyableProto(std::forward(queryResponse)) {} + explicit RolesResponse(QueryResponseType &&queryResponse); - RolesResponse(const RolesResponse &o) : RolesResponse(o.proto_) {} + RolesResponse(const RolesResponse &o); - RolesResponse(RolesResponse &&o) : RolesResponse(std::move(o.proto_)) {} + RolesResponse(RolesResponse &&o); - const RolesIdType &roles() const override { - return *roles_; - } + const RolesIdType &roles() const override; private: template using Lazy = detail::LazyInitializer; - const iroha::protocol::RolesResponse &rolesResponse_{ - proto_->roles_response()}; + const iroha::protocol::RolesResponse &rolesResponse_; - const Lazy roles_{[this] { - return boost::accumulate(rolesResponse_.roles(), - RolesIdType{}, - [](auto &&roles, const auto &role) { - roles.emplace_back(role); - return std::move(roles); - }); - }}; + const Lazy roles_; }; } // namespace proto } // namespace shared_model diff --git a/headers/backend/protobuf/query_responses/proto_signatories_response.hpp b/headers/backend/protobuf/query_responses/proto_signatories_response.hpp index d2677f106..31eb7cb32 100644 --- a/headers/backend/protobuf/query_responses/proto_signatories_response.hpp +++ b/headers/backend/protobuf/query_responses/proto_signatories_response.hpp @@ -32,31 +32,21 @@ namespace shared_model { SignatoriesResponse> { public: template - explicit SignatoriesResponse(QueryResponseType &&queryResponse) - : CopyableProto(std::forward(queryResponse)) {} + explicit SignatoriesResponse(QueryResponseType &&queryResponse); - SignatoriesResponse(const SignatoriesResponse &o) - : SignatoriesResponse(o.proto_) {} + SignatoriesResponse(const SignatoriesResponse &o); - SignatoriesResponse(SignatoriesResponse &&o) - : SignatoriesResponse(std::move(o.proto_)) {} + SignatoriesResponse(SignatoriesResponse &&o); - const interface::types::PublicKeyCollectionType &keys() const override { - return *keys_; - } + const interface::types::PublicKeyCollectionType &keys() const override; private: template using Lazy = detail::LazyInitializer; - const iroha::protocol::SignatoriesResponse &signatoriesResponse_{ - proto_->signatories_response()}; + const iroha::protocol::SignatoriesResponse &signatoriesResponse_; - const Lazy keys_{[this] { - return interface::types::PublicKeyCollectionType( - signatoriesResponse_.keys().begin(), - signatoriesResponse_.keys().end()); - }}; + const Lazy keys_; }; } // namespace proto } // namespace shared_model diff --git a/headers/backend/protobuf/query_responses/proto_transaction_response.hpp b/headers/backend/protobuf/query_responses/proto_transaction_response.hpp index 1eddeea77..d2535f292 100644 --- a/headers/backend/protobuf/query_responses/proto_transaction_response.hpp +++ b/headers/backend/protobuf/query_responses/proto_transaction_response.hpp @@ -33,32 +33,22 @@ namespace shared_model { TransactionsResponse> { public: template - explicit TransactionsResponse(QueryResponseType &&queryResponse) - : CopyableProto(std::forward(queryResponse)) {} + explicit TransactionsResponse(QueryResponseType &&queryResponse); - TransactionsResponse(const TransactionsResponse &o) - : TransactionsResponse(o.proto_) {} + TransactionsResponse(const TransactionsResponse &o); - TransactionsResponse(TransactionsResponse &&o) - : TransactionsResponse(std::move(o.proto_)) {} + TransactionsResponse(TransactionsResponse &&o); interface::types::TransactionsCollectionType transactions() - const override { - return *transactions_; - } + const override; private: template using Lazy = detail::LazyInitializer; - const iroha::protocol::TransactionsResponse &transactionResponse_{ - proto_->transactions_response()}; + const iroha::protocol::TransactionsResponse &transactionResponse_; - const Lazy> transactions_{[this] { - return std::vector( - transactionResponse_.transactions().begin(), - transactionResponse_.transactions().end()); - }}; + const Lazy> transactions_; }; } // namespace proto } // namespace shared_model diff --git a/headers/ed25519_export.h b/headers/ed25519_export.h index 2459a80a6..b3f34d12a 100644 --- a/headers/ed25519_export.h +++ b/headers/ed25519_export.h @@ -39,4 +39,4 @@ # endif #endif -#endif +#endif /* ED25519_EXPORT_H */ diff --git a/headers/interfaces/query_responses/account_asset_response.hpp b/headers/interfaces/query_responses/account_asset_response.hpp index 4b9d34e7e..88ff5172c 100644 --- a/headers/interfaces/query_responses/account_asset_response.hpp +++ b/headers/interfaces/query_responses/account_asset_response.hpp @@ -20,9 +20,6 @@ #include "interfaces/base/model_primitive.hpp" #include "interfaces/common_objects/account_asset.hpp" -#include "interfaces/common_objects/types.hpp" -#include "utils/string_builder.hpp" -#include "utils/visitor_apply_for_all.hpp" namespace shared_model { namespace interface { @@ -36,26 +33,9 @@ namespace shared_model { */ virtual const types::AccountAssetCollectionType accountAssets() const = 0; - /** - * Stringify the data. - * @return string representation of data. - */ - std::string toString() const override { - auto response = detail::PrettyStringBuilder() - .init("AccountAssetResponse"); - for (const auto &asset: accountAssets()) - response.append(asset.toString()); - return response.finalize(); - } + std::string toString() const override; - /** - * Implementation of operator == - * @param rhs - the right-hand side of AccountAssetResponse object - * @return true if they are same. - */ - bool operator==(const ModelType &rhs) const override { - return accountAssets() == rhs.accountAssets(); - } + bool operator==(const ModelType &rhs) const override; }; } // namespace interface } // namespace shared_model diff --git a/headers/interfaces/query_responses/account_detail_response.hpp b/headers/interfaces/query_responses/account_detail_response.hpp index 3892b5cf0..175091afa 100644 --- a/headers/interfaces/query_responses/account_detail_response.hpp +++ b/headers/interfaces/query_responses/account_detail_response.hpp @@ -19,10 +19,7 @@ #define IROHA_SHARED_MODEL_ACCOUNT_DETAIL_RESPONSE_HPP #include "interfaces/base/model_primitive.hpp" -#include "interfaces/common_objects/account_asset.hpp" #include "interfaces/common_objects/types.hpp" -#include "utils/string_builder.hpp" -#include "utils/visitor_apply_for_all.hpp" namespace shared_model { namespace interface { @@ -31,32 +28,14 @@ namespace shared_model { */ class AccountDetailResponse : public ModelPrimitive { public: - /// Detail - using DetailType = std::string; /** * @return Account has Asset model */ - virtual const DetailType &detail() const = 0; + virtual const types::DetailType &detail() const = 0; - /** - * Stringify the data. - * @return string representation of data. - */ - std::string toString() const override { - return detail::PrettyStringBuilder() - .init("AccountDetailResponse") - .append(detail()) - .finalize(); - } + std::string toString() const override; - /** - * Implementation of operator == - * @param rhs - the right-hand side of AccountAssetResponse object - * @return true if they are same. - */ - bool operator==(const ModelType &rhs) const override { - return detail() == rhs.detail(); - } + bool operator==(const ModelType &rhs) const override; }; } // namespace interface } // namespace shared_model diff --git a/headers/interfaces/query_responses/account_response.hpp b/headers/interfaces/query_responses/account_response.hpp index 56e4aef9d..262072ff1 100644 --- a/headers/interfaces/query_responses/account_response.hpp +++ b/headers/interfaces/query_responses/account_response.hpp @@ -21,7 +21,6 @@ #include "interfaces/base/model_primitive.hpp" #include "interfaces/common_objects/account.hpp" #include "interfaces/common_objects/types.hpp" -#include "utils/string_builder.hpp" namespace shared_model { namespace interface { @@ -43,27 +42,9 @@ namespace shared_model { */ virtual const AccountRolesIdType &roles() const = 0; - /** - * Stringify the data. - * @return string representation of data. - */ - std::string toString() const override { - return detail::PrettyStringBuilder() - .init("AccountResponse") - .append(account().toString()) - .append("roles") - .appendAll(roles(), [](auto s) { return s; }) - .finalize(); - } + std::string toString() const override; - /** - * Implementation of operator == - * @param rhs - the right hand-side of GetAccountAssetResponse - * @return true if they have same values. - */ - bool operator==(const ModelType &rhs) const override { - return account() == rhs.account() and roles() == rhs.roles(); - } + bool operator==(const ModelType &rhs) const override; }; } // namespace interface } // namespace shared_model diff --git a/headers/interfaces/query_responses/asset_response.hpp b/headers/interfaces/query_responses/asset_response.hpp index 132d7cf64..10e4d3c62 100644 --- a/headers/interfaces/query_responses/asset_response.hpp +++ b/headers/interfaces/query_responses/asset_response.hpp @@ -20,8 +20,6 @@ #include "interfaces/base/model_primitive.hpp" #include "interfaces/common_objects/asset.hpp" -#include "interfaces/common_objects/types.hpp" -#include "utils/string_builder.hpp" namespace shared_model { namespace interface { @@ -35,23 +33,9 @@ namespace shared_model { */ virtual const Asset &asset() const = 0; - /** - * Stringify the data. - * @return string representation of data. - */ - std::string toString() const override { - return detail::PrettyStringBuilder() - .init("AssetResponse") - .append(asset().toString()) - .finalize(); - } + std::string toString() const override; - /** - * @return true if the data are same. - */ - bool operator==(const ModelType &rhs) const override { - return asset() == rhs.asset(); - } + bool operator==(const ModelType &rhs) const override; }; } // namespace interface } // namespace shared_model diff --git a/headers/interfaces/query_responses/error_query_response.hpp b/headers/interfaces/query_responses/error_query_response.hpp index d07413b63..c868fb61d 100644 --- a/headers/interfaces/query_responses/error_query_response.hpp +++ b/headers/interfaces/query_responses/error_query_response.hpp @@ -30,7 +30,6 @@ #include "interfaces/query_responses/error_responses/not_supported_error_response.hpp" #include "interfaces/query_responses/error_responses/stateful_failed_error_response.hpp" #include "interfaces/query_responses/error_responses/stateless_failed_error_response.hpp" -#include "utils/visitor_apply_for_all.hpp" namespace shared_model { namespace interface { @@ -67,13 +66,9 @@ namespace shared_model { // ------------------------| Primitive override |------------------------- - std::string toString() const override { - return boost::apply_visitor(detail::ToStringVisitor(), get()); - } + std::string toString() const override; - bool operator==(const ModelType &rhs) const override { - return get() == rhs.get(); - } + bool operator==(const ModelType &rhs) const override; }; } // namespace interface } // namespace shared_model diff --git a/headers/interfaces/query_responses/query_response.hpp b/headers/interfaces/query_responses/query_response.hpp index cdeeaa37a..b0fa25852 100644 --- a/headers/interfaces/query_responses/query_response.hpp +++ b/headers/interfaces/query_responses/query_response.hpp @@ -71,13 +71,9 @@ namespace shared_model { // ------------------------| Primitive override |------------------------- - std::string toString() const override { - return boost::apply_visitor(detail::ToStringVisitor(), get()); - } + std::string toString() const override; - bool operator==(const ModelType &rhs) const override { - return queryHash() == rhs.queryHash() and get() == rhs.get(); - } + bool operator==(const ModelType &rhs) const override; }; } // namespace interface } // namespace shared_model diff --git a/headers/interfaces/query_responses/role_permissions.hpp b/headers/interfaces/query_responses/role_permissions.hpp index b1f7b1882..cad81c508 100644 --- a/headers/interfaces/query_responses/role_permissions.hpp +++ b/headers/interfaces/query_responses/role_permissions.hpp @@ -20,7 +20,6 @@ #include "interfaces/base/model_primitive.hpp" #include "interfaces/common_objects/types.hpp" -#include "utils/string_builder.hpp" namespace shared_model { namespace interface { @@ -39,25 +38,9 @@ namespace shared_model { */ virtual const PermissionNameCollectionType &rolePermissions() const = 0; - /** - * Stringify the data. - * @return string representation of data. - */ - std::string toString() const override { - return detail::PrettyStringBuilder() - .init("RolePermissionsResponse") - .appendAll(rolePermissions(), [](auto perm) { return perm; }) - .finalize(); - } + std::string toString() const override; - /** - * Implementation of operator == - * @param rhs - the right hand-side of RolePermissionsResponse - * @return true if they have same values. - */ - bool operator==(const ModelType &rhs) const override { - return rolePermissions() == rhs.rolePermissions(); - } + bool operator==(const ModelType &rhs) const override; }; } // namespace interface } // namespace shared_model diff --git a/headers/interfaces/query_responses/roles_response.hpp b/headers/interfaces/query_responses/roles_response.hpp index 2bdd1d372..ee7bebc27 100644 --- a/headers/interfaces/query_responses/roles_response.hpp +++ b/headers/interfaces/query_responses/roles_response.hpp @@ -20,7 +20,6 @@ #include "interfaces/base/model_primitive.hpp" #include "interfaces/common_objects/types.hpp" -#include "utils/string_builder.hpp" namespace shared_model { namespace interface { @@ -37,23 +36,9 @@ namespace shared_model { */ virtual const RolesIdType &roles() const = 0; - /** - * Stringify the data. - * @return string representation of data. - */ - std::string toString() const override { - return detail::PrettyStringBuilder() - .init("RolesResponse") - .appendAll(roles(), [](auto s) { return s; }) - .finalize(); - } + std::string toString() const override; - /** - * @return true if the data are same. - */ - bool operator==(const ModelType &rhs) const override { - return roles() == rhs.roles(); - } + bool operator==(const ModelType &rhs) const override; }; } // namespace interface } // namespace shared_model diff --git a/headers/interfaces/query_responses/signatories_response.hpp b/headers/interfaces/query_responses/signatories_response.hpp index 5d41126ed..555a0c5f3 100644 --- a/headers/interfaces/query_responses/signatories_response.hpp +++ b/headers/interfaces/query_responses/signatories_response.hpp @@ -20,7 +20,6 @@ #include "interfaces/base/model_primitive.hpp" #include "interfaces/common_objects/types.hpp" -#include "utils/string_builder.hpp" namespace shared_model { namespace interface { @@ -34,23 +33,9 @@ namespace shared_model { */ virtual const types::PublicKeyCollectionType &keys() const = 0; - /** - * Stringify the data. - * @return string representation of data. - */ - std::string toString() const override { - return detail::PrettyStringBuilder() - .init("SignatoriesResponse") - .appendAll(keys(), [](auto &key) { return key.toString(); }) - .finalize(); - } + std::string toString() const override; - /** - * @return true if the data are same. - */ - bool operator==(const ModelType &rhs) const override { - return keys() == rhs.keys(); - } + bool operator==(const ModelType &rhs) const override; }; } // namespace interface } // namespace shared_model diff --git a/headers/interfaces/query_responses/transactions_response.hpp b/headers/interfaces/query_responses/transactions_response.hpp index 85de9ab91..4b2ddcf1b 100644 --- a/headers/interfaces/query_responses/transactions_response.hpp +++ b/headers/interfaces/query_responses/transactions_response.hpp @@ -20,8 +20,6 @@ #include "interfaces/base/model_primitive.hpp" #include "interfaces/common_objects/types.hpp" -#include "utils/string_builder.hpp" -#include "interfaces/transaction.hpp" namespace shared_model { namespace interface { @@ -35,23 +33,9 @@ namespace shared_model { */ virtual types::TransactionsCollectionType transactions() const = 0; - /** - * Stringify the data. - * @return string representation of data. - */ - std::string toString() const override { - return detail::PrettyStringBuilder() - .init("TransactionsResponse") - .appendAll(transactions(), [](auto &tx) { return tx.toString(); }) - .finalize(); - } + std::string toString() const override; - /** - * @return true if the data are same. - */ - bool operator==(const ModelType &rhs) const override { - return transactions() == rhs.transactions(); - } + bool operator==(const ModelType &rhs) const override; }; } // namespace interface } // namespace shared_model diff --git a/headers/utils/visitor_apply_for_all.hpp b/headers/utils/visitor_apply_for_all.hpp index 1b651f7b2..d50c1579c 100644 --- a/headers/utils/visitor_apply_for_all.hpp +++ b/headers/utils/visitor_apply_for_all.hpp @@ -19,6 +19,7 @@ #define IROHA_VISITOR_APPLY_FOR_ALL_HPP #include +#include namespace shared_model { namespace detail { diff --git a/libs/simulator/libbindings.a b/libs/simulator/libbindings.a index 4519c1eae..a5ba55590 100644 Binary files a/libs/simulator/libbindings.a and b/libs/simulator/libbindings.a differ diff --git a/libs/simulator/libed25519.a b/libs/simulator/libed25519.a index 12fb1f465..f59d9f021 100644 Binary files a/libs/simulator/libed25519.a and b/libs/simulator/libed25519.a differ diff --git a/libs/simulator/libed25519_crypto.a b/libs/simulator/libed25519_crypto.a index 0b6649f79..1dfd1cb0b 100644 Binary files a/libs/simulator/libed25519_crypto.a and b/libs/simulator/libed25519_crypto.a differ diff --git a/libs/simulator/libgenerator.a b/libs/simulator/libgenerator.a index 122fc878b..960dfeefb 100644 Binary files a/libs/simulator/libgenerator.a and b/libs/simulator/libgenerator.a differ diff --git a/libs/simulator/libhash.a b/libs/simulator/libhash.a index 289c03f11..ce55d0429 100644 Binary files a/libs/simulator/libhash.a and b/libs/simulator/libhash.a differ diff --git a/libs/simulator/libiroha_amount.a b/libs/simulator/libiroha_amount.a index 20e07750e..8ad19ccae 100644 Binary files a/libs/simulator/libiroha_amount.a and b/libs/simulator/libiroha_amount.a differ diff --git a/libs/simulator/libprotobuf.a b/libs/simulator/libprotobuf.a index 36676269a..365d216dc 100644 Binary files a/libs/simulator/libprotobuf.a and b/libs/simulator/libprotobuf.a differ diff --git a/libs/simulator/libschema.a b/libs/simulator/libschema.a index a0aa7be36..7fbef2359 100644 Binary files a/libs/simulator/libschema.a and b/libs/simulator/libschema.a differ diff --git a/libs/simulator/libshared_model_cryptography.a b/libs/simulator/libshared_model_cryptography.a index f61718df0..e68f0f656 100644 Binary files a/libs/simulator/libshared_model_cryptography.a and b/libs/simulator/libshared_model_cryptography.a differ diff --git a/libs/simulator/libshared_model_cryptography_model.a b/libs/simulator/libshared_model_cryptography_model.a index b884f6e61..6ca54df1a 100644 Binary files a/libs/simulator/libshared_model_cryptography_model.a and b/libs/simulator/libshared_model_cryptography_model.a differ diff --git a/libs/simulator/libshared_model_interfaces.a b/libs/simulator/libshared_model_interfaces.a index 514ef761d..9251d7c6a 100644 Binary files a/libs/simulator/libshared_model_interfaces.a and b/libs/simulator/libshared_model_interfaces.a differ diff --git a/libs/simulator/libshared_model_proto_backend.a b/libs/simulator/libshared_model_proto_backend.a index afc0cf4fc..31a6cfc42 100644 Binary files a/libs/simulator/libshared_model_proto_backend.a and b/libs/simulator/libshared_model_proto_backend.a differ diff --git a/libs/simulator/libshared_model_stateless_validation.a b/libs/simulator/libshared_model_stateless_validation.a index bdda00689..7aaf65a46 100644 Binary files a/libs/simulator/libshared_model_stateless_validation.a and b/libs/simulator/libshared_model_stateless_validation.a differ