-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added support for zapping replaceable events #424
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -49,7 +49,7 @@ export function makeZapRequest({ | |||||||
comment = '', | ||||||||
}: { | ||||||||
profile: string | ||||||||
event: string | null | ||||||||
event: string | Event | null | ||||||||
amount: number | ||||||||
comment: string | ||||||||
relays: string[] | ||||||||
|
@@ -68,9 +68,23 @@ export function makeZapRequest({ | |||||||
], | ||||||||
} | ||||||||
|
||||||||
if (event) { | ||||||||
if (event && typeof event === 'string') { | ||||||||
zr.tags.push(['e', event]) | ||||||||
} | ||||||||
if (event && typeof event === 'object') { | ||||||||
zr.tags.push(['e', event.id]) | ||||||||
// replacable event | ||||||||
if ((10000 <= event.kind && event.kind < 20000) || event.kind == 0 || event.kind == 3){ | ||||||||
AsaiToshiya marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Line 9 in 1e5bfe8
|
||||||||
const a = ["a", `${event.kind}:${event.pubkey}`] | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
zr.tags.push(a) | ||||||||
// parameterized replacable event | ||||||||
}else if (30000 <= event.kind && event.kind < 40000){ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Line 19 in 1e5bfe8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. White space.
Suggested change
|
||||||||
let d = event.tags.find(([t, v]) => t === 'd' && v) | ||||||||
if (!d) throw new Error('d tag not found or is empty') | ||||||||
const a = ["a", `${event.kind}:${event.pubkey}:${d[1]}`] | ||||||||
zr.tags.push(a) | ||||||||
} | ||||||||
} | ||||||||
|
||||||||
return zr | ||||||||
} | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to delete?