diff --git a/src/controllers/NostrController.ts b/src/controllers/NostrController.ts index 1b80595..049f99a 100644 --- a/src/controllers/NostrController.ts +++ b/src/controllers/NostrController.ts @@ -31,7 +31,7 @@ import { SignedEvent, RelayMap, RelayStats, - ReadRelay, + RelayReadStats, RelayInfoObject, RelayConnectionStatus, RelayConnectionState @@ -548,7 +548,7 @@ export class NostrController extends EventEmitter { const apiTopRelays = data.relay_stats.user_picks.read_relays .slice(0, numberOfTopRelays) - .map((relay: ReadRelay) => relay.d) + .map((relay: RelayReadStats) => relay.d) if (!apiTopRelays.length) { return Promise.reject(`Couldn't fetch popular relays.`) diff --git a/src/types/relay.ts b/src/types/relay.ts index ee426f2..dd41095 100644 --- a/src/types/relay.ts +++ b/src/types/relay.ts @@ -19,21 +19,21 @@ export interface RelayStats { posts: number zaps: number zap_amount: number - daily: Daily - daily_totals: DailyTotals + daily: RelayDailyStats + daily_totals: RelayDailyTotals relay_stats: RelayStats } export interface RelayStats { - user_picks: UserPicks - written: Written + user_picks: RelayUserPicksStats + written: RelayWrittenStats } -export interface Written { - last_week: LastWeek[] +export interface RelayWrittenStats { + last_week: RelayLastWeekStats[] } -export interface LastWeek { +export interface RelayLastWeekStats { d: string p: number ps: number @@ -41,12 +41,12 @@ export interface LastWeek { es: number } -export interface UserPicks { - read_relays: ReadRelay[] - write_relays: ReadRelay[] +export interface RelayUserPicksStats { + read_relays: RelayReadStats[] + write_relays: RelayReadStats[] } -export interface ReadRelay { +export interface RelayReadStats { d: string r: number w: number @@ -54,100 +54,100 @@ export interface ReadRelay { ws: number } -export interface DailyTotals { - datasets: Datasets2 +export interface RelayDailyTotals { + datasets: RelayDailyTotalStatsDataset } -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 RelayDailyTotalStatsDataset { + kind_0: RelayItemStats[] + kind_1: RelayItemStats[] + kind_2: RelayItemStats[] + kind_3: RelayItemStats[] + kind_5: RelayItemStats[] + kind_6: RelayItemStats[] + kind_7: RelayItemStats[] + kind_1984: RelayItemStats[] + kind_9735: RelayItemStats[] + kind_1063: RelayItemStats[] + kind_6969: RelayItemStats[] + kind_9802: RelayItemStats[] + kind_30000: RelayItemStats[] + kind_30001: RelayItemStats[] + kind_30008: RelayItemStats[] + kind_30009: RelayItemStats[] + kind_30017: RelayItemStats[] + kind_30018: RelayItemStats[] + kind_30023: RelayItemStats[] + kind_31337: RelayItemStats[] + totals: RelayItemStats[] + new_profiles: RelayItemStats[] + new_pubkeys: RelayItemStats[] + new_contact_lists: RelayItemStats[] + new_ln: RelayItemStats[] + new_users: RelayItemStats[] + total_zap_amount: RelayItemStats[] + zappers: RelayItemStats[] + zapped_pubkeys: RelayItemStats[] + zapped_events: RelayItemStats[] + zap_providers: RelayItemStats[] } -export interface Daily { - datasets: Datasets +export interface RelayDailyStats { + datasets: RelayDailyStatsDataset } -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 RelayDailyStatsDataset { + kind_0: RelayItemStats[] + kind_1: RelayItemStats[] + kind_2: RelayItemStats[] + kind_3: RelayItemStats[] + kind_5: RelayItemStats[] + kind_6: RelayItemStats[] + kind_7: RelayItemStats[] + kind_1984: RelayItemStats[] + kind_9735: RelayItemStats[] + kind_1063: RelayItemStats[] + kind_6969: RelayItemStats[] + kind_9802: RelayItemStats[] + kind_30000: RelayItemStats[] + kind_30001: RelayItemStats[] + kind_30008: RelayItemStats[] + kind_30009: RelayItemStats[] + kind_30017: RelayItemStats[] + kind_30018: RelayItemStats[] + kind_30023: RelayItemStats[] + kind_31337: RelayItemStats[] + totals: RelayItemStats[] + new_profiles: RelayItemStats[] + new_pubkeys: RelayItemStats[] + new_contact_lists: RelayItemStats[] + new_ln: RelayItemStats[] + new_users: RelayItemStats[] + max_zap_amount: RelayItemStats[] + avg_zap_amount: RelayItemStats[] + total_zap_amount: RelayItemStats[] + active_pubkeys: RelayItemStats[] + active_pubkeys_total: RelayItemStats[] + active_pubkeys_week: RelayItemStats[] + active_pubkeys_total_week: RelayItemStats[] + active_relays: RelayItemStats[] + zappers: RelayItemStats[] + zapped_pubkeys: RelayItemStats[] + zapped_events: RelayItemStats[] + zap_providers: RelayItemStats[] + retention: RelayRetentionStats } -export interface Retention { - all: All[] - tr: All[] - bio: All[] - all_curves: Allcurve[] - tr_curves: Allcurve[] - bio_curves: Allcurve[] +export interface RelayRetentionStats { + all: RelayRetentionAll[] + tr: RelayRetentionAll[] + bio: RelayRetentionAll[] + all_curves: RelayRetentionAllCurve[] + tr_curves: RelayRetentionAllCurve[] + bio_curves: RelayRetentionAllCurve[] } -export interface Allcurve { +export interface RelayRetentionAllCurve { day: number '2023-02': number '2023-03': number @@ -157,7 +157,7 @@ export interface Allcurve { '2023-07': number } -export interface All { +export interface RelayRetentionAll { d: string signups: number retained: number @@ -191,9 +191,9 @@ export interface All { lost_followers: number } -export interface Kind0 { - d: string - c: number +export interface RelayItemStats { + d: string // date + c: number // count } export interface RelayFee {