Skip to content

Commit 58bceed

Browse files
author
erict875
committed
refactor(api)!: simplify event building methods by removing sender parameter
- Removed the sender parameter from multiple event building methods. - This change simplifies the API and ensures a consistent approach to event creation. BREAKING CHANGE: sender parameter is no longer accepted in event building methods. Impact: existing calls to these methods with a sender argument will need to be updated. Migration: remove sender argument from calls to buildTextNote, buildReplaceableEvent, buildEphemeralEvent, and buildAddressableEvent.
1 parent c652345 commit 58bceed

File tree

1 file changed

+4
-27
lines changed

1 file changed

+4
-27
lines changed

nostr-java-api/src/main/java/nostr/api/nip01/NIP01EventBuilder.java

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ public void updateDefaultSender(Identity defaultSender) {
2727
}
2828

2929
public GenericEvent buildTextNote(String content) {
30-
return buildTextNote(null, content);
31-
}
32-
33-
public GenericEvent buildTextNote(Identity sender, String content) {
34-
return new GenericEventFactory(resolveSender(sender), Kind.TEXT_NOTE.getValue(), content)
30+
return new GenericEventFactory(resolveSender(null), Kind.TEXT_NOTE.getValue(), content)
3531
.create();
3632
}
3733

@@ -59,17 +55,7 @@ public GenericEvent buildMetadataEvent(@NonNull String payload) {
5955
}
6056

6157
public GenericEvent buildReplaceableEvent(Integer kind, String content) {
62-
return buildReplaceableEvent(null, kind, content);
63-
}
64-
65-
public GenericEvent buildReplaceableEvent(
66-
Identity sender, Integer kind, String content) {
67-
return new GenericEventFactory(resolveSender(sender), kind, content).create();
68-
}
69-
70-
public GenericEvent buildReplaceableEvent(
71-
List<BaseTag> tags, Integer kind, String content) {
72-
return buildReplaceableEvent(null, tags, kind, content);
58+
return new GenericEventFactory(resolveSender(null), kind, content).create();
7359
}
7460

7561
public GenericEvent buildReplaceableEvent(List<BaseTag> tags, Integer kind, String content) {
@@ -81,20 +67,11 @@ public GenericEvent buildEphemeralEvent(List<BaseTag> tags, Integer kind, String
8167
}
8268

8369
public GenericEvent buildEphemeralEvent(Integer kind, String content) {
84-
return buildEphemeralEvent(null, kind, content);
85-
}
86-
87-
public GenericEvent buildEphemeralEvent(Identity sender, Integer kind, String content) {
88-
return new GenericEventFactory(resolveSender(sender), kind, content).create();
70+
return new GenericEventFactory(resolveSender(null), kind, content).create();
8971
}
9072

9173
public GenericEvent buildAddressableEvent(Integer kind, String content) {
92-
return buildAddressableEvent(null, kind, content);
93-
}
94-
95-
public GenericEvent buildAddressableEvent(
96-
Identity sender, Integer kind, String content) {
97-
return new GenericEventFactory(resolveSender(sender), kind, content).create();
74+
return new GenericEventFactory(resolveSender(null), kind, content).create();
9875
}
9976

10077
public GenericEvent buildAddressableEvent(

0 commit comments

Comments
 (0)