- **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.
40 lines
937 B
TypeScript
40 lines
937 B
TypeScript
export interface AlbyInvoice {
|
|
invoice: string // Lightning invoice (bolt11)
|
|
paymentHash: string
|
|
amount: number // Amount in satoshis
|
|
expiresAt: number // Unix timestamp
|
|
}
|
|
|
|
export interface AlbyPaymentStatus {
|
|
paid: boolean
|
|
paymentHash?: string
|
|
amount?: number
|
|
confirmedAt?: number
|
|
}
|
|
|
|
export interface AlbyInvoiceRequest {
|
|
amount: number // Amount in satoshis
|
|
description?: string
|
|
expiry?: number // Expiry in seconds (default 3600)
|
|
}
|
|
|
|
/**
|
|
* WebLN provider interface (WebLN standard)
|
|
* Used by Alby and other Lightning wallet extensions
|
|
*/
|
|
export interface WebLNProvider {
|
|
enabled: boolean
|
|
enable(): Promise<void>
|
|
makeInvoice(request: { amount: number; defaultMemo?: string }): Promise<{ paymentRequest: string }>
|
|
sendPayment(invoice: string): Promise<{ preimage: string }>
|
|
}
|
|
|
|
/**
|
|
* Extended Window interface with WebLN provider
|
|
*/
|
|
declare global {
|
|
interface Window {
|
|
webln?: WebLNProvider
|
|
}
|
|
}
|