- **Motivations :** Assurer passage du lint strict et clarifier la logique paiements/publications. - **Root causes :** Fonctions trop longues, promesses non gérées et typages WebLN/Nostr incomplets. - **Correctifs :** Refactor PaymentModal (handlers void), extraction helpers articlePublisher, simplification polling sponsoring/zap, corrections curly et awaits. - **Evolutions :** Nouveau module articlePublisherHelpers pour présentation/aiguillage contenu privé. - **Page affectées :** components/PaymentModal.tsx, lib/articlePublisher.ts, lib/articlePublisherHelpers.ts, lib/paymentPolling.ts, lib/sponsoring.ts, lib/nostrZapVerification.ts et dépendances liées.
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import { Event, EventTemplate } 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 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)
|
|
}
|
|
|
|
export interface AuthorPresentationArticle extends Article {
|
|
category: 'author-presentation'
|
|
isPresentation: true
|
|
mainnetAddress: string
|
|
totalSponsoring: number
|
|
}
|
|
|
|
export interface ZapRequest {
|
|
event: Event
|
|
amount: number
|
|
targetPubkey: string
|
|
targetEventId?: string
|
|
}
|
|
|
|
export interface NostrConnectState {
|
|
connected: boolean
|
|
pubkey: string | null
|
|
profile: NostrProfile | null
|
|
}
|