PortalBTCLib/paymentStatus.ts
2025-07-09 12:45:59 +02:00

30 lines
802 B
TypeScript

import type { Proof } from "@cashu/cashu-ts";
export enum PaymentStatus {
ParsingDestination = 0,
AttemptingCashuPayment = 1,
AttemptingLightningPayment = 2,
CashuPaymentFailed = 3,
AmountRequired = 4,
PreparingOnchainPayment = 5,
BroadcastingOnchainPayment = 6,
PaymentFailed = 0xfe,
PaymentSent = 0xff,
}
export interface CashuTxn {
txId: string;
paymentType: "receive" | "send";
amountSat: number;
timestamp: number;
status: "complete";
}
export interface CashuStore {
getProofs(): Promise<Proof[]>;
getTxns(): Promise<CashuTxn[]>;
getLastRedeemedCashuQuoteTimestamp(): Promise<number>;
persistProofs(proofs: Proof[]): Promise<void>;
persistTxns(txns: CashuTxn[]): Promise<void>;
persistLastRedeemedCashuQuoteTimestamp(timestamp: number): Promise<void>;
}