This commit is contained in:
2023-05-17 10:17:26 +01:00
parent 3a8125f0bb
commit 154098b5dc
5 changed files with 79 additions and 1 deletions

View File

@ -1,6 +1,9 @@
import { UserCache } from "Cache";
import { getDisplayName } from "Element/ProfileImage";
import ExternalStore from "ExternalStore";
import { LNURL } from "LNURL";
import { Toastore } from "Toaster";
import { unixNow } from "Util";
import { LNWallet, WalletInvoiceState } from "Wallet";
export enum ZapPoolRecipientType {
@ -46,6 +49,14 @@ class ZapPool extends ExternalStore<Array<ZapPoolRecipient>> {
const result = await wallet.payInvoice(invoice.pr);
if (result.state === WalletInvoiceState.Paid) {
x.sum -= amtSend;
Toastore.push({
element: `Sent ${amtSend.toLocaleString()} sats to ${getDisplayName(
profile,
x.pubkey
)} from your zap pool`,
expire: unixNow() + 10,
icon: "zap",
});
} else {
throw new Error("Payment failed");
}