Paid relay detection

This commit is contained in:
William Casarin
2023-02-10 08:27:28 -08:00
parent fe444228e6
commit 5f1545b86a
5 changed files with 44 additions and 10 deletions

View File

@@ -24,6 +24,14 @@ enum RelayFlags: Int {
case broken = 1
}
struct Limitations: Codable {
let payment_required: Bool?
static var empty: Limitations {
Limitations(payment_required: nil)
}
}
struct RelayMetadata: Codable {
let name: String?
let description: String?
@@ -32,6 +40,11 @@ struct RelayMetadata: Codable {
let supported_nips: [Int]?
let software: String?
let version: String?
let limitation: Limitations?
var is_paid: Bool {
return limitation?.payment_required ?? false
}
}
class Relay: Identifiable {