Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
make externalId and protocl optional to pass in (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirahsapong authored Mar 25, 2024
1 parent 60de73e commit cdd6355
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Sources/tbDEX/Protocol/Models/Message.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public struct Message<D: MessageData>: Codable, Equatable {
to: String,
exchangeID: String,
data: D,
externalID: String?,
`protocol`: String?
externalID: String? = nil,
`protocol`: String? = nil
) {
let now = Date()
self.metadata = MessageMetadata(
Expand Down
2 changes: 1 addition & 1 deletion Sources/tbDEX/Protocol/Models/Messages/Close.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public struct CloseData: MessageData {

/// An explanation of why the exchange is being closed/completed
public let reason: String?

/// Returns the MessageKind of close
public func kind() -> MessageKind {
return .close
Expand Down
4 changes: 2 additions & 2 deletions Sources/tbDEX/Protocol/Models/Messages/RFQ.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ extension RFQ {
to: String,
from: String,
data: RFQData,
externalID: String?,
`protocol`: String?
externalID: String? = nil,
`protocol`: String? = nil
) {
let id = TypeID(prefix: data.kind().rawValue)!
self.metadata = MessageMetadata(
Expand Down
5 changes: 1 addition & 4 deletions Tests/tbDEXTests/Protocol/Models/Messages/CloseTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ final class CloseTests: XCTestCase {
data: .init(
reason: "test reason"
),
externalID: nil,
protocol: "2.0"
)

Expand Down Expand Up @@ -66,9 +65,7 @@ final class CloseTests: XCTestCase {
exchangeID: "exchange_123",
data: .init(
reason: "test reason"
),
externalID: nil,
protocol: nil
)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ final class OrderStatusTests: XCTestCase {
data: .init(
orderStatus: "test status"
),
externalID: nil,
protocol: "2.0"
)

Expand Down Expand Up @@ -65,9 +64,7 @@ final class OrderStatusTests: XCTestCase {
exchangeID: "exchange_123",
data: .init(
orderStatus: "test status"
),
externalID: nil,
protocol: nil
)
)
}
}
5 changes: 1 addition & 4 deletions Tests/tbDEXTests/Protocol/Models/Messages/OrderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ final class OrderTests: XCTestCase {
to: pfi.uri,
exchangeID: "exchange_123",
data: .init(),
externalID: nil,
protocol: "2.0"
)

Expand Down Expand Up @@ -60,9 +59,7 @@ final class OrderTests: XCTestCase {
from: from,
to: to,
exchangeID: "exchange_123",
data: .init(),
externalID: nil,
protocol: nil
data: .init()
)
}
}
5 changes: 1 addition & 4 deletions Tests/tbDEXTests/Protocol/Models/Messages/QuoteTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ final class QuoteTests: XCTestCase {
fee: "0.50"
)
),
externalID: nil,
protocol: "2.0"
)

Expand Down Expand Up @@ -102,9 +101,7 @@ final class QuoteTests: XCTestCase {
amount: "2.00",
fee: "0.50"
)
),
externalID: nil,
protocol: nil
)
)
}
}
5 changes: 1 addition & 4 deletions Tests/tbDEXTests/Protocol/Models/Messages/RFQTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ final class RFQTests: XCTestCase {
),
claims: []
),
externalID: nil,
protocol: "2.0"
)

Expand Down Expand Up @@ -82,9 +81,7 @@ final class RFQTests: XCTestCase {
kind: "BITCOIN_ADDRESS"
),
claims: []
),
externalID: nil,
protocol: nil
)
)
}
}

0 comments on commit cdd6355

Please sign in to comment.