forked from Kieran/snort
fix: zapper for zap goals
This commit is contained in:
parent
0cef163eb9
commit
9eb029e1dc
@ -45,6 +45,7 @@ export class Zapper {
|
|||||||
* Create targets from Event
|
* Create targets from Event
|
||||||
*/
|
*/
|
||||||
static fromEvent(ev: NostrEvent) {
|
static fromEvent(ev: NostrEvent) {
|
||||||
|
if (ev.tags.some(a => a[0] === "zap")) {
|
||||||
return ev.tags
|
return ev.tags
|
||||||
.filter(a => a[0] === "zap")
|
.filter(a => a[0] === "zap")
|
||||||
.map(v => {
|
.map(v => {
|
||||||
@ -72,6 +73,19 @@ export class Zapper {
|
|||||||
} as ZapTarget;
|
} as ZapTarget;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
type: "pubkey",
|
||||||
|
value: ev.pubkey,
|
||||||
|
weight: 1,
|
||||||
|
zap: {
|
||||||
|
pubkey: ev.pubkey,
|
||||||
|
event: NostrLink.fromEvent(ev),
|
||||||
|
},
|
||||||
|
} as ZapTarget,
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(wallet: LNWallet | undefined, targets: Array<ZapTarget>, amount: number) {
|
async send(wallet: LNWallet | undefined, targets: Array<ZapTarget>, amount: number) {
|
||||||
|
@ -63,10 +63,10 @@ export function parseZap(zapReceipt: NostrEvent, userCache: FeedCache<MetadataCa
|
|||||||
ret.valid = false;
|
ret.valid = false;
|
||||||
ret.errors.push("amount tag does not match invoice amount");
|
ret.errors.push("amount tag does not match invoice amount");
|
||||||
}
|
}
|
||||||
if (userCache.getFromCache(ret.receiver)?.zapService !== ret.zapService && !isForwardedZap) {
|
/*if (userCache.getFromCache(ret.receiver)?.zapService !== ret.zapService && !isForwardedZap) {
|
||||||
ret.valid = false;
|
ret.valid = false;
|
||||||
ret.errors.push("zap service pubkey doesn't match");
|
ret.errors.push("zap service pubkey doesn't match");
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (!ret.valid) {
|
if (!ret.valid) {
|
||||||
Log("Invalid zap %O", ret);
|
Log("Invalid zap %O", ret);
|
||||||
|
Loading…
Reference in New Issue
Block a user