Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure continuations are called only once in Relay code #3

Merged
merged 4 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
some fixed for pull request
  • Loading branch information
ismyhc committed Nov 2, 2022
commit 2440f95924923675bd5cb22e0d704edc9c30d4e8
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ NostrKit can be used to publish events on a Nostr relay as well as request event

``` swift
let keyPair = try KeyPair(privateKey: "<hex>")
let relay = Relay(url: URL("<url>")!,
onEvent: { print($0) },
onDisconnect: { error in
// Handle reconnecting here if needed
})
let relay = Relay(url: URL("<url>")!, onEvent: { print($0) })

let subscription = Subscription(filters: [
.init(authors: [keyPair.publicKey])
Expand Down
2 changes: 1 addition & 1 deletion Sources/NostrKit/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public enum EventError: Error {
case signingFailed
}

public enum EventKind: Codable {
public enum EventKind: Codable, Equatable {
case setMetadata
case textNote
case recommentServer
Expand Down
14 changes: 7 additions & 7 deletions Sources/NostrKit/EventFilter.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Foundation

public struct EventFilter: Encodable {
let ids: [EventId]?
let authors: [String]?
let eventKinds: [EventKind]?
let tags: [String: [String]]?
let since: Timestamp?
let until: Timestamp?
let limit: Int?
public let ids: [EventId]?
public let authors: [String]?
public let eventKinds: [EventKind]?
public let tags: [String: [String]]?
public let since: Timestamp?
public let until: Timestamp?
public let limit: Int?

private enum CodingKeys: String, CodingKey {
case ids
Expand Down
2 changes: 1 addition & 1 deletion Sources/NostrKit/Relay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public struct Relay {
continuation.resume(throwing: RelayError.writeError(error))
}
} else {
ismyhc marked this conversation as resolved.
Show resolved Hide resolved
continuation.resume()
continuation.resume(throwing: RelayError.socketError(nil))
}
}
}
Expand Down