feat: 💨
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { CODY_PUBKEY } from '@/constants'
|
import { JUMBLE_PUBKEY } from '@/constants'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import ZapDialog from '../ZapDialog'
|
import ZapDialog from '../ZapDialog'
|
||||||
import RecentSupporters from './RecentSupporters'
|
|
||||||
import PlatinumSponsors from './PlatinumSponsors'
|
import PlatinumSponsors from './PlatinumSponsors'
|
||||||
|
import RecentSupporters from './RecentSupporters'
|
||||||
|
|
||||||
export default function Donation({ className }: { className?: string }) {
|
export default function Donation({ className }: { className?: string }) {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
@@ -45,7 +45,7 @@ export default function Donation({ className }: { className?: string }) {
|
|||||||
<ZapDialog
|
<ZapDialog
|
||||||
open={open}
|
open={open}
|
||||||
setOpen={setOpen}
|
setOpen={setOpen}
|
||||||
pubkey={CODY_PUBKEY}
|
pubkey={JUMBLE_PUBKEY}
|
||||||
defaultAmount={donationAmount}
|
defaultAmount={donationAmount}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ export const YOUTUBE_URL_REGEX =
|
|||||||
export const MONITOR = '9bbbb845e5b6c831c29789900769843ab43bb5047abe697870cb50b6fc9bf923'
|
export const MONITOR = '9bbbb845e5b6c831c29789900769843ab43bb5047abe697870cb50b6fc9bf923'
|
||||||
export const MONITOR_RELAYS = ['wss://relay.nostr.watch/']
|
export const MONITOR_RELAYS = ['wss://relay.nostr.watch/']
|
||||||
|
|
||||||
|
export const JUMBLE_PUBKEY = 'f4eb8e62add1340b9cadcd9861e669b2e907cea534e0f7f3ac974c11c758a51a'
|
||||||
export const CODY_PUBKEY = '8125b911ed0e94dbe3008a0be48cfe5cd0c0b05923cfff917ae7e87da8400883'
|
export const CODY_PUBKEY = '8125b911ed0e94dbe3008a0be48cfe5cd0c0b05923cfff917ae7e87da8400883'
|
||||||
|
|
||||||
export const NIP_96_SERVICE = [
|
export const NIP_96_SERVICE = [
|
||||||
|
|||||||
@@ -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 { getZapInfoFromEvent } from '@/lib/event-metadata'
|
||||||
import { TProfile } from '@/types'
|
import { TProfile } from '@/types'
|
||||||
import {
|
import {
|
||||||
@@ -19,6 +19,8 @@ import client from './client.service'
|
|||||||
|
|
||||||
export type TRecentSupporter = { pubkey: string; amount: number; comment?: string }
|
export type TRecentSupporter = { pubkey: string; amount: number; comment?: string }
|
||||||
|
|
||||||
|
const OFFICIAL_PUBKEYS = [JUMBLE_PUBKEY, CODY_PUBKEY]
|
||||||
|
|
||||||
class LightningService {
|
class LightningService {
|
||||||
static instance: LightningService
|
static instance: LightningService
|
||||||
private provider: WebLNProvider | null = null
|
private provider: WebLNProvider | null = null
|
||||||
@@ -186,14 +188,14 @@ class LightningService {
|
|||||||
const events = await client.fetchEvents(relayList.read.slice(0, 4), {
|
const events = await client.fetchEvents(relayList.read.slice(0, 4), {
|
||||||
authors: ['79f00d3f5a19ec806189fcab03c1be4ff81d18ee4f653c88fac41fe03570f432'], // alby
|
authors: ['79f00d3f5a19ec806189fcab03c1be4ff81d18ee4f653c88fac41fe03570f432'], // alby
|
||||||
kinds: [kinds.Zap],
|
kinds: [kinds.Zap],
|
||||||
'#p': [CODY_PUBKEY],
|
'#p': OFFICIAL_PUBKEYS,
|
||||||
since: dayjs().subtract(1, 'month').unix()
|
since: dayjs().subtract(1, 'month').unix()
|
||||||
})
|
})
|
||||||
events.sort((a, b) => b.created_at - a.created_at)
|
events.sort((a, b) => b.created_at - a.created_at)
|
||||||
const map = new Map<string, { pubkey: string; amount: number; comment?: string }>()
|
const map = new Map<string, { pubkey: string; amount: number; comment?: string }>()
|
||||||
events.forEach((event) => {
|
events.forEach((event) => {
|
||||||
const info = getZapInfoFromEvent(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 { amount, comment, senderPubkey } = info
|
||||||
const item = map.get(senderPubkey)
|
const item = map.get(senderPubkey)
|
||||||
|
|||||||
Reference in New Issue
Block a user