new account fixes

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-06-08 13:49:04 -07:00
parent 23bb7c7f18
commit 6bca9eb2be
9 changed files with 45 additions and 12 deletions

View File

@@ -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)"))