From 708cc0c640c2b91f73fc4990f4f9fb88ca567961 Mon Sep 17 00:00:00 2001 From: Brandon McAnsh Date: Wed, 30 Sep 2026 13:43:26 -0400 Subject: [PATCH 1/2] chore(contract): sync flipcash2 protos to d082b0a3 --- .../ContractInfo.swift | 4 +- .../chat_v1_model.pb.swift | 59 ++++++++++++++++++- flipcash2.lock | 4 +- proto/chat/v1/model.proto | 6 ++ 4 files changed, 68 insertions(+), 5 deletions(-) diff --git a/Sources/Flipcash2ClientProtocol/ContractInfo.swift b/Sources/Flipcash2ClientProtocol/ContractInfo.swift index 19356f9..d01e2ed 100644 --- a/Sources/Flipcash2ClientProtocol/ContractInfo.swift +++ b/Sources/Flipcash2ClientProtocol/ContractInfo.swift @@ -1,8 +1,8 @@ // Generated by scripts/generate-swift.sh. Do not edit. public enum Flipcash2ContractInfo { - public static let version = "0.13.0-dev" - public static let protoCommit = "df1cb04e71fef7ce77a6a537e0a106fde6452a8f" + public static let version = "0.14.0-dev" + public static let protoCommit = "d082b0a3dd268f884f75402ccd355b6548612221" public static var isLocal: Bool { protoCommit == localSentinel } diff --git a/Sources/Flipcash2ClientProtocol/chat_v1_model.pb.swift b/Sources/Flipcash2ClientProtocol/chat_v1_model.pb.swift index 3fc861d..93c4029 100644 --- a/Sources/Flipcash2ClientProtocol/chat_v1_model.pb.swift +++ b/Sources/Flipcash2ClientProtocol/chat_v1_model.pb.swift @@ -312,12 +312,21 @@ public struct Flipcash_Chat_V1_SpeakerRules: Sendable { set {kind = .never(newValue)} } + public var creator: Flipcash_Chat_V1_CreatorRequirement { + get { + if case .creator(let v)? = kind {return v} + return Flipcash_Chat_V1_CreatorRequirement() + } + set {kind = .creator(newValue)} + } + public var unknownFields = SwiftProtobuf.UnknownStorage() public enum OneOf_Kind: Equatable, Sendable { case minimumBalance(Flipcash_Chat_V1_MinimumBalanceRequirement) case staff(Flipcash_Chat_V1_StaffRequirement) case never(Flipcash_Chat_V1_Never) + case creator(Flipcash_Chat_V1_CreatorRequirement) } @@ -347,6 +356,18 @@ public struct Flipcash_Chat_V1_Never: Sendable { public init() {} } +/// CreatorRequirement requires the user to be the chat's creator, as indicated +/// by Metadata.creator. +public struct Flipcash_Chat_V1_CreatorRequirement: Sendable { + // 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. + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + /// MinimumBalanceRequirement requires a user to hold a minimum balance, /// denominated in fiat, in an acceptable mint. public struct Flipcash_Chat_V1_MinimumBalanceRequirement: Sendable { @@ -1235,7 +1256,7 @@ extension Flipcash_Chat_V1_ListenerRules: SwiftProtobuf.Message, SwiftProtobuf._ extension Flipcash_Chat_V1_SpeakerRules: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".SpeakerRules" - public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}minimum_balance\0\u{1}staff\0\u{1}never\0") + public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}minimum_balance\0\u{1}staff\0\u{1}never\0\u{1}creator\0") public mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { @@ -1282,6 +1303,19 @@ extension Flipcash_Chat_V1_SpeakerRules: SwiftProtobuf.Message, SwiftProtobuf._M self.kind = .never(v) } }() + case 4: try { + var v: Flipcash_Chat_V1_CreatorRequirement? + var hadOneofValue = false + if let current = self.kind { + hadOneofValue = true + if case .creator(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.kind = .creator(v) + } + }() default: break } } @@ -1305,6 +1339,10 @@ extension Flipcash_Chat_V1_SpeakerRules: SwiftProtobuf.Message, SwiftProtobuf._M guard case .never(let v)? = self.kind else { preconditionFailure() } try visitor.visitSingularMessageField(value: v, fieldNumber: 3) }() + case .creator?: try { + guard case .creator(let v)? = self.kind else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + }() case nil: break } try unknownFields.traverse(visitor: &visitor) @@ -1355,6 +1393,25 @@ extension Flipcash_Chat_V1_Never: SwiftProtobuf.Message, SwiftProtobuf._MessageI } } +extension Flipcash_Chat_V1_CreatorRequirement: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".CreatorRequirement" + public static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + public mutating func decodeMessage(decoder: inout D) throws { + // Load everything into unknown fields + while try decoder.nextFieldNumber() != nil {} + } + + public func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Flipcash_Chat_V1_CreatorRequirement, rhs: Flipcash_Chat_V1_CreatorRequirement) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + extension Flipcash_Chat_V1_MinimumBalanceRequirement: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".MinimumBalanceRequirement" public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}amount\0\u{1}mints\0") diff --git a/flipcash2.lock b/flipcash2.lock index 3dd4a70..36b447d 100644 --- a/flipcash2.lock +++ b/flipcash2.lock @@ -1,4 +1,4 @@ # Pinned upstream contract. Regenerate with scripts/sync-protos.sh . upstream: code-payments/flipcash2-protobuf-api -commit: df1cb04e71fef7ce77a6a537e0a106fde6452a8f -subject: Add is_username_auto_assigned to UserProfile (#128) +commit: d082b0a3dd268f884f75402ccd355b6548612221 +subject: Add a creator requirement for speaker rules (#129) diff --git a/proto/chat/v1/model.proto b/proto/chat/v1/model.proto index 0d1f840..8e07f51 100644 --- a/proto/chat/v1/model.proto +++ b/proto/chat/v1/model.proto @@ -139,6 +139,7 @@ message SpeakerRules { MinimumBalanceRequirement minimum_balance = 1; StaffRequirement staff = 2; Never never = 3; + CreatorRequirement creator = 4; } } @@ -151,6 +152,11 @@ message StaffRequirement { message Never { } +// CreatorRequirement requires the user to be the chat's creator, as indicated +// by Metadata.creator. +message CreatorRequirement { +} + // MinimumBalanceRequirement requires a user to hold a minimum balance, // denominated in fiat, in an acceptable mint. message MinimumBalanceRequirement { From 85800bd19095c64c215c53f0f54d4c2e1b2df762 Mon Sep 17 00:00:00 2001 From: Brandon McAnsh Date: Wed, 30 Sep 2026 13:43:46 -0400 Subject: [PATCH 2/2] docs(changelog): add the 0.14.1 entry --- CHANGELOG.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index be0c9bd..2cd868b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,24 @@ called out explicitly even when nothing else did. release notes, so a version with no entry here does not release. Write the entry in the same PR that syncs the contract, while the diff is still in front of you. +## 0.14.1 + +Synced to [`flipcash2-protobuf-api@d082b0a3`](https://github.com/code-payments/flipcash2-protobuf-api/commit/d082b0a3dd268f884f75402ccd355b6548612221), +picking up [#129](https://github.com/code-payments/flipcash2-protobuf-api/pull/129). Only `chat.v1` +moved. + +### Added + +- `chat.v1.CreatorRequirement`, a new empty message and a new `SpeakerRules` rule case + (`creator = 4`): only the chat's creator, as given by `Metadata.creator`, may speak. + +### Upgrading + +Nothing existing changed: no renames, and no field or enum renumbering. A client that switches +exhaustively over the `SpeakerRules` rule needs a case for `creator`. Until it has one, a chat with +this rule reaches that client as an unset or unknown rule, so decide what an unrecognized speaker +rule does before the server starts sending it. + ## 0.14.0 Synced to [`flipcash2-protobuf-api@df1cb04e`](https://github.com/code-payments/flipcash2-protobuf-api/commit/df1cb04e71fef7ce77a6a537e0a106fde6452a8f),