feat: 💨

This commit is contained in:
codytseng
2025-08-25 12:06:06 +08:00
parent 68d0c85dd2
commit c04b84a5b6
3 changed files with 9 additions and 6 deletions

View File

@@ -1,11 +1,11 @@
import { Button } from '@/components/ui/button'
import { CODY_PUBKEY } from '@/constants'
import { JUMBLE_PUBKEY } from '@/constants'
import { cn } from '@/lib/utils'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import ZapDialog from '../ZapDialog'
import RecentSupporters from './RecentSupporters'
import PlatinumSponsors from './PlatinumSponsors'
import RecentSupporters from './RecentSupporters'
export default function Donation({ className }: { className?: string }) {
const { t } = useTranslation()
@@ -45,7 +45,7 @@ export default function Donation({ className }: { className?: string }) {
<ZapDialog
open={open}
setOpen={setOpen}
pubkey={CODY_PUBKEY}
pubkey={JUMBLE_PUBKEY}
defaultAmount={donationAmount}
/>
</div>

View File

@@ -116,6 +116,7 @@ export const YOUTUBE_URL_REGEX =
export const MONITOR = '9bbbb845e5b6c831c29789900769843ab43bb5047abe697870cb50b6fc9bf923'
export const MONITOR_RELAYS = ['wss://relay.nostr.watch/']
export const JUMBLE_PUBKEY = 'f4eb8e62add1340b9cadcd9861e669b2e907cea534e0f7f3ac974c11c758a51a'
export const CODY_PUBKEY = '8125b911ed0e94dbe3008a0be48cfe5cd0c0b05923cfff917ae7e87da8400883'
export const NIP_96_SERVICE = [

View File

@@ -1,4 +1,4 @@
import { BIG_RELAY_URLS, CODY_PUBKEY } from '@/constants'
import { BIG_RELAY_URLS, CODY_PUBKEY, JUMBLE_PUBKEY } from '@/constants'
import { getZapInfoFromEvent } from '@/lib/event-metadata'
import { TProfile } from '@/types'
import {
@@ -19,6 +19,8 @@ import client from './client.service'
export type TRecentSupporter = { pubkey: string; amount: number; comment?: string }
const OFFICIAL_PUBKEYS = [JUMBLE_PUBKEY, CODY_PUBKEY]
class LightningService {
static instance: LightningService
private provider: WebLNProvider | null = null
@@ -186,14 +188,14 @@ class LightningService {
const events = await client.fetchEvents(relayList.read.slice(0, 4), {
authors: ['79f00d3f5a19ec806189fcab03c1be4ff81d18ee4f653c88fac41fe03570f432'], // alby
kinds: [kinds.Zap],
'#p': [CODY_PUBKEY],
'#p': OFFICIAL_PUBKEYS,
since: dayjs().subtract(1, 'month').unix()
})
events.sort((a, b) => b.created_at - a.created_at)
const map = new Map<string, { pubkey: string; amount: number; comment?: string }>()
events.forEach((event) => {
const info = getZapInfoFromEvent(event)
if (!info || info.eventId || !info.senderPubkey || info.senderPubkey === CODY_PUBKEY) return
if (!info || !info.senderPubkey || OFFICIAL_PUBKEYS.includes(info.senderPubkey)) return
const { amount, comment, senderPubkey } = info
const item = map.get(senderPubkey)