-
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?
added support for zapping replaceable events #424
Conversation
e337b1e
to
914504d
Compare
This code isn't zapping the replaceable event itself, but another replaceable events referenced by the target. To zap the replaceable event you would have to check if the target is replaceable, then build your own |
914504d
to
7ae5831
Compare
7ae5831
to
6b35f06
Compare
zr.tags.push(['e', event.id]) | ||
// replacable event | ||
if ((10000 <= event.kind && event.kind < 20000) || event.kind == 0 || event.kind == 3){ | ||
const a = ["a", `${event.kind}:${event.pubkey}`] |
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.
const a = ["a", `${event.kind}:${event.pubkey}`] | |
const a = ["a", `${event.kind}:${event.pubkey}:`] |
4d4b83e
to
bf0c4d4
Compare
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.
@bitcoinpirate Nice PR, but is this still active?
zr.tags.push(['e', event]) | ||
} | ||
if (event && typeof event === 'object') { | ||
zr.tags.push(['e', event.id]) |
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?
zr.tags.push(['e', event.id]) |
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){ |
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.
isReplaceableKind
would be better.
Line 9 in 1e5bfe8
export function isReplaceableKind(kind: number): boolean { |
const a = ["a", `${event.kind}:${event.pubkey}`] | ||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
isParameterizedReplaceableKind
would be better.
Line 19 in 1e5bfe8
export function isParameterizedReplaceableKind(kind: number): boolean { |
const a = ["a", `${event.kind}:${event.pubkey}`] | ||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
White space.
}else if (30000 <= event.kind && event.kind < 40000){ | |
} else if (30000 <= event.kind && event.kind < 40000){ |
If there is no response from @bitcoinpirate, I will edit and merge theirs fork. |
fixes #291
I tried to keep it backwards compatible by allowing the event id and the event object.