mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-06-06 18:31:00 +00:00
Merge pull request #9 from AustinKelsay/bugfix/zap-subscription-filters
Fix param replaceable even format in filters and get zaps total helper function
This commit is contained in:
commit
ca90b958a9
@ -16,7 +16,7 @@ export function useZapsQuery({ event, type }) {
|
|||||||
|
|
||||||
const filters = [
|
const filters = [
|
||||||
{ kinds: [9735], "#e": [event.id] },
|
{ kinds: [9735], "#e": [event.id] },
|
||||||
{ kinds: [9735], "#a": [`${event.kind}:${event.id}:${event.d}`] }
|
{ kinds: [9735], "#a": [`${event.kind}:${event.pubkey}:${event.d}`] }
|
||||||
];
|
];
|
||||||
|
|
||||||
const events = await ndk.fetchEvents(filters, { closeOnEose: true });
|
const events = await ndk.fetchEvents(filters, { closeOnEose: true });
|
||||||
|
@ -26,7 +26,7 @@ export function useZapsSubscription({ event }) {
|
|||||||
try {
|
try {
|
||||||
const filters = [
|
const filters = [
|
||||||
{ kinds: [9735], "#e": [event.id] },
|
{ kinds: [9735], "#e": [event.id] },
|
||||||
{ kinds: [9735], "#a": [`${event.kind}:${event.pubkey}:${event.id}`] }
|
{ kinds: [9735], "#a": [`${event.kind}:${event.pubkey}:${event.d}`] }
|
||||||
];
|
];
|
||||||
|
|
||||||
subscription = ndk.subscribe(filters, {
|
subscription = ndk.subscribe(filters, {
|
||||||
|
@ -10,7 +10,7 @@ export const getTotalFromZaps = (zaps, event) => {
|
|||||||
let uniqueZaps = new Set();
|
let uniqueZaps = new Set();
|
||||||
zaps.forEach((zap) => {
|
zaps.forEach((zap) => {
|
||||||
// If the zap matches the event or the parameterized event, then add the zap to the total
|
// If the zap matches the event or the parameterized event, then add the zap to the total
|
||||||
if ((zap.tags.find(tag => tag[0] === "e" && tag[1] === event.id) || zap.tags.find(tag => tag[0] === "a" && tag[1] === `${event.kind}:${event.id}:${event.d}`)) &&!uniqueZaps.has(zap.id)) {
|
if ((zap.tags.find(tag => tag[0] === "e" && tag[1] === event.id) || zap.tags.find(tag => tag[0] === "a" && tag[1] === `${event.kind}:${event.pubkey}:${event.d}`)) &&!uniqueZaps.has(zap.id)) {
|
||||||
uniqueZaps.add(zap.id);
|
uniqueZaps.add(zap.id);
|
||||||
const bolt11Tag = zap.tags.find(tag => tag[0] === "bolt11");
|
const bolt11Tag = zap.tags.find(tag => tag[0] === "bolt11");
|
||||||
const invoice = bolt11Tag ? bolt11Tag[1] : null;
|
const invoice = bolt11Tag ? bolt11Tag[1] : null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user