UNPKG

@getalby/lightning-tools

Version:

Collection of helpful building blocks and tools to develop Bitcoin Lightning web apps

47 lines (43 loc) 1.19 kB
type InvoiceArgs = { pr: string; verify?: string; preimage?: string; successAction?: SuccessAction; }; type SuccessAction = { tag: "message"; message: string; } | { tag: "url"; description: string; url: string; }; declare const fromHexString: (hexString: string) => Uint8Array<ArrayBuffer>; type DecodedInvoice = { paymentHash: string; satoshi: number; timestamp: number; expiry: number | undefined; description: string | undefined; }; declare const decodeInvoice: (paymentRequest: string) => DecodedInvoice | null; declare class Invoice { paymentRequest: string; paymentHash: string; preimage: string | null; verify: string | null; satoshi: number; expiry: number | undefined; timestamp: number; createdDate: Date; expiryDate: Date | undefined; description: string | null; successAction: SuccessAction | null; constructor(args: InvoiceArgs); isPaid(): Promise<boolean>; validatePreimage(preimage: string): boolean; verifyPayment(): Promise<boolean>; hasExpired(): boolean; } export { Invoice, decodeInvoice, fromHexString }; export type { InvoiceArgs, SuccessAction };