send zap to relays

This commit is contained in:
boufni95 2024-10-07 20:21:15 +00:00
parent c5b5581764
commit d31466c0b8
2 changed files with 4 additions and 1 deletions

View file

@ -278,7 +278,7 @@ export default class {
tags, tags,
} }
log({ unsigned: event }) log({ unsigned: event })
this.nostrSend({ type: 'app', appId: invoice.linkedApplication.app_id }, { type: 'event', event }) this.nostrSend({ type: 'app', appId: invoice.linkedApplication.app_id }, { type: 'event', event }, zapInfo.relays || undefined)
} }
async getNofferInvoice(offerReq: NofferData, appId: string): Promise<{ success: true, invoice: string } | { success: false, code: number, max: number }> { async getNofferInvoice(offerReq: NofferData, appId: string): Promise<{ success: true, invoice: string } | { success: false, code: number, max: number }> {

View file

@ -571,6 +571,9 @@ export default class {
if (!verified) { if (!verified) {
throw new Error("nostr event not valid") throw new Error("nostr event not valid")
} }
if (nostrEvent.kind !== 9734) {
throw new Error("nostr event not a zap event")
}
const p = this.parseTags("p", nostrEvent.tags, { required: true }) const p = this.parseTags("p", nostrEvent.tags, { required: true })
const e = this.parseTags("e", nostrEvent.tags) const e = this.parseTags("e", nostrEvent.tags)
const relays = this.parseTags("relays", nostrEvent.tags, { required: true, multiples: true }) const relays = this.parseTags("relays", nostrEvent.tags, { required: true, multiples: true })