-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Add support for NIP22 - Comment #612
Conversation
Hi @yukibtc , I wonder is there a way when I set I reuse tags.push(Tag::from_standardized_without_cell(TagStandard::Event {
event_id: root.id,
relay_url: relay_url.clone(),
marker: None,
public_key: Some(root.pubkey),
uppercase: true,
})); "tags": [
[
"e",
"b8c6832a2f2ec9172339c194b5e93f54fe7be1df7ec8389996c003302aa13214",
"",
"",
"126103bfddc8df256b6e0abfd7f3797c80dcc4ea88f7c2f87dd4104220b4d65f"
],
[
"k",
"1"
]
] |
I've fixed by using: if let Some(marker) = marker {
tag.resize_with(3, String::new);
tag.push(marker.to_string());
if let Some(public_key) = public_key {
tag.resize_with(4, String::new);
tag.push(public_key.to_string());
}
} else if let Some(public_key) = public_key {
tag.resize_with(3, String::new);
tag.push(public_key.to_string());
} |
My PR is only supporting comment on |
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.
Thanks!
I done some changes/fixes in the master
branch. I'll do a rebase and squash the commits during the cherry-picking.
My PR is only supporting comment on
EventId - e tag
, but NIP22 allow comment onCoordinate - a tag
andExternalIdentity - i tag
. Do you have any ideas for implement it? create each comment function for each thing is a bit complex.
I'll add the support to these later, thanks!
/// | ||
/// <https://github.com/nostr-protocol/nips/blob/master/22.md> | ||
#[inline] | ||
pub async fn comment<S>( |
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.
I'm thinking to remove all these kind of methods from Client
to keep the APIs more cleaned. At least, the ones that can be simply constructed directly with the EventBuilder
:
let builder = EventBuilder::<name>;
self.send_event_builder(builder).await
The more complex ones (the ones that requre more than 2 steps, are dangerous if used incorrectly or are very frequently used) can be left, like set_metadata
, gift_wrap
, send_private_msg
, etc.
This is still an idea. What do you think?
I started removing these methods in PR #608
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.
Yes, I prefer using EventBuilder than client's method
Description
Close: #611
Support NIP22: https://github.com/nostr-protocol/nips/blob/master/22.md
Scope:
Kind::Comment
E
inTagStandard::Event
K
inTagStandard::Kind
I
inTagStandard::ExternalIdentity
A
inTagStandard::Coordinate
EventBuilder::comment
client.comment()
Checklist
just precommit
orjust check
before committing