Allow guests to see top zaps

This commit is contained in:
Bojan Mojsilovic 2024-04-26 17:20:02 +02:00
parent c5092a0c3a
commit a55c5122f7
1 changed files with 12 additions and 3 deletions

View File

@ -562,14 +562,23 @@ export const getEventQuotes = (eventId: string, subid: string, offset = 0) => {
};
export const getEventZaps = (eventId: string, user_pubkey: string | undefined, subid: string, limit: number, offset = 0) => {
if (!user_pubkey) return;
const event_id = eventId.startsWith('note1') ? npubToHex(eventId) : eventId;
let payload = {
event_id,
limit,
offset
};
if (user_pubkey) {
// @ts-ignore
payload.user_pubkey = user_pubkey;
}
sendMessage(JSON.stringify([
"REQ",
subid,
{cache: ["event_zaps_by_satszapped", { event_id, user_pubkey, limit, offset }]},
{cache: ["event_zaps_by_satszapped", { ...payload }]},
]));
};