refactor: reactions grouping and other fixes

This commit is contained in:
2024-01-09 16:40:31 +00:00
parent 4455651d47
commit 80fa5a132b
58 changed files with 344 additions and 501 deletions

View File

@ -1,4 +1,5 @@
import { ExternalStore, LNURL, unixNow } from "@snort/shared";
import debug from "debug";
import { UserCache } from "@/Cache";
import { Toastore } from "@/Components/Toaster/Toaster";
@ -21,6 +22,7 @@ export interface ZapPoolRecipient {
}
class ZapPool extends ExternalStore<Array<ZapPoolRecipient>> {
#log = debug("ZapPool");
#store = new Map<string, ZapPoolRecipient>();
#isPayoutInProgress = false;
#lastPayout = 0;
@ -50,7 +52,7 @@ class ZapPool extends ExternalStore<Array<ZapPoolRecipient>> {
const invoice = await svc.getInvoice(amtSend, `SnortZapPool: ${x.split}%`);
if (invoice.pr) {
const result = await wallet.payInvoice(invoice.pr);
console.debug("ZPC", invoice, result);
this.#log("%o %o", invoice, result);
if (result.state === WalletInvoiceState.Paid) {
x.sum -= amtSend;
Toastore.push({