93 lines
2.1 KiB
TypeScript
93 lines
2.1 KiB
TypeScript
import type { Event } from 'nostr-tools'
|
|
|
|
export interface NostrProfile {
|
|
pubkey: string
|
|
name?: string
|
|
about?: string
|
|
picture?: string
|
|
nip05?: string
|
|
}
|
|
|
|
export type ArticleCategory = 'science-fiction' | 'scientific-research' | 'author-presentation'
|
|
|
|
export type KindType =
|
|
| 'article'
|
|
| 'series'
|
|
| 'review'
|
|
| 'purchase'
|
|
| 'review_tip'
|
|
| 'sponsoring'
|
|
|
|
export interface MediaRef {
|
|
url: string
|
|
type: 'image' | 'video'
|
|
}
|
|
|
|
export interface Article {
|
|
id: string
|
|
pubkey: string
|
|
title: string
|
|
preview: string
|
|
content: string
|
|
createdAt: number
|
|
zapAmount: number
|
|
paid: boolean
|
|
invoice?: string // BOLT11 invoice from event tags (if author created one)
|
|
paymentHash?: string // Payment hash from event tags
|
|
category?: ArticleCategory // Category of the article
|
|
isPresentation?: boolean // True if this is an author presentation article
|
|
mainnetAddress?: string // Bitcoin mainnet address for sponsoring (presentation articles only)
|
|
totalSponsoring?: number // Total sponsoring received in sats (presentation articles only)
|
|
authorPresentationId?: string // ID of the author's presentation article (for standard articles)
|
|
seriesId?: string // Series event id
|
|
bannerUrl?: string // NIP-95 banner
|
|
media?: MediaRef[] // Embedded media (NIP-95)
|
|
kindType?: KindType
|
|
}
|
|
|
|
export interface AuthorPresentationArticle extends Article {
|
|
category: 'author-presentation'
|
|
isPresentation: true
|
|
mainnetAddress: string
|
|
totalSponsoring: number
|
|
}
|
|
|
|
export interface Series {
|
|
id: string
|
|
pubkey: string
|
|
title: string
|
|
description: string
|
|
preview: string
|
|
coverUrl?: string
|
|
category: ArticleCategory
|
|
totalSponsoring?: number
|
|
totalPayments?: number
|
|
kindType?: KindType
|
|
}
|
|
|
|
export interface Review {
|
|
id: string
|
|
articleId: string
|
|
authorPubkey: string
|
|
reviewerPubkey: string
|
|
content: string
|
|
createdAt: number
|
|
title?: string
|
|
rewarded?: boolean
|
|
rewardAmount?: number
|
|
kindType?: KindType
|
|
}
|
|
|
|
export interface ZapRequest {
|
|
event: Event
|
|
amount: number
|
|
targetPubkey: string
|
|
targetEventId?: string
|
|
}
|
|
|
|
export interface NostrConnectState {
|
|
connected: boolean
|
|
pubkey: string | null
|
|
profile: NostrProfile | null
|
|
}
|