@@ -10,6 +10,7 @@ import Foundation
|
||||
enum NostrResponse: Decodable {
|
||||
case event(String, NostrEvent)
|
||||
case notice(String)
|
||||
case eose
|
||||
|
||||
init(from decoder: Decoder) throws {
|
||||
var container = try decoder.unkeyedContainer()
|
||||
@@ -32,6 +33,9 @@ enum NostrResponse: Decodable {
|
||||
let msg = try container.decode(String.self)
|
||||
self = .notice(msg)
|
||||
return
|
||||
} else if typ == "EOSE" {
|
||||
self = .eose
|
||||
return
|
||||
}
|
||||
|
||||
throw DecodingError.dataCorrupted(.init(codingPath: [], debugDescription: "expected EVENT or NOTICE, got \(typ)"))
|
||||
|
||||
Reference in New Issue
Block a user