diff --git a/Zircles/memo.pb.swift b/Zircles/memo.pb.swift new file mode 100644 index 0000000..a9c9bdf --- /dev/null +++ b/Zircles/memo.pb.swift @@ -0,0 +1,266 @@ +// DO NOT EDIT. +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: memo.proto +// +// For information on using the generated types, please see the documentation: +// 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 you 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 +} + +/// Admin Memo protocol. Declares the creation of a Zircle in the blockchain +struct CreateZircleMessage { + // 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. + + /// name of this zircle + var name: String = String() + + /// goal of the zircle in Zatoshis + var goal: UInt64 = 0 + + var frequency: CreateZircleMessage.ContributionFrequency = .day + + /// timestamp timeReferenceSince1970 for end of this Zircle, 0 for end At Will + var end: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum ContributionFrequency: SwiftProtobuf.Enum { + typealias RawValue = Int + case day // = 0 + case week // = 1 + case month // = 2 + case UNRECOGNIZED(Int) + + init() { + self = .day + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .day + case 1: self = .week + case 2: self = .month + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .day: return 0 + case .week: return 1 + case .month: return 2 + case .UNRECOGNIZED(let i): return i + } + } + + } + + init() {} +} + +#if swift(>=4.2) + +extension CreateZircleMessage.ContributionFrequency: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [CreateZircleMessage.ContributionFrequency] = [ + .day, + .week, + .month, + ] +} + +#endif // swift(>=4.2) + +/// Contribution and Join memo protocol +struct ContributionJoin { + // 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. + + /// nickname of the joiner / contributor + var from: String = String() + + /// autoid of the person contributing or joining + var autoid: String = String() + + /// zAddr of the joiner / contributor + var replyTo: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct PokeContributor { + // 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. + + /// message to the rogue contributor + var quote: String = String() + + /// who's claiming the funds + var name: String = String() + + /// address to pay the tribute + var replyTo: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "co.electriccoin.zircles.rpc" + +extension CreateZircleMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CreateZircleMessage" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "goal"), + 3: .same(proto: "frequency"), + 4: .same(proto: "end"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.name) + case 2: try decoder.decodeSingularUInt64Field(value: &self.goal) + case 3: try decoder.decodeSingularEnumField(value: &self.frequency) + case 4: try decoder.decodeSingularUInt64Field(value: &self.end) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + if self.goal != 0 { + try visitor.visitSingularUInt64Field(value: self.goal, fieldNumber: 2) + } + if self.frequency != .day { + try visitor.visitSingularEnumField(value: self.frequency, fieldNumber: 3) + } + if self.end != 0 { + try visitor.visitSingularUInt64Field(value: self.end, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: CreateZircleMessage, rhs: CreateZircleMessage) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.goal != rhs.goal {return false} + if lhs.frequency != rhs.frequency {return false} + if lhs.end != rhs.end {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension CreateZircleMessage.ContributionFrequency: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "day"), + 1: .same(proto: "week"), + 2: .same(proto: "month"), + ] +} + +extension ContributionJoin: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ContributionJoin" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "from"), + 2: .same(proto: "autoid"), + 4: .same(proto: "replyTo"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.from) + case 2: try decoder.decodeSingularStringField(value: &self.autoid) + case 4: try decoder.decodeSingularStringField(value: &self.replyTo) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.from.isEmpty { + try visitor.visitSingularStringField(value: self.from, fieldNumber: 1) + } + if !self.autoid.isEmpty { + try visitor.visitSingularStringField(value: self.autoid, fieldNumber: 2) + } + if !self.replyTo.isEmpty { + try visitor.visitSingularStringField(value: self.replyTo, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: ContributionJoin, rhs: ContributionJoin) -> Bool { + if lhs.from != rhs.from {return false} + if lhs.autoid != rhs.autoid {return false} + if lhs.replyTo != rhs.replyTo {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension PokeContributor: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PokeContributor" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "quote"), + 2: .same(proto: "name"), + 3: .same(proto: "replyTo"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.quote) + case 2: try decoder.decodeSingularStringField(value: &self.name) + case 3: try decoder.decodeSingularStringField(value: &self.replyTo) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.quote.isEmpty { + try visitor.visitSingularStringField(value: self.quote, fieldNumber: 1) + } + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 2) + } + if !self.replyTo.isEmpty { + try visitor.visitSingularStringField(value: self.replyTo, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: PokeContributor, rhs: PokeContributor) -> Bool { + if lhs.quote != rhs.quote {return false} + if lhs.name != rhs.name {return false} + if lhs.replyTo != rhs.replyTo {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Zircles/memo.proto b/Zircles/memo.proto index a2f8a57..9608124 100644 --- a/Zircles/memo.proto +++ b/Zircles/memo.proto @@ -5,9 +5,14 @@ option swift_prefix = ""; // Admin Memo protocol. Declares the creation of a Zircle in the blockchain message CreateZircleMessage { + enum ContributionFrequency { + day = 0; + week = 1; + month = 2; + } string name = 1; // name of this zircle uint64 goal = 2; // goal of the zircle in Zatoshis - uint8 frequency = 3; // 1=day, 2=week, 3=month + ContributionFrequency frequency = 3; uint64 end = 4; // timestamp timeReferenceSince1970 for end of this Zircle, 0 for end At Will } @@ -16,8 +21,7 @@ message CreateZircleMessage { message ContributionJoin { string from = 1; // nickname of the joiner / contributor string autoid = 2; // autoid of the person contributing or joining - uint8 frequency = 3; // 1=day, 2=week, 3=month - uint64 replyTo = 4; // zAddr of the joiner / contributor + string replyTo = 4; // zAddr of the joiner / contributor } message PokeContributor {