feat(Relays): added logic to manage relays #63
@ -2,3 +2,4 @@ export * from './core'
|
||||
export * from './nostr'
|
||||
export * from './profile'
|
||||
export * from './zip'
|
||||
export * from './relay'
|
||||
|
@ -8,19 +8,7 @@ export interface SignedEvent {
|
||||
sig: string
|
||||
}
|
||||
|
||||
export interface RelaySet {
|
||||
read: string[]
|
||||
write: string[]
|
||||
}
|
||||
|
||||
export interface NostrJoiningBlock {
|
||||
block: number
|
||||
encodedEventPointer: string
|
||||
}
|
||||
|
||||
export type RelayMap = {
|
||||
[key: string]: {
|
||||
read: boolean
|
||||
write: boolean
|
||||
}
|
||||
}
|
||||
|
232
src/types/relay.ts
Normal file
232
src/types/relay.ts
Normal file
@ -0,0 +1,232 @@
|
||||
export interface RelaySet {
|
||||
read: string[]
|
||||
write: string[]
|
||||
}
|
||||
|
||||
export type RelayMap = {
|
||||
[key: string]: {
|
||||
read: boolean
|
||||
write: boolean
|
||||
}
|
||||
}
|
||||
|
||||
export interface RelayStats {
|
||||
relays: number
|
||||
pubKeys: number
|
||||
users: number
|
||||
trusted_users: number
|
||||
events: number
|
||||
posts: number
|
||||
zaps: number
|
||||
zap_amount: number
|
||||
daily: Daily
|
||||
daily_totals: DailyTotals
|
||||
relay_stats: RelayStats
|
||||
}
|
||||
|
||||
export interface RelayStats {
|
||||
user_picks: UserPicks
|
||||
written: Written
|
||||
}
|
||||
|
||||
export interface Written {
|
||||
last_week: LastWeek[]
|
||||
}
|
||||
|
||||
export interface LastWeek {
|
||||
d: string
|
||||
p: number
|
||||
ps: number
|
||||
e: number
|
||||
es: number
|
||||
}
|
||||
|
||||
export interface UserPicks {
|
||||
read_relays: ReadRelay[]
|
||||
write_relays: ReadRelay[]
|
||||
}
|
||||
|
||||
export interface ReadRelay {
|
||||
d: string
|
||||
r: number
|
||||
w: number
|
||||
rs: number
|
||||
ws: number
|
||||
}
|
||||
|
||||
export interface DailyTotals {
|
||||
datasets: Datasets2
|
||||
}
|
||||
|
||||
export interface Datasets2 {
|
||||
kind_0: Kind0[]
|
||||
kind_1: Kind0[]
|
||||
kind_2: Kind0[]
|
||||
kind_3: Kind0[]
|
||||
kind_5: Kind0[]
|
||||
kind_6: Kind0[]
|
||||
kind_7: Kind0[]
|
||||
kind_1984: Kind0[]
|
||||
kind_9735: Kind0[]
|
||||
kind_1063: Kind0[]
|
||||
kind_6969: Kind0[]
|
||||
kind_9802: Kind0[]
|
||||
kind_30000: Kind0[]
|
||||
kind_30001: Kind0[]
|
||||
kind_30008: Kind0[]
|
||||
kind_30009: Kind0[]
|
||||
kind_30017: Kind0[]
|
||||
kind_30018: Kind0[]
|
||||
kind_30023: Kind0[]
|
||||
kind_31337: Kind0[]
|
||||
totals: Kind0[]
|
||||
new_profiles: Kind0[]
|
||||
new_pubkeys: Kind0[]
|
||||
new_contact_lists: Kind0[]
|
||||
new_ln: Kind0[]
|
||||
new_users: Kind0[]
|
||||
total_zap_amount: Kind0[]
|
||||
zappers: Kind0[]
|
||||
zapped_pubkeys: Kind0[]
|
||||
zapped_events: Kind0[]
|
||||
zap_providers: Kind0[]
|
||||
}
|
||||
|
||||
export interface Daily {
|
||||
datasets: Datasets
|
||||
}
|
||||
|
||||
export interface Datasets {
|
||||
kind_0: Kind0[]
|
||||
kind_1: Kind0[]
|
||||
kind_2: Kind0[]
|
||||
kind_3: Kind0[]
|
||||
kind_5: Kind0[]
|
||||
kind_6: Kind0[]
|
||||
kind_7: Kind0[]
|
||||
kind_1984: Kind0[]
|
||||
kind_9735: Kind0[]
|
||||
kind_1063: Kind0[]
|
||||
kind_6969: Kind0[]
|
||||
kind_9802: Kind0[]
|
||||
kind_30000: Kind0[]
|
||||
kind_30001: Kind0[]
|
||||
kind_30008: Kind0[]
|
||||
kind_30009: Kind0[]
|
||||
kind_30017: Kind0[]
|
||||
kind_30018: Kind0[]
|
||||
kind_30023: Kind0[]
|
||||
kind_31337: Kind0[]
|
||||
totals: Kind0[]
|
||||
new_profiles: Kind0[]
|
||||
new_pubkeys: Kind0[]
|
||||
new_contact_lists: Kind0[]
|
||||
new_ln: Kind0[]
|
||||
new_users: Kind0[]
|
||||
max_zap_amount: Kind0[]
|
||||
avg_zap_amount: Kind0[]
|
||||
total_zap_amount: Kind0[]
|
||||
active_pubkeys: Kind0[]
|
||||
active_pubkeys_total: Kind0[]
|
||||
active_pubkeys_week: Kind0[]
|
||||
active_pubkeys_total_week: Kind0[]
|
||||
active_relays: Kind0[]
|
||||
zappers: Kind0[]
|
||||
zapped_pubkeys: Kind0[]
|
||||
zapped_events: Kind0[]
|
||||
zap_providers: Kind0[]
|
||||
retention: Retention
|
||||
}
|
||||
|
||||
export interface Retention {
|
||||
all: All[]
|
||||
tr: All[]
|
||||
bio: All[]
|
||||
all_curves: Allcurve[]
|
||||
tr_curves: Allcurve[]
|
||||
bio_curves: Allcurve[]
|
||||
}
|
||||
|
||||
export interface Allcurve {
|
||||
day: number
|
||||
'2023-02': number
|
||||
'2023-03': number
|
||||
'2023-04': number
|
||||
'2023-05': number
|
||||
'2023-06': number
|
||||
'2023-07': number
|
||||
}
|
||||
|
||||
export interface All {
|
||||
d: string
|
||||
signups: number
|
||||
retained: number
|
||||
retd_posts: number
|
||||
retd_replies: number
|
||||
retd_reposts: number
|
||||
retd_likes: number
|
||||
retd_liked: number
|
||||
retd_liked_pubkeys: number
|
||||
retd_replied: number
|
||||
retd_replied_pubkeys: number
|
||||
retd_zaps_received: number
|
||||
retd_zaps_received_msats: number
|
||||
retd_zaps_sent: number
|
||||
retd_zaps_sent_msats: number
|
||||
retd_following: number
|
||||
retd_followers: number
|
||||
lost_posts: number
|
||||
lost_replies: number
|
||||
lost_reposts: number
|
||||
lost_likes: number
|
||||
lost_liked: number
|
||||
lost_liked_pubkeys: number
|
||||
lost_replied: number
|
||||
lost_replied_pubkeys: number
|
||||
lost_zaps_received: number
|
||||
lost_zaps_received_msats: number
|
||||
lost_zaps_sent: number
|
||||
lost_zaps_sent_msats: number
|
||||
lost_following: number
|
||||
lost_followers: number
|
||||
}
|
||||
|
||||
export interface Kind0 {
|
||||
d: string
|
||||
c: number
|
||||
}
|
||||
|
||||
export interface RelayFee {
|
||||
amount: number
|
||||
unit: string
|
||||
}
|
||||
|
||||
export interface RelayInfo {
|
||||
name: string
|
||||
description: string
|
||||
pubkey: string
|
||||
contact: string
|
||||
supported_nips: number[]
|
||||
software: string
|
||||
version: string
|
||||
limitation?: { [key: string]: number | boolean }
|
||||
fees?: { [key: string]: RelayFee[] }
|
||||
}
|
||||
|
||||
export interface RelayInfoObject {
|
||||
[key: string]: RelayInfo
|
||||
}
|
||||
|
||||
export interface RelayInfoItem {
|
||||
uri: string
|
||||
info: RelayInfo
|
||||
}
|
||||
|
||||
export enum RelayConnectionState {
|
||||
Connected = 'Connected',
|
||||
NotConnected = 'Failed to connect'
|
||||
}
|
||||
|
||||
export interface RelayConnectionStatus {
|
||||
[key: string]: RelayConnectionState
|
||||
}
|
Loading…
Reference in New Issue
Block a user