- **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.
22 lines
704 B
TypeScript
22 lines
704 B
TypeScript
import type { Event, Filter } from 'nostr-tools'
|
|
import { SimplePool } from 'nostr-tools'
|
|
|
|
/**
|
|
* Extended SimplePool interface that includes the sub method
|
|
* The sub method exists in nostr-tools but is not properly typed in the TypeScript definitions
|
|
*/
|
|
export interface SimplePoolWithSub extends SimplePool {
|
|
sub(relays: string[], filters: Filter[]): {
|
|
on(event: 'event', callback: (event: Event) => void): void
|
|
on(event: 'eose', callback: () => void): void
|
|
unsub(): void
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Type guard to check if a SimplePool has the sub method
|
|
*/
|
|
export function hasSubMethod(pool: SimplePool): pool is SimplePoolWithSub {
|
|
return typeof (pool as SimplePoolWithSub).sub === 'function'
|
|
}
|