From 6cc26c9a0f9ced103de8c4f503bad7982d007229 Mon Sep 17 00:00:00 2001 From: Kirah Sapong Date: Mon, 25 Mar 2024 16:58:05 -0700 Subject: [PATCH] add optional readonly close success field --- Sources/tbDEX/Protocol/Models/Messages/Close.swift | 3 +++ Tests/tbDEXTests/Protocol/Models/Messages/CloseTests.swift | 1 + 2 files changed, 4 insertions(+) diff --git a/Sources/tbDEX/Protocol/Models/Messages/Close.swift b/Sources/tbDEX/Protocol/Models/Messages/Close.swift index d6c7cc4..eb59eca 100644 --- a/Sources/tbDEX/Protocol/Models/Messages/Close.swift +++ b/Sources/tbDEX/Protocol/Models/Messages/Close.swift @@ -10,6 +10,9 @@ public struct CloseData: MessageData { /// An explanation of why the exchange is being closed/completed public let reason: String? + /// Indicates whether or not the exchange successfully completed + public private(set) var success: Bool? + /// Returns the MessageKind of close public func kind() -> MessageKind { return .close diff --git a/Tests/tbDEXTests/Protocol/Models/Messages/CloseTests.swift b/Tests/tbDEXTests/Protocol/Models/Messages/CloseTests.swift index d044654..1acaabe 100644 --- a/Tests/tbDEXTests/Protocol/Models/Messages/CloseTests.swift +++ b/Tests/tbDEXTests/Protocol/Models/Messages/CloseTests.swift @@ -17,6 +17,7 @@ final class CloseTests: XCTestCase { XCTAssertEqual(close.metadata.exchangeID, "exchange_123") XCTAssertEqual(close.data.reason, "test reason") XCTAssertEqual(close.metadata.protocol, "1.0") + XCTAssertEqual(close.data.success, nil) } func test_overrideProtocolVersion() {