feat: track zappool payout activity

This commit is contained in:
2023-12-10 17:35:18 +00:00
parent 91709c88be
commit d2cec4909c
2 changed files with 7 additions and 11 deletions

View File

@ -8,7 +8,7 @@ import { SnortPubKey } from "@/Const";
import ProfilePreview from "@/Element/User/ProfilePreview"; import ProfilePreview from "@/Element/User/ProfilePreview";
import useLogin from "@/Hooks/useLogin"; import useLogin from "@/Hooks/useLogin";
import { UploaderServices } from "@/Upload"; import { UploaderServices } from "@/Upload";
import { bech32ToHex, getRelayName, unwrap } from "@/SnortUtils"; import { bech32ToHex, getRelayName, trackEvent, unwrap } from "@/SnortUtils";
import { ZapPoolController, ZapPoolRecipient, ZapPoolRecipientType } from "@/ZapPoolController"; import { ZapPoolController, ZapPoolRecipient, ZapPoolRecipientType } from "@/ZapPoolController";
import AsyncButton from "@/Element/Button/AsyncButton"; import AsyncButton from "@/Element/Button/AsyncButton";
import { useWallet } from "@/Wallet"; import { useWallet } from "@/Wallet";
@ -19,14 +19,6 @@ const DataProviders = [
name: "nostr.band", name: "nostr.band",
owner: bech32ToHex("npub1sx9rnd03vs34lp39fvfv5krwlnxpl90f3dzuk8y3cuwutk2gdhdqjz6g8m"), owner: bech32ToHex("npub1sx9rnd03vs34lp39fvfv5krwlnxpl90f3dzuk8y3cuwutk2gdhdqjz6g8m"),
}, },
{
name: "semisol.dev",
owner: bech32ToHex("npub12262qa4uhw7u8gdwlgmntqtv7aye8vdcmvszkqwgs0zchel6mz7s6cgrkj"),
},
{
name: "nostr.directory",
owner: bech32ToHex("npub1teawtzxh6y02cnp9jphxm2q8u6xxfx85nguwg6ftuksgjctvavvqnsgq5u"),
},
]; ];
function ZapTarget({ target }: { target: ZapPoolRecipient }) { function ZapTarget({ target }: { target: ZapPoolRecipient }) {
@ -156,7 +148,10 @@ export default function ZapPoolPage() {
</p> </p>
<p> <p>
{wallet && ( {wallet && (
<AsyncButton onClick={() => ZapPoolController?.payout(wallet)}> <AsyncButton onClick={async () => {
trackEvent("ZapPool:Manual")
await ZapPoolController?.payout(wallet);
}}>
<FormattedMessage defaultMessage="Payout Now" id="+PzQ9Y" /> <FormattedMessage defaultMessage="Payout Now" id="+PzQ9Y" />
</AsyncButton> </AsyncButton>
)} )}

View File

@ -2,7 +2,7 @@ import { UserCache } from "@/Cache";
import { LNURL, ExternalStore, unixNow } from "@snort/shared"; import { LNURL, ExternalStore, unixNow } from "@snort/shared";
import { Toastore } from "@/Toaster"; import { Toastore } from "@/Toaster";
import { LNWallet, WalletInvoiceState, Wallets } from "@/Wallet"; import { LNWallet, WalletInvoiceState, Wallets } from "@/Wallet";
import { bech32ToHex, getDisplayName } from "@/SnortUtils"; import { bech32ToHex, getDisplayName, trackEvent } from "@/SnortUtils";
import { SnortPubKey } from "@/Const"; import { SnortPubKey } from "@/Const";
export enum ZapPoolRecipientType { export enum ZapPoolRecipientType {
@ -168,6 +168,7 @@ class ZapPool extends ExternalStore<Array<ZapPoolRecipient>> {
if (wallet.canAutoLogin()) { if (wallet.canAutoLogin()) {
await wallet.login(); await wallet.login();
} }
trackEvent("ZapPool:Automatic")
await this.payout(wallet); await this.payout(wallet);
} }
} }