-
Notifications
You must be signed in to change notification settings - Fork 24
Rewrite NostrApiExamples #239
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
Conversation
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.
Pull Request Overview
This PR rewrites the NostrApiExamples class to execute all event types in a sequential manner instead of using a multi-threaded executor approach. The changes simplify the code structure while enabling comprehensive testing of all nostr-java API functionality including metadata, notes, direct messages, mentions, deletions, ephemeral events, reactions, and NIP28 channel operations.
Key changes:
- Removed Spring Boot dependency and multi-threaded execution
- Converted from ApplicationRunner to standalone main class with sequential execution
- Uncommented and enabled all previously disabled event type examples
Comments suppressed due to low confidence (1)
nostr-java-examples/src/main/java/nostr/examples/NostrApiExamples.java:114
- The unused variable
tags
was removed but the deletion event creation logic may be incomplete. Verify that the deletion event properly references the original event without explicit tag creation.
var event = sendTextNoteEvent();
@@ -246,9 +150,8 @@ private static void reactionEvent() { | |||
var nip25 = new NIP25(RECIPIENT); | |||
var reactionEvent = nip25.createReactionEvent(event.getEvent(), Reaction.LIKE, new Relay("localhost:5555")); | |||
reactionEvent.signAndSend(RELAYS); | |||
nip25.createReactionEvent(event.getEvent(), "💩", new Relay("localhost:5555")).signAndSend(); | |||
nip25.createReactionEvent(event.getEvent(), "\uD83D\uDCA9", new Relay("localhost:5555")).signAndSend(); |
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.
[nitpick] The Unicode escape sequence \uD83D\uDCA9 for the emoji is less readable than the original emoji character. Consider using the actual emoji character for better code readability.
nip25.createReactionEvent(event.getEvent(), "\uD83D\uDCA9", new Relay("localhost:5555")).signAndSend(); | |
nip25.createReactionEvent(event.getEvent(), "💩", new Relay("localhost:5555")).signAndSend(); |
Copilot uses AI. Check for mistakes.
@@ -283,7 +186,7 @@ private static void internetIdMetadata() { | |||
.send(RELAYS); | |||
} | |||
|
|||
public static void filters() throws InterruptedException { | |||
private static void filters() throws InterruptedException { |
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.
The filters() method visibility was changed from public to private, which may break external usage if this method was intended to be part of the public API for examples.
private static void filters() throws InterruptedException { | |
public static void filters() throws InterruptedException { |
Copilot uses AI. Check for mistakes.
@@ -375,7 +278,7 @@ private static void logAccountsData() { | |||
'\n' + "* PublicKey HEX: " + SENDER.getPublicKey().toString() + | |||
'\n' + '\n' + "################################ ACCOUNTS END ################################"; | |||
|
|||
log.info(msg); | |||
System.out.println(msg); |
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.
[nitpick] Replacing structured logging (log.info) with System.out.println reduces the ability to control log levels and formatting. Consider using a simple logger or at least System.err for error cases.
Copilot uses AI. Check for mistakes.
Summary
Testing
mvn -q verify
(fails: Docker environment not available)https://chatgpt.com/codex/tasks/task_b_688abcf76dd48331b054ab3e55497eed