From 6d2c37c3460ab1b0339df6d7b759e06a8afa6365 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 26 Sep 2026 20:19:55 +0000 Subject: [PATCH] refactor(quartz): rename event classes to match their NIP names Old class names drifted from the NIP wording (or described the wrong kind). Every old name stays available as a @Deprecated typealias with a ReplaceWith, so external Quartz users get an IDE quick-fix instead of a break. Wire format is unchanged: parsing goes by kind. Renames: - FollowListEvent (39089) -> StarterPackEvent - LnZapPaymentRequestEvent/ResponseEvent (NIP-47) -> NwcRequestEvent/NwcResponseEvent - VideoHorizontalEvent/VideoVerticalEvent -> AddressableNormalVideoEvent/AddressableShortVideoEvent - CalendarEvent (31924) -> CalendarCollectionEvent - HashtagListEvent -> InterestListEvent - ContactCardEvent (30382) -> UserAssertionEvent - LnZapEvent/LnZapRequestEvent/LnZapEventInterface -> ZapReceiptEvent/ZapRequestEvent/ZapReceiptEventInterface - PrivateDmEvent -> EncryptedDmEvent, DeletionEvent -> DeletionRequestEvent - LongTextNoteEvent -> LongFormContentEvent, WikiNoteEvent -> WikiArticleEvent - PeopleListEvent -> FollowSetEvent, LabeledBookmarkListEvent -> BookmarkSetEvent - RelayFeedsListEvent -> FavoriteRelayListEvent, EmojiPackSelectionEvent -> EmojiListEvent - ChannelListEvent -> PublicChatListEvent, ChatMessageRelayListEvent -> DmRelayListEvent - SealedRumorEvent -> SealEvent, FileHeaderEvent -> FileMetadataEvent - GoalEvent -> ZapGoalEvent, StatusEvent -> UserStatusEvent - NIP90*Event -> Dvm*Event (all NIP-90 events) - NIP-29 group events get the Group prefix to separate them from NIP-43: PutUser, RemoveUser, EditMetadata, DeleteEvent, CreateInvite, UpdatePinList, JoinRequest, LeaveRequest; SupportedRolesEvent -> GroupRolesEvent Merged duplicate classes for the same kind: - nip61 TokenEvent (7375) was unreachable in EventFactory; now an alias of CashuTokenEvent. - nip61 NutzapRedemptionEvent (7376) was unreachable; CashuSpendingHistoryEvent now carries its hint providers and redeemedNutzaps(), plus CashuSpendingHistoryEvent.buildNutzapRedemption. - NIP-82 SoftwareReleaseEvent (30063) was never built by EventFactory; ReleaseArtifactSetEvent now exposes appId/version/channel/assets/releaseNotes and buildSoftwareRelease, and the app no longer re-parses the event. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_015VvJ8XpeYqBe8bYT3bJ7UD --- .claude/skills/auth-signers/SKILL.md | 2 +- .../skills/nip85-trusted-assertions/SKILL.md | 12 +- .../references/event-hierarchy.md | 18 +- .../nostr-expert/references/nip-catalog.md | 12 +- .claude/skills/quartz-integration/SKILL.md | 22 +- .../references/searchable-kinds.md | 40 +-- .../amethyst/LocalPreferences.kt | 16 +- .../vitorpamplona/amethyst/model/Account.kt | 46 +-- .../model/AccountRelayGroupActions.kt | 32 +- .../amethyst/model/AccountSettings.kt | 36 +-- .../amethyst/model/AccountSyncedSettings.kt | 4 +- .../model/AccountSyncedSettingsInternal.kt | 4 +- .../amethyst/model/AccountZapActions.kt | 20 +- .../amethyst/model/EventBroadcaster.kt | 14 +- .../FavoriteAlgoFeedsOrchestrator.kt | 14 +- .../model/nip17Dms/DmRelayListState.kt | 16 +- .../nip30CustomEmojis/OwnedEmojiPacksState.kt | 8 +- .../nip47WalletConnect/NwcSignerState.kt | 18 +- .../hashtagLists/HashtagListState.kt | 26 +- .../interestSets/InterestSetsState.kt | 8 +- .../LabeledBookmarkListsState.kt | 42 +-- .../nip51Lists/peopleList/FollowListsState.kt | 26 +- .../nip51Lists/peopleList/PeopleListsState.kt | 42 +-- .../relayFeeds/RelayFeedListState.kt | 20 +- .../model/nip60Cashu/CashuWalletState.kt | 8 +- .../amethyst/napplet/NappletConsentSummary.kt | 4 +- .../napplet/gateways/AccountIdentityReader.kt | 4 +- .../amethyst/service/V4VPaymentHandler.kt | 6 +- .../amethyst/service/ZapPaymentHandler.kt | 22 +- .../service/lnurl/LightningAddressResolver.kt | 8 +- .../EventNotificationConsumer.kt | 26 +- .../notifications/NotificationContent.kt | 10 +- .../notifications/NotificationDispatcher.kt | 24 +- .../renderers/DirectMessageNotification.kt | 4 +- .../renderers/ZapNotification.kt | 8 +- .../FilterAccountInfoAndListsFromKey.kt | 16 +- .../NWCFinderFilterAssemblerSubscription.kt | 4 +- .../reqCommand/user/UserObservers.kt | 10 +- .../resourceusage/MeteringNostrSigner.kt | 4 +- .../uploads/hls/HlsVideoEventBuilder.kt | 14 +- .../markdown/RenderContentAsMarkdown.kt | 4 +- .../amethyst/ui/dal/FilterByListParams.kt | 4 +- .../amethyst/ui/feeds/PrefetchFeedMedia.kt | 4 +- .../ui/navigation/routes/RouteMaker.kt | 18 +- .../ui/note/NIP05VerificationDisplay.kt | 8 +- .../amethyst/ui/note/NoteCompose.kt | 64 ++-- .../amethyst/ui/note/NoteQuickActionMenu.kt | 8 +- .../ui/note/UpdateReactionTypeDialog.kt | 4 +- .../amethyst/ui/note/UpdateZapAmountDialog.kt | 10 +- .../ui/note/UpdateZapAmountViewModel.kt | 4 +- .../amethyst/ui/note/ZapCustomDialog.kt | 22 +- .../amethyst/ui/note/ZapPollNote.kt | 4 +- .../amethyst/ui/note/ZapPollNoteViewModel.kt | 12 +- .../WatchAndLoadMyEmojiList.kt | 6 +- .../note/elements/AddInboxRelayForDMCard.kt | 10 +- .../ui/note/elements/NoteActionSections.kt | 10 +- .../nip22Comments/CommentPostViewModel.kt | 10 +- .../amethyst/ui/note/share/SharedNoteCard.kt | 6 +- .../ui/note/types/CalendarCollectionRender.kt | 4 +- .../amethyst/ui/note/types/FileHeader.kt | 10 +- .../amethyst/ui/note/types/FollowList.kt | 6 +- .../amethyst/ui/note/types/Goal.kt | 6 +- .../amethyst/ui/note/types/LongForm.kt | 6 +- .../types/NIP90ContentDiscoveryResponse.kt | 4 +- .../amethyst/ui/note/types/NIP90Status.kt | 4 +- .../amethyst/ui/note/types/PeopleList.kt | 4 +- .../amethyst/ui/note/types/PrivateMessage.kt | 4 +- .../amethyst/ui/note/types/Publication.kt | 8 +- .../ui/note/types/PublicationSection.kt | 6 +- .../amethyst/ui/note/types/RelayList.kt | 4 +- .../amethyst/ui/note/types/SoftwareApp.kt | 48 ++- .../amethyst/ui/note/types/Text.kt | 4 +- .../amethyst/ui/note/types/Wiki.kt | 6 +- .../ui/note/types/WikiCollaboration.kt | 6 +- .../amethyst/ui/note/types/ZapEvent.kt | 4 +- .../ui/note/types/lists/BookmarkLists.kt | 4 +- .../amethyst/ui/note/types/lists/TagLists.kt | 6 +- .../amethyst/ui/screen/TopNavFilterState.kt | 8 +- .../ui/screen/loggedIn/AccountViewModel.kt | 68 ++-- .../loggedIn/DecryptAndIndexProcessor.kt | 34 +- .../loggedIn/articles/ArticlesFeedLoaded.kt | 4 +- .../loggedIn/articles/ArticlesTopBar.kt | 4 +- .../articles/dal/ArticlesFeedFilter.kt | 8 +- .../backups/BackupConflictListViews.kt | 16 +- .../display/BookmarkGroupItemOptions.kt | 4 +- .../calendars/CalendarCollectionsTopBar.kt | 4 +- .../calendars/CalendarCollectionsView.kt | 6 +- .../loggedIn/calendars/CalendarsViewModel.kt | 8 +- .../create/NewCalendarCollectionViewModel.kt | 12 +- .../dal/CalendarCollectionsFeedFilter.kt | 6 +- .../calendars/detail/AddToCalendarSheet.kt | 14 +- .../detail/CalendarEventDetailScreen.kt | 12 +- .../loggedIn/chats/feed/ChatMessageCompose.kt | 12 +- .../screen/loggedIn/chats/feed/ChatTimeAgo.kt | 6 +- .../chats/feed/layouts/ChatGroupPosition.kt | 4 +- .../chats/feed/types/RenderChatZap.kt | 4 +- .../chats/geohashChat/GeohashChatViewModel.kt | 4 +- .../loggedIn/chats/privateDM/ChatroomView.kt | 4 +- .../privateDM/datasource/FilterNip04DMs.kt | 6 +- .../privateDM/send/ChatNewMessageViewModel.kt | 10 +- .../header/LiveStreamGoalHeader.kt | 4 +- .../rooms/dal/ChatroomListKnownFeedFilter.kt | 6 +- .../rooms/dal/ChatroomListNewFeedFilter.kt | 6 +- .../rooms/datasource/FilterNip04DMsFromMe.kt | 4 +- .../rooms/datasource/FilterNip04DMsToMe.kt | 4 +- .../chats/rooms/feed/ChatroomListFeedView.kt | 6 +- .../loggedIn/discover/ChannelCardCompose.kt | 12 +- .../loggedIn/discover/DiscoverScreen.kt | 8 +- .../DiscoverLongFormFeedFilter.kt | 8 +- .../discover/nip23LongForm/LongFormCard.kt | 4 +- .../nip23LongForm/LongFormPostViewModel.kt | 10 +- .../DiscoverFollowSetsFeedFilter.kt | 8 +- .../discover/nip51FollowSets/FollowSetCard.kt | 6 +- .../dvms/DvmContentDiscoveryScreen.kt | 18 +- .../loggedIn/dvms/FavoriteAlgoFeedToggle.kt | 4 +- .../NIP90ContentDiscoveryResponseFilter.kt | 8 +- .../membershipManagement/MyEmojiListScreen.kt | 4 +- .../followPacks/feed/FollowPackFeedScreen.kt | 6 +- .../FollowPackFeedConversationsFeedFilter.kt | 4 +- .../dal/FollowPackFeedNewThreadFeedFilter.kt | 16 +- .../feed/dal/FollowPackMembersFeedFilter.kt | 6 +- .../FollowPackFeedFilterSubAssembler.kt | 4 +- .../followPacks/list/FollowPacksFeedLoaded.kt | 4 +- .../followPacks/list/FollowPacksTopBar.kt | 4 +- .../loggedIn/geohash/dal/GeoHashFeedFilter.kt | 12 +- .../loggedIn/hashtag/dal/HashtagFeedFilter.kt | 12 +- .../datasource/FilterPostsByHashtags.kt | 8 +- .../home/dal/HomeNewThreadFeedFilter.kt | 24 +- .../home/nip75Goals/NewGoalViewModel.kt | 4 +- .../display/lists/PeopleListViewModel.kt | 4 +- .../display/packs/FollowPackViewModel.kt | 4 +- .../ui/screen/loggedIn/longs/LongsTopBar.kt | 4 +- .../loggedIn/longs/dal/LongsFeedFilter.kt | 8 +- .../datasource/NestRoomFilterAssembler.kt | 4 +- .../room/lifecycle/NestRoomEventCollectors.kt | 8 +- .../notifications/CardFeedContentState.kt | 12 +- .../notifications/NotificationSummaryState.kt | 6 +- .../dal/NotificationFeedFilter.kt | 38 +-- .../loggedIn/podcasts/PodcastTopSupporters.kt | 4 +- .../dal/UserProfileGalleryFeedFilter.kt | 6 +- .../mutual/dal/UserProfileMutualFeedFilter.kt | 8 +- .../dal/UserProfileNewThreadFeedFilter.kt | 8 +- .../profile/payment/SendPaymentContent.kt | 30 +- .../profile/payment/SendPaymentScreen.kt | 14 +- .../profile/relays/RelayFeedViewModel.kt | 6 +- .../zaps/dal/UserProfileZapsViewModel.kt | 8 +- .../screen/loggedIn/relays/KindDisplayName.kt | 116 +++---- .../loggedIn/relays/RelayInformationScreen.kt | 4 +- .../relays/dm/DMRelayListViewModel.kt | 4 +- .../ui/screen/loggedIn/shorts/ShortsTopBar.kt | 4 +- .../loggedIn/shorts/dal/ShortsFeedFilter.kt | 8 +- .../loggedIn/threadview/ThreadFeedView.kt | 48 +-- .../loggedIn/video/FileHeaderCardCompose.kt | 8 +- .../ui/screen/loggedIn/video/StoriesTopBar.kt | 6 +- .../ui/screen/loggedIn/video/VideoScreen.kt | 4 +- .../loggedIn/video/dal/VideoFeedFilter.kt | 22 +- .../appfunctions/AmethystAppFunctions.kt | 18 +- .../calendar/CalendarsViewModelFlowTest.kt | 6 +- .../model/AddressedAuthorRoutingTest.kt | 4 +- .../model/BuzzWorkspaceChannelTest.kt | 4 +- .../amethyst/model/HomeFeedTypeTest.kt | 8 +- .../FavoriteAlgoFeedTopNavFilterTest.kt | 4 +- .../service/okhttp/DelayingTestSigner.kt | 4 +- .../FilterGroupNotificationsToPubkeyTest.kt | 2 +- .../resourceusage/ResourceUsageLedgerTest.kt | 4 +- .../uploads/hls/HlsVideoEventBuilderTest.kt | 8 +- .../amethyst/ui/RouteForPointerTest.kt | 12 +- .../amethyst/ui/note/share/QrPayloadTest.kt | 6 +- .../ui/note/share/SharedNoteCardTest.kt | 4 +- .../dal/NotificationTagsAnEventByUserTest.kt | 10 +- .../quartz/benchmark/GiftWrapBenchmark.kt | 6 +- .../benchmark/GiftWrapReceivingBenchmark.kt | 8 +- .../benchmark/GiftWrapSigningBenchmark.kt | 8 +- .../benchmark/LargeDBInsertBenchmark.kt | 4 +- cli/ROADMAP.md | 2 +- .../com/vitorpamplona/amethyst/cli/Context.kt | 8 +- .../amethyst/cli/commands/GiftCommands.kt | 8 +- .../amethyst/cli/commands/GrapeRankCommand.kt | 2 +- .../amethyst/cli/commands/RelayCommands.kt | 14 +- .../cli/commands/RelayGroupCommands.kt | 12 +- .../commands/RelayGroupModerationCommands.kt | 16 +- .../amethyst/cli/commands/StatusReport.kt | 8 +- .../amethyst/cli/commands/ZapCommand.kt | 18 +- .../commands/graperank/GrapeRankOperator.kt | 8 +- .../commands/graperank/GrapeRankPublish.kt | 10 +- .../cli/commands/graperank/GrapeRankScore.kt | 6 +- .../commons/account/AccountBootstrapEvents.kt | 18 +- .../amethyst/commons/actions/ZapActions.kt | 24 +- .../signers/NostrSignerPermissionLedger.kt | 28 +- .../commons/feeds/FeedContentState.kt | 4 +- .../amethyst/commons/marmot/MarmotManager.kt | 8 +- .../amethyst/commons/model/DvmHeartbeat.kt | 4 +- .../amethyst/commons/model/HomeFeedType.kt | 16 +- .../amethyst/commons/model/IAccount.kt | 12 +- .../amethyst/commons/model/Note.kt | 28 +- .../amethyst/commons/model/ThreadAssembler.kt | 4 +- .../amethyst/commons/model/User.kt | 6 +- .../backups/ReplaceableBackupConflict.kt | 16 +- .../commons/model/cache/CachePruner.kt | 22 +- .../commons/model/cache/EventCache.kt | 200 ++++++------ .../nip23LongContent/LongFormPublishAction.kt | 8 +- .../PublicChatListDecryptionCache.kt | 12 +- .../nip28PublicChats/PublicChatListState.kt | 30 +- .../nip29RelayGroups/RelayGroupChannel.kt | 4 +- .../model/nip30CustomEmojis/EmojiPackState.kt | 20 +- .../nip38UserStatuses/UserStatusAction.kt | 20 +- .../blockPeopleList/BlockPeopleListState.kt | 34 +- .../HashtagListDecryptionCache.kt | 8 +- .../peopleList/PeopleListDecryptionCache.kt | 28 +- .../RelayFeedsListDecryptionCache.kt | 4 +- .../ContactCardDecryptionCache.kt | 12 +- .../ContactCardsState.kt | 18 +- .../nip85TrustedAssertions/UserCardsCache.kt | 6 +- .../commons/model/privateChats/ChatPreview.kt | 14 +- .../commons/model/privateChats/Chatroom.kt | 6 +- .../model/topNavFeeds/UsingRelayUnwrapper.kt | 8 +- .../topNavFeeds/noteBased/NoteFeedFlow.kt | 38 +-- .../commons/moderation/HashtagSpamCheck.kt | 4 +- .../notifications/NotificationKinds.kt | 10 +- .../commons/napplet/NappletRelayCleartext.kt | 4 +- .../FilterBasicAccountInfoFromKeys.kt | 12 +- .../FilterBookmarksAndReportsFromKey.kt | 4 +- .../metadata/FilterFollowsAndMutesFromKey.kt | 16 +- .../FilterNotificationsToPubkey.kt | 10 +- .../assemblers/ContactCardFilters.kt | 4 +- .../relayClient/calendars/CalendarKinds.kt | 4 +- .../channel/FilterGoalForLiveActivity.kt | 8 +- .../channel/FilterMessagesToLiveStream.kt | 4 +- .../relayGroup/RelayGroupFilterBuilders.kt | 12 +- .../communities/FilterCommunityPosts.kt | 4 +- .../diagnostics/DmRelayDiagnosticsLogger.kt | 4 +- .../FilterLongFormByAllCommunities.kt | 6 +- .../nip23LongForm/FilterLongFormByAuthors.kt | 4 +- .../FilterLongFormByCommunity.kt | 6 +- .../nip23LongForm/FilterLongFormByGeohash.kt | 4 +- .../nip23LongForm/FilterLongFormByHashtag.kt | 4 +- .../nip23LongForm/FilterLongFormGlobal.kt | 4 +- .../FilterFollowSetsByAllCommunities.kt | 6 +- .../FilterFollowSetsByAuthors.kt | 4 +- .../FilterFollowSetsByCommunity.kt | 6 +- .../FilterFollowSetsByGeohash.kt | 4 +- .../FilterFollowSetsByHashtag.kt | 4 +- .../nip51FollowSets/FilterFollowSetsGlobal.kt | 4 +- .../FilterRepliesAndReactionsToAddresses.kt | 8 +- .../FilterRepliesAndReactionsToNotes.kt | 16 +- .../geohash/FilterPostsByGeohash.kt | 8 +- .../nip01Core/FilterHomePostsByGeohashes.kt | 16 +- .../nip01Core/FilterHomePostsByHashtags.kt | 16 +- .../nip65Follows/FilterHomePostsByAuthors.kt | 16 +- .../FilterHomePostsFromCommunities.kt | 16 +- .../FilterHomePostsByAlgoFeedIds.kt | 8 +- .../longs/FilterLongsByAllCommunities.kt | 6 +- .../relayClient/longs/FilterLongsByAuthors.kt | 4 +- .../longs/FilterLongsByGeohashes.kt | 4 +- .../relayClient/longs/FilterLongsByHashtag.kt | 4 +- .../relayClient/longs/FilterLongsGlobal.kt | 4 +- .../relayClient/nip17Dm/GiftWrapDecryptor.kt | 8 +- .../FilterNWCPaymentsFromRequests.kt | 4 +- .../profile/FilterUserProfileLists.kt | 12 +- .../profile/FilterUserProfileMedia.kt | 8 +- .../profile/FilterUserProfilePosts.kt | 8 +- .../profile/FilterUserProfileZapReceived.kt | 4 +- .../relayClient/relay/FilterPostsByRelay.kt | 8 +- .../shorts/FilterShortsByAllCommunities.kt | 6 +- .../shorts/FilterShortsByAuthors.kt | 4 +- .../shorts/FilterShortsByGeohashes.kt | 4 +- .../shorts/FilterShortsByHashtag.kt | 4 +- .../relayClient/shorts/FilterShortsGlobal.kt | 4 +- .../FilterSoftwareAppsByAuthors.kt | 4 +- .../FilterSoftwareAppsByHashtag.kt | 4 +- .../softwareapps/FilterSoftwareAppsGlobal.kt | 4 +- .../user/watchers/FilterUserMetadataForKey.kt | 8 +- .../commons/relayClient/video/FeedBasis.kt | 18 +- .../FilterPictureAndVideoByAllCommunities.kt | 4 +- .../amethyst/commons/search/KindRegistry.kt | 32 +- .../commons/search/RenderableKinds.kt | 44 +-- .../commons/search/SearchResultSorter.kt | 4 +- .../commons/service/nwc/NwcPaymentTracker.kt | 8 +- .../amethyst/commons/service/pow/PoWPolicy.kt | 8 +- .../LiveStreamTopZappersViewModel.kt | 12 +- .../commons/viewmodels/RoomZapsState.kt | 8 +- .../commons/actions/PrivateNoteFactoryTest.kt | 8 +- .../commons/actions/ZapActionsTest.kt | 8 +- .../commons/model/ThreadAssemblerTest.kt | 4 +- .../model/privateChats/ChatPreviewTest.kt | 4 +- .../notifications/NotificationKindsTest.kt | 16 +- .../commons/napplet/NappletBrokerTest.kt | 4 +- .../commons/onchain/OnchainZapSenderTest.kt | 4 +- .../channel/FilterRelayGroupStateTest.kt | 4 +- .../RelayGroupFilterBuildersTest.kt | 10 +- .../home/HomeMediaKindCoverageTest.kt | 8 +- .../FilterHomePostsByAlgoFeedIdsTest.kt | 6 +- .../commons/search/SearchResultSorterTest.kt | 6 +- .../amethyst/commons/search/SearchSeedTest.kt | 6 +- .../commons/viewmodels/RoomZapsStateTest.kt | 6 +- .../commons/cashu/ops/CashuWalletOps.kt | 34 +- .../commons/model/nip52Calendar/IcsExport.kt | 6 +- .../commons/model/nip57Zaps/ZapAction.kt | 12 +- .../service/lnurl/LightningAddressResolver.kt | 6 +- .../lnurl/OkHttpLnurlEndpointResolver.kt | 2 +- .../commons/viewmodels/NestViewModel.kt | 2 +- .../marmot/MarmotEditsAndSystemRowsTest.kt | 6 +- .../model/nip52Calendar/IcsExportTest.kt | 4 +- .../nip71Video/DivineVideoInteropTest.kt | 20 +- .../nip71Video/VideoTrackSelectionTest.kt | 4 +- .../nip17Dm/DmInboxRelayResolverOutboxTest.kt | 10 +- .../commons/viewmodels/NestViewModelTest.kt | 4 +- .../commons/nip17Dm/ui/IncognitoBadge.kt | 4 +- .../commons/ui/note/CalendarCollectionCard.kt | 4 +- .../vitorpamplona/amethyst/desktop/Main.kt | 10 +- .../desktop/cache/DesktopLocalCache.kt | 50 +-- .../desktop/feeds/DesktopFeedFilters.kt | 10 +- .../desktop/followpacks/BulkFollowAction.kt | 6 +- .../desktop/followpacks/FollowPackEditor.kt | 8 +- .../desktop/followpacks/FollowPacksState.kt | 18 +- .../desktop/followpacks/ui/DiscoverScreen.kt | 4 +- .../followpacks/ui/FollowAllConfirmDialog.kt | 4 +- .../ui/FollowPackBrowseAllScreen.kt | 6 +- .../followpacks/ui/FollowPackComponents.kt | 6 +- .../followpacks/ui/FollowPackDetailScreen.kt | 6 +- .../followpacks/ui/RenderFollowPackCard.kt | 4 +- .../desktop/model/DesktopAccountRelays.kt | 12 +- .../desktop/model/DesktopDmRelayState.kt | 2 +- .../desktop/model/DesktopHiddenUsersState.kt | 10 +- .../amethyst/desktop/model/DesktopIAccount.kt | 12 +- .../desktop/model/DesktopRelayListMutator.kt | 4 +- .../amethyst/desktop/nwc/NwcPaymentHandler.kt | 14 +- .../DesktopRelaySubscriptionsCoordinator.kt | 2 +- .../desktop/subscriptions/FilterBuilders.kt | 14 +- .../desktop/subscriptions/FilterDMs.kt | 10 +- .../desktop/ui/ArticleReaderScreen.kt | 10 +- .../amethyst/desktop/ui/NoteActions.kt | 8 +- .../desktop/ui/NotificationsScreen.kt | 10 +- .../amethyst/desktop/ui/ReadsScreen.kt | 16 +- .../amethyst/desktop/ui/UserProfileScreen.kt | 26 +- .../amethyst/desktop/ui/chats/ChatPane.kt | 10 +- .../desktop/ui/chats/ChatroomListState.kt | 4 +- .../desktop/ui/chats/composer/GifResult.kt | 6 +- .../desktop/ui/note/DesktopRichText.kt | 2 +- .../DesktopNotificationAutoDispatcher.kt | 12 +- .../desktop/ui/relay/DmRelayEditor.kt | 4 +- .../desktop/ui/search/SearchResultsList.kt | 6 +- .../cache/DesktopDmRelayListConsumeTest.kt | 4 +- .../desktop/nwc/NwcPaymentHandlerTest.kt | 6 +- .../desktop/nwc/NwcRpcIntegrationTest.kt | 18 +- .../geode/ConcordPlaneKeyDeletionTest.kt | 6 +- .../geode/DeletionSettleBenchmark.kt | 4 +- .../vitorpamplona/geode/DeletionSyncTest.kt | 18 +- .../geode/Nip01ComplianceTest.kt | 12 +- .../vitorpamplona/geode/Nip09DeletionTest.kt | 12 +- quartz/CLIENT.md | 4 +- .../quartz/nip01Core/EventSigCheck.kt | 4 +- .../LnZapPaymentRequestNip44EventTest.kt | 6 +- .../quartz/nip57Zaps/PrivateZapTests.kt | 8 +- .../nip59GiftWraps/GiftWrapEventTest.kt | 46 +-- .../intents/requests/DecryptZapRequest.kt | 4 +- .../client/NostrSignerExternal.kt | 4 +- .../handlers/BackgroundRequestHandler.kt | 4 +- .../handlers/ForegroundRequestHandler.kt | 4 +- .../com/vitorpamplona/quartz/buzz/README.md | 2 +- .../buzz/moderation/ModerationUnbanEvent.kt | 6 +- .../cord05Invites/ConcordDirectInvite.kt | 6 +- .../assistant/CurationCopy.kt | 4 +- .../graperank/GrapeRankCrawler.kt | 4 +- .../graperank/GrapeRankPublisher.kt | 26 +- .../release/Nip82ReleaseDetector.kt | 10 +- .../release/SoftwareReleaseEvent.kt | 94 +----- .../release/TagArrayBuilderExt.kt | 11 +- .../publications/PublicationSectionRef.kt | 8 +- .../vitorpamplona/quartz/kinds/KindNames.kt | 284 ++++++++--------- .../quartz/marmot/MarmotWelcomeSender.kt | 2 +- .../quartz/marmot/RecipientRelayFetcher.kt | 8 +- .../KeyPackageRelayListEvent.kt | 2 +- .../marmot/mip02Welcome/WelcomeGiftWrap.kt | 8 +- .../cache/projection/EventStoreProjection.kt | 6 +- .../NostrClientNegentropyDeletionSettleExt.kt | 4 +- .../quartz/nip01Core/signers/NostrSigner.kt | 4 +- .../nip01Core/signers/NostrSignerInternal.kt | 4 +- .../nip01Core/signers/NostrSignerSync.kt | 6 +- .../nip01Core/store/EventStoreDeletionsExt.kt | 8 +- .../store/sqlite/DeletionRequestModule.kt | 4 +- .../store/sqlite/SQLiteEventStore.kt | 4 +- .../quartz/nip04Dm/PrivateDMCache.kt | 14 +- ...{PrivateDmEvent.kt => EncryptedDmEvent.kt} | 14 +- .../nip04Dm/messages/TagArrayBuilderExt.kt | 4 +- .../quartz/nip09Deletions/DeletionIndex.kt | 8 +- ...letionEvent.kt => DeletionRequestEvent.kt} | 14 +- .../quartz/nip10Notes/BaseThreadedEvent.kt | 4 +- .../quartz/nip13Pow/signer/PoWNostrSigner.kt | 4 +- .../quartz/nip17Dm/NIP17Factory.kt | 10 +- ...eRelayListEvent.kt => DmRelayListEvent.kt} | 18 +- ...xtNoteEvent.kt => LongFormContentEvent.kt} | 10 +- .../nip23LongContent/TagArrayBuilderExt.kt | 8 +- ...nelListEvent.kt => PublicChatListEvent.kt} | 32 +- .../list/TagArrayBuilderExt.kt | 4 +- .../metadata/GroupPinnedEvent.kt | 2 +- ...portedRolesEvent.kt => GroupRolesEvent.kt} | 10 +- ...viteEvent.kt => GroupCreateInviteEvent.kt} | 10 +- ...EventEvent.kt => GroupDeleteEventEvent.kt} | 10 +- ...dataEvent.kt => GroupEditMetadataEvent.kt} | 10 +- .../{PutUserEvent.kt => GroupPutUserEvent.kt} | 10 +- ...veUserEvent.kt => GroupRemoveUserEvent.kt} | 10 +- ...istEvent.kt => GroupUpdatePinListEvent.kt} | 10 +- ...questEvent.kt => GroupJoinRequestEvent.kt} | 10 +- ...uestEvent.kt => GroupLeaveRequestEvent.kt} | 10 +- ...ackSelectionEvent.kt => EmojiListEvent.kt} | 18 +- .../selection/TagArrayBuilderExt.kt | 6 +- .../{StatusEvent.kt => UserStatusEvent.kt} | 18 +- .../signer/NostrSignerRemote.kt | 4 +- .../quartz/nip47WalletConnect/Nip47Client.kt | 40 +-- .../quartz/nip47WalletConnect/Nip47Server.kt | 54 ++-- .../quartz/nip47WalletConnect/README.md | 16 +- .../cache/NostrWalletConnectRequestCache.kt | 14 +- .../cache/NostrWalletConnectResponseCache.kt | 14 +- ...mentRequestEvent.kt => NwcRequestEvent.kt} | 12 +- ...ntResponseEvent.kt => NwcResponseEvent.kt} | 12 +- .../rpc/NwcTransactionMetadata.kt | 2 +- .../nip50Search/SearchFieldExtractor.kt | 40 +-- .../quartz/nip50Search/SearchableKinds.kt | 40 +-- ...FollowListEvent.kt => StarterPackEvent.kt} | 26 +- .../followList/TagArrayBuilderExt.kt | 16 +- ...shtagListEvent.kt => InterestListEvent.kt} | 32 +- .../hashtagList/TagArrayBuilderExt.kt | 4 +- ...okmarkListEvent.kt => BookmarkSetEvent.kt} | 36 ++- .../labeledBookmarkList/TagArrayBuilderExt.kt | 10 +- .../{PeopleListEvent.kt => FollowSetEvent.kt} | 56 ++-- .../peopleList/TagArrayBuilderExt.kt | 10 +- ...ListEvent.kt => FavoriteRelayListEvent.kt} | 22 +- .../relayLists/tags/TagArrayBuilderExt.kt | 4 +- .../ReleaseArtifactSetEvent.kt | 57 +++- ...darEvent.kt => CalendarCollectionEvent.kt} | 10 +- .../calendar/TagArrayBuilderExt.kt | 4 +- .../quartz/nip54Wiki/TagArrayBuilderExt.kt | 8 +- .../{WikiNoteEvent.kt => WikiArticleEvent.kt} | 12 +- .../nip57Zaps/IPrivateZapsDecryptionCache.kt | 4 +- .../quartz/nip57Zaps/PrivateZapCache.kt | 14 +- .../nip57Zaps/PrivateZapRequestBuilder.kt | 2 +- .../{LnZapEvent.kt => ZapReceiptEvent.kt} | 22 +- ...terface.kt => ZapReceiptEventInterface.kt} | 8 +- ...nZapRequestEvent.kt => ZapRequestEvent.kt} | 32 +- .../validate/LnZapReceiptValidator.kt | 10 +- .../quartz/nip59Giftwrap/HasInnerEvent.kt | 2 +- .../quartz/nip59Giftwrap/rumors/Rumor.kt | 4 +- .../{SealedRumorEvent.kt => SealEvent.kt} | 16 +- .../history/CashuSpendingHistoryEvent.kt | 26 +- .../redemption/NutzapRedemptionEvent.kt | 69 ++--- .../redemption/TagArrayBuilderExt.kt | 5 +- .../quartz/nip61Nutzaps/token/TokenEvent.kt | 38 +-- ...vent.kt => AddressableNormalVideoEvent.kt} | 14 +- ...Event.kt => AddressableShortVideoEvent.kt} | 12 +- .../nip75ZapGoals/TagArrayBuilderExt.kt | 14 +- .../{GoalEvent.kt => ZapGoalEvent.kt} | 10 +- .../users/TagArrayBuilderExt.kt | 40 +-- ...tactCardEvent.kt => UserAssertionEvent.kt} | 24 +- .../clientTag/NostrSignerWithClientTag.kt | 4 +- ....kt => DvmContentDiscoveryRequestEvent.kt} | 10 +- .../TagArrayBuilderExt.kt | 6 +- ...kt => DvmContentDiscoveryResponseEvent.kt} | 12 +- ...ent.kt => DvmContentSearchRequestEvent.kt} | 10 +- ...nt.kt => DvmContentSearchResponseEvent.kt} | 12 +- ...tEvent.kt => DvmEventCountRequestEvent.kt} | 10 +- ...Event.kt => DvmEventCountResponseEvent.kt} | 10 +- ...t => DvmEventPowDelegationRequestEvent.kt} | 10 +- ... => DvmEventPowDelegationResponseEvent.kt} | 10 +- ...=> DvmEventPublishScheduleRequestEvent.kt} | 10 +- ...> DvmEventPublishScheduleResponseEvent.kt} | 10 +- ...kt => DvmEventTimestampingRequestEvent.kt} | 10 +- ...t => DvmEventTimestampingResponseEvent.kt} | 10 +- ...t.kt => DvmImageGenerationRequestEvent.kt} | 10 +- ....kt => DvmImageGenerationResponseEvent.kt} | 10 +- ...vent.kt => DvmImageToVideoRequestEvent.kt} | 10 +- ...ent.kt => DvmImageToVideoResponseEvent.kt} | 10 +- ...Event.kt => DvmMalwareScanRequestEvent.kt} | 10 +- ...vent.kt => DvmMalwareScanResponseEvent.kt} | 10 +- ...estEvent.kt => DvmOpReturnRequestEvent.kt} | 10 +- ...seEvent.kt => DvmOpReturnResponseEvent.kt} | 10 +- ...vent.kt => DvmPeopleSearchRequestEvent.kt} | 10 +- ...ent.kt => DvmPeopleSearchResponseEvent.kt} | 12 +- ...{NIP90StatusEvent.kt => DvmStatusEvent.kt} | 10 +- .../nip90Dvms/status/TagArrayBuilderExt.kt | 6 +- ...ent.kt => DvmSummarizationRequestEvent.kt} | 10 +- ...nt.kt => DvmSummarizationResponseEvent.kt} | 10 +- ...nt.kt => DvmTextExtractionRequestEvent.kt} | 10 +- ...t.kt => DvmTextExtractionResponseEvent.kt} | 10 +- ...nt.kt => DvmTextGenerationRequestEvent.kt} | 10 +- ...t.kt => DvmTextGenerationResponseEvent.kt} | 10 +- ...vent.kt => DvmTextToSpeechRequestEvent.kt} | 10 +- ...ent.kt => DvmTextToSpeechResponseEvent.kt} | 10 +- ...Event.kt => DvmTranslationRequestEvent.kt} | 10 +- ...vent.kt => DvmTranslationResponseEvent.kt} | 10 +- ...ent.kt => DvmUserDiscoveryRequestEvent.kt} | 10 +- ...nt.kt => DvmUserDiscoveryResponseEvent.kt} | 12 +- ...t.kt => DvmVideoConversionRequestEvent.kt} | 10 +- ....kt => DvmVideoConversionResponseEvent.kt} | 10 +- ....kt => DvmVideoTranslationRequestEvent.kt} | 10 +- ...kt => DvmVideoTranslationResponseEvent.kt} | 10 +- ...ileHeaderEvent.kt => FileMetadataEvent.kt} | 12 +- .../nip94FileMetadata/TagArrayBuilderExt.kt | 30 +- .../quartz/utils/EventFactory.kt | 292 +++++++++--------- .../moderation/ModerationUnbanEventTest.kt | 6 +- .../graperank/GrapeRankPublisherTest.kt | 20 +- .../SoftwareApplicationEventTest.kt | 57 +++- .../AssertionEventTest.kt | 8 +- .../ContactCardPetNameTest.kt | 24 +- .../projection/EventStoreProjectionTest.kt | 24 +- .../nip01Core/store/sqlite/AddressableTest.kt | 22 +- .../store/sqlite/AuthorsMissingOutboxTest.kt | 4 +- .../nip01Core/store/sqlite/BasicTest.kt | 4 +- .../nip01Core/store/sqlite/DeletionTest.kt | 48 +-- .../sqlite/InsertOutcomeClassificationTest.kt | 6 +- .../store/sqlite/QueryAssemblerTest.kt | 4 +- .../nip01Core/store/sqlite/SearchTest.kt | 14 +- .../ChannelSettingsTagTest.kt | 14 +- .../Nip29ArmadaInteropTest.kt | 48 +-- .../quartz/nip29RelayGroups/PinEventsTest.kt | 12 +- .../quartz/nip29RelayGroups/SubgroupTest.kt | 10 +- .../BunkerRequestProcessorConcurrencyTest.kt | 4 +- .../server/BunkerRequestProcessorTest.kt | 6 +- .../server/NostrConnectSignerServiceTest.kt | 4 +- .../LnZapPaymentRequestNip44EventTest.kt | 6 +- .../NwcOutgoingMetadataTest.kt | 2 +- .../NwcRefusalRoundTripTest.kt | 12 +- ...estEventTest.kt => NwcRequestEventTest.kt} | 16 +- .../nip50Search/SearchFieldExtractorTest.kt | 16 +- ...tTest.kt => FavoriteRelayListEventTest.kt} | 34 +- .../relayLists/RelayListPublicEntriesTest.kt | 4 +- .../nip52Calendar/CalendarHintProviderTest.kt | 4 +- .../quartz/nip54Wiki/WikiCollaborationTest.kt | 10 +- .../nip57Zaps/LnZapRequestAnonTagTest.kt | 14 +- .../nip57Zaps/LnZapRequestGroupTagTest.kt | 4 +- .../nip57Zaps/LnZapRequestKindTagTest.kt | 12 +- .../validate/LnZapReceiptValidatorTest.kt | 6 +- .../nip61Nutzaps/NutzapInfoEventTest.kt | 4 +- .../nip61Nutzaps/NutzapRedemptionTest.kt | 61 ++++ .../AddressableVideoEventAddressTest.kt | 14 +- .../quartz/marmot/MarmotMipBehaviorTest.kt | 6 +- .../nip01Core/jackson/JacksonMapperTest.kt | 4 +- .../KotlinSerializationMapperTest.kt | 10 +- .../RelayGroupFilterServingRelayTest.kt | 10 +- .../quartz/nip01Core/store/fs/FsEventStore.kt | 8 +- .../buzz/interop/BuzzRelayLiveInteropTest.kt | 8 +- .../store/fs/FsAuthorsMissingOutboxTest.kt | 4 +- .../nip01Core/store/fs/FsDeletionTest.kt | 62 ++-- .../quartz/nip01Core/store/fs/FsParityTest.kt | 28 +- .../quartz/nip01Core/store/fs/FsSearchTest.kt | 4 +- .../quartz/nip01Core/store/fs/FsSlotsTest.kt | 22 +- 546 files changed, 3851 insertions(+), 3343 deletions(-) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip04Dm/messages/{PrivateDmEvent.kt => EncryptedDmEvent.kt} (92%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip09Deletions/{DeletionEvent.kt => DeletionRequestEvent.kt} (90%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip17Dm/settings/{ChatMessageRelayListEvent.kt => DmRelayListEvent.kt} (86%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip23LongContent/{LongTextNoteEvent.kt => LongFormContentEvent.kt} (94%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip28PublicChat/list/{ChannelListEvent.kt => PublicChatListEvent.kt} (89%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/metadata/{SupportedRolesEvent.kt => GroupRolesEvent.kt} (83%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/{CreateInviteEvent.kt => GroupCreateInviteEvent.kt} (82%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/{DeleteEventEvent.kt => GroupDeleteEventEvent.kt} (84%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/{EditMetadataEvent.kt => GroupEditMetadataEvent.kt} (92%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/{PutUserEvent.kt => GroupPutUserEvent.kt} (88%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/{RemoveUserEvent.kt => GroupRemoveUserEvent.kt} (84%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/{UpdatePinListEvent.kt => GroupUpdatePinListEvent.kt} (85%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/request/{JoinRequestEvent.kt => GroupJoinRequestEvent.kt} (84%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/request/{LeaveRequestEvent.kt => GroupLeaveRequestEvent.kt} (82%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip30CustomEmoji/selection/{EmojiPackSelectionEvent.kt => EmojiListEvent.kt} (85%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip38UserStatus/{StatusEvent.kt => UserStatusEvent.kt} (90%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/events/{LnZapPaymentRequestEvent.kt => NwcRequestEvent.kt} (91%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/events/{LnZapPaymentResponseEvent.kt => NwcResponseEvent.kt} (90%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/followList/{FollowListEvent.kt => StarterPackEvent.kt} (90%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/hashtagList/{HashtagListEvent.kt => InterestListEvent.kt} (90%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/labeledBookmarkList/{LabeledBookmarkListEvent.kt => BookmarkSetEvent.kt} (94%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/peopleList/{PeopleListEvent.kt => FollowSetEvent.kt} (93%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/{RelayFeedsListEvent.kt => FavoriteRelayListEvent.kt} (88%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip52Calendar/calendar/{CalendarEvent.kt => CalendarCollectionEvent.kt} (89%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip54Wiki/{WikiNoteEvent.kt => WikiArticleEvent.kt} (95%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/{LnZapEvent.kt => ZapReceiptEvent.kt} (87%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/{LnZapEventInterface.kt => ZapReceiptEventInterface.kt} (82%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/{LnZapRequestEvent.kt => ZapRequestEvent.kt} (91%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip59Giftwrap/seals/{SealedRumorEvent.kt => SealEvent.kt} (93%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip71Video/{VideoHorizontalEvent.kt => AddressableNormalVideoEvent.kt} (82%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip71Video/{VideoVerticalEvent.kt => AddressableShortVideoEvent.kt} (83%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip75ZapGoals/{GoalEvent.kt => ZapGoalEvent.kt} (94%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip85TrustedAssertions/users/{ContactCardEvent.kt => UserAssertionEvent.kt} (89%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryRequest/{NIP90ContentDiscoveryRequestEvent.kt => DvmContentDiscoveryRequestEvent.kt} (85%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryResponse/{NIP90ContentDiscoveryResponseEvent.kt => DvmContentDiscoveryResponseEvent.kt} (82%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentSearch/{NIP90ContentSearchRequestEvent.kt => DvmContentSearchRequestEvent.kt} (89%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentSearch/{NIP90ContentSearchResponseEvent.kt => DvmContentSearchResponseEvent.kt} (83%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventCount/{NIP90EventCountRequestEvent.kt => DvmEventCountRequestEvent.kt} (86%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventCount/{NIP90EventCountResponseEvent.kt => DvmEventCountResponseEvent.kt} (82%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPowDelegation/{NIP90EventPowDelegationRequestEvent.kt => DvmEventPowDelegationRequestEvent.kt} (83%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPowDelegation/{NIP90EventPowDelegationResponseEvent.kt => DvmEventPowDelegationResponseEvent.kt} (79%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPublishSchedule/{NIP90EventPublishScheduleRequestEvent.kt => DvmEventPublishScheduleRequestEvent.kt} (84%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPublishSchedule/{NIP90EventPublishScheduleResponseEvent.kt => DvmEventPublishScheduleResponseEvent.kt} (79%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventTimestamping/{NIP90EventTimestampingRequestEvent.kt => DvmEventTimestampingRequestEvent.kt} (83%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventTimestamping/{NIP90EventTimestampingResponseEvent.kt => DvmEventTimestampingResponseEvent.kt} (80%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageGeneration/{NIP90ImageGenerationRequestEvent.kt => DvmImageGenerationRequestEvent.kt} (89%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageGeneration/{NIP90ImageGenerationResponseEvent.kt => DvmImageGenerationResponseEvent.kt} (80%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageToVideo/{NIP90ImageToVideoRequestEvent.kt => DvmImageToVideoRequestEvent.kt} (84%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageToVideo/{NIP90ImageToVideoResponseEvent.kt => DvmImageToVideoResponseEvent.kt} (81%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/malwareScanning/{NIP90MalwareScanRequestEvent.kt => DvmMalwareScanRequestEvent.kt} (84%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/malwareScanning/{NIP90MalwareScanResponseEvent.kt => DvmMalwareScanResponseEvent.kt} (81%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/opReturn/{NIP90OpReturnRequestEvent.kt => DvmOpReturnRequestEvent.kt} (85%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/opReturn/{NIP90OpReturnResponseEvent.kt => DvmOpReturnResponseEvent.kt} (82%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/peopleSearch/{NIP90PeopleSearchRequestEvent.kt => DvmPeopleSearchRequestEvent.kt} (87%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/peopleSearch/{NIP90PeopleSearchResponseEvent.kt => DvmPeopleSearchResponseEvent.kt} (83%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/status/{NIP90StatusEvent.kt => DvmStatusEvent.kt} (85%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/summarization/{NIP90SummarizationRequestEvent.kt => DvmSummarizationRequestEvent.kt} (85%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/summarization/{NIP90SummarizationResponseEvent.kt => DvmSummarizationResponseEvent.kt} (80%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textExtraction/{NIP90TextExtractionRequestEvent.kt => DvmTextExtractionRequestEvent.kt} (87%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textExtraction/{NIP90TextExtractionResponseEvent.kt => DvmTextExtractionResponseEvent.kt} (80%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textGeneration/{NIP90TextGenerationRequestEvent.kt => DvmTextGenerationRequestEvent.kt} (90%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textGeneration/{NIP90TextGenerationResponseEvent.kt => DvmTextGenerationResponseEvent.kt} (80%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textToSpeech/{NIP90TextToSpeechRequestEvent.kt => DvmTextToSpeechRequestEvent.kt} (87%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textToSpeech/{NIP90TextToSpeechResponseEvent.kt => DvmTextToSpeechResponseEvent.kt} (81%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/translation/{NIP90TranslationRequestEvent.kt => DvmTranslationRequestEvent.kt} (85%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/translation/{NIP90TranslationResponseEvent.kt => DvmTranslationResponseEvent.kt} (81%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/userDiscoveryRequest/{NIP90UserDiscoveryRequestEvent.kt => DvmUserDiscoveryRequestEvent.kt} (83%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/userDiscoveryResponse/{NIP90UserDiscoveryResponseEvent.kt => DvmUserDiscoveryResponseEvent.kt} (82%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoConversion/{NIP90VideoConversionRequestEvent.kt => DvmVideoConversionRequestEvent.kt} (86%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoConversion/{NIP90VideoConversionResponseEvent.kt => DvmVideoConversionResponseEvent.kt} (80%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoTranslation/{NIP90VideoTranslationRequestEvent.kt => DvmVideoTranslationRequestEvent.kt} (87%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoTranslation/{NIP90VideoTranslationResponseEvent.kt => DvmVideoTranslationResponseEvent.kt} (80%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip94FileMetadata/{FileHeaderEvent.kt => FileMetadataEvent.kt} (93%) rename quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/{LnZapPaymentRequestEventTest.kt => NwcRequestEventTest.kt} (93%) rename quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/{RelayFeedsListEventTest.kt => FavoriteRelayListEventTest.kt} (87%) create mode 100644 quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/NutzapRedemptionTest.kt diff --git a/.claude/skills/auth-signers/SKILL.md b/.claude/skills/auth-signers/SKILL.md index 8b11a52d1b..0d32eedf8c 100644 --- a/.claude/skills/auth-signers/SKILL.md +++ b/.claude/skills/auth-signers/SKILL.md @@ -29,7 +29,7 @@ abstract class NostrSigner(val pubKey: HexKey) { abstract fun nip04Decrypt(ciphertext: String, fromPubKey: HexKey, onReady: (String) -> Unit) abstract fun nip44Encrypt(...) abstract fun nip44Decrypt(...) - abstract fun decryptZapEvent(event: LnZapRequestEvent, onReady: (LnZapRequestEvent) -> Unit) + abstract fun decryptZapEvent(event: ZapRequestEvent, onReady: (ZapRequestEvent) -> Unit) } ``` diff --git a/.claude/skills/nip85-trusted-assertions/SKILL.md b/.claude/skills/nip85-trusted-assertions/SKILL.md index b0b17f22ea..d75415e4df 100644 --- a/.claude/skills/nip85-trusted-assertions/SKILL.md +++ b/.claude/skills/nip85-trusted-assertions/SKILL.md @@ -26,16 +26,16 @@ event signatures; the 10040→assertion link is **consumer-side convention** (se | Kind | Class | Kind class | d-tag = the subject | Content | |---|---|---|---|---| | 10040 | `list/TrustProviderListEvent` | replaceable | *(none — always `""`)* | NIP-44 private provider entries (optional) | -| 30382 | `users/ContactCardEvent` | addressable | **target user's pubkey** (hex) | NIP-44 private tags (petname/summary/emoji) | +| 30382 | `users/UserAssertionEvent` | addressable | **target user's pubkey** (hex) | NIP-44 private tags (petname/summary/emoji) | | 30383 | `events/EventAssertionEvent` | addressable | **target event id** (hex) | `""` | | 30384 | `addressables/AddressableAssertionEvent` | addressable | **target coordinate** `kind:pubkey:dtag` | `""` | | 30385 | `externalIds/ExternalIdAssertionEvent` | addressable | **external identifier** (e.g. `isbn:978-0-13-468599-1`) | `""` | -Addresses: `ContactCardEvent.createAddress(owner, target)` → `Address(30382, owner, target)` +Addresses: `UserAssertionEvent.createAddress(owner, target)` → `Address(30382, owner, target)` (owner = signer, target = subject). `TrustProviderListEvent.createAddress(pubKey)` uses `FIXED_D_TAG = ""`. `AssertionEventTest.eventKindsAreCorrect` pins all five numbers. -`ContactCardEvent` is also a `SearchableEvent` — it indexes only the **public** petname/summary +`UserAssertionEvent` is also a `SearchableEvent` — it indexes only the **public** petname/summary tags plus topics; the encrypted card content is intentionally never indexed. ## The 10040 provider entry (`ServiceProviderTag` / `ServiceType`) @@ -91,7 +91,7 @@ The same kind serves two roles, distinguished **by author**: `followers`, `hops`, …); this is what 10040 discovery points at. 2. **The account's own contact cards (nicknames, NIP-81-style)** — signed by the account, one per target user. The petname, summary, and their NIP-30 emoji mappings **always live in - the NIP-44 encrypted content, never in public tags** (`ContactCardEvent.build`/ + the NIP-44 encrypted content, never in public tags** (`UserAssertionEvent.build`/ `updatePetNameAndSummary` strip stray public copies; asserted by `ContactCardPetNameTest`). `commons/.../ContactCardsState.kt` keys everything on `author == account` and ignores provider cards. @@ -104,7 +104,7 @@ value — a bad tag is *dropped*, never an error) + `assemble(value)` → `[name validation (rank isn't clamped, hours aren't checked against 0–23, counts may be negative) — consumers must defend. -**On 30382** (`users/tags/`, accessors on `ContactCardEvent` and as `TagArray` extensions in +**On 30382** (`users/tags/`, accessors on `UserAssertionEvent` and as `TagArray` extensions in `users/TagArrayExt.kt` so they also work on decrypted private arrays): | Tag name | Accessor | Type | Semantics | @@ -138,7 +138,7 @@ val providers: List = updated.serviceProviders() // val private = updated.privateTags(signer)?.serviceProviders() // private side // Provider-style contact card (public metrics) — the GrapeRankPublisher pattern: -val card = ContactCardEvent.create( +val card = UserAssertionEvent.create( targetUser = subjectPubkey, signer = providerSigner, publicInitializer = { diff --git a/.claude/skills/nostr-expert/references/event-hierarchy.md b/.claude/skills/nostr-expert/references/event-hierarchy.md index 1ca0c0fa1c..cf6f6dfd12 100644 --- a/.claude/skills/nostr-expert/references/event-hierarchy.md +++ b/.claude/skills/nostr-expert/references/event-hierarchy.md @@ -79,28 +79,28 @@ companion object { ### Zap Request/Receipt (kinds 9734, 9735) ```kotlin -class LnZapRequestEvent(...) : Event(...) +class ZapRequestEvent(...) : Event(...) // Created by client, sent to Lightning Address -class LnZapEvent(...) : Event(...) +class ZapReceiptEvent(...) : Event(...) // Receipt from LSP, contains bolt11 + embedded zap request - val zapRequest: LnZapRequestEvent? by lazy { containedPost() } + val zapRequest: ZapRequestEvent? by lazy { containedPost() } val amount: BigDecimal? by lazy { /* parse from bolt11 */ } ``` ### Long-Form Content (kind 30023) ```kotlin -class LongTextNoteEvent(...) : BaseAddressableEvent(...) +class LongFormContentEvent(...) : BaseAddressableEvent(...) // Blog posts, articles // Addressable via kind:pubkey:d-tag ``` ### Lists (kinds 10000-30004) ```kotlin -sealed class PeopleListEvent : BaseAddressableEvent { - object MuteList : PeopleListEvent(10000) - object PinList : PeopleListEvent(10001) - object BookmarkList : PeopleListEvent(10003) +sealed class FollowSetEvent : BaseAddressableEvent { + object MuteList : FollowSetEvent(10000) + object PinList : FollowSetEvent(10001) + object BookmarkList : FollowSetEvent(10003) // ... 18 list types total } ``` @@ -279,7 +279,7 @@ val metadata2 = MetadataEvent.createNew(name = "Alice Updated", picture = "url2" ### Event Deletion ```kotlin // Delete events -val deletion = DeletionEvent.create( +val deletion = DeletionRequestEvent.create( deleteEvents = listOf(eventId1, eventId2), reason = "Spam", signer = signer diff --git a/.claude/skills/nostr-expert/references/nip-catalog.md b/.claude/skills/nostr-expert/references/nip-catalog.md index 78ed47ee11..996addba10 100644 --- a/.claude/skills/nostr-expert/references/nip-catalog.md +++ b/.claude/skills/nostr-expert/references/nip-catalog.md @@ -15,7 +15,7 @@ under `experimental/`**. The categorized list below may lag behind — | 04 | `nip04Dm/` | EncryptedDmEvent.kt | Legacy encrypted DMs (deprecated for NIP-17) | | 05 | `nip05DnsIdentifiers/` | UserHexResolver.kt, Nip05Client.kt | Internet identifiers; `resolveUserHexOrNull` resolves hex/npub/nprofile/`name@domain` → pubkey (see references/nip05-identifiers.md) | | 06 | `nip06KeyDerivation/` | Mnemonic-related | BIP-39 key derivation | -| 09 | `nip09Deletions/` | DeletionEvent.kt | Event deletion requests (kind 5) | +| 09 | `nip09Deletions/` | DeletionRequestEvent.kt | Event deletion requests (kind 5) | | 11 | `nip11RelayInfo/` | RelayInformation.kt | Relay metadata | | 13 | `nip13Pow/` | ProofOfWork.kt | Proof of work | | 14 | `nip14Subject/` | Subject tags | Subject tags for text notes | @@ -33,7 +33,7 @@ ent for NIP-04) | | 10 | `nip10Notes/` | TextNoteEvent.kt | Text notes with threading (kind 1) | | 18 | `nip18Reposts/` | RepostEvent.kt, GenericRepostEvent.kt | Reposts (kind 6, 16) | | 22 | `nip22Comments/` | CommentEvent.kt | Comments (kind 1111) | -| 23 | `nip23LongContent/` | LongTextNoteEvent.kt | Long-form content (kind 30023) | +| 23 | `nip23LongContent/` | LongFormContentEvent.kt | Long-form content (kind 30023) | | 25 | `nip25Reactions/` | ReactionEvent.kt | Reactions (kind 7) | | 31 | `nip31Alts/` | Alt tags | Alt description tags | | 36 | `nip36SensitiveContent/` | Content warnings | Content warning tags | @@ -62,7 +62,7 @@ ent for NIP-04) | | 46 | `nip46RemoteSigner/` | NostrConnectEvent.kt | Remote signer protocol (bunker) | | 47 | `nip47WalletConnect/` | Nostr Wallet Connect | Wallet connection protocol | | 56 | `nip56Reports/` | ReportEvent.kt | Reports (kind 1984) | -| 57 | `nip57Zaps/` | LnZapEvent.kt, LnZapRequestEvent.kt | Lightning zaps (kinds 9734, 9735) | +| 57 | `nip57Zaps/` | ZapReceiptEvent.kt, ZapRequestEvent.kt | Lightning zaps (kinds 9734, 9735) | | 58 | `nip58Badges/` | Badge events | Badge definitions & awards (kinds 30009, 8) | | 59 | `nip59Giftwrap/` | GiftWrapEvent.kt | Gift-wrapped events for privacy | | 75 | `nip75ZapGoals/` | ZapGoalEvent.kt | Zap goals (kind 9041) | @@ -76,7 +76,7 @@ ent for NIP-04) | | 35 | `nip35Torrents/` | Torrent events | Torrent tracking | | 52 | `nip52Calendar/` | Calendar events | Calendar time-based/date-based (kinds 31922-31925) | | 53 | `nip53LiveActivities/` | LiveActivitiesEvent.kt | Live events/streaming (kind 30311) | -| 54 | `nip54Wiki/` | WikiNoteEvent.kt | Wiki pages (kind 30818) | +| 54 | `nip54Wiki/` | WikiArticleEvent.kt | Wiki pages (kind 30818) | | 68 | `nip68Picture/` | Picture metadata | Picture metadata | | 71 | `nip71Video/` | 7 video event types | Video events (kinds 34235, 35235, 1234, 1235) | | 72 | `nip72ModCommunities/` | Community events | Moderated communities (kinds 34550, 34551, 9041) | @@ -84,7 +84,7 @@ ent for NIP-04) | | 89 | `nip89AppHandlers/` | AppDefinitionEvent.kt | App recommendations (kinds 31990, 31989) | | 90 | `nip90Dvms/` | DVM job events | Data Vending Machines (DVMs) (kinds 5000-7000) | | 92 | `nip92IMeta/` | IMeta tags | Image metadata tags | -| 94 | `nip94FileMetadata/` | FileHeaderEvent.kt, FileStorageEvent.kt | File metadata (kind 1063) | +| 94 | `nip94FileMetadata/` | FileMetadataEvent.kt, FileStorageEvent.kt | File metadata (kind 1063) | | 96 | `nip96FileStorage/` | HTTP file storage | HTTP-based file storage | | 99 | `nip99Classifieds/` | ClassifiedsEvent.kt | Classifieds/marketplace (kind 30402) | | A0 | `nipA0VoiceMessages/` | Voice messages | Voice message events | @@ -93,7 +93,7 @@ ent for NIP-04) | ### Web/Storage/Other | NIP | Directory | Key Files | Description | |-----|-----------|-----------|-------------| -| 38 | `nip38UserStatus/` | StatusEvent.kt | User status (kind 30315) | +| 38 | `nip38UserStatus/` | UserStatusEvent.kt | User status (kind 30315) | | 60 | `nip60Payment/` | Wallet events | Wallet info (kind 13194) | | 61 | `nip61PaymentRequest/` | Nut zaps | Cashu payment requests | | 64 | `nip64Chess/` | Chess moves | Chess move events | diff --git a/.claude/skills/quartz-integration/SKILL.md b/.claude/skills/quartz-integration/SKILL.md index 55dc9ad12f..8bd65f92e1 100644 --- a/.claude/skills/quartz-integration/SKILL.md +++ b/.claude/skills/quartz-integration/SKILL.md @@ -650,15 +650,15 @@ val custom = ReactionEvent.build("🤙", targetEvent) ### NIP-57 — Zap request (kind 9734) ```kotlin -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent -val template = LnZapRequestEvent.build( +val template = ZapRequestEvent.build( message = "Great post!", relays = listOf("wss://relay.damus.io"), target = targetEvent, - zapType = LnZapRequestEvent.ZapType.PUBLIC + zapType = ZapRequestEvent.ZapType.PUBLIC ) -val zapRequest: LnZapRequestEvent = signer.sign(template) +val zapRequest: ZapRequestEvent = signer.sign(template) ``` ### NIP-59 — Gift wrap / sealed DM (kind 1059 + 14) @@ -678,9 +678,9 @@ val (dmEvent, giftWrap) = NIP17Factory.create( ### NIP-23 — Long-form article (kind 30023) ```kotlin -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent -val template = LongTextNoteEvent.build( +val template = LongFormContentEvent.build( body = markdownContent, title = "My Article", image = "https://example.com/cover.jpg", @@ -882,16 +882,16 @@ use `Nip11RelayInformation.fromJson(json)`. | 0 | User metadata | 01 | `MetadataEvent` | | 1 | Text note | 10 | `TextNoteEvent` | | 3 | Follow list | 02 | `ContactListEvent` | -| 4 | Legacy DM | 04 | `PrivateDmEvent` | -| 5 | Deletion | 09 | `DeletionEvent` | +| 4 | Legacy DM | 04 | `EncryptedDmEvent` | +| 5 | Deletion | 09 | `DeletionRequestEvent` | | 6 | Repost | 18 | `RepostEvent` | | 7 | Reaction | 25 | `ReactionEvent` | | 14 | Chat message (sealed) | 17 | `NIP17GroupMessage` | | 1059 | Gift wrap | 59 | `GiftWrapEvent` | -| 9734 | Zap request | 57 | `LnZapRequestEvent` | -| 9735 | Zap receipt | 57 | `LnZapEvent` | +| 9734 | Zap request | 57 | `ZapRequestEvent` | +| 9735 | Zap receipt | 57 | `ZapReceiptEvent` | | 10002 | Relay list | 65 | `AdvertisedRelayListEvent` | -| 30023 | Long-form content | 23 | `LongTextNoteEvent` | +| 30023 | Long-form content | 23 | `LongFormContentEvent` | ## Related Skills diff --git a/.claude/skills/searchable-events/references/searchable-kinds.md b/.claude/skills/searchable-events/references/searchable-kinds.md index b2e3348127..92688128ec 100644 --- a/.claude/skills/searchable-events/references/searchable-kinds.md +++ b/.claude/skills/searchable-events/references/searchable-kinds.md @@ -26,7 +26,7 @@ Separator legend: **NL** = `joinToString("\n")`, **SP** = `joinToString(" ")`. | 42 | ChannelMessageEvent | nip28PublicChat/message | `content` | | 54 | PodcastEpisodeEvent | nipF4Podcasts/episode | `listOfNotNull(title(), description(), content)` NL | | 1010 | TextNoteModificationEvent | experimental/edits | `listOfNotNull(content, summary())` NL (content first) | -| 1063 | FileHeaderEvent | nip94FileMetadata | `listOfNotNull(summary(), content)` NL | +| 1063 | FileMetadataEvent | nip94FileMetadata | `listOfNotNull(summary(), content)` NL | | 1065 | FileStorageHeaderEvent | experimental/nip95/header | `listOfNotNull(summary())` NL | | 1068 | PollEvent | nip88Polls/poll | `buildString { append(content); options().forEach { append('\n').append(it.label) } }` | | 1111 | CommentEvent | nip22Comments | `(listOf(content) + tags.hashtags())` NL | @@ -48,20 +48,20 @@ Separator legend: **NL** = `joinToString("\n")`, **SP** = `joinToString(" ")`. | 2004 | TorrentCommentEvent | nip35Torrents | `content` | | 2473 | BirdDetectionEvent | experimental/birdstar | `listOfNotNull(summary(), speciesName())` NL | | 3302 | ConcordChatEditEvent | concord/cord03Channels | `content` | -| 5050 | NIP90TextGenerationRequestEvent | nip90Dvms/textGeneration | `inputs().filter { it.type == "prompt" \|\| it.type == "text" }.joinToString(" ") { it.value }` (SP) | -| 5100 | NIP90ImageGenerationRequestEvent | nip90Dvms/imageGeneration | `listOfNotNull(prompt(), negativePrompt()).joinToString(" ")` (SP) | +| 5050 | DvmTextGenerationRequestEvent | nip90Dvms/textGeneration | `inputs().filter { it.type == "prompt" \|\| it.type == "text" }.joinToString(" ") { it.value }` (SP) | +| 5100 | DvmImageGenerationRequestEvent | nip90Dvms/imageGeneration | `listOfNotNull(prompt(), negativePrompt()).joinToString(" ")` (SP) | | 5129 | NappletSnapshotEvent | nip5dNapplets | `listOfNotNull(title(), description())` NL | -| 5250 | NIP90TextToSpeechRequestEvent | nip90Dvms/textToSpeech | `text() ?: ""` | -| 5302 | NIP90ContentSearchRequestEvent | nip90Dvms/contentSearch | `searchQuery() ?: ""` | -| 5303 | NIP90PeopleSearchRequestEvent | nip90Dvms/peopleSearch | `searchQuery() ?: ""` | +| 5250 | DvmTextToSpeechRequestEvent | nip90Dvms/textToSpeech | `text() ?: ""` | +| 5302 | DvmContentSearchRequestEvent | nip90Dvms/contentSearch | `searchQuery() ?: ""` | +| 5303 | DvmPeopleSearchRequestEvent | nip90Dvms/peopleSearch | `searchQuery() ?: ""` | | 6969 | ZapPollEvent | experimental/zapPolls | `buildString { append(content); pollOptionsArray().forEach { append('\n').append(it.descriptor) } }` | | 7516 | GeocacheFoundLogEvent | nipCCGeocaching/foundLog | `content` | | 8333 | OnchainZapEvent | nipBCOnchainZaps/zap | `content` | -| 9002 | EditMetadataEvent | nip29RelayGroups/moderation | `(listOfNotNull(name(), about()) + hashtags())` NL | -| 9041 | GoalEvent | nip75ZapGoals | `listOfNotNull(summary(), content)` NL | +| 9002 | GroupEditMetadataEvent | nip29RelayGroups/moderation | `(listOfNotNull(name(), about()) + hashtags())` NL | +| 9041 | ZapGoalEvent | nip75ZapGoals | `listOfNotNull(summary(), content)` NL | | 9321 | NutzapEvent | nip61Nutzaps/nutzap | `content` | -| 9734 | LnZapRequestEvent | nip57Zaps | `content` | -| 9735 | LnZapEvent | nip57Zaps | `zapRequest?.content.orEmpty()` — indexes the **embedded 9734's** content | +| 9734 | ZapRequestEvent | nip57Zaps | `content` | +| 9735 | ZapReceiptEvent | nip57Zaps | `zapRequest?.content.orEmpty()` — indexes the **embedded 9734's** content | | 9736 | Bolt12ZapEvent | nipB1Bolt12Zaps/zap | `content` | | 9737 | Bolt12ZapIntentEvent | nipB1Bolt12Zaps/intent | `content` | | 9802 | HighlightEvent | nip84Highlights | `listOfNotNull(comment(), context(), content)` NL | @@ -74,10 +74,10 @@ Separator legend: **NL** = `joinToString("\n")`, **SP** = `joinToString(" ")`. | 12473 | BirdexEvent | experimental/birdstar | `(listOfNotNull(summary()) + speciesNames())` NL | | 15128 | RootSiteEvent | nip5aStaticWebsites | `listOfNotNull(title(), description())` NL | | 15129 | RootNappletEvent | nip5dNapplets | `listOfNotNull(title(), description())` NL | -| 30000 | PeopleListEvent | nip51Lists/peopleList | `listOfNotNull(titleOrName(), description())` NL | +| 30000 | FollowSetEvent | nip51Lists/peopleList | `listOfNotNull(titleOrName(), description())` NL | | 30001 | OldBookmarkListEvent | nip51Lists/bookmarkList | `listOfNotNull(title())` NL | | 30002 | RelaySetEvent | nip51Lists/relaySets | `listOfNotNull(title(), description())` NL | -| 30003 | LabeledBookmarkListEvent | nip51Lists/labeledBookmarkList | `listOfNotNull(titleOrName(), description())` NL | +| 30003 | BookmarkSetEvent | nip51Lists/labeledBookmarkList | `listOfNotNull(titleOrName(), description())` NL | | 30004 | ArticleCurationSetEvent | nip51Lists/articleCurationSet | `listOfNotNull(title(), description())` NL | | 30005 | VideoCurationSetEvent | nip51Lists/videoCurationSet | `listOfNotNull(title(), description())` NL | | 30006 | PictureCurationSetEvent | nip51Lists/pictureCurationSet | `listOfNotNull(title(), description())` NL | @@ -87,7 +87,7 @@ Separator legend: **NL** = `joinToString("\n")`, **SP** = `joinToString(" ")`. | 30018 | ProductEvent | nip15Marketplace/product | `productData()?.let { (listOfNotNull(it.name, it.description) + categories()).joinToString("\n") } ?: ""` | | 30019 | MarketplaceEvent | nip15Marketplace/marketplace | `marketplaceData()?.let { listOfNotNull(it.name, it.about).joinToString("\n") } ?: ""` | | 30020 | AuctionEvent | nip15Marketplace/auction | `auctionData()?.let { (listOfNotNull(it.name, it.description) + tags.hashtags()).joinToString("\n") } ?: ""` | -| 30023 | LongTextNoteEvent | nip23LongContent | `listOfNotNull(title(), summary(), content)` NL | +| 30023 | LongFormContentEvent | nip23LongContent | `listOfNotNull(title(), summary(), content)` NL | | 30030 | EmojiPackEvent | nip30CustomEmoji/pack | `listOfNotNull(titleOrName(), description(), content)` NL | | 30054 | Podcasting20EpisodeEvent | nipXXPodcasting20/episode | `(listOfNotNull(title(), description(), content) + topics())` NL | | 30055 | Podcasting20TrailerEvent | nipXXPodcasting20/trailer | `listOfNotNull(title(), content)` NL | @@ -101,8 +101,8 @@ Separator legend: **NL** = `joinToString("\n")`, **SP** = `joinToString(" ")`. | 30311 | LiveActivitiesEvent | nip53LiveActivities/streaming | `listOfNotNull(title(), summary(), content)` NL | | 30312 | MeetingSpaceEvent | nip53LiveActivities/meetingSpaces | `listOfNotNull(room(), summary(), content)` NL | | 30313 | MeetingRoomEvent | nip53LiveActivities/meetingSpaces | `listOfNotNull(title(), summary())` NL | -| 30315 | StatusEvent | nip38UserStatus | `content` | -| 30382 | ContactCardEvent | nip85TrustedAssertions/users | `(listOfNotNull(petName(), summary()) + topics())` NL — public tags only, never the NIP-44 content | +| 30315 | UserStatusEvent | nip38UserStatus | `content` | +| 30382 | UserAssertionEvent | nip85TrustedAssertions/users | `(listOfNotNull(petName(), summary()) + topics())` NL — public tags only, never the NIP-44 content | | 30392 | UserTrustedListEvent | experimental/trustedLists/users | inherited `TrustedListEvent`: `title() ?: ""` — the label only; `metric`/`d` are machine ids and `content` is a JSON echo of the membership | | 30393 | EventTrustedListEvent | experimental/trustedLists/events | inherited `TrustedListEvent`: `title() ?: ""` | | 30394 | AddressableTrustedListEvent | experimental/trustedLists/addressables | inherited `TrustedListEvent`: `title() ?: ""` | @@ -111,7 +111,7 @@ Separator legend: **NL** = `joinToString("\n")`, **SP** = `joinToString(" ")`. | 30617 | GitRepositoryEvent | nip34Git/repository | `listOfNotNull(name(), description(), content)` NL | | 30620 | WorkflowDefEvent | buzz/workflow | `listOfNotNull(name(), content)` NL | | 30817 | NipTextEvent | experimental/nipsOnNostr | `listOfNotNull(title(), content)` NL | -| 30818 | WikiNoteEvent | nip54Wiki | `listOfNotNull(title(), summary(), content)` NL | +| 30818 | WikiArticleEvent | nip54Wiki | `listOfNotNull(title(), summary(), content)` NL | | 31337 | AudioTrackEvent | experimental/audio/track | `listOfNotNull(subject())` NL | | 31871 | AttestationEvent | experimental/attestations/attestation | `content` | | 31872 | AttestationRequestEvent | experimental/attestations/request | `content` | @@ -119,15 +119,15 @@ Separator legend: **NL** = `joinToString("\n")`, **SP** = `joinToString(" ")`. | 31890 | FeedDefinitionEvent | feedDefinition | `title().orEmpty()` | | 31922 | CalendarDateSlotEvent | nip52Calendar/appt/day | `listOfNotNull(title(), summary(), content)` NL | | 31923 | CalendarTimeSlotEvent | nip52Calendar/appt/time | `listOfNotNull(title(), summary(), content)` NL | -| 31924 | CalendarEvent | nip52Calendar/calendar | `listOfNotNull(title(), content)` NL | +| 31924 | CalendarCollectionEvent | nip52Calendar/calendar | `listOfNotNull(title(), content)` NL | | 31925 | CalendarRSVPEvent | nip52Calendar/rsvp | `content` | | 31990 | AppDefinitionEvent | nip89AppHandlers/definition | `appMetaData()?.let { listOfNotNull(it.name, it.username, it.displayName, it.about, it.nip05, it.lud06, it.lud16, it.website, it.picture, it.banner, it.image).joinToString(" ") } ?: ""` (SP) | | 32267 | SoftwareApplicationEvent | experimental/nip82SoftwareApps/application | `listOfNotNull(name(), summary(), content)` NL | | 33401 | ExerciseTemplateEvent | experimental/fitness/workout | `listOfNotNull(title(), content)` NL | | 33863 | FundraiserEvent | experimental/agora | `listOfNotNull(title(), content)` NL | | 34139 | MusicPlaylistEvent | experimental/music/playlist | `listOfNotNull(title(), description(), content)` NL | -| 34235 | VideoHorizontalEvent | nip71Video | inherited `AddressableVideoEvent`: `listOfNotNull(title(), content)` NL | -| 34236 | VideoVerticalEvent | nip71Video | inherited `AddressableVideoEvent`: `listOfNotNull(title(), content)` NL | +| 34235 | AddressableNormalVideoEvent | nip71Video | inherited `AddressableVideoEvent`: `listOfNotNull(title(), content)` NL | +| 34236 | AddressableShortVideoEvent | nip71Video | inherited `AddressableVideoEvent`: `listOfNotNull(title(), content)` NL | | 34550 | CommunityDefinitionEvent | nip72ModCommunities/definition | `listOfNotNull(name(), description(), rules(), content)` NL | | 35128 | NamedSiteEvent | nip5aStaticWebsites | `listOfNotNull(title(), description())` NL | | 35129 | NamedNappletEvent | nip5dNapplets | `listOfNotNull(title(), description())` NL | @@ -138,7 +138,7 @@ Separator legend: **NL** = `joinToString("\n")`, **SP** = `joinToString(" ")`. | 38192 | Ps1SaveEvent | experimental/ps1saves | `listOfNotNull(summary(), saveTitle(), region(), filename())` NL | | 38383 | P2POrderEvent | nip69P2pOrderEvents | `(listOfNotNull(makerName(), currency()) + paymentMethods().orEmpty()).joinToString(" ")` (SP) | | 39000 | GroupMetadataEvent | nip29RelayGroups/metadata | `listOfNotNull(name(), about())` NL | -| 39089 | FollowListEvent | nip51Lists/followList | `listOfNotNull(title(), description())` NL | +| 39089 | StarterPackEvent | nip51Lists/followList | `listOfNotNull(title(), description())` NL | | 39092 | MediaStarterPackEvent | nip51Lists/mediaStarterPack | `listOfNotNull(title(), description())` NL | | 39307 | TextTrackEvent | nip71Video/textTrack | `content` (the WebVTT cue text) | | 39701 | WebBookmarkEvent | nipB0WebBookmarks | `listOfNotNull(title(), description())` NL | diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/LocalPreferences.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/LocalPreferences.kt index a0acb8bad9..7f1b0da472 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/LocalPreferences.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/LocalPreferences.kt @@ -54,19 +54,19 @@ import com.vitorpamplona.quartz.nip01Core.core.toHexKey import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip19Bech32.toNpub -import com.vitorpamplona.quartz.nip28PublicChat.list.ChannelListEvent +import com.vitorpamplona.quartz.nip28PublicChat.list.PublicChatListEvent import com.vitorpamplona.quartz.nip37Drafts.privateOutbox.PrivateOutboxRelayListEvent import com.vitorpamplona.quartz.nip47WalletConnect.Nip47WalletConnect import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent import com.vitorpamplona.quartz.nip51Lists.favoriteAlgoFeedsList.FavoriteAlgoFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.geohashList.GeohashListEvent -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BlockedRelayListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.simpleGroupList.SimpleGroupListEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent @@ -887,19 +887,19 @@ object LocalPreferences { val pendingAttestations = async { parseOrNull>(pendingAttestationsStr) ?: mapOf() } val latestUserMetadata = async { parseEventOrNull(latestUserMetadataStr) } val latestContactList = async { parseEventOrNull(latestContactListStr) } - val latestDmRelayList = async { parseEventOrNull(latestDmRelayListStr) } + val latestDmRelayList = async { parseEventOrNull(latestDmRelayListStr) } val latestNip65RelayList = async { parseEventOrNull(latestNip65RelayListStr) } val latestSearchRelayList = async { parseEventOrNull(latestSearchRelayListStr) } val latestIndexRelayList = async { parseEventOrNull(latestIndexRelayListStr) } - val latestRelayFeedsList = async { parseEventOrNull(latestRelayFeedsListStr) } + val latestRelayFeedsList = async { parseEventOrNull(latestRelayFeedsListStr) } val latestBlockedRelayList = async { parseEventOrNull(latestBlockedRelayListStr) } val latestTrustedRelayList = async { parseEventOrNull(latestTrustedRelayListStr) } val latestMuteList = async { parseEventOrNull(latestMuteListStr) } val latestPrivateHomeRelayList = async { parseEventOrNull(latestPrivateHomeRelayListStr) } val latestAppSpecificData = async { parseEventOrNull(latestAppSpecificDataStr) } - val latestChannelList = async { parseEventOrNull(latestChannelListStr) } + val latestChannelList = async { parseEventOrNull(latestChannelListStr) } val latestCommunityList = async { parseEventOrNull(latestCommunityListStr) } - val latestHashtagList = async { parseEventOrNull(latestHashtagListStr) } + val latestHashtagList = async { parseEventOrNull(latestHashtagListStr) } val latestGeohashList = async { parseEventOrNull(latestGeohashListStr) } val latestEphemeralList = async { parseEventOrNull(latestEphemeralListStr) } val latestRelayGroupList = async { parseEventOrNull(latestRelayGroupListStr) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Account.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Account.kt index 406c21e081..438be42d4f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Account.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Account.kt @@ -238,8 +238,8 @@ import com.vitorpamplona.quartz.nip01Core.tags.people.taggedUserIds import com.vitorpamplona.quartz.nip01Core.tags.references.references import com.vitorpamplona.quartz.nip03Timestamp.OtsResolver import com.vitorpamplona.quartz.nip04Dm.PrivateDMCache -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip10Notes.content.findHashtags import com.vitorpamplona.quartz.nip10Notes.content.findNostrUris @@ -281,10 +281,10 @@ import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.tags.AddressBookmark import com.vitorpamplona.quartz.nip56Reports.ReportEvent import com.vitorpamplona.quartz.nip56Reports.ReportType -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent import com.vitorpamplona.quartz.nip57Zaps.PrivateZapCache +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip57Zaps.splits.ZapSplitSetup import com.vitorpamplona.quartz.nip57Zaps.splits.zapSplits import com.vitorpamplona.quartz.nip57Zaps.zapraiser.zapraiser @@ -320,10 +320,10 @@ import com.vitorpamplona.quartz.nip88Polls.poll.tags.PollType import com.vitorpamplona.quartz.nip88Polls.response.PollResponseEvent import com.vitorpamplona.quartz.nip89AppHandlers.clientTag.NostrSignerWithClientTag import com.vitorpamplona.quartz.nip89AppHandlers.clientTag.withoutClientTag -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.NIP90ContentDiscoveryRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.DvmContentDiscoveryRequestEvent import com.vitorpamplona.quartz.nip92IMeta.IMetaTag import com.vitorpamplona.quartz.nip92IMeta.imetas -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent import com.vitorpamplona.quartz.nip94FileMetadata.blurhash import com.vitorpamplona.quartz.nip94FileMetadata.dimension import com.vitorpamplona.quartz.nip94FileMetadata.fileSize @@ -1283,7 +1283,7 @@ class Account( suspend fun updateZapAmounts( amountSet: List, - selectedZapType: LnZapEvent.ZapType, + selectedZapType: ZapReceiptEvent.ZapType, nip47Update: Nip47WalletConnect.Nip47URINorm?, ) { var changed = false @@ -1707,7 +1707,7 @@ class Account( if (myNotes.isNotEmpty()) { // chunks in 200 elements to avoid going over the 65KB limit for events. myNotes.chunked(200).forEach { chunkedList -> - val template = DeletionEvent.build(chunkedList.mapNotNull { it.event }) + val template = DeletionRequestEvent.build(chunkedList.mapNotNull { it.event }) val deletionEvent = signer.sign(template) val myRelayList = outboxRelays.flow.value.toMutableSet() chunkedList.forEach { @@ -1738,7 +1738,7 @@ class Account( val recipients = (targetEvent.taggedUserIds() + targetEvent.pubKey).distinct().minus(signer.pubKey) broadcastPrivately( - NIP17Factory().createDeletionNIP17(DeletionEvent.build(myRumors), recipients, signer), + NIP17Factory().createDeletionNIP17(DeletionRequestEvent.build(myRumors), recipients, signer), ) } @@ -1749,7 +1749,7 @@ class Account( if (!isWriteable()) return if (event.pubKey != signer.pubKey) return - val deletionEvent = signer.sign(DeletionEvent.build(listOf(event))) + val deletionEvent = signer.sign(DeletionRequestEvent.build(listOf(event))) client.publish(deletionEvent, outboxRelays.flow.value + additionalRelays) cache.justConsumeMyOwnEvent(deletionEvent) } @@ -2176,7 +2176,7 @@ class Account( suspend fun deleteWebBookmark(event: WebBookmarkEvent) { if (!isWriteable()) return - val template = DeletionEvent.build(listOf(event)) + val template = DeletionRequestEvent.build(listOf(event)) val signedEvent = signer.sign(template) cache.justConsumeMyOwnEvent(signedEvent) @@ -2212,7 +2212,7 @@ class Account( if (!isWriteable()) return if (event.pubKey != signer.pubKey) return - val template = DeletionEvent.build(listOf(event)) + val template = DeletionRequestEvent.build(listOf(event)) val signedEvent = signer.sign(template) cache.justConsumeMyOwnEvent(signedEvent) @@ -2597,7 +2597,7 @@ class Account( } } } else { - FileHeaderEvent.build(url, alt) { + FileMetadataEvent.build(url, alt) { hash(headerInfo.hash) fileSize(headerInfo.size) @@ -2711,7 +2711,7 @@ class Account( val extraRelays = draftNote.relays val deletedDraft = DraftWrapEvent.createDeletedEvent(draftTag, signer) - val deletionEvent = signer.sign(DeletionEvent.build(listOf(deletedDraft))) + val deletionEvent = signer.sign(DeletionRequestEvent.build(listOf(deletedDraft))) val relayList = (privateStorageRelayList.flow.value + localRelayList.flow.value + extraRelays).toSet() @@ -2937,7 +2937,7 @@ class Account( broadcast.forEach { client.publish(it, relayList) } } - override suspend fun sendNip04PrivateMessage(eventTemplate: EventTemplate) { + override suspend fun sendNip04PrivateMessage(eventTemplate: EventTemplate) { if (!isWriteable()) return val newEvent = signer.sign(eventTemplate) @@ -3481,10 +3481,10 @@ class Account( suspend fun requestDVMContentDiscovery( dvmPublicKey: User, - onReady: (event: NIP90ContentDiscoveryRequestEvent, relays: Set) -> Unit, + onReady: (event: DvmContentDiscoveryRequestEvent, relays: Set) -> Unit, ) { val relays = nip65RelayList.inboxFlow.value.toSet() - val request = signer.sign(NIP90ContentDiscoveryRequestEvent.build(dvmPublicKey.pubkeyHex, signer.pubKey, relays)) + val request = signer.sign(DvmContentDiscoveryRequestEvent.build(dvmPublicKey.pubkeyHex, signer.pubKey, relays)) val relayList = dvmPublicKey.inboxRelays()?.toSet()?.ifEmpty { null } @@ -3503,8 +3503,8 @@ class Account( return if (isWriteable()) { when { - event is PrivateDmEvent -> privateDMDecryptionCache.cachedDM(event) - event is LnZapRequestEvent && event.isPrivateZap() -> privateZapsDecryptionCache.cachedPrivateZap(event)?.content + event is EncryptedDmEvent -> privateDMDecryptionCache.cachedDM(event) + event is ZapRequestEvent && event.isPrivateZap() -> privateZapsDecryptionCache.cachedPrivateZap(event)?.content event is DraftWrapEvent -> draftsDecryptionCache.preCachedDraft(event)?.content else -> event.content } @@ -3519,11 +3519,11 @@ class Account( suspend fun decryptContent(note: Note): String? { val event = note.event return when { - event is PrivateDmEvent && isWriteable() -> { + event is EncryptedDmEvent && isWriteable() -> { privateDMDecryptionCache.decryptDM(event) } - event is LnZapRequestEvent && isWriteable() -> { + event is ZapRequestEvent && isWriteable() -> { if (event.isPrivateZap()) { if (isWriteable()) { privateZapsDecryptionCache.decryptPrivateZap(event)?.content @@ -3550,7 +3550,7 @@ class Account( } } - suspend fun decryptZapOrNull(event: LnZapRequestEvent): LnZapPrivateEvent? = if (event.isPrivateZap() && isWriteable()) privateZapsDecryptionCache.decryptPrivateZap(event) else null + suspend fun decryptZapOrNull(event: ZapRequestEvent): LnZapPrivateEvent? = if (event.isPrivateZap() && isWriteable()) privateZapsDecryptionCache.decryptPrivateZap(event) else null fun isAllHidden(users: Set): Boolean = users.all { isHidden(it) } @@ -3602,7 +3602,7 @@ class Account( note.countReportAuthorsBy(followingKeySet()) < reportWarningThreshold } - fun isDecryptedContentHidden(noteEvent: PrivateDmEvent): Boolean = + fun isDecryptedContentHidden(noteEvent: EncryptedDmEvent): Boolean = if (hiddenUsers.flow.value.hiddenWordsCase .isNotEmpty() ) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountRelayGroupActions.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountRelayGroupActions.kt index 33612b11ef..884213d17f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountRelayGroupActions.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountRelayGroupActions.kt @@ -58,15 +58,15 @@ import com.vitorpamplona.quartz.nip29RelayGroups.GroupId import com.vitorpamplona.quartz.nip29RelayGroups.hTag import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMetadataEvent import com.vitorpamplona.quartz.nip29RelayGroups.moderation.CreateGroupEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.CreateInviteEvent import com.vitorpamplona.quartz.nip29RelayGroups.moderation.DeleteGroupEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.EditMetadataEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.PutUserEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.RemoveUserEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.UpdatePinListEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupCreateInviteEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupEditMetadataEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupPutUserEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupRemoveUserEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupUpdatePinListEvent import com.vitorpamplona.quartz.nip29RelayGroups.moderation.previous -import com.vitorpamplona.quartz.nip29RelayGroups.request.JoinRequestEvent -import com.vitorpamplona.quartz.nip29RelayGroups.request.LeaveRequestEvent +import com.vitorpamplona.quartz.nip29RelayGroups.request.GroupJoinRequestEvent +import com.vitorpamplona.quartz.nip29RelayGroups.request.GroupLeaveRequestEvent import com.vitorpamplona.quartz.nip29RelayGroups.tags.GroupIdTag import com.vitorpamplona.quartz.nip7DThreads.ThreadEvent import com.vitorpamplona.quartz.utils.RandomInstance @@ -92,7 +92,7 @@ class AccountRelayGroupActions( channel: RelayGroupChannel, code: String? = null, ) { - val template = JoinRequestEvent.build(channel.groupId.id, inviteCode = code) + val template = GroupJoinRequestEvent.build(channel.groupId.id, inviteCode = code) account.broadcaster.signAndSendPrivatelyOrBroadcast(template) { channel.relays().toList() } account.follow(channel) } @@ -295,7 +295,7 @@ class AccountRelayGroupActions( /** Send a kind 9022 leave request to the host relay and drop it from our list. */ suspend fun leaveRelayGroup(channel: RelayGroupChannel) { - val template = LeaveRequestEvent.build(channel.groupId.id) + val template = GroupLeaveRequestEvent.build(channel.groupId.id) account.broadcaster.signAndSendPrivatelyOrBroadcast(template) { channel.relays().toList() } account.unfollow(channel) } @@ -351,7 +351,7 @@ class AccountRelayGroupActions( ) { listOf(relay) } val edit = - EditMetadataEvent.build( + GroupEditMetadataEvent.build( groupId, name = name, about = about, @@ -405,7 +405,7 @@ class AccountRelayGroupActions( channel: RelayGroupChannel, code: String, ) { - val template = CreateInviteEvent.build(channel.groupId.id, code) + val template = GroupCreateInviteEvent.build(channel.groupId.id, code) account.broadcaster.signAndSendPrivatelyOrBroadcast(template) { channel.relays().toList() } } @@ -418,7 +418,7 @@ class AccountRelayGroupActions( channel: RelayGroupChannel, pinnedEventIds: List, ) { - val template = UpdatePinListEvent.build(channel.groupId.id, pinnedEventIds) + val template = GroupUpdatePinListEvent.build(channel.groupId.id, pinnedEventIds) account.broadcaster.signAndSendPrivatelyOrBroadcast(template) { channel.relays().toList() } } @@ -445,7 +445,7 @@ class AccountRelayGroupActions( channel: RelayGroupChannel, pubkey: HexKey, ) { - val template = RemoveUserEvent.build(channel.groupId.id, listOf(pubkey)) + val template = GroupRemoveUserEvent.build(channel.groupId.id, listOf(pubkey)) account.broadcaster.signAndSendPrivatelyOrBroadcast(template) { channel.relays().toList() } } @@ -470,7 +470,7 @@ class AccountRelayGroupActions( } else { null } - val template = PutUserEvent.build(channel.groupId.id, listOf(pubkey to roles), buzzRole = buzzRole) + val template = GroupPutUserEvent.build(channel.groupId.id, listOf(pubkey to roles), buzzRole = buzzRole) account.broadcaster.signAndSendPrivatelyOrBroadcast(template) { channel.relays().toList() } } @@ -525,7 +525,7 @@ class AccountRelayGroupActions( // edit when we send that tag. A plain NIP-29 relay ignores it and honours the status flag. val isBuzz = BuzzRelayDialect.isBuzz(channel.groupId.relayUrl) val template = - EditMetadataEvent.build( + GroupEditMetadataEvent.build( channel.groupId.id, name = name, about = about, @@ -549,7 +549,7 @@ class AccountRelayGroupActions( channel: RelayGroupChannel, archived: Boolean, ) { - val template = EditMetadataEvent.build(channel.groupId.id, archived = archived) + val template = GroupEditMetadataEvent.build(channel.groupId.id, archived = archived) account.broadcaster.signAndSendPrivatelyOrBroadcast(template) { channel.relays().toList() } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSettings.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSettings.kt index e2613fbe36..b70197390c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSettings.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSettings.kt @@ -59,8 +59,8 @@ import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKey -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent -import com.vitorpamplona.quartz.nip28PublicChat.list.ChannelListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent +import com.vitorpamplona.quartz.nip28PublicChat.list.PublicChatListEvent import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent import com.vitorpamplona.quartz.nip37Drafts.privateOutbox.PrivateOutboxRelayListEvent import com.vitorpamplona.quartz.nip42RelayAuth.RelayAuthEvent @@ -68,16 +68,16 @@ import com.vitorpamplona.quartz.nip47WalletConnect.Nip47WalletConnect import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent import com.vitorpamplona.quartz.nip51Lists.favoriteAlgoFeedsList.FavoriteAlgoFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.geohashList.GeohashListEvent -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BlockedRelayListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.simpleGroupList.SimpleGroupListEvent import com.vitorpamplona.quartz.nip55AndroidSigner.api.CommandType import com.vitorpamplona.quartz.nip55AndroidSigner.api.permission.Permission -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip60Cashu.wallet.CashuWalletEvent import com.vitorpamplona.quartz.nip61Nutzaps.info.NutzapInfoEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent @@ -203,20 +203,20 @@ class AccountSettings( val showMessagesInNotifications: MutableStateFlow = MutableStateFlow(true), var backupUserMetadata: MetadataEvent? = null, var backupContactList: ContactListEvent? = null, - var backupDMRelayList: ChatMessageRelayListEvent? = null, + var backupDMRelayList: DmRelayListEvent? = null, var backupKeyPackageRelayList: KeyPackageRelayListEvent? = null, var backupNIP65RelayList: AdvertisedRelayListEvent? = null, var backupSearchRelayList: SearchRelayListEvent? = null, var backupIndexRelayList: IndexerRelayListEvent? = null, - var backupRelayFeedsList: RelayFeedsListEvent? = null, + var backupRelayFeedsList: FavoriteRelayListEvent? = null, var backupBlockedRelayList: BlockedRelayListEvent? = null, var backupTrustedRelayList: TrustedRelayListEvent? = null, var backupMuteList: MuteListEvent? = null, var backupPrivateHomeRelayList: PrivateOutboxRelayListEvent? = null, var backupAppSpecificData: AppSpecificDataEvent? = null, - var backupChannelList: ChannelListEvent? = null, + var backupChannelList: PublicChatListEvent? = null, var backupCommunityList: CommunityListEvent? = null, - var backupHashtagList: HashtagListEvent? = null, + var backupHashtagList: InterestListEvent? = null, var backupFavoriteAlgoFeedsList: FavoriteAlgoFeedsListEvent? = null, var backupGeohashList: GeohashListEvent? = null, var backupEphemeralChatList: EphemeralChatListEvent? = null, @@ -375,7 +375,7 @@ class AccountSettings( // Zaps and Reactions // --- - fun changeDefaultZapType(zapType: LnZapEvent.ZapType): Boolean { + fun changeDefaultZapType(zapType: ZapReceiptEvent.ZapType): Boolean { if (syncedSettings.zaps.defaultZapType.value != zapType) { syncedSettings.zaps.defaultZapType.tryEmit(zapType) saveAccountSettings() @@ -1075,7 +1075,7 @@ class AccountSettings( when (incoming) { is MetadataEvent -> updateUserMetadata(incoming) is ContactListEvent -> updateContactListTo(incoming) - is ChatMessageRelayListEvent -> updateDMRelayList(incoming) + is DmRelayListEvent -> updateDMRelayList(incoming) is KeyPackageRelayListEvent -> updateKeyPackageRelayList(incoming) is AdvertisedRelayListEvent -> updateNIP65RelayList(incoming) is CashuWalletEvent -> updateCashuWallet(incoming) @@ -1084,13 +1084,13 @@ class AccountSettings( is Bolt12OfferListEvent -> updateBolt12Offers(incoming) is SearchRelayListEvent -> updateSearchRelayList(incoming) is IndexerRelayListEvent -> updateIndexRelayList(incoming) - is RelayFeedsListEvent -> updateRelayFeedList(incoming) + is FavoriteRelayListEvent -> updateRelayFeedList(incoming) is BlockedRelayListEvent -> updateBlockedRelayList(incoming) is TrustedRelayListEvent -> updateTrustedRelayList(incoming) is PrivateOutboxRelayListEvent -> updatePrivateHomeRelayList(incoming) - is ChannelListEvent -> updateChannelListTo(incoming) + is PublicChatListEvent -> updateChannelListTo(incoming) is GeohashListEvent -> updateGeohashListTo(incoming) - is HashtagListEvent -> updateHashtagListTo(incoming) + is InterestListEvent -> updateHashtagListTo(incoming) is FavoriteAlgoFeedsListEvent -> updateFavoriteAlgoFeedsListTo(incoming) is CommunityListEvent -> updateCommunityListTo(incoming) is EphemeralChatListEvent -> updateEphemeralChatListTo(incoming) @@ -1140,7 +1140,7 @@ class AccountSettings( } } - fun updateDMRelayList(newDMRelayList: ChatMessageRelayListEvent?) { + fun updateDMRelayList(newDMRelayList: DmRelayListEvent?) { if (newDMRelayList == null) return if (backupGuard.accept(backupDMRelayList, newDMRelayList, isEmpty = newDMRelayList.tags.isEmpty()) { updateDMRelayList(newDMRelayList) }) { @@ -1284,7 +1284,7 @@ class AccountSettings( } } - fun updateRelayFeedList(newRelayFeedList: RelayFeedsListEvent?) { + fun updateRelayFeedList(newRelayFeedList: FavoriteRelayListEvent?) { if (newRelayFeedList == null) return if (backupGuard.accept(backupRelayFeedsList, newRelayFeedList, isEmpty = newRelayFeedList.tags.isEmpty()) { updateRelayFeedList(newRelayFeedList) }) { @@ -1322,7 +1322,7 @@ class AccountSettings( override fun channelList() = backupChannelList - override fun updateChannelListTo(newChannelList: ChannelListEvent?) { + override fun updateChannelListTo(newChannelList: PublicChatListEvent?) { if (newChannelList == null) return if (backupGuard.accept(backupChannelList, newChannelList, isEmpty = newChannelList.tags.isEmpty()) { updateChannelListTo(newChannelList) }) { @@ -1340,7 +1340,7 @@ class AccountSettings( } } - fun updateHashtagListTo(newHashtagList: HashtagListEvent?) { + fun updateHashtagListTo(newHashtagList: InterestListEvent?) { if (newHashtagList == null) return if (backupGuard.accept(backupHashtagList, newHashtagList, isEmpty = newHashtagList.tags.isEmpty()) { updateHashtagListTo(newHashtagList) }) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSyncedSettings.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSyncedSettings.kt index 3d1047d25a..3acb2ed75a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSyncedSettings.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSyncedSettings.kt @@ -31,7 +31,7 @@ import com.vitorpamplona.amethyst.commons.service.pow.PoWCategory import com.vitorpamplona.amethyst.commons.service.pow.PoWPolicy import com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications.equalImmutableLists import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKey -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.flow.MutableStateFlow @@ -265,7 +265,7 @@ class AccountVideoPlayerPreferences( @Stable class AccountZapPreferences( var zapAmountChoices: MutableStateFlow>, - val defaultZapType: MutableStateFlow, + val defaultZapType: MutableStateFlow, ) /** diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSyncedSettingsInternal.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSyncedSettingsInternal.kt index b167b7ba62..de721aefbe 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSyncedSettingsInternal.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountSyncedSettingsInternal.kt @@ -25,7 +25,7 @@ import androidx.core.os.ConfigurationCompat import com.vitorpamplona.amethyst.commons.model.navigation.BottomBarEntry import com.vitorpamplona.amethyst.commons.service.pow.PoWCategory import com.vitorpamplona.amethyst.ui.navigation.bottombars.DefaultBottomBarEntries -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import kotlinx.serialization.Serializable import java.util.Locale @@ -207,7 +207,7 @@ class AccountZapPreferencesInternal( // and so the on-chain-eligible subset round-trips back for them; on load it // is unioned into [zapAmountChoices]. See AccountSyncedSettings. var onchainZapAmountChoices: List = DefaultOnchainZapAmounts, - val defaultZapType: LnZapEvent.ZapType = LnZapEvent.ZapType.PUBLIC, + val defaultZapType: ZapReceiptEvent.ZapType = ZapReceiptEvent.ZapType.PUBLIC, ) @Serializable diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountZapActions.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountZapActions.kt index 4bcfcaef46..cf994956f6 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountZapActions.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/AccountZapActions.kt @@ -48,8 +48,8 @@ import com.vitorpamplona.quartz.nip47WalletConnect.rpc.PayMethod import com.vitorpamplona.quartz.nip47WalletConnect.rpc.PaySuccessResponse import com.vitorpamplona.quartz.nip47WalletConnect.rpc.Request import com.vitorpamplona.quartz.nip47WalletConnect.rpc.Response -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nipB1Bolt12Zaps.builder.Bolt12ZapBuilder import com.vitorpamplona.quartz.nipB1Bolt12Zaps.verify.Bolt12ZapValidation import com.vitorpamplona.quartz.utils.Log @@ -74,12 +74,12 @@ class AccountZapActions( event: Event, pollOption: Int?, message: String = "", - zapType: LnZapEvent.ZapType, + zapType: ZapReceiptEvent.ZapType, toUser: User?, additionalRelays: Set? = null, amountMillisats: Long? = null, lnurl: String? = null, - ) = LnZapRequestEvent.create( + ) = ZapRequestEvent.create( zappedEvent = event, // Where the provider should publish the receipt. Zapping group content pins that to the room's // host relay: the receipt belongs where the message it pays for lives, so the room can show it @@ -205,7 +205,7 @@ class AccountZapActions( offer: String, amountMillisats: Long, message: String, - zapType: LnZapEvent.ZapType, + zapType: ZapReceiptEvent.ZapType, // (messageResId, detail) — the caller localizes; detail carries a wallet error, if any. onError: (StringResource, String?) -> Unit, // (code, detail) — the wallet refused or failed the payment; no funds moved. @@ -215,7 +215,7 @@ class AccountZapActions( ) { // NONZAP means "pay, but publish no receipt" — settle the offer without binding // a zap intent or emitting a 9736, matching the privacy of a bolt11 NONZAP. - if (zapType == LnZapEvent.ZapType.NONZAP) { + if (zapType == ZapReceiptEvent.ZapType.NONZAP) { sendNwcRequest(PayMethod.create("bitcoin:?lno=$offer", amountMillisats), onTimeout) { response -> account.scope.launch { try { @@ -228,7 +228,7 @@ class AccountZapActions( return } - val anonymous = zapType == LnZapEvent.ZapType.ANONYMOUS + val anonymous = zapType == ZapReceiptEvent.ZapType.ANONYMOUS // The 9737 intent and the 9736 zap MUST be signed by the same key. An anonymous // zap uses a fresh ephemeral key so it carries no `P` tag and isn't traceable. val zapSigner = if (anonymous) NostrSignerInternal(KeyPair()) else account.signer @@ -284,12 +284,12 @@ class AccountZapActions( suspend fun createZapRequestFor( user: User, message: String = "", - zapType: LnZapEvent.ZapType, + zapType: ZapReceiptEvent.ZapType, amountMillisats: Long? = null, lnurl: String? = null, - ): LnZapRequestEvent { + ): ZapRequestEvent { val zapRequest = - LnZapRequestEvent.create( + ZapRequestEvent.create( userHex = user.pubkeyHex, relays = account.nip65RelayList.inboxFlow.value + (user.inboxRelays() ?: emptyList()), signer = account.signer, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/EventBroadcaster.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/EventBroadcaster.kt index 298fff1dff..9765753489 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/EventBroadcaster.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/EventBroadcaster.kt @@ -40,16 +40,16 @@ import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip17Dm.base.BaseDMGroupEvent -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip29RelayGroups.isGroupScoped import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.OldBookmarkListEvent -import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.LabeledBookmarkListEvent +import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.BookmarkSetEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingRoomEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingSpaceEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nip60Cashu.wallet.CashuWalletEvent import com.vitorpamplona.quartz.nip61Nutzaps.info.NutzapInfoEvent @@ -121,7 +121,7 @@ class EventBroadcaster( event is AppSpecificDataEvent || event is BookmarkListEvent || event is OldBookmarkListEvent || - event is LabeledBookmarkListEvent + event is BookmarkSetEvent ) { return false } @@ -166,7 +166,7 @@ class EventBroadcaster( } // Seals, inner DM messages, and unsigned rumors never get broadcast // relays: they only travel inside gift wraps. - if (event is SealedRumorEvent || event is BaseDMGroupEvent || event.sig.isEmpty()) { + if (event is SealEvent || event is BaseDMGroupEvent || event.sig.isEmpty()) { return emptySet() } @@ -322,7 +322,7 @@ class EventBroadcaster( .toList() } val filter = - if (host.kind == SealedRumorEvent.KIND) { + if (host.kind == SealEvent.KIND) { Filter( kinds = listOf(host.kind), ids = listOf(host.id), @@ -383,7 +383,7 @@ class EventBroadcaster( fun sendRestoredVersion(event: Event) { when (event) { is AdvertisedRelayListEvent -> sendEverywhereAnd(event, event.relays().mapTo(mutableSetOf()) { it.relayUrl }) - is ChatMessageRelayListEvent -> sendEverywhereAnd(event, event.relays().toSet()) + is DmRelayListEvent -> sendEverywhereAnd(event, event.relays().toSet()) is KeyPackageRelayListEvent -> sendEverywhereAnd(event, event.relays().toSet()) is CashuWalletEvent -> sendLiterallyEverywhere(event) // Profiles and nutzap info are normally saved everywhere so others can find them; diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/algoFeeds/FavoriteAlgoFeedsOrchestrator.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/algoFeeds/FavoriteAlgoFeedsOrchestrator.kt index 0496ad62dd..e8aa1a078b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/algoFeeds/FavoriteAlgoFeedsOrchestrator.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/algoFeeds/FavoriteAlgoFeedsOrchestrator.kt @@ -25,8 +25,8 @@ import com.vitorpamplona.quartz.nip01Core.core.Address import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.NIP90ContentDiscoveryResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.status.NIP90StatusEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.DvmContentDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.status.DvmStatusEvent import com.vitorpamplona.quartz.utils.Log import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CoroutineScope @@ -60,7 +60,7 @@ data class FavoriteAlgoFeedsSnapshot( val responseRelays: Set = emptySet(), val ids: Set = emptySet(), val addresses: Set = emptySet(), - val latestStatus: NIP90StatusEvent? = null, + val latestStatus: DvmStatusEvent? = null, val errorMessage: String? = null, ) @@ -139,9 +139,9 @@ class FavoriteAlgoFeedsOrchestrator( launch { account.cache - .observeLatestEvent( + .observeLatestEvent( Filter( - kinds = listOf(NIP90ContentDiscoveryResponseEvent.KIND), + kinds = listOf(DvmContentDiscoveryResponseEvent.KIND), tags = mapOf("e" to listOf(requestId)), limit = 1, ), @@ -159,9 +159,9 @@ class FavoriteAlgoFeedsOrchestrator( launch { account.cache - .observeLatestEvent( + .observeLatestEvent( Filter( - kinds = listOf(NIP90StatusEvent.KIND), + kinds = listOf(DvmStatusEvent.KIND), tags = mapOf("e" to listOf(requestId)), limit = 1, ), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip17Dms/DmRelayListState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip17Dms/DmRelayListState.kt index 360fd7309b..1f97c26b2f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip17Dms/DmRelayListState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip17Dms/DmRelayListState.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.model.AccountSettings import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.utils.Log import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.DelicateCoroutinesApi @@ -48,14 +48,14 @@ class DmRelayListState( // Creates a long-term reference for this note so that the GC doesn't collect the note it self val dmListNote = cache.getOrCreateAddressableNote(getDMRelayListAddress()) - fun getDMRelayListAddress() = ChatMessageRelayListEvent.createAddress(signer.pubKey) + fun getDMRelayListAddress() = DmRelayListEvent.createAddress(signer.pubKey) fun getDMRelayListFlow(): StateFlow = dmListNote.flow().metadata.stateFlow - fun getDMRelayList(): ChatMessageRelayListEvent? = dmListNote.event as? ChatMessageRelayListEvent + fun getDMRelayList(): DmRelayListEvent? = dmListNote.event as? DmRelayListEvent fun normalizeDMRelayListWithBackup(note: Note): Set { - val event = note.event as? ChatMessageRelayListEvent ?: settings.backupDMRelayList + val event = note.event as? DmRelayListEvent ?: settings.backupDMRelayList return event?.relays()?.toSet() ?: emptySet() } @@ -70,16 +70,16 @@ class DmRelayListState( emptySet(), ) - suspend fun saveRelayList(dmRelays: List): ChatMessageRelayListEvent { + suspend fun saveRelayList(dmRelays: List): DmRelayListEvent { val relayListForDMs = getDMRelayList() return if (relayListForDMs != null && relayListForDMs.tags.isNotEmpty()) { - ChatMessageRelayListEvent.updateRelayList( + DmRelayListEvent.updateRelayList( earlierVersion = relayListForDMs, relays = dmRelays, signer = signer, ) } else { - ChatMessageRelayListEvent.create( + DmRelayListEvent.create( relays = dmRelays, signer = signer, ) @@ -99,7 +99,7 @@ class DmRelayListState( Log.d("AccountRegisterObservers", "NIP-17 Relay List Collector Start") getDMRelayListFlow().collect { Log.d("AccountRegisterObservers") { "Updating DM Relay List for ${signer.pubKey}" } - (it.note.event as? ChatMessageRelayListEvent)?.let { + (it.note.event as? DmRelayListEvent)?.let { settings.updateDMRelayList(it) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip30CustomEmojis/OwnedEmojiPacksState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip30CustomEmojis/OwnedEmojiPacksState.kt index 7021497479..b9af0de585 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip30CustomEmojis/OwnedEmojiPacksState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip30CustomEmojis/OwnedEmojiPacksState.kt @@ -33,7 +33,7 @@ import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.SignerExceptions import com.vitorpamplona.quartz.nip01Core.signers.update -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip30CustomEmoji.EmojiUrlTag import com.vitorpamplona.quartz.nip30CustomEmoji.emoji import com.vitorpamplona.quartz.nip30CustomEmoji.pack.EmojiPackEvent @@ -129,12 +129,12 @@ class OwnedEmojiPacksState( .onStart { emit(listFeedFlow.value.getPack(dTag)) } .flowOn(Dispatchers.IO) - fun DeletionEvent.hasAnyDeletedOwnedEmojiPacks() = deleteAddressesWithKind(EmojiPackEvent.KIND) || deletesAnyEventIn(ownedEmojiPackEventIds.value) + fun DeletionRequestEvent.hasAnyDeletedOwnedEmojiPacks() = deleteAddressesWithKind(EmojiPackEvent.KIND) || deletesAnyEventIn(ownedEmojiPackEventIds.value) fun hasItemInNoteList(notes: Set): Boolean = notes.anyNotNullEvent { event -> if (event.pubKey == signer.pubKey) { - event is EmojiPackEvent || (event is DeletionEvent && event.hasAnyDeletedOwnedEmojiPacks()) + event is EmojiPackEvent || (event is DeletionRequestEvent && event.hasAnyDeletedOwnedEmojiPacks()) } else { false } @@ -269,7 +269,7 @@ class OwnedEmojiPacksState( account: Account, ) { val packEvent = getOwnedEmojiPackEvent(dTag) ?: return - val deletionEventTemplate = DeletionEvent.build(listOf(packEvent)) + val deletionEventTemplate = DeletionRequestEvent.build(listOf(packEvent)) val deletionEvent = signer.sign(deletionEventTemplate) account.sendMyPublicAndPrivateOutbox(deletionEvent) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip47WalletConnect/NwcSignerState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip47WalletConnect/NwcSignerState.kt index 2252b83c4f..1c576e1a4f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip47WalletConnect/NwcSignerState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip47WalletConnect/NwcSignerState.kt @@ -36,10 +36,10 @@ import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip47WalletConnect.Nip47WalletConnect import com.vitorpamplona.quartz.nip47WalletConnect.cache.NostrWalletConnectRequestCache import com.vitorpamplona.quartz.nip47WalletConnect.cache.NostrWalletConnectResponseCache -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcInfoEvent import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcNotificationEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip47WalletConnect.rpc.NwcTransaction import com.vitorpamplona.quartz.nip47WalletConnect.rpc.PayInvoiceMethod import com.vitorpamplona.quartz.nip47WalletConnect.rpc.PaymentReceivedNotification @@ -199,12 +199,12 @@ class NwcSignerState( override fun isNIP47Author(pubKey: HexKey?): Boolean = nip47Signer.value.pubKey == pubKey - override suspend fun decryptRequest(event: LnZapPaymentRequestEvent): Request? { + override suspend fun decryptRequest(event: NwcRequestEvent): Request? { if (!hasWalletConnectSetup()) return null return zapPaymentRequestDecryptionCache.value.decryptRequest(event) } - override suspend fun decryptResponse(event: LnZapPaymentResponseEvent): Response? { + override suspend fun decryptResponse(event: NwcResponseEvent): Response? { if (!hasWalletConnectSetup()) return null return zapPaymentResponseDecryptionCache.value.decryptResponse(event) } @@ -252,7 +252,7 @@ class NwcSignerState( request: Request, onTimeout: () -> Unit = {}, onResponse: (Response?) -> Unit, - ): Pair = sendNwcRequestToWallet(defaultWalletUri.value, request, onTimeout, onResponse) + ): Pair = sendNwcRequestToWallet(defaultWalletUri.value, request, onTimeout, onResponse) /** * Sends a generic NIP-47 request to a specific wallet. @@ -266,14 +266,14 @@ class NwcSignerState( request: Request, onTimeout: () -> Unit = {}, onResponse: (Response?) -> Unit, - ): Pair { + ): Pair { val walletService = walletUri ?: throw IllegalArgumentException("No NIP47 setup") val walletSigner = buildSigner(walletService) ?: signer val info = walletInfo(walletService) request.dropMetadataIfUnsupported(info) - val event = LnZapPaymentRequestEvent.createRequest(request, walletService.pubKeyHex, walletSigner, useNip44 = prefersNip44(info)) + val event = NwcRequestEvent.createRequest(request, walletService.pubKeyHex, walletSigner, useNip44 = prefersNip44(info)) val filter = NWCPaymentQueryState( @@ -314,7 +314,7 @@ class NwcSignerState( onTimeout: () -> Unit = {}, metadata: Map? = null, onResponse: (Response?) -> Unit, - ): Pair { + ): Pair { val walletService = defaultWalletUri.value ?: throw IllegalArgumentException("No NIP47 setup") val info = walletInfo(walletService) @@ -322,7 +322,7 @@ class NwcSignerState( request.dropMetadataIfUnsupported(info) val event = - LnZapPaymentRequestEvent.createRequest( + NwcRequestEvent.createRequest( request, walletService.pubKeyHex, nip47Signer.value, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/hashtagLists/HashtagListState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/hashtagLists/HashtagListState.kt index 92869bfbb5..8ef88a5e24 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/hashtagLists/HashtagListState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/hashtagLists/HashtagListState.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.commons.model.nip51Lists.hashtagLists.HashtagListDecryptionCache import com.vitorpamplona.amethyst.model.AccountSettings import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent import com.vitorpamplona.quartz.utils.Log import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.DelicateCoroutinesApi @@ -50,14 +50,14 @@ class HashtagListState( // Creates a long-term reference for this note so that the GC doesn't collect the note it self val hashtagListNote = cache.getOrCreateAddressableNote(getHashtagListAddress()) - fun getHashtagListAddress() = HashtagListEvent.createAddress(signer.pubKey) + fun getHashtagListAddress() = InterestListEvent.createAddress(signer.pubKey) fun getHashtagListFlow(): StateFlow = hashtagListNote.flow().metadata.stateFlow - fun getHashtagList(): HashtagListEvent? = hashtagListNote.event as? HashtagListEvent + fun getHashtagList(): InterestListEvent? = hashtagListNote.event as? InterestListEvent suspend fun hashtagListWithBackup(note: Note): Set { - val event = note.event as? HashtagListEvent ?: settings.backupHashtagList + val event = note.event as? InterestListEvent ?: settings.backupHashtagList return event?.let { decryptionCache.hashtags(it).mapTo(mutableSetOf()) { it.lowercase() } } ?: emptySet() } @@ -75,31 +75,31 @@ class HashtagListState( emptySet(), ) - suspend fun follow(hashtags: List): HashtagListEvent { + suspend fun follow(hashtags: List): InterestListEvent { val hashtagList = getHashtagList() return if (hashtagList == null) { - HashtagListEvent.create(hashtags, true, signer) + InterestListEvent.create(hashtags, true, signer) } else { - HashtagListEvent.add(hashtagList, hashtags, true, signer) + InterestListEvent.add(hashtagList, hashtags, true, signer) } } - suspend fun follow(hashtag: String): HashtagListEvent { + suspend fun follow(hashtag: String): InterestListEvent { val hashtagList = getHashtagList() return if (hashtagList == null) { - HashtagListEvent.create(hashtag.lowercase(), true, signer) + InterestListEvent.create(hashtag.lowercase(), true, signer) } else { - HashtagListEvent.add(hashtagList, hashtag.lowercase(), true, signer) + InterestListEvent.add(hashtagList, hashtag.lowercase(), true, signer) } } - suspend fun unfollow(hashtag: String): HashtagListEvent? { + suspend fun unfollow(hashtag: String): InterestListEvent? { val hashtagList = getHashtagList() return if (hashtagList != null) { - HashtagListEvent.remove(hashtagList, hashtag, signer) + InterestListEvent.remove(hashtagList, hashtag, signer) } else { null } @@ -118,7 +118,7 @@ class HashtagListState( Log.d("AccountRegisterObservers", "Hashtag List Collector Start") getHashtagListFlow().collect { Log.d("AccountRegisterObservers") { "Hashtag List for ${signer.pubKey}" } - (it.note.event as? HashtagListEvent)?.let { + (it.note.event as? InterestListEvent)?.let { settings.updateHashtagListTo(it) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/interestSets/InterestSetsState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/interestSets/InterestSetsState.kt index 487aa8748b..f70f9a13cb 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/interestSets/InterestSetsState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/interestSets/InterestSetsState.kt @@ -31,7 +31,7 @@ import com.vitorpamplona.amethyst.commons.model.nip51Lists.interestSets.Interest import com.vitorpamplona.amethyst.commons.model.updateFlow import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip51Lists.interestSet.InterestSetEvent import com.vitorpamplona.quartz.nip51Lists.tags.TitleTag import kotlinx.coroutines.CoroutineScope @@ -106,12 +106,12 @@ class InterestSetsState( fun getInterestSet(dTag: String) = listFeedFlow.value.getSet(dTag) - fun DeletionEvent.hasAnyDeletedInterestSets() = deleteAddressesWithKind(InterestSetEvent.KIND) || deletesAnyEventIn(interestSetEventIds.value) + fun DeletionRequestEvent.hasAnyDeletedInterestSets() = deleteAddressesWithKind(InterestSetEvent.KIND) || deletesAnyEventIn(interestSetEventIds.value) fun hasItemInNoteList(notes: Set): Boolean = notes.anyNotNullEvent { event -> if (event.pubKey == signer.pubKey) { - event is InterestSetEvent || (event is DeletionEvent && event.hasAnyDeletedInterestSets()) + event is InterestSetEvent || (event is DeletionRequestEvent && event.hasAnyDeletedInterestSets()) } else { false } @@ -178,7 +178,7 @@ class InterestSetsState( account: Account, ) { val event = getInterestSetEvent(identifier) - val template = DeletionEvent.build(listOf(event)) + val template = DeletionRequestEvent.build(listOf(event)) val deletionEvent = account.signer.sign(template) account.sendMyPublicAndPrivateOutbox(deletionEvent) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/labeledBookmarkLists/LabeledBookmarkListsState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/labeledBookmarkLists/LabeledBookmarkListsState.kt index 71626d7d4e..49a1c8b3d4 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/labeledBookmarkLists/LabeledBookmarkListsState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/labeledBookmarkLists/LabeledBookmarkListsState.kt @@ -33,11 +33,11 @@ import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.quartz.nip01Core.core.Address import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.update -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.tags.AddressBookmark import com.vitorpamplona.quartz.nip51Lists.bookmarkList.tags.BookmarkIdTag import com.vitorpamplona.quartz.nip51Lists.bookmarkList.tags.EventBookmark -import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.LabeledBookmarkListEvent +import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.BookmarkSetEvent import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.description import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.image import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.title @@ -62,7 +62,7 @@ class LabeledBookmarkListsState( ) { val user = cache.getOrCreateUser(signer.pubKey) - fun existingLabeledBookmarkNotes() = cache.addressables.filter(LabeledBookmarkListEvent.KIND, user.pubkeyHex) + fun existingLabeledBookmarkNotes() = cache.addressables.filter(BookmarkSetEvent.KIND, user.pubkeyHex) val labeledBookmarkListVersions = MutableStateFlow(0) @@ -81,14 +81,14 @@ class LabeledBookmarkListsState( .stateIn(scope, SharingStarted.Eagerly, emptySet()) @OptIn(ExperimentalCoroutinesApi::class) - val latestBookmarkLists: StateFlow> = + val latestBookmarkLists: StateFlow> = labeledBookmarkListNotes - .transformLatest { emitAll(it.updateFlow()) } + .transformLatest { emitAll(it.updateFlow()) } .onStart { emit(labeledBookmarkListNotes.value.events()) } .flowOn(Dispatchers.IO) .stateIn(scope, SharingStarted.Eagerly, emptyList()) - suspend fun LabeledBookmarkListEvent.toLabeledBookmarkList() = + suspend fun BookmarkSetEvent.toLabeledBookmarkList() = LabeledBookmarkList( identifier = dTag(), title = titleOrName() ?: dTag(), @@ -98,7 +98,7 @@ class LabeledBookmarkListsState( publicBookmarks = publicBookmarks().toSet(), ) - suspend fun List.toLabeledBookmarkListsFeed() = map { it.toLabeledBookmarkList() }.sortedBy { it.title } + suspend fun List.toLabeledBookmarkListsFeed() = map { it.toLabeledBookmarkList() }.sortedBy { it.title } val listFeedFlow = latestBookmarkLists @@ -114,12 +114,12 @@ class LabeledBookmarkListsState( fun getBookmarkList(dTag: String) = listFeedFlow.value.getList(bookmarkListId = dTag) - fun DeletionEvent.hasAnyDeletedBookmarkLists() = deleteAddressesWithKind(LabeledBookmarkListEvent.KIND) || deletesAnyEventIn(labeledBookmarkListEventIds.value) + fun DeletionRequestEvent.hasAnyDeletedBookmarkLists() = deleteAddressesWithKind(BookmarkSetEvent.KIND) || deletesAnyEventIn(labeledBookmarkListEventIds.value) fun hasItemInNoteList(notes: Set): Boolean = notes.anyNotNullEvent { event -> if (event.pubKey == signer.pubKey) { - event is LabeledBookmarkListEvent || (event is DeletionEvent && event.hasAnyDeletedBookmarkLists()) + event is BookmarkSetEvent || (event is DeletionRequestEvent && event.hasAnyDeletedBookmarkLists()) } else { false } @@ -143,7 +143,7 @@ class LabeledBookmarkListsState( fun getLabeledBookmarkListNote(bookmarkIdentifier: String): AddressableNote? = existingLabeledBookmarkNotes().find { it.dTag() == bookmarkIdentifier } - fun getLabeledBookmarkListEvent(bookmarkIdentifier: String): LabeledBookmarkListEvent = getLabeledBookmarkListNote(bookmarkIdentifier)?.event as LabeledBookmarkListEvent + fun getLabeledBookmarkListEvent(bookmarkIdentifier: String): BookmarkSetEvent = getLabeledBookmarkListNote(bookmarkIdentifier)?.event as BookmarkSetEvent fun getLabeledBookmarkListFlow(bookmarkIdentifier: String) = listFeedFlow @@ -163,7 +163,7 @@ class LabeledBookmarkListsState( account: Account, ) { val newList = - LabeledBookmarkListEvent.create( + BookmarkSetEvent.create( title = listName, description = listDescription, image = listImage, @@ -202,7 +202,7 @@ class LabeledBookmarkListsState( ) { val listEvent = getLabeledBookmarkListEvent(bookmarkList.identifier) val renamedList = - LabeledBookmarkListEvent.modifyName( + BookmarkSetEvent.modifyName( earlierVersion = listEvent, newTitle = newName, signer = account.signer, @@ -217,7 +217,7 @@ class LabeledBookmarkListsState( ) { val listEvent = getLabeledBookmarkListEvent(bookmarkList.identifier) val modifiedList = - LabeledBookmarkListEvent.modifyDescription( + BookmarkSetEvent.modifyDescription( earlierVersion = listEvent, newDescription = newDescription, signer = account.signer, @@ -232,7 +232,7 @@ class LabeledBookmarkListsState( account: Account, ) { val clonedList = - LabeledBookmarkListEvent.create( + BookmarkSetEvent.create( title = customCloneName ?: currentBookmarkList.title, description = customCloneDescription ?: currentBookmarkList.description, publicBookmarks = currentBookmarkList.publicBookmarks.toList(), @@ -247,7 +247,7 @@ class LabeledBookmarkListsState( account: Account, ) { val listEvent = getLabeledBookmarkListEvent(bookmarkListIdentifier) - val deletionEventTemplate = DeletionEvent.build(listOf(listEvent)) + val deletionEventTemplate = DeletionRequestEvent.build(listOf(listEvent)) val deletionEvent = account.signer.sign(deletionEventTemplate) account.sendMyPublicAndPrivateOutbox(deletionEvent) } @@ -260,7 +260,7 @@ class LabeledBookmarkListsState( ) { val currentBookmarkList = getLabeledBookmarkListEvent(bookmarkListIdentifier) val updatedList = - LabeledBookmarkListEvent.addBookmark( + BookmarkSetEvent.addBookmark( earlierVersion = currentBookmarkList, bookmarkIdTag = bookmark, isPrivate = isBookmarkPrivate, @@ -277,7 +277,7 @@ class LabeledBookmarkListsState( ) { val bookmarkList = getLabeledBookmarkListEvent(bookmarkListIdentifier) val updatedList = - LabeledBookmarkListEvent.moveBookmark( + BookmarkSetEvent.moveBookmark( earlierVersion = bookmarkList, bookmarkIdTag = bookmark, isCurrentlyPrivate = isBookmarkCurrentlyPrivate, @@ -294,7 +294,7 @@ class LabeledBookmarkListsState( ) { val currentBookmarkList = getLabeledBookmarkListEvent(bookmarkListIdentifier) val updatedList = - LabeledBookmarkListEvent.removeBookmark( + BookmarkSetEvent.removeBookmark( earlierVersion = currentBookmarkList, bookmarkIdTag = bookmark, isPrivate = isBookmarkPrivate, @@ -311,7 +311,7 @@ class LabeledBookmarkListsState( ) { if (deletedEventIds.isEmpty() && deletedAddresses.isEmpty()) return - val currentList = getLabeledBookmarkListNote(bookmarkListIdentifier)?.event as? LabeledBookmarkListEvent ?: return + val currentList = getLabeledBookmarkListNote(bookmarkListIdentifier)?.event as? BookmarkSetEvent ?: return val newPublicTags = currentList.tags @@ -328,7 +328,7 @@ class LabeledBookmarkListsState( val updatedList = if (oldPrivateTags == null) { if (newPublicTags.size == currentList.tags.size) return - LabeledBookmarkListEvent.resign( + BookmarkSetEvent.resign( content = currentList.content, tags = newPublicTags, signer = account.signer, @@ -344,7 +344,7 @@ class LabeledBookmarkListsState( } }.toTypedArray() if (newPublicTags.size == currentList.tags.size && newPrivateTags.size == oldPrivateTags.size) return - LabeledBookmarkListEvent.resign( + BookmarkSetEvent.resign( tags = newPublicTags, privateTags = newPrivateTags, signer = account.signer, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/peopleList/FollowListsState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/peopleList/FollowListsState.kt index 0c10d3d49b..fbcdfe4e46 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/peopleList/FollowListsState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/peopleList/FollowListsState.kt @@ -35,8 +35,8 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.update import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip51Lists.followList.description import com.vitorpamplona.quartz.nip51Lists.followList.image import com.vitorpamplona.quartz.nip51Lists.followList.person @@ -79,7 +79,7 @@ class FollowListsState( // them from relays. fun existingPeopleListNotes() = cache.addressables - .filter(FollowListEvent.KIND, user.pubkeyHex) + .filter(StarterPackEvent.KIND, user.pubkeyHex) .filter { it.event != null || !cache.hasBeenDeleted(it.address) } val followListVersions = MutableStateFlow(0) @@ -99,14 +99,14 @@ class FollowListsState( .stateIn(scope, SharingStarted.Eagerly, emptySet()) @OptIn(ExperimentalCoroutinesApi::class) - val latestLists: StateFlow> = + val latestLists: StateFlow> = followListNotes - .transformLatest { emitAll(it.updateFlow()) } + .transformLatest { emitAll(it.updateFlow()) } .onStart { emit(followListNotes.value.events()) } .flowOn(Dispatchers.IO) .stateIn(scope, SharingStarted.Eagerly, emptyList()) - fun List.mapToUserIdSet() = this.map { it.followIdSet() }.flattenToSet() + fun List.mapToUserIdSet() = this.map { it.followIdSet() }.flattenToSet() val allPeopleListProfiles: StateFlow> = latestLists @@ -115,7 +115,7 @@ class FollowListsState( .flowOn(Dispatchers.IO) .stateIn(scope, SharingStarted.Eagerly, emptySet()) - fun FollowListEvent.toUI() = + fun StarterPackEvent.toUI() = PeopleList( identifierTag = this.dTag(), title = this.title() ?: this.dTag(), @@ -125,7 +125,7 @@ class FollowListsState( publicMembers = cache.load(this.followIdSet()), ) - fun List.toUI() = this.map { it.toUI() } + fun List.toUI() = this.map { it.toUI() } val uiListFlow = latestLists @@ -148,12 +148,12 @@ class FollowListsState( fun isUserInFollowSets(user: User): Boolean = allPeopleListProfiles.value.contains(user.pubkeyHex) - fun DeletionEvent.hasDeletedAnyFollowList() = deleteAddressesWithKind(FollowListEvent.KIND) || deletesAnyEventIn(followListsEventIds.value) + fun DeletionRequestEvent.hasDeletedAnyFollowList() = deleteAddressesWithKind(StarterPackEvent.KIND) || deletesAnyEventIn(followListsEventIds.value) fun hasItemInNoteList(notes: Set): Boolean = notes.anyNotNullEvent { event -> if (event.pubKey == signer.pubKey) { - event is FollowListEvent || (event is DeletionEvent && event.hasDeletedAnyFollowList()) + event is StarterPackEvent || (event is DeletionRequestEvent && event.hasDeletedAnyFollowList()) } else { false } @@ -181,7 +181,7 @@ class FollowListsState( fun getPeopleListNote(noteIdentifier: String): AddressableNote? = existingPeopleListNotes().find { it.dTag() == noteIdentifier } - fun getPeopleList(noteIdentifier: String): FollowListEvent = getPeopleListNote(noteIdentifier)?.event as FollowListEvent + fun getPeopleList(noteIdentifier: String): StarterPackEvent = getPeopleListNote(noteIdentifier)?.event as StarterPackEvent fun User.toUserTag() = UserTag(this.pubkeyHex, this.bestRelayHint()) @@ -198,7 +198,7 @@ class FollowListsState( val dTag = UUID.randomUUID().toString() val newListTemplate = - FollowListEvent.build( + StarterPackEvent.build( name = name, people = if (!isPrivate && member != null) listOf(member.toUserTag()) else emptyList(), dTag = dTag, @@ -262,7 +262,7 @@ class FollowListsState( account: Account, ) { val followListEvent = getPeopleList(identifierTag) - val deletionEvent = account.signer.sign(DeletionEvent.build(listOf(followListEvent))) + val deletionEvent = account.signer.sign(DeletionRequestEvent.build(listOf(followListEvent))) account.sendMyPublicAndPrivateOutbox(deletionEvent) // Any screen whose persisted feed filter still points at this follow pack would // keep re-creating an empty shell for its address (and render the dTag/UUID in diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/peopleList/PeopleListsState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/peopleList/PeopleListsState.kt index 013b2c0a07..bdd1731ab8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/peopleList/PeopleListsState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/peopleList/PeopleListsState.kt @@ -35,9 +35,9 @@ import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.update -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip51Lists.muteList.tags.UserTag -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import com.vitorpamplona.quartz.nip51Lists.peopleList.description import com.vitorpamplona.quartz.nip51Lists.peopleList.image import com.vitorpamplona.quartz.nip51Lists.peopleList.title @@ -78,8 +78,8 @@ class PeopleListsState( // can subscribe and fetch them from relays. fun existingPeopleListNotes() = cache.addressables - .filter(PeopleListEvent.KIND, user.pubkeyHex) - .filter { it.dTag() != PeopleListEvent.BLOCK_LIST_D_TAG || it.event != null } + .filter(FollowSetEvent.KIND, user.pubkeyHex) + .filter { it.dTag() != FollowSetEvent.BLOCK_LIST_D_TAG || it.event != null } .filter { it.event != null || !cache.hasBeenDeleted(it.address) } val peopleListVersions = MutableStateFlow(0) @@ -99,21 +99,21 @@ class PeopleListsState( .stateIn(scope, SharingStarted.Eagerly, emptySet()) @OptIn(ExperimentalCoroutinesApi::class) - val latestLists: StateFlow> = + val latestLists: StateFlow> = peopleListNotes - .transformLatest { emitAll(it.updateFlow()) } + .transformLatest { emitAll(it.updateFlow()) } .onStart { emit(peopleListNotes.value.events()) } .flowOn(Dispatchers.IO) .stateIn(scope, SharingStarted.Eagerly, emptyList()) - suspend fun PeopleListEvent.userIdSet() = decryptionCache.userIdSet(this) + suspend fun FollowSetEvent.userIdSet() = decryptionCache.userIdSet(this) - suspend fun List.mapToUserIdSet() = this.map { it.userIdSet() }.flattenToSet() + suspend fun List.mapToUserIdSet() = this.map { it.userIdSet() }.flattenToSet() - suspend fun List.mapGoodUsersToIdSet() = + suspend fun List.mapGoodUsersToIdSet() = this .mapNotNull { - if (it.dTag() != PeopleListEvent.BLOCK_LIST_D_TAG) { + if (it.dTag() != FollowSetEvent.BLOCK_LIST_D_TAG) { it.userIdSet() } else { null @@ -127,7 +127,7 @@ class PeopleListsState( .flowOn(Dispatchers.IO) .stateIn(scope, SharingStarted.Eagerly, emptySet()) - suspend fun PeopleListEvent.toUI() = + suspend fun FollowSetEvent.toUI() = PeopleList( identifierTag = this.dTag(), title = this.titleOrName() ?: this.dTag(), @@ -137,7 +137,7 @@ class PeopleListsState( publicMembers = cache.load(this.publicUsersIdSet()), ) - suspend fun List.toUI() = this.map { it.toUI() }.sortedBy { it.title } + suspend fun List.toUI() = this.map { it.toUI() }.sortedBy { it.title } val uiListFlow = latestLists @@ -158,12 +158,12 @@ class PeopleListsState( .map { it.select(dTag) } .onStart { emit(selectList(dTag)) } - fun DeletionEvent.hasDeletedAnyPeopleList() = deleteAddressesWithKind(PeopleListEvent.KIND) || deletesAnyEventIn(peopleListsEventIds.value) + fun DeletionRequestEvent.hasDeletedAnyPeopleList() = deleteAddressesWithKind(FollowSetEvent.KIND) || deletesAnyEventIn(peopleListsEventIds.value) fun hasItemInNoteList(notes: Set): Boolean = notes.anyNotNullEvent { event -> if (event.pubKey == signer.pubKey) { - event is PeopleListEvent || (event is DeletionEvent && event.hasDeletedAnyPeopleList()) + event is FollowSetEvent || (event is DeletionRequestEvent && event.hasDeletedAnyPeopleList()) } else { false } @@ -191,7 +191,7 @@ class PeopleListsState( fun getPeopleListNote(noteIdentifier: String): AddressableNote? = existingPeopleListNotes().find { it.dTag() == noteIdentifier } - fun getPeopleList(noteIdentifier: String): PeopleListEvent = getPeopleListNote(noteIdentifier)?.event as PeopleListEvent + fun getPeopleList(noteIdentifier: String): FollowSetEvent = getPeopleListNote(noteIdentifier)?.event as FollowSetEvent fun User.toUserTag() = UserTag(this.pubkeyHex, this.bestRelayHint()) @@ -207,7 +207,7 @@ class PeopleListsState( ): String { val dTag = UUID.randomUUID().toString() val newListTemplate = - PeopleListEvent.build( + FollowSetEvent.build( dTag = dTag, title = listName, publicMembers = if (!isPrivate && member != null) listOf(member.toUserTag()) else emptyList(), @@ -252,7 +252,7 @@ class PeopleListsState( account: Account, ) { val newList = - PeopleListEvent.createListWithDescription( + FollowSetEvent.createListWithDescription( dTag = UUID.randomUUID().toString(), title = customCloneName ?: currentPeopleList.title, description = customCloneDescription ?: currentPeopleList.description, @@ -268,7 +268,7 @@ class PeopleListsState( account: Account, ) { val followListEvent = getPeopleList(identifierTag) - val deletionEvent = account.signer.sign(DeletionEvent.build(listOf(followListEvent))) + val deletionEvent = account.signer.sign(DeletionRequestEvent.build(listOf(followListEvent))) account.sendMyPublicAndPrivateOutbox(deletionEvent) // Any screen whose persisted feed filter still points at this list would keep // re-creating an empty shell for its address (and render the dTag/UUID in the @@ -284,7 +284,7 @@ class PeopleListsState( ) { val followListEvent = getPeopleList(identifierTag) val newList = - PeopleListEvent.addUser( + FollowSetEvent.addUser( earlierVersion = followListEvent, pubKeyHex = user.pubkeyHex, relayHint = user.bestRelayHint(), @@ -302,7 +302,7 @@ class PeopleListsState( ) { val followListEvent = getPeopleList(identifierTag) val newList = - PeopleListEvent.addUserFirst( + FollowSetEvent.addUserFirst( earlierVersion = followListEvent, pubKeyHex = user.pubkeyHex, relayHint = user.bestRelayHint(), @@ -320,7 +320,7 @@ class PeopleListsState( ) { val followListEvent = getPeopleList(identifierTag) val newList = - PeopleListEvent.removeUser( + FollowSetEvent.removeUser( earlierVersion = followListEvent, pubKeyHex = user.pubkeyHex, isUserPrivate = isPrivate, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/relayFeeds/RelayFeedListState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/relayFeeds/RelayFeedListState.kt index 7c803a398d..685e8411a9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/relayFeeds/RelayFeedListState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip51Lists/relayFeeds/RelayFeedListState.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.amethyst.commons.model.nip51Lists.relayFeeds.RelayFeeds import com.vitorpamplona.amethyst.model.AccountSettings import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent import com.vitorpamplona.quartz.utils.Log import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.DelicateCoroutinesApi @@ -50,13 +50,13 @@ class RelayFeedListState( // Creates a long-term reference for this note so that the GC doesn't collect the note it self val relayFeedListNote = cache.getOrCreateAddressableNote(getRelayFeedsListAddress()) - fun getRelayFeedsListAddress() = RelayFeedsListEvent.createAddress(signer.pubKey) + fun getRelayFeedsListAddress() = FavoriteRelayListEvent.createAddress(signer.pubKey) fun getRelayFeedsListFlow(): StateFlow = relayFeedListNote.flow().metadata.stateFlow - fun getRelayFeedsList(): RelayFeedsListEvent? = relayFeedListNote.event as? RelayFeedsListEvent + fun getRelayFeedsList(): FavoriteRelayListEvent? = relayFeedListNote.event as? FavoriteRelayListEvent - fun relayFeedsListEvent(note: Note) = note.event as? RelayFeedsListEvent ?: settings.backupRelayFeedsList + fun relayFeedsListEvent(note: Note) = note.event as? FavoriteRelayListEvent ?: settings.backupRelayFeedsList suspend fun normalizeRelayFeedsListWithBackup(note: Note): Set = relayFeedsListEvent(note)?.let { decryptionCache.relays(it) }?.ifEmpty { null } ?: emptySet() @@ -84,30 +84,30 @@ class RelayFeedListState( emptySet(), ) - suspend fun addRelay(relay: NormalizedRelayUrl): RelayFeedsListEvent { + suspend fun addRelay(relay: NormalizedRelayUrl): FavoriteRelayListEvent { val current = normalizeRelayFeedsListWithBackupNoDefaults(relayFeedListNote).toMutableList() if (relay !in current) current.add(relay) return saveRelayList(current) } - suspend fun removeRelay(relay: NormalizedRelayUrl): RelayFeedsListEvent? { + suspend fun removeRelay(relay: NormalizedRelayUrl): FavoriteRelayListEvent? { val current = normalizeRelayFeedsListWithBackupNoDefaults(relayFeedListNote).toMutableList() if (relay !in current) return null current.remove(relay) return saveRelayList(current) } - suspend fun saveRelayList(relayFeeds: List): RelayFeedsListEvent { + suspend fun saveRelayList(relayFeeds: List): FavoriteRelayListEvent { val relayFeedsList = getRelayFeedsList() return if (relayFeedsList != null && relayFeedsList.tags.isNotEmpty()) { - RelayFeedsListEvent.updateRelayList( + FavoriteRelayListEvent.updateRelayList( earlierVersion = relayFeedsList, relays = relayFeeds, signer = signer, ) } else { - RelayFeedsListEvent.create( + FavoriteRelayListEvent.create( relays = relayFeeds, signer = signer, ) @@ -125,7 +125,7 @@ class RelayFeedListState( Log.d("AccountRegisterObservers", "Relay feeds list Collector Start") getRelayFeedsListFlow().collect { Log.d("AccountRegisterObservers") { "Updating Relay feeds list for ${signer.pubKey}" } - (it.note.event as? RelayFeedsListEvent)?.let { + (it.note.event as? FavoriteRelayListEvent)?.let { settings.updateRelayFeedList(it) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip60Cashu/CashuWalletState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip60Cashu/CashuWalletState.kt index 98a005ebdc..1a97ee66c1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip60Cashu/CashuWalletState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/nip60Cashu/CashuWalletState.kt @@ -41,7 +41,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.client.accessories.fetchAllPages import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip60Cashu.history.CashuSpendingHistoryEvent import com.vitorpamplona.quartz.nip60Cashu.mintApi.DeterministicSecretFactory import com.vitorpamplona.quartz.nip60Cashu.mintApi.MeltQuoteBolt11ResponseDto @@ -486,7 +486,7 @@ class CashuWalletState( // Process our own NIP-09 deletions inline rather than // relying on LocalCache's `deletedEventBundles`. That - // path only fires when `consume(DeletionEvent)` finds + // path only fires when `consume(DeletionRequestEvent)` finds // the target Note still resident in `notes` — a // LargeSoftCache backed by WeakReferences, which can // be cleared on any GC cycle. When the weak ref is @@ -503,7 +503,7 @@ class CashuWalletState( val ourDeleteIds = all .asSequence() - .filterIsInstance() + .filterIsInstance() .filter { it.pubKey == pubKey } .flatMap { it.deleteEventIds().asSequence() } .toSet() @@ -1447,7 +1447,7 @@ class CashuWalletState( } val redundantIds = redundant.map { it.event.id }.toSet() runCatching { - val template = DeletionEvent.build(redundant.map { it.event }) + val template = DeletionRequestEvent.build(redundant.map { it.event }) val signed = signer.sign(template) publishEvent(signed) }.onFailure { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/napplet/NappletConsentSummary.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/napplet/NappletConsentSummary.kt index 500b133ef6..850374e92e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/napplet/NappletConsentSummary.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/napplet/NappletConsentSummary.kt @@ -67,7 +67,7 @@ import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.quartz.lightning.LnInvoiceUtil import com.vitorpamplona.quartz.nip01Core.core.fastForEach import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent import org.jetbrains.compose.resources.PluralStringResource @@ -199,7 +199,7 @@ class NappletConsentSummary( oneRemoved = Res.string.napplet_consent_diff_unmute_one, ) // Deletions have no prior version to compare against — the tags are the whole request. - DeletionEvent.KIND -> + DeletionRequestEvent.KIND -> pluralFor(Res.plurals.napplet_consent_effect_deletes, countTag(tags, "e") + countTag(tags, "a")) ?.let { Consequence(it) } // Any other kind: at least tell the user tags exist and can be inspected, so an empty diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/napplet/gateways/AccountIdentityReader.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/napplet/gateways/AccountIdentityReader.kt index 369a7b95c9..8bc8f18df3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/napplet/gateways/AccountIdentityReader.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/napplet/gateways/AccountIdentityReader.kt @@ -23,7 +23,7 @@ package com.vitorpamplona.amethyst.napplet.gateways import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip51Lists.muteList.tags.UserTag -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip58Badges.award.BadgeAwardEvent import com.vitorpamplona.quartz.nip58Badges.definition.BadgeDefinitionEvent import kotlinx.serialization.json.add @@ -137,7 +137,7 @@ class AccountIdentityReader( val receipts = cache .filter(Filter(kinds = listOf(9735), tags = mapOf("p" to listOf(pubkey)))) - .mapNotNull { it.event as? LnZapEvent } + .mapNotNull { it.event as? ZapReceiptEvent } return buildJsonArray { receipts.forEach { zap -> addJsonObject { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/V4VPaymentHandler.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/V4VPaymentHandler.kt index 0c07fa506f..cb7cc0ef22 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/V4VPaymentHandler.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/V4VPaymentHandler.kt @@ -40,7 +40,7 @@ import com.vitorpamplona.quartz.nip01Core.core.toHexKey import com.vitorpamplona.quartz.nip47WalletConnect.rpc.PayKeysendMethod import com.vitorpamplona.quartz.nip47WalletConnect.rpc.Response import com.vitorpamplona.quartz.nip47WalletConnect.rpc.TlvRecord -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip57Zaps.validate.LnurlForm import com.vitorpamplona.quartz.podcasts.PodcastBoostagram import com.vitorpamplona.quartz.podcasts.PodcastValue @@ -91,7 +91,7 @@ class V4VPaymentHandler( onProgress: (percent: Float) -> Unit, onPayInvoicesViaIntent: (invoices: List) -> Unit, asZap: Boolean = false, - zapType: LnZapEvent.ZapType = LnZapEvent.ZapType.PUBLIC, + zapType: ZapReceiptEvent.ZapType = ZapReceiptEvent.ZapType.PUBLIC, ) = withContext(Dispatchers.IO) { val shares = value.computeShares(totalMilliSats) if (shares.isEmpty()) { @@ -190,7 +190,7 @@ class V4VPaymentHandler( shares: List, message: String, asZap: Boolean, - zapType: LnZapEvent.ZapType, + zapType: ZapReceiptEvent.ZapType, zappedNote: Note?, okHttpClient: (String) -> OkHttpClient, context: Context, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/ZapPaymentHandler.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/ZapPaymentHandler.kt index 86e3a61284..6c8a9e667c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/ZapPaymentHandler.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/ZapPaymentHandler.kt @@ -48,8 +48,8 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip47WalletConnect.rpc.NwcErrorCode import com.vitorpamplona.quartz.nip47WalletConnect.rpc.NwcTransactionMetadata import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip57Zaps.splits.ZapSplitSetup import com.vitorpamplona.quartz.nip57Zaps.splits.ZapSplitSetupLnAddress import com.vitorpamplona.quartz.nip57Zaps.splits.zapSplitSetup @@ -79,7 +79,7 @@ class ZapPaymentHandler( // The signed kind 9734 this invoice was fetched with, and the message on it. // Carried so the NWC payment can name the payee (NWC-06 `metadata`); null for // a NONZAP split, which has no zap request to send. - val zapRequest: LnZapRequestEvent? = null, + val zapRequest: ZapRequestEvent? = null, val message: String = "", ) @@ -122,7 +122,7 @@ class ZapPaymentHandler( onError: (String, String, User?) -> Unit, onProgress: (percent: Float) -> Unit, onPayViaIntent: (ImmutableList) -> Unit, - zapType: LnZapEvent.ZapType, + zapType: ZapReceiptEvent.ZapType, ) = withContext(Dispatchers.IO) { val noteEvent = note.event val zapSplitSetup = noteEvent?.zapSplitSetup() @@ -297,7 +297,7 @@ class ZapPaymentHandler( note: Note, pollOption: Int?, message: String, - zapType: LnZapEvent.ZapType, + zapType: ZapReceiptEvent.ZapType, totalAmountMilliSats: Long, totalWeight: Double, okHttpClient: (String) -> OkHttpClient, @@ -360,14 +360,14 @@ class ZapPaymentHandler( class ZapRequestReady( val inputSetup: MyZapSplitSetup, - val zapRequest: LnZapRequestEvent?, + val zapRequest: ZapRequestEvent?, ) suspend fun signAllZapRequests( note: Note, pollOption: Int?, message: String, - zapType: LnZapEvent.ZapType, + zapType: ZapReceiptEvent.ZapType, zapsToSend: List, totalAmountMilliSats: Long, // Shared across the lightning + BOLT12 lanes so a mixed split stays proportional. @@ -389,7 +389,7 @@ class ZapPaymentHandler( val splitLnurl = LnurlForm.toUrl(next.lnAddress)?.let(LnurlForm::urlToBech32) val zapRequest = - if (zapType != LnZapEvent.ZapType.NONZAP && noteEvent != null) { + if (zapType != ZapReceiptEvent.ZapType.NONZAP && noteEvent != null) { account.zaps.createZapRequestFor( event = noteEvent, pollOption = pollOption, @@ -535,7 +535,7 @@ class ZapPaymentHandler( totalAmountMilliSats: Long, totalWeight: Double, message: String, - zapType: LnZapEvent.ZapType, + zapType: ZapReceiptEvent.ZapType, okHttpClient: (String) -> OkHttpClient, onError: (String, String, User?) -> Unit, onProgress: (percent: Float) -> Unit, @@ -672,7 +672,7 @@ class ZapPaymentHandler( private suspend fun assembleInvoice( lud16: String, splitSetup: MyZapSplitSetup, - nostrZapRequest: LnZapRequestEvent?, + nostrZapRequest: ZapRequestEvent?, zapValue: Long, message: String, okHttpClient: (String) -> OkHttpClient, @@ -683,7 +683,7 @@ class ZapPaymentHandler( // Only the request the provider actually accepted may be claimed as bound to // this invoice; see lnAddressInvoice's onZapRequestSent. - var sentZapRequest: LnZapRequestEvent? = null + var sentZapRequest: ZapRequestEvent? = null val invoice = LightningAddressResolver().lnAddressInvoice( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/lnurl/LightningAddressResolver.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/lnurl/LightningAddressResolver.kt index 83efb8028e..9056561530 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/lnurl/LightningAddressResolver.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/lnurl/LightningAddressResolver.kt @@ -38,7 +38,7 @@ import com.vitorpamplona.amethyst.commons.ui.loadStringRes import com.vitorpamplona.amethyst.service.HttpStatusMessages import com.vitorpamplona.quartz.lightning.LnInvoiceUtil import com.vitorpamplona.quartz.lightning.Lud06 -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip57Zaps.validate.LnurlEndpointCache import com.vitorpamplona.quartz.nip57Zaps.validate.LnurlEndpointInfo import com.vitorpamplona.quartz.utils.Log @@ -128,7 +128,7 @@ class LightningAddressResolver { lnCallback: String, milliSats: Long, message: String, - nostrRequest: LnZapRequestEvent? = null, + nostrRequest: ZapRequestEvent? = null, okHttpClient: (String) -> OkHttpClient, context: Context, ): String { @@ -219,11 +219,11 @@ class LightningAddressResolver { lnAddress: String, milliSats: Long, message: String, - nostrRequest: LnZapRequestEvent? = null, + nostrRequest: ZapRequestEvent? = null, okHttpClient: (String) -> OkHttpClient, onProgress: (percent: Float) -> Unit, context: Context, - onZapRequestSent: (LnZapRequestEvent?) -> Unit = {}, + onZapRequestSent: (ZapRequestEvent?) -> Unit = {}, ): String { val mapper = ObjectMapper() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt index 30b71e240a..b596797b6a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt @@ -64,7 +64,7 @@ import com.vitorpamplona.quartz.marmot.mip02Welcome.WelcomeEvent import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.core.toHexKey import com.vitorpamplona.quartz.nip01Core.tags.people.isTaggedUser -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent @@ -72,7 +72,7 @@ import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip19Bech32.bech32.bechToBytes import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent import com.vitorpamplona.quartz.nip34Git.issue.GitIssueEvent @@ -84,17 +84,17 @@ import com.vitorpamplona.quartz.nip34Git.status.GitStatusAppliedEvent import com.vitorpamplona.quartz.nip34Git.status.GitStatusClosedEvent import com.vitorpamplona.quartz.nip34Git.status.GitStatusDraftEvent import com.vitorpamplona.quartz.nip34Git.status.GitStatusOpenEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip58Badges.award.BadgeAwardEvent import com.vitorpamplona.quartz.nip61Nutzaps.nutzap.NutzapEvent import com.vitorpamplona.quartz.nip64Chess.challenge.accept.LiveChessGameAcceptEvent import com.vitorpamplona.quartz.nip64Chess.move.LiveChessMoveEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nipACWebRtcCalls.events.CallOfferEvent @@ -234,7 +234,7 @@ class EventNotificationConsumer( // public chat the user has silenced (matches the in-app feed, which mutes all four). // Without the second check, muting a channel still let a like on your own message // there notify you — the row's glyph promises silence, so it has to mean it. - if (event is ReactionEvent || event is LnZapEvent || event is RepostEvent || event is GenericRepostEvent) { + if (event is ReactionEvent || event is ZapReceiptEvent || event is RepostEvent || event is GenericRepostEvent) { val target = LocalCache.getNoteIfExists(event)?.replyTo?.lastOrNull() if (target != null && ( @@ -247,7 +247,7 @@ class EventNotificationConsumer( } when (event) { - is PrivateDmEvent -> DirectMessageNotification.notify(applicationContext, account, event) + is EncryptedDmEvent -> DirectMessageNotification.notify(applicationContext, account, event) is ChatMessageEvent -> DirectMessageNotification.notify(applicationContext, account, event) is ChatMessageEncryptedFileHeaderEvent -> DirectMessageNotification.notify(applicationContext, account, event) @@ -256,7 +256,7 @@ class EventNotificationConsumer( is StreamMessageV2Event -> BuzzDmNotification.notify(applicationContext, account, event) is ChatEvent -> BuzzDmNotification.notify(applicationContext, account, event) - is LnZapEvent -> ZapNotification.notify(applicationContext, account, event) + is ZapReceiptEvent -> ZapNotification.notify(applicationContext, account, event) is NutzapEvent -> ZapNotification.notify(applicationContext, account, event) is OnchainZapEvent -> ZapNotification.notify(applicationContext, account, event) @@ -274,15 +274,15 @@ class EventNotificationConsumer( is PictureEvent, is VideoNormalEvent, is VideoShortEvent, - is VideoHorizontalEvent, - is VideoVerticalEvent, + is AddressableNormalVideoEvent, + is AddressableShortVideoEvent, -> MediaNotification.notify(applicationContext, account, event) is PollEvent -> MentionNotification.notify(applicationContext, account, event, titleRes = Res.string.app_notification_poll_channel_message) is HighlightEvent, - is LongTextNoteEvent, - is WikiNoteEvent, + is LongFormContentEvent, + is WikiArticleEvent, -> ArticleNotification.notify(applicationContext, account, event) is GitIssueEvent -> CodeNotification.notify(applicationContext, account, event) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationContent.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationContent.kt index 238b20c0bc..68077c7d66 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationContent.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationContent.kt @@ -27,11 +27,11 @@ import com.vitorpamplona.amethyst.commons.model.nip71Video.selectVideoTrack import com.vitorpamplona.amethyst.commons.richtext.RichTextParser import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip19Bech32.Nip19Parser import com.vitorpamplona.quartz.nip19Bech32.entities.NProfile import com.vitorpamplona.quartz.nip19Bech32.entities.NPub -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent import com.vitorpamplona.quartz.nip71Video.VideoEvent @@ -177,7 +177,7 @@ object NotificationContent { } suspend fun decryptZapContentAuthor( - event: LnZapRequestEvent, + event: ZapRequestEvent, signer: NostrSigner, ): Event? = if (event.isPrivateZap() && event.zappedAuthor().contains(event.pubKey)) { @@ -191,8 +191,8 @@ object NotificationContent { signer: NostrSigner, ): String? = when (val event = note.event) { - is PrivateDmEvent -> event.decryptContent(signer) - is LnZapRequestEvent -> decryptZapContentAuthor(event, signer)?.content + is EncryptedDmEvent -> event.decryptContent(signer) + is ZapRequestEvent -> decryptZapContentAuthor(event, signer)?.content else -> event?.content } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationDispatcher.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationDispatcher.kt index f75661b6f3..e9bca8f358 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationDispatcher.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationDispatcher.kt @@ -32,7 +32,7 @@ import com.vitorpamplona.quartz.marmot.mip02Welcome.WelcomeEvent import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.core.toHexKey import com.vitorpamplona.quartz.nip01Core.tags.people.isTaggedUser -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent @@ -40,7 +40,7 @@ import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip19Bech32.bech32.bechToBytes import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent import com.vitorpamplona.quartz.nip34Git.issue.GitIssueEvent @@ -52,17 +52,17 @@ import com.vitorpamplona.quartz.nip34Git.status.GitStatusAppliedEvent import com.vitorpamplona.quartz.nip34Git.status.GitStatusClosedEvent import com.vitorpamplona.quartz.nip34Git.status.GitStatusDraftEvent import com.vitorpamplona.quartz.nip34Git.status.GitStatusOpenEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip58Badges.award.BadgeAwardEvent import com.vitorpamplona.quartz.nip61Nutzaps.nutzap.NutzapEvent import com.vitorpamplona.quartz.nip64Chess.challenge.accept.LiveChessGameAcceptEvent import com.vitorpamplona.quartz.nip64Chess.move.LiveChessMoveEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nipACWebRtcCalls.events.CallOfferEvent @@ -118,8 +118,8 @@ class NotificationDispatcher( internal val NOTIFICATION_KINDS: Set = setOf( // Direct-arrival - PrivateDmEvent.KIND, - LnZapEvent.KIND, + EncryptedDmEvent.KIND, + ZapReceiptEvent.KIND, NutzapEvent.KIND, OnchainZapEvent.KIND, Bolt12ZapEvent.KIND, @@ -133,8 +133,8 @@ class NotificationDispatcher( PictureEvent.KIND, VideoNormalEvent.KIND, VideoShortEvent.KIND, - VideoHorizontalEvent.KIND, - VideoVerticalEvent.KIND, + AddressableNormalVideoEvent.KIND, + AddressableShortVideoEvent.KIND, ChannelMessageEvent.KIND, PollEvent.KIND, GitPatchEvent.KIND, @@ -150,8 +150,8 @@ class NotificationDispatcher( GitStatusClosedEvent.KIND, GitStatusDraftEvent.KIND, HighlightEvent.KIND, - LongTextNoteEvent.KIND, - WikiNoteEvent.KIND, + LongFormContentEvent.KIND, + WikiArticleEvent.KIND, LiveChessGameAcceptEvent.KIND, LiveChessMoveEvent.KIND, WakeUpEvent.KIND, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/renderers/DirectMessageNotification.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/renderers/DirectMessageNotification.kt index 23a67fc369..6935da0691 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/renderers/DirectMessageNotification.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/renderers/DirectMessageNotification.kt @@ -32,7 +32,7 @@ import com.vitorpamplona.amethyst.service.notifications.NotificationUtils.Conver import com.vitorpamplona.amethyst.service.notifications.NotificationUtils.ReplyAction import com.vitorpamplona.amethyst.service.notifications.NotificationUtils.postConversation import com.vitorpamplona.amethyst.service.notifications.notificationManager -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKey import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent @@ -64,7 +64,7 @@ object DirectMessageNotification { suspend fun notify( context: Context, account: Account, - event: PrivateDmEvent, + event: EncryptedDmEvent, ) { if (account.signer.pubKey != event.verifiedRecipientPubKey()) return notifyRoom(context, account, event.id, event.createdAt, event.chatroomKey(account.signer.pubKey), decrypt = true) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/renderers/ZapNotification.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/renderers/ZapNotification.kt index f60e54aad7..6f13908502 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/renderers/ZapNotification.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/renderers/ZapNotification.kt @@ -39,8 +39,8 @@ import com.vitorpamplona.amethyst.service.notifications.NotificationRoutes import com.vitorpamplona.amethyst.service.notifications.NotificationUtils.postStandard import com.vitorpamplona.amethyst.service.notifications.notificationManager import com.vitorpamplona.amethyst.ui.note.showAmount -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip61Nutzaps.nutzap.NutzapEvent import com.vitorpamplona.quartz.nipBCOnchainZaps.zap.OnchainZapEvent import org.jetbrains.compose.resources.StringResource @@ -59,7 +59,7 @@ object ZapNotification { suspend fun notify( context: Context, account: Account, - event: LnZapEvent, + event: ZapReceiptEvent, ) { LocalCache.getNoteIfExists(event.id) ?: return val zapRequestNote = event.zapRequest?.id?.let { LocalCache.checkGetOrCreateNote(it) } ?: return @@ -67,7 +67,7 @@ object ZapNotification { if (!account.isAcceptable(zappedNote)) return if ((event.amount ?: BigDecimal.ZERO) < MIN_ZAP_AMOUNT) return - val zapRequestEvent = zapRequestNote.event as? LnZapRequestEvent ?: return + val zapRequestEvent = zapRequestNote.event as? ZapRequestEvent ?: return // Resolve the (possibly private) zapper once — never re-decrypt per tick. val decrypted = NotificationContent.decryptZapContentAuthor(zapRequestEvent, account.signer) ?: return val sender = LocalCache.getOrCreateUser(decrypted.pubKey) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/metadata/FilterAccountInfoAndListsFromKey.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/metadata/FilterAccountInfoAndListsFromKey.kt index 087e2cdeee..75a9090d82 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/metadata/FilterAccountInfoAndListsFromKey.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/metadata/FilterAccountInfoAndListsFromKey.kt @@ -32,18 +32,18 @@ import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip37Drafts.privateOutbox.PrivateOutboxRelayListEvent -import com.vitorpamplona.quartz.nip38UserStatus.StatusEvent +import com.vitorpamplona.quartz.nip38UserStatus.UserStatusEvent import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent import com.vitorpamplona.quartz.nip51Lists.geohashList.GeohashListEvent -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent import com.vitorpamplona.quartz.nip51Lists.interestSet.InterestSetEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BlockedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BroadcastRelayListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.ProxyRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.simpleGroupList.SimpleGroupListEvent import com.vitorpamplona.quartz.nip53LiveActivities.nestsServers.NestsServersEvent @@ -60,9 +60,9 @@ val AccountInfoAndListsFromKeyKinds = listOf( MetadataEvent.KIND, ContactListEvent.KIND, - StatusEvent.KIND, + UserStatusEvent.KIND, AdvertisedRelayListEvent.KIND, - ChatMessageRelayListEvent.KIND, + DmRelayListEvent.KIND, KeyPackageRelayListEvent.KIND, SearchRelayListEvent.KIND, FileServersEvent.KIND, @@ -78,12 +78,12 @@ val AccountInfoAndListsFromKeyKinds2 = BroadcastRelayListEvent.KIND, IndexerRelayListEvent.KIND, ProxyRelayListEvent.KIND, - HashtagListEvent.KIND, + InterestListEvent.KIND, GeohashListEvent.KIND, TrustProviderListEvent.KIND, PaymentTargetsEvent.KIND, Bolt12OfferListEvent.KIND, - RelayFeedsListEvent.KIND, + FavoriteRelayListEvent.KIND, InterestSetEvent.KIND, // NIP-51 "simple groups" list (kind 10009): the user's joined NIP-29 groups + servers. // Loaded up-front so "My Groups" and group memberships resolve immediately at login, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/nwc/NWCFinderFilterAssemblerSubscription.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/nwc/NWCFinderFilterAssemblerSubscription.kt index 065304ec16..6f7d9e6064 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/nwc/NWCFinderFilterAssemblerSubscription.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/nwc/NWCFinderFilterAssemblerSubscription.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.amethyst.commons.relayClient.nip47WalletConnect.NWCPaym import com.vitorpamplona.amethyst.commons.relayClient.nip47WalletConnect.NWCPaymentQueryState import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.KeyDataSourceSubscription import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent @SuppressLint("StateFlowValueCalledInComposition") @Composable @@ -50,7 +50,7 @@ fun NWCFinderFilterAssemblerSubscription( val states = remember(note) { val zapPaymentRequestNote = note - (zapPaymentRequestNote.event as? LnZapPaymentRequestEvent)?.let { noteEvent -> + (zapPaymentRequestNote.event as? NwcRequestEvent)?.let { noteEvent -> noteEvent.walletServicePubKey()?.let { zapPaymentRequestNote.relays.map { NWCPaymentQueryState( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/user/UserObservers.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/user/UserObservers.kt index 691179b7e7..bd26b5ad5a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/user/UserObservers.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/user/UserObservers.kt @@ -39,7 +39,7 @@ import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent import com.vitorpamplona.quartz.nip51Lists.PinListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.OldBookmarkListEvent -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent import kotlinx.collections.immutable.ImmutableList import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -132,9 +132,9 @@ fun observeUserTagFollowCount( .metadata.stateFlow .sample(1000) .mapLatest { noteState -> - (noteState.note.event as? HashtagListEvent)?.let { accountViewModel.account.hashtagListDecryptionCache.hashtags(it) }?.size ?: 0 + (noteState.note.event as? InterestListEvent)?.let { accountViewModel.account.hashtagListDecryptionCache.hashtags(it) }?.size ?: 0 }.onStart { - emit((accountViewModel.hashtagFollows(user).event as? HashtagListEvent)?.let { accountViewModel.account.hashtagListDecryptionCache.hashtags(it) }?.size ?: 0) + emit((accountViewModel.hashtagFollows(user).event as? InterestListEvent)?.let { accountViewModel.account.hashtagListDecryptionCache.hashtags(it) }?.size ?: 0) }.distinctUntilChanged() .flowOn(Dispatchers.IO) } @@ -160,9 +160,9 @@ fun observeUserTagFollows( .metadata.stateFlow .sample(200) .mapLatest { noteState -> - (noteState.note.event as? HashtagListEvent)?.let { accountViewModel.account.hashtagListDecryptionCache.hashtags(it) }?.sorted() ?: emptyList() + (noteState.note.event as? InterestListEvent)?.let { accountViewModel.account.hashtagListDecryptionCache.hashtags(it) }?.sorted() ?: emptyList() }.onStart { - emit((accountViewModel.hashtagFollows(user).event as? HashtagListEvent)?.let { accountViewModel.account.hashtagListDecryptionCache.hashtags(it) }?.sorted() ?: emptyList()) + emit((accountViewModel.hashtagFollows(user).event as? InterestListEvent)?.let { accountViewModel.account.hashtagListDecryptionCache.hashtags(it) }?.sorted() ?: emptyList()) }.distinctUntilChanged() .flowOn(Dispatchers.IO) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/resourceusage/MeteringNostrSigner.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/resourceusage/MeteringNostrSigner.kt index 93bb31f4a5..1b5355efef 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/resourceusage/MeteringNostrSigner.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/resourceusage/MeteringNostrSigner.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip46RemoteSigner.signer.NostrSignerRemote import com.vitorpamplona.quartz.nip55AndroidSigner.client.NostrSignerExternal import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip89AppHandlers.clientTag.NostrSignerWithClientTag /** @@ -89,7 +89,7 @@ class MeteringNostrSigner( fromPublicKey: HexKey, ): String = metered(UsageKeys.DECRYPT_COUNT, UsageKeys.DECRYPT_US) { inner.nip44Decrypt(ciphertext, fromPublicKey) } - override suspend fun decryptZapEvent(event: LnZapRequestEvent): LnZapPrivateEvent = metered(UsageKeys.DECRYPT_COUNT, UsageKeys.DECRYPT_US) { inner.decryptZapEvent(event) } + override suspend fun decryptZapEvent(event: ZapRequestEvent): LnZapPrivateEvent = metered(UsageKeys.DECRYPT_COUNT, UsageKeys.DECRYPT_US) { inner.decryptZapEvent(event) } override suspend fun deriveKey(nonce: HexKey): HexKey = inner.deriveKey(nonce) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/uploads/hls/HlsVideoEventBuilder.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/uploads/hls/HlsVideoEventBuilder.kt index 6a326f99c9..fe15bfee85 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/uploads/hls/HlsVideoEventBuilder.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/uploads/hls/HlsVideoEventBuilder.kt @@ -26,9 +26,9 @@ import com.davotoula.lightcompressor.hls.HlsUploaded import com.vitorpamplona.amethyst.service.uploads.MediaUploadResult import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate import com.vitorpamplona.quartz.nip36SensitiveContent.contentWarning -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoMeta -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip71Video.duration import com.vitorpamplona.quartz.nip71Video.title import com.vitorpamplona.quartz.nip71Video.videoIMetas @@ -61,11 +61,11 @@ data class HlsVideoPublishInput( sealed class HlsVideoEventTemplate { data class Horizontal( - val template: EventTemplate, + val template: EventTemplate, ) : HlsVideoEventTemplate() data class Vertical( - val template: EventTemplate, + val template: EventTemplate, ) : HlsVideoEventTemplate() } @@ -80,7 +80,7 @@ data class HlsBuiltTemplate( ) /** - * Assembles a NIP-71 VideoHorizontalEvent / VideoVerticalEvent template from an HLS upload + * Assembles a NIP-71 AddressableNormalVideoEvent / AddressableShortVideoEvent template from an HLS upload * result. Orientation is decided from the first rendition's width/height: portrait * (height > width) selects kind 34236, otherwise 34235. * @@ -142,7 +142,7 @@ object HlsVideoEventBuilder { val template = if (isVertical) { HlsVideoEventTemplate.Vertical( - VideoVerticalEvent.build(input.description, dTag, createdAt) { + AddressableShortVideoEvent.build(input.description, dTag, createdAt) { videoIMetas(videoMetas) title(input.title) input.durationSeconds?.let { duration(it) } @@ -151,7 +151,7 @@ object HlsVideoEventBuilder { ) } else { HlsVideoEventTemplate.Horizontal( - VideoHorizontalEvent.build(input.description, dTag, createdAt) { + AddressableNormalVideoEvent.build(input.description, dTag, createdAt) { videoIMetas(videoMetas) title(input.title) input.durationSeconds?.let { duration(it) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/markdown/RenderContentAsMarkdown.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/markdown/RenderContentAsMarkdown.kt index 650224ae95..2b0d73753f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/markdown/RenderContentAsMarkdown.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/markdown/RenderContentAsMarkdown.kt @@ -54,7 +54,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.mockAccountViewModel import com.vitorpamplona.amethyst.ui.uriToRoute import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip92IMeta.imetasByUrl import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking @@ -425,7 +425,7 @@ fun RenderContentAsMarkdownNotePreview() { runBlocking { withContext(Dispatchers.IO) { val blogPost = - LongTextNoteEvent( + LongFormContentEvent( id = "e69fa72a221d0b7362f8e63fd6ab84cc6b5e7b505fe49cefe6823a47a6a4b583", pubKey = "88cc134b1a65f54ef48acc1df3665063d3ea45f04eab8af4646e561c5ae99079", createdAt = 1718785725, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal/FilterByListParams.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal/FilterByListParams.kt index 9c36e806a9..79d22a9dbe 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal/FilterByListParams.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal/FilterByListParams.kt @@ -33,7 +33,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hasMoreHashtagsThan import com.vitorpamplona.quartz.nip10Notes.threadRootIdOrSelf import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import com.vitorpamplona.quartz.utils.TimeUtils class FilterByListParams( @@ -105,7 +105,7 @@ class FilterByListParams( fun showHiddenKey( selectedListName: String, userHex: String, - ) = selectedListName == PeopleListEvent.blockListFor(userHex) || selectedListName == MuteListEvent.blockListFor(userHex) + ) = selectedListName == FollowSetEvent.blockListFor(userHex) || selectedListName == MuteListEvent.blockListFor(userHex) fun create( followLists: IFeedTopNavFilter?, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/PrefetchFeedMedia.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/PrefetchFeedMedia.kt index 1fbdc53637..3d70cf26d2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/PrefetchFeedMedia.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/PrefetchFeedMedia.kt @@ -298,7 +298,7 @@ private class WarmTargets { /** * Adds NIP-94 file-header media: blobs declared as top-level `url` tags (not - * imeta), as used by FileHeaderEvent and the gallery/file kinds. Only image + * imeta), as used by FileMetadataEvent and the gallery/file kinds. Only image * files are prefetched — detected by the URL extension or the event's top-level * `m` mime type (a hashed URL may carry no extension). The decode listener * records their dims like any other image. @@ -333,7 +333,7 @@ private fun Note.collectWarmTargets(): WarmTargets? { } // NIP-94 file-header convention: the blob is a top-level `url` tag with sibling - // `m`/`dim`, not imeta (FileHeaderEvent and the gallery/file kinds). The generic + // `m`/`dim`, not imeta (FileMetadataEvent and the gallery/file kinds). The generic // imetas() above misses these entirely. targets.addFileHeaderMedia(ev) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/routes/RouteMaker.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/routes/RouteMaker.kt index 13f0e95cf2..3962bce3ac 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/routes/RouteMaker.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/navigation/routes/RouteMaker.kt @@ -44,7 +44,7 @@ import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKey import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKeyable import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent import com.vitorpamplona.quartz.nip28PublicChat.base.IsInPublicChatChannel import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent @@ -57,12 +57,12 @@ import com.vitorpamplona.quartz.nip34Git.pr.GitPullRequestEvent import com.vitorpamplona.quartz.nip34Git.pr.GitPullRequestUpdateEvent import com.vitorpamplona.quartz.nip34Git.repository.GitRepositoryEvent import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip59Giftwrap.HasInnerEvent -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent @@ -247,7 +247,7 @@ fun routeForInner( } } - is FollowListEvent -> { + is StarterPackEvent -> { Route.FollowPack(noteEvent.address()) } @@ -294,7 +294,7 @@ fun routeForInner( Route.GeocacheHunt(noteEvent.kind, noteEvent.pubKey, noteEvent.dTag()) } - is GiftWrapEvent, is SealedRumorEvent -> { + is GiftWrapEvent, is SealEvent -> { val wrap = noteEvent as HasInnerEvent wrap.innerEventId?.let { routeFor(LocalCache.getOrCreateNote(it), loggedIn) @@ -456,7 +456,7 @@ fun routeReplyTo( } is ChatroomKeyable -> { - // Covers PrivateDmEvent (NIP-04) and BaseDMGroupEvent (NIP-17) — both + // Covers EncryptedDmEvent (NIP-04) and BaseDMGroupEvent (NIP-17) — both // implement ChatroomKeyable with identical routing semantics here. routeToMessage( room = noteEvent.chatroomKey(account.userProfile().pubkeyHex), @@ -477,7 +477,7 @@ fun routeReplyTo( } } - is LnZapEvent -> { + is ZapReceiptEvent -> { // A public reply can't tag a private zapper without exposing them. // When we hold the decrypted sender (we are the zap recipient), reply // in their DM room instead of the public comment composer. @@ -532,7 +532,7 @@ suspend fun routeEditDraftTo( Route.NewShortNote(draft = note.idHex) } - is LongTextNoteEvent -> { + is LongFormContentEvent -> { Route.NewLongFormPost(draft = note.idHex) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt index ee0acbe5e7..208b2c4ba1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt @@ -84,7 +84,7 @@ import com.vitorpamplona.quartz.nip01Core.tags.events.ETag import com.vitorpamplona.quartz.nip01Core.tags.events.firstTaggedEvent import com.vitorpamplona.quartz.nip01Core.tags.people.firstTaggedUserId import com.vitorpamplona.quartz.nip30CustomEmoji.taggedEmojis -import com.vitorpamplona.quartz.nip38UserStatus.StatusEvent +import com.vitorpamplona.quartz.nip38UserStatus.UserStatusEvent import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableMap import kotlinx.collections.immutable.persistentMapOf @@ -219,14 +219,14 @@ fun DisplayStatus( nav: INav, ) { val noteState by observeNote(addressableNote, accountViewModel) - val noteEvent = noteState.note.event as? StatusEvent ?: return + val noteEvent = noteState.note.event as? UserStatusEvent ?: return DisplayStatus(noteEvent, accountViewModel, nav) } @Composable fun DisplayStatus( - event: StatusEvent, + event: UserStatusEvent, accountViewModel: AccountViewModel, nav: INav, ) { @@ -266,7 +266,7 @@ fun DisplayStatusInner( nav: INav, ) { when (type) { - StatusEvent.MUSIC -> { + UserStatusEvent.MUSIC -> { Icon( imageVector = CustomHashTagIcons.Tunestr, null, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt index 08ae330cde..a05755b51f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt @@ -331,16 +331,16 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip01Core.tags.geohash.geoHashOrScope import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip10Notes.BaseThreadedEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip13Pow.strongPoWOrNull import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip25Reactions.ExternalReactionEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent @@ -368,26 +368,26 @@ import com.vitorpamplona.quartz.nip51Lists.articleCurationSet.ArticleCurationSet import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.OldBookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.favoriteAlgoFeedsList.FavoriteAlgoFeedsListEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip51Lists.geohashList.GeohashListEvent import com.vitorpamplona.quartz.nip51Lists.gitAuthorList.GitAuthorListEvent import com.vitorpamplona.quartz.nip51Lists.gitRepositoryList.GitRepositoryListEvent import com.vitorpamplona.quartz.nip51Lists.goodWikiAuthorList.GoodWikiAuthorListEvent import com.vitorpamplona.quartz.nip51Lists.goodWikiRelayList.GoodWikiRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent import com.vitorpamplona.quartz.nip51Lists.interestSet.InterestSetEvent import com.vitorpamplona.quartz.nip51Lists.kindMuteSet.KindMuteSetEvent -import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.LabeledBookmarkListEvent +import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.BookmarkSetEvent import com.vitorpamplona.quartz.nip51Lists.mediaFollowList.MediaFollowListEvent import com.vitorpamplona.quartz.nip51Lists.mediaStarterPack.MediaStarterPackEvent import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import com.vitorpamplona.quartz.nip51Lists.pictureCurationSet.PictureCurationSetEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BlockedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BroadcastRelayListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.ProxyRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relaySets.RelaySetEvent import com.vitorpamplona.quartz.nip51Lists.releaseArtifactSet.ReleaseArtifactSetEvent @@ -395,19 +395,19 @@ import com.vitorpamplona.quartz.nip51Lists.simpleGroupList.SimpleGroupListEvent import com.vitorpamplona.quartz.nip51Lists.videoCurationSet.VideoCurationSetEvent import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import com.vitorpamplona.quartz.nip52Calendar.rsvp.CalendarRSVPEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.clip.LiveActivitiesClipEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingRoomEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingSpaceEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip54Wiki.WikiMergeAcceptanceEvent import com.vitorpamplona.quartz.nip54Wiki.WikiMergeRequestEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent import com.vitorpamplona.quartz.nip54Wiki.WikiRedirectEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip57Zaps.splits.hasZapSplitSetupBesidesAuthor import com.vitorpamplona.quartz.nip58Badges.award.BadgeAwardEvent import com.vitorpamplona.quartz.nip58Badges.definition.BadgeDefinitionEvent @@ -427,7 +427,7 @@ import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprov import com.vitorpamplona.quartz.nip72ModCommunities.communityAddress import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent import com.vitorpamplona.quartz.nip72ModCommunities.isACommunityPost -import com.vitorpamplona.quartz.nip75ZapGoals.GoalEvent +import com.vitorpamplona.quartz.nip75ZapGoals.ZapGoalEvent import com.vitorpamplona.quartz.nip78AppData.AppSpecificDataEvent import com.vitorpamplona.quartz.nip7DThreads.ThreadEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent @@ -437,9 +437,9 @@ import com.vitorpamplona.quartz.nip87Ecash.recommendation.MintRecommendationEven import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip89AppHandlers.definition.AppDefinitionEvent import com.vitorpamplona.quartz.nip89AppHandlers.recommendation.AppRecommendationEvent -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.NIP90ContentDiscoveryResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.status.NIP90StatusEvent -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.DvmContentDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.status.DvmStatusEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent import com.vitorpamplona.quartz.nipA0VoiceMessages.BaseVoiceEvent import com.vitorpamplona.quartz.nipA4PublicMessages.PublicMessageEvent @@ -1145,7 +1145,7 @@ private fun RenderNoteRow( RenderReport(baseNote, quotesLeft, backgroundColor, accountViewModel, nav) } - is LongTextNoteEvent -> { + is LongFormContentEvent -> { RenderLongFormContent(baseNote, accountViewModel, nav) } @@ -1171,7 +1171,7 @@ private fun RenderNoteRow( RenderCodeSnippetEvent(baseNote) } - is WikiNoteEvent -> { + is WikiArticleEvent -> { RenderWikiContent(baseNote, accountViewModel, nav) } @@ -1191,7 +1191,7 @@ private fun RenderNoteRow( BadgeDisplay(baseNote = baseNote, accountViewModel = accountViewModel, nav = nav) } - is LnZapEvent -> { + is ZapReceiptEvent -> { RenderLnZap(baseNote, quotesLeft, backgroundColor, accountViewModel, nav) } @@ -1215,11 +1215,11 @@ private fun RenderNoteRow( RenderFhirResource(baseNote, accountViewModel, nav) } - is PeopleListEvent -> { + is FollowSetEvent -> { DisplayPeopleList(baseNote, backgroundColor, accountViewModel, nav) } - is FollowListEvent -> { + is StarterPackEvent -> { DisplayFollowList(baseNote, true, accountViewModel, nav) } @@ -1231,7 +1231,7 @@ private fun RenderNoteRow( DisplayRelaySet(baseNote, backgroundColor, accountViewModel, nav) } - is ChatMessageRelayListEvent -> { + is DmRelayListEvent -> { DisplayDMRelayList(baseNote, backgroundColor, accountViewModel, nav) } @@ -1251,7 +1251,7 @@ private fun RenderNoteRow( DisplayTrustedRelayList(baseNote, backgroundColor, accountViewModel, nav) } - is RelayFeedsListEvent -> { + is FavoriteRelayListEvent -> { DisplayRelayFeedsList(baseNote, backgroundColor, accountViewModel, nav) } @@ -1384,7 +1384,7 @@ private fun RenderNoteRow( ) } - is PrivateDmEvent -> { + is EncryptedDmEvent -> { RenderPrivateMessage( baseNote, makeItShort, @@ -1494,7 +1494,7 @@ private fun RenderNoteRow( RenderCalendarDateSlotEvent(baseNote, accountViewModel, nav) } - is CalendarEvent -> { + is CalendarCollectionEvent -> { RenderCalendarCollectionEvent(baseNote, accountViewModel, nav) } @@ -1502,7 +1502,7 @@ private fun RenderNoteRow( RenderCalendarRSVPEvent(baseNote, accountViewModel, nav) } - is GoalEvent -> { + is ZapGoalEvent -> { RenderGoal(baseNote, accountViewModel, nav) } @@ -1550,7 +1550,7 @@ private fun RenderNoteRow( ) } - is NIP90ContentDiscoveryResponseEvent -> { + is DvmContentDiscoveryResponseEvent -> { RenderNIP90ContentDiscoveryResponse( baseNote, makeItShort, @@ -1562,7 +1562,7 @@ private fun RenderNoteRow( ) } - is NIP90StatusEvent -> { + is DvmStatusEvent -> { RenderNIP90Status( baseNote, accountViewModel, @@ -1640,7 +1640,7 @@ private fun RenderNoteRow( ) } - is FileHeaderEvent -> { + is FileMetadataEvent -> { FileHeaderDisplay(baseNote, true, ContentScale.FillWidth, accountViewModel) } @@ -1879,7 +1879,7 @@ private fun RenderNoteRow( RenderOldBookmarkList(baseNote, quotesLeft, backgroundColor, accountViewModel, nav) } - is LabeledBookmarkListEvent -> { + is BookmarkSetEvent -> { RenderLabeledBookmarkList(baseNote, quotesLeft, backgroundColor, accountViewModel, nav) } @@ -1923,7 +1923,7 @@ private fun RenderNoteRow( RenderMediaStarterPack(baseNote, backgroundColor, accountViewModel, nav) } - is HashtagListEvent -> { + is InterestListEvent -> { RenderHashtagList(baseNote, backgroundColor, accountViewModel, nav) } @@ -2172,7 +2172,7 @@ fun FirstUserInfoRow( // Zap receipts are signed by the recipient's lightning provider; show the // sender from the embedded zap request instead of the service key. val zapSender = - if (baseNote.event is LnZapEvent) { + if (baseNote.event is ZapReceiptEvent) { observeZapSender(baseNote, accountViewModel).value } else { null @@ -2411,7 +2411,7 @@ fun RenderAuthorImages( } else { NoteAuthorPicture(baseNote, Size55dp, accountViewModel = accountViewModel, nav = nav) } - } else if (noteEvent is LnZapEvent) { + } else if (noteEvent is ZapReceiptEvent) { // Zap receipts are signed by the recipient's lightning provider; show the // sender from the embedded zap request instead of the service key, matching // how the thread's master note resolves the author. diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt index 5cb7a5d1cd..a6999b790b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt @@ -116,8 +116,8 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.report.ReportNoteDialog import com.vitorpamplona.quartz.experimental.bounties.bountyBaseReward import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import kotlinx.coroutines.launch import org.jetbrains.compose.resources.StringResource @@ -149,8 +149,8 @@ val externalLinkForNote = { note: Note -> if (note is AddressableNote) { when { note.event?.bountyBaseReward() != null -> "https://nostrbounties.com/b/${note.toNAddr()}" - note.event is PeopleListEvent -> "https://listr.lol/a/${note.toNAddr()}" - note.event is FollowListEvent -> "https://following.space/d/${note.address.dTag}?p=${note.address.pubKeyHex}" + note.event is FollowSetEvent -> "https://listr.lol/a/${note.toNAddr()}" + note.event is StarterPackEvent -> "https://following.space/d/${note.address.dTag}?p=${note.address.pubKeyHex}" else -> njumpLink(note.toNAddr()) } } else { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateReactionTypeDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateReactionTypeDialog.kt index 7fc4cc5be5..5faaa6a2e2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateReactionTypeDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateReactionTypeDialog.kt @@ -95,7 +95,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip01Core.core.Address import com.vitorpamplona.quartz.nip30CustomEmoji.CustomEmoji import com.vitorpamplona.quartz.nip30CustomEmoji.EmojiUrlTag -import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiPackSelectionEvent +import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiListEvent import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toImmutableList @@ -361,7 +361,7 @@ private fun EmojiSelector( accountViewModel.account.emoji.getEmojiPackSelectionAddress(), ) { emptyNote -> emptyNote?.let { usersEmojiList -> - val collections by observeNoteEventAndMapNotNull(usersEmojiList, accountViewModel) { event: EmojiPackSelectionEvent -> + val collections by observeNoteEventAndMapNotNull(usersEmojiList, accountViewModel) { event: EmojiListEvent -> event.emojiPacks().toImmutableList() } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountDialog.kt index 51351dac5b..af65ce3dbb 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountDialog.kt @@ -121,7 +121,7 @@ import com.vitorpamplona.amethyst.commons.ui.theme.placeholderText import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.keyBackup.getFragmentActivity import com.vitorpamplona.amethyst.ui.screen.loggedIn.mockAccountViewModel -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.launch @@ -153,22 +153,22 @@ fun UpdateZapAmountContent( val zapTypes = listOf( Triple( - LnZapEvent.ZapType.PUBLIC, + ZapReceiptEvent.ZapType.PUBLIC, stringRes(id = Res.string.zap_type_public), stringRes(id = Res.string.zap_type_public_explainer), ), Triple( - LnZapEvent.ZapType.PRIVATE, + ZapReceiptEvent.ZapType.PRIVATE, stringRes(id = Res.string.zap_type_private), stringRes(id = Res.string.zap_type_private_explainer), ), Triple( - LnZapEvent.ZapType.ANONYMOUS, + ZapReceiptEvent.ZapType.ANONYMOUS, stringRes(id = Res.string.zap_type_anonymous), stringRes(id = Res.string.zap_type_anonymous_explainer), ), Triple( - LnZapEvent.ZapType.NONZAP, + ZapReceiptEvent.ZapType.NONZAP, stringRes(id = Res.string.zap_type_nonzap), stringRes(id = Res.string.zap_type_nonzap_explainer), ), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountViewModel.kt index b1b44291e6..168e937299 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/UpdateZapAmountViewModel.kt @@ -32,7 +32,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip19Bech32.decodePrivateKeyAsHexOrNull import com.vitorpamplona.quartz.nip19Bech32.decodePublicKey import com.vitorpamplona.quartz.nip47WalletConnect.Nip47WalletConnect -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import kotlinx.coroutines.CancellationException @Stable @@ -44,7 +44,7 @@ class UpdateZapAmountViewModel : ViewModel() { var walletConnectRelay by mutableStateOf(TextFieldValue("")) var walletConnectPubkey by mutableStateOf(TextFieldValue("")) var walletConnectSecret by mutableStateOf(TextFieldValue("")) - var selectedZapType by mutableStateOf(LnZapEvent.ZapType.PRIVATE) + var selectedZapType by mutableStateOf(ZapReceiptEvent.ZapType.PRIVATE) // A local UI preference rather than synced account state, but it is edited on // this screen, so it follows this screen's Save/Cancel contract instead of diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt index 75a78c8df2..ac414ad2b2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt @@ -117,7 +117,7 @@ import com.vitorpamplona.amethyst.service.ZapPaymentHandler import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.wallet.OnchainZapSendDialog import com.vitorpamplona.quartz.nip01Core.core.Event -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import kotlinx.collections.immutable.ImmutableList import kotlinx.coroutines.CancellationException @@ -163,35 +163,35 @@ fun ZapCustomDialog( val zapTypes = listOf( Triple( - LnZapEvent.ZapType.PUBLIC, + ZapReceiptEvent.ZapType.PUBLIC, stringRes(id = Res.string.zap_type_public), stringRes(id = Res.string.zap_type_public_explainer), ), Triple( - LnZapEvent.ZapType.PRIVATE, + ZapReceiptEvent.ZapType.PRIVATE, stringRes(id = Res.string.zap_type_private), stringRes(id = Res.string.zap_type_private_explainer), ), Triple( - LnZapEvent.ZapType.ANONYMOUS, + ZapReceiptEvent.ZapType.ANONYMOUS, stringRes(id = Res.string.zap_type_anonymous), stringRes(id = Res.string.zap_type_anonymous_explainer), ), Triple( - LnZapEvent.ZapType.NONZAP, + ZapReceiptEvent.ZapType.NONZAP, stringRes(id = Res.string.zap_type_nonzap), stringRes(id = Res.string.zap_type_nonzap_explainer), ), ).filter { - !isPrivateTarget || it.first == LnZapEvent.ZapType.PRIVATE || it.first == LnZapEvent.ZapType.NONZAP + !isPrivateTarget || it.first == ZapReceiptEvent.ZapType.PRIVATE || it.first == ZapReceiptEvent.ZapType.NONZAP } var selectedZapType by remember(accountViewModel, baseNote) { val default = accountViewModel.defaultZapType() mutableStateOf( - if (isPrivateTarget && default != LnZapEvent.ZapType.NONZAP) { - LnZapEvent.ZapType.PRIVATE + if (isPrivateTarget && default != ZapReceiptEvent.ZapType.NONZAP) { + ZapReceiptEvent.ZapType.PRIVATE } else { default }, @@ -327,15 +327,15 @@ fun ZapCustomDialog( OutlinedTextField( label = { when (selectedZapType) { - LnZapEvent.ZapType.PUBLIC, LnZapEvent.ZapType.ANONYMOUS -> { + ZapReceiptEvent.ZapType.PUBLIC, ZapReceiptEvent.ZapType.ANONYMOUS -> { Text(text = stringRes(id = Res.string.custom_zaps_add_a_message)) } - LnZapEvent.ZapType.PRIVATE -> { + ZapReceiptEvent.ZapType.PRIVATE -> { Text(text = stringRes(id = Res.string.custom_zaps_add_a_message_private)) } - LnZapEvent.ZapType.NONZAP -> { + ZapReceiptEvent.ZapType.NONZAP -> { Text(text = stringRes(id = Res.string.custom_zaps_add_a_message_nonzap)) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapPollNote.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapPollNote.kt index 445efa5a78..60899cf0e4 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapPollNote.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapPollNote.kt @@ -113,7 +113,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.mockAccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.mockVitorAccountViewModel import com.vitorpamplona.quartz.experimental.zapPolls.ZapPollEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import kotlinx.collections.immutable.ImmutableList import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -145,7 +145,7 @@ fun ZapZapPollNotePreview() { ) val zapVote = - LnZapEvent( + ZapReceiptEvent( id = "2a17fdcd0e387d1623c7313d7aa2848e18dde8a942cfe8a2d6b686ea5f68f01a", pubKey = "79f00d3f5a19ec806189fcab03c1be4ff81d18ee4f653c88fac41fe03570f432", createdAt = 1729186293, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapPollNoteViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapPollNoteViewModel.kt index 1a331eb8ac..d8970b6b23 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapPollNoteViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapPollNoteViewModel.kt @@ -30,8 +30,8 @@ import com.vitorpamplona.amethyst.commons.model.Note import com.vitorpamplona.amethyst.commons.model.User import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.quartz.experimental.zapPolls.ZapPollEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.utils.TimeUtils import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -233,9 +233,9 @@ class PollNoteViewModel : ViewModel() { user: User, ): Boolean = pollNote!!.zaps.any { - val zapEvent = it.value?.event as? LnZapEvent + val zapEvent = it.value?.event as? ZapReceiptEvent val privateZapAuthor = - (it.key.event as? LnZapRequestEvent)?.let { + (it.key.event as? ZapRequestEvent)?.let { account.privateZapsDecryptionCache.cachedPrivateZap(it) } zapEvent?.zappedPollOption() == option && @@ -244,7 +244,7 @@ class PollNoteViewModel : ViewModel() { private fun zappedPollOptionAmount(option: Int): BigDecimal = pollNote?.zaps?.values?.sumOf { - val event = it?.event as? LnZapEvent + val event = it?.event as? ZapReceiptEvent val zapAmount = event?.amount ?: BigDecimal.ZERO val isValidAmount = isValidInputVoteAmount(event?.amount) @@ -258,7 +258,7 @@ class PollNoteViewModel : ViewModel() { private fun totalZapped(): BigDecimal = pollNote?.zaps?.values?.sumOf { - val zapEvent = (it?.event as? LnZapEvent) + val zapEvent = (it?.event as? ZapReceiptEvent) val zapAmount = zapEvent?.amount ?: BigDecimal.ZERO val isValidAmount = isValidInputVoteAmount(zapEvent?.amount) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/emojiSuggestions/WatchAndLoadMyEmojiList.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/emojiSuggestions/WatchAndLoadMyEmojiList.kt index 1687f0a6ea..cabe2aafbe 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/emojiSuggestions/WatchAndLoadMyEmojiList.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/emojiSuggestions/WatchAndLoadMyEmojiList.kt @@ -27,16 +27,16 @@ import com.vitorpamplona.amethyst.service.relayClient.reqCommand.event.observeNo import com.vitorpamplona.amethyst.ui.note.LoadAddressableNote import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip01Core.tags.aTag.taggedAddresses -import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiPackSelectionEvent +import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiListEvent import kotlinx.collections.immutable.toImmutableList @Composable fun WatchAndLoadMyEmojiList(accountViewModel: AccountViewModel) { LoadAddressableNote( - EmojiPackSelectionEvent.createAddress(accountViewModel.userProfile().pubkeyHex), + EmojiListEvent.createAddress(accountViewModel.userProfile().pubkeyHex), ) { emptyNote -> emptyNote?.let { usersEmojiList -> - val collections by observeNoteEventAndMapNotNull(usersEmojiList, accountViewModel) { event: EmojiPackSelectionEvent -> + val collections by observeNoteEventAndMapNotNull(usersEmojiList, accountViewModel) { event: EmojiListEvent -> event.taggedAddresses().toImmutableList() } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/AddInboxRelayForDMCard.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/AddInboxRelayForDMCard.kt index 15205698c9..856bddd12c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/AddInboxRelayForDMCard.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/AddInboxRelayForDMCard.kt @@ -55,7 +55,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.mockAccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.dm.AddDMRelayListDialog import com.vitorpamplona.quartz.nip01Core.core.HexKey -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent @Preview @Composable @@ -88,7 +88,7 @@ fun ObserveRelayListForDMsAndDisplayIfNotFound( @Composable fun ObserveRelayListForDMs( accountViewModel: AccountViewModel, - inner: @Composable (relayListEvent: ChatMessageRelayListEvent?) -> Unit, + inner: @Composable (relayListEvent: DmRelayListEvent?) -> Unit, ) { ObserveRelayListForDMs( pubkey = accountViewModel.account.userProfile().pubkeyHex, @@ -102,13 +102,13 @@ fun ObserveRelayListForDMs( fun ObserveRelayListForDMs( pubkey: HexKey, accountViewModel: AccountViewModel, - inner: @Composable (relayListEvent: ChatMessageRelayListEvent?) -> Unit, + inner: @Composable (relayListEvent: DmRelayListEvent?) -> Unit, ) { LoadAddressableNote( - ChatMessageRelayListEvent.createAddress(pubkey), + DmRelayListEvent.createAddress(pubkey), ) { relayList -> if (relayList != null) { - val relayListEvent by observeNoteEvent(relayList, accountViewModel) + val relayListEvent by observeNoteEvent(relayList, accountViewModel) inner(relayListEvent) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/NoteActionSections.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/NoteActionSections.kt index cbb23ef5a4..958acad531 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/NoteActionSections.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/elements/NoteActionSections.kt @@ -80,7 +80,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.experimental.music.track.MusicTrackEvent import com.vitorpamplona.quartz.nip01Core.jackson.JacksonMapper import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent import com.vitorpamplona.quartz.nip30CustomEmoji.pack.EmojiPackEvent import kotlinx.coroutines.Dispatchers @@ -222,7 +222,7 @@ fun noteActionSections( // nostr source pre-tagged (`a` for an addressable article, else `e`) plus the author, // and the passage left for the user to type or paste. Prose kinds only, and never a // private rumor (a public highlight would e-tag the unsigned rumor onto relays). - if (!isPrivateRumor && (note.event is TextNoteEvent || note.event is LongTextNoteEvent)) { + if (!isPrivateRumor && (note.event is TextNoteEvent || note.event is LongFormContentEvent)) { add( NoteAction(MaterialSymbols.FormatQuote, stringRes(Res.string.highlight_action)) { val author = note.author?.pubkeyHex @@ -256,7 +256,7 @@ fun noteActionSections( onClick = handlers.onEditPost, ), ) - } else if (note.event is LongTextNoteEvent && state.isLoggedUser) { + } else if (note.event is LongFormContentEvent && state.isLoggedUser) { add( NoteAction(MaterialSymbols.Edit, stringRes(Res.string.edit_article)) { nav.nav { Route.NewLongFormPost(version = note.idHex) } @@ -343,10 +343,10 @@ fun noteActionSections( } else -> { - val noteBookmarkType = if (note.event is LongTextNoteEvent) stringRes(Res.string.article) else stringRes(Res.string.post) + val noteBookmarkType = if (note.event is LongFormContentEvent) stringRes(Res.string.article) else stringRes(Res.string.post) add( NoteAction(MaterialSymbols.BookmarkAdd, stringRes(Res.string.manage_bookmark_label, noteBookmarkType)) { - if (note.event is LongTextNoteEvent) { + if (note.event is LongFormContentEvent) { nav.nav(Route.ArticleBookmarkManagement((note as AddressableNote).address)) } else { nav.nav(Route.PostBookmarkManagement(note.idHex)) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/CommentPostViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/CommentPostViewModel.kt index 8afb6da337..f6550f6e3a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/CommentPostViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/nip22Comments/CommentPostViewModel.kt @@ -109,7 +109,7 @@ import com.vitorpamplona.quartz.nip36SensitiveContent.contentWarningReason import com.vitorpamplona.quartz.nip36SensitiveContent.isSensitive import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent import com.vitorpamplona.quartz.nip40Expiration.expiration -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip57Zaps.splits.zapSplits import com.vitorpamplona.quartz.nip57Zaps.zapraiser.zapraiser import com.vitorpamplona.quartz.nip57Zaps.zapraiser.zapraiserAmount @@ -352,7 +352,7 @@ open class CommentPostViewModel : this.externalIdentity = (post.event as? CommentEvent)?.scope() mutedNotifies = emptySet() notifyProvenance = emptyMap() - (post.event as? LnZapEvent)?.let { zap -> + (post.event as? ZapReceiptEvent)?.let { zap -> notifying = listOfNotNull(zapSenderToNotify(zap)) } observeCommunityRules(post) @@ -366,7 +366,7 @@ open class CommentPostViewModel : * by an ephemeral key: skip those — tagging the throwaway key is useless, and * tagging the decrypted sender would publicly expose a private zapper. */ - private fun zapSenderToNotify(zapEvent: LnZapEvent): User? { + private fun zapSenderToNotify(zapEvent: ZapReceiptEvent): User? { val request = zapEvent.zapRequest ?: return null if (request.hasAnonTag()) return null if (request.pubKey == account.signer.pubKey) return null @@ -554,7 +554,7 @@ open class CommentPostViewModel : // Replies to zaps notify the zap sender through a plain p tag (the receipt's // author keys above are the lightning provider). The sender chip always comes // back; a missing p tag in the draft means the user muted their bell. - (replyingTo?.event as? LnZapEvent)?.let { zap -> + (replyingTo?.event as? ZapReceiptEvent)?.let { zap -> zapSenderToNotify(zap)?.let { sender -> notifying = ((notifying ?: emptyList()) + sender).distinct() if (!draftEvent.tags.mapNotNull(PTag::parseKey).contains(sender.pubkeyHex)) { @@ -726,7 +726,7 @@ open class CommentPostViewModel : null } } - } else if (replyingToEvent is LnZapEvent) { + } else if (replyingToEvent is ZapReceiptEvent) { val sender = zapSenderToNotify(replyingToEvent) // The sender's chip stays in the list; a muted bell means // the user doesn't want to ping them, so don't tag them. diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/share/SharedNoteCard.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/share/SharedNoteCard.kt index 0a54abc2f0..f0d9265a41 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/share/SharedNoteCard.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/share/SharedNoteCard.kt @@ -63,7 +63,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.profile.gallery.GalleryThum import com.vitorpamplona.amethyst.ui.screen.loggedIn.profile.gallery.UrlImageView import com.vitorpamplona.quartz.experimental.profileGallery.ProfileGalleryEntryEvent import com.vitorpamplona.quartz.nip01Core.core.Event -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip36SensitiveContent.ContentWarningTag import com.vitorpamplona.quartz.nip36SensitiveContent.isSensitiveOrNSFW import com.vitorpamplona.quartz.nip53LiveActivities.clip.LiveActivitiesClipEvent @@ -278,7 +278,7 @@ private fun secondaryLineFor( return when { event is PictureEvent -> stringRes(Res.string.share_as_qr_kind_picture) event is VideoEvent -> stringRes(Res.string.kind_video) - event is LongTextNoteEvent -> stringRes(Res.string.article) + event is LongFormContentEvent -> stringRes(Res.string.article) hasContentImage -> stringRes(Res.string.share_as_qr_kind_picture) else -> "" } @@ -293,7 +293,7 @@ internal fun secondaryBodyTextFor( // Gated: never surface the note's own title, content or alt text, only the kind label above. if (isGated) return null - if (event is LongTextNoteEvent) { + if (event is LongFormContentEvent) { val title = event.title() if (!title.isNullOrBlank()) return title } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/CalendarCollectionRender.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/CalendarCollectionRender.kt index e28e4021e7..22b1fa72c6 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/CalendarCollectionRender.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/CalendarCollectionRender.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.commons.model.Note import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.commons.ui.note.CalendarCollectionCard import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent /** * Entry for a NIP-52 calendar collection: decodes the [Note] and renders the shared commons @@ -38,7 +38,7 @@ fun RenderCalendarCollectionEvent( accountViewModel: AccountViewModel, nav: INav, ) { - val event = note.event as? CalendarEvent ?: return + val event = note.event as? CalendarCollectionEvent ?: return CalendarCollectionCard(event) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/FileHeader.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/FileHeader.kt index 81a4a54709..bda74a2880 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/FileHeader.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/FileHeader.kt @@ -35,7 +35,7 @@ import com.vitorpamplona.amethyst.ui.components.SensitivityWarning import com.vitorpamplona.amethyst.ui.components.ZoomableContentView import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip31Alts.alt -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent @Composable fun FileHeaderDisplay( @@ -44,7 +44,7 @@ fun FileHeaderDisplay( contentScale: ContentScale, accountViewModel: AccountViewModel, ) { - val event = (note.event as? FileHeaderEvent) ?: return + val event = (note.event as? FileMetadataEvent) ?: return val fullUrl = event.url() ?: return val mimeType = remember(note) { event.mimeType() } val content = remember(note) { event.toMediaContent(note, fullUrl, mimeType) } @@ -72,7 +72,7 @@ fun FileHeaderDisplay( * video event the kind itself asserts nothing about how to render the payload. A null here means * the file belongs in [FileHeaderAttachmentCard] rather than being pushed into the video player. */ -internal fun FileHeaderEvent.toMediaContent( +internal fun FileMetadataEvent.toMediaContent( note: Note, url: String, mimeType: String?, @@ -129,7 +129,7 @@ internal fun FileHeaderEvent.toMediaContent( /** The link card a kind-1063 header falls back to when [toMediaContent] returns null. */ @Composable internal fun FileHeaderAttachmentCard( - event: FileHeaderEvent, + event: FileMetadataEvent, url: String, mimeType: String?, ) { @@ -145,4 +145,4 @@ internal fun FileHeaderAttachmentCard( } /** The human-facing name of the file: NIP-94 `content` when present, else the `alt` tag. */ -private fun FileHeaderEvent.fileDescription(): String? = content.ifEmpty { null } ?: alt() +private fun FileMetadataEvent.fileDescription(): String? = content.ifEmpty { null } ?: alt() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/FollowList.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/FollowList.kt index 2f394b2fe8..ac06818f09 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/FollowList.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/FollowList.kt @@ -66,7 +66,7 @@ import com.vitorpamplona.amethyst.ui.note.elements.DefaultImageHeaderBackground import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.discover.nip51FollowSets.FollowSetCard import com.vitorpamplona.amethyst.ui.screen.loggedIn.mockAccountViewModel -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toImmutableList @@ -79,7 +79,7 @@ fun DisplayFollowList( nav: INav, ) { val card = - observeNoteEventAndMap(baseNote, accountViewModel) { event: FollowListEvent? -> + observeNoteEventAndMap(baseNote, accountViewModel) { event: StarterPackEvent? -> if (event == null) { FollowSetCard( name = "", @@ -190,7 +190,7 @@ fun RenderFollowSetThumbPreview() { val accountViewModel = mockAccountViewModel() val followCard = - FollowListEvent( + StarterPackEvent( id = "eca31634fce7c9068b56fa8db9f387da70bdcceb3986a77ca1a9844f3128eb5f", pubKey = "3c39a7b53dec9ac85acf08b267637a9841e6df7b7b0f5e2ac56a8cf107de37da", createdAt = 1761736286, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Goal.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Goal.kt index a272a55618..0c314f5017 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Goal.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Goal.kt @@ -60,7 +60,7 @@ import com.vitorpamplona.amethyst.ui.note.elements.DefaultImageHeader import com.vitorpamplona.amethyst.ui.note.elements.DefaultImageHeaderBackground import com.vitorpamplona.amethyst.ui.note.showAmount import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip75ZapGoals.GoalEvent +import com.vitorpamplona.quartz.nip75ZapGoals.ZapGoalEvent import com.vitorpamplona.quartz.utils.TimeUtils import java.math.BigDecimal import kotlin.math.roundToInt @@ -71,14 +71,14 @@ fun RenderGoal( accountViewModel: AccountViewModel, nav: INav, ) { - val noteEvent = note.event as? GoalEvent ?: return + val noteEvent = note.event as? ZapGoalEvent ?: return GoalHeader(noteEvent, note, accountViewModel, nav) } @Composable fun GoalHeader( - noteEvent: GoalEvent, + noteEvent: ZapGoalEvent, note: Note, accountViewModel: AccountViewModel, nav: INav, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/LongForm.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/LongForm.kt index 7e87980caa..c316416092 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/LongForm.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/LongForm.kt @@ -65,7 +65,7 @@ import com.vitorpamplona.amethyst.ui.note.elements.DefaultImageHeader import com.vitorpamplona.amethyst.ui.note.elements.DefaultImageHeaderBackground import com.vitorpamplona.amethyst.ui.note.elements.TimeAgo import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import kotlinx.collections.immutable.toImmutableList private const val WORDS_PER_MINUTE = 225 @@ -77,7 +77,7 @@ fun RenderLongFormContent( accountViewModel: AccountViewModel, nav: INav, ) { - val noteEvent = note.event as? LongTextNoteEvent ?: return + val noteEvent = note.event as? LongFormContentEvent ?: return LongFormHeader(noteEvent, note, accountViewModel) } @@ -85,7 +85,7 @@ fun RenderLongFormContent( @OptIn(ExperimentalLayoutApi::class) @Composable fun LongFormHeader( - noteEvent: LongTextNoteEvent, + noteEvent: LongFormContentEvent, note: Note, accountViewModel: AccountViewModel, ) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/NIP90ContentDiscoveryResponse.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/NIP90ContentDiscoveryResponse.kt index d5c9a604ab..2bee2e52d0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/NIP90ContentDiscoveryResponse.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/NIP90ContentDiscoveryResponse.kt @@ -35,7 +35,7 @@ import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer import com.vitorpamplona.amethyst.ui.note.elements.DisplayUncitedHashtags import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hasHashtags -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.NIP90ContentDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.DvmContentDiscoveryResponseEvent @Composable fun RenderNIP90ContentDiscoveryResponse( @@ -47,7 +47,7 @@ fun RenderNIP90ContentDiscoveryResponse( accountViewModel: AccountViewModel, nav: INav, ) { - val noteEvent = note.event as? NIP90ContentDiscoveryResponseEvent ?: return + val noteEvent = note.event as? DvmContentDiscoveryResponseEvent ?: return val callbackUri = remember(note) { note.toNostrUri() } SensitivityWarning( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/NIP90Status.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/NIP90Status.kt index a2afc2ebec..6b6bfb0303 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/NIP90Status.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/NIP90Status.kt @@ -25,7 +25,7 @@ import androidx.compose.runtime.Composable import com.vitorpamplona.amethyst.commons.model.Note import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip90Dvms.status.NIP90StatusEvent +import com.vitorpamplona.quartz.nip90Dvms.status.DvmStatusEvent @Composable fun RenderNIP90Status( @@ -33,7 +33,7 @@ fun RenderNIP90Status( accountViewModel: AccountViewModel, nav: INav, ) { - val noteEvent = note.event as? NIP90StatusEvent ?: return + val noteEvent = note.event as? DvmStatusEvent ?: return Text(text = noteEvent.content) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PeopleList.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PeopleList.kt index effd49f5e1..64b4fa7b39 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PeopleList.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PeopleList.kt @@ -56,7 +56,7 @@ import com.vitorpamplona.amethyst.ui.note.UserCompose import com.vitorpamplona.amethyst.ui.note.getGradient import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip01Core.tags.people.taggedUserIds -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf @@ -68,7 +68,7 @@ fun DisplayPeopleList( accountViewModel: AccountViewModel, nav: INav, ) { - val noteEvent = baseNote.event as? PeopleListEvent ?: return + val noteEvent = baseNote.event as? FollowSetEvent ?: return var members by remember { mutableStateOf>(persistentListOf()) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PrivateMessage.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PrivateMessage.kt index 1a2310f3fc..743ada7075 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PrivateMessage.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PrivateMessage.kt @@ -53,7 +53,7 @@ import com.vitorpamplona.amethyst.ui.note.elements.DisplayUncitedHashtags import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.privateDM.header.ChatroomHeader import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hasHashtags -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKeyable import com.vitorpamplona.quartz.nip19Bech32.toNpub @@ -67,7 +67,7 @@ fun RenderPrivateMessage( accountViewModel: AccountViewModel, nav: INav, ) { - val noteEvent = note.event as? PrivateDmEvent ?: return + val noteEvent = note.event as? EncryptedDmEvent ?: return val userRoom by remember(note) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Publication.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Publication.kt index ae654a1f05..fdccdb6b39 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Publication.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Publication.kt @@ -80,8 +80,8 @@ import com.vitorpamplona.quartz.experimental.publications.PublicationContentEven import com.vitorpamplona.quartz.experimental.publications.PublicationIndexEvent import com.vitorpamplona.quartz.experimental.publications.PublicationSectionRef import com.vitorpamplona.quartz.nip01Core.core.Event -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import kotlinx.collections.immutable.toImmutableList // A 2:3 portrait cover — a book jacket, which is what NKBIP-01's default `book` type is. The @@ -355,8 +355,8 @@ private fun ObservedSectionRow( // list long-form, wiki and spec events as sections too. is PublicationIndexEvent -> event.titleOrIdentifier() is PublicationContentEvent -> event.titleOrIdentifier() - is LongTextNoteEvent -> event.title() - is WikiNoteEvent -> event.title() + is LongFormContentEvent -> event.title() + is WikiArticleEvent -> event.title() // A bookshelf directory lists whatever it likes, including another directory, so the // row has to name the library kinds too -- otherwise a nested entry falls through to // the section placeholder and reads "Untitled section", which it is not. diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PublicationSection.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PublicationSection.kt index 73fea0a6e4..8eeaeba528 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PublicationSection.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/PublicationSection.kt @@ -67,7 +67,7 @@ import com.vitorpamplona.quartz.experimental.publications.PublicationIndexEvent import com.vitorpamplona.quartz.experimental.publications.PublicationSectionRef import com.vitorpamplona.quartz.nip19Bech32.entities.NAddress import com.vitorpamplona.quartz.nip19Bech32.entities.NEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent /** * Renders a kind-30041 NKBIP-01 publication section — a chapter, zettel or episode. @@ -331,12 +331,12 @@ private fun wikilinkResolver(event: PublicationContentEvent): (String) -> String link == null -> null link.eventId != null -> - "nostr:" + NEvent.create(link.eventId!!, link.pubKey, WikiNoteEvent.KIND, link.relay) + "nostr:" + NEvent.create(link.eventId!!, link.pubKey, WikiArticleEvent.KIND, link.relay) link.pubKey != null -> "nostr:" + NAddress.create( - WikiNoteEvent.KIND, + WikiArticleEvent.KIND, link.pubKey!!, PublicationContentEvent.normalizeWikilink(link.target), link.relay, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RelayList.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RelayList.kt index e90e933cbb..ec1f485c88 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RelayList.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/RelayList.kt @@ -70,7 +70,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip01Core.core.firstTagValueFor import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.displayUrl -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relaySets.RelaySetEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent import kotlinx.collections.immutable.toImmutableList @@ -158,7 +158,7 @@ fun DisplayDMRelayList( accountViewModel: AccountViewModel, nav: INav, ) { - val noteEvent = baseNote.event as? ChatMessageRelayListEvent ?: return + val noteEvent = baseNote.event as? DmRelayListEvent ?: return val relays = remember(noteEvent) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/SoftwareApp.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/SoftwareApp.kt index 2bb1f341e6..8067e9db46 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/SoftwareApp.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/SoftwareApp.kt @@ -96,12 +96,11 @@ import com.vitorpamplona.amethyst.ui.note.elements.MoreOptionsButton import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.application.SoftwareApplicationEvent import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.asset.SoftwareAssetEvent -import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.SoftwareReleaseEvent -import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.asSoftwareRelease import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.isNip82SoftwareRelease import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.tags.AppIdTag import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag +import com.vitorpamplona.quartz.nip51Lists.releaseArtifactSet.ReleaseArtifactSetEvent import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.distinctUntilChanged @@ -209,7 +208,7 @@ fun RenderSoftwareApplication( } /** - * Latest NIP-82 [SoftwareReleaseEvent] version for [app], kept live. + * Latest NIP-82 [ReleaseArtifactSetEvent] version for [app], kept live. * * Releases (kind 30063) are separate events that point back to the app via an * `i` tag rather than an `a` tag, so they are never indexed as replies to the @@ -230,7 +229,7 @@ fun produceLatestReleaseVersion(app: SoftwareApplicationEvent): State { remember(app.pubKey, app.id) { val filter = Filter( - kinds = listOf(SoftwareReleaseEvent.KIND), + kinds = listOf(ReleaseArtifactSetEvent.KIND), authors = listOf(app.pubKey), tags = mapOf(AppIdTag.TAG_NAME to listOf(app.appId())), ) @@ -243,13 +242,13 @@ fun produceLatestReleaseVersion(app: SoftwareApplicationEvent): State { return flow.collectAsStateWithLifecycle(initialValue = null) } -fun findLatestNip82Release(app: SoftwareApplicationEvent): SoftwareReleaseEvent? = latestNip82Release(nip82ReleaseNotesFor(app), app) +fun findLatestNip82Release(app: SoftwareApplicationEvent): ReleaseArtifactSetEvent? = latestNip82Release(nip82ReleaseNotesFor(app), app) /** Picks the newest NIP-82 release for [app] out of an already-narrowed [notes] collection. */ private fun latestNip82Release( notes: Collection, app: SoftwareApplicationEvent, -): SoftwareReleaseEvent? { +): ReleaseArtifactSetEvent? { val prefix = "${app.dTag()}@" return notes .mapNotNull { it.asNip82ReleaseFor(prefix) } @@ -259,25 +258,22 @@ private fun latestNip82Release( /** kind-30063 addressables authored by [app] whose `d` tag is `@`. */ private fun nip82ReleaseNotesFor(app: SoftwareApplicationEvent): Set { val prefix = "${app.dTag()}@" - return LocalCache.addressables.filterIntoSet(SoftwareReleaseEvent.KIND, app.pubKey) { _, addr -> + return LocalCache.addressables.filterIntoSet(ReleaseArtifactSetEvent.KIND, app.pubKey) { _, addr -> val ev = addr.event ?: return@filterIntoSet false ev.isNip82SoftwareRelease() && ev.dTag().startsWith(prefix) } } /** - * Re-reads this note as the NIP-82 release for [prefix] (`@`). kind 30063 - * collides with NIP-51 `ReleaseArtifactSetEvent`, which is what `EventFactory` - * builds, so we re-parse matching tag arrays as the NIP-82 form. + * This note as the NIP-82 release for [prefix] (`@`). kind 30063 is shared + * with NIP-51 release artifact sets, so only events carrying the NIP-82 tags qualify. */ -private fun Note.asNip82ReleaseFor(prefix: String): SoftwareReleaseEvent? = - when (val ev = event) { - null -> null - is SoftwareReleaseEvent -> ev.takeIf { it.dTag().startsWith(prefix) } - else -> if (ev.isNip82SoftwareRelease() && ev.dTag().startsWith(prefix)) ev.asSoftwareRelease() else null - } +private fun Note.asNip82ReleaseFor(prefix: String): ReleaseArtifactSetEvent? { + val ev = event as? ReleaseArtifactSetEvent ?: return null + return ev.takeIf { it.isNip82SoftwareRelease() && it.dTag().startsWith(prefix) } +} -fun findAllNip82Releases(app: SoftwareApplicationEvent): List { +fun findAllNip82Releases(app: SoftwareApplicationEvent): List { val prefix = "${app.dTag()}@" return nip82ReleaseNotesFor(app) .mapNotNull { it.asNip82ReleaseFor(prefix) } @@ -486,25 +482,17 @@ fun RenderSoftwareRelease( accountViewModel: AccountViewModel, nav: INav, ) { - // kind 30063 is shared between NIP-51 ReleaseArtifactSetEvent and NIP-82 SoftwareReleaseEvent; - // EventFactory always returns the NIP-51 class, so we re-parse the same tag array as the - // NIP-82 form when the tag signature matches. - val rawEvent = note.event ?: return - val event: SoftwareReleaseEvent = - if (rawEvent is SoftwareReleaseEvent) { - rawEvent - } else if (rawEvent.isNip82SoftwareRelease()) { - rawEvent.asSoftwareRelease() - } else { - return - } + // kind 30063 is shared between NIP-51 release artifact sets and NIP-82 software + // releases; only render the NIP-82 form here. + val event = note.event as? ReleaseArtifactSetEvent ?: return + if (!event.isNip82SoftwareRelease()) return RenderSoftwareReleaseBody(event = event, accountViewModel = accountViewModel, nav = nav) } @Composable fun RenderSoftwareReleaseBody( - event: SoftwareReleaseEvent, + event: ReleaseArtifactSetEvent, accountViewModel: AccountViewModel, nav: INav, showAppId: Boolean = true, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt index b9bdd996a6..908ff3f919 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Text.kt @@ -60,7 +60,7 @@ import com.vitorpamplona.quartz.nip10Notes.BaseThreadedEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip14Subject.subject import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent enum class ReplyRenderType { FULL, @@ -129,7 +129,7 @@ fun RenderTextEvent( // Zap receipts are signed by the recipient's lightning provider; // label the reply with the zap sender instead of the service key. val zapSender = - if (parentNote.event is LnZapEvent) { + if (parentNote.event is ZapReceiptEvent) { observeZapSender(parentNote, accountViewModel).value } else { null diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Wiki.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Wiki.kt index 22d717f56d..be61fdda0a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Wiki.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Wiki.kt @@ -50,7 +50,7 @@ import com.vitorpamplona.amethyst.ui.components.MyAsyncImage import com.vitorpamplona.amethyst.ui.note.elements.DefaultImageHeader import com.vitorpamplona.amethyst.ui.note.elements.DefaultImageHeaderBackground import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent @Composable fun RenderWikiContent( @@ -58,14 +58,14 @@ fun RenderWikiContent( accountViewModel: AccountViewModel, nav: INav, ) { - val noteEvent = note.event as? WikiNoteEvent ?: return + val noteEvent = note.event as? WikiArticleEvent ?: return WikiNoteHeader(noteEvent, note, accountViewModel, nav) } @Composable private fun WikiNoteHeader( - noteEvent: WikiNoteEvent, + noteEvent: WikiArticleEvent, note: Note, accountViewModel: AccountViewModel, nav: INav, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/WikiCollaboration.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/WikiCollaboration.kt index 4338782fd5..521e0e02db 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/WikiCollaboration.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/WikiCollaboration.kt @@ -55,9 +55,9 @@ import com.vitorpamplona.amethyst.ui.components.TranslatableRichTextViewer import com.vitorpamplona.amethyst.ui.note.LoadAddressableNote import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip01Core.core.Address +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip54Wiki.WikiMergeAcceptanceEvent import com.vitorpamplona.quartz.nip54Wiki.WikiMergeRequestEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent import com.vitorpamplona.quartz.nip54Wiki.WikiRedirectEvent /** @@ -215,7 +215,7 @@ private fun WikiArticleRow( ) { LoadAddressableNote(address) { articleNote -> if (articleNote != null) { - val article by observeNoteEvent(articleNote, accountViewModel) + val article by observeNoteEvent(articleNote, accountViewModel) WikiRow( // The coordinate's own identifier is a readable slug, so it stands in until the @@ -240,7 +240,7 @@ private fun WikiVersionRow( ) { LoadNote(eventId) { versionNote -> if (versionNote != null) { - val article by observeNoteEvent(versionNote, accountViewModel) + val article by observeNoteEvent(versionNote, accountViewModel) WikiRow( title = article?.title() ?: eventId.take(8), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ZapEvent.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ZapEvent.kt index 94c76b141e..bc6d1bb5f8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ZapEvent.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/ZapEvent.kt @@ -64,7 +64,7 @@ import com.vitorpamplona.amethyst.ui.note.UserPicture import com.vitorpamplona.amethyst.ui.note.ZapAmountCommentNotification import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.mockAccountViewModel -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking import kotlinx.coroutines.withContext @@ -104,7 +104,7 @@ fun RenderLnZap( accountViewModel: AccountViewModel, nav: INav, ) { - val zapEvent = note.event as? LnZapEvent ?: return + val zapEvent = note.event as? ZapReceiptEvent ?: return val card by parseAuthorCommentAndAmount(note, accountViewModel) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/lists/BookmarkLists.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/lists/BookmarkLists.kt index 157bf7f0de..2a8a1ce57b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/lists/BookmarkLists.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/lists/BookmarkLists.kt @@ -38,7 +38,7 @@ import com.vitorpamplona.quartz.nip51Lists.articleCurationSet.ArticleCurationSet import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.OldBookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.tags.BookmarkIdTag -import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.LabeledBookmarkListEvent +import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.BookmarkSetEvent import com.vitorpamplona.quartz.nip51Lists.pictureCurationSet.PictureCurationSetEvent /** NIP-51 kind 10003: the user's bookmarks — notes, articles, hashtags and links. */ @@ -108,7 +108,7 @@ fun RenderLabeledBookmarkList( accountViewModel: AccountViewModel, nav: INav, ) { - val noteEvent = baseNote.event as? LabeledBookmarkListEvent ?: return + val noteEvent = baseNote.event as? BookmarkSetEvent ?: return val public = remember(noteEvent) { noteEvent.publicBookmarks() } val private by loadPrivateItems(noteEvent, accountViewModel) { noteEvent.privateBookmarks(it) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/lists/TagLists.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/lists/TagLists.kt index 4294e5386d..b2186cbd21 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/lists/TagLists.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/lists/TagLists.kt @@ -36,7 +36,7 @@ import com.vitorpamplona.amethyst.commons.ui.stringRes import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip01Core.tags.hashtags.HashtagTag import com.vitorpamplona.quartz.nip51Lists.geohashList.GeohashListEvent -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent import com.vitorpamplona.quartz.nip51Lists.interestSet.InterestSetEvent /** NIP-51 kind 10015: the hashtags this user follows. */ @@ -47,10 +47,10 @@ fun RenderHashtagList( accountViewModel: AccountViewModel, nav: INav, ) { - val noteEvent = baseNote.event as? HashtagListEvent ?: return + val noteEvent = baseNote.event as? InterestListEvent ?: return val public = remember(noteEvent) { noteEvent.publicHashtags() } - // HashtagListEvent exposes no private accessor of its own, but it is a PrivateTagArrayEvent + // InterestListEvent exposes no private accessor of its own, but it is a PrivateTagArrayEvent // like the rest, so its private half is read the same way InterestSetEvent reads its own. val private by loadPrivateItems(noteEvent, accountViewModel) { signer -> noteEvent.privateTags(signer)?.mapNotNull(HashtagTag::parse) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/TopNavFilterState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/TopNavFilterState.kt index 5a3eaf6059..8d0618d42d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/TopNavFilterState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/TopNavFilterState.kt @@ -43,9 +43,9 @@ import com.vitorpamplona.amethyst.service.checkNotInMainThread import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip01Core.relay.normalizer.displayUrl -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip51Lists.interestSet.InterestSetEvent -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent import com.vitorpamplona.quartz.nip89AppHandlers.definition.AppDefinitionEvent import com.vitorpamplona.quartz.utils.Log @@ -594,9 +594,9 @@ class PeopleListName( NoteBackedName { override fun name(): String { val noteEvent = note.event - return if (noteEvent is PeopleListEvent) { + return if (noteEvent is FollowSetEvent) { noteEvent.titleOrName() ?: note.dTag() - } else if (noteEvent is FollowListEvent) { + } else if (noteEvent is StarterPackEvent) { noteEvent.title() ?: note.dTag() } else { note.dTag() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt index 04244170d0..6cd968367e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt @@ -172,7 +172,7 @@ import com.vitorpamplona.quartz.nip01Core.tags.people.PubKeyReferenceTag import com.vitorpamplona.quartz.nip01Core.tags.people.isTaggedUser import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent import com.vitorpamplona.quartz.nip03Timestamp.EmptyOtsResolverBuilder -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip05DnsIdentifiers.EmptyNip05Client import com.vitorpamplona.quartz.nip05DnsIdentifiers.INip05Client import com.vitorpamplona.quartz.nip05DnsIdentifiers.Nip05Client @@ -202,16 +202,16 @@ import com.vitorpamplona.quartz.nip51Lists.PinListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.OldBookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.tags.AddressBookmark -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent import com.vitorpamplona.quartz.nip56Reports.ReportType -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip57Zaps.validate.LnurlForm import com.vitorpamplona.quartz.nip57Zaps.zapraiser.zapraiserAmount -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nip60Cashu.token.CashuToken -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.NIP90ContentDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.DvmContentDiscoveryResponseEvent import com.vitorpamplona.quartz.nip92IMeta.imeta import com.vitorpamplona.quartz.nip94FileMetadata.tags.DimensionTag import com.vitorpamplona.quartz.podcasts.PodcastBoostagram @@ -725,7 +725,7 @@ class AccountViewModel( val isHiddenAuthor = note.author?.let { account.isHidden(it) } == true val noteEvent = note.event - val isDecryptedPostHidden = if (noteEvent is PrivateDmEvent) account.isDecryptedContentHidden(noteEvent) else false + val isDecryptedPostHidden = if (noteEvent is EncryptedDmEvent) account.isDecryptedContentHidden(noteEvent) else false return if (isPostHidden || isDecryptedPostHidden) { // Spam + Blocked Users + Hidden Words + Sensitive Content @@ -924,14 +924,14 @@ class AccountViewModel( it.request.event ?.content ?.ifBlank { null }, - showAmountInteger((it.response.event as? LnZapEvent)?.amount), + showAmountInteger((it.response.event as? ZapReceiptEvent)?.amount), it.response, ) }.toMutableMap() val results = mapNotNullAsync( - zaps.filter { (it.request.event as? LnZapRequestEvent)?.isPrivateZap() == true }, + zaps.filter { (it.request.event as? ZapRequestEvent)?.isPrivateZap() == true }, ) { next -> val info = innerDecryptAmountMessage(next.request, next.response) if (info != null) { @@ -950,14 +950,14 @@ class AccountViewModel( fun cachedDecryptAmountMessageInGroup(zapNotes: List): ImmutableList = zapNotes .map { - val request = it.request.event as? LnZapRequestEvent + val request = it.request.event as? ZapRequestEvent if (request?.isPrivateZap() == true) { val cachedPrivateRequest = account.privateZapsDecryptionCache.cachedPrivateZap(request) if (cachedPrivateRequest != null) { ZapAmountCommentNotification( LocalCache.getUserIfExists(cachedPrivateRequest.pubKey) ?: it.request.author, cachedPrivateRequest.content.ifBlank { null }, - showAmountInteger((it.response.event as? LnZapEvent)?.amount), + showAmountInteger((it.response.event as? ZapReceiptEvent)?.amount), it.response, ) } else { @@ -966,7 +966,7 @@ class AccountViewModel( it.request.event ?.content ?.ifBlank { null }, - showAmountInteger((it.response.event as? LnZapEvent)?.amount), + showAmountInteger((it.response.event as? ZapReceiptEvent)?.amount), it.response, ) } @@ -976,7 +976,7 @@ class AccountViewModel( it.request.event ?.content ?.ifBlank { null }, - showAmountInteger((it.response.event as? LnZapEvent)?.amount), + showAmountInteger((it.response.event as? ZapReceiptEvent)?.amount), it.response, ) } @@ -987,14 +987,14 @@ class AccountViewModel( return myList .map { - val request = it.first.event as? LnZapRequestEvent + val request = it.first.event as? ZapRequestEvent if (request?.isPrivateZap() == true) { val cachedPrivateRequest = account.privateZapsDecryptionCache.cachedPrivateZap(request) if (cachedPrivateRequest != null) { ZapAmountCommentNotification( LocalCache.getUserIfExists(cachedPrivateRequest.pubKey) ?: it.first.author, cachedPrivateRequest.content.ifBlank { null }, - showAmountInteger((it.second?.event as? LnZapEvent)?.amount), + showAmountInteger((it.second?.event as? ZapReceiptEvent)?.amount), it.second, ) } else { @@ -1003,7 +1003,7 @@ class AccountViewModel( it.first.event ?.content ?.ifBlank { null }, - showAmountInteger((it.second?.event as? LnZapEvent)?.amount), + showAmountInteger((it.second?.event as? ZapReceiptEvent)?.amount), it.second, ) } @@ -1013,7 +1013,7 @@ class AccountViewModel( it.first.event ?.content ?.ifBlank { null }, - showAmountInteger((it.second?.event as? LnZapEvent)?.amount), + showAmountInteger((it.second?.event as? ZapReceiptEvent)?.amount), it.second, ) } @@ -1036,7 +1036,7 @@ class AccountViewModel( it.first.event ?.content ?.ifBlank { null }, - showAmountInteger((it.second?.event as? LnZapEvent)?.amount), + showAmountInteger((it.second?.event as? ZapReceiptEvent)?.amount), it.second, ) }.toMutableMap() @@ -1073,7 +1073,7 @@ class AccountViewModel( } suspend fun innerDecryptAmountMessage(zapNote: Note): ZapAmountCommentNotification? { - val zapEvent = zapNote.event as? LnZapEvent ?: return null + val zapEvent = zapNote.event as? ZapReceiptEvent ?: return null val zapRequest = zapEvent.zapRequest ?: return null return innerDecryptAmountMessage(zapRequest, zapEvent)?.copy(zapNote = zapNote) @@ -1083,14 +1083,14 @@ class AccountViewModel( zapRequest: Note, zapEvent: Note, ): ZapAmountCommentNotification? { - val zapEvent = zapEvent.event as? LnZapEvent ?: return null - val zapRequest = zapRequest.event as? LnZapRequestEvent ?: return null + val zapEvent = zapEvent.event as? ZapReceiptEvent ?: return null + val zapRequest = zapRequest.event as? ZapRequestEvent ?: return null return innerDecryptAmountMessage(zapRequest, zapEvent) } suspend fun innerDecryptAmountMessage( - zapRequestEvent: LnZapRequestEvent, - zapEvent: LnZapEvent, + zapRequestEvent: ZapRequestEvent, + zapEvent: ZapReceiptEvent, ): ZapAmountCommentNotification? { val amount = showAmountInteger(zapEvent.amount) return if (zapRequestEvent.isPrivateZap()) { @@ -1148,7 +1148,7 @@ class AccountViewModel( onError: (String, String, User?) -> Unit, onProgress: (percent: Float) -> Unit, onPayViaIntent: (ImmutableList) -> Unit, - zapType: LnZapEvent.ZapType? = null, + zapType: ZapReceiptEvent.ZapType? = null, ) = launchSigner { // A podcast note (episode or show) can carry a Podcasting-2.0 value-for-value block. When it // does, "zapping" it means paying that split — lnaddress recipients go out as real zaps (with @@ -1177,8 +1177,8 @@ class AccountViewModel( // comment stay encrypted. NONZAP is kept: paying without a zap // request produces no receipt at all, which is even more private. val effectiveType = - if (note.isPrivateRumor() && requestedType != LnZapEvent.ZapType.NONZAP) { - LnZapEvent.ZapType.PRIVATE + if (note.isPrivateRumor() && requestedType != ZapReceiptEvent.ZapType.NONZAP) { + ZapReceiptEvent.ZapType.PRIVATE } else { requestedType } @@ -1299,7 +1299,7 @@ class AccountViewModel( zappedNote = zappedNote, context = context, asZap = !streaming, - zapType = LnZapEvent.ZapType.PUBLIC, + zapType = ZapReceiptEvent.ZapType.PUBLIC, okHttpClient = httpClientBuilder::okHttpClientForMoney, onError = { title, message -> if (!streaming) toastManager.toast(title, message) @@ -1463,7 +1463,7 @@ class AccountViewModel( fun follows(user: User): Note = LocalCache.getOrCreateAddressableNote(ContactListEvent.createAddress(user.pubkeyHex)) - fun hashtagFollows(user: User): Note = LocalCache.getOrCreateAddressableNote(HashtagListEvent.createAddress(user.pubkeyHex)) + fun hashtagFollows(user: User): Note = LocalCache.getOrCreateAddressableNote(InterestListEvent.createAddress(user.pubkeyHex)) fun bookmarks(user: User): Note = LocalCache.getOrCreateAddressableNote(BookmarkListEvent.createBookmarkAddress(user.pubkeyHex)) @@ -2122,7 +2122,7 @@ class AccountViewModel( fun updateZapAmounts( amountSet: List, - selectedZapType: LnZapEvent.ZapType, + selectedZapType: ZapReceiptEvent.ZapType, nip47Update: Nip47WalletConnect.Nip47URINorm?, ) = launchSigner { account.updateZapAmounts(amountSet, selectedZapType, nip47Update) } @@ -2848,7 +2848,7 @@ class AccountViewModel( } } - private suspend fun unwrapSeal(event: SealedRumorEvent): Note? { + private suspend fun unwrapSeal(event: SealEvent): Note? { val cacheInnerEventId = event.innerEventId return if (cacheInnerEventId != null) { val existingNoteEvent = LocalCache.getNoteIfExists(cacheInnerEventId)?.event @@ -2882,7 +2882,7 @@ class AccountViewModel( private suspend fun unwrapIfNeeded(event: Event): Note? = when (event) { is GiftWrapEvent -> unwrapGiftWrap(event) - is SealedRumorEvent -> unwrapSeal(event) + is SealEvent -> unwrapSeal(event) else -> LocalCache.getNoteIfExists(event.id) } @@ -2936,7 +2936,7 @@ class AccountViewModel( LocalCache.notes.maxOrNullOf( filter = { _, note -> val noteEvent = note.event - noteEvent is NIP90ContentDiscoveryResponseEvent && + noteEvent is DvmContentDiscoveryResponseEvent && noteEvent.pubKey == pubkeyHex && noteEvent.isTaggedUser(account.signer.pubKey) && noteEvent.createdAt > fifteenMinsAgo @@ -3005,13 +3005,13 @@ class AccountViewModel( onError: (String, String) -> Unit, onProgress: (percent: Float) -> Unit, context: Context, - zapType: LnZapEvent.ZapType? = null, + zapType: ZapReceiptEvent.ZapType? = null, ) { viewModelScope.launch(Dispatchers.IO) { try { val effectiveZapType = zapType ?: defaultZapType() val zapRequest = - if (effectiveZapType != LnZapEvent.ZapType.NONZAP) { + if (effectiveZapType != ZapReceiptEvent.ZapType.NONZAP) { // NIP-57 Appendix F: include amount + lnurl so the receipt can be validated. val splitLnurl = LnurlForm.toUrl(lnAddress)?.let(LnurlForm::urlToBech32) account.zaps.createZapRequestFor( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/DecryptAndIndexProcessor.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/DecryptAndIndexProcessor.kt index ab256b5804..794e1b3027 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/DecryptAndIndexProcessor.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/DecryptAndIndexProcessor.kt @@ -42,10 +42,10 @@ import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKeyable import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent import com.vitorpamplona.quartz.nip57Zaps.PrivateZapCache -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.EphemeralGiftWrapEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nipACWebRtcCalls.events.CallAnswerEvent @@ -112,9 +112,9 @@ class EventProcessor( is GiftWrapEvent -> giftWrapHandler.add(event, eventNote, publicNote) - is SealedRumorEvent -> sealHandler.add(event, eventNote, publicNote) + is SealEvent -> sealHandler.add(event, eventNote, publicNote) - is LnZapRequestEvent -> zapRequest.add(event, eventNote, publicNote) + is ZapRequestEvent -> zapRequest.add(event, eventNote, publicNote) } } @@ -153,9 +153,9 @@ class EventProcessor( is ChatroomKeyable -> chatHandler.delete(event, note) is DraftWrapEvent -> draftHandler.delete(event, note) is GiftWrapEvent -> giftWrapHandler.delete(event, note) - is SealedRumorEvent -> sealHandler.delete(event, note) - is LnZapRequestEvent -> zapRequest.delete(event, note) - is LnZapEvent -> zapEvent.delete(event, note) + is SealEvent -> sealHandler.delete(event, note) + is ZapRequestEvent -> zapRequest.delete(event, note) + is ZapReceiptEvent -> zapEvent.delete(event, note) } } @@ -457,9 +457,9 @@ class SealedRumorEventHandler( private val account: Account, private val cache: LocalCache, private val eventProcessor: EventProcessor, -) : EventHandler { +) : EventHandler { override suspend fun add( - event: SealedRumorEvent, + event: SealEvent, eventNote: Note, publicNote: Note, ) { @@ -477,7 +477,7 @@ class SealedRumorEventHandler( } override suspend fun delete( - event: SealedRumorEvent, + event: SealEvent, eventNote: Note, ) { event.innerEventId?.let { rumorId -> @@ -489,7 +489,7 @@ class SealedRumorEventHandler( } private suspend fun processNewSealedRumor( - event: SealedRumorEvent, + event: SealEvent, eventNote: Note, publicNote: Note, ) { @@ -538,9 +538,9 @@ class SealedRumorEventHandler( class LnZapRequestEventHandler( val decryptionCache: PrivateZapCache, -) : EventHandler { +) : EventHandler { override suspend fun add( - event: LnZapRequestEvent, + event: ZapRequestEvent, eventNote: Note, publicNote: Note, ) { @@ -550,7 +550,7 @@ class LnZapRequestEventHandler( } override suspend fun delete( - event: LnZapRequestEvent, + event: ZapRequestEvent, eventNote: Note, ) { if (event.isPrivateZap()) { @@ -561,9 +561,9 @@ class LnZapRequestEventHandler( class LnZapEventHandler( val decryptionCache: PrivateZapCache, -) : EventHandler { +) : EventHandler { override suspend fun delete( - event: LnZapEvent, + event: ZapReceiptEvent, eventNote: Note, ) { event.zapRequest?.let { req -> diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/articles/ArticlesFeedLoaded.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/articles/ArticlesFeedLoaded.kt index d2a3d6e0d5..13ab488bfd 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/articles/ArticlesFeedLoaded.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/articles/ArticlesFeedLoaded.kt @@ -37,7 +37,7 @@ import com.vitorpamplona.amethyst.commons.ui.theme.DividerThickness import com.vitorpamplona.amethyst.commons.ui.theme.FeedPadding import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.discover.ChannelCardCompose -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent @Composable fun ArticlesFeedLoaded( @@ -61,7 +61,7 @@ fun ArticlesFeedLoaded( ChannelCardCompose( baseNote = item, modifier = Modifier.fillMaxWidth(), - forceEventKind = LongTextNoteEvent.KIND, + forceEventKind = LongFormContentEvent.KIND, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/articles/ArticlesTopBar.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/articles/ArticlesTopBar.kt index 4163e6e015..922e4f8445 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/articles/ArticlesTopBar.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/articles/ArticlesTopBar.kt @@ -36,7 +36,7 @@ import com.vitorpamplona.amethyst.ui.navigation.topbars.UserDrawerSearchTopBar import com.vitorpamplona.amethyst.ui.screen.FeedDefinition import com.vitorpamplona.amethyst.ui.screen.TopNavFilterState import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent @Composable fun ArticlesTopBar( @@ -49,7 +49,7 @@ fun ArticlesTopBar( // The feed's own kind window, plus whatever the list spinner narrowed it to — a hashtag or a // geohash says itself as a token; a follow set does not, and seeds nothing (see asSearchQuery). val me = accountViewModel.userProfile().pubkeyHex - val seed = remember(list, me) { SearchSeed.merge(SearchSeed.ofKinds(LongTextNoteEvent.KIND), list.asSearchQuery(me)) } + val seed = remember(list, me) { SearchSeed.merge(SearchSeed.ofKinds(LongFormContentEvent.KIND), list.asSearchQuery(me)) } UserDrawerSearchTopBar(accountViewModel, nav, seed) { ArticlesTopNavFilterBar( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/articles/dal/ArticlesFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/articles/dal/ArticlesFeedFilter.kt index 5ec4bd4976..7bea4bb080 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/articles/dal/ArticlesFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/articles/dal/ArticlesFeedFilter.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.amethyst.commons.model.topNavFeeds.TopFilter import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.ui.dal.FilterByListParams import com.vitorpamplona.amethyst.ui.dal.sortedByDefaultFeedOrder -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent class ArticlesFeedFilter( val account: Account, @@ -50,9 +50,9 @@ class ArticlesFeedFilter( override fun feed(): List { val params = buildFilterParams(account) val notes = - LocalCache.addressables.filterIntoSet(LongTextNoteEvent.KIND) { _, it -> + LocalCache.addressables.filterIntoSet(LongFormContentEvent.KIND) { _, it -> val noteEvent = it.event - noteEvent is LongTextNoteEvent && params.match(noteEvent, it.relays) + noteEvent is LongFormContentEvent && params.match(noteEvent, it.relays) } return sort(notes) } @@ -70,7 +70,7 @@ class ArticlesFeedFilter( return collection.filterTo(HashSet()) { val noteEvent = it.event - noteEvent is LongTextNoteEvent && params.match(noteEvent, it.relays) + noteEvent is LongFormContentEvent && params.match(noteEvent, it.relays) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/backups/BackupConflictListViews.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/backups/BackupConflictListViews.kt index 55473cce27..6587568294 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/backups/BackupConflictListViews.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/backups/BackupConflictListViews.kt @@ -92,9 +92,9 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.diff.ContentChange import com.vitorpamplona.quartz.nip01Core.diff.ListDiff import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip28PublicChat.list.ChannelListDiff -import com.vitorpamplona.quartz.nip28PublicChat.list.ChannelListEvent +import com.vitorpamplona.quartz.nip28PublicChat.list.PublicChatListEvent import com.vitorpamplona.quartz.nip28PublicChat.list.channels import com.vitorpamplona.quartz.nip37Drafts.privateOutbox.PrivateOutboxRelayListEvent import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent @@ -103,10 +103,10 @@ import com.vitorpamplona.quartz.nip51Lists.favoriteAlgoFeedsList.FavoriteAlgoFee import com.vitorpamplona.quartz.nip51Lists.geohashList.GeohashListDiff import com.vitorpamplona.quartz.nip51Lists.geohashList.GeohashListEvent import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListDiff -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BlockedRelayListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayListDiff import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent import com.vitorpamplona.quartz.nip60Cashu.wallet.CashuWalletDiff @@ -137,7 +137,7 @@ internal fun LazyListScope.listDiffItems( is CommunityListDiff -> communityItems(diff, conflict, accountViewModel, nav) is EphemeralChatListDiff -> ephemeralRoomItems(diff, conflict, nav) is FavoriteAlgoFeedsListDiff -> favoriteFeedItems(diff, conflict, accountViewModel, nav) - is HashtagListDiff -> topicItems(diff.hashtags, (conflict.saved as? HashtagListEvent)?.publicHashtags().orEmpty(), diff.privateItems, isPlace = false, nav) + is HashtagListDiff -> topicItems(diff.hashtags, (conflict.saved as? InterestListEvent)?.publicHashtags().orEmpty(), diff.privateItems, isPlace = false, nav) is GeohashListDiff -> topicItems(diff.geohashes, (conflict.saved as? GeohashListEvent)?.publicGeohashes().orEmpty(), diff.privateItems, isPlace = true, nav) is TrustProviderListDiff -> trustProviderItems(diff, conflict, accountViewModel, nav) is PaymentTargetsDiff -> paymentTargetItems(diff, conflict) @@ -236,11 +236,11 @@ private fun framingOf(type: BackupEventType): RelayFraming = private fun savedRelaysOf(event: Event): List = when (event) { - is ChatMessageRelayListEvent -> event.relays() + is DmRelayListEvent -> event.relays() is KeyPackageRelayListEvent -> event.relays() is SearchRelayListEvent -> event.publicRelays() is IndexerRelayListEvent -> event.publicRelays() - is RelayFeedsListEvent -> event.publicRelays() + is FavoriteRelayListEvent -> event.publicRelays() is BlockedRelayListEvent -> event.publicRelays() is TrustedRelayListEvent -> event.publicRelays() is PrivateOutboxRelayListEvent -> event.publicRelays() @@ -451,7 +451,7 @@ private fun LazyListScope.publicChatItems( accountViewModel: AccountViewModel, nav: INav, ) { - val saved = (conflict.saved as? ChannelListEvent)?.tags?.channels().orEmpty() + val saved = (conflict.saved as? PublicChatListEvent)?.tags?.channels().orEmpty() spaceGrid("chat-", fates(saved, diff.channels) { it.eventId }, { it.eventId }) { tag, fate, modifier -> LoadPublicChatChannel(tag.eventId) { channel -> // Subscribes to the channel's metadata on relays and recomposes when it arrives. diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarkgroups/display/BookmarkGroupItemOptions.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarkgroups/display/BookmarkGroupItemOptions.kt index b2a31af51a..4c31575212 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarkgroups/display/BookmarkGroupItemOptions.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarkgroups/display/BookmarkGroupItemOptions.kt @@ -75,7 +75,7 @@ import com.vitorpamplona.amethyst.ui.note.types.EditState import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.report.ReportNoteDialog import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -281,7 +281,7 @@ fun BookmarkGroupItemOptionsMenu( wantsToEditPost.value = true } } - } else if (note.event is LongTextNoteEvent && state.isLoggedUser) { + } else if (note.event is LongFormContentEvent && state.isLoggedUser) { M3ActionRow(icon = MaterialSymbols.Edit, text = stringRes(Res.string.edit_article)) { nav.nav { Route.NewLongFormPost(version = note.idHex) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/CalendarCollectionsTopBar.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/CalendarCollectionsTopBar.kt index 996453f5e7..c5c54cff10 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/CalendarCollectionsTopBar.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/CalendarCollectionsTopBar.kt @@ -36,7 +36,7 @@ import com.vitorpamplona.amethyst.ui.navigation.topbars.UserDrawerSearchTopBar import com.vitorpamplona.amethyst.ui.screen.FeedDefinition import com.vitorpamplona.amethyst.ui.screen.TopNavFilterState import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent @Composable fun CalendarCollectionsTopBar( @@ -49,7 +49,7 @@ fun CalendarCollectionsTopBar( // The feed's own kind window, plus whatever the list spinner narrowed it to — a hashtag // or a geohash says itself as a token; a follow set does not, and seeds nothing. val me = accountViewModel.userProfile().pubkeyHex - val seed = remember(list, me) { SearchSeed.merge(SearchSeed.ofKinds(CalendarEvent.KIND), list.asSearchQuery(me)) } + val seed = remember(list, me) { SearchSeed.merge(SearchSeed.ofKinds(CalendarCollectionEvent.KIND), list.asSearchQuery(me)) } UserDrawerSearchTopBar(accountViewModel, nav, seed) { CalendarCollectionsTopNavFilterBar( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/CalendarCollectionsView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/CalendarCollectionsView.kt index 644d10c45e..ea7cc7c295 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/CalendarCollectionsView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/CalendarCollectionsView.kt @@ -76,7 +76,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.video.UserCardHeader import com.vitorpamplona.quartz.nip01Core.core.Address import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import com.vitorpamplona.quartz.utils.TimeUtils @Composable @@ -153,7 +153,7 @@ fun CalendarCollectionCard( accountViewModel: AccountViewModel, nav: INav, ) { - val event = note.event as? CalendarEvent ?: return + val event = note.event as? CalendarCollectionEvent ?: return val title = remember(note.idHex) { event.title() } val description = remember(note.idHex) { event.content.take(180) } val count = remember(note.idHex) { event.calendarEventAddresses().size } @@ -241,7 +241,7 @@ fun CalendarCollectionCard( * arrived from relays yet or aren't appointments. Returns a list compatible with * [IcsExport.calendarToIcs]. */ -private fun collectMembers(calendar: CalendarEvent): List> = +private fun collectMembers(calendar: CalendarCollectionEvent): List> = calendar .calendarEventAddresses() .mapNotNull { addr -> diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/CalendarsViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/CalendarsViewModel.kt index dc74d818fa..5b41ea50f8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/CalendarsViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/CalendarsViewModel.kt @@ -39,7 +39,7 @@ import com.vitorpamplona.amethyst.commons.model.nip52Calendar.groupByDayKeyExpan import com.vitorpamplona.quartz.nip01Core.core.Address import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow @@ -162,13 +162,13 @@ class CalendarsViewModel : ViewModel() { * changes about once a week. */ @OptIn(ExperimentalCoroutinesApi::class) - val ownCalendars: StateFlow> = + val ownCalendars: StateFlow> = inputs .filterNotNull() .flatMapLatest { (myPubKey, _) -> LocalCache - .observeEvents( - Filter(kinds = listOf(CalendarEvent.KIND), authors = listOf(myPubKey)), + .observeEvents( + Filter(kinds = listOf(CalendarCollectionEvent.KIND), authors = listOf(myPubKey)), ).map { calendars -> calendars.sortedBy { it.title()?.lowercase() ?: "" } } } // The seed scan inside observeEvents walks the whole notes cache (LocalCache.filter diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/create/NewCalendarCollectionViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/create/NewCalendarCollectionViewModel.kt index 62fc41a72a..f389c7a9c1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/create/NewCalendarCollectionViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/create/NewCalendarCollectionViewModel.kt @@ -33,7 +33,7 @@ import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag import com.vitorpamplona.quartz.nip01Core.tags.aTag.aTags import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import com.vitorpamplona.quartz.utils.TimeUtils import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job @@ -62,7 +62,7 @@ class NewCalendarCollectionViewModel : ViewModel() { private var dTag: String? = null /** The full original event in edit mode; needed to publish a NIP-09 deletion. */ - private var loadedEvent: com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent? = null + private var loadedEvent: com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent? = null val selectedAddresses = mutableStateListOf
() val availableAppointments = mutableStateOf>(emptyList()) @@ -81,9 +81,9 @@ class NewCalendarCollectionViewModel : ViewModel() { dTag = editDTag editDTag?.let { existingDTag -> - val existingAddress = Address(CalendarEvent.KIND, account.userProfile().pubkeyHex, existingDTag) + val existingAddress = Address(CalendarCollectionEvent.KIND, account.userProfile().pubkeyHex, existingDTag) val existingNote = LocalCache.addressables.get(existingAddress) - (existingNote?.event as? CalendarEvent)?.let { existing -> + (existingNote?.event as? CalendarCollectionEvent)?.let { existing -> loadedEvent = existing title.value = existing.title().orEmpty() description.value = existing.content @@ -140,7 +140,7 @@ class NewCalendarCollectionViewModel : ViewModel() { account.signAndComputeBroadcast( if (effectiveDTag != null) { - CalendarEvent.build( + CalendarCollectionEvent.build( title = parsedTitle, content = parsedDescription, dTag = effectiveDTag, @@ -148,7 +148,7 @@ class NewCalendarCollectionViewModel : ViewModel() { if (selected.isNotEmpty()) aTags(selected.map { ATag(it) }) } } else { - CalendarEvent.build( + CalendarCollectionEvent.build( title = parsedTitle, content = parsedDescription, ) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/dal/CalendarCollectionsFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/dal/CalendarCollectionsFeedFilter.kt index c26935be56..7396b10d5a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/dal/CalendarCollectionsFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/dal/CalendarCollectionsFeedFilter.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.amethyst.commons.model.topNavFeeds.TopFilter import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.ui.dal.FilterByListParams import com.vitorpamplona.amethyst.ui.dal.sortedByDefaultFeedOrder -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent class CalendarCollectionsFeedFilter( val account: Account, @@ -49,7 +49,7 @@ class CalendarCollectionsFeedFilter( val notes = LocalCache.addressables.filterIntoSet { _, it -> val e = it.event - e is CalendarEvent && params.match(e, it.relays) + e is CalendarCollectionEvent && params.match(e, it.relays) } return sort(notes) } @@ -66,7 +66,7 @@ class CalendarCollectionsFeedFilter( val params = buildFilterParams(account) return collection.filterTo(HashSet()) { val e = it.event - e is CalendarEvent && params.match(e, it.relays) + e is CalendarCollectionEvent && params.match(e, it.relays) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/detail/AddToCalendarSheet.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/detail/AddToCalendarSheet.kt index 8f9deda35d..6d878afb92 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/detail/AddToCalendarSheet.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/detail/AddToCalendarSheet.kt @@ -53,7 +53,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip01Core.core.Address import com.vitorpamplona.quartz.nip01Core.tags.aTag.ATag import com.vitorpamplona.quartz.nip01Core.tags.aTag.aTags -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent /** * Bottom sheet that lists the current user's own kind-31924 calendars with a checkbox per @@ -74,7 +74,7 @@ fun AddToCalendarSheet( val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) val myPubKey = accountViewModel.userProfile().pubkeyHex - val ownCalendars by produceState>(initialValue = ownCalendars(myPubKey), myPubKey) { + val ownCalendars by produceState>(initialValue = ownCalendars(myPubKey), myPubKey) { LocalCache.live.newEventBundles.collect { value = ownCalendars(myPubKey) } @@ -152,17 +152,17 @@ private fun CalendarPickerRow( } } -private fun ownCalendars(myPubKey: String): List = +private fun ownCalendars(myPubKey: String): List = LocalCache.addressables .filterIntoSet { _, note -> val e = note.event - e is CalendarEvent && e.pubKey == myPubKey - }.mapNotNull { it.event as? CalendarEvent } + e is CalendarCollectionEvent && e.pubKey == myPubKey + }.mapNotNull { it.event as? CalendarCollectionEvent } .sortedBy { it.title()?.lowercase() ?: "" } private fun toggleMembership( accountViewModel: AccountViewModel, - calendar: CalendarEvent, + calendar: CalendarCollectionEvent, targetAddress: Address, isCurrentlyMember: Boolean, ) { @@ -177,7 +177,7 @@ private fun toggleMembership( } accountViewModel.launchSigner { accountViewModel.account.signAndComputeBroadcast( - CalendarEvent.build( + CalendarCollectionEvent.build( title = calendar.title().orEmpty(), content = calendar.content, dTag = calendar.dTag(), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/detail/CalendarEventDetailScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/detail/CalendarEventDetailScreen.kt index beece330fa..3072750bd7 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/detail/CalendarEventDetailScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/calendars/detail/CalendarEventDetailScreen.kt @@ -116,7 +116,7 @@ import com.vitorpamplona.quartz.nip19Bech32.entities.NAddress import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent import com.vitorpamplona.quartz.nip52Calendar.appt.tags.RSVPStatusTag import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import com.vitorpamplona.quartz.nip52Calendar.rsvp.CalendarRSVPEvent import com.vitorpamplona.quartz.utils.TimeUtils import kotlinx.coroutines.Dispatchers @@ -287,7 +287,7 @@ fun CalendarEventDetailScreen( targetAddress = targetAddress, ) - is CalendarEvent -> + is CalendarCollectionEvent -> CollectionBody( note = targetNote, accountViewModel = accountViewModel, @@ -432,7 +432,7 @@ private fun CollectionBody( nav: INav, targetAddress: Address, ) { - val event = note.event as? CalendarEvent ?: return + val event = note.event as? CalendarCollectionEvent ?: return val title = remember(note.idHex) { event.title() } val memberAddresses = remember(note.idHex) { event.calendarEventAddresses() } @@ -736,7 +736,7 @@ private fun InCalendarsSection( .clickable { nav.nav( Route.CalendarEventDetail( - kind = CalendarEvent.KIND, + kind = CalendarCollectionEvent.KIND, pubKeyHex = calendar.pubKey, dTag = calendar.dTag(), ), @@ -889,11 +889,11 @@ private fun rememberRsvpsFor(targetAddress: Address): State> { +private fun rememberCalendarsContaining(targetAddress: Address): State> { val calendars = remember(targetAddress) { LocalCache - .observeEvents(Filter(kinds = listOf(CalendarEvent.KIND))) + .observeEvents(Filter(kinds = listOf(CalendarCollectionEvent.KIND))) .map { all -> all .filter { it.calendarEventAddresses().contains(targetAddress) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/ChatMessageCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/ChatMessageCompose.kt index ccb19c4c2d..9ecb9c8776 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/ChatMessageCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/ChatMessageCompose.kt @@ -87,7 +87,7 @@ import com.vitorpamplona.quartz.buzz.stream.SystemMessageEvent import com.vitorpamplona.quartz.concord.cord03Channels.ConcordChatEditEvent import com.vitorpamplona.quartz.marmot.foundation.appEvents.MarmotAppEvent import com.vitorpamplona.quartz.nip01Core.core.HexKey -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip10Notes.BaseNoteEvent import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKeyable import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent @@ -97,7 +97,7 @@ import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMetadataEvent import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent import com.vitorpamplona.quartz.nip53LiveActivities.clip.LiveActivitiesClipEvent import com.vitorpamplona.quartz.nip53LiveActivities.raid.LiveActivitiesRaidEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip57Zaps.splits.hasZapSplitSetup import com.vitorpamplona.quartz.nip57Zaps.zapraiser.zapraiserAmount @@ -156,7 +156,7 @@ fun ChatroomMessageCompose( } val event = baseNote.event - if (event is LnZapEvent) { + if (event is ZapReceiptEvent) { RenderChatZap(baseNote, accountViewModel, nav) } else if (event is LiveActivitiesRaidEvent) { RenderChatRaid(baseNote, accountViewModel, nav) @@ -248,10 +248,10 @@ fun NormalChatNote( when { // Own messages: normally no name; in a multi-identity chat, show it (unless a DM, // which never draws the user's own author info). - isLoggedInUser -> showSelfAuthorName && noteEvent !is PrivateDmEvent + isLoggedInUser -> showSelfAuthorName && noteEvent !is EncryptedDmEvent // never shows the user's pictures - noteEvent is PrivateDmEvent -> false + noteEvent is EncryptedDmEvent -> false // one-on-one, never shows it. // only shows in a group chat. @@ -588,7 +588,7 @@ private fun RenderReply( is ChatMessageEvent, is ChatMessageEncryptedFileHeaderEvent -> { { LoadingReplyNote(DmReplyProtocol.NIP17, accountViewModel) } } - is PrivateDmEvent -> { + is EncryptedDmEvent -> { { LoadingReplyNote(DmReplyProtocol.NIP04, accountViewModel) } } else -> null diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/ChatTimeAgo.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/ChatTimeAgo.kt index 7f0627d365..3f0c1a3f0d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/ChatTimeAgo.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/ChatTimeAgo.kt @@ -51,7 +51,7 @@ import com.vitorpamplona.amethyst.ui.note.elements.ToggleableTimeAgoText import com.vitorpamplona.amethyst.ui.note.timeAheadNoDot import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip01Core.tags.geohash.geoHashOrScope -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip13Pow.strongPoWOrNull import com.vitorpamplona.quartz.nip40Expiration.expiration @@ -84,7 +84,7 @@ fun chatFooterHasMeta( ): Boolean { val event = note.event ?: return false val geo = event.geoHashOrScope() - return event is PrivateDmEvent || + return event is EncryptedDmEvent || event.expiration() != null || (geo != null && geo != suppressGeohash) || event.strongPoWOrNull() != null || @@ -132,7 +132,7 @@ fun ChatMessageFooter( } if (showTime) { - val hasGlyph = note.isPinnedInRelayGroup() || event is PrivateDmEvent || event?.expiration() != null || geo != null || pow != null + val hasGlyph = note.isPinnedInRelayGroup() || event is EncryptedDmEvent || event?.expiration() != null || geo != null || pow != null if (hasGlyph) Spacer(StdHorzSpacer) // Drafts aren't published, so no relay/delivery detail; everything else gets diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/layouts/ChatGroupPosition.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/layouts/ChatGroupPosition.kt index d942a54dd9..fbbf82afd3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/layouts/ChatGroupPosition.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/layouts/ChatGroupPosition.kt @@ -41,7 +41,7 @@ import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMetadataEvent import com.vitorpamplona.quartz.nip53LiveActivities.clip.LiveActivitiesClipEvent import com.vitorpamplona.quartz.nip53LiveActivities.raid.LiveActivitiesRaidEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import kotlin.math.abs /** @@ -96,7 +96,7 @@ internal const val CHAT_GROUP_WINDOW_SECONDS = 10 * 60L */ private fun isGroupableEvent(event: Event?): Boolean = event != null && - event !is LnZapEvent && + event !is ZapReceiptEvent && event !is LiveActivitiesRaidEvent && event !is LiveActivitiesClipEvent && event !is ChannelCreateEvent && diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderChatZap.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderChatZap.kt index ee5645fa71..c52b22a690 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderChatZap.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/feed/types/RenderChatZap.kt @@ -55,7 +55,7 @@ import com.vitorpamplona.amethyst.ui.note.UsernameDisplay import com.vitorpamplona.amethyst.ui.note.ZapAmountCommentNotification import com.vitorpamplona.amethyst.ui.note.showAmountInteger import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent private const val BIG_ZAP_THRESHOLD_SATS = 50_000L @@ -65,7 +65,7 @@ fun RenderChatZap( accountViewModel: AccountViewModel, nav: INav, ) { - val zapEvent = baseNote.event as? LnZapEvent ?: return + val zapEvent = baseNote.event as? ZapReceiptEvent ?: return val card by produceState( ZapAmountCommentNotification(user = null, comment = null, amount = null), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/geohashChat/GeohashChatViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/geohashChat/GeohashChatViewModel.kt index e653bad481..7a40654504 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/geohashChat/GeohashChatViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/geohashChat/GeohashChatViewModel.kt @@ -29,7 +29,7 @@ import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.core.toHexKey import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow @@ -122,7 +122,7 @@ class GeohashChatViewModel : ViewModel() { val signer = NostrSignerInternal(keyPair) val template = if (mine.isNotEmpty()) { - DeletionEvent.build(mine) + DeletionRequestEvent.build(mine) } else { val hint = note.toEventHint() ?: return@launch ReactionEvent.build(reaction, hint) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/ChatroomView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/ChatroomView.kt index 4a9c15f240..14f7c0528b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/ChatroomView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/ChatroomView.kt @@ -71,7 +71,7 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.client.paging.RelayPagingProgress import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKey -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.utils.Log import kotlinx.collections.immutable.persistentListOf import kotlinx.coroutines.delay @@ -130,7 +130,7 @@ fun ChatroomView( // Reactively check if recipients have DM relays for NIP-17 delivery for (userHex in room.users) { LoadAddressableNote( - ChatMessageRelayListEvent.createAddress(userHex), + DmRelayListEvent.createAddress(userHex), ) { note -> if (note != null) { EventFinderFilterAssemblerSubscription(note, accountViewModel) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/datasource/FilterNip04DMs.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/datasource/FilterNip04DMs.kt index c203189fd2..2254624aee 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/datasource/FilterNip04DMs.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/datasource/FilterNip04DMs.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent /** @@ -114,7 +114,7 @@ private fun toMeFilter( filter = ExplainedFilter( purpose = SubPurpose.DIRECT_MESSAGES, - kinds = listOf(PrivateDmEvent.KIND), + kinds = listOf(EncryptedDmEvent.KIND), authors = authors.toList(), tags = mapOf("p" to listOf(account.userProfile().pubkeyHex)), since = since, @@ -135,7 +135,7 @@ private fun fromMeFilter( filter = ExplainedFilter( purpose = SubPurpose.DIRECT_MESSAGES, - kinds = listOf(PrivateDmEvent.KIND), + kinds = listOf(EncryptedDmEvent.KIND), authors = listOf(account.userProfile().pubkeyHex), tags = mapOf("p" to pTags.toList()), since = since, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/send/ChatNewMessageViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/send/ChatNewMessageViewModel.kt index 3bb0e5dce0..ca797a2b12 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/send/ChatNewMessageViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/send/ChatNewMessageViewModel.kt @@ -68,7 +68,7 @@ import com.vitorpamplona.quartz.nip01Core.tags.geohash.geohash import com.vitorpamplona.quartz.nip01Core.tags.geohash.getGeoHash import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hashtags import com.vitorpamplona.quartz.nip01Core.tags.references.references -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip10Notes.content.findHashtags import com.vitorpamplona.quartz.nip10Notes.content.findNostrEventUris import com.vitorpamplona.quartz.nip10Notes.content.findURLs @@ -78,7 +78,7 @@ import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKey import com.vitorpamplona.quartz.nip17Dm.base.NIP17Group import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip18Reposts.quotes.quotes import com.vitorpamplona.quartz.nip19Bech32.toNpub import com.vitorpamplona.quartz.nip30CustomEmoji.emojis @@ -184,7 +184,7 @@ class ChatNewMessageViewModel : combine(dmRelayListNoteFlows) { dmRelayListNotes -> dmRelayListNotes .mapNotNull { noteState -> - val noteEvent = noteState.note.event as? ChatMessageRelayListEvent + val noteEvent = noteState.note.event as? DmRelayListEvent if (noteEvent == null || noteEvent.relays().isEmpty()) { noteState.note.author } else { @@ -409,7 +409,7 @@ class ChatNewMessageViewModel : if (replyId != null) { replyTo.value = LocalCache.checkGetOrCreateNote(replyId) } - } else if (draftEvent is PrivateDmEvent) { + } else if (draftEvent is EncryptedDmEvent) { val recipientNPub = draftEvent.verifiedRecipientPubKey()?.let { Hex.decode(it).toNpub() } toUsers.setTextAndPlaceCursorAtEnd("@$recipientNPub") @@ -420,7 +420,7 @@ class ChatNewMessageViewModel : } val draftText = - if (draftEvent is PrivateDmEvent) { + if (draftEvent is EncryptedDmEvent) { accountViewModel.account.privateDMDecryptionCache.cachedDM(draftEvent) ?: "" } else { draftEvent.content diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/header/LiveStreamGoalHeader.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/header/LiveStreamGoalHeader.kt index 8ff9d9a3fd..c8f2739522 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/header/LiveStreamGoalHeader.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/nip53LiveActivities/header/LiveStreamGoalHeader.kt @@ -48,7 +48,7 @@ import com.vitorpamplona.amethyst.ui.components.LoadNote import com.vitorpamplona.amethyst.ui.note.ZapReaction import com.vitorpamplona.amethyst.ui.note.types.GoalProgressBar import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip75ZapGoals.GoalEvent +import com.vitorpamplona.quartz.nip75ZapGoals.ZapGoalEvent /** * Compact header rendered above the live-activity chat feed when the stream @@ -76,7 +76,7 @@ private fun GoalHeaderContent( accountViewModel: AccountViewModel, nav: INav, ) { - val goal = goalNote.event as? GoalEvent ?: return + val goal = goalNote.event as? ZapGoalEvent ?: return val title = remember(goal) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/dal/ChatroomListKnownFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/dal/ChatroomListKnownFeedFilter.kt index ad3d06dcbd..1ba516916f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/dal/ChatroomListKnownFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/dal/ChatroomListKnownFeedFilter.kt @@ -43,7 +43,7 @@ import com.vitorpamplona.quartz.experimental.ephemChat.chat.RoomId import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKey import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKeyable import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent @@ -59,8 +59,8 @@ class ChatroomListKnownFeedFilter( private fun isEnabled(type: ChatFeedType): Boolean = type in account.settings.enabledChatFeeds.value - /** A room note is NIP-04 when its event is a [PrivateDmEvent], otherwise it is a NIP-17 message. */ - private fun isDmEnabled(note: Note): Boolean = isEnabled(if (note.event is PrivateDmEvent) ChatFeedType.NIP04 else ChatFeedType.NIP17) + /** A room note is NIP-04 when its event is a [EncryptedDmEvent], otherwise it is a NIP-17 message. */ + private fun isDmEnabled(note: Note): Boolean = isEnabled(if (note.event is EncryptedDmEvent) ChatFeedType.NIP04 else ChatFeedType.NIP17) // returns the last Note of each user. override fun feed(): List { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/dal/ChatroomListNewFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/dal/ChatroomListNewFeedFilter.kt index 86acd5c0cf..14ef60fd83 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/dal/ChatroomListNewFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/dal/ChatroomListNewFeedFilter.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.amethyst.commons.model.chats.ChatFeedType import com.vitorpamplona.amethyst.commons.util.replace import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.ui.dal.sortedByDefaultFeedOrder -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKey import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKeyable @@ -38,8 +38,8 @@ class ChatroomListNewFeedFilter( private fun isEnabled(type: ChatFeedType): Boolean = type in account.settings.enabledChatFeeds.value - /** A room note is NIP-04 when its event is a [PrivateDmEvent], otherwise it is a NIP-17 message. */ - private fun isDmEnabled(note: Note): Boolean = isEnabled(if (note.event is PrivateDmEvent) ChatFeedType.NIP04 else ChatFeedType.NIP17) + /** A room note is NIP-04 when its event is a [EncryptedDmEvent], otherwise it is a NIP-17 message. */ + private fun isDmEnabled(note: Note): Boolean = isEnabled(if (note.event is EncryptedDmEvent) ChatFeedType.NIP04 else ChatFeedType.NIP17) // returns the last Note of each user. override fun feed(): List { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FilterNip04DMsFromMe.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FilterNip04DMsFromMe.kt index 534ddcbb6e..516c98b011 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FilterNip04DMsFromMe.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FilterNip04DMsFromMe.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.ExplainedFil import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent fun filterNip04DMsFromMe( user: User, @@ -39,7 +39,7 @@ fun filterNip04DMsFromMe( filter = ExplainedFilter( purpose = SubPurpose.DIRECT_MESSAGES, - kinds = listOf(PrivateDmEvent.KIND), + kinds = listOf(EncryptedDmEvent.KIND), authors = listOf(user.pubkeyHex), since = since, until = until, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FilterNip04DMsToMe.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FilterNip04DMsToMe.kt index 4ebe2b0077..d7b68ba331 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FilterNip04DMsToMe.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/datasource/FilterNip04DMsToMe.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.ExplainedFil import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent fun filterNip04DMsToMe( user: User, @@ -39,7 +39,7 @@ fun filterNip04DMsToMe( filter = ExplainedFilter( purpose = SubPurpose.DIRECT_MESSAGES, - kinds = listOf(PrivateDmEvent.KIND), + kinds = listOf(EncryptedDmEvent.KIND), tags = mapOf("p" to listOf(user.pubkeyHex)), since = since, until = until, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/feed/ChatroomListFeedView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/feed/ChatroomListFeedView.kt index eefcbb1888..502d424d8c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/feed/ChatroomListFeedView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/feed/ChatroomListFeedView.kt @@ -70,7 +70,7 @@ import com.vitorpamplona.quartz.experimental.ephemChat.chat.EphemeralChatEvent import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.client.paging.RelayPagingProgress import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKeyable import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMetadataEvent @@ -180,8 +180,8 @@ private fun FeedLoaded( val user = accountViewModel.userProfile() val nip17Name = stringRes(Res.string.chats_history_proto_nip17) val nip04Name = stringRes(Res.string.chats_history_proto_nip04) - val oldestNip17Index = items.list.indexOfLast { it.event is ChatroomKeyable && it.event !is PrivateDmEvent } - val oldestNip04Index = items.list.indexOfLast { it.event is PrivateDmEvent } + val oldestNip17Index = items.list.indexOfLast { it.event is ChatroomKeyable && it.event !is EncryptedDmEvent } + val oldestNip04Index = items.list.indexOfLast { it.event is EncryptedDmEvent } // Each relay's window limit, carrying the advance() that pulls its OWN next page. Placed in the list // at its reached depth as a sentinel (see RelayReachMarkers): a relay pages only while its diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/ChannelCardCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/ChannelCardCompose.kt index dc20c61fcd..b6eb04d860 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/ChannelCardCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/ChannelCardCompose.kt @@ -43,9 +43,9 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.discover.nip53LiveActivitie import com.vitorpamplona.amethyst.ui.screen.loggedIn.discover.nip72Communities.RenderCommunitiesThumb import com.vitorpamplona.amethyst.ui.screen.loggedIn.discover.nip90DVMs.RenderContentDVMThumb import com.vitorpamplona.amethyst.ui.screen.loggedIn.discover.nip99Classifieds.RenderClassifiedsThumb -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingRoomEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingSpaceEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent @@ -157,8 +157,8 @@ fun InnerChannelCardWithReactions( is ChannelCreateEvent -> InnerCardRow(baseNote, accountViewModel, nav) is ClassifiedsEvent -> InnerCardBox(baseNote, accountViewModel, nav) is AppDefinitionEvent -> InnerCardRow(baseNote, accountViewModel, nav) - is FollowListEvent -> InnerCardRow(baseNote, accountViewModel, nav) - is LongTextNoteEvent -> InnerCardRow(baseNote, accountViewModel, nav) + is StarterPackEvent -> InnerCardRow(baseNote, accountViewModel, nav) + is LongFormContentEvent -> InnerCardRow(baseNote, accountViewModel, nav) } } @@ -211,7 +211,7 @@ private fun RenderNoteRow( is CommunityDefinitionEvent -> RenderCommunitiesThumb(baseNote, accountViewModel, nav) is ChannelCreateEvent -> RenderPublicChatChannelThumb(baseNote, accountViewModel, nav) is AppDefinitionEvent -> RenderContentDVMThumb(baseNote, accountViewModel, nav) - is FollowListEvent -> RenderFollowSetThumb(baseNote, accountViewModel, nav) - is LongTextNoteEvent -> RenderLongFormThumb(baseNote, accountViewModel, nav) + is StarterPackEvent -> RenderFollowSetThumb(baseNote, accountViewModel, nav) + is LongFormContentEvent -> RenderLongFormThumb(baseNote, accountViewModel, nav) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/DiscoverScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/DiscoverScreen.kt index bb061315f3..5d28a436a8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/DiscoverScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/DiscoverScreen.kt @@ -86,9 +86,9 @@ import com.vitorpamplona.amethyst.ui.navigation.bottombars.AppBottomBar import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.discover.datasource.DiscoveryFilterAssemblerSubscription import com.vitorpamplona.amethyst.ui.screen.loggedIn.home.TabItem -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent import com.vitorpamplona.quartz.nip89AppHandlers.definition.AppDefinitionEvent @@ -140,14 +140,14 @@ fun DiscoverScreen( discoveryFollowSetsFeedContentState, "DiscoverFollowSets", ScrollStateKeys.DISCOVER_FOLLOWS, - FollowListEvent.KIND, + StarterPackEvent.KIND, ), TabItem( Res.string.discover_reads, discoveryReadsFeedContentState, "DiscoverReads", ScrollStateKeys.DISCOVER_READS, - LongTextNoteEvent.KIND, + LongFormContentEvent.KIND, ), TabItem( Res.string.discover_content_v2, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/DiscoverLongFormFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/DiscoverLongFormFeedFilter.kt index 4ac6cca8ed..33fdf104ce 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/DiscoverLongFormFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/DiscoverLongFormFeedFilter.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.amethyst.commons.model.topNavFeeds.TopFilter import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.ui.dal.FilterByListParams import com.vitorpamplona.amethyst.ui.dal.sortedByDefaultFeedOrder -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent open class DiscoverLongFormFeedFilter( val account: Account, @@ -50,9 +50,9 @@ open class DiscoverLongFormFeedFilter( override fun feed(): List { val params = buildFilterParams(account) val notes = - LocalCache.addressables.filterIntoSet(LongTextNoteEvent.KIND) { _, it -> + LocalCache.addressables.filterIntoSet(LongFormContentEvent.KIND) { _, it -> val noteEvent = it.event - noteEvent is LongTextNoteEvent && params.match(noteEvent, it.relays) + noteEvent is LongFormContentEvent && params.match(noteEvent, it.relays) } return sort(notes) } @@ -70,7 +70,7 @@ open class DiscoverLongFormFeedFilter( return collection.filterTo(HashSet()) { val noteEvent = it.event - noteEvent is LongTextNoteEvent && params.match(noteEvent, it.relays) + noteEvent is LongFormContentEvent && params.match(noteEvent, it.relays) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormCard.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormCard.kt index 226c1c0675..e780927f4a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormCard.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormCard.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.amethyst.commons.ui.navigation.navs.INav import com.vitorpamplona.amethyst.service.relayClient.reqCommand.event.observeNoteEvent import com.vitorpamplona.amethyst.ui.note.types.LongFormHeader import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent @Composable fun RenderLongFormThumb( @@ -35,7 +35,7 @@ fun RenderLongFormThumb( accountViewModel: AccountViewModel, nav: INav, ) { - val noteEvent by observeNoteEvent(baseNote, accountViewModel) + val noteEvent by observeNoteEvent(baseNote, accountViewModel) noteEvent?.let { LongFormHeader( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostViewModel.kt index d03ab0074b..e076080373 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip23LongForm/LongFormPostViewModel.kt @@ -91,7 +91,7 @@ import com.vitorpamplona.quartz.nip10Notes.content.findNostrUris import com.vitorpamplona.quartz.nip10Notes.content.findURLs import com.vitorpamplona.quartz.nip18Reposts.quotes.quotes import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip30CustomEmoji.emojis import com.vitorpamplona.quartz.nip36SensitiveContent.contentWarning import com.vitorpamplona.quartz.nip36SensitiveContent.contentWarningReason @@ -266,7 +266,7 @@ class LongFormPostViewModel : } else { val noteEvent = version?.event - if (noteEvent is LongTextNoteEvent) { + if (noteEvent is LongFormContentEvent) { title = TextFieldValue(noteEvent.title() ?: "") summary = TextFieldValue(noteEvent.summary() ?: "") publishedAt = noteEvent.publishedAt() ?: noteEvent.createdAt @@ -300,12 +300,12 @@ class LongFormPostViewModel : private fun loadFromDraft(draft: Note) { val draftEvent = draft.event ?: return - if (draftEvent is LongTextNoteEvent) { + if (draftEvent is LongFormContentEvent) { loadFromDraft(draftEvent) } } - private fun loadFromDraft(draftEvent: LongTextNoteEvent) { + private fun loadFromDraft(draftEvent: LongFormContentEvent) { title = TextFieldValue(draftEvent.title() ?: "") summary = TextFieldValue(draftEvent.summary() ?: "") publishedAt = draftEvent.publishedAt() ?: draftEvent.createdAt @@ -441,7 +441,7 @@ class LongFormPostViewModel : val contentWarningReason = if (wantsToMarkAsSensitive) contentWarningDescription else null val localExpirationDate = if (wantsExpirationDate) expirationDate else null - return LongTextNoteEvent.build( + return LongFormContentEvent.build( description = tagger.message, title = title.text.trim(), summary = summary.text.trim().ifBlank { null }, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip51FollowSets/DiscoverFollowSetsFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip51FollowSets/DiscoverFollowSetsFeedFilter.kt index 13de523110..2e09975f62 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip51FollowSets/DiscoverFollowSetsFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip51FollowSets/DiscoverFollowSetsFeedFilter.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.amethyst.commons.model.topNavFeeds.TopFilter import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.ui.dal.FilterByListParams import com.vitorpamplona.amethyst.ui.dal.sortedByDefaultFeedOrder -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent open class DiscoverFollowSetsFeedFilter( val account: Account, @@ -49,9 +49,9 @@ open class DiscoverFollowSetsFeedFilter( val params = buildFilterParams(account) val notes = - LocalCache.addressables.filterIntoSet(FollowListEvent.KIND) { _, it -> + LocalCache.addressables.filterIntoSet(StarterPackEvent.KIND) { _, it -> val noteEvent = it.event - noteEvent is FollowListEvent && params.match(noteEvent, it.relays) + noteEvent is StarterPackEvent && params.match(noteEvent, it.relays) } return sort(notes) @@ -70,7 +70,7 @@ open class DiscoverFollowSetsFeedFilter( return collection.filterTo(HashSet()) { val noteEvent = it.event - noteEvent is FollowListEvent && params.match(noteEvent, it.relays) + noteEvent is StarterPackEvent && params.match(noteEvent, it.relays) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip51FollowSets/FollowSetCard.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip51FollowSets/FollowSetCard.kt index 282e4abe69..d7399581f6 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip51FollowSets/FollowSetCard.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/discover/nip51FollowSets/FollowSetCard.kt @@ -63,7 +63,7 @@ import com.vitorpamplona.amethyst.ui.note.elements.DefaultImageBannerBackground import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.mockAccountViewModel import com.vitorpamplona.quartz.nip01Core.core.HexKey -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.toImmutableList @@ -82,7 +82,7 @@ fun RenderFollowSetThumb( nav: INav, ) { val card by observeNoteAndMap(baseNote, accountViewModel) { - val noteEvent = it.event as? FollowListEvent + val noteEvent = it.event as? StarterPackEvent FollowSetCard( name = noteEvent?.title()?.ifBlank { null } ?: noteEvent?.dTag() ?: "", @@ -111,7 +111,7 @@ fun RenderFollowSetThumbPreview() { val nav = EmptyNav() val followCard = - FollowListEvent( + StarterPackEvent( id = "eca31634fce7c9068b56fa8db9f387da70bdcceb3986a77ca1a9844f3128eb5f", pubKey = "3c39a7b53dec9ac85acf08b267637a9841e6df7b7b0f5e2ac56a8cf107de37da", createdAt = 1761736286, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmContentDiscoveryScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmContentDiscoveryScreen.kt index 5bcbfa664a..ef283a4950 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmContentDiscoveryScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/DvmContentDiscoveryScreen.kt @@ -92,8 +92,8 @@ import com.vitorpamplona.quartz.lightning.LnInvoiceUtil import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip89AppHandlers.definition.AppDefinitionEvent import com.vitorpamplona.quartz.nip89AppHandlers.definition.AppMetadata -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.NIP90ContentDiscoveryResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.status.NIP90StatusEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.DvmContentDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.status.DvmStatusEvent import kotlinx.coroutines.launch @Composable @@ -190,9 +190,9 @@ fun ObserverContentDiscoveryResponse( val resultFlow = remember(dvmRequestId) { accountViewModel.account.cache - .observeLatestEvent( + .observeLatestEvent( Filter( - kinds = listOf(NIP90ContentDiscoveryResponseEvent.KIND), + kinds = listOf(DvmContentDiscoveryResponseEvent.KIND), tags = mapOf("e" to listOf(dvmRequestId.idHex)), limit = 1, ), @@ -231,9 +231,9 @@ fun ObserverDvmStatusResponse( val statusFlow = remember(dvmRequestId) { accountViewModel.account.cache - .observeLatestEvent( + .observeLatestEvent( Filter( - kinds = listOf(NIP90StatusEvent.KIND), + kinds = listOf(DvmStatusEvent.KIND), tags = mapOf("e" to listOf(dvmRequestId)), limit = 1, ), @@ -258,7 +258,7 @@ fun ObserverDvmStatusResponse( fun PrepareViewContentDiscoveryModels( dvm: User, dvmRequestId: String, - latestResponse: NIP90ContentDiscoveryResponseEvent, + latestResponse: DvmContentDiscoveryResponseEvent, onRefresh: () -> Unit, accountViewModel: AccountViewModel, nav: INav, @@ -303,7 +303,7 @@ fun RenderNostrNIP90ContentDiscoveryScreen( @Composable fun FeedDVM( appDefinitionNote: Note, - latestStatus: NIP90StatusEvent, + latestStatus: DvmStatusEvent, accountViewModel: AccountViewModel, nav: INav, ) { @@ -374,7 +374,7 @@ fun FeedDVM( @Composable fun DvmPaymentActions( - latestStatus: NIP90StatusEvent, + latestStatus: DvmStatusEvent, accountViewModel: AccountViewModel, nav: INav, onStatusUpdate: (String) -> Unit, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/FavoriteAlgoFeedToggle.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/FavoriteAlgoFeedToggle.kt index 1f0670563d..2eb0e01e0b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/FavoriteAlgoFeedToggle.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/FavoriteAlgoFeedToggle.kt @@ -38,7 +38,7 @@ import com.vitorpamplona.amethyst.service.relayClient.reqCommand.event.observeNo import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip51Lists.bookmarkList.tags.AddressBookmark import com.vitorpamplona.quartz.nip89AppHandlers.definition.AppDefinitionEvent -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.NIP90ContentDiscoveryRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.DvmContentDiscoveryRequestEvent /** * Inline star toggle that follows / unfollows a NIP-90 content-discovery DVM. @@ -60,7 +60,7 @@ fun FavoriteAlgoFeedToggle( ) { val supportsContentDiscovery by observeNoteAndMap(appDefinitionNote, accountViewModel) { note -> - (note.event as? AppDefinitionEvent)?.includeKind(NIP90ContentDiscoveryRequestEvent.KIND) == true + (note.event as? AppDefinitionEvent)?.includeKind(DvmContentDiscoveryRequestEvent.KIND) == true } if (!supportsContentDiscovery) return diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/dal/NIP90ContentDiscoveryResponseFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/dal/NIP90ContentDiscoveryResponseFilter.kt index 286a7e321a..acb70c2ab0 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/dal/NIP90ContentDiscoveryResponseFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/dal/NIP90ContentDiscoveryResponseFilter.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.amethyst.commons.model.observables.CreatedAtComparator import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.ui.dal.FilterByListParams import com.vitorpamplona.quartz.nip01Core.tags.events.isTaggedEvent -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.NIP90ContentDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.DvmContentDiscoveryResponseEvent open class NIP90ContentDiscoveryResponseFilter( val account: Account, @@ -40,7 +40,7 @@ open class NIP90ContentDiscoveryResponseFilter( fun acceptableEvent(note: Note): Boolean { val noteEvent = note.event - return noteEvent is NIP90ContentDiscoveryResponseEvent && noteEvent.isTaggedEvent(request) + return noteEvent is DvmContentDiscoveryResponseEvent && noteEvent.isTaggedEvent(request) } override fun feed(): List { @@ -54,7 +54,7 @@ open class NIP90ContentDiscoveryResponseFilter( comparator = CreatedAtComparator, ) - val noteEvent = latestNote?.event as? NIP90ContentDiscoveryResponseEvent ?: return listOf() + val noteEvent = latestNote?.event as? DvmContentDiscoveryResponseEvent ?: return listOf() return noteEvent.innerTags().mapNotNull { LocalCache.checkGetOrCreateNote(it) @@ -78,7 +78,7 @@ open class NIP90ContentDiscoveryResponseFilter( latestNote = maxNote } - val noteEvent = latestNote?.event as? NIP90ContentDiscoveryResponseEvent ?: return setOf() + val noteEvent = latestNote?.event as? DvmContentDiscoveryResponseEvent ?: return setOf() return noteEvent .innerTags() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/emojipacks/membershipManagement/MyEmojiListScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/emojipacks/membershipManagement/MyEmojiListScreen.kt index 6f5feccd25..6226d1a680 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/emojipacks/membershipManagement/MyEmojiListScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/emojipacks/membershipManagement/MyEmojiListScreen.kt @@ -66,7 +66,7 @@ import com.vitorpamplona.amethyst.ui.note.LoadAddressableNote import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip01Core.core.Address import com.vitorpamplona.quartz.nip30CustomEmoji.pack.EmojiPackEvent -import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiPackSelectionEvent +import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiListEvent import com.vitorpamplona.quartz.nip30CustomEmoji.taggedEmojis // Screen that lets the logged-in user inspect the contents of their kind 10030 selection @@ -102,7 +102,7 @@ private fun MyEmojiListView( TopBarWithBackButton(caption = stringRes(Res.string.my_emoji_list_title), nav) }, ) { contentPadding -> - val packAddresses by observeNoteEventAndMap>( + val packAddresses by observeNoteEventAndMap>( selectionNote, accountViewModel, ) { event -> diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/FollowPackFeedScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/FollowPackFeedScreen.kt index 5d9412c8fb..e72a91d271 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/FollowPackFeedScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/FollowPackFeedScreen.kt @@ -85,7 +85,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.followPacks.feed.dal.Follow import com.vitorpamplona.amethyst.ui.screen.loggedIn.followPacks.feed.dal.FollowPackMembersUserFeedViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.followPacks.feed.datasource.FollowPackFeedFilterAssemblerSubscription import com.vitorpamplona.quartz.nip01Core.core.Address -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import kotlinx.coroutines.launch @OptIn(ExperimentalMaterial3Api::class) @@ -309,7 +309,7 @@ private fun DisplayBanner( modifier: Modifier = Modifier, accountViewModel: AccountViewModel, ) { - val noteEvent by observeNoteEvent(baseNote, accountViewModel) + val noteEvent by observeNoteEvent(baseNote, accountViewModel) noteEvent?.image()?.let { AsyncImage( @@ -327,7 +327,7 @@ fun FollowPackHeader( accountViewModel: AccountViewModel, nav: INav, ) { - val noteEvent by observeNoteEvent(baseNote, accountViewModel) + val noteEvent by observeNoteEvent(baseNote, accountViewModel) Text( text = noteEvent?.title() ?: baseNote.dTag(), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/dal/FollowPackFeedConversationsFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/dal/FollowPackFeedConversationsFeedFilter.kt index 352fc2da65..663afb6994 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/dal/FollowPackFeedConversationsFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/dal/FollowPackFeedConversationsFeedFilter.kt @@ -37,7 +37,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nipA0VoiceMessages.VoiceReplyEvent import com.vitorpamplona.quartz.nipA4PublicMessages.PublicMessageEvent @@ -62,7 +62,7 @@ class FollowPackFeedConversationsFeedFilter( ) } - val followPackEvent = followPackNote.event as? FollowListEvent + val followPackEvent = followPackNote.event as? StarterPackEvent val follows = followPackEvent?.followIdSet() ?: emptySet() override fun applyFilter(newItems: Set): Set = innerApplyFilter(newItems) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/dal/FollowPackFeedNewThreadFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/dal/FollowPackFeedNewThreadFeedFilter.kt index e721fbdb88..c89f21f3d7 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/dal/FollowPackFeedNewThreadFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/dal/FollowPackFeedNewThreadFeedFilter.kt @@ -45,9 +45,9 @@ import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent import com.vitorpamplona.quartz.nipA0VoiceMessages.VoiceEvent @@ -66,16 +66,16 @@ class FollowPackFeedNewThreadFeedFilter( MusicPlaylistEvent.KIND, PodcastMetadataEvent.KIND, InteractiveStoryPrologueEvent.KIND, - WikiNoteEvent.KIND, + WikiArticleEvent.KIND, NipTextEvent.KIND, ClassifiedsEvent.KIND, FundraiserEvent.KIND, BirdexEvent.KIND, - LongTextNoteEvent.KIND, + LongFormContentEvent.KIND, ) } - val followPackEvent = followPackNote.event as? FollowListEvent + val followPackEvent = followPackNote.event as? StarterPackEvent val follows = followPackEvent?.followIdSet() ?: emptySet() override fun feedKey(): String = account.userProfile().pubkeyHex + "-" + followPackNote.idHex @@ -143,8 +143,8 @@ class FollowPackFeedNewThreadFeedFilter( noteEvent is BirdexEvent || noteEvent is BirdDetectionEvent || noteEvent.isRenderableRepost() || - (noteEvent is LongTextNoteEvent && noteEvent.content.isNotEmpty()) || - (noteEvent is WikiNoteEvent && noteEvent.content.isNotEmpty()) || + (noteEvent is LongFormContentEvent && noteEvent.content.isNotEmpty()) || + (noteEvent is WikiArticleEvent && noteEvent.content.isNotEmpty()) || noteEvent is ZapPollEvent || noteEvent is HighlightEvent || noteEvent is InteractiveStoryPrologueEvent || diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/dal/FollowPackMembersFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/dal/FollowPackMembersFeedFilter.kt index 033edb6744..a081c0031b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/dal/FollowPackMembersFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/dal/FollowPackMembersFeedFilter.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.commons.model.AddressableNote import com.vitorpamplona.amethyst.commons.model.User import com.vitorpamplona.amethyst.commons.model.cache.LocalCache.checkGetOrCreateUser import com.vitorpamplona.amethyst.model.Account -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent class FollowPackMembersFeedFilter( val followPackNote: AddressableNote, @@ -33,10 +33,10 @@ class FollowPackMembersFeedFilter( ) : FeedFilter() { override fun feedKey(): String = account.userProfile().pubkeyHex + "-" + followPackNote.idHex - val cache: MutableMap> = mutableMapOf() + val cache: MutableMap> = mutableMapOf() override fun feed(): List { - val followPackEvent = followPackNote.event as? FollowListEvent ?: return emptyList() + val followPackEvent = followPackNote.event as? StarterPackEvent ?: return emptyList() val previousList = cache[followPackEvent] if (previousList != null) return previousList diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/datasource/FollowPackFeedFilterSubAssembler.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/datasource/FollowPackFeedFilterSubAssembler.kt index d392e9ceb3..7c7b968467 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/datasource/FollowPackFeedFilterSubAssembler.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/feed/datasource/FollowPackFeedFilterSubAssembler.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.amethyst.commons.relayClient.home.nip65Follows.filterHo import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.INostrClient import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent class FollowPackFeedFilterSubAssembler( client: INostrClient, @@ -40,7 +40,7 @@ class FollowPackFeedFilterSubAssembler( if (keys.isEmpty()) return emptyList() return keys.flatMap { val followPack = it.followPack.event - if (followPack is FollowListEvent) { + if (followPack is StarterPackEvent) { val filter = if (it.account.proxyRelayList.flow.value .isEmpty() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/list/FollowPacksFeedLoaded.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/list/FollowPacksFeedLoaded.kt index 9b77a2d811..4ff1d00053 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/list/FollowPacksFeedLoaded.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/list/FollowPacksFeedLoaded.kt @@ -38,7 +38,7 @@ import com.vitorpamplona.amethyst.commons.ui.theme.DividerThickness import com.vitorpamplona.amethyst.commons.ui.theme.FeedPadding import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.discover.ChannelCardCompose -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent @OptIn(ExperimentalFoundationApi::class) @Composable @@ -64,7 +64,7 @@ fun FollowPacksFeedLoaded( baseNote = item, routeForLastRead = "FollowPacksFeed", modifier = Modifier.fillMaxWidth(), - forceEventKind = FollowListEvent.KIND, + forceEventKind = StarterPackEvent.KIND, accountViewModel = accountViewModel, nav = nav, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/list/FollowPacksTopBar.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/list/FollowPacksTopBar.kt index 4775dd8a8c..1c67d0241b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/list/FollowPacksTopBar.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/followPacks/list/FollowPacksTopBar.kt @@ -36,7 +36,7 @@ import com.vitorpamplona.amethyst.ui.navigation.topbars.UserDrawerSearchTopBar import com.vitorpamplona.amethyst.ui.screen.FeedDefinition import com.vitorpamplona.amethyst.ui.screen.TopNavFilterState import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent @Composable fun FollowPacksTopBar( @@ -49,7 +49,7 @@ fun FollowPacksTopBar( // The feed's own kind window, plus whatever the list spinner narrowed it to — a hashtag // or a geohash says itself as a token; a follow set does not, and seeds nothing. val me = accountViewModel.userProfile().pubkeyHex - val seed = remember(list, me) { SearchSeed.merge(SearchSeed.ofKinds(FollowListEvent.KIND), list.asSearchQuery(me)) } + val seed = remember(list, me) { SearchSeed.merge(SearchSeed.ofKinds(StarterPackEvent.KIND), list.asSearchQuery(me)) } UserDrawerSearchTopBar(accountViewModel, nav, seed) { FollowPacksTopNavFilterBar( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/dal/GeoHashFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/dal/GeoHashFeedFilter.kt index 5e3caa267d..3322db8e7d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/dal/GeoHashFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/dal/GeoHashFeedFilter.kt @@ -34,12 +34,12 @@ import com.vitorpamplona.quartz.experimental.zapPolls.ZapPollEvent import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.tags.geohash.isTaggedGeoHash -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip73ExternalIds.location.GeohashId import com.vitorpamplona.quartz.nipF4Podcasts.episode.PodcastEpisodeEvent import com.vitorpamplona.quartz.nipF4Podcasts.metadata.PodcastMetadataEvent @@ -79,10 +79,10 @@ class GeoHashFeedFilter( ): Boolean = ( event is TextNoteEvent || - event is LongTextNoteEvent || - event is WikiNoteEvent || + event is LongFormContentEvent || + event is WikiArticleEvent || event is ChannelMessageEvent || - event is PrivateDmEvent || + event is EncryptedDmEvent || event is ZapPollEvent || event is AudioHeaderEvent || event is MusicTrackEvent || diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/dal/HashtagFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/dal/HashtagFeedFilter.kt index 99c78942fd..0c7d4f80cc 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/dal/HashtagFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/dal/HashtagFeedFilter.kt @@ -34,12 +34,12 @@ import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.tags.hashtags.isTaggedHash -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip73ExternalIds.topics.HashtagId import com.vitorpamplona.quartz.nipF4Podcasts.episode.PodcastEpisodeEvent import com.vitorpamplona.quartz.nipF4Podcasts.metadata.PodcastMetadataEvent @@ -104,10 +104,10 @@ class HashtagFeedFilter( ( event is TextNoteEvent || event.isRenderableRepost() || - event is LongTextNoteEvent || - event is WikiNoteEvent || + event is LongFormContentEvent || + event is WikiArticleEvent || event is ChannelMessageEvent || - event is PrivateDmEvent || + event is EncryptedDmEvent || event is ZapPollEvent || event is AudioHeaderEvent || event is MusicTrackEvent || diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/datasource/FilterPostsByHashtags.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/datasource/FilterPostsByHashtags.kt index bfd839f1fa..2586985599 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/datasource/FilterPostsByHashtags.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/datasource/FilterPostsByHashtags.kt @@ -36,10 +36,10 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hashtagAlts import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip73ExternalIds.topics.HashtagId import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent @@ -51,12 +51,12 @@ val PostsByHashtagsKinds = listOf( TextNoteEvent.KIND, ChannelMessageEvent.KIND, - LongTextNoteEvent.KIND, + LongFormContentEvent.KIND, PollEvent.KIND, LiveActivitiesChatMessageEvent.KIND, ClassifiedsEvent.KIND, HighlightEvent.KIND, - WikiNoteEvent.KIND, + WikiArticleEvent.KIND, CommentEvent.KIND, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/dal/HomeNewThreadFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/dal/HomeNewThreadFeedFilter.kt index 3297759834..1cf99188dd 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/dal/HomeNewThreadFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/dal/HomeNewThreadFeedFilter.kt @@ -49,16 +49,16 @@ import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip35Torrents.TorrentEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip64Chess.end.LiveChessGameEndEvent import com.vitorpamplona.quartz.nip64Chess.game.ChessGameEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent @@ -77,15 +77,15 @@ class HomeNewThreadFeedFilter( MusicPlaylistEvent.KIND, PodcastMetadataEvent.KIND, InteractiveStoryPrologueEvent.KIND, - WikiNoteEvent.KIND, + WikiArticleEvent.KIND, ClassifiedsEvent.KIND, FundraiserEvent.KIND, BirdexEvent.KIND, - LongTextNoteEvent.KIND, + LongFormContentEvent.KIND, LiveChessGameEndEvent.KIND, AttestationEvent.KIND, - VideoHorizontalEvent.KIND, - VideoVerticalEvent.KIND, + AddressableNormalVideoEvent.KIND, + AddressableShortVideoEvent.KIND, EntityRatingEvent.KIND, ) } @@ -147,8 +147,8 @@ class HomeNewThreadFeedFilter( noteEvent is BirdexEvent || noteEvent is BirdDetectionEvent || noteEvent.isRenderableRepost() || - (noteEvent is LongTextNoteEvent && noteEvent.content.isNotEmpty()) || - (noteEvent is WikiNoteEvent && noteEvent.content.isNotEmpty()) || + (noteEvent is LongFormContentEvent && noteEvent.content.isNotEmpty()) || + (noteEvent is WikiArticleEvent && noteEvent.content.isNotEmpty()) || noteEvent is ZapPollEvent || noteEvent is PollEvent || noteEvent is HighlightEvent || @@ -166,8 +166,8 @@ class HomeNewThreadFeedFilter( noteEvent is PictureEvent || noteEvent is VideoNormalEvent || noteEvent is VideoShortEvent || - noteEvent is VideoHorizontalEvent || - noteEvent is VideoVerticalEvent || + noteEvent is AddressableNormalVideoEvent || + noteEvent is AddressableShortVideoEvent || noteEvent is TorrentEvent || noteEvent is AttestationEvent || noteEvent is AttestationRequestEvent || diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/nip75Goals/NewGoalViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/nip75Goals/NewGoalViewModel.kt index 22aac53186..1696cdae66 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/nip75Goals/NewGoalViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/home/nip75Goals/NewGoalViewModel.kt @@ -32,7 +32,7 @@ import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate -import com.vitorpamplona.quartz.nip75ZapGoals.GoalEvent +import com.vitorpamplona.quartz.nip75ZapGoals.ZapGoalEvent import com.vitorpamplona.quartz.utils.TimeUtils @Stable @@ -89,7 +89,7 @@ class NewGoalViewModel : ViewModel() { val sum = summary.text.ifBlank { null } val web = websiteUrl.text.ifBlank { null } - return GoalEvent.build( + return ZapGoalEvent.build( description = description.text, amount = amountMillisats, relays = relays, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/display/lists/PeopleListViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/display/lists/PeopleListViewModel.kt index dc141e4b72..8733e7a42f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/display/lists/PeopleListViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/display/lists/PeopleListViewModel.kt @@ -31,7 +31,7 @@ import com.vitorpamplona.amethyst.commons.model.User import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.ui.note.creators.userSuggestions.UserSuggestionState import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow @@ -62,7 +62,7 @@ class PeopleListViewModel : ViewModel() { }.flowOn(Dispatchers.IO) .stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), null) - fun selectedAddress() = PeopleListEvent.createAddress(account.userProfile().pubkeyHex, selectedDTag.value) + fun selectedAddress() = FollowSetEvent.createAddress(account.userProfile().pubkeyHex, selectedDTag.value) fun selectedNote() = account.cache.getOrCreateAddressableNote(selectedAddress()) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/display/packs/FollowPackViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/display/packs/FollowPackViewModel.kt index 62948d2075..f54fa456ca 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/display/packs/FollowPackViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/display/packs/FollowPackViewModel.kt @@ -31,7 +31,7 @@ import com.vitorpamplona.amethyst.commons.model.User import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.ui.note.creators.userSuggestions.UserSuggestionState import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow @@ -62,7 +62,7 @@ class FollowPackViewModel : ViewModel() { }.flowOn(Dispatchers.IO) .stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), null) - fun selectedAddress() = FollowListEvent.createAddress(account.userProfile().pubkeyHex, selectedDTag.value) + fun selectedAddress() = StarterPackEvent.createAddress(account.userProfile().pubkeyHex, selectedDTag.value) fun selectedNote() = account.cache.getOrCreateAddressableNote(selectedAddress()) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/longs/LongsTopBar.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/longs/LongsTopBar.kt index 9e87884561..898057185a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/longs/LongsTopBar.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/longs/LongsTopBar.kt @@ -36,7 +36,7 @@ import com.vitorpamplona.amethyst.ui.navigation.topbars.UserDrawerSearchTopBar import com.vitorpamplona.amethyst.ui.screen.FeedDefinition import com.vitorpamplona.amethyst.ui.screen.TopNavFilterState import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent @Composable fun LongsTopBar( @@ -49,7 +49,7 @@ fun LongsTopBar( // The feed's own kind window, plus whatever the list spinner narrowed it to — a hashtag // or a geohash says itself as a token; a follow set does not, and seeds nothing. val me = accountViewModel.userProfile().pubkeyHex - val seed = remember(list, me) { SearchSeed.merge(SearchSeed.ofKinds(VideoHorizontalEvent.KIND), list.asSearchQuery(me)) } + val seed = remember(list, me) { SearchSeed.merge(SearchSeed.ofKinds(AddressableNormalVideoEvent.KIND), list.asSearchQuery(me)) } UserDrawerSearchTopBar(accountViewModel, nav, seed) { LongsTopNavFilterBar( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/longs/dal/LongsFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/longs/dal/LongsFeedFilter.kt index cfe0cbc3b5..138d6b8e34 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/longs/dal/LongsFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/longs/dal/LongsFeedFilter.kt @@ -33,7 +33,7 @@ import com.vitorpamplona.amethyst.ui.dal.FilterByListParams import com.vitorpamplona.amethyst.ui.dal.sortedByDefaultFeedOrder import com.vitorpamplona.amethyst.ui.screen.loggedIn.video.dal.SupportedContent import com.vitorpamplona.quartz.nip01Core.core.AddressableEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoMeta import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent @@ -60,7 +60,7 @@ class LongsFeedFilter( LocalCache.notes.filterIntoSet { _, it -> acceptableEvent(it, params) } + - LocalCache.addressables.filterIntoSet(VideoHorizontalEvent.KIND) { _, it -> + LocalCache.addressables.filterIntoSet(AddressableNormalVideoEvent.KIND) { _, it -> acceptableEvent(it, params) } return sort(notes) @@ -91,7 +91,7 @@ class LongsFeedFilter( fun acceptableVideoiMetas(iMetas: List): Boolean = iMetas.any { videoFeedSupport.acceptableUrl(it.url, it.mimeType) } - fun acceptanceEvent(noteEvent: VideoHorizontalEvent) = acceptableVideoiMetas(noteEvent.imetaTags()) + fun acceptanceEvent(noteEvent: AddressableNormalVideoEvent) = acceptableVideoiMetas(noteEvent.imetaTags()) fun acceptanceEvent(noteEvent: VideoNormalEvent) = acceptableVideoiMetas(noteEvent.imetaTags()) @@ -106,7 +106,7 @@ class LongsFeedFilter( } return ( - (noteEvent is VideoHorizontalEvent && acceptanceEvent(noteEvent)) || + (noteEvent is AddressableNormalVideoEvent && acceptanceEvent(noteEvent)) || (noteEvent is VideoNormalEvent && acceptanceEvent(noteEvent)) ) && params.match(noteEvent, note.relays) && diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/datasource/NestRoomFilterAssembler.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/datasource/NestRoomFilterAssembler.kt index 3923973d8f..ca4c53d621 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/datasource/NestRoomFilterAssembler.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/datasource/NestRoomFilterAssembler.kt @@ -41,7 +41,7 @@ import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingSpaceEvent import com.vitorpamplona.quartz.nip53LiveActivities.presence.MeetingRoomPresenceEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nipB1Bolt12Zaps.zap.Bolt12ZapEvent /** @@ -100,7 +100,7 @@ class NestRoomFilterSubAssembler( LiveActivitiesChatMessageEvent.KIND, MeetingRoomPresenceEvent.KIND, ReactionEvent.KIND, - LnZapEvent.KIND, + ZapReceiptEvent.KIND, Bolt12ZapEvent.KIND, ), tags = mapOf("a" to listOf(key.note.idHex)), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/lifecycle/NestRoomEventCollectors.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/lifecycle/NestRoomEventCollectors.kt index 6e3fb4d01b..a18200cfdd 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/lifecycle/NestRoomEventCollectors.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/lifecycle/NestRoomEventCollectors.kt @@ -32,7 +32,7 @@ import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingSpaceEvent import com.vitorpamplona.quartz.nip53LiveActivities.presence.MeetingRoomPresenceEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nipB1Bolt12Zaps.zap.Bolt12ZapEvent import com.vitorpamplona.quartz.utils.TimeUtils import kotlinx.coroutines.delay @@ -153,7 +153,7 @@ private fun ReactionsCollector( * floating zap-overlay aggregator. The same note flows two places: * * 1. [NestViewModel.onChatEvent] — `ChatroomMessageCompose` routes - * `LnZapEvent` notes through `RenderChatZap`, which is the same + * `ZapReceiptEvent` notes through `RenderChatZap`, which is the same * card live streams use. Sharing the chat ledger keeps zap * cards interleaved with kind-1311 chat messages in time order. * @@ -169,14 +169,14 @@ private fun ZapsCollector( LaunchedEffect(viewModel, roomATag) { val filter = Filter( - kinds = listOf(LnZapEvent.KIND, Bolt12ZapEvent.KIND), + kinds = listOf(ZapReceiptEvent.KIND, Bolt12ZapEvent.KIND), tags = mapOf("a" to listOf(roomATag)), ) LocalCache.observeNotes(filter).collect { notes -> val nowSec = System.currentTimeMillis() / 1000 notes.forEach { note -> viewModel.onChatEvent(note) - (note.event as? LnZapEvent)?.let { viewModel.onZapEvent(it, nowSec) } + (note.event as? ZapReceiptEvent)?.let { viewModel.onZapEvent(it, nowSec) } (note.event as? Bolt12ZapEvent)?.let { viewModel.onZapEvent(it, nowSec) } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/CardFeedContentState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/CardFeedContentState.kt index 25f3230185..a219448a67 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/CardFeedContentState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/CardFeedContentState.kt @@ -45,14 +45,14 @@ import com.vitorpamplona.amethyst.ui.dal.NotificationFeedOrderCard import com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications.dal.NotificationFeedFilter import com.vitorpamplona.quartz.buzz.notifications.MemberAddedNotificationEvent import com.vitorpamplona.quartz.nip01Core.core.HexKey -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip17Dm.base.NIP17Group import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMetadataEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip58Badges.award.BadgeAwardEvent import com.vitorpamplona.quartz.nip61Nutzaps.nutzap.NutzapEvent import com.vitorpamplona.quartz.utils.Log @@ -183,7 +183,7 @@ class CardFeedContentState( val zapsPerUser = mutableMapOf>() val zapsPerEvent = mutableMapOf>() notes - .filter { it.event is LnZapEvent } + .filter { it.event is ZapReceiptEvent } .forEach { zapEvent -> val zappedPost = zapEvent.replyTo?.lastOrNull() if (zappedPost != null) { @@ -200,7 +200,7 @@ class CardFeedContentState( .add(CombinedZap(zapRequest, zapEvent)) } } else { - val event = (zapEvent.event as LnZapEvent) + val event = (zapEvent.event as ZapReceiptEvent) val author = event.zappedAuthor().firstNotNullOfOrNull { LocalCache.getUserIfExists(it) // don't create user if it doesn't exist @@ -361,7 +361,7 @@ class CardFeedContentState( it.event !is ReactionEvent && it.event !is RepostEvent && it.event !is GenericRepostEvent && - it.event !is LnZapEvent && + it.event !is ZapReceiptEvent && // Nutzaps are already grouped into nutzapsPerEvent (MultiSetCard) // or nutzapsPerUser (NutzapUserSetCard) above, exactly like lightning // zaps. Without this exclusion a nutzap would ALSO fall through to a @@ -372,7 +372,7 @@ class CardFeedContentState( val pendingInvite = if (it.event is MemberAddedNotificationEvent) pendingInvites[it.idHex] else null if (pendingInvite != null) { ChannelInviteCard(it, pendingInvite) - } else if (it.event is PrivateDmEvent || it.event is NIP17Group || it.isInMarmotGroup()) { + } else if (it.event is EncryptedDmEvent || it.event is NIP17Group || it.isInMarmotGroup()) { MessageSetCard(it) } else if (it.event is BadgeAwardEvent) { BadgeCard(it) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/NotificationSummaryState.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/NotificationSummaryState.kt index 8b86a5c5da..e1cc54cc4a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/NotificationSummaryState.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/NotificationSummaryState.kt @@ -39,7 +39,7 @@ import com.vitorpamplona.quartz.nip10Notes.BaseThreadedEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nipB1Bolt12Zaps.zap.Bolt12ZapEvent import com.vitorpamplona.quartz.nipBCOnchainZaps.zap.OnchainZapEvent import com.vitorpamplona.quartz.utils.Log @@ -117,7 +117,7 @@ class NotificationSummaryState( } } - noteEvent is LnZapEvent -> { + noteEvent is ZapReceiptEvent -> { // the user might be sending his own receipts noteEvent.pubKey != currentUser if (noteEvent.isTaggedUser(currentUser)) { val netDate = formatDate(noteEvent.createdAt) @@ -212,7 +212,7 @@ class NotificationSummaryState( } } - noteEvent is LnZapEvent -> { + noteEvent is ZapReceiptEvent -> { if (noteEvent.isTaggedUser(currentUser)) { // && noteEvent.pubKey != currentUser User might be sending his own receipts val netDate = formatDate(noteEvent.createdAt) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/dal/NotificationFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/dal/NotificationFeedFilter.kt index c9735bb746..433d8d8183 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/dal/NotificationFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/dal/NotificationFeedFilter.kt @@ -52,7 +52,7 @@ import com.vitorpamplona.quartz.experimental.zapPolls.ZapPollEvent import com.vitorpamplona.quartz.nip01Core.core.AddressableEvent import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.tags.people.isTaggedUser -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip10Notes.BaseNoteEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent @@ -60,7 +60,7 @@ import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent import com.vitorpamplona.quartz.nip34Git.issue.GitIssueEvent @@ -78,17 +78,17 @@ import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent import com.vitorpamplona.quartz.nip52Calendar.rsvp.CalendarRSVPEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip58Badges.award.BadgeAwardEvent import com.vitorpamplona.quartz.nip61Nutzaps.nutzap.NutzapEvent import com.vitorpamplona.quartz.nip64Chess.challenge.accept.LiveChessGameAcceptEvent import com.vitorpamplona.quartz.nip64Chess.move.LiveChessMoveEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip72ModCommunities.communityAddress import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent @@ -131,11 +131,11 @@ class NotificationFeedFilter( LiveActivitiesEvent.KIND, LiveChessGameAcceptEvent.KIND, LiveChessMoveEvent.KIND, - LongTextNoteEvent.KIND, + LongFormContentEvent.KIND, NipTextEvent.KIND, - VideoVerticalEvent.KIND, - VideoHorizontalEvent.KIND, - WikiNoteEvent.KIND, + AddressableShortVideoEvent.KIND, + AddressableNormalVideoEvent.KIND, + WikiArticleEvent.KIND, AttestationRequestEvent.KIND, ) @@ -198,7 +198,7 @@ class NotificationFeedFilter( TextNoteEvent.KIND, ReactionEvent.KIND, RepostEvent.KIND, - LnZapEvent.KIND, + ZapReceiptEvent.KIND, NutzapEvent.KIND, OnchainZapEvent.KIND, Bolt12ZapEvent.KIND, @@ -206,7 +206,7 @@ class NotificationFeedFilter( PictureEvent.KIND, PollEvent.KIND, ZapPollEvent.KIND, - PrivateDmEvent.KIND, + EncryptedDmEvent.KIND, PublicMessageEvent.KIND, VideoNormalEvent.KIND, VideoShortEvent.KIND, @@ -322,9 +322,9 @@ class NotificationFeedFilter( // proves the comment targets a zap; the reply's explicit p tag // on the user marks it as theirs. val targetsZapReceipt = - event.hasScopeKind(LnZapEvent.KIND.toString()) || + event.hasScopeKind(ZapReceiptEvent.KIND.toString()) || event.hasScopeKind(Bolt12ZapEvent.KIND.toString()) || - note.replyTo?.any { it.event is LnZapEvent || it.event is Bolt12ZapEvent } == true + note.replyTo?.any { it.event is ZapReceiptEvent || it.event is Bolt12ZapEvent } == true if (targetsZapReceipt && event.isTaggedUser(authorHex)) { return true @@ -578,13 +578,13 @@ class NotificationFeedFilter( ( noteEvent is ChatMessageEvent || noteEvent is ChatMessageEncryptedFileHeaderEvent || - noteEvent is PrivateDmEvent + noteEvent is EncryptedDmEvent ) ) { return false } val notifAuthor = - if (noteEvent is LnZapEvent) { + if (noteEvent is ZapReceiptEvent) { val zapRequest = noteEvent.zapRequest if (zapRequest != null) { if (noteEvent.zapRequest?.isPrivateZap() == true) { @@ -608,7 +608,7 @@ class NotificationFeedFilter( // Reactions/zaps/reposts target a note via `replyTo`, not via thread-root tags, // so isNotInMutedThread on the wrapper event misses them. - if (noteEvent is ReactionEvent || noteEvent is LnZapEvent || noteEvent is Bolt12ZapEvent || + if (noteEvent is ReactionEvent || noteEvent is ZapReceiptEvent || noteEvent is Bolt12ZapEvent || noteEvent is RepostEvent || noteEvent is GenericRepostEvent ) { val target = it.replyTo?.lastOrNull() @@ -679,11 +679,11 @@ class NotificationFeedFilter( // relevance check (tagsAnEventByUser is skipped below); it still scopes // to genuine replies, so unrelated channel chatter never leaks through. return noteEvent?.kind in NOTIFICATION_KINDS && - (noteEvent is LnZapEvent || noteEvent is Bolt12ZapEvent || notifAuthor != loggedInUserHex) && + (noteEvent is ZapReceiptEvent || noteEvent is Bolt12ZapEvent || notifAuthor != loggedInUserHex) && (isChessEvent || isConcord || isReactionToMe || isThreadReplyToMe || filterParams.isGlobal() || notifAuthor == null || filterParams.isAuthorInFollows(notifAuthor)) && (noteEvent?.isTaggedUser(loggedInUserHex) == true || isNotifiablePublicChatReply(it, loggedInUserHex) || isReactionToMe || isThreadReplyToMe) && (filterParams.isHiddenList || notifAuthor == null || !account.isHidden(notifAuthor)) && - (noteEvent !is PrivateDmEvent || !account.isDecryptedContentHidden(noteEvent)) && + (noteEvent !is EncryptedDmEvent || !account.isDecryptedContentHidden(noteEvent)) && // For a Concord note the explicit p-tag above IS the relevance signal (the reply/reaction/ // mention targets me directly), so skip the per-kind heuristic — which for a reaction would // otherwise need my target message already loaded to resolve replyTo. diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/podcasts/PodcastTopSupporters.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/podcasts/PodcastTopSupporters.kt index 9ce804d10e..5b8fdcda06 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/podcasts/PodcastTopSupporters.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/podcasts/PodcastTopSupporters.kt @@ -61,7 +61,7 @@ import com.vitorpamplona.amethyst.ui.note.UsernameDisplay import com.vitorpamplona.amethyst.ui.note.showAmountInteger import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.rooms.LoadUser -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import java.math.BigDecimal private val Gold = Color(0xFFFFC300) @@ -86,7 +86,7 @@ fun PodcastTopSupporters( remember(zapState) { val contributions = note.zaps.mapNotNull { (_, receiptNote) -> - val receipt = receiptNote?.event as? LnZapEvent ?: return@mapNotNull null + val receipt = receiptNote?.event as? ZapReceiptEvent ?: return@mapNotNull null val request = receipt.zapRequest ?: return@mapNotNull null val sats = receipt.amount()?.toLong() ?: return@mapNotNull null // Anon/private zaps carry an `anon` tag; collapse them into the shared bucket. diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/gallery/dal/UserProfileGalleryFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/gallery/dal/UserProfileGalleryFeedFilter.kt index b6742d40aa..aef3178ea3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/gallery/dal/UserProfileGalleryFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/gallery/dal/UserProfileGalleryFeedFilter.kt @@ -32,10 +32,10 @@ import com.vitorpamplona.amethyst.ui.dal.sortedByDefaultFeedOrder import com.vitorpamplona.quartz.experimental.profileGallery.ProfileGalleryEntryEvent import com.vitorpamplona.quartz.nip53LiveActivities.clip.LiveActivitiesClipEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.AddressableVideoEvent import com.vitorpamplona.quartz.nip71Video.RegularVideoEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent class UserProfileGalleryFeedFilter( val user: User, @@ -57,7 +57,7 @@ class UserProfileGalleryFeedFilter( // Both NIP-71 addressable kinds: acceptableEvent() takes any // AddressableVideoEvent, so listing 34236 twice silently kept every // 34235 (horizontal) video out of the gallery. - listOf(VideoVerticalEvent.KIND, VideoHorizontalEvent.KIND), + listOf(AddressableShortVideoEvent.KIND, AddressableNormalVideoEvent.KIND), user.pubkeyHex, ) { _, it -> acceptableEvent(it, params, user) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/mutual/dal/UserProfileMutualFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/mutual/dal/UserProfileMutualFeedFilter.kt index 4a1654ac55..1af33308ff 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/mutual/dal/UserProfileMutualFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/mutual/dal/UserProfileMutualFeedFilter.kt @@ -41,9 +41,9 @@ import com.vitorpamplona.quartz.experimental.zapPolls.ZapPollEvent import com.vitorpamplona.quartz.nip01Core.core.AddressableEvent import com.vitorpamplona.quartz.nip01Core.tags.people.isTaggedUser import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip35Torrents.TorrentEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent import com.vitorpamplona.quartz.nipA4PublicMessages.PublicMessageEvent @@ -83,8 +83,8 @@ class UserProfileMutualFeedFilter( it.event is BirdexEvent || it.event is BirdDetectionEvent || it.event.isRenderableRepost() || - it.event is LongTextNoteEvent || - it.event is WikiNoteEvent || + it.event is LongFormContentEvent || + it.event is WikiArticleEvent || it.event is NipTextEvent || it.event is ZapPollEvent || it.event is HighlightEvent || diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/newthreads/dal/UserProfileNewThreadFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/newthreads/dal/UserProfileNewThreadFeedFilter.kt index f649abb356..561bc45837 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/newthreads/dal/UserProfileNewThreadFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/newthreads/dal/UserProfileNewThreadFeedFilter.kt @@ -47,9 +47,9 @@ import com.vitorpamplona.quartz.experimental.zapPolls.ZapPollEvent import com.vitorpamplona.quartz.nip01Core.core.AddressableEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip35Torrents.TorrentEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent @@ -91,8 +91,8 @@ class UserProfileNewThreadFeedFilter( it.event is BirdexEvent || it.event is BirdDetectionEvent || it.event.isRenderableRepost() || - it.event is LongTextNoteEvent || - it.event is WikiNoteEvent || + it.event is LongFormContentEvent || + it.event is WikiArticleEvent || it.event is NipTextEvent || it.event is ZapPollEvent || it.event is PollEvent || diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/payment/SendPaymentContent.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/payment/SendPaymentContent.kt index c437afb68d..1bd3ac0ebb 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/payment/SendPaymentContent.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/payment/SendPaymentContent.kt @@ -99,7 +99,7 @@ import com.vitorpamplona.amethyst.commons.ui.theme.ButtonBorder import com.vitorpamplona.amethyst.commons.ui.theme.ThemeComparisonColumn import com.vitorpamplona.amethyst.commons.ui.theme.placeholderText import com.vitorpamplona.amethyst.ui.note.showAmount -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toImmutableList @@ -139,7 +139,7 @@ data class PaymentMethodUi( /** One entry of the zap-type selector (Public / Private / Anonymous / Non-Zap). */ @Immutable data class ZapTypeOption( - val type: LnZapEvent.ZapType, + val type: ZapReceiptEvent.ZapType, val label: String, val explainer: String, ) @@ -270,8 +270,8 @@ fun SendPaymentContent( showMessageField: Boolean, messageLabel: String, zapTypes: ImmutableList?, - selectedZapType: LnZapEvent.ZapType, - onZapTypeChange: (LnZapEvent.ZapType) -> Unit, + selectedZapType: ZapReceiptEvent.ZapType, + onZapTypeChange: (ZapReceiptEvent.ZapType) -> Unit, receiptNote: String?, stage: PaymentFlowStage, canSend: Boolean, @@ -630,8 +630,8 @@ private fun AmountSection( @Composable private fun ReceiptSection( zapTypes: ImmutableList?, - selectedZapType: LnZapEvent.ZapType, - onZapTypeChange: (LnZapEvent.ZapType) -> Unit, + selectedZapType: ZapReceiptEvent.ZapType, + onZapTypeChange: (ZapReceiptEvent.ZapType) -> Unit, receiptNote: String?, enabled: Boolean, ) { @@ -771,10 +771,10 @@ private val previewFromSources = private val previewZapTypes = listOf( - ZapTypeOption(LnZapEvent.ZapType.PUBLIC, "Public", "Everybody can see the transaction and message"), - ZapTypeOption(LnZapEvent.ZapType.PRIVATE, "Private", "Sender and receiver can see each other and read the message"), - ZapTypeOption(LnZapEvent.ZapType.ANONYMOUS, "Anonymous", "Receiver does not know who sent the payment"), - ZapTypeOption(LnZapEvent.ZapType.NONZAP, "Non-Zap", "No trace on Nostr, only in Lightning"), + ZapTypeOption(ZapReceiptEvent.ZapType.PUBLIC, "Public", "Everybody can see the transaction and message"), + ZapTypeOption(ZapReceiptEvent.ZapType.PRIVATE, "Private", "Sender and receiver can see each other and read the message"), + ZapTypeOption(ZapReceiptEvent.ZapType.ANONYMOUS, "Anonymous", "Receiver does not know who sent the payment"), + ZapTypeOption(ZapReceiptEvent.ZapType.NONZAP, "Non-Zap", "No trace on Nostr, only in Lightning"), ).toImmutableList() @Composable @@ -822,7 +822,7 @@ private fun SendPaymentLightningPreview() { showMessageField = true, messageLabel = PREVIEW_MESSAGE_LABEL, zapTypes = previewZapTypes, - selectedZapType = LnZapEvent.ZapType.PUBLIC, + selectedZapType = ZapReceiptEvent.ZapType.PUBLIC, onZapTypeChange = {}, receiptNote = null, stage = PaymentFlowStage.Editing, @@ -858,7 +858,7 @@ private fun SendPaymentClinkFixedPreview() { showMessageField = false, messageLabel = "", zapTypes = null, - selectedZapType = LnZapEvent.ZapType.PUBLIC, + selectedZapType = ZapReceiptEvent.ZapType.PUBLIC, onZapTypeChange = {}, receiptNote = "Direct Lightning payment — no zap receipt is published on Nostr.", stage = PaymentFlowStage.Editing, @@ -894,7 +894,7 @@ private fun SendPaymentInProgressPreview() { showMessageField = true, messageLabel = PREVIEW_MESSAGE_LABEL, zapTypes = null, - selectedZapType = LnZapEvent.ZapType.PUBLIC, + selectedZapType = ZapReceiptEvent.ZapType.PUBLIC, onZapTypeChange = {}, receiptNote = "The nutzap event delivers the ecash itself, so it is always published.", stage = PaymentFlowStage.InProgress("Locking and sending ecash…", progress = 0.55f), @@ -930,7 +930,7 @@ private fun SendPaymentSuccessPreview() { showMessageField = true, messageLabel = PREVIEW_MESSAGE_LABEL, zapTypes = previewZapTypes, - selectedZapType = LnZapEvent.ZapType.PUBLIC, + selectedZapType = ZapReceiptEvent.ZapType.PUBLIC, onZapTypeChange = {}, receiptNote = null, stage = PaymentFlowStage.Success("Payment sent!", "1,000 sats to Alice"), @@ -966,7 +966,7 @@ private fun SendPaymentFailurePreview() { showMessageField = true, messageLabel = "Comment", zapTypes = null, - selectedZapType = LnZapEvent.ZapType.PUBLIC, + selectedZapType = ZapReceiptEvent.ZapType.PUBLIC, onZapTypeChange = {}, receiptNote = "An on-chain zap receipt is published on Nostr so the recipient can find the payment.", stage = PaymentFlowStage.Failure("Insufficient funds to cover the amount plus the network fee."), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/payment/SendPaymentScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/payment/SendPaymentScreen.kt index adaec88edf..32bfc5a77a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/payment/SendPaymentScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/payment/SendPaymentScreen.kt @@ -117,7 +117,7 @@ import com.vitorpamplona.quartz.experimental.clink.offers.OfferErrorCode import com.vitorpamplona.quartz.experimental.clink.pointers.ClinkPointerParser import com.vitorpamplona.quartz.experimental.clink.pointers.NOffer import com.vitorpamplona.quartz.experimental.clink.pointers.OfferPriceType -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nipBCOnchainZaps.chain.FeeEstimates import com.vitorpamplona.quartz.nipBCOnchainZaps.taproot.SegwitAddress import com.vitorpamplona.quartz.nipBCOnchainZaps.taproot.TaprootAddress @@ -621,9 +621,9 @@ private fun SendPaymentLoaded( val messageLabel = when { selectedMethod == ProfilePaymentMethod.ONCHAIN -> stringRes(Res.string.note_to_receiver) - selectedMethod == ProfilePaymentMethod.LIGHTNING && zapType == LnZapEvent.ZapType.PRIVATE -> + selectedMethod == ProfilePaymentMethod.LIGHTNING && zapType == ZapReceiptEvent.ZapType.PRIVATE -> stringRes(Res.string.custom_zaps_add_a_message_private) - selectedMethod == ProfilePaymentMethod.LIGHTNING && zapType == LnZapEvent.ZapType.NONZAP -> + selectedMethod == ProfilePaymentMethod.LIGHTNING && zapType == ZapReceiptEvent.ZapType.NONZAP -> stringRes(Res.string.custom_zaps_add_a_message_nonzap) else -> stringRes(Res.string.custom_zaps_add_a_message) } @@ -738,10 +738,10 @@ private fun rememberLightningZapTypeOptions(): ImmutableList { return remember { persistentListOf( - ZapTypeOption(LnZapEvent.ZapType.PUBLIC, publicLabel, publicExplainer), - ZapTypeOption(LnZapEvent.ZapType.PRIVATE, privateLabel, privateExplainer), - ZapTypeOption(LnZapEvent.ZapType.ANONYMOUS, anonymousLabel, anonymousExplainer), - ZapTypeOption(LnZapEvent.ZapType.NONZAP, nonzapLabel, nonzapExplainer), + ZapTypeOption(ZapReceiptEvent.ZapType.PUBLIC, publicLabel, publicExplainer), + ZapTypeOption(ZapReceiptEvent.ZapType.PRIVATE, privateLabel, privateExplainer), + ZapTypeOption(ZapReceiptEvent.ZapType.ANONYMOUS, anonymousLabel, anonymousExplainer), + ZapTypeOption(ZapReceiptEvent.ZapType.NONZAP, nonzapLabel, nonzapExplainer), ) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/relays/RelayFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/relays/RelayFeedViewModel.kt index cb0e4df73a..3c10216804 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/relays/RelayFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/relays/RelayFeedViewModel.kt @@ -30,7 +30,7 @@ import com.vitorpamplona.amethyst.commons.model.User import com.vitorpamplona.amethyst.commons.model.nip01Core.RelayInfo import com.vitorpamplona.amethyst.commons.model.nip01Core.Wrapper import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent import com.vitorpamplona.quartz.utils.Log import kotlinx.coroutines.Dispatchers @@ -144,7 +144,7 @@ class RelayFeedViewModel : .flow() .metadata.stateFlow .map { dmNote -> - (dmNote.note.event as? ChatMessageRelayListEvent)?.relays()?.toSet() ?: emptySet() + (dmNote.note.event as? DmRelayListEvent)?.relays()?.toSet() ?: emptySet() }, flow2 = user.relayState().flow(), transform = ::convert, @@ -154,7 +154,7 @@ class RelayFeedViewModel : emit(emptyList()) } }.onStart { - emit(convert((currentUser.value?.nip65RelayListNote?.event as? ChatMessageRelayListEvent)?.relays()?.toSet(), currentUser.value?.relayState()?.data)) + emit(convert((currentUser.value?.nip65RelayListNote?.event as? DmRelayListEvent)?.relays()?.toSet(), currentUser.value?.relayState()?.data)) }.flowOn(Dispatchers.IO) .stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), emptyList()) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/zaps/dal/UserProfileZapsViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/zaps/dal/UserProfileZapsViewModel.kt index 4e718ef67e..db71a85712 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/zaps/dal/UserProfileZapsViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/zaps/dal/UserProfileZapsViewModel.kt @@ -30,7 +30,7 @@ import com.vitorpamplona.amethyst.commons.model.cache.LocalCache import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nipB1Bolt12Zaps.zap.Bolt12ZapEvent import com.vitorpamplona.quartz.nipBCOnchainZaps.zap.OnchainZapEvent import com.vitorpamplona.quartz.utils.BigDecimal @@ -55,14 +55,14 @@ class UserProfileZapsViewModel( ) : ViewModel() { val zapsToUser = Filter( - kinds = listOf(LnZapEvent.KIND, OnchainZapEvent.KIND, Bolt12ZapEvent.KIND), + kinds = listOf(ZapReceiptEvent.KIND, OnchainZapEvent.KIND, Bolt12ZapEvent.KIND), tags = mapOf("p" to listOf(user.pubkeyHex)), ) val sortingModel: Comparator = compareByDescending { it.amount }.thenBy { it.user.pubkeyHex } - suspend fun mapRequest(zapEvent: LnZapEvent): ZapAmount? { + suspend fun mapRequest(zapEvent: ZapReceiptEvent): ZapAmount? { val zapRequest = zapEvent.zapRequest ?: return ZapAmount( LocalCache.getOrCreateUser(zapEvent.pubKey), @@ -122,7 +122,7 @@ class UserProfileZapsViewModel( this.forEach { zapEvent -> val zapAmount = when (zapEvent) { - is LnZapEvent -> mapRequest(zapEvent) + is ZapReceiptEvent -> mapRequest(zapEvent) is OnchainZapEvent -> mapOnchainZap(zapEvent) is Bolt12ZapEvent -> mapBolt12Zap(zapEvent) else -> null diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/KindDisplayName.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/KindDisplayName.kt index 2ea4d40bac..0684f76185 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/KindDisplayName.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/KindDisplayName.kt @@ -206,25 +206,25 @@ import com.vitorpamplona.quartz.kinds.KindNames import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent import com.vitorpamplona.quartz.nip03Timestamp.OtsEvent -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelHideMessageEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMetadataEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMuteUserEvent -import com.vitorpamplona.quartz.nip28PublicChat.list.ChannelListEvent +import com.vitorpamplona.quartz.nip28PublicChat.list.PublicChatListEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent import com.vitorpamplona.quartz.nip30CustomEmoji.pack.EmojiPackEvent -import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiPackSelectionEvent +import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiListEvent import com.vitorpamplona.quartz.nip34Git.issue.GitIssueEvent import com.vitorpamplona.quartz.nip34Git.patch.GitPatchEvent import com.vitorpamplona.quartz.nip34Git.pr.GitPullRequestEvent @@ -239,32 +239,32 @@ import com.vitorpamplona.quartz.nip35Torrents.TorrentCommentEvent import com.vitorpamplona.quartz.nip35Torrents.TorrentEvent import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent import com.vitorpamplona.quartz.nip37Drafts.privateOutbox.PrivateOutboxRelayListEvent -import com.vitorpamplona.quartz.nip38UserStatus.StatusEvent +import com.vitorpamplona.quartz.nip38UserStatus.UserStatusEvent import com.vitorpamplona.quartz.nip42RelayAuth.RelayAuthEvent import com.vitorpamplona.quartz.nip46RemoteSigner.NostrConnectEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent import com.vitorpamplona.quartz.nip51Lists.PinListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.OldBookmarkListEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip51Lists.geohashList.GeohashListEvent -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent -import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.LabeledBookmarkListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent +import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.BookmarkSetEvent import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BlockedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BroadcastRelayListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.ProxyRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relaySets.RelaySetEvent import com.vitorpamplona.quartz.nip51Lists.videoCurationSet.VideoCurationSetEvent import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import com.vitorpamplona.quartz.nip52Calendar.rsvp.CalendarRSVPEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingRoomEvent @@ -272,16 +272,16 @@ import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingSpaceEv import com.vitorpamplona.quartz.nip53LiveActivities.nestsServers.NestsServersEvent import com.vitorpamplona.quartz.nip53LiveActivities.presence.MeetingRoomPresenceEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip58Badges.accepted.AcceptedBadgeSetEvent import com.vitorpamplona.quartz.nip58Badges.award.BadgeAwardEvent import com.vitorpamplona.quartz.nip58Badges.definition.BadgeDefinitionEvent import com.vitorpamplona.quartz.nip58Badges.profile.ProfileBadgesEvent -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.EphemeralGiftWrapEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nip62RequestToVanish.RequestToVanishEvent @@ -296,29 +296,29 @@ import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent import com.vitorpamplona.quartz.nip66RelayMonitor.discovery.RelayDiscoveryEvent import com.vitorpamplona.quartz.nip66RelayMonitor.monitor.RelayMonitorEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip71Video.textTrack.TextTrackEvent import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent import com.vitorpamplona.quartz.nip72ModCommunities.follow.CommunityListEvent -import com.vitorpamplona.quartz.nip75ZapGoals.GoalEvent +import com.vitorpamplona.quartz.nip75ZapGoals.ZapGoalEvent import com.vitorpamplona.quartz.nip78AppData.AppSpecificDataEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip85TrustedAssertions.list.TrustProviderListEvent -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip88Polls.response.PollResponseEvent import com.vitorpamplona.quartz.nip89AppHandlers.definition.AppDefinitionEvent import com.vitorpamplona.quartz.nip89AppHandlers.recommendation.AppRecommendationEvent -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.NIP90ContentDiscoveryRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.NIP90ContentDiscoveryResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.status.NIP90StatusEvent -import com.vitorpamplona.quartz.nip90Dvms.userDiscoveryRequest.NIP90UserDiscoveryRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.userDiscoveryResponse.NIP90UserDiscoveryResponseEvent -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.DvmContentDiscoveryRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.DvmContentDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.status.DvmStatusEvent +import com.vitorpamplona.quartz.nip90Dvms.userDiscoveryRequest.DvmUserDiscoveryRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.userDiscoveryResponse.DvmUserDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent import com.vitorpamplona.quartz.nip96FileStorage.config.FileServersEvent import com.vitorpamplona.quartz.nip98HttpAuth.HTTPAuthorizationEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent @@ -366,12 +366,12 @@ fun kindDisplayName(kind: Int): StringResource? = BookmarkListEvent.KIND -> Res.string.kind_bookmark_list OldBookmarkListEvent.KIND -> Res.string.kind_old_bookmark_list CalendarDateSlotEvent.KIND -> Res.string.kind_day_appointment - CalendarEvent.KIND -> Res.string.kind_calendar + CalendarCollectionEvent.KIND -> Res.string.kind_calendar CalendarTimeSlotEvent.KIND -> Res.string.kind_appointment CalendarRSVPEvent.KIND -> Res.string.kind_appt_rsvp ChessGameEvent.KIND -> Res.string.kind_chess_games JesterEvent.KIND -> Res.string.kind_chess_auth - RelayFeedsListEvent.KIND -> Res.string.kind_favorite_relays + FavoriteRelayListEvent.KIND -> Res.string.kind_favorite_relays LiveChessGameChallengeEvent.KIND -> Res.string.kind_chess_challenges LiveChessGameAcceptEvent.KIND -> Res.string.kind_chess_game_accept LiveChessMoveEvent.KIND -> Res.string.kind_chess_move @@ -379,32 +379,32 @@ fun kindDisplayName(kind: Int): StringResource? = LiveChessDrawOfferEvent.KIND -> Res.string.kind_chess_draw_offer ChannelCreateEvent.KIND -> Res.string.kind_channel_definition ChannelHideMessageEvent.KIND -> Res.string.kind_channel_hide_msg - ChannelListEvent.KIND -> Res.string.kind_channel_list + PublicChatListEvent.KIND -> Res.string.kind_channel_list ChannelMessageEvent.KIND -> Res.string.kind_channel_message ChannelMetadataEvent.KIND -> Res.string.kind_channel_metadata ChannelMuteUserEvent.KIND -> Res.string.kind_channel_mute_user ChatMessageEncryptedFileHeaderEvent.KIND -> Res.string.kind_dm_file ChatMessageEvent.KIND -> Res.string.kind_dm_message - ChatMessageRelayListEvent.KIND -> Res.string.kind_dm_relays + DmRelayListEvent.KIND -> Res.string.kind_dm_relays ClassifiedsEvent.KIND -> Res.string.kind_classifieds CommentEvent.KIND -> Res.string.kind_comments CommunityDefinitionEvent.KIND -> Res.string.kind_community_def CommunityListEvent.KIND -> Res.string.kind_community_list CommunityPostApprovalEvent.KIND -> Res.string.kind_community_post ContactListEvent.KIND -> Res.string.kind_follow_list - DeletionEvent.KIND -> Res.string.kind_deletions + DeletionRequestEvent.KIND -> Res.string.kind_deletions DraftWrapEvent.KIND -> Res.string.kind_drafts EmojiPackEvent.KIND -> Res.string.kind_emoji_packs - EmojiPackSelectionEvent.KIND -> Res.string.kind_emoji_pack_list + EmojiListEvent.KIND -> Res.string.kind_emoji_pack_list EphemeralChatEvent.KIND -> Res.string.kind_ephemeral_chat EphemeralChatListEvent.KIND -> Res.string.kind_ephemeral_chatrooms - FileHeaderEvent.KIND -> Res.string.kind_file_headers + FileMetadataEvent.KIND -> Res.string.kind_file_headers ProfileGalleryEntryEvent.KIND -> Res.string.kind_profile_gallery FileServersEvent.KIND -> Res.string.kind_file_servers FileStorageEvent.KIND -> Res.string.kind_blob_data FileStorageHeaderEvent.KIND -> Res.string.kind_blob_headers FhirResourceEvent.KIND -> Res.string.kind_medical_data - FollowListEvent.KIND -> Res.string.kind_follow_packs + StarterPackEvent.KIND -> Res.string.kind_follow_packs GenericRepostEvent.KIND -> Res.string.kind_reposts_16 GeohashListEvent.KIND -> Res.string.kind_geohash_follows GiftWrapEvent.KIND -> Res.string.kind_gift_wraps @@ -419,24 +419,24 @@ fun kindDisplayName(kind: Int): StringResource? = GitStatusAppliedEvent.KIND -> Res.string.kind_git_status_applied GitStatusClosedEvent.KIND -> Res.string.kind_git_status_closed GitStatusDraftEvent.KIND -> Res.string.kind_git_status_draft - GoalEvent.KIND -> Res.string.kind_zap_goals - HashtagListEvent.KIND -> Res.string.kind_hashtag_follows + ZapGoalEvent.KIND -> Res.string.kind_zap_goals + InterestListEvent.KIND -> Res.string.kind_hashtag_follows HighlightEvent.KIND -> Res.string.kind_highlights HTTPAuthorizationEvent.KIND -> Res.string.kind_http_auth IndexerRelayListEvent.KIND -> Res.string.kind_index_relay_list InteractiveStoryPrologueEvent.KIND -> Res.string.kind_adventure_prologue InteractiveStorySceneEvent.KIND -> Res.string.kind_adventure_scene InteractiveStoryReadingStateEvent.KIND -> Res.string.kind_adventure_reading - LabeledBookmarkListEvent.KIND -> Res.string.kind_named_bookmarks + BookmarkSetEvent.KIND -> Res.string.kind_named_bookmarks LiveActivitiesChatMessageEvent.KIND -> Res.string.kind_live_chats LiveActivitiesEvent.KIND -> Res.string.kind_live_streams - LnZapEvent.KIND -> Res.string.kind_zaps + ZapReceiptEvent.KIND -> Res.string.kind_zaps Bolt12ZapEvent.KIND -> Res.string.kind_zaps - LnZapPaymentRequestEvent.KIND -> Res.string.kind_nwc_request - LnZapPaymentResponseEvent.KIND -> Res.string.kind_nwc_response + NwcRequestEvent.KIND -> Res.string.kind_nwc_request + NwcResponseEvent.KIND -> Res.string.kind_nwc_response LnZapPrivateEvent.KIND -> Res.string.kind_private_zaps - LnZapRequestEvent.KIND -> Res.string.kind_zap_req - LongTextNoteEvent.KIND -> Res.string.kind_blogs + ZapRequestEvent.KIND -> Res.string.kind_zap_req + LongFormContentEvent.KIND -> Res.string.kind_blogs MeetingRoomEvent.KIND -> Res.string.kind_meeting_room MeetingRoomPresenceEvent.KIND -> Res.string.kind_room_presence MeetingSpaceEvent.KIND -> Res.string.kind_meeting_space @@ -445,14 +445,14 @@ fun kindDisplayName(kind: Int): StringResource? = NNSEvent.KIND -> Res.string.kind_nns NipTextEvent.KIND -> Res.string.kind_nip NostrConnectEvent.KIND -> Res.string.kind_nostr_connect - NIP90StatusEvent.KIND -> Res.string.kind_dvm_status - NIP90ContentDiscoveryRequestEvent.KIND -> Res.string.kind_dvm_content_req - NIP90ContentDiscoveryResponseEvent.KIND -> Res.string.kind_dvm_content_resp - NIP90UserDiscoveryRequestEvent.KIND -> Res.string.kind_dvm_user_req - NIP90UserDiscoveryResponseEvent.KIND -> Res.string.kind_dvm_user_resp + DvmStatusEvent.KIND -> Res.string.kind_dvm_status + DvmContentDiscoveryRequestEvent.KIND -> Res.string.kind_dvm_content_req + DvmContentDiscoveryResponseEvent.KIND -> Res.string.kind_dvm_content_resp + DvmUserDiscoveryRequestEvent.KIND -> Res.string.kind_dvm_user_req + DvmUserDiscoveryResponseEvent.KIND -> Res.string.kind_dvm_user_resp OtsEvent.KIND -> Res.string.kind_ots PaymentTargetsEvent.KIND -> Res.string.kind_pay_to - PeopleListEvent.KIND -> Res.string.kind_people_lists + FollowSetEvent.KIND -> Res.string.kind_people_lists ProfileBadgesEvent.KIND -> Res.string.kind_profile_badges PictureEvent.KIND -> Res.string.kind_pictures WorkoutRecordEvent.KIND -> Res.string.kind_workouts @@ -460,12 +460,12 @@ fun kindDisplayName(kind: Int): StringResource? = ZapPollEvent.KIND -> Res.string.kind_zap_poll PollEvent.KIND -> Res.string.kind_poll PollResponseEvent.KIND -> Res.string.kind_poll_response - PrivateDmEvent.KIND -> Res.string.kind_nip04_dms + EncryptedDmEvent.KIND -> Res.string.kind_nip04_dms PrivateOutboxRelayListEvent.KIND -> Res.string.kind_private_relays ProxyRelayListEvent.KIND -> Res.string.kind_proxy_relays PublicMessageEvent.KIND -> Res.string.kind_public_message ReactionEvent.KIND -> Res.string.kind_reactions - ContactCardEvent.KIND -> Res.string.kind_contact_card + UserAssertionEvent.KIND -> Res.string.kind_contact_card RelayAuthEvent.KIND -> Res.string.kind_relay_auth RelayDiscoveryEvent.KIND -> Res.string.kind_relay_discovery RelayMonitorEvent.KIND -> Res.string.kind_relay_monitor @@ -473,9 +473,9 @@ fun kindDisplayName(kind: Int): StringResource? = ReportEvent.KIND -> Res.string.kind_reports RepostEvent.KIND -> Res.string.kind_reposts RequestToVanishEvent.KIND -> Res.string.kind_user_delete - SealedRumorEvent.KIND -> Res.string.kind_seals + SealEvent.KIND -> Res.string.kind_seals SearchRelayListEvent.KIND -> Res.string.kind_search_relays - StatusEvent.KIND -> Res.string.kind_user_status + UserStatusEvent.KIND -> Res.string.kind_user_status TextNoteEvent.KIND -> Res.string.kind_notes TextNoteModificationEvent.KIND -> Res.string.kind_edits TorrentEvent.KIND -> Res.string.kind_torrents @@ -485,15 +485,15 @@ fun kindDisplayName(kind: Int): StringResource? = VideoCurationSetEvent.KIND -> Res.string.kind_video_list VideoCollaborationEvent.KIND -> Res.string.kind_video_collaboration TextTrackEvent.KIND -> Res.string.kind_video_subtitles - VideoHorizontalEvent.KIND -> Res.string.kind_video_repl - VideoVerticalEvent.KIND -> Res.string.kind_shorts_repl + AddressableNormalVideoEvent.KIND -> Res.string.kind_video_repl + AddressableShortVideoEvent.KIND -> Res.string.kind_shorts_repl VideoNormalEvent.KIND -> Res.string.kind_video VideoShortEvent.KIND -> Res.string.kind_shorts VoiceEvent.KIND -> Res.string.kind_voice_msg VoiceReplyEvent.KIND -> Res.string.kind_voice_reply WakeUpEvent.KIND -> Res.string.kind_wake WebBookmarkEvent.KIND -> Res.string.kind_web_bookmark - WikiNoteEvent.KIND -> Res.string.kind_wiki + WikiArticleEvent.KIND -> Res.string.kind_wiki else -> null } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/RelayInformationScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/RelayInformationScreen.kt index a49752d925..4cfcdbed55 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/RelayInformationScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/RelayInformationScreen.kt @@ -198,7 +198,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip01Core.relay.normalizer.displayUrl -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip11RelayInfo.Nip11RelayInformation import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent @@ -478,7 +478,7 @@ val posts = setOf(0, 1, 6, 7, 16, 30023) val settings = setOf(3, 10002, 10000, 10001, 10003, 10004, 30000) val dms = setOf(4, GiftWrapEvent.KIND, EphemeralGiftWrapEvent.KIND, 10050) val zaps = setOf(9734, 9735, 9041, 17375, 23194, 23195) -val reports = setOf(ReportEvent.KIND, MuteListEvent.KIND, DeletionEvent.KIND, RequestToVanishEvent.KIND) +val reports = setOf(ReportEvent.KIND, MuteListEvent.KIND, DeletionRequestEvent.KIND, RequestToVanishEvent.KIND) @Composable fun KindChip(kind: Int) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/dm/DMRelayListViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/dm/DMRelayListViewModel.kt index 0d2c1399bf..d0f5ac593c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/dm/DMRelayListViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/relays/dm/DMRelayListViewModel.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.amethyst.commons.resources.dms import com.vitorpamplona.amethyst.ui.screen.loggedIn.relays.common.BasicRelaySetupInfoModel import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.EphemeralGiftWrapEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent @@ -45,7 +45,7 @@ class DMRelayListViewModel : BasicRelaySetupInfoModel() { label = Res.string.dms, filter = Filter( - kinds = listOf(GiftWrapEvent.KIND, EphemeralGiftWrapEvent.KIND, PrivateDmEvent.KIND), + kinds = listOf(GiftWrapEvent.KIND, EphemeralGiftWrapEvent.KIND, EncryptedDmEvent.KIND), tags = mapOf("p" to listOf(account.pubKey)), ), ), diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/shorts/ShortsTopBar.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/shorts/ShortsTopBar.kt index 86cb3bf712..0d129f2eec 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/shorts/ShortsTopBar.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/shorts/ShortsTopBar.kt @@ -36,7 +36,7 @@ import com.vitorpamplona.amethyst.ui.navigation.topbars.UserDrawerSearchTopBar import com.vitorpamplona.amethyst.ui.screen.FeedDefinition import com.vitorpamplona.amethyst.ui.screen.TopNavFilterState import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent @Composable fun ShortsTopBar( @@ -49,7 +49,7 @@ fun ShortsTopBar( // The feed's own kind window, plus whatever the list spinner narrowed it to — a hashtag // or a geohash says itself as a token; a follow set does not, and seeds nothing. val me = accountViewModel.userProfile().pubkeyHex - val seed = remember(list, me) { SearchSeed.merge(SearchSeed.ofKinds(VideoVerticalEvent.KIND), list.asSearchQuery(me)) } + val seed = remember(list, me) { SearchSeed.merge(SearchSeed.ofKinds(AddressableShortVideoEvent.KIND), list.asSearchQuery(me)) } UserDrawerSearchTopBar(accountViewModel, nav, seed) { ShortsTopNavFilterBar( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/shorts/dal/ShortsFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/shorts/dal/ShortsFeedFilter.kt index 4e5390209a..dfbaf15534 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/shorts/dal/ShortsFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/shorts/dal/ShortsFeedFilter.kt @@ -33,9 +33,9 @@ import com.vitorpamplona.amethyst.ui.dal.FilterByListParams import com.vitorpamplona.amethyst.ui.dal.sortedByDefaultFeedOrder import com.vitorpamplona.amethyst.ui.screen.loggedIn.video.dal.SupportedContent import com.vitorpamplona.quartz.nip01Core.core.AddressableEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoMeta import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent class ShortsFeedFilter( val account: Account, @@ -60,7 +60,7 @@ class ShortsFeedFilter( LocalCache.notes.filterIntoSet { _, it -> acceptableEvent(it, params) } + - LocalCache.addressables.filterIntoSet(VideoVerticalEvent.KIND) { _, it -> + LocalCache.addressables.filterIntoSet(AddressableShortVideoEvent.KIND) { _, it -> acceptableEvent(it, params) } return sort(notes) @@ -91,7 +91,7 @@ class ShortsFeedFilter( fun acceptableVideoiMetas(iMetas: List): Boolean = iMetas.any { videoFeedSupport.acceptableUrl(it.url, it.mimeType) } - fun acceptanceEvent(noteEvent: VideoVerticalEvent) = acceptableVideoiMetas(noteEvent.imetaTags()) + fun acceptanceEvent(noteEvent: AddressableShortVideoEvent) = acceptableVideoiMetas(noteEvent.imetaTags()) fun acceptanceEvent(noteEvent: VideoShortEvent) = acceptableVideoiMetas(noteEvent.imetaTags()) @@ -106,7 +106,7 @@ class ShortsFeedFilter( } return ( - (noteEvent is VideoVerticalEvent && acceptanceEvent(noteEvent)) || + (noteEvent is AddressableShortVideoEvent && acceptanceEvent(noteEvent)) || (noteEvent is VideoShortEvent && acceptanceEvent(noteEvent)) ) && params.match(noteEvent, note.relays) && diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt index fbd05a0120..74d6155773 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt @@ -315,14 +315,14 @@ import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip01Core.tags.geohash.geoHashOrScope import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip13Pow.strongPoWOrNull import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMetadataEvent @@ -343,13 +343,13 @@ import com.vitorpamplona.quartz.nip43RelayMembers.list.RelayMembershipListEvent import com.vitorpamplona.quartz.nip43RelayMembers.removeMember.RelayRemoveMemberEvent import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent import com.vitorpamplona.quartz.nip51Lists.PinListEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BlockedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BroadcastRelayListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.ProxyRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relaySets.RelaySetEvent import com.vitorpamplona.quartz.nip51Lists.releaseArtifactSet.ReleaseArtifactSetEvent @@ -358,8 +358,8 @@ import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingRoomEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingSpaceEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip57Zaps.splits.hasZapSplitSetup import com.vitorpamplona.quartz.nip58Badges.definition.BadgeDefinitionEvent import com.vitorpamplona.quartz.nip5aStaticWebsites.NamedSiteEvent @@ -372,7 +372,7 @@ import com.vitorpamplona.quartz.nip71Video.VideoEvent import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent import com.vitorpamplona.quartz.nip72ModCommunities.communityAddress import com.vitorpamplona.quartz.nip72ModCommunities.isACommunityPost -import com.vitorpamplona.quartz.nip75ZapGoals.GoalEvent +import com.vitorpamplona.quartz.nip75ZapGoals.ZapGoalEvent import com.vitorpamplona.quartz.nip78AppData.AppSpecificDataEvent import com.vitorpamplona.quartz.nip7DThreads.ThreadEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent @@ -382,7 +382,7 @@ import com.vitorpamplona.quartz.nip87Ecash.recommendation.MintRecommendationEven import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip89AppHandlers.definition.AppDefinitionEvent import com.vitorpamplona.quartz.nip89AppHandlers.recommendation.AppRecommendationEvent -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent import com.vitorpamplona.quartz.nipA0VoiceMessages.BaseVoiceEvent import com.vitorpamplona.quartz.nipA4PublicMessages.PublicMessageEvent @@ -737,7 +737,7 @@ private fun FullBleedNoteCompose( // Zap receipts are signed by the recipient's lightning provider; show the // sender from the embedded zap request instead of the service key. val zapSender = - if (noteEvent is LnZapEvent) { + if (noteEvent is ZapReceiptEvent) { observeZapSender(baseNote, accountViewModel).value } else { null @@ -859,9 +859,9 @@ private fun FullBleedNoteCompose( when (noteEvent) { is BadgeDefinitionEvent -> BadgeDisplay(baseNote = baseNote, accountViewModel) - is LongTextNoteEvent -> RenderLongFormHeaderForThread(noteEvent, baseNote, accountViewModel) + is LongFormContentEvent -> RenderLongFormHeaderForThread(noteEvent, baseNote, accountViewModel) is ThreadEvent -> RenderThreadHeaderForThread(noteEvent) - is WikiNoteEvent -> RenderWikiHeaderForThread(noteEvent, accountViewModel, nav) + is WikiArticleEvent -> RenderWikiHeaderForThread(noteEvent, accountViewModel, nav) is ClassifiedsEvent -> RenderClassifiedsReaderForThread(noteEvent, baseNote, accountViewModel, nav) is CodeSnippetEvent -> RenderCodeSnippetHeaderForThread(noteEvent) } @@ -896,13 +896,13 @@ private fun FullBleedNoteCompose( WorkoutDisplay(baseNote, backgroundColor, canPreview = true, quotesLeft = 3, accountViewModel = accountViewModel, nav = nav) } else if (noteEvent is BaseVoiceEvent) { VoiceHeader(noteEvent, baseNote, accountViewModel, nav) - } else if (noteEvent is FileHeaderEvent) { + } else if (noteEvent is FileMetadataEvent) { FileHeaderDisplay(baseNote, roundedCorner = true, ContentScale.FillWidth, accountViewModel = accountViewModel) } else if (noteEvent is FileStorageHeaderEvent) { FileStorageHeaderDisplay(baseNote, roundedCorner = true, ContentScale.FillWidth, accountViewModel = accountViewModel) - } else if (noteEvent is PeopleListEvent) { + } else if (noteEvent is FollowSetEvent) { DisplayPeopleList(baseNote, backgroundColor, accountViewModel, nav) - } else if (noteEvent is FollowListEvent) { + } else if (noteEvent is StarterPackEvent) { DisplayFollowList(baseNote, false, accountViewModel, nav) } else if (noteEvent is ContactListEvent) { DisplayContactList(baseNote, accountViewModel, nav) @@ -954,7 +954,7 @@ private fun FullBleedNoteCompose( accountViewModel, nav, ) - } else if (noteEvent is ChatMessageRelayListEvent) { + } else if (noteEvent is DmRelayListEvent) { DisplayDMRelayList(baseNote, backgroundColor, accountViewModel, nav) } else if (noteEvent is ChatMessageEncryptedFileHeaderEvent) { RenderChatMessageEncryptedFile( @@ -977,7 +977,7 @@ private fun FullBleedNoteCompose( RenderAttestorProficiency(baseNote, 3, backgroundColor, accountViewModel, nav) } else if (noteEvent is AdvertisedRelayListEvent) { DisplayNIP65RelayList(baseNote, backgroundColor, accountViewModel, nav) - } else if (noteEvent is LnZapEvent) { + } else if (noteEvent is ZapReceiptEvent) { RenderLnZap(baseNote, quotesLeft = 3, backgroundColor = backgroundColor, accountViewModel = accountViewModel, nav = nav) } else if (noteEvent is NutzapEvent) { RenderNutzap(baseNote, quotesLeft = 3, backgroundColor = backgroundColor, accountViewModel = accountViewModel, nav = nav) @@ -995,7 +995,7 @@ private fun FullBleedNoteCompose( DisplayProxyRelayList(baseNote, backgroundColor, accountViewModel, nav) } else if (noteEvent is TrustedRelayListEvent) { DisplayTrustedRelayList(baseNote, backgroundColor, accountViewModel, nav) - } else if (noteEvent is RelayFeedsListEvent) { + } else if (noteEvent is FavoriteRelayListEvent) { DisplayRelayFeedsList(baseNote, backgroundColor, accountViewModel, nav) } else if (noteEvent is IndexerRelayListEvent) { DisplayIndexerRelayList(baseNote, backgroundColor, accountViewModel, nav) @@ -1070,7 +1070,7 @@ private fun FullBleedNoteCompose( RenderCalendarTimeSlotEvent(baseNote, accountViewModel, nav) } else if (noteEvent is CalendarDateSlotEvent) { RenderCalendarDateSlotEvent(baseNote, accountViewModel, nav) - } else if (noteEvent is GoalEvent) { + } else if (noteEvent is ZapGoalEvent) { RenderGoal(baseNote, accountViewModel, nav) } else if (noteEvent is FundraiserEvent) { RenderFundraiser(baseNote, makeItShort = false, accountViewModel, nav) @@ -1158,7 +1158,7 @@ private fun FullBleedNoteCompose( accountViewModel = accountViewModel, nav = nav, ) - } else if (noteEvent is PrivateDmEvent) { + } else if (noteEvent is EncryptedDmEvent) { RenderPrivateMessage( baseNote, false, @@ -1492,7 +1492,7 @@ private fun RenderClassifiedsReaderForThread( @Composable private fun RenderLongFormHeaderForThread( - noteEvent: LongTextNoteEvent, + noteEvent: LongFormContentEvent, note: Note, accountViewModel: AccountViewModel, ) { @@ -1558,7 +1558,7 @@ private fun RenderThreadHeaderForThread(noteEvent: ThreadEvent) { @Preview @Composable private fun RenderWikiHeaderForThreadPreview() { - val event = Event.fromJson("{\"id\":\"277f982a4cd3f67cc47ad9282176acabee1713848f547d6021e0c155572078e1\",\"pubkey\":\"460c25e682fda7832b52d1f22d3d22b3176d972f60dcdc3212ed8c92ef85065c\",\"created_at\":1708695717,\"kind\":30818,\"tags\":[[\"d\",\"amethyst\"],[\"a\",\"30818:f03e7c5262648e0b7823dfb49f8f17309cfec9cb14711413dcabdf3d7fc6369a:amethyst\",\"wss://relay.nostr.band\",\"fork\"],[\"e\",\"ceabc60c8022c472c727aa25ae7691885964366386ce265c47e5a78be6cb00be\",\"wss://relay.nostr.band\",\"fork\"],[\"title\",\"Amethyst\"],[\"published_at\",\"1708707133\"]],\"content\":\"An Android-only app written in Kotlin with support for over 90 event kinds. \\n\\n![](https://play-lh.googleusercontent.com/lvZlAm9dBrpHeOo7sIPKCsiKOLYLhR2b0FiOT4tyiwWO2dvsR2gDS0xk9tOOr9U-6uM=w240-h480-rw)\\n\",\"sig\":\"6748126a909a20dbdb67947a09d64e41d7140a79335a4ad675c6173d7dd5dbcab9c360dec617bd67bbbc20dfad416b15056eda2e20716cd6c425a84301a125a0\"}") as WikiNoteEvent + val event = Event.fromJson("{\"id\":\"277f982a4cd3f67cc47ad9282176acabee1713848f547d6021e0c155572078e1\",\"pubkey\":\"460c25e682fda7832b52d1f22d3d22b3176d972f60dcdc3212ed8c92ef85065c\",\"created_at\":1708695717,\"kind\":30818,\"tags\":[[\"d\",\"amethyst\"],[\"a\",\"30818:f03e7c5262648e0b7823dfb49f8f17309cfec9cb14711413dcabdf3d7fc6369a:amethyst\",\"wss://relay.nostr.band\",\"fork\"],[\"e\",\"ceabc60c8022c472c727aa25ae7691885964366386ce265c47e5a78be6cb00be\",\"wss://relay.nostr.band\",\"fork\"],[\"title\",\"Amethyst\"],[\"published_at\",\"1708707133\"]],\"content\":\"An Android-only app written in Kotlin with support for over 90 event kinds. \\n\\n![](https://play-lh.googleusercontent.com/lvZlAm9dBrpHeOo7sIPKCsiKOLYLhR2b0FiOT4tyiwWO2dvsR2gDS0xk9tOOr9U-6uM=w240-h480-rw)\\n\",\"sig\":\"6748126a909a20dbdb67947a09d64e41d7140a79335a4ad675c6173d7dd5dbcab9c360dec617bd67bbbc20dfad416b15056eda2e20716cd6c425a84301a125a0\"}") as WikiArticleEvent val accountViewModel = mockAccountViewModel() val editState = @@ -1602,7 +1602,7 @@ private fun RenderWikiHeaderForThreadPreview() { @Composable private fun RenderWikiHeaderForThread( - noteEvent: WikiNoteEvent, + noteEvent: WikiArticleEvent, accountViewModel: AccountViewModel, nav: INav, ) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/FileHeaderCardCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/FileHeaderCardCompose.kt index 45f3eae01e..523cb12efd 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/FileHeaderCardCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/FileHeaderCardCompose.kt @@ -52,7 +52,7 @@ import com.vitorpamplona.amethyst.ui.note.types.toMediaContent import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip36SensitiveContent.isSensitiveOrNSFW -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent @Composable fun FileHeaderCardCompose( @@ -60,7 +60,7 @@ fun FileHeaderCardCompose( accountViewModel: AccountViewModel, nav: INav, ) { - val event = (baseNote.event as? FileHeaderEvent) ?: return + val event = (baseNote.event as? FileMetadataEvent) ?: return val backgroundColor = remember { mutableStateOf(Color.Transparent) } Column( @@ -90,7 +90,7 @@ fun FileHeaderCardCompose( @Composable private fun FileHeaderCardImage( note: Note, - event: FileHeaderEvent, + event: FileMetadataEvent, backgroundColor: MutableState, accountViewModel: AccountViewModel, ) { @@ -145,7 +145,7 @@ private fun FileHeaderCardImage( } @Composable -internal fun FileHeaderCardCaption(videoEvent: FileHeaderEvent) { +internal fun FileHeaderCardCaption(videoEvent: FileMetadataEvent) { val event = (videoEvent as? Event) ?: return val title = videoEvent.summary() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/StoriesTopBar.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/StoriesTopBar.kt index 74e418893f..831ee5d806 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/StoriesTopBar.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/StoriesTopBar.kt @@ -36,8 +36,8 @@ import com.vitorpamplona.amethyst.ui.navigation.topbars.UserDrawerSearchTopBar import com.vitorpamplona.amethyst.ui.screen.FeedDefinition import com.vitorpamplona.amethyst.ui.screen.TopNavFilterState import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent @Composable fun StoriesTopBar( @@ -50,7 +50,7 @@ fun StoriesTopBar( // The feed's own kind window, plus whatever the list spinner narrowed it to — a hashtag // or a geohash says itself as a token; a follow set does not, and seeds nothing. val me = accountViewModel.userProfile().pubkeyHex - val seed = remember(list, me) { SearchSeed.merge(SearchSeed.ofKinds(VideoHorizontalEvent.KIND, VideoVerticalEvent.KIND), list.asSearchQuery(me)) } + val seed = remember(list, me) { SearchSeed.merge(SearchSeed.ofKinds(AddressableNormalVideoEvent.KIND, AddressableShortVideoEvent.KIND), list.asSearchQuery(me)) } UserDrawerSearchTopBar(accountViewModel, nav, seed) { TopNavFilterBar( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/VideoScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/VideoScreen.kt index a4f8fccfcd..d9b3fe531b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/VideoScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/VideoScreen.kt @@ -53,7 +53,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.shorts.VideoCardCompose import com.vitorpamplona.amethyst.ui.screen.loggedIn.video.datasource.VideoFilterAssemblerSubscription import com.vitorpamplona.quartz.nip68Picture.PictureEvent import com.vitorpamplona.quartz.nip71Video.VideoEvent -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent @Composable fun VideoScreen( @@ -199,7 +199,7 @@ fun VideoFeedLoaded( Spacer(modifier = Modifier.height(8.dp)) } - item.event is FileHeaderEvent -> { + item.event is FileMetadataEvent -> { FileHeaderCardCompose(item, accountViewModel, nav) HorizontalDivider( diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/dal/VideoFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/dal/VideoFeedFilter.kt index b9b67e2ffc..7fad0d489e 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/dal/VideoFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/dal/VideoFeedFilter.kt @@ -34,12 +34,12 @@ import com.vitorpamplona.amethyst.ui.dal.sortedByDefaultFeedOrder import com.vitorpamplona.quartz.nip01Core.core.AddressableEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent import com.vitorpamplona.quartz.nip68Picture.PictureMeta -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoMeta import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent class VideoFeedFilter( val account: Account, @@ -72,10 +72,10 @@ class VideoFeedFilter( LocalCache.notes.filterIntoSet { _, it -> acceptableEvent(it, params) } + - LocalCache.addressables.filterIntoSet(VideoHorizontalEvent.KIND) { _, it -> + LocalCache.addressables.filterIntoSet(AddressableNormalVideoEvent.KIND) { _, it -> acceptableEvent(it, params) } + - LocalCache.addressables.filterIntoSet(VideoVerticalEvent.KIND) { _, it -> + LocalCache.addressables.filterIntoSet(AddressableShortVideoEvent.KIND) { _, it -> acceptableEvent(it, params) } @@ -101,11 +101,11 @@ class VideoFeedFilter( fun acceptanceEvent(noteEvent: PictureEvent) = acceptablePictureiMetas(noteEvent.imetaTags()) - fun acceptanceEvent(noteEvent: FileHeaderEvent) = acceptableUrls(noteEvent.urls(), noteEvent.mimeType()) + fun acceptanceEvent(noteEvent: FileMetadataEvent) = acceptableUrls(noteEvent.urls(), noteEvent.mimeType()) - fun acceptanceEvent(noteEvent: VideoVerticalEvent) = acceptableVideoiMetas(noteEvent.imetaTags()) + fun acceptanceEvent(noteEvent: AddressableShortVideoEvent) = acceptableVideoiMetas(noteEvent.imetaTags()) - fun acceptanceEvent(noteEvent: VideoHorizontalEvent) = acceptableVideoiMetas(noteEvent.imetaTags()) + fun acceptanceEvent(noteEvent: AddressableNormalVideoEvent) = acceptableVideoiMetas(noteEvent.imetaTags()) fun acceptanceEvent(noteEvent: VideoNormalEvent) = acceptableVideoiMetas(noteEvent.imetaTags()) @@ -122,9 +122,9 @@ class VideoFeedFilter( } return ( - (noteEvent is FileHeaderEvent && acceptanceEvent(noteEvent)) || - (noteEvent is VideoVerticalEvent && acceptanceEvent(noteEvent)) || - (noteEvent is VideoHorizontalEvent && acceptanceEvent(noteEvent)) || + (noteEvent is FileMetadataEvent && acceptanceEvent(noteEvent)) || + (noteEvent is AddressableShortVideoEvent && acceptanceEvent(noteEvent)) || + (noteEvent is AddressableNormalVideoEvent && acceptanceEvent(noteEvent)) || (noteEvent is VideoNormalEvent && acceptanceEvent(noteEvent)) || (noteEvent is VideoShortEvent && acceptanceEvent(noteEvent)) || (noteEvent is PictureEvent && acceptanceEvent(noteEvent)) diff --git a/amethyst/src/play/java/com/vitorpamplona/amethyst/appfunctions/AmethystAppFunctions.kt b/amethyst/src/play/java/com/vitorpamplona/amethyst/appfunctions/AmethystAppFunctions.kt index a0dd8d1bf9..f14ec732b7 100644 --- a/amethyst/src/play/java/com/vitorpamplona/amethyst/appfunctions/AmethystAppFunctions.kt +++ b/amethyst/src/play/java/com/vitorpamplona/amethyst/appfunctions/AmethystAppFunctions.kt @@ -54,14 +54,14 @@ import com.vitorpamplona.quartz.nip17Dm.base.BaseDMGroupEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent import com.vitorpamplona.quartz.nip19Bech32.decodePublicKey import com.vitorpamplona.quartz.nip19Bech32.entities.NPub -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip47WalletConnect.rpc.NwcErrorResponse import com.vitorpamplona.quartz.nip47WalletConnect.rpc.PayInvoiceErrorResponse import com.vitorpamplona.quartz.nip47WalletConnect.rpc.PayInvoiceSuccessResponse import com.vitorpamplona.quartz.nip47WalletConnect.rpc.Response import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent import com.vitorpamplona.quartz.nip55AndroidSigner.client.NostrSignerExternal -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nipB1Bolt12Zaps.zap.Bolt12ZapEvent import com.vitorpamplona.quartz.utils.TimeUtils @@ -778,7 +778,7 @@ class AmethystAppFunctions { val filter = Filter( - kinds = listOf(LnZapEvent.KIND, Bolt12ZapEvent.KIND), + kinds = listOf(ZapReceiptEvent.KIND, Bolt12ZapEvent.KIND), tags = mapOf("p" to listOf(myPub)), since = sinceSecs, limit = 500, @@ -789,7 +789,7 @@ class AmethystAppFunctions { idleTimeoutMs = GEMINI_FETCH_TIMEOUT_MS, ) - val receipts = events.mapNotNull { it as? LnZapEvent } + val receipts = events.mapNotNull { it as? ZapReceiptEvent } val zapperIds = mutableSetOf() var totalSats = 0L var unparseable = 0 @@ -936,7 +936,7 @@ class AmethystAppFunctions { val filter = SearchActions.searchNotesFilter( query = query, - kinds = listOf(LongTextNoteEvent.KIND), + kinds = listOf(LongFormContentEvent.KIND), limit = cappedLimit, ) ?: return SearchNotesResult.empty() @@ -953,7 +953,7 @@ class AmethystAppFunctions { val hits = events - .mapNotNull { it as? LongTextNoteEvent } + .mapNotNull { it as? LongFormContentEvent } .take(cappedLimit) .map { (it as com.vitorpamplona.quartz.nip01Core.core.Event).toFeedNoteHit() } @@ -1403,7 +1403,7 @@ class AmethystAppFunctions { amountMillisats = ZapActions.satsToMillisats(sats), inboxRelays = account.nip65RelayList.inboxFlow.value, comment = comment, - zapType = LnZapEvent.ZapType.PUBLIC, + zapType = ZapReceiptEvent.ZapType.PUBLIC, ) val invoice = fetchInvoiceOrThrow(lnAddress, sats, comment, zapRequest) @@ -1614,7 +1614,7 @@ class AmethystAppFunctions { lookupLnAddress = lookupLnAddress, lookupInboxRelays = lookupInboxRelays, comment = trimmedComment, - zapType = LnZapEvent.ZapType.PUBLIC, + zapType = ZapReceiptEvent.ZapType.PUBLIC, ) if (requests.isEmpty()) { throw AppFunctionInvalidArgumentException( @@ -1787,7 +1787,7 @@ class AmethystAppFunctions { lnAddress: String, sats: Long, comment: String, - zapRequest: com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent, + zapRequest: com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent, ): String { // Compute the LNURL-pay endpoint so we can ask the privacy-aware // HttpClient builder for the right OkHttpClient for that host. diff --git a/amethyst/src/test/java/com/vitorpamplona/amethyst/calendar/CalendarsViewModelFlowTest.kt b/amethyst/src/test/java/com/vitorpamplona/amethyst/calendar/CalendarsViewModelFlowTest.kt index e504817753..aaf1c26d9b 100644 --- a/amethyst/src/test/java/com/vitorpamplona/amethyst/calendar/CalendarsViewModelFlowTest.kt +++ b/amethyst/src/test/java/com/vitorpamplona/amethyst/calendar/CalendarsViewModelFlowTest.kt @@ -30,7 +30,7 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.calendars.CalendarsViewMode import com.vitorpamplona.amethyst.ui.screen.loggedIn.calendars.dal.CalendarAppointmentsFeedFilter import com.vitorpamplona.quartz.nip01Core.core.Address import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -90,7 +90,7 @@ class CalendarsViewModelFlowTest { dTag: String?, title: String, members: List
= emptyList(), - ) = CalendarEvent( + ) = CalendarCollectionEvent( id = id, pubKey = pubKey, createdAt = 1_700_000_000L, @@ -121,7 +121,7 @@ class CalendarsViewModelFlowTest { * for the length of the test: `LocalCache.addressables` is a weak cache, and with nothing * holding a reference a calendar can be collected out from under the assertions. */ - private fun consume(vararg calendars: CalendarEvent): List { + private fun consume(vararg calendars: CalendarCollectionEvent): List { calendars.forEach { LocalCache.justConsumeMyOwnEvent(it) } return calendars.map { LocalCache.getAddressableNoteIfExists(it.address()) } } diff --git a/amethyst/src/test/java/com/vitorpamplona/amethyst/model/AddressedAuthorRoutingTest.kt b/amethyst/src/test/java/com/vitorpamplona/amethyst/model/AddressedAuthorRoutingTest.kt index 815b6e933b..3033cec228 100644 --- a/amethyst/src/test/java/com/vitorpamplona/amethyst/model/AddressedAuthorRoutingTest.kt +++ b/amethyst/src/test/java/com/vitorpamplona/amethyst/model/AddressedAuthorRoutingTest.kt @@ -20,7 +20,7 @@ */ package com.vitorpamplona.amethyst.model -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import com.vitorpamplona.quartz.nip52Calendar.rsvp.CalendarRSVPEvent import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue @@ -49,7 +49,7 @@ class AddressedAuthorRoutingTest { ) private fun calendar(vararg tags: Array) = - CalendarEvent( + CalendarCollectionEvent( id = "22".repeat(32), pubKey = host, createdAt = 1700000000, diff --git a/amethyst/src/test/java/com/vitorpamplona/amethyst/model/BuzzWorkspaceChannelTest.kt b/amethyst/src/test/java/com/vitorpamplona/amethyst/model/BuzzWorkspaceChannelTest.kt index 30766d0f2c..97512fd09b 100644 --- a/amethyst/src/test/java/com/vitorpamplona/amethyst/model/BuzzWorkspaceChannelTest.kt +++ b/amethyst/src/test/java/com/vitorpamplona/amethyst/model/BuzzWorkspaceChannelTest.kt @@ -31,7 +31,7 @@ import com.vitorpamplona.quartz.buzz.stream.StreamMessageV2Event import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip29RelayGroups.GroupId import io.mockk.every import io.mockk.mockk @@ -225,7 +225,7 @@ class BuzzWorkspaceChannelTest { // The author deletes their own edit (NIP-09). It must stop overlaying the message and // be unlinked from Note.edits, not linger as a stale overlay. - val deletion = signer.sign(DeletionEvent.build(listOf(edit))) + val deletion = signer.sign(DeletionRequestEvent.build(listOf(edit))) LocalCache.checkDeletionAndConsume(deletion, buzzRelay, false) assertNull("a deleted edit must no longer overlay its message", target.latestBuzzEdit()) diff --git a/amethyst/src/test/java/com/vitorpamplona/amethyst/model/HomeFeedTypeTest.kt b/amethyst/src/test/java/com/vitorpamplona/amethyst/model/HomeFeedTypeTest.kt index e9580d0ac5..7b96f5a90d 100644 --- a/amethyst/src/test/java/com/vitorpamplona/amethyst/model/HomeFeedTypeTest.kt +++ b/amethyst/src/test/java/com/vitorpamplona/amethyst/model/HomeFeedTypeTest.kt @@ -24,10 +24,10 @@ import com.vitorpamplona.amethyst.commons.model.HomeFeedType import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip35Torrents.TorrentEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse import org.junit.Assert.assertNull @@ -76,8 +76,8 @@ class HomeFeedTypeTest { fun picturesVideosShortsAndTorrentsOwnTheirKinds() { assertEquals(listOf(PictureEvent.KIND), HomeFeedType.PICTURES.kinds) // Long-form videos are the horizontal/normal kinds; vertical/short kinds belong to Shorts. - assertEquals(listOf(VideoNormalEvent.KIND, VideoHorizontalEvent.KIND), HomeFeedType.VIDEOS.kinds) - assertEquals(listOf(VideoShortEvent.KIND, VideoVerticalEvent.KIND), HomeFeedType.SHORTS.kinds) + assertEquals(listOf(VideoNormalEvent.KIND, AddressableNormalVideoEvent.KIND), HomeFeedType.VIDEOS.kinds) + assertEquals(listOf(VideoShortEvent.KIND, AddressableShortVideoEvent.KIND), HomeFeedType.SHORTS.kinds) assertEquals(listOf(TorrentEvent.KIND), HomeFeedType.TORRENTS.kinds) } diff --git a/amethyst/src/test/java/com/vitorpamplona/amethyst/model/topNavFeeds/favoriteAlgoFeeds/FavoriteAlgoFeedTopNavFilterTest.kt b/amethyst/src/test/java/com/vitorpamplona/amethyst/model/topNavFeeds/favoriteAlgoFeeds/FavoriteAlgoFeedTopNavFilterTest.kt index a8872f4ad3..3d06dfb3d5 100644 --- a/amethyst/src/test/java/com/vitorpamplona/amethyst/model/topNavFeeds/favoriteAlgoFeeds/FavoriteAlgoFeedTopNavFilterTest.kt +++ b/amethyst/src/test/java/com/vitorpamplona/amethyst/model/topNavFeeds/favoriteAlgoFeeds/FavoriteAlgoFeedTopNavFilterTest.kt @@ -23,7 +23,7 @@ package com.vitorpamplona.amethyst.model.topNavFeeds.favoriteAlgoFeeds import com.vitorpamplona.amethyst.commons.model.topNavFeeds.favoriteAlgoFeeds.FavoriteAlgoFeedTopNavFilter import com.vitorpamplona.quartz.nip01Core.core.Address import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue import org.junit.Test @@ -34,7 +34,7 @@ class FavoriteAlgoFeedTopNavFilterTest { private fun longFormNote( pubkey: String, dTag: String, - ) = LongTextNoteEvent( + ) = LongFormContentEvent( id = "0".repeat(64), pubKey = pubkey, createdAt = 1, diff --git a/amethyst/src/test/java/com/vitorpamplona/amethyst/service/okhttp/DelayingTestSigner.kt b/amethyst/src/test/java/com/vitorpamplona/amethyst/service/okhttp/DelayingTestSigner.kt index ff18cabafc..9cb566f031 100644 --- a/amethyst/src/test/java/com/vitorpamplona/amethyst/service/okhttp/DelayingTestSigner.kt +++ b/amethyst/src/test/java/com/vitorpamplona/amethyst/service/okhttp/DelayingTestSigner.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import kotlinx.coroutines.delay /** @@ -74,7 +74,7 @@ class DelayingTestSigner( fromPublicKey: HexKey, ) = unsupported() - override suspend fun decryptZapEvent(event: LnZapRequestEvent) = unsupported() + override suspend fun decryptZapEvent(event: ZapRequestEvent) = unsupported() override suspend fun deriveKey(nonce: HexKey) = unsupported() diff --git a/amethyst/src/test/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/nip01Notifications/FilterGroupNotificationsToPubkeyTest.kt b/amethyst/src/test/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/nip01Notifications/FilterGroupNotificationsToPubkeyTest.kt index 475a99e29b..d87a15fded 100644 --- a/amethyst/src/test/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/nip01Notifications/FilterGroupNotificationsToPubkeyTest.kt +++ b/amethyst/src/test/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/account/nip01Notifications/FilterGroupNotificationsToPubkeyTest.kt @@ -58,7 +58,7 @@ class FilterGroupNotificationsToPubkeyTest { assertTrue(GroupNotificationKinds.contains(9)) // ChatEvent assertTrue(GroupNotificationKinds.contains(1111)) // CommentEvent assertTrue(GroupNotificationKinds.contains(7)) // ReactionEvent - assertTrue(GroupNotificationKinds.contains(9735)) // LnZapEvent + assertTrue(GroupNotificationKinds.contains(9735)) // ZapReceiptEvent } @Test diff --git a/amethyst/src/test/java/com/vitorpamplona/amethyst/service/resourceusage/ResourceUsageLedgerTest.kt b/amethyst/src/test/java/com/vitorpamplona/amethyst/service/resourceusage/ResourceUsageLedgerTest.kt index 9eca6b4480..63bbe4a78b 100644 --- a/amethyst/src/test/java/com/vitorpamplona/amethyst/service/resourceusage/ResourceUsageLedgerTest.kt +++ b/amethyst/src/test/java/com/vitorpamplona/amethyst/service/resourceusage/ResourceUsageLedgerTest.kt @@ -44,7 +44,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import io.mockk.every import io.mockk.mockk import kotlinx.coroutines.CoroutineScope @@ -650,7 +650,7 @@ class MeteringNostrSignerTest { fromPublicKey: HexKey, ) = "dec44" - override suspend fun decryptZapEvent(event: LnZapRequestEvent): LnZapPrivateEvent = throw UnsupportedOperationException("fake") + override suspend fun decryptZapEvent(event: ZapRequestEvent): LnZapPrivateEvent = throw UnsupportedOperationException("fake") override suspend fun deriveKey(nonce: HexKey): HexKey = "bb".repeat(32) diff --git a/amethyst/src/test/java/com/vitorpamplona/amethyst/service/uploads/hls/HlsVideoEventBuilderTest.kt b/amethyst/src/test/java/com/vitorpamplona/amethyst/service/uploads/hls/HlsVideoEventBuilderTest.kt index 1d7223b49c..114660dbb0 100644 --- a/amethyst/src/test/java/com/vitorpamplona/amethyst/service/uploads/hls/HlsVideoEventBuilderTest.kt +++ b/amethyst/src/test/java/com/vitorpamplona/amethyst/service/uploads/hls/HlsVideoEventBuilderTest.kt @@ -25,8 +25,8 @@ import com.davotoula.lightcompressor.hls.HlsRenditionSummary import com.davotoula.lightcompressor.hls.HlsUploaded import com.davotoula.lightcompressor.hls.Rendition import com.vitorpamplona.amethyst.service.uploads.MediaUploadResult -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import org.junit.Assert.assertEquals import org.junit.Assert.assertNotNull import org.junit.Assert.assertNull @@ -122,7 +122,7 @@ class HlsVideoEventBuilderTest { assertTrue("expected Horizontal template", result.template is HlsVideoEventTemplate.Horizontal) val template = (result.template as HlsVideoEventTemplate.Horizontal).template - assertEquals(VideoHorizontalEvent.KIND, template.kind) + assertEquals(AddressableNormalVideoEvent.KIND, template.kind) assertEquals("A cool video", template.content) } @@ -132,7 +132,7 @@ class HlsVideoEventBuilderTest { assertTrue("expected Vertical template", result.template is HlsVideoEventTemplate.Vertical) val template = (result.template as HlsVideoEventTemplate.Vertical).template - assertEquals(VideoVerticalEvent.KIND, template.kind) + assertEquals(AddressableShortVideoEvent.KIND, template.kind) } @Test diff --git a/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/RouteForPointerTest.kt b/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/RouteForPointerTest.kt index 92337c0f2e..19964c6862 100644 --- a/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/RouteForPointerTest.kt +++ b/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/RouteForPointerTest.kt @@ -31,12 +31,12 @@ import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.utils.EventFactory import io.mockk.mockk import org.junit.Assert.assertEquals @@ -73,7 +73,7 @@ class RouteForPointerTest { // the wrap has to be opened before it can say anything assertNull(routeForPointer(GiftWrapEvent.KIND, id)) // addressables are cited by `a` tag, not by id - assertNull(routeForPointer(LongTextNoteEvent.KIND, id)) + assertNull(routeForPointer(LongFormContentEvent.KIND, id)) // a kind:0 IS the person — Route.Profile, not a note assertNull(routeForPointer(MetadataEvent.KIND, id)) } @@ -111,7 +111,7 @@ class RouteForPointerTest { */ @Test fun addressableVideoKindsDoNotTakeTheShortcut() { - assertNull(routeForPointer(VideoHorizontalEvent.KIND, id)) - assertNull(routeForPointer(VideoVerticalEvent.KIND, id)) + assertNull(routeForPointer(AddressableNormalVideoEvent.KIND, id)) + assertNull(routeForPointer(AddressableShortVideoEvent.KIND, id)) } } diff --git a/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/note/share/QrPayloadTest.kt b/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/note/share/QrPayloadTest.kt index 72a8c43723..e00804aded 100644 --- a/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/note/share/QrPayloadTest.kt +++ b/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/note/share/QrPayloadTest.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import kotlinx.coroutines.test.runTest import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue @@ -79,9 +79,9 @@ class QrPayloadTest { runTest { // build(description, title, summary, image, publishedAt, dTag, createdAt, init) // — `title` is a required positional; `dTag` must be named. - // LongTextNoteEvent.kt:148-157. + // LongFormContentEvent.kt:148-157. val event = - LongTextNoteEvent + LongFormContentEvent .build("body", "My Article", dTag = "my-article") {} .let { aliceSigner.sign(it) } val note = AddressableNote(event.address()) diff --git a/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/note/share/SharedNoteCardTest.kt b/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/note/share/SharedNoteCardTest.kt index 0e70df1ace..7d76a5852f 100644 --- a/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/note/share/SharedNoteCardTest.kt +++ b/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/note/share/SharedNoteCardTest.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip92IMeta.IMetaTagBuilder import com.vitorpamplona.quartz.nip92IMeta.imetas import kotlinx.coroutines.test.runTest @@ -129,7 +129,7 @@ class SharedNoteCardTest { fun article_prefersItsTitle() = runTest { val note = - LongTextNoteEvent + LongFormContentEvent .build("the body", "My Article", dTag = "a1") {} .let { aliceSigner.sign(it) } diff --git a/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/dal/NotificationTagsAnEventByUserTest.kt b/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/dal/NotificationTagsAnEventByUserTest.kt index 786c4eda28..f57bf851e3 100644 --- a/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/dal/NotificationTagsAnEventByUserTest.kt +++ b/amethyst/src/test/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/notifications/dal/NotificationTagsAnEventByUserTest.kt @@ -22,7 +22,7 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications.dal import com.vitorpamplona.amethyst.commons.model.Note import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue import org.junit.Test @@ -81,10 +81,10 @@ class NotificationTagsAnEventByUserTest { 1000, arrayOf( arrayOf("E", zapId, "", wallet), - arrayOf("K", LnZapEvent.KIND.toString()), + arrayOf("K", ZapReceiptEvent.KIND.toString()), arrayOf("P", wallet), arrayOf("e", zapId, "", wallet), - arrayOf("k", LnZapEvent.KIND.toString()), + arrayOf("k", ZapReceiptEvent.KIND.toString()), arrayOf("p", wallet), arrayOf("p", me), ), @@ -109,10 +109,10 @@ class NotificationTagsAnEventByUserTest { 1000, arrayOf( arrayOf("E", zapId, "", wallet), - arrayOf("K", LnZapEvent.KIND.toString()), + arrayOf("K", ZapReceiptEvent.KIND.toString()), arrayOf("P", wallet), arrayOf("e", zapId, "", wallet), - arrayOf("k", LnZapEvent.KIND.toString()), + arrayOf("k", ZapReceiptEvent.KIND.toString()), arrayOf("p", wallet), ), "nice zap", diff --git a/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/GiftWrapBenchmark.kt b/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/GiftWrapBenchmark.kt index 34431d9e3c..60e6b13cd7 100644 --- a/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/GiftWrapBenchmark.kt +++ b/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/GiftWrapBenchmark.kt @@ -30,7 +30,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip01Core.tags.people.PTag import com.vitorpamplona.quartz.nip17Dm.NIP17Factory import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import kotlinx.coroutines.runBlocking import org.junit.Assert @@ -78,7 +78,7 @@ class GiftWrapBenchmark { val event = it.unwrapThrowing(keyToUse) event.checkSignature() - if (event is SealedRumorEvent) { + if (event is SealEvent) { val innerData = event.unsealThrowing(keyToUse) Assert.assertEquals(message, innerData.content) } else { @@ -116,7 +116,7 @@ class GiftWrapBenchmark { val seal = wrap.unwrapThrowing(keyToUse) seal.checkSignature() - if (seal is SealedRumorEvent) { + if (seal is SealEvent) { val innerData = seal.unsealThrowing(keyToUse) Assert.assertEquals(message, innerData.content) } else { diff --git a/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/GiftWrapReceivingBenchmark.kt b/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/GiftWrapReceivingBenchmark.kt index 62c3e676af..2501bb7845 100644 --- a/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/GiftWrapReceivingBenchmark.kt +++ b/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/GiftWrapReceivingBenchmark.kt @@ -37,7 +37,7 @@ import com.vitorpamplona.quartz.nip36SensitiveContent.contentWarning import com.vitorpamplona.quartz.nip44Encryption.Nip44 import com.vitorpamplona.quartz.nip57Zaps.zapraiser.zapraiser import com.vitorpamplona.quartz.nip59Giftwrap.rumors.Rumor -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import junit.framework.TestCase.assertNotNull import kotlinx.coroutines.runBlocking @@ -62,7 +62,7 @@ class GiftWrapReceivingBenchmark { runBlocking { GiftWrapEvent.create( event = - SealedRumorEvent.create( + SealEvent.create( event = sender.sign( ChatMessageEvent.build( @@ -84,7 +84,7 @@ class GiftWrapReceivingBenchmark { fun createSeal( sender: NostrSigner, receiver: NostrSigner, - ): SealedRumorEvent = + ): SealEvent = runBlocking { val msg = sender.sign( @@ -101,7 +101,7 @@ class GiftWrapReceivingBenchmark { }, ) - SealedRumorEvent.create( + SealEvent.create( event = msg, encryptTo = receiver.pubKey, signer = sender, diff --git a/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/GiftWrapSigningBenchmark.kt b/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/GiftWrapSigningBenchmark.kt index 1395ab7202..796f2c309e 100644 --- a/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/GiftWrapSigningBenchmark.kt +++ b/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/GiftWrapSigningBenchmark.kt @@ -30,7 +30,7 @@ import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent import com.vitorpamplona.quartz.nip17Dm.messages.changeSubject import com.vitorpamplona.quartz.nip36SensitiveContent.contentWarning import com.vitorpamplona.quartz.nip57Zaps.zapraiser.zapraiser -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import kotlinx.coroutines.runBlocking import org.junit.Rule @@ -95,7 +95,7 @@ class GiftWrapSigningBenchmark { benchmarkRule.measureRepeated { runBlocking { - SealedRumorEvent.create( + SealEvent.create( event = msg, encryptTo = receiver.pubKey, signer = sender, @@ -128,7 +128,7 @@ class GiftWrapSigningBenchmark { val seal = runBlocking { - SealedRumorEvent.create( + SealEvent.create( event = msg, encryptTo = receiver.pubKey, signer = sender, @@ -169,7 +169,7 @@ class GiftWrapSigningBenchmark { val seal = runBlocking { - SealedRumorEvent.create( + SealEvent.create( event = msg, encryptTo = receiver.pubKey, signer = sender, diff --git a/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/LargeDBInsertBenchmark.kt b/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/LargeDBInsertBenchmark.kt index 228f247b89..5882a26a03 100644 --- a/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/LargeDBInsertBenchmark.kt +++ b/benchmark/src/androidTest/java/com/vitorpamplona/quartz/benchmark/LargeDBInsertBenchmark.kt @@ -28,7 +28,7 @@ import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import com.vitorpamplona.quartz.nip01Core.core.AddressableEvent import com.vitorpamplona.quartz.nip01Core.store.sqlite.EventStore -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip40Expiration.isExpired import com.vitorpamplona.quartz.utils.Log import com.vitorpamplona.quartz.utils.flattenToSet @@ -72,7 +72,7 @@ class LargeDBInsertBenchmark : BaseLargeCacheBenchmark() { @Test fun bench40DeletionRequestsEvents() { val context = ApplicationProvider.getApplicationContext() - val deletions = allEvents.filterIsInstance() + val deletions = allEvents.filterIsInstance() val deletionIds = deletions.map { it.deleteEventIds() }.flattenToSet() val deletionAddresses = deletions.map { it.deleteAddressIds() }.flattenToSet() diff --git a/cli/ROADMAP.md b/cli/ROADMAP.md index 09b80c2072..41f46bbc9c 100644 --- a/cli/ROADMAP.md +++ b/cli/ROADMAP.md @@ -71,7 +71,7 @@ Status legend: ✅ shipped · 📦 logic lives in `commons/`, needs a command · | NIP-5A nsites + NIP-5D napplets | ✅ | `NsiteCommands` + `NappletCommands` — fetch/publish/serve/list with sha256 + aggregate-hash verification and `requires` capability reporting. | | Podcasting 2.0 / podstr (`amy podcast20`) | ✅ | `Podcast20Commands` — kind:30078 metadata, 30054 episodes, 30055 trailers, list. | | Follows-of-follows (`amy fof get/list/sync`) | ✅ | `FofCommand` — single-hop social proof from the local store (`wot` kept as deprecation alias). | -| NIP-85 GrapeRank web-of-trust (`amy graperank`) | ✅ | `GrapeRankCommand` — outbox-model crawl + scoring engine in `commons/wot/` (`GrapeRank`, `TrustGraph`, `TrustGraphBuilder`); every score run persists kind:30382 `ContactCardEvent` cards to the local store (diffed against prior ranks, kind:5 retractions), `publish` mirrors that set to the operator relays via NIP-77 up-sync, `rank` reads cards back, plus `register` / `unregister` / `providers` for the kind:10040 `TrustProviderListEvent` discovery layer. | +| NIP-85 GrapeRank web-of-trust (`amy graperank`) | ✅ | `GrapeRankCommand` — outbox-model crawl + scoring engine in `commons/wot/` (`GrapeRank`, `TrustGraph`, `TrustGraphBuilder`); every score run persists kind:30382 `UserAssertionEvent` cards to the local store (diffed against prior ranks, kind:5 retractions), `publish` mirrors that set to the operator relays via NIP-77 up-sync, `rank` reads cards back, plus `register` / `unregister` / `providers` for the kind:10040 `TrustProviderListEvent` discovery layer. | | NIP-72 communities | 🆕 | | | NIP-78 app-specific data (settings sync) | 🆕 | | | Long-form (NIP-23) publish / read | 🆕 | | diff --git a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/Context.kt b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/Context.kt index af23b2f575..1db3013b82 100644 --- a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/Context.kt +++ b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/Context.kt @@ -66,7 +66,7 @@ import com.vitorpamplona.quartz.nip01Core.store.verifyAndInsert import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent import com.vitorpamplona.quartz.nip05DnsIdentifiers.resolveUserHexOrNull import com.vitorpamplona.quartz.nip11RelayInfo.Nip11RelayInformation -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip46RemoteSigner.signer.NostrSignerRemote import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent import com.vitorpamplona.quartz.nip66RelayMonitor.reachability.RelayObserver @@ -760,11 +760,11 @@ class Context( * for [pubKey], or `null` if Amy has never observed one. Used by * `dm send` to resolve where to deliver a wrap. */ - suspend fun dmInboxOf(pubKey: HexKey): ChatMessageRelayListEvent? = + suspend fun dmInboxOf(pubKey: HexKey): DmRelayListEvent? = store .query( - Filter(authors = listOf(pubKey), kinds = listOf(ChatMessageRelayListEvent.KIND), limit = 1), - ).firstOrNull() as? ChatMessageRelayListEvent + Filter(authors = listOf(pubKey), kinds = listOf(DmRelayListEvent.KIND), limit = 1), + ).firstOrNull() as? DmRelayListEvent /** * Latest known kind:10051 KeyPackage relay list (MIP-00) for diff --git a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/GiftCommands.kt b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/GiftCommands.kt index 4df0d26172..73db57cb9d 100644 --- a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/GiftCommands.kt +++ b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/GiftCommands.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.cli.Context import com.vitorpamplona.amethyst.cli.DataDir import com.vitorpamplona.amethyst.cli.Output import com.vitorpamplona.quartz.nip01Core.core.Event -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent /** @@ -41,7 +41,7 @@ import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent * Inner/wrap JSON comes from the positional argument or stdin (`-`). * * Thin assembly only: seal/wrap/unwrap all live in quartz - * (`SealedRumorEvent`, `GiftWrapEvent`). + * (`SealEvent`, `GiftWrapEvent`). */ object GiftCommands { val USAGE: String = @@ -87,7 +87,7 @@ object GiftCommands { Context.open(dataDir).use { ctx -> ctx.prepare() val peer = ctx.requireUserHex(to) - val seal = SealedRumorEvent.create(event = inner, encryptTo = peer, signer = ctx.signer) + val seal = SealEvent.create(event = inner, encryptTo = peer, signer = ctx.signer) val giftWrap = GiftWrapEvent.create(event = seal, recipientPubKey = peer) val wrapNode = Output.mapper.readTree(giftWrap.toJson()) @@ -134,7 +134,7 @@ object GiftCommands { return Output.error("decrypt_failed", "could not unwrap (is this gift addressed to the active account?): ${e.message}") } // The wrap holds a seal (kind:13); unseal it to recover the rumor. - val inner = if (unwrapped is SealedRumorEvent) unwrapped.unsealThrowing(ctx.signer) else unwrapped + val inner = if (unwrapped is SealEvent) unwrapped.unsealThrowing(ctx.signer) else unwrapped Output.emit(mapOf("event" to Output.mapper.readTree(inner.toJson()))) return 0 } diff --git a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/GrapeRankCommand.kt b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/GrapeRankCommand.kt index 0d4ae9c3b8..3beb8aacc0 100644 --- a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/GrapeRankCommand.kt +++ b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/GrapeRankCommand.kt @@ -51,7 +51,7 @@ import com.vitorpamplona.amethyst.cli.commands.graperank.GrapeRankScore * Answers "do I need to crawl again?" with no network and no signing. * - `amy graperank score [OBSERVER]` — local only: build the graph from the store, * score (same as bare `--offline`), and ALWAYS reconcile the result into the - * store as kind:30382 ContactCardEvent cards signed by the observer's + * store as kind:30382 UserAssertionEvent cards signed by the observer's * per-observer service key (`rank = round(score*100)`, cutoff `--min-rank`): * changed ranks are re-signed, unchanged ones skipped, dropped targets * retracted with a kind:5. That persisted card set is what `publish` and diff --git a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/RelayCommands.kt b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/RelayCommands.kt index 09f31e2e29..3d5a3746ec 100644 --- a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/RelayCommands.kt +++ b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/RelayCommands.kt @@ -32,14 +32,14 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip01Core.relay.normalizer.normalizeRelayUrlOrNull import com.vitorpamplona.quartz.nip01Core.relay.normalizer.toHttp import com.vitorpamplona.quartz.nip11RelayInfo.Nip11RelayInformation -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip37Drafts.privateOutbox.PrivateOutboxRelayListEvent import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BlockedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BroadcastRelayListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.ProxyRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayFacet import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent @@ -144,14 +144,14 @@ object RelayCommands { Flat( "dm", "dm", - ChatMessageRelayListEvent.KIND, + DmRelayListEvent.KIND, setOf("chat", "inbox-dm"), // allRelays(), not relays(): every Flat here is read for SELF, // and the filtered accessor drops local entries meant for // attacker-supplied lists — making a deliberately configured // local relay report as no configuration at all. read = { c, pk -> c.dmInboxOf(pk)?.allRelays().orEmpty() }, - build = { c, r -> ChatMessageRelayListEvent.create(r, c.signer) }, + build = { c, r -> DmRelayListEvent.create(r, c.signer) }, ), Flat( "key-package", @@ -220,10 +220,10 @@ object RelayCommands { Flat( "feeds", "feeds", - RelayFeedsListEvent.KIND, + FavoriteRelayListEvent.KIND, setOf("favorites", "relay_feeds"), - read = { c, pk -> (c.latestReplaceable(pk, RelayFeedsListEvent.KIND) as? RelayFeedsListEvent)?.decryptRelays(c.signer).orEmpty() }, - build = { c, r -> RelayFeedsListEvent.create(r, c.signer) }, + read = { c, pk -> (c.latestReplaceable(pk, FavoriteRelayListEvent.KIND) as? FavoriteRelayListEvent)?.decryptRelays(c.signer).orEmpty() }, + build = { c, r -> FavoriteRelayListEvent.create(r, c.signer) }, ), ) diff --git a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/RelayGroupCommands.kt b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/RelayGroupCommands.kt index 2f7e08bfdf..0bf79a57d1 100644 --- a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/RelayGroupCommands.kt +++ b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/RelayGroupCommands.kt @@ -33,9 +33,9 @@ import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate import com.vitorpamplona.quartz.nip29RelayGroups.hTag import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMetadataEvent import com.vitorpamplona.quartz.nip29RelayGroups.moderation.CreateGroupEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.EditMetadataEvent -import com.vitorpamplona.quartz.nip29RelayGroups.request.JoinRequestEvent -import com.vitorpamplona.quartz.nip29RelayGroups.request.LeaveRequestEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupEditMetadataEvent +import com.vitorpamplona.quartz.nip29RelayGroups.request.GroupJoinRequestEvent +import com.vitorpamplona.quartz.nip29RelayGroups.request.GroupLeaveRequestEvent import com.vitorpamplona.quartz.nip51Lists.simpleGroupList.GroupTag import com.vitorpamplona.quartz.nip51Lists.simpleGroupList.SimpleGroupListEvent import com.vitorpamplona.quartz.nipC7Chats.ChatEvent @@ -116,7 +116,7 @@ object RelayGroupCommands { val createAck = ctx.publish(ctx.signer.sign(CreateGroupEvent.build(groupId)), target) val status = groupStatus(isPrivate, isClosed) - val edit = EditMetadataEvent.build(groupId, name = name, about = about, status = status) + val edit = GroupEditMetadataEvent.build(groupId, name = name, about = about, status = status) val editAck = ctx.publish(ctx.signer.sign(edit), target) // Track it in our own kind:10009 so `relaygroup list` shows it, matching // the Android create flow (Account.createRelayGroup → follow). @@ -154,7 +154,7 @@ object RelayGroupCommands { Context.open(dataDir).use { ctx -> ctx.prepare() - val join = JoinRequestEvent.build(groupId, reason = args.flag("reason") ?: "", inviteCode = args.flag("code")) + val join = GroupJoinRequestEvent.build(groupId, reason = args.flag("reason") ?: "", inviteCode = args.flag("code")) args.rejectUnknown() val signed = ctx.signer.sign(join) val ack = ctx.publish(signed, setOf(relay)) @@ -184,7 +184,7 @@ object RelayGroupCommands { Context.open(dataDir).use { ctx -> ctx.prepare() - val signed = ctx.signer.sign(LeaveRequestEvent.build(groupId)) + val signed = ctx.signer.sign(GroupLeaveRequestEvent.build(groupId)) val ack = ctx.publish(signed, setOf(relay)) RawEventSupport.publishGuard(ack, signed.id)?.let { return it } val listed = updateGroupList(ctx, relay, groupId, add = false) diff --git a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/RelayGroupModerationCommands.kt b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/RelayGroupModerationCommands.kt index 12bde96071..937b14ed19 100644 --- a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/RelayGroupModerationCommands.kt +++ b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/RelayGroupModerationCommands.kt @@ -26,10 +26,10 @@ import com.vitorpamplona.amethyst.cli.DataDir import com.vitorpamplona.amethyst.cli.Output import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMetadataEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.CreateInviteEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.EditMetadataEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.PutUserEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.RemoveUserEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupCreateInviteEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupEditMetadataEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupPutUserEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupRemoveUserEvent /** * Moderator/admin write verbs for a relay group (the relay is the final authority @@ -94,7 +94,7 @@ object RelayGroupModerationCommands { // A kind-9002 re-asserts the whole metadata, so omitted fields must be carried over // from the current 39000 — otherwise editing only a flag would wipe name/about/tags. val template = - EditMetadataEvent.build( + GroupEditMetadataEvent.build( groupId, name = args.flag("name") ?: meta?.name(), about = args.flag("about") ?: meta?.about(), @@ -127,7 +127,7 @@ object RelayGroupModerationCommands { ): Int { val code = Args(rest).flag("code") ?: return Output.error("bad_args", "relaygroup invite RELAY GROUP_ID --code CODE") return publishScoped(dataDir, rest, "relaygroup invite RELAY GROUP_ID --code CODE", allowedFlags = arrayOf("code")) { _, groupId, _ -> - CreateInviteEvent.build(groupId, code) + GroupCreateInviteEvent.build(groupId, code) } } @@ -153,7 +153,7 @@ object RelayGroupModerationCommands { Context.open(dataDir).use { ctx -> ctx.prepare() val pubkey = ctx.requireUserHex(user) - val signed = ctx.signer.sign(PutUserEvent.build(groupId, listOf(pubkey to roles))) + val signed = ctx.signer.sign(GroupPutUserEvent.build(groupId, listOf(pubkey to roles))) val ack = ctx.publish(signed, setOf(relay)) RawEventSupport.publishGuard(ack, signed.id)?.let { return it } Output.emit( @@ -186,7 +186,7 @@ object RelayGroupModerationCommands { Context.open(dataDir).use { ctx -> ctx.prepare() val pubkey = ctx.requireUserHex(user) - val signed = ctx.signer.sign(RemoveUserEvent.build(groupId, listOf(pubkey))) + val signed = ctx.signer.sign(GroupRemoveUserEvent.build(groupId, listOf(pubkey))) val ack = ctx.publish(signed, setOf(relay)) RawEventSupport.publishGuard(ack, signed.id)?.let { return it } Output.emit( diff --git a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/StatusReport.kt b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/StatusReport.kt index 5109d78728..91e692140d 100644 --- a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/StatusReport.kt +++ b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/StatusReport.kt @@ -34,7 +34,7 @@ import com.vitorpamplona.quartz.nip01Core.metadata.UserMetadata import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.store.IEventStore import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip19Bech32.entities.NPub import com.vitorpamplona.quartz.nip60Cashu.wallet.CashuWalletEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent @@ -317,7 +317,7 @@ internal object StatusReport { var profile: MetadataEvent? = null var contacts: ContactListEvent? = null var relayList: AdvertisedRelayListEvent? = null - var dmInbox: ChatMessageRelayListEvent? = null + var dmInbox: DmRelayListEvent? = null var wallet = false // Newest-first with limit 1 gives the last-activity stamp. @@ -330,7 +330,7 @@ internal object StatusReport { MetadataEvent.KIND, ContactListEvent.KIND, AdvertisedRelayListEvent.KIND, - ChatMessageRelayListEvent.KIND, + DmRelayListEvent.KIND, CashuWalletEvent.KIND, ) store.query(Filter(authors = authors, kinds = describes)) { event -> @@ -340,7 +340,7 @@ internal object StatusReport { is MetadataEvent -> if (isNewer(event, profile)) profile = event is ContactListEvent -> if (isNewer(event, contacts)) contacts = event is AdvertisedRelayListEvent -> if (isNewer(event, relayList)) relayList = event - is ChatMessageRelayListEvent -> if (isNewer(event, dmInbox)) dmInbox = event + is DmRelayListEvent -> if (isNewer(event, dmInbox)) dmInbox = event is CashuWalletEvent -> wallet = true else -> Unit } diff --git a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/ZapCommand.kt b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/ZapCommand.kt index 7f0300c989..df39413b02 100644 --- a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/ZapCommand.kt +++ b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/ZapCommand.kt @@ -33,8 +33,8 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import okhttp3.OkHttpClient /** @@ -222,8 +222,8 @@ object ZapCommand { sats: Long, lnAddress: String, comment: String, - request: LnZapRequestEvent, - zapType: LnZapEvent.ZapType, + request: ZapRequestEvent, + zapType: ZapReceiptEvent.ZapType, timeoutMs: Long, settleWith: NDebit?, zappedEventId: HexKey? = null, @@ -300,7 +300,7 @@ object ZapCommand { sats: Long, comment: String, zappedEventId: HexKey, - zapType: LnZapEvent.ZapType, + zapType: ZapReceiptEvent.ZapType, requests: List, timeoutMs: Long, settleWith: NDebit?, @@ -350,11 +350,11 @@ object ZapCommand { ) } - private fun parseZapType(args: Args): LnZapEvent.ZapType = + private fun parseZapType(args: Args): ZapReceiptEvent.ZapType = when { - args.bool("anon") -> LnZapEvent.ZapType.ANONYMOUS - args.bool("private") -> LnZapEvent.ZapType.PRIVATE - else -> LnZapEvent.ZapType.PUBLIC + args.bool("anon") -> ZapReceiptEvent.ZapType.ANONYMOUS + args.bool("private") -> ZapReceiptEvent.ZapType.PRIVATE + else -> ZapReceiptEvent.ZapType.PUBLIC } private suspend fun fetchLatestMetadata( diff --git a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/graperank/GrapeRankOperator.kt b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/graperank/GrapeRankOperator.kt index c380072c06..057768d857 100644 --- a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/graperank/GrapeRankOperator.kt +++ b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/graperank/GrapeRankOperator.kt @@ -34,7 +34,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent @@ -45,7 +45,7 @@ import com.vitorpamplona.quartz.nip85TrustedAssertions.list.serviceProviders import com.vitorpamplona.quartz.nip85TrustedAssertions.list.tags.ProviderTypes import com.vitorpamplona.quartz.nip85TrustedAssertions.list.tags.ServiceProviderTag import com.vitorpamplona.quartz.nip85TrustedAssertions.list.tags.ServiceType -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent import com.vitorpamplona.quartz.utils.TimeUtils /** @@ -90,8 +90,8 @@ object GrapeRankOperator { linkedMapOf( "observer" to observer, "provider_pubkey" to rec.providerPubKey, - "cards" to ctx.store.count(Filter(kinds = listOf(ContactCardEvent.KIND), authors = listOf(rec.providerPubKey))), - "retractions" to ctx.store.count(Filter(kinds = listOf(DeletionEvent.KIND), authors = listOf(rec.providerPubKey))), + "cards" to ctx.store.count(Filter(kinds = listOf(UserAssertionEvent.KIND), authors = listOf(rec.providerPubKey))), + "retractions" to ctx.store.count(Filter(kinds = listOf(DeletionRequestEvent.KIND), authors = listOf(rec.providerPubKey))), ) } diff --git a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/graperank/GrapeRankPublish.kt b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/graperank/GrapeRankPublish.kt index f57b4eb3ce..dff06fcc6f 100644 --- a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/graperank/GrapeRankPublish.kt +++ b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/graperank/GrapeRankPublish.kt @@ -36,7 +36,7 @@ import com.vitorpamplona.quartz.nip85TrustedAssertions.list.TrustProviderListEve import com.vitorpamplona.quartz.nip85TrustedAssertions.list.serviceProviders import com.vitorpamplona.quartz.nip85TrustedAssertions.list.tags.ProviderTypes import com.vitorpamplona.quartz.nip85TrustedAssertions.list.tags.ServiceProviderTag -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent /** * The transport + consumption sides of NIP-85: `graperank publish` pushes the @@ -169,12 +169,12 @@ object GrapeRankPublish { val provider = providerArg?.let { ctx.requireUserHex(it) } val cardFilter = Filter( - kinds = listOf(ContactCardEvent.KIND), + kinds = listOf(UserAssertionEvent.KIND), tags = mapOf("d" to listOf(user)), authors = provider?.let { listOf(it) }, ) - suspend fun localCards(): List = ctx.store.query(cardFilter).filterIsInstance() + suspend fun localCards(): List = ctx.store.query(cardFilter).filterIsInstance() var cards = localCards() if (refresh || cards.isEmpty()) { @@ -190,7 +190,7 @@ object GrapeRankPublish { cards .groupBy { it.pubKey } .mapNotNull { (_, list) -> list.maxByOrNull { it.createdAt } } - .sortedWith(compareByDescending { it.rank() ?: -1 }.thenByDescending { it.createdAt }) + .sortedWith(compareByDescending { it.rank() ?: -1 }.thenByDescending { it.createdAt }) // A provider key this machine's operator master derived maps back to // the observer whose subjective view the rank expresses. @@ -236,7 +236,7 @@ object GrapeRankPublish { if (!ctx.anonymous) { providerListOf(ctx, ctx.identity.pubKeyHex) ?.serviceProviders() - ?.filter { it.service.kind == ContactCardEvent.KIND && (provider == null || it.pubkey == provider) } + ?.filter { it.service.kind == UserAssertionEvent.KIND && (provider == null || it.pubkey == provider) } ?.map { it.relayUrl } .orEmpty() } else { diff --git a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/graperank/GrapeRankScore.kt b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/graperank/GrapeRankScore.kt index 34efcf4f86..e23b4a3b06 100644 --- a/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/graperank/GrapeRankScore.kt +++ b/cli/src/main/kotlin/com/vitorpamplona/amethyst/cli/commands/graperank/GrapeRankScore.kt @@ -34,8 +34,8 @@ import com.vitorpamplona.quartz.nip01Core.core.toHexKey import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent import com.vitorpamplona.quartz.nip09Deletions.DeletionIndex +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent import kotlin.math.roundToInt @@ -293,8 +293,8 @@ object GrapeRankScore { // Everything in the store already passed verifyAndStore, so mark the // deletions as verified and skip the redundant signature check. val deletions = DeletionIndex() - for (ev in ctx.store.query(Filter(kinds = listOf(DeletionEvent.KIND)))) { - if (ev is DeletionEvent) deletions.add(ev, wasVerified = true) + for (ev in ctx.store.query(Filter(kinds = listOf(DeletionRequestEvent.KIND)))) { + if (ev is DeletionRequestEvent) deletions.add(ev, wasVerified = true) } var dropped = 0 diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/account/AccountBootstrapEvents.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/account/AccountBootstrapEvents.kt index dbfb17605c..f5e80b7685 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/account/AccountBootstrapEvents.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/account/AccountBootstrapEvents.kt @@ -33,11 +33,11 @@ import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent import com.vitorpamplona.quartz.nip02FollowList.tags.ContactTag -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent -import com.vitorpamplona.quartz.nip28PublicChat.list.ChannelListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent +import com.vitorpamplona.quartz.nip28PublicChat.list.PublicChatListEvent import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent /** @@ -58,12 +58,12 @@ data class AccountBootstrapEvents( val userMetadata: MetadataEvent, val contactList: ContactListEvent, val nip65RelayList: AdvertisedRelayListEvent, - val dmRelayList: ChatMessageRelayListEvent, + val dmRelayList: DmRelayListEvent, val keyPackageRelayList: KeyPackageRelayListEvent, val searchRelayList: SearchRelayListEvent, val indexerRelayList: IndexerRelayListEvent, - val channelList: ChannelListEvent, - val relayFeedsList: RelayFeedsListEvent, + val channelList: PublicChatListEvent, + val relayFeedsList: FavoriteRelayListEvent, ) { /** All nine signed events in publication order. */ fun all(): List = @@ -102,13 +102,13 @@ fun bootstrapAccountEvents( signer = signer, ), nip65RelayList = AdvertisedRelayListEvent.create(DefaultNIP65List, signer), - dmRelayList = ChatMessageRelayListEvent.create(DefaultDMRelayList, signer), + dmRelayList = DmRelayListEvent.create(DefaultDMRelayList, signer), // MIP-00: advertise the default outbox relays as KeyPackage hosts // so other users can discover and fetch this account's KeyPackage // events without having to guess where they were published. keyPackageRelayList = KeyPackageRelayListEvent.create(DefaultNIP65RelaySet.toList(), signer), searchRelayList = SearchRelayListEvent.create(DefaultSearchRelayList.toList(), signer), indexerRelayList = IndexerRelayListEvent.create(DefaultIndexerRelayList.toList(), signer), - channelList = ChannelListEvent.create(emptyList(), DefaultChannels, signer), - relayFeedsList = RelayFeedsListEvent.create(DefaultGlobalRelays, signer), + channelList = PublicChatListEvent.create(emptyList(), DefaultChannels, signer), + relayFeedsList = FavoriteRelayListEvent.create(DefaultGlobalRelays, signer), ) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/actions/ZapActions.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/actions/ZapActions.kt index 5c6bd6ecc9..d9a75e71d8 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/actions/ZapActions.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/actions/ZapActions.kt @@ -25,13 +25,13 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent /** * NIP-57 zap-request building + LN address extraction. * - * Returns a signed [LnZapRequestEvent] (kind:9734) — the artifact a caller + * Returns a signed [ZapRequestEvent] (kind:9734) — the artifact a caller * hands to a LNURL-pay callback to receive a BOLT11 invoice. * * **Caller responsibilities** that the Amethyst Android flow handles but @@ -86,10 +86,10 @@ object ZapActions { amountMillisats: Long, inboxRelays: Set, comment: String = "", - zapType: LnZapEvent.ZapType = LnZapEvent.ZapType.PUBLIC, + zapType: ZapReceiptEvent.ZapType = ZapReceiptEvent.ZapType.PUBLIC, lnurl: String? = null, - ): LnZapRequestEvent = - LnZapRequestEvent.create( + ): ZapRequestEvent = + ZapRequestEvent.create( userHex = recipientPubkey, relays = inboxRelays, signer = signer, @@ -118,12 +118,12 @@ object ZapActions { amountMillisats: Long, inboxRelays: Set, comment: String = "", - zapType: LnZapEvent.ZapType = LnZapEvent.ZapType.PUBLIC, + zapType: ZapReceiptEvent.ZapType = ZapReceiptEvent.ZapType.PUBLIC, toUserPubkey: HexKey? = null, pollOption: Int? = null, lnurl: String? = null, - ): LnZapRequestEvent = - LnZapRequestEvent.create( + ): ZapRequestEvent = + ZapRequestEvent.create( zappedEvent = zappedEvent, relays = inboxRelays, signer = signer, @@ -142,7 +142,7 @@ object ZapActions { data class ZapRequestForSplit( val recipient: ZapSplitResolver.Recipient, val amountMillisats: Long, - val request: LnZapRequestEvent, + val request: ZapRequestEvent, ) /** @@ -172,7 +172,7 @@ object ZapActions { lookupLnAddress: suspend (HexKey) -> String?, lookupInboxRelays: suspend (HexKey) -> Set = { emptySet() }, comment: String = "", - zapType: LnZapEvent.ZapType = LnZapEvent.ZapType.PUBLIC, + zapType: ZapReceiptEvent.ZapType = ZapReceiptEvent.ZapType.PUBLIC, pollOption: Int? = null, ): List { val recipients = ZapSplitResolver.resolve(zappedEvent, lookupLnAddress) @@ -189,7 +189,7 @@ object ZapActions { val recipientInbox = recipient.pubkey?.let { lookupInboxRelays(it) }.orEmpty() val allRelays = senderInboxRelays + recipientInbox + authorInbox val request = - LnZapRequestEvent.create( + ZapRequestEvent.create( zappedEvent = zappedEvent, relays = allRelays, signer = signer, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/connectedApps/signers/NostrSignerPermissionLedger.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/connectedApps/signers/NostrSignerPermissionLedger.kt index 0991204ea0..1cfcd2f99e 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/connectedApps/signers/NostrSignerPermissionLedger.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/connectedApps/signers/NostrSignerPermissionLedger.kt @@ -28,27 +28,27 @@ import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip25Reactions.ExternalReactionEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent import com.vitorpamplona.quartz.nip35Torrents.TorrentCommentEvent import com.vitorpamplona.quartz.nip35Torrents.TorrentEvent -import com.vitorpamplona.quartz.nip38UserStatus.StatusEvent +import com.vitorpamplona.quartz.nip38UserStatus.UserStatusEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip7DThreads.ThreadEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip88Polls.response.PollResponseEvent -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent import com.vitorpamplona.quartz.nipA0VoiceMessages.VoiceEvent import com.vitorpamplona.quartz.nipA0VoiceMessages.VoiceReplyEvent import com.vitorpamplona.quartz.nipA4PublicMessages.PublicMessageEvent @@ -232,7 +232,7 @@ class NostrSignerPermissionLedger( PublicMessageEvent.KIND, // 24 — NIP-A4 public messages (plaintext, public) ChannelMessageEvent.KIND, // 42 — public chat messages PollResponseEvent.KIND, // 1018 — voting in a poll (additive, like a reaction) - FileHeaderEvent.KIND, // 1063 — NIP-94 file metadata (shares a file reference) + FileMetadataEvent.KIND, // 1063 — NIP-94 file metadata (shares a file reference) PollEvent.KIND, // 1068 — creating a poll (additive public content) CommentEvent.KIND, // 1111 — NIP-22 threaded comments (same risk as kind 1) VoiceEvent.KIND, // 1222 — voice messages (audio post, like a picture/video) @@ -243,12 +243,12 @@ class NostrSignerPermissionLedger( TorrentEvent.KIND, // 2003 — NIP-35 torrent announcements (additive public content) TorrentCommentEvent.KIND, // 2004 — NIP-35 torrent comments HighlightEvent.KIND, // 9802 — highlighted snippets shared publicly - LnZapRequestEvent.KIND, // 9734 — Lightning zap request; the payment itself still prompts - LongTextNoteEvent.KIND, // 30023 — NIP-23 long-form articles (addressable content) - StatusEvent.KIND, // 30315 — ephemeral user status / presence - WikiNoteEvent.KIND, // 30818 — NIP-54 wiki articles (addressable content) - VideoHorizontalEvent.KIND, // 34235 — addressable horizontal video (NIP-71) - VideoVerticalEvent.KIND, // 34236 — addressable vertical video (NIP-71) + ZapRequestEvent.KIND, // 9734 — Lightning zap request; the payment itself still prompts + LongFormContentEvent.KIND, // 30023 — NIP-23 long-form articles (addressable content) + UserStatusEvent.KIND, // 30315 — ephemeral user status / presence + WikiArticleEvent.KIND, // 30818 — NIP-54 wiki articles (addressable content) + AddressableNormalVideoEvent.KIND, // 34235 — addressable horizontal video (NIP-71) + AddressableShortVideoEvent.KIND, // 34236 — addressable vertical video (NIP-71) PublicationIndexEvent.KIND, // 30040 — NKBIP-01 publication index (addressable content) LearningResourceEvent.KIND, // 30142 — learning resources (addressable content) BlossomPieceIndexEvent.KIND, // 32176 — Blossom piece indexes (addressable content) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/feeds/FeedContentState.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/feeds/FeedContentState.kt index 02767f31d0..550621707b 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/feeds/FeedContentState.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/feeds/FeedContentState.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.amethyst.commons.model.cache.ICacheProvider import com.vitorpamplona.amethyst.commons.service.BasicBundledInsert import com.vitorpamplona.amethyst.commons.service.BasicBundledUpdate import com.vitorpamplona.amethyst.commons.util.equalImmutableLists -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.utils.flattenToSet import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.toImmutableList @@ -149,7 +149,7 @@ class FeedContentState( val oldNotesState = _feedContent.value if (localFilter is AdditiveFeedFilter && lastFeedKey == localFilter.feedKey()) { if (oldNotesState is FeedState.Loaded) { - val deletionEvents: List = newItems.mapNotNull { it.event as? DeletionEvent } + val deletionEvents: List = newItems.mapNotNull { it.event as? DeletionRequestEvent } val oldList = if (deletionEvents.isEmpty()) { diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/marmot/MarmotManager.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/marmot/MarmotManager.kt index 29a82221cb..b100491b67 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/marmot/MarmotManager.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/marmot/MarmotManager.kt @@ -84,7 +84,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.tags.people.PTag import com.vitorpamplona.quartz.nip01Core.tags.people.pTags -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip18Reposts.quotes.QEventTag import com.vitorpamplona.quartz.nip18Reposts.quotes.quote import com.vitorpamplona.quartz.nip59Giftwrap.rumors.RumorAssembler @@ -740,8 +740,8 @@ class MarmotManager( persistOwn: Boolean = true, ): TextMessageBundle { require(targetEvents.isNotEmpty()) { "buildDeletionMessage: targetEvents must not be empty" } - val template = DeletionEvent.build(targetEvents) - val innerEvent = RumorAssembler.assembleRumor(signer.pubKey, template) + val template = DeletionRequestEvent.build(targetEvents) + val innerEvent = RumorAssembler.assembleRumor(signer.pubKey, template) val outbound = buildGroupMessage(nostrGroupId, innerEvent) if (persistOwn) persistDecryptedMessage(nostrGroupId, innerEvent.toJson()) return TextMessageBundle(outbound = outbound, innerEvent = innerEvent) @@ -1502,7 +1502,7 @@ class MarmotManager( val authorOf = HashMap(messages.size) val claims = ArrayList>() for (event in messages) { - if (event.kind == DeletionEvent.KIND) { + if (event.kind == DeletionRequestEvent.KIND) { for (tag in event.tags) { if (tag.size >= 2 && tag[0] == "e") claims.add(tag[1] to event.pubKey) } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/DvmHeartbeat.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/DvmHeartbeat.kt index 449decb3cd..dcbcefa483 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/DvmHeartbeat.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/DvmHeartbeat.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.commons.model.cache.filterIntoSet import com.vitorpamplona.amethyst.commons.model.nip90DVMs.DvmHeartbeatRegistry import com.vitorpamplona.quartz.nip01Core.core.Address import com.vitorpamplona.quartz.nip89AppHandlers.definition.AppDefinitionEvent -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.NIP90ContentDiscoveryRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.DvmContentDiscoveryRequestEvent import com.vitorpamplona.quartz.nip90Dvms.dvmHeartbeat.DvmHeartbeatEvent import com.vitorpamplona.quartz.utils.TimeUtils @@ -56,7 +56,7 @@ fun LocalCache.cachedDvmAnnouncements(limit: Int = 100): List (note.event as? AppDefinitionEvent)?.let { - it.appMetaData()?.subscription != true && it.includeKind(NIP90ContentDiscoveryRequestEvent.KIND) + it.appMetaData()?.subscription != true && it.includeKind(DvmContentDiscoveryRequestEvent.KIND) } == true }.mapNotNull { it.event as? AppDefinitionEvent } .sortedByDescending { it.createdAt } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/HomeFeedType.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/HomeFeedType.kt index eb2ebb6c06..204864b038 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/HomeFeedType.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/HomeFeedType.kt @@ -40,19 +40,19 @@ import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip35Torrents.TorrentEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip64Chess.challenge.offer.LiveChessGameChallengeEvent import com.vitorpamplona.quartz.nip64Chess.end.LiveChessGameEndEvent import com.vitorpamplona.quartz.nip64Chess.game.ChessGameEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip88Polls.response.PollResponseEvent @@ -80,10 +80,10 @@ enum class HomeFeedType( REPOSTS("reposts", listOf(RepostEvent.KIND, GenericRepostEvent.KIND)), COMMENTS("comments", listOf(CommentEvent.KIND)), PICTURES("pictures", listOf(PictureEvent.KIND)), - VIDEOS("videos", listOf(VideoNormalEvent.KIND, VideoHorizontalEvent.KIND)), - SHORTS("shorts", listOf(VideoShortEvent.KIND, VideoVerticalEvent.KIND)), - ARTICLES("articles", listOf(LongTextNoteEvent.KIND)), - WIKI("wiki", listOf(WikiNoteEvent.KIND)), + VIDEOS("videos", listOf(VideoNormalEvent.KIND, AddressableNormalVideoEvent.KIND)), + SHORTS("shorts", listOf(VideoShortEvent.KIND, AddressableShortVideoEvent.KIND)), + ARTICLES("articles", listOf(LongFormContentEvent.KIND)), + WIKI("wiki", listOf(WikiArticleEvent.KIND)), HIGHLIGHTS("highlights", listOf(HighlightEvent.KIND)), POLLS("polls", listOf(PollEvent.KIND, ZapPollEvent.KIND, PollResponseEvent.KIND)), CLASSIFIEDS("classifieds", listOf(ClassifiedsEvent.KIND)), diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/IAccount.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/IAccount.kt index 6b1e4d1640..54d776c06e 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/IAccount.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/IAccount.kt @@ -24,11 +24,11 @@ import com.vitorpamplona.amethyst.commons.model.marmotGroups.MarmotGroupList import com.vitorpamplona.amethyst.commons.model.privateChats.ChatroomList import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip47WalletConnect.rpc.Request import com.vitorpamplona.quartz.nip47WalletConnect.rpc.Response import com.vitorpamplona.quartz.nip57Zaps.IPrivateZapsDecryptionCache @@ -40,9 +40,9 @@ import com.vitorpamplona.quartz.utils.DualCase * Used by Note.kt for checking NWC payment status. */ interface INwcSignerState { - suspend fun decryptResponse(event: LnZapPaymentResponseEvent): Response? + suspend fun decryptResponse(event: NwcResponseEvent): Response? - suspend fun decryptRequest(event: LnZapPaymentRequestEvent): Request? + suspend fun decryptRequest(event: NwcRequestEvent): Request? fun isNIP47Author(pubKey: String?): Boolean } @@ -127,7 +127,7 @@ interface IAccount { fun isAcceptable(note: Note): Boolean /** Send a NIP-04 encrypted direct message */ - suspend fun sendNip04PrivateMessage(eventTemplate: EventTemplate) + suspend fun sendNip04PrivateMessage(eventTemplate: EventTemplate) /** Send a NIP-17 gift-wrapped direct message */ suspend fun sendNip17PrivateMessage(template: EventTemplate) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/Note.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/Note.kt index 3dde3a6d1e..342e88fda1 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/Note.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/Note.kt @@ -51,16 +51,16 @@ import com.vitorpamplona.quartz.nip28PublicChat.base.IsInPublicChatChannel import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent import com.vitorpamplona.quartz.nip36SensitiveContent.isSensitiveOrNSFW import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip47WalletConnect.rpc.PayInvoiceMethod import com.vitorpamplona.quartz.nip47WalletConnect.rpc.PayInvoiceSuccessResponse import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent import com.vitorpamplona.quartz.nip56Reports.ReportType -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip59Giftwrap.HostStub import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent @@ -1038,7 +1038,7 @@ open class Note( } return anyAsync(zapPayments) { next -> - val zapResponseEvent = next.second?.event as? LnZapPaymentResponseEvent + val zapResponseEvent = next.second?.event as? NwcResponseEvent if (zapResponseEvent != null) { val response = account.nip47SignerState.decryptResponse(zapResponseEvent) @@ -1066,11 +1066,11 @@ open class Note( return false } - val parallelDecrypt = mutableListOf>() + val parallelDecrypt = mutableListOf>() zapEvents.forEach { next -> - val zapRequest = next.key.event as LnZapRequestEvent - val zapEvent = next.value?.event as? LnZapEvent + val zapRequest = next.key.event as ZapRequestEvent + val zapEvent = next.value?.event as? ZapReceiptEvent if (zapEvent != null) { if (!zapRequest.isPrivateZap()) { @@ -1227,7 +1227,7 @@ open class Note( // Regular Zap Receipts zaps.forEach { val noteEvent = it.value?.event - if (noteEvent is LnZapEvent) { + if (noteEvent is ZapReceiptEvent) { sumOfAmounts += noteEvent.amount ?: BigDecimal(0) } } @@ -1299,8 +1299,8 @@ open class Note( paymentResponse: Note?, signerState: INwcSignerState, ): InvoiceAmount? { - val nwcRequest = paymentRequest.event as? LnZapPaymentRequestEvent - val nwcResponse = paymentResponse?.event as? LnZapPaymentResponseEvent + val nwcRequest = paymentRequest.event as? NwcRequestEvent + val nwcResponse = paymentResponse?.event as? NwcResponseEvent return if (nwcRequest != null && nwcResponse != null) { processZapAmountFromResponse( @@ -1319,8 +1319,8 @@ open class Note( ) private suspend fun processZapAmountFromResponse( - nwcRequest: LnZapPaymentRequestEvent, - nwcResponse: LnZapPaymentResponseEvent, + nwcRequest: NwcRequestEvent, + nwcResponse: NwcResponseEvent, signerState: INwcSignerState, ): InvoiceAmount? { // if we can decrypt the reply @@ -1361,7 +1361,7 @@ open class Note( } val invoiceSet = LinkedHashSet(zaps.size + zapPayments.size) - zaps.forEach { (it.value?.event as? LnZapEvent)?.lnInvoice()?.let { invoiceSet.add(it) } } + zaps.forEach { (it.value?.event as? ZapReceiptEvent)?.lnInvoice()?.let { invoiceSet.add(it) } } return zappedAmountCalculation( zapsAmount, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/ThreadAssembler.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/ThreadAssembler.kt index e07c1c98f9..d75e4ab742 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/ThreadAssembler.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/ThreadAssembler.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip61Nutzaps.nutzap.NutzapEvent import com.vitorpamplona.quartz.nipB1Bolt12Zaps.zap.Bolt12ZapEvent import com.vitorpamplona.quartz.nipBCOnchainZaps.zap.OnchainZapEvent @@ -183,7 +183,7 @@ class ThreadAssembler( */ fun Event?.anchorsItsOwnThread(): Boolean = when (this) { - is ReactionEvent, is LnZapEvent, is NutzapEvent, is OnchainZapEvent, is Bolt12ZapEvent -> true + is ReactionEvent, is ZapReceiptEvent, is NutzapEvent, is OnchainZapEvent, is Bolt12ZapEvent -> true else -> false } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/User.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/User.kt index ac221fef95..aaa614f854 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/User.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/User.kt @@ -37,7 +37,7 @@ import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip01Core.metadata.UserMetadata import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.tags.people.PTag -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip19Bech32.entities.NProfile import com.vitorpamplona.quartz.nip19Bech32.toNpub import com.vitorpamplona.quartz.nip61Nutzaps.info.NutzapInfoEvent @@ -76,7 +76,7 @@ class User( val nip65RelayListNote: Note = context.addressableNote(AdvertisedRelayListEvent.createAddress(pubkeyHex)) - val dmRelayListNote: Note = context.addressableNote(ChatMessageRelayListEvent.createAddress(pubkeyHex)) + val dmRelayListNote: Note = context.addressableNote(DmRelayListEvent.createAddress(pubkeyHex)) val nutzapInfoNote: Note = context.addressableNote(NutzapInfoEvent.createAddress(pubkeyHex)) @@ -114,7 +114,7 @@ class User( fun pubkeyDisplayHex() = pubkeyNpub().toShortDisplay(5) - fun dmInboxRelayList() = dmRelayListNote.event as? ChatMessageRelayListEvent + fun dmInboxRelayList() = dmRelayListNote.event as? DmRelayListEvent fun authorRelayList() = nip65RelayListNote.event as? AdvertisedRelayListEvent diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/backups/ReplaceableBackupConflict.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/backups/ReplaceableBackupConflict.kt index dd348ce0da..f32456f1c1 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/backups/ReplaceableBackupConflict.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/backups/ReplaceableBackupConflict.kt @@ -32,18 +32,18 @@ import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent import com.vitorpamplona.quartz.nip13Pow.tags.PoWTag -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent -import com.vitorpamplona.quartz.nip28PublicChat.list.ChannelListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent +import com.vitorpamplona.quartz.nip28PublicChat.list.PublicChatListEvent import com.vitorpamplona.quartz.nip37Drafts.privateOutbox.PrivateOutboxRelayListEvent import com.vitorpamplona.quartz.nip40Expiration.ExpirationTag import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent import com.vitorpamplona.quartz.nip51Lists.favoriteAlgoFeedsList.FavoriteAlgoFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.geohashList.GeohashListEvent -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BlockedRelayListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.simpleGroupList.SimpleGroupListEvent import com.vitorpamplona.quartz.nip60Cashu.wallet.CashuWalletEvent @@ -93,18 +93,18 @@ enum class BackupEventType { ContactListEvent.KIND -> FOLLOW_LIST MuteListEvent.KIND -> MUTE_LIST AdvertisedRelayListEvent.KIND -> OUTBOX_INBOX_RELAYS - ChatMessageRelayListEvent.KIND -> DM_RELAYS + DmRelayListEvent.KIND -> DM_RELAYS KeyPackageRelayListEvent.KIND -> KEY_PACKAGE_RELAYS SearchRelayListEvent.KIND -> SEARCH_RELAYS IndexerRelayListEvent.KIND -> INDEXER_RELAYS - RelayFeedsListEvent.KIND -> RELAY_FEEDS + FavoriteRelayListEvent.KIND -> RELAY_FEEDS BlockedRelayListEvent.KIND -> BLOCKED_RELAYS TrustedRelayListEvent.KIND -> TRUSTED_RELAYS PrivateOutboxRelayListEvent.KIND -> PRIVATE_OUTBOX_RELAYS AppSpecificDataEvent.KIND -> APP_SETTINGS - ChannelListEvent.KIND -> PUBLIC_CHATS + PublicChatListEvent.KIND -> PUBLIC_CHATS CommunityListEvent.KIND -> COMMUNITIES - HashtagListEvent.KIND -> HASHTAGS + InterestListEvent.KIND -> HASHTAGS GeohashListEvent.KIND -> GEOHASHES FavoriteAlgoFeedsListEvent.KIND -> FAVORITE_ALGO_FEEDS EphemeralChatListEvent.KIND -> EPHEMERAL_CHATS diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/cache/CachePruner.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/cache/CachePruner.kt index 8f26268712..119f2ff33e 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/cache/CachePruner.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/cache/CachePruner.kt @@ -35,19 +35,19 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.tags.people.isTaggedUsers import com.vitorpamplona.quartz.nip03Timestamp.OtsEvent -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip17Dm.base.BaseDMGroupEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.quotes.taggedQuoteIds import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent -import com.vitorpamplona.quartz.nip38UserStatus.StatusEvent +import com.vitorpamplona.quartz.nip38UserStatus.UserStatusEvent import com.vitorpamplona.quartz.nip40Expiration.isExpirationBefore import com.vitorpamplona.quartz.nip56Reports.ReportEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent import com.vitorpamplona.quartz.nip88Polls.response.PollResponseEvent import com.vitorpamplona.quartz.utils.Log import com.vitorpamplona.quartz.utils.TimeUtils @@ -207,7 +207,7 @@ class CachePruner( val roomNip04Pruned = HashMap() // chatroom.nip04History is lazy — only touch (allocate) it when this room actually drops a // kind:4 message, so rooms that never paged conversation history pay nothing. - val roomNip04Floor = if (toBeRemoved.any { it.event is PrivateDmEvent }) chatroom.nip04History.floor else null + val roomNip04Floor = if (toBeRemoved.any { it.event is EncryptedDmEvent }) chatroom.nip04History.floor else null toBeRemoved.forEach { note -> when (val ev = note.event) { @@ -216,7 +216,7 @@ class CachePruner( val outerUntil = note.rumorHost?.createdAt ?: ev.createdAt if (outerUntil < giftWrapFloor) note.relays.forEach { giftWrapPruned.mergeMax(it, outerUntil) } } - is PrivateDmEvent -> { + is EncryptedDmEvent -> { val until = ev.createdAt if (accountNip04Floor != null && until < accountNip04Floor) note.relays.forEach { accountNip04Pruned.mergeMax(it, until) } if (roomNip04Floor != null && until < roomNip04Floor) note.relays.forEach { roomNip04Pruned.mergeMax(it, until) } @@ -317,8 +317,8 @@ class CachePruner( ( (note.event is TextNoteEvent && !note.isNewThread()) || note.event is ReactionEvent || - note.event is LnZapEvent || - note.event is LnZapRequestEvent || + note.event is ZapReceiptEvent || + note.event is ZapRequestEvent || note.event is ReportEvent || note.event is GenericRepostEvent ) && @@ -413,11 +413,11 @@ class CachePruner( } } - if (note is AddressableNote && noteEvent is ContactCardEvent) { + if (note is AddressableNote && noteEvent is UserAssertionEvent) { cache.getUserIfExists(noteEvent.aboutUser())?.cardsOrNull()?.removeCard(note) } - if (note is AddressableNote && noteEvent is StatusEvent) { + if (note is AddressableNote && noteEvent is UserStatusEvent) { note.author?.statusStateOrNull()?.removeStatus(note) } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/cache/EventCache.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/cache/EventCache.kt index d4aaf2d354..1789346dcf 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/cache/EventCache.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/cache/EventCache.kt @@ -221,28 +221,28 @@ import com.vitorpamplona.quartz.nip01Core.tags.events.GenericETag import com.vitorpamplona.quartz.nip01Core.tags.events.taggedEvents import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent import com.vitorpamplona.quartz.nip03Timestamp.OtsEvent -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip09Deletions.DeletionIndex +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.BaseNoteEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip18Reposts.BaseRepostEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip18Reposts.quotes.taggedQuoteIds import com.vitorpamplona.quartz.nip19Bech32.isATag import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip25Reactions.ExternalReactionEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelHideMessageEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMetadataEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMuteUserEvent -import com.vitorpamplona.quartz.nip28PublicChat.list.ChannelListEvent +import com.vitorpamplona.quartz.nip28PublicChat.list.PublicChatListEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent import com.vitorpamplona.quartz.nip29RelayGroups.GroupId import com.vitorpamplona.quartz.nip29RelayGroups.groupId @@ -251,19 +251,19 @@ import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMembersEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMetadataEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupParticipantsEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupPinnedEvent -import com.vitorpamplona.quartz.nip29RelayGroups.metadata.SupportedRolesEvent +import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupRolesEvent import com.vitorpamplona.quartz.nip29RelayGroups.moderation.CreateGroupEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.CreateInviteEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.DeleteEventEvent import com.vitorpamplona.quartz.nip29RelayGroups.moderation.DeleteGroupEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.EditMetadataEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.PutUserEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.RemoveUserEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.UpdatePinListEvent -import com.vitorpamplona.quartz.nip29RelayGroups.request.JoinRequestEvent -import com.vitorpamplona.quartz.nip29RelayGroups.request.LeaveRequestEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupCreateInviteEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupDeleteEventEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupEditMetadataEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupPutUserEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupRemoveUserEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupUpdatePinListEvent +import com.vitorpamplona.quartz.nip29RelayGroups.request.GroupJoinRequestEvent +import com.vitorpamplona.quartz.nip29RelayGroups.request.GroupLeaveRequestEvent import com.vitorpamplona.quartz.nip30CustomEmoji.pack.EmojiPackEvent -import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiPackSelectionEvent +import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiListEvent import com.vitorpamplona.quartz.nip32Labeling.LabelEvent import com.vitorpamplona.quartz.nip34Git.grasp.UserGraspListEvent import com.vitorpamplona.quartz.nip34Git.issue.GitIssueEvent @@ -278,31 +278,31 @@ import com.vitorpamplona.quartz.nip35Torrents.TorrentCommentEvent import com.vitorpamplona.quartz.nip35Torrents.TorrentEvent import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent import com.vitorpamplona.quartz.nip37Drafts.privateOutbox.PrivateOutboxRelayListEvent -import com.vitorpamplona.quartz.nip38UserStatus.StatusEvent +import com.vitorpamplona.quartz.nip38UserStatus.UserStatusEvent import com.vitorpamplona.quartz.nip39ExtIdentities.ExternalIdentitiesEvent import com.vitorpamplona.quartz.nip40Expiration.isExpired import com.vitorpamplona.quartz.nip43RelayMembers.addMember.RelayAddMemberEvent import com.vitorpamplona.quartz.nip43RelayMembers.list.RelayMembershipListEvent import com.vitorpamplona.quartz.nip43RelayMembers.removeMember.RelayRemoveMemberEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent import com.vitorpamplona.quartz.nip51Lists.PinListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.OldBookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.favoriteAlgoFeedsList.FavoriteAlgoFeedsListEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip51Lists.geohashList.GeohashListEvent -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent import com.vitorpamplona.quartz.nip51Lists.interestSet.InterestSetEvent -import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.LabeledBookmarkListEvent +import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.BookmarkSetEvent import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BlockedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BroadcastRelayListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.ProxyRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relaySets.RelaySetEvent import com.vitorpamplona.quartz.nip51Lists.releaseArtifactSet.ReleaseArtifactSetEvent @@ -310,7 +310,7 @@ import com.vitorpamplona.quartz.nip51Lists.simpleGroupList.SimpleGroupListEvent import com.vitorpamplona.quartz.nip51Lists.videoCurationSet.VideoCurationSetEvent import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import com.vitorpamplona.quartz.nip52Calendar.rsvp.CalendarRSVPEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.clip.LiveActivitiesClipEvent @@ -320,13 +320,13 @@ import com.vitorpamplona.quartz.nip53LiveActivities.nestsServers.NestsServersEve import com.vitorpamplona.quartz.nip53LiveActivities.presence.MeetingRoomPresenceEvent import com.vitorpamplona.quartz.nip53LiveActivities.raid.LiveActivitiesRaidEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip54Wiki.WikiMergeAcceptanceEvent import com.vitorpamplona.quartz.nip54Wiki.WikiMergeRequestEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent import com.vitorpamplona.quartz.nip54Wiki.WikiRedirectEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip57Zaps.validate.LnZapReceiptValidator import com.vitorpamplona.quartz.nip57Zaps.validate.LnurlEndpointResolver import com.vitorpamplona.quartz.nip57Zaps.validate.LnurlForm @@ -335,7 +335,7 @@ import com.vitorpamplona.quartz.nip58Badges.award.BadgeAwardEvent import com.vitorpamplona.quartz.nip58Badges.definition.BadgeDefinitionEvent import com.vitorpamplona.quartz.nip58Badges.profile.ProfileBadgesEvent import com.vitorpamplona.quartz.nip59Giftwrap.HasInnerEvent -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nip5aStaticWebsites.NamedSiteEvent import com.vitorpamplona.quartz.nip5aStaticWebsites.RootSiteEvent @@ -360,20 +360,20 @@ import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent import com.vitorpamplona.quartz.nip66RelayMonitor.discovery.RelayDiscoveryEvent import com.vitorpamplona.quartz.nip66RelayMonitor.monitor.RelayMonitorEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip71Video.textTrack.TextTrackEvent import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent import com.vitorpamplona.quartz.nip72ModCommunities.follow.CommunityListEvent -import com.vitorpamplona.quartz.nip75ZapGoals.GoalEvent +import com.vitorpamplona.quartz.nip75ZapGoals.ZapGoalEvent import com.vitorpamplona.quartz.nip78AppData.AppSpecificDataEvent import com.vitorpamplona.quartz.nip7DThreads.ThreadEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip85TrustedAssertions.list.TrustProviderListEvent -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent import com.vitorpamplona.quartz.nip87Ecash.cashu.CashuMintEvent import com.vitorpamplona.quartz.nip87Ecash.fedimint.FedimintEvent import com.vitorpamplona.quartz.nip87Ecash.recommendation.MintRecommendationEvent @@ -381,13 +381,13 @@ import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip88Polls.response.PollResponseEvent import com.vitorpamplona.quartz.nip89AppHandlers.definition.AppDefinitionEvent import com.vitorpamplona.quartz.nip89AppHandlers.recommendation.AppRecommendationEvent -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.NIP90ContentDiscoveryRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.NIP90ContentDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.DvmContentDiscoveryRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.DvmContentDiscoveryResponseEvent import com.vitorpamplona.quartz.nip90Dvms.dvmHeartbeat.DvmHeartbeatEvent -import com.vitorpamplona.quartz.nip90Dvms.status.NIP90StatusEvent -import com.vitorpamplona.quartz.nip90Dvms.userDiscoveryRequest.NIP90UserDiscoveryRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.userDiscoveryResponse.NIP90UserDiscoveryResponseEvent -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip90Dvms.status.DvmStatusEvent +import com.vitorpamplona.quartz.nip90Dvms.userDiscoveryRequest.DvmUserDiscoveryRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.userDiscoveryResponse.DvmUserDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent import com.vitorpamplona.quartz.nip96FileStorage.config.FileServersEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent import com.vitorpamplona.quartz.nipA0VoiceMessages.VoiceEvent @@ -502,7 +502,7 @@ open class EventCache : val bolt12ZapValidator = Bolt12ZapValidator() /** - * Resolver for LNURL provider metadata used by [consume]`(LnZapEvent)` to + * Resolver for LNURL provider metadata used by [consume]`(ZapReceiptEvent)` to * validate NIP-57 Appendix F. `null` skips the receipt-signer check (the * receipt is still accepted on signature verification alone — matches legacy * behavior); set this in app init so receipts can be verified against the @@ -1210,7 +1210,7 @@ open class EventCache : } fun consume( - event: LongTextNoteEvent, + event: LongFormContentEvent, relay: NormalizedRelayUrl?, wasVerified: Boolean, ): Boolean { @@ -1298,7 +1298,7 @@ open class EventCache : } fun consume( - event: WikiNoteEvent, + event: WikiArticleEvent, relay: NormalizedRelayUrl?, wasVerified: Boolean, ): Boolean { @@ -1347,7 +1347,7 @@ open class EventCache : event.tagsWithoutCitations().mapNotNull { checkGetOrCreateNote(it) } } - is LongTextNoteEvent -> { + is LongFormContentEvent -> { event.tagsWithoutCitations().mapNotNull { checkGetOrCreateNote(it) } } @@ -1405,7 +1405,7 @@ open class EventCache : event.taggedEvents().mapNotNull { checkGetOrCreateNote(it) } } - is LnZapEvent -> { + is ZapReceiptEvent -> { event.zappedPost().mapNotNull { checkGetOrCreateNote(it) } + event.taggedAddresses().map { getOrCreateAddressableNote(it) } + (event.zapRequest?.taggedAddresses()?.map { getOrCreateAddressableNote(it) } ?: emptyList()) @@ -1438,11 +1438,11 @@ open class EventCache : // The zapped event is carried in the kind:9321's `e` tags // (and optionally an `a` tag for addressables). Whichever // notes those resolve to receive the nutzap entry — - // analogous to how LnZapEvent flows into `addZap`. + // analogous to how ZapReceiptEvent flows into `addZap`. event.linkedEventIds().mapNotNull { checkGetOrCreateNote(it) } } - is LnZapRequestEvent -> { + is ZapRequestEvent -> { event.zappedPost().mapNotNull { checkGetOrCreateNote(it) } + event.taggedAddresses().map { getOrCreateAddressableNote(it) } } @@ -1456,7 +1456,7 @@ open class EventCache : event.awardDefinition().map { getOrCreateAddressableNote(it) } } - is PrivateDmEvent -> { + is EncryptedDmEvent -> { event.taggedEvents().mapNotNull { checkGetOrCreateNote(it) } } @@ -1557,7 +1557,7 @@ open class EventCache : } fun consume( - event: StatusEvent, + event: UserStatusEvent, relay: NormalizedRelayUrl?, wasVerified: Boolean, ): Boolean { @@ -1577,7 +1577,7 @@ open class EventCache : fun AddressableEvent.toAddressableNote() = getOrCreateAddressableNote(address()) fun consume( - event: ContactCardEvent, + event: UserAssertionEvent, relay: NormalizedRelayUrl?, wasVerified: Boolean, ): Boolean { @@ -1667,7 +1667,7 @@ open class EventCache : } fun consume( - event: DeletionEvent, + event: DeletionRequestEvent, relay: NormalizedRelayUrl?, wasVerified: Boolean, ): Boolean { @@ -2245,13 +2245,13 @@ open class EventCache : /** NIP-29 relay-declared supported roles (kind 39003) → the group's role set. */ fun consume( - event: SupportedRolesEvent, + event: GroupRolesEvent, relay: NormalizedRelayUrl?, wasVerified: Boolean, ): Boolean { val new = consumeBaseReplaceable(event, relay, wasVerified) if (relay != null && isRelaySignedGroupEvent(event, relay)) { - val latest = getOrCreateAddressableNote(event.address()).event as? SupportedRolesEvent + val latest = getOrCreateAddressableNote(event.address()).event as? GroupRolesEvent latest?.let { getOrCreateRelayGroupChannel(GroupId(it.groupId(), relay)).updateSupportedRoles(it) } } return new @@ -2661,7 +2661,7 @@ open class EventCache : ): Boolean = false fun consume( - event: LnZapEvent, + event: ZapReceiptEvent, relay: NormalizedRelayUrl?, wasVerified: Boolean, ): Boolean { @@ -2687,7 +2687,7 @@ open class EventCache : val zapRequest = event.zapRequest?.id?.let { getNoteIfExists(it) } - if (zapRequest == null || zapRequest.event !is LnZapRequestEvent) { + if (zapRequest == null || zapRequest.event !is ZapRequestEvent) { Log.d("ZP") { "Zap Request not found. Unable to process Zap {${event.toJson()}}" } return false } @@ -2788,7 +2788,7 @@ open class EventCache : * zap target). Returns null if we have no metadata, or the user has neither * lud16 nor lud06. */ - private fun recipientLnurl(event: LnZapEvent): String? { + private fun recipientLnurl(event: ZapReceiptEvent): String? { val recipientPubkey = event.zappedAuthor().firstOrNull() ?: return null val user = getUserIfExists(recipientPubkey) ?: return null return user.lnAddress()?.takeIf { it.isNotBlank() } @@ -2925,7 +2925,7 @@ open class EventCache : } private fun attachZapToLiveActivityChannel( - event: LnZapEvent, + event: ZapReceiptEvent, note: Note, relay: NormalizedRelayUrl?, ) { @@ -2963,7 +2963,7 @@ open class EventCache : } fun consume( - event: LnZapRequestEvent, + event: ZapRequestEvent, relay: NormalizedRelayUrl?, wasVerified: Boolean, ): Boolean { @@ -3166,7 +3166,7 @@ open class EventCache : } fun consume( - event: LnZapPaymentRequestEvent, + event: NwcRequestEvent, relay: NormalizedRelayUrl?, wasVerified: Boolean, ): Boolean { @@ -3175,11 +3175,11 @@ open class EventCache : } fun consume( - event: LnZapPaymentRequestEvent, + event: NwcRequestEvent, zappedNote: Note?, wasVerified: Boolean, relay: NormalizedRelayUrl?, - onResponse: suspend (LnZapPaymentResponseEvent) -> Unit, + onResponse: suspend (NwcResponseEvent) -> Unit, ): Boolean { val note = getOrCreateNote(event.id) val author = getOrCreateUser(event.pubKey) @@ -3213,7 +3213,7 @@ open class EventCache : } fun consume( - event: LnZapPaymentResponseEvent, + event: NwcResponseEvent, relay: NormalizedRelayUrl?, wasVerified: Boolean, ): Boolean { @@ -3285,7 +3285,7 @@ open class EventCache : return false } - fun getPeopleListNotesFor(user: User): List = addressables.filter(PeopleListEvent.KIND, user.pubkeyHex) + fun getPeopleListNotesFor(user: User): List = addressables.filter(FollowSetEvent.KIND, user.pubkeyHex) override fun markAsSeen( eventId: String, @@ -3584,7 +3584,7 @@ open class EventCache : is ChannelMetadataEvent -> consume(event, relay, wasVerified) is ChannelMuteUserEvent -> consume(event, relay, wasVerified) is CommunityPostApprovalEvent -> consume(event, relay, wasVerified) - is DeletionEvent -> consume(event, relay, wasVerified) + is DeletionRequestEvent -> consume(event, relay, wasVerified) is DraftWrapEvent -> consume(event, relay, wasVerified) is EphemeralChatEvent -> consume(event, relay, wasVerified) is GeohashChatEvent -> consume(event, relay, wasVerified) @@ -3595,7 +3595,7 @@ open class EventCache : // 39003 (relay-declared roles) is durable group state like 39000/39001/39002: // route it onto the channel so a moderation UI can offer the relay's role set. - is SupportedRolesEvent -> consume(event, relay, wasVerified) + is GroupRolesEvent -> consume(event, relay, wasVerified) is GenericRepostEvent -> consume(event, relay, wasVerified) is FileStorageEvent -> consume(event, relay, wasVerified) @@ -3627,26 +3627,26 @@ open class EventCache : } } - is LnZapEvent -> consume(event, relay, wasVerified) - is LnZapRequestEvent -> consume(event, relay, wasVerified) + is ZapReceiptEvent -> consume(event, relay, wasVerified) + is ZapRequestEvent -> consume(event, relay, wasVerified) is OnchainZapEvent -> consume(event, relay, wasVerified) is Bolt12ZapEvent -> consume(event, relay, wasVerified) - is LnZapPaymentRequestEvent -> consume(event, relay, wasVerified) - is LnZapPaymentResponseEvent -> consume(event, relay, wasVerified) - is LongTextNoteEvent -> consume(event, relay, wasVerified) + is NwcRequestEvent -> consume(event, relay, wasVerified) + is NwcResponseEvent -> consume(event, relay, wasVerified) + is LongFormContentEvent -> consume(event, relay, wasVerified) is MetadataEvent -> consume(event, relay, wasVerified) is NipTextEvent -> consume(event, relay, wasVerified) is OtsEvent -> consume(event, relay, wasVerified) is PollResponseEvent -> consume(event, relay, wasVerified) is ReactionEvent -> consume(event, relay, wasVerified) is LabelEvent -> consume(event, relay, wasVerified) - is ContactCardEvent -> consume(event, relay, wasVerified) + is UserAssertionEvent -> consume(event, relay, wasVerified) is ReportEvent -> consume(event, relay, wasVerified) is RepostEvent -> consume(event, relay, wasVerified) - is StatusEvent -> consume(event, relay, wasVerified) + is UserStatusEvent -> consume(event, relay, wasVerified) is TextNoteModificationEvent -> consume(event, relay, wasVerified) is ConcordChatEditEvent -> consume(event, relay, wasVerified) - is WikiNoteEvent -> consume(event, relay, wasVerified) + is WikiArticleEvent -> consume(event, relay, wasVerified) is PaymentTargetsEvent -> consume(event, relay, wasVerified) is ChatEvent -> { @@ -3671,7 +3671,7 @@ open class EventCache : // Buzz workspace kinds (block/buzz — the Buzz dialect of NIP-29). // Timeline kinds attach into the group's BuzzWorkspaceChannel; the // rest are stored for query/state. Kinds 9041/39005/49001 are absent - // on purpose: their numbers belong to GoalEvent, GroupPinnedEvent and + // on purpose: their numbers belong to ZapGoalEvent, GroupPinnedEvent and // a non-wire audit kind. Kind 20001 is shared with GeohashPresenceEvent // (BitChat); EventFactory routes it to PresenceUpdateEvent only when the // BitChat `g` tag is absent, and it is handled below with the ephemerals. @@ -3799,14 +3799,14 @@ open class EventCache : is BroadcastRelayListEvent, is BookmarkListEvent, is OldBookmarkListEvent, - is CalendarEvent, + is CalendarCollectionEvent, is CalendarDateSlotEvent, is CalendarTimeSlotEvent, is CalendarRSVPEvent, is CashuWalletEvent, is NutzapInfoEvent, - is ChannelListEvent, - is ChatMessageRelayListEvent, + is PublicChatListEvent, + is DmRelayListEvent, is Bolt12OfferListEvent, is ClassifiedsEvent, is FundraiserEvent, @@ -3825,7 +3825,7 @@ open class EventCache : DvmHeartbeatRegistry.record(event.address(), event.createdAt) } is EmojiPackEvent, - is EmojiPackSelectionEvent, + is EmojiListEvent, is EphemeralChatListEvent, // NIP-51 "simple groups" list (kind 10009): the user's joined NIP-29 groups + // servers. Replaceable like its sibling lists; RelayGroupListState reads it from the @@ -3840,7 +3840,7 @@ open class EventCache : is GroupParticipantsEvent, is ExternalIdentitiesEvent, is FileServersEvent, - is FollowListEvent, + is StarterPackEvent, is GeocacheListingEvent, is GeocacheCurationListEvent, is GeohashListEvent, @@ -3854,7 +3854,7 @@ open class EventCache : is NamedSiteEvent, is RootNappletEvent, is NamedNappletEvent, - is RelayFeedsListEvent, + is FavoriteRelayListEvent, is KeyPackageEvent, is KeyPackageRelayListEvent, is LiveChessGameChallengeEvent, @@ -3862,14 +3862,14 @@ open class EventCache : is LiveChessMoveEvent, is LiveChessGameEndEvent, is LiveChessDrawOfferEvent, - is HashtagListEvent, + is InterestListEvent, is FavoriteAlgoFeedsListEvent, is IndexerRelayListEvent, is InteractiveStoryPrologueEvent, is InteractiveStorySceneEvent, is InteractiveStoryReadingStateEvent, is InterestSetEvent, - is LabeledBookmarkListEvent, + is BookmarkSetEvent, is MeetingSpaceEvent, is MeetingRoomEvent, is MusicTrackEvent, @@ -3884,7 +3884,7 @@ open class EventCache : is ProfileBadgesEvent, is ProxyRelayListEvent, is PinListEvent, - is PeopleListEvent, + is FollowSetEvent, // Buzz addressable/replaceable state. is PersonaEvent, is TeamEvent, @@ -3904,8 +3904,8 @@ open class EventCache : is SoftwareApplicationEvent, is TrustedRelayListEvent, is TrustProviderListEvent, - is VideoHorizontalEvent, - is VideoVerticalEvent, + is AddressableNormalVideoEvent, + is AddressableShortVideoEvent, is TextTrackEvent, is VideoCollaborationEvent, is VideoCurationSetEvent, @@ -3953,21 +3953,21 @@ open class EventCache : // one-shot events the relay is authoritative for (it applies them and // republishes the 39000/39001/39002); we store them so they're queryable, // but we don't act on them client-side. - is PutUserEvent, - is RemoveUserEvent, - is EditMetadataEvent, - is DeleteEventEvent, - is UpdatePinListEvent, + is GroupPutUserEvent, + is GroupRemoveUserEvent, + is GroupEditMetadataEvent, + is GroupDeleteEventEvent, + is GroupUpdatePinListEvent, is DeleteGroupEvent, is CreateGroupEvent, - is CreateInviteEvent, - is JoinRequestEvent, - is LeaveRequestEvent, + is GroupCreateInviteEvent, + is GroupJoinRequestEvent, + is GroupLeaveRequestEvent, is FhirResourceEvent, - is FileHeaderEvent, + is FileMetadataEvent, is ProfileGalleryEntryEvent, is FileStorageHeaderEvent, - is GoalEvent, + is ZapGoalEvent, is GroupEvent, is GitIssueEvent, is GitReplyEvent, @@ -3980,13 +3980,13 @@ open class EventCache : is JesterEvent, is HighlightEvent, is PodcastEpisodeEvent, - is NIP90StatusEvent, - is NIP90ContentDiscoveryResponseEvent, - is NIP90ContentDiscoveryRequestEvent, - is NIP90UserDiscoveryResponseEvent, - is NIP90UserDiscoveryRequestEvent, + is DvmStatusEvent, + is DvmContentDiscoveryResponseEvent, + is DvmContentDiscoveryRequestEvent, + is DvmUserDiscoveryResponseEvent, + is DvmUserDiscoveryRequestEvent, is PictureEvent, - is PrivateDmEvent, + is EncryptedDmEvent, is PublicMessageEvent, is RequestToVanishEvent, is CodeSnippetEvent, @@ -4000,7 +4000,7 @@ open class EventCache : is GeocacheVerificationEvent, is RoadEventReportEvent, is RoadEventConfirmationEvent, - is SealedRumorEvent, + is SealEvent, is SoftwareAssetEvent, is ExternalReactionEvent, is ExternalCitationEvent, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip23LongContent/LongFormPublishAction.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip23LongContent/LongFormPublishAction.kt index f34b9a0792..4526e93e9c 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip23LongContent/LongFormPublishAction.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip23LongContent/LongFormPublishAction.kt @@ -22,7 +22,7 @@ package com.vitorpamplona.amethyst.commons.model.nip23LongContent import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hashtag -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.utils.TimeUtils /** @@ -42,7 +42,7 @@ object LongFormPublishAction { * @param tags List of hashtag topics * @param dTag Unique identifier for this addressable event (slug) * @param signer The NostrSigner to sign the event - * @return Signed LongTextNoteEvent ready to broadcast + * @return Signed LongFormContentEvent ready to broadcast * @throws IllegalStateException if signer is not writeable */ suspend fun publish( @@ -53,7 +53,7 @@ object LongFormPublishAction { tags: List, dTag: String, signer: NostrSigner, - ): LongTextNoteEvent { + ): LongFormContentEvent { if (!signer.isWriteable()) { throw IllegalStateException("Cannot publish: signer is not writeable") } @@ -63,7 +63,7 @@ object LongFormPublishAction { } val template = - LongTextNoteEvent.build( + LongFormContentEvent.build( description = content, title = title, summary = summary, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip28PublicChats/PublicChatListDecryptionCache.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip28PublicChats/PublicChatListDecryptionCache.kt index e8f16823c9..702240aee3 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip28PublicChats/PublicChatListDecryptionCache.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip28PublicChats/PublicChatListDecryptionCache.kt @@ -21,7 +21,7 @@ package com.vitorpamplona.amethyst.commons.model.nip28PublicChats import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip28PublicChat.list.ChannelListEvent +import com.vitorpamplona.quartz.nip28PublicChat.list.PublicChatListEvent import com.vitorpamplona.quartz.nip28PublicChat.list.channelSet import com.vitorpamplona.quartz.nip28PublicChat.list.channels import com.vitorpamplona.quartz.nip51Lists.PrivateTagArrayEventCache @@ -29,13 +29,13 @@ import com.vitorpamplona.quartz.nip51Lists.PrivateTagArrayEventCache class PublicChatListDecryptionCache( val signer: NostrSigner, ) { - val cachedPrivateLists = PrivateTagArrayEventCache(signer) + val cachedPrivateLists = PrivateTagArrayEventCache(signer) - fun cachedChannelSet(event: ChannelListEvent) = cachedPrivateLists.mergeTagListPrecached(event).channelSet() + fun cachedChannelSet(event: PublicChatListEvent) = cachedPrivateLists.mergeTagListPrecached(event).channelSet() - fun cachedChannels(event: ChannelListEvent) = cachedPrivateLists.mergeTagListPrecached(event).channels() + fun cachedChannels(event: PublicChatListEvent) = cachedPrivateLists.mergeTagListPrecached(event).channels() - suspend fun channelSet(event: ChannelListEvent) = cachedPrivateLists.mergeTagList(event).channelSet() + suspend fun channelSet(event: PublicChatListEvent) = cachedPrivateLists.mergeTagList(event).channelSet() - suspend fun channels(event: ChannelListEvent) = cachedPrivateLists.mergeTagList(event).channels() + suspend fun channels(event: PublicChatListEvent) = cachedPrivateLists.mergeTagList(event).channels() } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip28PublicChats/PublicChatListState.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip28PublicChats/PublicChatListState.kt index 2c59434441..1f70bcea4b 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip28PublicChats/PublicChatListState.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip28PublicChats/PublicChatListState.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.commons.model.NoteState import com.vitorpamplona.amethyst.commons.model.cache.ICacheProvider import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip28PublicChat.list.ChannelListEvent +import com.vitorpamplona.quartz.nip28PublicChat.list.PublicChatListEvent import com.vitorpamplona.quartz.nip28PublicChat.list.tags.ChannelTag import com.vitorpamplona.quartz.utils.Log import kotlinx.coroutines.CoroutineScope @@ -44,9 +44,9 @@ import kotlinx.coroutines.flow.transformLatest import kotlinx.coroutines.launch interface PublicChatListRepository { - fun channelList(): ChannelListEvent? + fun channelList(): PublicChatListEvent? - fun updateChannelListTo(newChannelList: ChannelListEvent?) + fun updateChannelListTo(newChannelList: PublicChatListEvent?) } class PublicChatListState( @@ -59,14 +59,14 @@ class PublicChatListState( // Creates a long-term reference for this note so that the GC doesn't collect the note it self val publicChatListNote = cache.getOrCreateAddressableNote(getChannelListAddress()) - fun getChannelListAddress() = ChannelListEvent.createAddress(signer.pubKey) + fun getChannelListAddress() = PublicChatListEvent.createAddress(signer.pubKey) fun getChannelListFlow(): StateFlow = publicChatListNote.flow().metadata.stateFlow - fun getChannelList(): ChannelListEvent? = publicChatListNote.event as? ChannelListEvent + fun getChannelList(): PublicChatListEvent? = publicChatListNote.event as? PublicChatListEvent suspend fun publicChatListWithBackup(note: Note): Set { - val event = note.event as? ChannelListEvent ?: settings.channelList() + val event = note.event as? PublicChatListEvent ?: settings.channelList() return event?.let { decryptionCache.channelSet(it) } ?: emptySet() } @@ -111,32 +111,32 @@ class PublicChatListState( emptyList(), ) - suspend fun follow(channel: PublicChatChannel): ChannelListEvent { + suspend fun follow(channel: PublicChatChannel): PublicChatListEvent { val publicChatList = getChannelList() return if (publicChatList == null) { - ChannelListEvent.create(ChannelTag(channel.idHex, channel.relayHintUrl()), true, signer) + PublicChatListEvent.create(ChannelTag(channel.idHex, channel.relayHintUrl()), true, signer) } else { - ChannelListEvent.add(publicChatList, ChannelTag(channel.idHex, channel.relayHintUrl()), true, signer) + PublicChatListEvent.add(publicChatList, ChannelTag(channel.idHex, channel.relayHintUrl()), true, signer) } } - suspend fun follow(channels: List): ChannelListEvent { + suspend fun follow(channels: List): PublicChatListEvent { val publicChatList = getChannelList() val channelTags = channels.map { ChannelTag(it.idHex, it.relayHintUrl()) } return if (publicChatList == null) { - ChannelListEvent.create(channelTags, true, signer) + PublicChatListEvent.create(channelTags, true, signer) } else { - ChannelListEvent.add(publicChatList, channelTags, true, signer) + PublicChatListEvent.add(publicChatList, channelTags, true, signer) } } - suspend fun unfollow(channel: PublicChatChannel): ChannelListEvent? { + suspend fun unfollow(channel: PublicChatChannel): PublicChatListEvent? { val publicChatList = getChannelList() return if (publicChatList != null) { - ChannelListEvent.remove(publicChatList, ChannelTag(channel.idHex, channel.relayHintUrl()), signer) + PublicChatListEvent.remove(publicChatList, ChannelTag(channel.idHex, channel.relayHintUrl()), signer) } else { null } @@ -155,7 +155,7 @@ class PublicChatListState( Log.d("AccountRegisterObservers", "Channel List Collector Start") getChannelListFlow().collect { Log.d("AccountRegisterObservers") { "Channel List for ${signer.pubKey}" } - (it.note.event as? ChannelListEvent)?.let { + (it.note.event as? PublicChatListEvent)?.let { settings.updateChannelListTo(it) } } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip29RelayGroups/RelayGroupChannel.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip29RelayGroups/RelayGroupChannel.kt index 9c029296f8..d1009af4cc 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip29RelayGroups/RelayGroupChannel.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip29RelayGroups/RelayGroupChannel.kt @@ -35,7 +35,7 @@ import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupAdminsEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMembersEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMetadataEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupPinnedEvent -import com.vitorpamplona.quartz.nip29RelayGroups.metadata.SupportedRolesEvent +import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupRolesEvent import com.vitorpamplona.quartz.nip29RelayGroups.tags.GroupAdminTag import com.vitorpamplona.quartz.nip29RelayGroups.tags.RoleTag import com.vitorpamplona.quartz.utils.cache.LargeCache @@ -237,7 +237,7 @@ class RelayGroupChannel( updateChannelInfo() } - fun updateSupportedRoles(event: SupportedRolesEvent) { + fun updateSupportedRoles(event: GroupRolesEvent) { // Only newer definitions supersede; equal-or-older is dropped (no redundant emit). if (event.createdAt <= supportedRolesUpdatedAt) return supportedRoles = event.roles() diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip30CustomEmojis/EmojiPackState.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip30CustomEmojis/EmojiPackState.kt index decf5f345e..612e2c5673 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip30CustomEmojis/EmojiPackState.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip30CustomEmojis/EmojiPackState.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.tags.aTag.taggedAddresses import com.vitorpamplona.quartz.nip30CustomEmoji.CustomEmoji import com.vitorpamplona.quartz.nip30CustomEmoji.EmojiUrlTag import com.vitorpamplona.quartz.nip30CustomEmoji.pack.EmojiPackEvent -import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiPackSelectionEvent +import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiListEvent import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -55,13 +55,13 @@ class EmojiPackState( // Creates a long-term reference for this note so that the GC doesn't collect the note it self val emojiPackListNote = cache.getOrCreateAddressableNote(getEmojiPackSelectionAddress()) - fun getEmojiPackSelectionAddress() = EmojiPackSelectionEvent.createAddress(signer.pubKey) + fun getEmojiPackSelectionAddress() = EmojiListEvent.createAddress(signer.pubKey) - fun getEmojiPackSelection(): EmojiPackSelectionEvent? = emojiPackListNote.event as? EmojiPackSelectionEvent + fun getEmojiPackSelection(): EmojiListEvent? = emojiPackListNote.event as? EmojiListEvent fun getEmojiPackSelectionFlow(): StateFlow = emojiPackListNote.flow().metadata.stateFlow - fun convertEmojiSelectionPack(selection: EmojiPackSelectionEvent?): List>? = + fun convertEmojiSelectionPack(selection: EmojiListEvent?): List>? = selection?.taggedAddresses()?.map { cache .getOrCreateAddressableNote(it) @@ -73,7 +73,7 @@ class EmojiPackState( val flow: StateFlow>?> = getEmojiPackSelectionFlow() .transformLatest { - emit(convertEmojiSelectionPack(it.note.event as? EmojiPackSelectionEvent)) + emit(convertEmojiSelectionPack(it.note.event as? EmojiListEvent)) }.onStart { emit(convertEmojiSelectionPack(getEmojiPackSelection())) }.flowOn(Dispatchers.IO) @@ -143,7 +143,7 @@ class EmojiPackState( } } - suspend fun addEmojiPack(emojiPack: Note): EmojiPackSelectionEvent { + suspend fun addEmojiPack(emojiPack: Note): EmojiListEvent { val emojiPackEvent = emojiPack.event if (emojiPackEvent !is EmojiPackEvent) throw IllegalArgumentException("Note is not an EmojiPackEvent; cannot add to emoji list.") @@ -151,21 +151,21 @@ class EmojiPackState( val usersEmojiList = getEmojiPackSelection() return if (usersEmojiList == null) { - val template = EmojiPackSelectionEvent.build(listOf(eventHint)) + val template = EmojiListEvent.build(listOf(eventHint)) signer.sign(template) } else { - val template = EmojiPackSelectionEvent.add(usersEmojiList, eventHint) + val template = EmojiListEvent.add(usersEmojiList, eventHint) signer.sign(template) } } - suspend fun removeEmojiPack(emojiPack: Note): EmojiPackSelectionEvent? { + suspend fun removeEmojiPack(emojiPack: Note): EmojiListEvent? { val usersEmojiList = getEmojiPackSelection() ?: throw IllegalArgumentException("No emoji pack selection exists to remove from.") val emojiPackEvent = emojiPack.event if (emojiPackEvent !is EmojiPackEvent) return null - val template = EmojiPackSelectionEvent.remove(usersEmojiList, emojiPackEvent) + val template = EmojiListEvent.remove(usersEmojiList, emojiPackEvent) return signer.sign(template) } } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip38UserStatuses/UserStatusAction.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip38UserStatuses/UserStatusAction.kt index 0040e9e0d8..4fac63e096 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip38UserStatuses/UserStatusAction.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip38UserStatuses/UserStatusAction.kt @@ -23,38 +23,38 @@ package com.vitorpamplona.amethyst.commons.model.nip38UserStatuses import com.vitorpamplona.amethyst.commons.model.AddressableNote import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent -import com.vitorpamplona.quartz.nip38UserStatus.StatusEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent +import com.vitorpamplona.quartz.nip38UserStatus.UserStatusEvent class UserStatusAction { companion object { suspend fun create( newStatus: String, signer: NostrSigner, - type: String = StatusEvent.GENERAL, - ): StatusEvent = StatusEvent.create(newStatus, type, signer = signer) + type: String = UserStatusEvent.GENERAL, + ): UserStatusEvent = UserStatusEvent.create(newStatus, type, signer = signer) suspend fun update( oldStatus: AddressableNote, newStatus: String, signer: NostrSigner, - ): StatusEvent { - val oldEvent = oldStatus.event as? StatusEvent ?: throw IllegalStateException("Tried to update a non-status event") + ): UserStatusEvent { + val oldEvent = oldStatus.event as? UserStatusEvent ?: throw IllegalStateException("Tried to update a non-status event") - return StatusEvent.update(oldEvent, newStatus, signer) + return UserStatusEvent.update(oldEvent, newStatus, signer) } suspend fun delete( oldStatus: AddressableNote, signer: NostrSigner, ): List { - val oldEvent = oldStatus.event as? StatusEvent ?: throw IllegalStateException("Tried to update a non-status event") + val oldEvent = oldStatus.event as? UserStatusEvent ?: throw IllegalStateException("Tried to update a non-status event") - val event = StatusEvent.clear(oldEvent, signer) + val event = UserStatusEvent.clear(oldEvent, signer) val deletion = signer.sign( - DeletionEvent.buildForVersionOnly(listOf(event)), + DeletionRequestEvent.buildForVersionOnly(listOf(event)), ) return listOf(event, deletion) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip51Lists/blockPeopleList/BlockPeopleListState.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip51Lists/blockPeopleList/BlockPeopleListState.kt index a1d0403978..0d36cb6391 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip51Lists/blockPeopleList/BlockPeopleListState.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip51Lists/blockPeopleList/BlockPeopleListState.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip51Lists.muteList.tags.MuteTag import com.vitorpamplona.quartz.nip51Lists.muteList.tags.UserTag import com.vitorpamplona.quartz.nip51Lists.muteList.tags.WordTag -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.IO @@ -48,14 +48,14 @@ class BlockPeopleListState( // Creates a long-term reference for this note so that the GC doesn't collect the note it self val blockListNote = cache.getOrCreateAddressableNote(getBlockListAddress()) - fun getBlockListAddress() = PeopleListEvent.createBlockAddress(signer.pubKey) + fun getBlockListAddress() = FollowSetEvent.createBlockAddress(signer.pubKey) fun getBlockListFlow(): StateFlow = blockListNote.flow().metadata.stateFlow - fun getBlockList(): PeopleListEvent? = blockListNote.event as? PeopleListEvent + fun getBlockList(): FollowSetEvent? = blockListNote.event as? FollowSetEvent suspend fun blockListWithBackup(note: Note): List { - val event = note.event as? PeopleListEvent + val event = note.event as? FollowSetEvent return event?.let { decryptionCache.usersAndWords(it) } ?: emptyList() } @@ -70,32 +70,32 @@ class BlockPeopleListState( emptyList(), ) - suspend fun hideUser(pubkeyHex: String): PeopleListEvent { + suspend fun hideUser(pubkeyHex: String): FollowSetEvent { val blockList = getBlockList() return if (blockList != null) { - PeopleListEvent.add( + FollowSetEvent.add( earlierVersion = blockList, person = UserTag(pubkeyHex), isPrivate = true, signer = signer, ) } else { - PeopleListEvent.create( - title = PeopleListEvent.BLOCK_LIST_D_TAG, + FollowSetEvent.create( + title = FollowSetEvent.BLOCK_LIST_D_TAG, person = UserTag(pubkeyHex), isPrivate = true, signer = signer, - dTag = PeopleListEvent.BLOCK_LIST_D_TAG, + dTag = FollowSetEvent.BLOCK_LIST_D_TAG, ) } } - suspend fun showUser(pubkeyHex: String): PeopleListEvent? { + suspend fun showUser(pubkeyHex: String): FollowSetEvent? { val blockList = getBlockList() return if (blockList != null) { - PeopleListEvent.remove( + FollowSetEvent.remove( earlierVersion = blockList, person = UserTag(pubkeyHex), signer = signer, @@ -105,11 +105,11 @@ class BlockPeopleListState( } } - suspend fun showWord(word: String): PeopleListEvent? { + suspend fun showWord(word: String): FollowSetEvent? { val blockList = getBlockList() return if (blockList != null) { - PeopleListEvent.remove( + FollowSetEvent.remove( earlierVersion = blockList, person = WordTag(word), signer = signer, @@ -119,20 +119,20 @@ class BlockPeopleListState( } } - suspend fun showUsers(pubkeys: List): PeopleListEvent? { + suspend fun showUsers(pubkeys: List): FollowSetEvent? { if (pubkeys.isEmpty()) return null val blockList = getBlockList() ?: return null - return PeopleListEvent.removeAll( + return FollowSetEvent.removeAll( earlierVersion = blockList, persons = pubkeys.map { UserTag(it) }, signer = signer, ) } - suspend fun showWords(words: List): PeopleListEvent? { + suspend fun showWords(words: List): FollowSetEvent? { if (words.isEmpty()) return null val blockList = getBlockList() ?: return null - return PeopleListEvent.removeAll( + return FollowSetEvent.removeAll( earlierVersion = blockList, persons = words.map { WordTag(it) }, signer = signer, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip51Lists/hashtagLists/HashtagListDecryptionCache.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip51Lists/hashtagLists/HashtagListDecryptionCache.kt index 6aa9da1171..db80d69a1b 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip51Lists/hashtagLists/HashtagListDecryptionCache.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip51Lists/hashtagLists/HashtagListDecryptionCache.kt @@ -22,15 +22,15 @@ package com.vitorpamplona.amethyst.commons.model.nip51Lists.hashtagLists import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip51Lists.PrivateTagArrayEventCache -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent import com.vitorpamplona.quartz.nip51Lists.hashtagList.hashtagSet class HashtagListDecryptionCache( val signer: NostrSigner, ) { - val cachedPrivateLists = PrivateTagArrayEventCache(signer) + val cachedPrivateLists = PrivateTagArrayEventCache(signer) - fun cachedHashtags(event: HashtagListEvent) = cachedPrivateLists.mergeTagListPrecached(event).hashtagSet() + fun cachedHashtags(event: InterestListEvent) = cachedPrivateLists.mergeTagListPrecached(event).hashtagSet() - suspend fun hashtags(event: HashtagListEvent) = cachedPrivateLists.mergeTagList(event).hashtagSet() + suspend fun hashtags(event: InterestListEvent) = cachedPrivateLists.mergeTagList(event).hashtagSet() } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip51Lists/peopleList/PeopleListDecryptionCache.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip51Lists/peopleList/PeopleListDecryptionCache.kt index e8f1af7638..e31ca57983 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip51Lists/peopleList/PeopleListDecryptionCache.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip51Lists/peopleList/PeopleListDecryptionCache.kt @@ -27,34 +27,34 @@ import com.vitorpamplona.quartz.nip51Lists.muteList.mutedUsers import com.vitorpamplona.quartz.nip51Lists.muteList.mutedUsersAndWords import com.vitorpamplona.quartz.nip51Lists.muteList.mutedWordSet import com.vitorpamplona.quartz.nip51Lists.muteList.mutedWords -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent class PeopleListDecryptionCache( val signer: NostrSigner, ) { - val cachedPrivateLists = PrivateTagArrayEventCache(signer) + val cachedPrivateLists = PrivateTagArrayEventCache(signer) - fun cachedUsersAndWords(event: PeopleListEvent) = cachedPrivateLists.mergeTagListPrecached(event).mutedUsersAndWords() + fun cachedUsersAndWords(event: FollowSetEvent) = cachedPrivateLists.mergeTagListPrecached(event).mutedUsersAndWords() - fun cachedUsers(event: PeopleListEvent) = cachedPrivateLists.mergeTagListPrecached(event).mutedUsers() + fun cachedUsers(event: FollowSetEvent) = cachedPrivateLists.mergeTagListPrecached(event).mutedUsers() - fun cachedUserIdSet(event: PeopleListEvent) = cachedPrivateLists.mergeTagListPrecached(event).mutedUserIdSet() + fun cachedUserIdSet(event: FollowSetEvent) = cachedPrivateLists.mergeTagListPrecached(event).mutedUserIdSet() - fun cachedWords(event: PeopleListEvent) = cachedPrivateLists.mergeTagListPrecached(event).mutedWords() + fun cachedWords(event: FollowSetEvent) = cachedPrivateLists.mergeTagListPrecached(event).mutedWords() - fun cachedWordSet(event: PeopleListEvent) = cachedPrivateLists.mergeTagListPrecached(event).mutedWordSet() + fun cachedWordSet(event: FollowSetEvent) = cachedPrivateLists.mergeTagListPrecached(event).mutedWordSet() - suspend fun usersAndWords(event: PeopleListEvent) = cachedPrivateLists.mergeTagList(event).mutedUsersAndWords() + suspend fun usersAndWords(event: FollowSetEvent) = cachedPrivateLists.mergeTagList(event).mutedUsersAndWords() - suspend fun users(event: PeopleListEvent) = cachedPrivateLists.mergeTagList(event).mutedUsers() + suspend fun users(event: FollowSetEvent) = cachedPrivateLists.mergeTagList(event).mutedUsers() - suspend fun userIdSet(event: PeopleListEvent) = cachedPrivateLists.mergeTagList(event).mutedUserIdSet() + suspend fun userIdSet(event: FollowSetEvent) = cachedPrivateLists.mergeTagList(event).mutedUserIdSet() - suspend fun words(event: PeopleListEvent) = cachedPrivateLists.mergeTagList(event).mutedWords() + suspend fun words(event: FollowSetEvent) = cachedPrivateLists.mergeTagList(event).mutedWords() - suspend fun wordSet(event: PeopleListEvent) = cachedPrivateLists.mergeTagList(event).mutedWordSet() + suspend fun wordSet(event: FollowSetEvent) = cachedPrivateLists.mergeTagList(event).mutedWordSet() - suspend fun privateUsers(event: PeopleListEvent) = cachedPrivateLists.privateTags(event)?.mutedUsers() ?: emptyList() + suspend fun privateUsers(event: FollowSetEvent) = cachedPrivateLists.privateTags(event)?.mutedUsers() ?: emptyList() - suspend fun privateUserIdSet(event: PeopleListEvent) = cachedPrivateLists.privateTags(event)?.mutedUserIdSet() ?: emptySet() + suspend fun privateUserIdSet(event: FollowSetEvent) = cachedPrivateLists.privateTags(event)?.mutedUserIdSet() ?: emptySet() } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip51Lists/relayFeeds/RelayFeedsListDecryptionCache.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip51Lists/relayFeeds/RelayFeedsListDecryptionCache.kt index 3d262d28b9..694897a993 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip51Lists/relayFeeds/RelayFeedsListDecryptionCache.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip51Lists/relayFeeds/RelayFeedsListDecryptionCache.kt @@ -22,8 +22,8 @@ package com.vitorpamplona.amethyst.commons.model.nip51Lists.relayFeeds import com.vitorpamplona.amethyst.commons.model.nip51Lists.relayLists.GenericRelayListCache import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent class RelayFeedsListDecryptionCache( signer: NostrSigner, -) : GenericRelayListCache(signer) +) : GenericRelayListCache(signer) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip85TrustedAssertions/ContactCardDecryptionCache.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip85TrustedAssertions/ContactCardDecryptionCache.kt index e6e5477791..61bb8a3705 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip85TrustedAssertions/ContactCardDecryptionCache.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip85TrustedAssertions/ContactCardDecryptionCache.kt @@ -24,7 +24,7 @@ import com.vitorpamplona.amethyst.commons.model.toImmutableListOfLists import com.vitorpamplona.quartz.nip01Core.core.TagArray import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip51Lists.PrivateTagArrayEventCache -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent import com.vitorpamplona.quartz.nip85TrustedAssertions.users.petName import com.vitorpamplona.quartz.nip85TrustedAssertions.users.summary @@ -37,24 +37,24 @@ import com.vitorpamplona.quartz.nip85TrustedAssertions.users.summary class ContactCardDecryptionCache( val signer: NostrSigner, ) { - val cachedPrivateCards = PrivateTagArrayEventCache(signer, cacheSize = 100) + val cachedPrivateCards = PrivateTagArrayEventCache(signer, cacheSize = 100) - suspend fun petName(event: ContactCardEvent) = cachedPrivateCards.mergeTagList(event).petName() + suspend fun petName(event: UserAssertionEvent) = cachedPrivateCards.mergeTagList(event).petName() - suspend fun summary(event: ContactCardEvent) = cachedPrivateCards.mergeTagList(event).summary() + suspend fun summary(event: UserAssertionEvent) = cachedPrivateCards.mergeTagList(event).summary() /** * The decrypted petname and summary plus the card's full decrypted tag list, * so renderers can resolve the NIP-30 `emoji` mappings stored alongside them. */ - suspend fun nickname(event: ContactCardEvent): Nickname? = cachedPrivateCards.mergeTagList(event).toNickname() + suspend fun nickname(event: UserAssertionEvent): Nickname? = cachedPrivateCards.mergeTagList(event).toNickname() /** * Synchronous variant that only reads an already-decrypted card, for use as * the immediate value of UI flows. Returns null until the suspend path has * decrypted the card once. */ - fun cachedNickname(event: ContactCardEvent): Nickname? = cachedPrivateCards.mergeTagListPrecached(event).toNickname() + fun cachedNickname(event: UserAssertionEvent): Nickname? = cachedPrivateCards.mergeTagListPrecached(event).toNickname() private fun TagArray.toNickname(): Nickname? { val name = petName() diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip85TrustedAssertions/ContactCardsState.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip85TrustedAssertions/ContactCardsState.kt index f643429c5c..ce8635472b 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip85TrustedAssertions/ContactCardsState.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip85TrustedAssertions/ContactCardsState.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.amethyst.commons.model.nip30CustomEmojis.EmojiPackState import com.vitorpamplona.quartz.nip01Core.core.Address import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.IO @@ -59,11 +59,11 @@ class ContactCardsState( ) { private val accountUser: User? by lazy { cache.getOrCreateUser(signer.pubKey) } - fun createCardAddress(target: HexKey): Address = ContactCardEvent.createAddress(signer.pubKey, target) + fun createCardAddress(target: HexKey): Address = UserAssertionEvent.createAddress(signer.pubKey, target) fun getCardNote(target: HexKey): AddressableNote = cache.getOrCreateAddressableNote(createCardAddress(target)) - fun getCard(target: HexKey): ContactCardEvent? = getCardNote(target).event as? ContactCardEvent + fun getCard(target: HexKey): UserAssertionEvent? = getCardNote(target).event as? UserAssertionEvent /** * The account's own card about [target], as attached to the target user's @@ -71,7 +71,7 @@ class ContactCardsState( * per-user cache (like `metadata()` does) so a card arriving later is seen. */ @OptIn(ExperimentalCoroutinesApi::class) - fun myCardFlow(target: User): Flow = + fun myCardFlow(target: User): Flow = target .cards() .receivedCards @@ -82,7 +82,7 @@ class ContactCardsState( ?.flow() ?.metadata ?.stateFlow - ?.map { it.note.event as? ContactCardEvent } + ?.map { it.note.event as? UserAssertionEvent } ?: flowOf(null) } @@ -110,7 +110,7 @@ class ContactCardsState( ?.receivedCards ?.value ?.get(accountUser) - ?.event as? ContactCardEvent ?: return null + ?.event as? UserAssertionEvent ?: return null return decryptionCache.cachedNickname(card) } @@ -145,12 +145,12 @@ class ContactCardsState( target: HexKey, petName: String?, summary: String?, - ): ContactCardEvent { + ): UserAssertionEvent { val emojis = emojiPacks.findEmojiTags(listOfNotNull(petName, summary).joinToString(" ")) val existing = getCard(target) return if (existing != null) { signer.sign( - ContactCardEvent.updatePetNameAndSummary( + UserAssertionEvent.updatePetNameAndSummary( earlierVersion = existing, petName = petName, summary = summary, @@ -159,7 +159,7 @@ class ContactCardsState( ), ) } else { - ContactCardEvent.create( + UserAssertionEvent.create( targetUser = target, petName = petName, summary = summary, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip85TrustedAssertions/UserCardsCache.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip85TrustedAssertions/UserCardsCache.kt index 5077850035..afe53a380b 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip85TrustedAssertions/UserCardsCache.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/nip85TrustedAssertions/UserCardsCache.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.commons.model.User import com.vitorpamplona.amethyst.commons.model.UserDependencies import com.vitorpamplona.amethyst.commons.relays.EOSERelayList import com.vitorpamplona.amethyst.commons.util.PlatformNumberFormatter -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.IO import kotlinx.coroutines.flow.MutableStateFlow @@ -104,7 +104,7 @@ class UserCardsCache : UserDependencies { emit(null) } }.map { - (it?.note?.event as? ContactCardEvent)?.rank() + (it?.note?.event as? UserAssertionEvent)?.rank() }.flowOn(Dispatchers.IO) private val formatter = PlatformNumberFormatter() @@ -132,7 +132,7 @@ class UserCardsCache : UserDependencies { emit(null) } }.map { - val value = (it?.note?.event as? ContactCardEvent)?.followerCount() + val value = (it?.note?.event as? UserAssertionEvent)?.followerCount() if (value != null && value > 0) { formatter.format(value.toLong()) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/privateChats/ChatPreview.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/privateChats/ChatPreview.kt index aa3502cc0b..55d278e140 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/privateChats/ChatPreview.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/privateChats/ChatPreview.kt @@ -22,12 +22,12 @@ package com.vitorpamplona.amethyst.commons.model.privateChats import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.core.HexKey -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent import com.vitorpamplona.quartz.nip51Lists.PrivateReplaceableTagArrayEvent import com.vitorpamplona.quartz.nip51Lists.PrivateTagArrayEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent /** @@ -44,11 +44,11 @@ import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent */ fun Event.hasEncryptedContent(): Boolean = when (this) { - is PrivateDmEvent -> true + is EncryptedDmEvent -> true is DraftWrapEvent -> true - is SealedRumorEvent -> true + is SealEvent -> true is GiftWrapEvent -> true - is LnZapRequestEvent -> isPrivateZap() + is ZapRequestEvent -> isPrivateZap() // Every NIP-51 list keeps its private members as a NIP-44 payload in `content`. The two // base classes cover all ~30 list kinds, present and future, which is the point: naming // them one at a time is how kind 30005 came to print its own ciphertext on screen. @@ -105,7 +105,7 @@ fun chatPreviewOf( if (!canDecrypt) return ChatPreview.Undecryptable // A kind:4 addressed to neither me nor from me can't be opened with my key, ever. - if (event is PrivateDmEvent && myPubKey != null && !event.isIncluded(myPubKey)) { + if (event is EncryptedDmEvent && myPubKey != null && !event.isIncluded(myPubKey)) { return ChatPreview.Undecryptable } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/privateChats/Chatroom.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/privateChats/Chatroom.kt index b197e44971..61c493964c 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/privateChats/Chatroom.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/privateChats/Chatroom.kt @@ -31,7 +31,7 @@ import com.vitorpamplona.amethyst.commons.util.WeakReference import com.vitorpamplona.amethyst.commons.util.withLock import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.client.paging.RelayLoadingCursors -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip14Subject.subject import com.vitorpamplona.quartz.nip17Dm.base.BaseDMGroupEvent import kotlinx.coroutines.channels.BufferOverflow @@ -151,8 +151,8 @@ class Chatroom : NotesGatherer { } else { // Old conversation, keep the last one. sorted.take(1).toSet() - } + sorted.filter { it.flowSet?.isInUse() ?: false } + sorted.filter { it.event !is PrivateDmEvent && it.event !is BaseDMGroupEvent } - // Both DM protocols are pruned by the recency rule above: NIP-04 (PrivateDmEvent) and NIP-17 + } + sorted.filter { it.flowSet?.isInUse() ?: false } + sorted.filter { it.event !is EncryptedDmEvent && it.event !is BaseDMGroupEvent } + // Both DM protocols are pruned by the recency rule above: NIP-04 (EncryptedDmEvent) and NIP-17 // (BaseDMGroupEvent rumors — ChatMessageEvent / file headers). Anything else that ever lands in a // room is kept. The caller realigns the per-relay download window for the dropped messages so // they can be paged again later (see LocalCache.pruneOldMessages + RelayLoadingCursors.rewindTo). diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/topNavFeeds/UsingRelayUnwrapper.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/topNavFeeds/UsingRelayUnwrapper.kt index 195c303fdb..c0824d52d2 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/topNavFeeds/UsingRelayUnwrapper.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/topNavFeeds/UsingRelayUnwrapper.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.commons.model.NoteState import com.vitorpamplona.amethyst.commons.model.cache.ICacheProvider import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent import com.vitorpamplona.quartz.utils.mapOfSet import kotlinx.coroutines.flow.Flow @@ -49,7 +49,7 @@ class UsingRelayUnwrapper { val relays = when (val noteEvent = outboxNote.note.event) { is AdvertisedRelayListEvent -> noteEvent.relaysNorm() - is ChatMessageRelayListEvent -> noteEvent.relays() + is DmRelayListEvent -> noteEvent.relays() else -> emptySet() } @@ -81,7 +81,7 @@ class UsingRelayUnwrapper { users .map { pubkeyHex -> cache - .getOrCreateAddressableNote(ChatMessageRelayListEvent.createAddress(pubkeyHex)) + .getOrCreateAddressableNote(DmRelayListEvent.createAddress(pubkeyHex)) .flow() .metadata.stateFlow.value }.toTypedArray() @@ -100,7 +100,7 @@ class UsingRelayUnwrapper { note.flow().metadata.stateFlow } + users.map { pubkeyHex -> - val note = cache.getOrCreateAddressableNote(ChatMessageRelayListEvent.createAddress(pubkeyHex)) + val note = cache.getOrCreateAddressableNote(DmRelayListEvent.createAddress(pubkeyHex)) note.flow().metadata.stateFlow } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/topNavFeeds/noteBased/NoteFeedFlow.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/topNavFeeds/noteBased/NoteFeedFlow.kt index eaf06a32b7..d48e5704a0 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/topNavFeeds/noteBased/NoteFeedFlow.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/model/topNavFeeds/noteBased/NoteFeedFlow.kt @@ -35,11 +35,11 @@ import com.vitorpamplona.amethyst.commons.model.topNavFeeds.noteBased.muted.Mute import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip51Lists.geohashList.GeohashListEvent -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent import com.vitorpamplona.quartz.nip72ModCommunities.follow.CommunityListEvent import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -61,8 +61,8 @@ class NoteFeedFlow( outboxRelays: Set, ): IFeedTopNavFilter = when (noteEvent) { - is PeopleListEvent -> { - if (noteEvent.dTag() == PeopleListEvent.BLOCK_LIST_D_TAG) { + is FollowSetEvent -> { + if (noteEvent.dTag() == FollowSetEvent.BLOCK_LIST_D_TAG) { MutedAuthorsByOutboxTopNavFilter(caches.peopleListCache.cachedUserIdSet(noteEvent), blockedRelays) } else { AuthorsByOutboxTopNavFilter(caches.peopleListCache.cachedUserIdSet(noteEvent), blockedRelays) @@ -73,7 +73,7 @@ class NoteFeedFlow( MutedAuthorsByOutboxTopNavFilter(caches.muteListCache.cachedUserIdSet(noteEvent), blockedRelays) } - is FollowListEvent -> { + is StarterPackEvent -> { AuthorsByOutboxTopNavFilter(noteEvent.followIdSet(), blockedRelays) } @@ -81,7 +81,7 @@ class NoteFeedFlow( AllCommunitiesTopNavFilter(caches.communityListCache.cachedCommunityIdSet(noteEvent), blockedRelays) } - is HashtagListEvent -> { + is InterestListEvent -> { HashtagTopNavFilter(caches.hashtagCache.cachedHashtags(noteEvent), outboxRelays) } @@ -108,8 +108,8 @@ class NoteFeedFlow( outboxRelays: Set, ) { when (noteEvent) { - is PeopleListEvent -> { - if (noteEvent.dTag() == PeopleListEvent.BLOCK_LIST_D_TAG) { + is FollowSetEvent -> { + if (noteEvent.dTag() == FollowSetEvent.BLOCK_LIST_D_TAG) { emit(MutedAuthorsByOutboxTopNavFilter(caches.peopleListCache.userIdSet(noteEvent), blockedRelays)) } else { emit(AuthorsByOutboxTopNavFilter(caches.peopleListCache.userIdSet(noteEvent), blockedRelays)) @@ -120,7 +120,7 @@ class NoteFeedFlow( emit(MutedAuthorsByOutboxTopNavFilter(caches.muteListCache.mutedUserIdSet(noteEvent), blockedRelays)) } - is FollowListEvent -> { + is StarterPackEvent -> { emit(AuthorsByOutboxTopNavFilter(noteEvent.followIdSet(), blockedRelays)) } @@ -128,7 +128,7 @@ class NoteFeedFlow( emit(AllCommunitiesTopNavFilter(caches.communityListCache.communityIdSet(noteEvent), blockedRelays)) } - is HashtagListEvent -> { + is InterestListEvent -> { emit(HashtagTopNavFilter(caches.hashtagCache.hashtags(noteEvent), outboxRelays)) } @@ -160,8 +160,8 @@ class NoteFeedFlow( proxyRelays: Set, ): IFeedTopNavFilter = when (noteEvent) { - is PeopleListEvent -> { - if (noteEvent.dTag() == PeopleListEvent.BLOCK_LIST_D_TAG) { + is FollowSetEvent -> { + if (noteEvent.dTag() == FollowSetEvent.BLOCK_LIST_D_TAG) { MutedAuthorsByProxyTopNavFilter(caches.peopleListCache.cachedUserIdSet(noteEvent), proxyRelays) } else { AuthorsByProxyTopNavFilter(caches.peopleListCache.cachedUserIdSet(noteEvent), proxyRelays) @@ -172,7 +172,7 @@ class NoteFeedFlow( MutedAuthorsByProxyTopNavFilter(caches.muteListCache.cachedUserIdSet(noteEvent), proxyRelays) } - is FollowListEvent -> { + is StarterPackEvent -> { AuthorsByProxyTopNavFilter(noteEvent.followIdSet(), proxyRelays) } @@ -180,7 +180,7 @@ class NoteFeedFlow( AllCommunitiesTopNavFilter(caches.communityListCache.cachedCommunityIdSet(noteEvent), blockedRelays) } - is HashtagListEvent -> { + is InterestListEvent -> { HashtagTopNavFilter(caches.hashtagCache.cachedHashtags(noteEvent), proxyRelays) } @@ -207,8 +207,8 @@ class NoteFeedFlow( proxyRelays: Set, ) { when (noteEvent) { - is PeopleListEvent -> { - if (noteEvent.dTag() == PeopleListEvent.BLOCK_LIST_D_TAG) { + is FollowSetEvent -> { + if (noteEvent.dTag() == FollowSetEvent.BLOCK_LIST_D_TAG) { emit(MutedAuthorsByProxyTopNavFilter(caches.peopleListCache.userIdSet(noteEvent), proxyRelays)) } else { emit(AuthorsByProxyTopNavFilter(caches.peopleListCache.userIdSet(noteEvent), proxyRelays)) @@ -219,7 +219,7 @@ class NoteFeedFlow( emit(MutedAuthorsByProxyTopNavFilter(caches.muteListCache.mutedUserIdSet(noteEvent), proxyRelays)) } - is FollowListEvent -> { + is StarterPackEvent -> { emit(AuthorsByProxyTopNavFilter(noteEvent.followIdSet(), proxyRelays)) } @@ -227,7 +227,7 @@ class NoteFeedFlow( emit(AllCommunitiesTopNavFilter(caches.communityListCache.communityIdSet(noteEvent), blockedRelays)) } - is HashtagListEvent -> { + is InterestListEvent -> { emit(HashtagTopNavFilter(caches.hashtagCache.hashtags(noteEvent), proxyRelays)) } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/moderation/HashtagSpamCheck.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/moderation/HashtagSpamCheck.kt index d704e81e7a..e72e8201ee 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/moderation/HashtagSpamCheck.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/moderation/HashtagSpamCheck.kt @@ -23,7 +23,7 @@ package com.vitorpamplona.amethyst.commons.moderation import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hasMoreHashtagsThan -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent /** * Pure decision: should this note be collapsed because it abuses hashtag `t` tags? @@ -46,7 +46,7 @@ object HashtagSpamCheck { ): Boolean { if (!enabled) return false if (displayedEvent == null) return false - if (displayedEvent.kind == LongTextNoteEvent.KIND) return false + if (displayedEvent.kind == LongFormContentEvent.KIND) return false if (authorPubkey != null && authorPubkey in exemptKeys) return false return displayedEvent.tags.hasMoreHashtagsThan(threshold) } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/moderation/notifications/NotificationKinds.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/moderation/notifications/NotificationKinds.kt index 1d911cd5bc..1147d8eeaf 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/moderation/notifications/NotificationKinds.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/moderation/notifications/NotificationKinds.kt @@ -23,7 +23,7 @@ package com.vitorpamplona.amethyst.commons.moderation.notifications import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent @@ -32,7 +32,7 @@ import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nip61Nutzaps.nutzap.NutzapEvent import com.vitorpamplona.quartz.nipB1Bolt12Zaps.zap.Bolt12ZapEvent @@ -60,7 +60,7 @@ object NotificationKinds { val SUBSCRIPTION_KINDS: List = listOf( TextNoteEvent.KIND, // 1 — mentions + replies - PrivateDmEvent.KIND, // 4 — NIP-04 legacy DM + EncryptedDmEvent.KIND, // 4 — NIP-04 legacy DM RepostEvent.KIND, // 6 ReactionEvent.KIND, // 7 ChatMessageEvent.KIND, // 14 — NIP-17 DM rumor (rarely arrives raw; gift-wrap is more common) @@ -69,7 +69,7 @@ object NotificationKinds { CommentEvent.KIND, // 1111 — NIP-22 threaded comment GiftWrapEvent.KIND, // 1059 — NIP-17 gift-wrapped DM NutzapEvent.KIND, // 9321 — NIP-61 Cashu nutzap - LnZapEvent.KIND, // 9735 — NIP-57 zap receipt + ZapReceiptEvent.KIND, // 9735 — NIP-57 zap receipt OnchainZapEvent.KIND, // 8333 — onchain zap Bolt12ZapEvent.KIND, // 9736 — NIP-B1 BOLT12 zap // NIP-17 file-header messages (encrypted file DMs) @@ -114,7 +114,7 @@ object NotificationKinds { // Own events never notify — except zap receipts (LnZap/Nutzap/Onchain) // which are signed by the LNURL provider or the payer, not by us. if (event.pubKey == myPubKeyHex && - event !is LnZapEvent && + event !is ZapReceiptEvent && event !is NutzapEvent && event !is OnchainZapEvent && event !is Bolt12ZapEvent diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/napplet/NappletRelayCleartext.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/napplet/NappletRelayCleartext.kt index 9cbee53bd1..8bd8d29085 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/napplet/NappletRelayCleartext.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/napplet/NappletRelayCleartext.kt @@ -24,7 +24,7 @@ import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip04Dm.crypto.EncryptedInfo -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip44Encryption.Nip44v2 /** NAP-RELAY read boundary: encrypted event content is decrypted or withheld, never exposed. */ @@ -56,7 +56,7 @@ object NappletRelayCleartext { } fun isEncrypted(event: Event): Boolean = - event is PrivateDmEvent || + event is EncryptedDmEvent || EncryptedInfo.isNIP04(event.content) || isNip44V2(event.content) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/account/metadata/FilterBasicAccountInfoFromKeys.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/account/metadata/FilterBasicAccountInfoFromKeys.kt index 5244802c74..6026a0bba8 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/account/metadata/FilterBasicAccountInfoFromKeys.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/account/metadata/FilterBasicAccountInfoFromKeys.kt @@ -28,16 +28,16 @@ import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent import com.vitorpamplona.quartz.nip51Lists.geohashList.GeohashListEvent -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent import com.vitorpamplona.quartz.nip51Lists.interestSet.InterestSetEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BlockedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BroadcastRelayListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.ProxyRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.simpleGroupList.SimpleGroupListEvent import com.vitorpamplona.quartz.nip53LiveActivities.nestsServers.NestsServersEvent @@ -51,7 +51,7 @@ val BasicAccountInfoKinds = MetadataEvent.KIND, ContactListEvent.KIND, AdvertisedRelayListEvent.KIND, - ChatMessageRelayListEvent.KIND, + DmRelayListEvent.KIND, KeyPackageRelayListEvent.KIND, SearchRelayListEvent.KIND, FileServersEvent.KIND, @@ -66,10 +66,10 @@ val BasicAccountInfoKinds2 = BroadcastRelayListEvent.KIND, IndexerRelayListEvent.KIND, ProxyRelayListEvent.KIND, - HashtagListEvent.KIND, + InterestListEvent.KIND, GeohashListEvent.KIND, TrustProviderListEvent.KIND, - RelayFeedsListEvent.KIND, + FavoriteRelayListEvent.KIND, InterestSetEvent.KIND, // NIP-51 "simple groups" list (kind 10009), matching the sibling NIP-51 lists above. SimpleGroupListEvent.KIND, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/account/metadata/FilterBookmarksAndReportsFromKey.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/account/metadata/FilterBookmarksAndReportsFromKey.kt index 285fa83cb4..5d4a10c7a8 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/account/metadata/FilterBookmarksAndReportsFromKey.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/account/metadata/FilterBookmarksAndReportsFromKey.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip51Lists.PinListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.OldBookmarkListEvent -import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.LabeledBookmarkListEvent +import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.BookmarkSetEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent import com.vitorpamplona.quartz.nip62RequestToVanish.RequestToVanishEvent @@ -37,7 +37,7 @@ val ReportsAndBookmarksFromKeyKinds = ReportEvent.KIND, BookmarkListEvent.KIND, OldBookmarkListEvent.KIND, - LabeledBookmarkListEvent.KIND, + BookmarkSetEvent.KIND, PinListEvent.KIND, RequestToVanishEvent.KIND, ) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/account/metadata/FilterFollowsAndMutesFromKey.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/account/metadata/FilterFollowsAndMutesFromKey.kt index 1e9840ef13..fc0436f6a0 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/account/metadata/FilterFollowsAndMutesFromKey.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/account/metadata/FilterFollowsAndMutesFromKey.kt @@ -26,24 +26,24 @@ import com.vitorpamplona.quartz.experimental.ephemChat.list.EphemeralChatListEve import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip28PublicChat.list.ChannelListEvent -import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiPackSelectionEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip28PublicChat.list.PublicChatListEvent +import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import com.vitorpamplona.quartz.nip58Badges.accepted.AcceptedBadgeSetEvent import com.vitorpamplona.quartz.nip58Badges.profile.ProfileBadgesEvent val FollowAndMutesFromKeyKinds = listOf( - PeopleListEvent.KIND, - FollowListEvent.KIND, + FollowSetEvent.KIND, + StarterPackEvent.KIND, MuteListEvent.KIND, AcceptedBadgeSetEvent.KIND, ProfileBadgesEvent.KIND, - EmojiPackSelectionEvent.KIND, + EmojiListEvent.KIND, EphemeralChatListEvent.KIND, - ChannelListEvent.KIND, + PublicChatListEvent.KIND, ) fun filterFollowsAndMutesFromKey( diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/account/nip01Notifications/FilterNotificationsToPubkey.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/account/nip01Notifications/FilterNotificationsToPubkey.kt index 9cdd3a11c6..a341e4f78c 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/account/nip01Notifications/FilterNotificationsToPubkey.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/account/nip01Notifications/FilterNotificationsToPubkey.kt @@ -48,12 +48,12 @@ import com.vitorpamplona.quartz.nip34Git.status.GitStatusAppliedEvent import com.vitorpamplona.quartz.nip34Git.status.GitStatusClosedEvent import com.vitorpamplona.quartz.nip34Git.status.GitStatusDraftEvent import com.vitorpamplona.quartz.nip34Git.status.GitStatusOpenEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent import com.vitorpamplona.quartz.nip52Calendar.rsvp.CalendarRSVPEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip58Badges.award.BadgeAwardEvent import com.vitorpamplona.quartz.nip64Chess.challenge.accept.LiveChessGameAcceptEvent import com.vitorpamplona.quartz.nip64Chess.move.LiveChessMoveEvent @@ -79,7 +79,7 @@ val GroupNotificationKinds = PollResponseEvent.KIND, RepostEvent.KIND, GenericRepostEvent.KIND, - LnZapEvent.KIND, + ZapReceiptEvent.KIND, Bolt12ZapEvent.KIND, ReportEvent.KIND, ) @@ -90,7 +90,7 @@ val SummaryKinds = ReactionEvent.KIND, RepostEvent.KIND, GenericRepostEvent.KIND, - LnZapEvent.KIND, + ZapReceiptEvent.KIND, OnchainZapEvent.KIND, Bolt12ZapEvent.KIND, ) @@ -98,7 +98,7 @@ val SummaryKinds = val NotificationsPerKeyKinds = listOf( ReportEvent.KIND, - LnZapPaymentResponseEvent.KIND, + NwcResponseEvent.KIND, ChannelMessageEvent.KIND, EphemeralChatEvent.KIND, BadgeAwardEvent.KIND, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/assemblers/ContactCardFilters.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/assemblers/ContactCardFilters.kt index 87df5fba9c..237c08b2f9 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/assemblers/ContactCardFilters.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/assemblers/ContactCardFilters.kt @@ -26,9 +26,9 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.tags.dTag.DTag -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent -val ContactCardKindList = listOf(ContactCardEvent.KIND) +val ContactCardKindList = listOf(UserAssertionEvent.KIND) /** * Kind:30382 cards *about* [targets], written by [trustedAccounts] (the account diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/calendars/CalendarKinds.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/calendars/CalendarKinds.kt index 80846f47b5..9842410406 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/calendars/CalendarKinds.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/calendars/CalendarKinds.kt @@ -22,7 +22,7 @@ package com.vitorpamplona.amethyst.commons.relayClient.calendars import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import com.vitorpamplona.quartz.nip52Calendar.rsvp.CalendarRSVPEvent // Appointments are the only kinds shown in the main calendar feed/views. RSVPs and @@ -34,6 +34,6 @@ val AllCalendarKinds = listOf( CalendarTimeSlotEvent.KIND, CalendarDateSlotEvent.KIND, - CalendarEvent.KIND, + CalendarCollectionEvent.KIND, CalendarRSVPEvent.KIND, ) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/FilterGoalForLiveActivity.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/FilterGoalForLiveActivity.kt index 66f6929113..2468f528f6 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/FilterGoalForLiveActivity.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/FilterGoalForLiveActivity.kt @@ -25,8 +25,8 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.ExplainedFil import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip75ZapGoals.GoalEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip75ZapGoals.ZapGoalEvent import com.vitorpamplona.quartz.nipB1Bolt12Zaps.zap.Bolt12ZapEvent import com.vitorpamplona.quartz.nipBCOnchainZaps.zap.OnchainZapEvent @@ -50,7 +50,7 @@ fun filterGoalForLiveActivities( filter = ExplainedFilter( purpose = SubPurpose.LIVE_CHAT, - kinds = listOf(GoalEvent.KIND), + kinds = listOf(ZapGoalEvent.KIND), ids = listOf(goalId), limit = 1, ), @@ -60,7 +60,7 @@ fun filterGoalForLiveActivities( filter = ExplainedFilter( purpose = SubPurpose.LIVE_CHAT, - kinds = listOf(LnZapEvent.KIND, OnchainZapEvent.KIND, Bolt12ZapEvent.KIND), + kinds = listOf(ZapReceiptEvent.KIND, OnchainZapEvent.KIND, Bolt12ZapEvent.KIND), tags = mapOf("e" to listOf(goalId)), limit = 200, since = since?.get(relay)?.time, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/FilterMessagesToLiveStream.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/FilterMessagesToLiveStream.kt index a065038175..5ae7424389 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/FilterMessagesToLiveStream.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/FilterMessagesToLiveStream.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.clip.LiveActivitiesClipEvent import com.vitorpamplona.quartz.nip53LiveActivities.raid.LiveActivitiesRaidEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nipB1Bolt12Zaps.zap.Bolt12ZapEvent import com.vitorpamplona.quartz.nipBCOnchainZaps.zap.OnchainZapEvent @@ -47,7 +47,7 @@ fun filterMessagesToLiveActivities( LiveActivitiesChatMessageEvent.KIND, LiveActivitiesRaidEvent.KIND, LiveActivitiesClipEvent.KIND, - LnZapEvent.KIND, + ZapReceiptEvent.KIND, OnchainZapEvent.KIND, Bolt12ZapEvent.KIND, ), diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/relayGroup/RelayGroupFilterBuilders.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/relayGroup/RelayGroupFilterBuilders.kt index 94135ea335..3b3b5226f2 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/relayGroup/RelayGroupFilterBuilders.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/relayGroup/RelayGroupFilterBuilders.kt @@ -55,7 +55,7 @@ import com.vitorpamplona.quartz.buzz.workflow.WorkflowTriggeredEvent import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip29RelayGroups.GroupId @@ -63,8 +63,8 @@ import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupAdminsEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMembersEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMetadataEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupPinnedEvent -import com.vitorpamplona.quartz.nip29RelayGroups.metadata.SupportedRolesEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.DeleteEventEvent +import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupRolesEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupDeleteEventEvent import com.vitorpamplona.quartz.nip29RelayGroups.tags.GroupIdTag import com.vitorpamplona.quartz.nip51Lists.simpleGroupList.GroupTag import com.vitorpamplona.quartz.nip7DThreads.ThreadEvent @@ -89,7 +89,7 @@ val RELAY_GROUP_METADATA_KINDS = GroupMetadataEvent.KIND, GroupAdminsEvent.KIND, GroupMembersEvent.KIND, - SupportedRolesEvent.KIND, + GroupRolesEvent.KIND, ) /** @@ -224,9 +224,9 @@ val RELAY_GROUP_ALL_TIMELINE_KINDS = RELAY_GROUP_TIMELINE_KINDS + BUZZ_RELAY_GRO */ val RELAY_GROUP_AUX_KINDS = listOf( - DeletionEvent.KIND, + DeletionRequestEvent.KIND, ReactionEvent.KIND, - DeleteEventEvent.KIND, + GroupDeleteEventEvent.KIND, ) /** How many aux events a channel replays on subscribe. Bounds the backfill; live delivery is unbounded. */ diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/communities/FilterCommunityPosts.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/communities/FilterCommunityPosts.kt index ef795c5880..fa00fd2524 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/communities/FilterCommunityPosts.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/communities/FilterCommunityPosts.kt @@ -30,7 +30,7 @@ import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent @@ -42,7 +42,7 @@ val CommunityPostKinds = RepostEvent.KIND, GenericRepostEvent.KIND, ClassifiedsEvent.KIND, - LongTextNoteEvent.KIND, + LongFormContentEvent.KIND, CommunityPostApprovalEvent.KIND, AttestationEvent.KIND, ) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/diagnostics/DmRelayDiagnosticsLogger.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/diagnostics/DmRelayDiagnosticsLogger.kt index f1ecab2c10..0eaa25ad91 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/diagnostics/DmRelayDiagnosticsLogger.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/diagnostics/DmRelayDiagnosticsLogger.kt @@ -31,7 +31,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.OkMessage import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.AuthCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.Command import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.EphemeralGiftWrapEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.utils.Log @@ -171,7 +171,7 @@ class DmRelayDiagnosticsLogger( // The kinds a DM-path REQ carries: NIP-17 gift wraps (1059 + 21059) and NIP-04 legacy DMs // (4). Matched exactly against the filter's "kinds" array — never as a substring of the whole // command, since a pubkey hex or timestamp can incidentally contain "1059" or "4". - private val DM_KINDS = setOf(GiftWrapEvent.KIND, EphemeralGiftWrapEvent.KIND, PrivateDmEvent.KIND) + private val DM_KINDS = setOf(GiftWrapEvent.KIND, EphemeralGiftWrapEvent.KIND, EncryptedDmEvent.KIND) private val KINDS_ARRAY = Regex("\"kinds\":\\[([0-9,\\s]*)]") diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByAllCommunities.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByAllCommunities.kt index ff5958375f..bd4233d7fa 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByAllCommunities.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByAllCommunities.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent fun filterLongFormAllCommunities( @@ -47,7 +47,7 @@ fun filterLongFormAllCommunities( tags = mapOf( "a" to communityList, - "k" to listOf(LongTextNoteEvent.KIND.toString()), + "k" to listOf(LongFormContentEvent.KIND.toString()), ), limit = 30, since = since, @@ -60,7 +60,7 @@ fun filterLongFormAllCommunities( ExplainedFilter( purpose = SubPurpose.DISCOVER_FEED, tags = mapOf("k" to listOf("5300"), "a" to communityList), - kinds = listOf(LongTextNoteEvent.KIND), + kinds = listOf(LongFormContentEvent.KIND), limit = 30, since = since, ), diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByAuthors.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByAuthors.kt index e9b4eab6ae..14275756c6 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByAuthors.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByAuthors.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent fun filterLongFormAuthors( relay: NormalizedRelayUrl, @@ -43,7 +43,7 @@ fun filterLongFormAuthors( ExplainedFilter( purpose = SubPurpose.DISCOVER_FEED, authors = authorList, - kinds = listOf(LongTextNoteEvent.KIND), + kinds = listOf(LongFormContentEvent.KIND), limit = 200, since = since, ), diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByCommunity.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByCommunity.kt index a93b476ab0..57a6f6a430 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByCommunity.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByCommunity.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent fun filterLongFormByCommunity( @@ -48,7 +48,7 @@ fun filterLongFormByCommunity( tags = mapOf( "a" to listOf(community), - "k" to listOf(LongTextNoteEvent.KIND.toString()), + "k" to listOf(LongFormContentEvent.KIND.toString()), ), limit = 30, since = since, @@ -62,7 +62,7 @@ fun filterLongFormByCommunity( purpose = SubPurpose.DISCOVER_FEED, authors = authors, tags = mapOf("k" to listOf("5300"), "a" to listOf(community)), - kinds = listOf(LongTextNoteEvent.KIND), + kinds = listOf(LongFormContentEvent.KIND), limit = 30, since = since, ), diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByGeohash.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByGeohash.kt index cd35d75baa..5b86dbcb4e 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByGeohash.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByGeohash.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent fun filterLongFormByGeohash( relay: NormalizedRelayUrl, @@ -44,7 +44,7 @@ fun filterLongFormByGeohash( filter = ExplainedFilter( purpose = SubPurpose.DISCOVER_FEED, - kinds = listOf(LongTextNoteEvent.KIND), + kinds = listOf(LongFormContentEvent.KIND), tags = mapOf("g" to geoHashes), limit = 100, since = since, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByHashtag.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByHashtag.kt index e857cd1b62..adefda859e 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByHashtag.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormByHashtag.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hashtagAlts -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent fun filterLongFormByHashtag( relay: NormalizedRelayUrl, @@ -44,7 +44,7 @@ fun filterLongFormByHashtag( filter = ExplainedFilter( purpose = SubPurpose.DISCOVER_FEED, - kinds = listOf(LongTextNoteEvent.KIND), + kinds = listOf(LongFormContentEvent.KIND), tags = mapOf("t" to hashtags), limit = 200, since = since, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormGlobal.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormGlobal.kt index 67b266a7ab..78219f6a18 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormGlobal.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip23LongForm/FilterLongFormGlobal.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.ExplainedFil import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.utils.TimeUtils fun filterLongFormGlobal( @@ -42,7 +42,7 @@ fun filterLongFormGlobal( filter = ExplainedFilter( purpose = SubPurpose.DISCOVER_FEED, - kinds = listOf(LongTextNoteEvent.KIND), + kinds = listOf(LongFormContentEvent.KIND), limit = 100, since = since, ), diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByAllCommunities.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByAllCommunities.kt index b59a5bec9c..714813a311 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByAllCommunities.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByAllCommunities.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent fun filterFollowSetsAllCommunities( @@ -48,7 +48,7 @@ fun filterFollowSetsAllCommunities( tags = mapOf( "a" to communityList, - "k" to listOf(FollowListEvent.KIND.toString()), + "k" to listOf(StarterPackEvent.KIND.toString()), ), limit = 300, since = since, @@ -61,7 +61,7 @@ fun filterFollowSetsAllCommunities( ExplainedFilter( purpose = SubPurpose.FOLLOW_LISTS, tags = mapOf("k" to listOf("5300"), "a" to communityList), - kinds = listOf(FollowListEvent.KIND), + kinds = listOf(StarterPackEvent.KIND), limit = 300, since = since, ), diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByAuthors.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByAuthors.kt index 0fc3c986d5..bcb5f3d944 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByAuthors.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByAuthors.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent fun filterFollowSetsAuthors( relay: NormalizedRelayUrl, @@ -43,7 +43,7 @@ fun filterFollowSetsAuthors( ExplainedFilter( purpose = SubPurpose.FOLLOW_LISTS, authors = authorList, - kinds = listOf(FollowListEvent.KIND), + kinds = listOf(StarterPackEvent.KIND), limit = 300, since = since, ), diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByCommunity.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByCommunity.kt index 095ab751ed..65483bc063 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByCommunity.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByCommunity.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent fun filterFollowSetsByCommunity( @@ -48,7 +48,7 @@ fun filterFollowSetsByCommunity( tags = mapOf( "a" to listOf(community), - "k" to listOf(FollowListEvent.KIND.toString()), + "k" to listOf(StarterPackEvent.KIND.toString()), ), limit = 300, since = since, @@ -62,7 +62,7 @@ fun filterFollowSetsByCommunity( purpose = SubPurpose.FOLLOW_LISTS, authors = authors, tags = mapOf("k" to listOf("5300"), "a" to listOf(community)), - kinds = listOf(FollowListEvent.KIND), + kinds = listOf(StarterPackEvent.KIND), limit = 300, since = since, ), diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByGeohash.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByGeohash.kt index f671ba36b7..8973d4358d 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByGeohash.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByGeohash.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent fun filterFollowSetsByGeohash( relay: NormalizedRelayUrl, @@ -43,7 +43,7 @@ fun filterFollowSetsByGeohash( filter = ExplainedFilter( purpose = SubPurpose.FOLLOW_LISTS, - kinds = listOf(FollowListEvent.KIND), + kinds = listOf(StarterPackEvent.KIND), tags = mapOf("g" to geoHashes), limit = 300, since = since, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByHashtag.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByHashtag.kt index bc53534f50..21749a61e7 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByHashtag.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsByHashtag.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hashtagAlts -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent fun filterFollowSetsByHashtag( relay: NormalizedRelayUrl, @@ -44,7 +44,7 @@ fun filterFollowSetsByHashtag( filter = ExplainedFilter( purpose = SubPurpose.FOLLOW_LISTS, - kinds = listOf(FollowListEvent.KIND), + kinds = listOf(StarterPackEvent.KIND), tags = mapOf("t" to hashtags), limit = 300, since = since, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsGlobal.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsGlobal.kt index a853b22722..c62c7bf76e 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsGlobal.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/discover/nip51FollowSets/FilterFollowSetsGlobal.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.ExplainedFil import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent fun filterFollowSetsGlobal( relays: GlobalTopNavPerRelayFilterSet, @@ -41,7 +41,7 @@ fun filterFollowSetsGlobal( filter = ExplainedFilter( purpose = SubPurpose.FOLLOW_LISTS, - kinds = listOf(FollowListEvent.KIND), + kinds = listOf(StarterPackEvent.KIND), limit = 100, since = since, ), diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/event/watchers/FilterRepliesAndReactionsToAddresses.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/event/watchers/FilterRepliesAndReactionsToAddresses.kt index 25ad0322a1..0aadb128d6 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/event/watchers/FilterRepliesAndReactionsToAddresses.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/event/watchers/FilterRepliesAndReactionsToAddresses.kt @@ -29,7 +29,7 @@ import com.vitorpamplona.quartz.experimental.videoCollaboration.VideoCollaborati import com.vitorpamplona.quartz.experimental.zapPolls.ZapPollEvent import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent @@ -37,7 +37,7 @@ import com.vitorpamplona.quartz.nip22Comments.CommentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip58Badges.award.BadgeAwardEvent import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent import com.vitorpamplona.quartz.nipB1Bolt12Zaps.zap.Bolt12ZapEvent @@ -51,7 +51,7 @@ val RepliesAndReactionsToAddressesKinds1 = RepostEvent.KIND, GenericRepostEvent.KIND, ReportEvent.KIND, - LnZapEvent.KIND, + ZapReceiptEvent.KIND, Bolt12ZapEvent.KIND, ZapPollEvent.KIND, CommentEvent.KIND, @@ -88,7 +88,7 @@ val RootScopedRepliesToAddressesKinds = val DeletionKindList = listOf( - DeletionEvent.KIND, + DeletionRequestEvent.KIND, ) val TextNoteKindList = listOf(TextNoteEvent.KIND) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/event/watchers/FilterRepliesAndReactionsToNotes.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/event/watchers/FilterRepliesAndReactionsToNotes.kt index 11c723a879..ea59b16521 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/event/watchers/FilterRepliesAndReactionsToNotes.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/event/watchers/FilterRepliesAndReactionsToNotes.kt @@ -32,7 +32,7 @@ import com.vitorpamplona.quartz.experimental.zapPolls.ZapPollEvent import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip03Timestamp.OtsEvent -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent @@ -46,11 +46,11 @@ import com.vitorpamplona.quartz.nip34Git.status.GitStatusDraftEvent import com.vitorpamplona.quartz.nip34Git.status.GitStatusOpenEvent import com.vitorpamplona.quartz.nip35Torrents.TorrentCommentEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip88Polls.response.PollResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.NIP90ContentDiscoveryResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.status.NIP90StatusEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.DvmContentDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.status.DvmStatusEvent import com.vitorpamplona.quartz.nipB1Bolt12Zaps.zap.Bolt12ZapEvent import com.vitorpamplona.quartz.nipBCOnchainZaps.zap.OnchainZapEvent import com.vitorpamplona.quartz.utils.mapOfSet @@ -62,7 +62,7 @@ val RepliesAndReactionsKinds = RepostEvent.KIND, GenericRepostEvent.KIND, ReportEvent.KIND, - LnZapEvent.KIND, + ZapReceiptEvent.KIND, OnchainZapEvent.KIND, Bolt12ZapEvent.KIND, OtsEvent.KIND, @@ -89,9 +89,9 @@ val RootScopedRepliesKinds = val RepliesAndReactionsKinds2 = listOf( - DeletionEvent.KIND, - NIP90ContentDiscoveryResponseEvent.KIND, - NIP90StatusEvent.KIND, + DeletionRequestEvent.KIND, + DvmContentDiscoveryResponseEvent.KIND, + DvmStatusEvent.KIND, TorrentCommentEvent.KIND, GitReplyEvent.KIND, // NIP-34 status events (1630/1631/1632/1633). Rooted at the target diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/geohash/FilterPostsByGeohash.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/geohash/FilterPostsByGeohash.kt index 102d73791a..63bf3ed5bc 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/geohash/FilterPostsByGeohash.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/geohash/FilterPostsByGeohash.kt @@ -34,9 +34,9 @@ import com.vitorpamplona.quartz.experimental.zapPolls.ZapPollEvent import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip73ExternalIds.location.GeohashId import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent @@ -49,7 +49,7 @@ val PostsByGeohashKinds = listOf( TextNoteEvent.KIND, ChannelMessageEvent.KIND, - LongTextNoteEvent.KIND, + LongFormContentEvent.KIND, PollEvent.KIND, ZapPollEvent.KIND, ClassifiedsEvent.KIND, @@ -60,7 +60,7 @@ val PostsByGeohashKinds = MusicPlaylistEvent.KIND, PodcastEpisodeEvent.KIND, PodcastMetadataEvent.KIND, - WikiNoteEvent.KIND, + WikiArticleEvent.KIND, RoadEventReportEvent.KIND, RoadEventConfirmationEvent.KIND, GeocacheListingEvent.KIND, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip01Core/FilterHomePostsByGeohashes.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip01Core/FilterHomePostsByGeohashes.kt index 90bdc83585..ed72bcacfb 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip01Core/FilterHomePostsByGeohashes.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip01Core/FilterHomePostsByGeohashes.kt @@ -33,13 +33,13 @@ import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent import com.vitorpamplona.quartz.nipA0VoiceMessages.VoiceEvent @@ -49,10 +49,10 @@ val HomePostsByGeohashKinds = TextNoteEvent.KIND, RepostEvent.KIND, GenericRepostEvent.KIND, - LongTextNoteEvent.KIND, + LongFormContentEvent.KIND, ClassifiedsEvent.KIND, HighlightEvent.KIND, - WikiNoteEvent.KIND, + WikiArticleEvent.KIND, CommentEvent.KIND, VoiceEvent.KIND, AttestationEvent.KIND, @@ -60,8 +60,8 @@ val HomePostsByGeohashKinds = PictureEvent.KIND, VideoNormalEvent.KIND, VideoShortEvent.KIND, - VideoHorizontalEvent.KIND, - VideoVerticalEvent.KIND, + AddressableNormalVideoEvent.KIND, + AddressableShortVideoEvent.KIND, ) fun filterHomePostsByGeohashes( diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip01Core/FilterHomePostsByHashtags.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip01Core/FilterHomePostsByHashtags.kt index 6983457805..ee76335ea9 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip01Core/FilterHomePostsByHashtags.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip01Core/FilterHomePostsByHashtags.kt @@ -36,13 +36,13 @@ import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent import com.vitorpamplona.quartz.nipA0VoiceMessages.VoiceEvent @@ -52,12 +52,12 @@ val HomePostsBuHashtagsKinds = TextNoteEvent.KIND, RepostEvent.KIND, GenericRepostEvent.KIND, - LongTextNoteEvent.KIND, + LongFormContentEvent.KIND, ClassifiedsEvent.KIND, HighlightEvent.KIND, AudioHeaderEvent.KIND, CommentEvent.KIND, - WikiNoteEvent.KIND, + WikiArticleEvent.KIND, NipTextEvent.KIND, VoiceEvent.KIND, AttestationEvent.KIND, @@ -65,8 +65,8 @@ val HomePostsBuHashtagsKinds = PictureEvent.KIND, VideoNormalEvent.KIND, VideoShortEvent.KIND, - VideoHorizontalEvent.KIND, - VideoVerticalEvent.KIND, + AddressableNormalVideoEvent.KIND, + AddressableShortVideoEvent.KIND, ) fun filterHomePostsByHashtags( diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip65Follows/FilterHomePostsByAuthors.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip65Follows/FilterHomePostsByAuthors.kt index d7daaa94c4..e9d27d4d9f 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip65Follows/FilterHomePostsByAuthors.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip65Follows/FilterHomePostsByAuthors.kt @@ -40,19 +40,19 @@ import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip35Torrents.TorrentEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip64Chess.challenge.offer.LiveChessGameChallengeEvent import com.vitorpamplona.quartz.nip64Chess.end.LiveChessGameEndEvent import com.vitorpamplona.quartz.nip64Chess.game.ChessGameEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip88Polls.response.PollResponseEvent @@ -67,18 +67,18 @@ val HomePostsNewThreadKinds1 = RepostEvent.KIND, GenericRepostEvent.KIND, ClassifiedsEvent.KIND, - LongTextNoteEvent.KIND, + LongFormContentEvent.KIND, HighlightEvent.KIND, ZapPollEvent.KIND, PollEvent.KIND, - WikiNoteEvent.KIND, + WikiArticleEvent.KIND, AttestationEvent.KIND, NipTextEvent.KIND, PictureEvent.KIND, VideoNormalEvent.KIND, VideoShortEvent.KIND, - VideoHorizontalEvent.KIND, - VideoVerticalEvent.KIND, + AddressableNormalVideoEvent.KIND, + AddressableShortVideoEvent.KIND, ) val HomePostsNewThreadKinds2 = diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip72Communities/FilterHomePostsFromCommunities.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip72Communities/FilterHomePostsFromCommunities.kt index 096432af97..64e9a2f66d 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip72Communities/FilterHomePostsFromCommunities.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip72Communities/FilterHomePostsFromCommunities.kt @@ -30,13 +30,13 @@ import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent @@ -45,11 +45,11 @@ import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent val HomePostsFromCommunityKinds = listOf( TextNoteEvent.KIND, - LongTextNoteEvent.KIND, + LongFormContentEvent.KIND, ClassifiedsEvent.KIND, HighlightEvent.KIND, PollEvent.KIND, - WikiNoteEvent.KIND, + WikiArticleEvent.KIND, NipTextEvent.KIND, CommunityPostApprovalEvent.KIND, CommentEvent.KIND, @@ -57,8 +57,8 @@ val HomePostsFromCommunityKinds = PictureEvent.KIND, VideoNormalEvent.KIND, VideoShortEvent.KIND, - VideoHorizontalEvent.KIND, - VideoVerticalEvent.KIND, + AddressableNormalVideoEvent.KIND, + AddressableShortVideoEvent.KIND, ) /** The same set, as the `k` tag values a NIP-72 post approval carries. */ diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip90AlgoFeeds/FilterHomePostsByAlgoFeedIds.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip90AlgoFeeds/FilterHomePostsByAlgoFeedIds.kt index d8dbc554ab..6f575ea96d 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip90AlgoFeeds/FilterHomePostsByAlgoFeedIds.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip90AlgoFeeds/FilterHomePostsByAlgoFeedIds.kt @@ -28,8 +28,8 @@ import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.NIP90ContentDiscoveryResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.status.NIP90StatusEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.DvmContentDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.status.DvmStatusEvent /** * Builds relay REQ filters for a favorite-DVM home feed. @@ -112,8 +112,8 @@ private fun responseListenFilter( purpose = SubPurpose.HOME_FEED, kinds = listOf( - NIP90ContentDiscoveryResponseEvent.KIND, - NIP90StatusEvent.KIND, + DvmContentDiscoveryResponseEvent.KIND, + DvmStatusEvent.KIND, ), tags = mapOf("e" to requestIds), limit = 10 * requestIds.size, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsByAllCommunities.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsByAllCommunities.kt index c8b32bae95..f6461946c2 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsByAllCommunities.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsByAllCommunities.kt @@ -27,20 +27,20 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent val LongsFromCommunityKinds = listOf( VideoNormalEvent.KIND, - VideoHorizontalEvent.KIND, + AddressableNormalVideoEvent.KIND, ) val LongsFromCommunityKindsStr = listOf( VideoNormalEvent.KIND.toString(), - VideoHorizontalEvent.KIND.toString(), + AddressableNormalVideoEvent.KIND.toString(), ) fun filterLongsFromAllCommunities( diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsByAuthors.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsByAuthors.kt index 2c365f4fbd..179349b97b 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsByAuthors.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsByAuthors.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent fun filterLongsByAuthors( @@ -44,7 +44,7 @@ fun filterLongsByAuthors( ExplainedFilter( purpose = SubPurpose.MEDIA_FEED, authors = authorList, - kinds = listOf(VideoNormalEvent.KIND, VideoHorizontalEvent.KIND), + kinds = listOf(VideoNormalEvent.KIND, AddressableNormalVideoEvent.KIND), limit = 200, since = since, ), diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsByGeohashes.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsByGeohashes.kt index 8cf5096e02..9c0d605be8 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsByGeohashes.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsByGeohashes.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent fun filterLongsByGeohashes( @@ -42,7 +42,7 @@ fun filterLongsByGeohashes( filter = ExplainedFilter( purpose = SubPurpose.MEDIA_FEED, - kinds = listOf(VideoNormalEvent.KIND, VideoHorizontalEvent.KIND), + kinds = listOf(VideoNormalEvent.KIND, AddressableNormalVideoEvent.KIND), tags = mapOf("g" to geotags.sorted()), limit = 100, since = since, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsByHashtag.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsByHashtag.kt index 85e2eee01b..956bd69436 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsByHashtag.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsByHashtag.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent fun filterLongsByHashtag( @@ -40,7 +40,7 @@ fun filterLongsByHashtag( filter = ExplainedFilter( purpose = SubPurpose.MEDIA_FEED, - kinds = listOf(VideoNormalEvent.KIND, VideoHorizontalEvent.KIND), + kinds = listOf(VideoNormalEvent.KIND, AddressableNormalVideoEvent.KIND), tags = mapOf("t" to hashtags.toList()), limit = 200, since = since, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsGlobal.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsGlobal.kt index c538f86362..e9378496a7 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsGlobal.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/longs/FilterLongsGlobal.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.ExplainedFil import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.utils.TimeUtils @@ -43,7 +43,7 @@ fun filterLongsGlobal( filter = ExplainedFilter( purpose = SubPurpose.MEDIA_FEED, - kinds = listOf(VideoNormalEvent.KIND, VideoHorizontalEvent.KIND), + kinds = listOf(VideoNormalEvent.KIND, AddressableNormalVideoEvent.KIND), limit = 200, since = since, ), diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/nip17Dm/GiftWrapDecryptor.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/nip17Dm/GiftWrapDecryptor.kt index cf19417ca5..4b9d7a8bc4 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/nip17Dm/GiftWrapDecryptor.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/nip17Dm/GiftWrapDecryptor.kt @@ -22,25 +22,25 @@ package com.vitorpamplona.amethyst.commons.relayClient.nip17Dm import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent /** * Fully decrypt a NIP-59 gift wrap down to the inner rumor. * * A gift wrap carries two encryption layers: - * kind:1059 [GiftWrapEvent] → kind:13 [SealedRumorEvent] → the rumor. + * kind:1059 [GiftWrapEvent] → kind:13 [SealEvent] → the rumor. * * [GiftWrapEvent.unwrapOrNull] peels only the outer layer. Every non-Android * consumer that looks at the rumor directly (the CLI's `dm list`, the desktop * chat receive path, the Marmot welcome ingest in commons) needs both peels. * - * If the inner content isn't a [SealedRumorEvent] (malformed, or a future + * If the inner content isn't a [SealEvent] (malformed, or a future * NIP-59 variant that wraps a rumor directly), the outer unwrap result is * returned as-is so callers can still route on kind. Either unwrap returning * null propagates as null. */ suspend fun GiftWrapEvent.unwrapAndUnsealOrNull(signer: NostrSigner): Event? { val inner = unwrapOrNull(signer) ?: return null - return if (inner is SealedRumorEvent) inner.unsealOrNull(signer) else inner + return if (inner is SealEvent) inner.unsealOrNull(signer) else inner } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/nip47WalletConnect/FilterNWCPaymentsFromRequests.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/nip47WalletConnect/FilterNWCPaymentsFromRequests.kt index 815746628b..b4a468d7b2 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/nip47WalletConnect/FilterNWCPaymentsFromRequests.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/nip47WalletConnect/FilterNWCPaymentsFromRequests.kt @@ -22,7 +22,7 @@ package com.vitorpamplona.amethyst.commons.relayClient.nip47WalletConnect import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent // The request event id (#e) is a unique 32-byte identifier — sufficient on // its own to match a spec-compliant kind-23195 response. We deliberately keep @@ -43,7 +43,7 @@ fun filterNWCPaymentsFromRequests( fromUsers: Set, ): Filter = Filter( - kinds = listOf(LnZapPaymentResponseEvent.KIND), + kinds = listOf(NwcResponseEvent.KIND), tags = mapOf( "e" to paymentRequests.sorted(), diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/profile/FilterUserProfileLists.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/profile/FilterUserProfileLists.kt index 022f5cb712..1ebb50c63b 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/profile/FilterUserProfileLists.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/profile/FilterUserProfileLists.kt @@ -29,9 +29,9 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip51Lists.PinListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.OldBookmarkListEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import com.vitorpamplona.quartz.nip89AppHandlers.recommendation.AppRecommendationEvent val UserProfileListKinds = @@ -39,9 +39,9 @@ val UserProfileListKinds = BookmarkListEvent.KIND, OldBookmarkListEvent.KIND, PinListEvent.KIND, - PeopleListEvent.KIND, - FollowListEvent.KIND, - HashtagListEvent.KIND, + FollowSetEvent.KIND, + StarterPackEvent.KIND, + InterestListEvent.KIND, AppRecommendationEvent.KIND, PaymentTargetsEvent.KIND, ) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/profile/FilterUserProfileMedia.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/profile/FilterUserProfileMedia.kt index 5d689fbb15..46d26ab82c 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/profile/FilterUserProfileMedia.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/profile/FilterUserProfileMedia.kt @@ -29,17 +29,17 @@ import com.vitorpamplona.quartz.experimental.profileGallery.ProfileGalleryEntryE import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip53LiveActivities.clip.LiveActivitiesClipEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent val UserProfileMediaKinds = listOf( PictureEvent.KIND, ProfileGalleryEntryEvent.KIND, - VideoVerticalEvent.KIND, - VideoHorizontalEvent.KIND, + AddressableShortVideoEvent.KIND, + AddressableNormalVideoEvent.KIND, VideoNormalEvent.KIND, VideoShortEvent.KIND, ) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/profile/FilterUserProfilePosts.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/profile/FilterUserProfilePosts.kt index a00b67bce8..ef9fe01388 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/profile/FilterUserProfilePosts.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/profile/FilterUserProfilePosts.kt @@ -40,11 +40,11 @@ import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip35Torrents.TorrentCommentEvent import com.vitorpamplona.quartz.nip35Torrents.TorrentEvent import com.vitorpamplona.quartz.nip51Lists.PinListEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip5aStaticWebsites.NamedSiteEvent import com.vitorpamplona.quartz.nip5aStaticWebsites.RootSiteEvent import com.vitorpamplona.quartz.nip5dNapplets.NamedNappletEvent @@ -60,10 +60,10 @@ val UserProfilePostKinds1 = TextNoteEvent.KIND, GenericRepostEvent.KIND, RepostEvent.KIND, - LongTextNoteEvent.KIND, + LongFormContentEvent.KIND, PollEvent.KIND, HighlightEvent.KIND, - WikiNoteEvent.KIND, + WikiArticleEvent.KIND, VoiceEvent.KIND, PublicMessageEvent.KIND, ) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/profile/FilterUserProfileZapReceived.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/profile/FilterUserProfileZapReceived.kt index 8d5ab4790b..af26c39476 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/profile/FilterUserProfileZapReceived.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/profile/FilterUserProfileZapReceived.kt @@ -26,11 +26,11 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.ExplainedFil import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nipB1Bolt12Zaps.zap.Bolt12ZapEvent import com.vitorpamplona.quartz.nipBCOnchainZaps.zap.OnchainZapEvent -val UserProfileZapReceiverKinds = listOf(LnZapEvent.KIND, OnchainZapEvent.KIND, Bolt12ZapEvent.KIND) +val UserProfileZapReceiverKinds = listOf(ZapReceiptEvent.KIND, OnchainZapEvent.KIND, Bolt12ZapEvent.KIND) fun filterUserProfileZapsReceived( cache: ICacheProvider, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/relay/FilterPostsByRelay.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/relay/FilterPostsByRelay.kt index becd8b7779..a6fc642406 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/relay/FilterPostsByRelay.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/relay/FilterPostsByRelay.kt @@ -34,10 +34,10 @@ import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent @@ -48,12 +48,12 @@ val PostsByRelayKinds = listOf( TextNoteEvent.KIND, ChannelMessageEvent.KIND, - LongTextNoteEvent.KIND, + LongFormContentEvent.KIND, PollEvent.KIND, LiveActivitiesChatMessageEvent.KIND, ClassifiedsEvent.KIND, HighlightEvent.KIND, - WikiNoteEvent.KIND, + WikiArticleEvent.KIND, CommentEvent.KIND, ) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsByAllCommunities.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsByAllCommunities.kt index 18bcd8b0fa..9d420b8e6d 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsByAllCommunities.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsByAllCommunities.kt @@ -27,20 +27,20 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent val ShortsFromCommunityKinds = listOf( VideoShortEvent.KIND, - VideoVerticalEvent.KIND, + AddressableShortVideoEvent.KIND, ) val ShortsFromCommunityKindsStr = listOf( VideoShortEvent.KIND.toString(), - VideoVerticalEvent.KIND.toString(), + AddressableShortVideoEvent.KIND.toString(), ) fun filterShortsFromAllCommunities( diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsByAuthors.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsByAuthors.kt index 24bca3c574..e671e6a37f 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsByAuthors.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsByAuthors.kt @@ -28,8 +28,8 @@ import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent fun filterShortsByAuthors( relay: NormalizedRelayUrl, @@ -44,7 +44,7 @@ fun filterShortsByAuthors( ExplainedFilter( purpose = SubPurpose.MEDIA_FEED, authors = authorList, - kinds = listOf(VideoShortEvent.KIND, VideoVerticalEvent.KIND), + kinds = listOf(VideoShortEvent.KIND, AddressableShortVideoEvent.KIND), limit = 200, since = since, ), diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsByGeohashes.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsByGeohashes.kt index c9afffb742..36345aa08e 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsByGeohashes.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsByGeohashes.kt @@ -26,8 +26,8 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent fun filterShortsByGeohashes( relay: NormalizedRelayUrl, @@ -42,7 +42,7 @@ fun filterShortsByGeohashes( filter = ExplainedFilter( purpose = SubPurpose.MEDIA_FEED, - kinds = listOf(VideoShortEvent.KIND, VideoVerticalEvent.KIND), + kinds = listOf(VideoShortEvent.KIND, AddressableShortVideoEvent.KIND), tags = mapOf("g" to geotags.sorted()), limit = 100, since = since, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsByHashtag.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsByHashtag.kt index dfe7382fe8..16cb6c6dcb 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsByHashtag.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsByHashtag.kt @@ -26,8 +26,8 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent fun filterShortsByHashtag( relay: NormalizedRelayUrl, @@ -40,7 +40,7 @@ fun filterShortsByHashtag( filter = ExplainedFilter( purpose = SubPurpose.MEDIA_FEED, - kinds = listOf(VideoShortEvent.KIND, VideoVerticalEvent.KIND), + kinds = listOf(VideoShortEvent.KIND, AddressableShortVideoEvent.KIND), tags = mapOf("t" to hashtags.toList()), limit = 200, since = since, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsGlobal.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsGlobal.kt index ee0c14a2b1..ece2a170e2 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsGlobal.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/shorts/FilterShortsGlobal.kt @@ -25,8 +25,8 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.ExplainedFil import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.utils.TimeUtils fun filterShortsGlobal( @@ -43,7 +43,7 @@ fun filterShortsGlobal( filter = ExplainedFilter( purpose = SubPurpose.MEDIA_FEED, - kinds = listOf(VideoShortEvent.KIND, VideoVerticalEvent.KIND), + kinds = listOf(VideoShortEvent.KIND, AddressableShortVideoEvent.KIND), limit = 200, since = since, ), diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/softwareapps/FilterSoftwareAppsByAuthors.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/softwareapps/FilterSoftwareAppsByAuthors.kt index 5eda45cb9b..1483c10824 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/softwareapps/FilterSoftwareAppsByAuthors.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/softwareapps/FilterSoftwareAppsByAuthors.kt @@ -26,10 +26,10 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.ExplainedFil import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.application.SoftwareApplicationEvent -import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.SoftwareReleaseEvent import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl +import com.vitorpamplona.quartz.nip51Lists.releaseArtifactSet.ReleaseArtifactSetEvent fun filterSoftwareAppsByAuthors( relay: NormalizedRelayUrl, @@ -44,7 +44,7 @@ fun filterSoftwareAppsByAuthors( ExplainedFilter( purpose = SubPurpose.ADD_ONS, authors = authorList, - kinds = listOf(SoftwareApplicationEvent.KIND, SoftwareReleaseEvent.KIND), + kinds = listOf(SoftwareApplicationEvent.KIND, ReleaseArtifactSetEvent.KIND), limit = 200, since = since, ), diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/softwareapps/FilterSoftwareAppsByHashtag.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/softwareapps/FilterSoftwareAppsByHashtag.kt index 638eee590e..00ff7c3723 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/softwareapps/FilterSoftwareAppsByHashtag.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/softwareapps/FilterSoftwareAppsByHashtag.kt @@ -25,10 +25,10 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.ExplainedFil import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.application.SoftwareApplicationEvent -import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.SoftwareReleaseEvent import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hashtagAlts +import com.vitorpamplona.quartz.nip51Lists.releaseArtifactSet.ReleaseArtifactSetEvent fun filterSoftwareAppsByHashtag( relay: NormalizedRelayUrl, @@ -45,7 +45,7 @@ fun filterSoftwareAppsByHashtag( filter = ExplainedFilter( purpose = SubPurpose.TAG_FEED, - kinds = listOf(SoftwareApplicationEvent.KIND, SoftwareReleaseEvent.KIND), + kinds = listOf(SoftwareApplicationEvent.KIND, ReleaseArtifactSetEvent.KIND), tags = mapOf("t" to expanded), limit = 200, since = since, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/softwareapps/FilterSoftwareAppsGlobal.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/softwareapps/FilterSoftwareAppsGlobal.kt index ed54dbf12d..c72a5c6ac1 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/softwareapps/FilterSoftwareAppsGlobal.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/softwareapps/FilterSoftwareAppsGlobal.kt @@ -25,10 +25,10 @@ import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.ExplainedFil import com.vitorpamplona.amethyst.commons.relayClient.subscriptions.SubPurpose import com.vitorpamplona.amethyst.commons.relays.SincePerRelayMap import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.application.SoftwareApplicationEvent -import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.SoftwareReleaseEvent import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.normalizeRelayUrl +import com.vitorpamplona.quartz.nip51Lists.releaseArtifactSet.ReleaseArtifactSetEvent // zapstore's relay indexes the entire software-app catalog (NIP-82), so the // global Apps feed always queries it in addition to the user's own relays — @@ -57,7 +57,7 @@ fun filterSoftwareAppsGlobal( filter = ExplainedFilter( purpose = SubPurpose.ADD_ONS, - kinds = listOf(SoftwareApplicationEvent.KIND, SoftwareReleaseEvent.KIND), + kinds = listOf(SoftwareApplicationEvent.KIND, ReleaseArtifactSetEvent.KIND), // Keep the limit < 100. Relays such as zapstore's score filter // specificity and treat a limit >= 100 (or none) as too vague, // rejecting the whole REQ with "filters are too vague". diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/user/watchers/FilterUserMetadataForKey.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/user/watchers/FilterUserMetadataForKey.kt index db874ab832..0d1290113d 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/user/watchers/FilterUserMetadataForKey.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/user/watchers/FilterUserMetadataForKey.kt @@ -32,8 +32,8 @@ import com.vitorpamplona.quartz.nip01Core.hints.HintIndexer import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent -import com.vitorpamplona.quartz.nip38UserStatus.StatusEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent +import com.vitorpamplona.quartz.nip38UserStatus.UserStatusEvent import com.vitorpamplona.quartz.nip39ExtIdentities.ExternalIdentitiesEvent import com.vitorpamplona.quartz.nip61Nutzaps.info.NutzapInfoEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent @@ -44,9 +44,9 @@ val UserMetadataForKeyKinds = listOf( MetadataEvent.KIND, ExternalIdentitiesEvent.KIND, - StatusEvent.KIND, + UserStatusEvent.KIND, AdvertisedRelayListEvent.KIND, - ChatMessageRelayListEvent.KIND, + DmRelayListEvent.KIND, KeyPackageRelayListEvent.KIND, PaymentTargetsEvent.KIND, Bolt12OfferListEvent.KIND, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/video/FeedBasis.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/video/FeedBasis.kt index a6d9bd3de3..17c4b31bdb 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/video/FeedBasis.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/video/FeedBasis.kt @@ -22,11 +22,11 @@ package com.vitorpamplona.amethyst.commons.relayClient.video import com.vitorpamplona.quartz.experimental.nip95.header.FileStorageHeaderEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent // The media types the video/shorts feeds will admit. HLS playlists are in here because a // blossom-hosted manifest is `https://host/` with no extension at all, so the MIME is the @@ -57,8 +57,8 @@ val SUPPORTED_VIDEO_FEED_MIME_TYPES_SET = SUPPORTED_VIDEO_FEED_MIME_TYPES.toSet( val PictureAndVideoKinds = listOf( PictureEvent.KIND, - VideoHorizontalEvent.KIND, - VideoVerticalEvent.KIND, + AddressableNormalVideoEvent.KIND, + AddressableShortVideoEvent.KIND, VideoNormalEvent.KIND, VideoShortEvent.KIND, ) @@ -66,12 +66,12 @@ val PictureAndVideoKinds = val PictureAndVideoKTags = listOf( PictureEvent.KIND.toString(), - VideoHorizontalEvent.KIND.toString(), - VideoVerticalEvent.KIND.toString(), + AddressableNormalVideoEvent.KIND.toString(), + AddressableShortVideoEvent.KIND.toString(), VideoNormalEvent.KIND.toString(), VideoShortEvent.KIND.toString(), ) -val PictureAndVideoLegacyKinds = listOf(FileHeaderEvent.KIND, FileStorageHeaderEvent.KIND) -val PictureAndVideoLegacyKTags = listOf(FileHeaderEvent.KIND.toString(), FileStorageHeaderEvent.KIND.toString()) +val PictureAndVideoLegacyKinds = listOf(FileMetadataEvent.KIND, FileStorageHeaderEvent.KIND) +val PictureAndVideoLegacyKTags = listOf(FileMetadataEvent.KIND.toString(), FileStorageHeaderEvent.KIND.toString()) val LegacyMimeTypes = SUPPORTED_VIDEO_FEED_MIME_TYPES val LegacyMimeTypeMap = mapOf("m" to LegacyMimeTypes) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/video/nip72Communities/FilterPictureAndVideoByAllCommunities.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/video/nip72Communities/FilterPictureAndVideoByAllCommunities.kt index 530b8a2d2c..81bebc33d5 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/video/nip72Communities/FilterPictureAndVideoByAllCommunities.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/relayClient/video/nip72Communities/FilterPictureAndVideoByAllCommunities.kt @@ -32,7 +32,7 @@ import com.vitorpamplona.quartz.experimental.nip95.header.FileStorageHeaderEvent import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent fun filterPictureAndVideoAllCommunities( relay: NormalizedRelayUrl, @@ -80,7 +80,7 @@ fun filterPictureAndVideoAllCommunities( tags = mapOf( "a" to communityList, - "k" to listOf(FileHeaderEvent.KIND.toString(), FileStorageHeaderEvent.KIND.toString()), + "k" to listOf(FileMetadataEvent.KIND.toString(), FileStorageHeaderEvent.KIND.toString()), ), limit = 200, since = since, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/search/KindRegistry.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/search/KindRegistry.kt index 6a61907b8c..34b7ce090f 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/search/KindRegistry.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/search/KindRegistry.kt @@ -27,29 +27,29 @@ import com.vitorpamplona.quartz.experimental.music.track.MusicTrackEvent import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.application.SoftwareApplicationEvent import com.vitorpamplona.quartz.experimental.zapPolls.ZapPollEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMetadataEvent import com.vitorpamplona.quartz.nip30CustomEmoji.pack.EmojiPackEvent import com.vitorpamplona.quartz.nip34Git.repository.GitRepositoryEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingRoomEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingSpaceEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip58Badges.definition.BadgeDefinitionEvent import com.vitorpamplona.quartz.nip5aStaticWebsites.NamedSiteEvent import com.vitorpamplona.quartz.nip5aStaticWebsites.RootSiteEvent import com.vitorpamplona.quartz.nip5dNapplets.NamedNappletEvent import com.vitorpamplona.quartz.nip5dNapplets.RootNappletEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent @@ -93,7 +93,7 @@ object KindRegistry { val aliases: Map> = mapOf( "note" to listOf(TextNoteEvent.KIND), - "article" to listOf(LongTextNoteEvent.KIND), + "article" to listOf(LongFormContentEvent.KIND), // No `repost` or `profile` here on purpose: both name kinds in // [RenderableKinds.NEVER_IN_RESULTS], so the chip drew and the list stayed empty // forever. `kind:profile` was the worse of the two — it pinned the scope to Notes, @@ -101,7 +101,7 @@ object KindRegistry { "channel" to listOf(ChannelCreateEvent.KIND, ChannelMetadataEvent.KIND), "live" to listOf(LiveActivitiesEvent.KIND, MeetingSpaceEvent.KIND, MeetingRoomEvent.KIND), "community" to listOf(CommunityDefinitionEvent.KIND), - "wiki" to listOf(WikiNoteEvent.KIND), + "wiki" to listOf(WikiArticleEvent.KIND), "classified" to listOf(ClassifiedsEvent.KIND), "geocache" to listOf(GeocacheListingEvent.KIND), "highlight" to listOf(HighlightEvent.KIND), @@ -109,7 +109,7 @@ object KindRegistry { // The kinds the app's own feeds are windows onto, so a screen that seeds its search // gets a chip a reader recognises instead of a bare number. "picture" to listOf(PictureEvent.KIND), - "video" to listOf(VideoNormalEvent.KIND, VideoShortEvent.KIND, VideoHorizontalEvent.KIND, VideoVerticalEvent.KIND), + "video" to listOf(VideoNormalEvent.KIND, VideoShortEvent.KIND, AddressableNormalVideoEvent.KIND, AddressableShortVideoEvent.KIND), "nsite" to listOf(RootSiteEvent.KIND, NamedSiteEvent.KIND), "napplet" to listOf(RootNappletEvent.KIND, NamedNappletEvent.KIND), "emoji" to listOf(EmojiPackEvent.KIND), @@ -123,15 +123,15 @@ object KindRegistry { "podcast" to listOf(PodcastMetadataEvent.KIND), "episode" to listOf(Podcasting20EpisodeEvent.KIND), "software" to listOf(SoftwareApplicationEvent.KIND), - "followpack" to listOf(FollowListEvent.KIND), + "followpack" to listOf(StarterPackEvent.KIND), "zappoll" to listOf(ZapPollEvent.KIND), // `video` is every video kind; these name the two the app gives their own feeds. - "stories" to listOf(VideoHorizontalEvent.KIND, VideoVerticalEvent.KIND), - "short" to listOf(VideoVerticalEvent.KIND), - "longvideo" to listOf(VideoHorizontalEvent.KIND), + "stories" to listOf(AddressableNormalVideoEvent.KIND, AddressableShortVideoEvent.KIND), + "short" to listOf(AddressableShortVideoEvent.KIND), + "longvideo" to listOf(AddressableNormalVideoEvent.KIND), // The slots on a calendar, and the calendars that collect them. "calendar" to listOf(CalendarTimeSlotEvent.KIND, CalendarDateSlotEvent.KIND), - "calendarset" to listOf(CalendarEvent.KIND), + "calendarset" to listOf(CalendarCollectionEvent.KIND), ) val pseudoKinds: Set = setOf("reply", "media") @@ -148,11 +148,11 @@ object KindRegistry { val presets: Map = mapOf( "Notes" to ContentPreset(kinds = listOf(TextNoteEvent.KIND)), - "Articles" to ContentPreset(kinds = listOf(LongTextNoteEvent.KIND)), + "Articles" to ContentPreset(kinds = listOf(LongFormContentEvent.KIND)), "Media" to ContentPreset(pseudoKind = "media"), "Channels" to ContentPreset(kinds = listOf(ChannelCreateEvent.KIND, ChannelMetadataEvent.KIND)), "Communities" to ContentPreset(kinds = listOf(CommunityDefinitionEvent.KIND)), - "Wiki" to ContentPreset(kinds = listOf(WikiNoteEvent.KIND)), + "Wiki" to ContentPreset(kinds = listOf(WikiArticleEvent.KIND)), "Polls" to ContentPreset(kinds = listOf(PollEvent.KIND)), ) diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/search/RenderableKinds.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/search/RenderableKinds.kt index b5be14e927..214e789056 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/search/RenderableKinds.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/search/RenderableKinds.kt @@ -33,12 +33,12 @@ import com.vitorpamplona.quartz.experimental.nns.NNSEvent import com.vitorpamplona.quartz.experimental.zapPolls.ZapPollEvent import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMetadataEvent @@ -47,18 +47,18 @@ import com.vitorpamplona.quartz.nip34Git.repository.GitRepositoryEvent import com.vitorpamplona.quartz.nip51Lists.PinListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.OldBookmarkListEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import com.vitorpamplona.quartz.nip51Lists.videoCurationSet.VideoCurationSetEvent import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingRoomEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingSpaceEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip58Badges.definition.BadgeDefinitionEvent import com.vitorpamplona.quartz.nip5aStaticWebsites.NamedSiteEvent import com.vitorpamplona.quartz.nip5aStaticWebsites.RootSiteEvent @@ -66,17 +66,17 @@ import com.vitorpamplona.quartz.nip5dNapplets.NamedNappletEvent import com.vitorpamplona.quartz.nip5dNapplets.RootNappletEvent import com.vitorpamplona.quartz.nip62RequestToVanish.RequestToVanishEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent import com.vitorpamplona.quartz.nip78AppData.AppSpecificDataEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip88Polls.response.PollResponseEvent -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent import com.vitorpamplona.quartz.nipA4PublicMessages.PublicMessageEvent import com.vitorpamplona.quartz.nipC0CodeSnippets.CodeSnippetEvent @@ -141,15 +141,15 @@ object RenderableKinds { setOf( MetadataEvent.KIND, ContactListEvent.KIND, - DeletionEvent.KIND, + DeletionRequestEvent.KIND, RepostEvent.KIND, ReactionEvent.KIND, GenericRepostEvent.KIND, RequestToVanishEvent.KIND, - FileHeaderEvent.KIND, + FileMetadataEvent.KIND, CommunityPostApprovalEvent.KIND, - LnZapRequestEvent.KIND, - LnZapEvent.KIND, + ZapRequestEvent.KIND, + ZapReceiptEvent.KIND, AppSpecificDataEvent.KIND, ) @@ -166,8 +166,8 @@ object RenderableKinds { TextNoteEvent.KIND, CommentEvent.KIND, PublicMessageEvent.KIND, - LongTextNoteEvent.KIND, - WikiNoteEvent.KIND, + LongFormContentEvent.KIND, + WikiArticleEvent.KIND, HighlightEvent.KIND, CodeSnippetEvent.KIND, NipTextEvent.KIND, @@ -175,8 +175,8 @@ object RenderableKinds { PictureEvent.KIND, VideoNormalEvent.KIND, VideoShortEvent.KIND, - VideoHorizontalEvent.KIND, - VideoVerticalEvent.KIND, + AddressableNormalVideoEvent.KIND, + AddressableShortVideoEvent.KIND, // A video list has a card of its own, so by the rule the omission list states — in // ALL when Amethyst can render it — it belongs in the window. Its title and // description are what Quartz indexes, which is exactly what a reader would search. @@ -202,15 +202,15 @@ object RenderableKinds { MeetingRoomEvent.KIND, // communities and lists CommunityDefinitionEvent.KIND, - PeopleListEvent.KIND, - FollowListEvent.KIND, + FollowSetEvent.KIND, + StarterPackEvent.KIND, BookmarkListEvent.KIND, OldBookmarkListEvent.KIND, PinListEvent.KIND, // calendar CalendarDateSlotEvent.KIND, CalendarTimeSlotEvent.KIND, - CalendarEvent.KIND, + CalendarCollectionEvent.KIND, // marketplace, apps, code and sites ClassifiedsEvent.KIND, SoftwareApplicationEvent.KIND, diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/search/SearchResultSorter.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/search/SearchResultSorter.kt index 0c1884976f..e1e4734441 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/search/SearchResultSorter.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/search/SearchResultSorter.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.commons.util.KmpLock import com.vitorpamplona.amethyst.commons.util.sortedBySnapshot import com.vitorpamplona.amethyst.commons.util.withLock import com.vitorpamplona.quartz.nip01Core.core.Event -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.utils.currentTimeSeconds object SearchResultSorter { @@ -66,7 +66,7 @@ object SearchResultSorter { } // Article title boost - if (event is LongTextNoteEvent) { + if (event is LongFormContentEvent) { val title = event.title()?.lowercase() if (title != null) { if (title.contains(query)) { diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/service/nwc/NwcPaymentTracker.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/service/nwc/NwcPaymentTracker.kt index 94ba2218d7..697e71a1cd 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/service/nwc/NwcPaymentTracker.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/service/nwc/NwcPaymentTracker.kt @@ -22,7 +22,7 @@ package com.vitorpamplona.amethyst.commons.service.nwc import com.vitorpamplona.amethyst.commons.model.Note import com.vitorpamplona.quartz.nip01Core.core.HexKey -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.utils.concurrent.ConcurrentMap import kotlin.concurrent.atomics.AtomicInt import kotlin.concurrent.atomics.ExperimentalAtomicApi @@ -60,7 +60,7 @@ class NwcPaymentTracker { class PendingRequest( val expectedServicePubkey: HexKey, val zappedNote: Note?, - val onResponse: suspend (LnZapPaymentResponseEvent) -> Unit, + val onResponse: suspend (NwcResponseEvent) -> Unit, ) { // Number of kind-23195 events that targeted this request id with the // right `e` tag but the wrong author. Surfaced to the UI when a @@ -74,7 +74,7 @@ class NwcPaymentTracker { /** * Registers a pending payment request. * - * @param requestId Event ID of the LnZapPaymentRequestEvent + * @param requestId Event ID of the NwcRequestEvent * @param expectedServicePubkey Wallet service pubkey from the request's `p` tag * @param zappedNote The note being zapped (null if not a zap payment) * @param onResponse Callback invoked when response arrives @@ -83,7 +83,7 @@ class NwcPaymentTracker { requestId: HexKey, expectedServicePubkey: HexKey, zappedNote: Note?, - onResponse: suspend (LnZapPaymentResponseEvent) -> Unit, + onResponse: suspend (NwcResponseEvent) -> Unit, ) { awaitingRequests[requestId] = PendingRequest(expectedServicePubkey, zappedNote, onResponse) } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/service/pow/PoWPolicy.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/service/pow/PoWPolicy.kt index d4c0da8079..042127051c 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/service/pow/PoWPolicy.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/service/pow/PoWPolicy.kt @@ -30,13 +30,13 @@ import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nip78AppData.AppSpecificDataEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent @@ -116,7 +116,7 @@ object PoWPolicy { setOf( MetadataEvent.KIND, ContactListEvent.KIND, - LnZapRequestEvent.KIND, // blocks the invoice fetch + ZapRequestEvent.KIND, // blocks the invoice fetch OtsEvent.KIND, // machine-generated companion events DraftWrapEvent.KIND, // re-signed on a 1s debounce while typing ) @@ -141,7 +141,7 @@ object PoWPolicy { TextNoteEvent.KIND -> PoWCategory.SHORT_NOTES CommentEvent.KIND -> PoWCategory.COMMENTS ReportEvent.KIND -> PoWCategory.REPORTS - LongTextNoteEvent.KIND, HighlightEvent.KIND -> PoWCategory.LONG_FORM + LongFormContentEvent.KIND, HighlightEvent.KIND -> PoWCategory.LONG_FORM VoiceEvent.KIND, VoiceReplyEvent.KIND -> PoWCategory.VOICE RepostEvent.KIND, GenericRepostEvent.KIND -> PoWCategory.REPOSTS ReactionEvent.KIND -> PoWCategory.REACTIONS diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/LiveStreamTopZappersViewModel.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/LiveStreamTopZappersViewModel.kt index 9c698f36d9..17e06618e1 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/LiveStreamTopZappersViewModel.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/LiveStreamTopZappersViewModel.kt @@ -30,8 +30,8 @@ import com.vitorpamplona.amethyst.commons.nip53LiveActivities.LiveActivityTopZap import com.vitorpamplona.amethyst.commons.nip53LiveActivities.TopZapperEntry import com.vitorpamplona.amethyst.commons.nip53LiveActivities.ZapContribution import com.vitorpamplona.quartz.nip01Core.core.HexKey -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nipB1Bolt12Zaps.zap.Bolt12ZapEvent import com.vitorpamplona.quartz.utils.toLongValue import kotlinx.coroutines.Dispatchers @@ -163,7 +163,7 @@ class LiveStreamTopZappersViewModel( private fun contributionFromStreamZap(note: Note): ZapContribution? = when (val ev = note.event) { - is LnZapEvent -> { + is ZapReceiptEvent -> { val request = ev.zapRequest ?: return null val sats = ev.amount()?.toLongValue() ?: return null ZapContribution(note.idHex, request.pubKey, request.isAnonTagged(), sats) @@ -179,12 +179,12 @@ class LiveStreamTopZappersViewModel( zapRequestNote: Note, receiptNote: Note?, ): ZapContribution? { - val receiptEv = receiptNote?.event as? LnZapEvent ?: return null - val request = zapRequestNote.event as? LnZapRequestEvent ?: return null + val receiptEv = receiptNote?.event as? ZapReceiptEvent ?: return null + val request = zapRequestNote.event as? ZapRequestEvent ?: return null val sats = receiptEv.amount()?.toLongValue() ?: return null return ZapContribution(receiptNote.idHex, request.pubKey, request.isAnonTagged(), sats) } } /** True for both public anonymous and NIP-57 private zaps (any `anon` tag, empty or encrypted). */ -private fun LnZapRequestEvent.isAnonTagged(): Boolean = tags.any { it.isNotEmpty() && it[0] == "anon" } +private fun ZapRequestEvent.isAnonTagged(): Boolean = tags.any { it.isNotEmpty() && it[0] == "anon" } diff --git a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/RoomZapsState.kt b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/RoomZapsState.kt index ce0267fb9e..09af0fb088 100644 --- a/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/RoomZapsState.kt +++ b/commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/RoomZapsState.kt @@ -21,7 +21,7 @@ package com.vitorpamplona.amethyst.commons.viewmodels import androidx.compose.runtime.Immutable -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nipB1Bolt12Zaps.zap.Bolt12ZapEvent import com.vitorpamplona.quartz.utils.toLongValue @@ -49,13 +49,13 @@ data class RoomZap( ) { companion object { /** - * Project a kind-9735 [LnZapEvent] into a [RoomZap]. The + * Project a kind-9735 [ZapReceiptEvent] into a [RoomZap]. The * source pubkey is the embedded kind-9734 request author — * the actual zapper — NOT the receipt's own `pubKey`, which * is the lnurl service provider's signing key. Falls back to * the receipt issuer only when the request can't be parsed. */ - fun from(event: LnZapEvent): RoomZap = + fun from(event: ZapReceiptEvent): RoomZap = RoomZap( eventId = event.id, sourcePubkey = event.zapRequest?.pubKey ?: event.pubKey, @@ -95,7 +95,7 @@ class RoomZapsAggregator { /** Apply one zap and return the post-evict snapshot. */ fun apply( - event: LnZapEvent, + event: ZapReceiptEvent, nowSec: Long, windowSec: Long, ): Map> = apply(RoomZap.from(event), nowSec, windowSec) diff --git a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/actions/PrivateNoteFactoryTest.kt b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/actions/PrivateNoteFactoryTest.kt index 29e8d2617e..b18e2da18e 100644 --- a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/actions/PrivateNoteFactoryTest.kt +++ b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/actions/PrivateNoteFactoryTest.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip01Core.tags.people.PTag import com.vitorpamplona.quartz.nip01Core.tags.people.pTags -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip17Dm.NIP17Factory import kotlinx.coroutines.test.runTest @@ -85,12 +85,12 @@ class PrivateNoteFactoryTest { val result = NIP17Factory().createDeletionNIP17( - template = DeletionEvent.build(listOf(reaction)), + template = DeletionRequestEvent.build(listOf(reaction)), to = listOf(bobSigner.pubKey), signer = aliceSigner, ) - assertEquals(DeletionEvent.KIND, result.msg.kind) + assertEquals(DeletionRequestEvent.KIND, result.msg.kind) assertEquals( setOf(aliceSigner.pubKey, bobSigner.pubKey), result.wraps.mapNotNull { it.recipientPubKey() }.toSet(), @@ -101,7 +101,7 @@ class PrivateNoteFactoryTest { val rumor = bobWrap.unwrapAndUnsealOrNull(bobSigner) assertNotNull(rumor, "recipient must be able to unwrap and unseal the deletion") - assertEquals(DeletionEvent.KIND, rumor.kind) + assertEquals(DeletionRequestEvent.KIND, rumor.kind) assertEquals(aliceSigner.pubKey, rumor.pubKey, "deletions only apply when the author matches") assertTrue(rumor.sig.isEmpty(), "the deletion travels as an unsigned rumor") assertTrue( diff --git a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/actions/ZapActionsTest.kt b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/actions/ZapActionsTest.kt index eaa21809b1..e738de8961 100644 --- a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/actions/ZapActionsTest.kt +++ b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/actions/ZapActionsTest.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.utils.Secp256k1Instance import kotlinx.coroutines.test.runTest import kotlin.test.Test @@ -108,7 +108,7 @@ class ZapActionsTest { amountMillisats = 21_000L, inboxRelays = setOf(relay), comment = "thanks!", - zapType = LnZapEvent.ZapType.PUBLIC, + zapType = ZapReceiptEvent.ZapType.PUBLIC, lnurl = "lnurl1example", ) @@ -133,7 +133,7 @@ class ZapActionsTest { recipientPubkey = recipientPubkey, amountMillisats = 1_000L, inboxRelays = setOf(relay), - zapType = LnZapEvent.ZapType.ANONYMOUS, + zapType = ZapReceiptEvent.ZapType.ANONYMOUS, ) assertTrue( @@ -152,7 +152,7 @@ class ZapActionsTest { recipientPubkey = recipientPubkey, amountMillisats = 1_000L, inboxRelays = setOf(relay), - zapType = LnZapEvent.ZapType.PRIVATE, + zapType = ZapReceiptEvent.ZapType.PRIVATE, ) // NIP-57 PRIVATE zaps use an ephemeral key derived from diff --git a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/model/ThreadAssemblerTest.kt b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/model/ThreadAssemblerTest.kt index 5bed98dc6f..04c4a0cacd 100644 --- a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/model/ThreadAssemblerTest.kt +++ b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/model/ThreadAssemblerTest.kt @@ -29,7 +29,7 @@ import com.vitorpamplona.quartz.nip01Core.hints.HintIndexer import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse @@ -75,7 +75,7 @@ class ThreadAssemblerTest { private val zap = Note(zapId).apply { - event = LnZapEvent(zapId, authorKey, 1001, arrayOf(arrayOf("e", originalId), arrayOf("p", authorKey)), "", sig) + event = ZapReceiptEvent(zapId, authorKey, 1001, arrayOf(arrayOf("e", originalId), arrayOf("p", authorKey)), "", sig) replyTo = listOf(original) } diff --git a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/model/privateChats/ChatPreviewTest.kt b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/model/privateChats/ChatPreviewTest.kt index 35c6013608..d050ab8e93 100644 --- a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/model/privateChats/ChatPreviewTest.kt +++ b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/model/privateChats/ChatPreviewTest.kt @@ -20,7 +20,7 @@ */ package com.vitorpamplona.amethyst.commons.model.privateChats -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent import com.vitorpamplona.quartz.nip51Lists.videoCurationSet.VideoCurationSetEvent @@ -40,7 +40,7 @@ class ChatPreviewTest { private fun privateDm( author: String = other, recipient: String = me, - ) = PrivateDmEvent( + ) = EncryptedDmEvent( id = "dm".padEnd(64, '0'), pubKey = author, createdAt = 1_000, diff --git a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/moderation/notifications/NotificationKindsTest.kt b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/moderation/notifications/NotificationKindsTest.kt index 52ce93b5e1..f9aee77c88 100644 --- a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/moderation/notifications/NotificationKindsTest.kt +++ b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/moderation/notifications/NotificationKindsTest.kt @@ -21,14 +21,14 @@ package com.vitorpamplona.amethyst.commons.moderation.notifications import com.vitorpamplona.quartz.nip01Core.core.Event -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nip61Nutzaps.nutzap.NutzapEvent import kotlin.test.Test @@ -116,8 +116,8 @@ class NotificationKindsTest { ) } - private fun zapReceipt(pTag: String = me): LnZapEvent = - LnZapEvent( + private fun zapReceipt(pTag: String = me): ZapReceiptEvent = + ZapReceiptEvent( id = "zap".padEnd(64, '0'), pubKey = "lnurl_provider".padEnd(64, '0'), createdAt = 1_000, @@ -142,8 +142,8 @@ class NotificationKindsTest { private fun privateDm( author: String, pTag: String = me, - ): PrivateDmEvent = - PrivateDmEvent( + ): EncryptedDmEvent = + EncryptedDmEvent( id = "dm".padEnd(64, '0'), pubKey = author, createdAt = 1_000, @@ -303,7 +303,7 @@ class NotificationKindsTest { val expected = setOf( TextNoteEvent.KIND, - PrivateDmEvent.KIND, + EncryptedDmEvent.KIND, RepostEvent.KIND, ReactionEvent.KIND, GenericRepostEvent.KIND, @@ -311,7 +311,7 @@ class NotificationKindsTest { CommentEvent.KIND, GiftWrapEvent.KIND, NutzapEvent.KIND, - LnZapEvent.KIND, + ZapReceiptEvent.KIND, ) val actual = NotificationKinds.SUBSCRIPTION_KINDS.toSet() assertTrue(actual.containsAll(expected), "expected subset missing from SUBSCRIPTION_KINDS") diff --git a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/napplet/NappletBrokerTest.kt b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/napplet/NappletBrokerTest.kt index a5d33e5a23..aa5d930cff 100644 --- a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/napplet/NappletBrokerTest.kt +++ b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/napplet/NappletBrokerTest.kt @@ -43,7 +43,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll @@ -137,7 +137,7 @@ class NappletBrokerTest { fromPublicKey: HexKey, ): String = throw NotImplementedError() - override suspend fun decryptZapEvent(event: LnZapRequestEvent): LnZapPrivateEvent = throw NotImplementedError() + override suspend fun decryptZapEvent(event: ZapRequestEvent): LnZapPrivateEvent = throw NotImplementedError() override suspend fun deriveKey(nonce: HexKey): HexKey = throw NotImplementedError() diff --git a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/onchain/OnchainZapSenderTest.kt b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/onchain/OnchainZapSenderTest.kt index 8f439de480..d0f61a9ad3 100644 --- a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/onchain/OnchainZapSenderTest.kt +++ b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/onchain/OnchainZapSenderTest.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nipBCOnchainZaps.builder.OnchainZapBuilder import com.vitorpamplona.quartz.nipBCOnchainZaps.chain.BitcoinAddressTx import com.vitorpamplona.quartz.nipBCOnchainZaps.chain.BitcoinTx @@ -228,7 +228,7 @@ class OnchainZapSenderTest { fromPublicKey: HexKey, ) = inner.nip44Decrypt(ciphertext, fromPublicKey) - override suspend fun decryptZapEvent(event: LnZapRequestEvent): LnZapPrivateEvent = inner.decryptZapEvent(event) + override suspend fun decryptZapEvent(event: ZapRequestEvent): LnZapPrivateEvent = inner.decryptZapEvent(event) override suspend fun deriveKey(nonce: HexKey): HexKey = inner.deriveKey(nonce) diff --git a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/FilterRelayGroupStateTest.kt b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/FilterRelayGroupStateTest.kt index d0ef97fdf9..5a410492c9 100644 --- a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/FilterRelayGroupStateTest.kt +++ b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/FilterRelayGroupStateTest.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupAdminsEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMembersEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMetadataEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupPinnedEvent -import com.vitorpamplona.quartz.nip29RelayGroups.metadata.SupportedRolesEvent +import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupRolesEvent import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse @@ -51,7 +51,7 @@ class FilterRelayGroupStateTest { GroupMetadataEvent.KIND, GroupAdminsEvent.KIND, GroupMembersEvent.KIND, - SupportedRolesEvent.KIND, + GroupRolesEvent.KIND, ) private val pinKinds = listOf(GroupPinnedEvent.KIND) diff --git a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/relayGroup/RelayGroupFilterBuildersTest.kt b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/relayGroup/RelayGroupFilterBuildersTest.kt index f7f85e742f..56c53c075d 100644 --- a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/relayGroup/RelayGroupFilterBuildersTest.kt +++ b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/channel/relayGroup/RelayGroupFilterBuildersTest.kt @@ -24,7 +24,7 @@ import com.vitorpamplona.quartz.buzz.forum.ForumCommentEvent import com.vitorpamplona.quartz.buzz.forum.ForumPostEvent import com.vitorpamplona.quartz.nip01Core.relay.client.pool.FiltersChanged import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip29RelayGroups.GroupId @@ -32,8 +32,8 @@ import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupAdminsEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMembersEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMetadataEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupPinnedEvent -import com.vitorpamplona.quartz.nip29RelayGroups.metadata.SupportedRolesEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.DeleteEventEvent +import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupRolesEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupDeleteEventEvent import com.vitorpamplona.quartz.nip51Lists.simpleGroupList.GroupTag import com.vitorpamplona.quartz.nip7DThreads.ThreadEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent @@ -187,7 +187,7 @@ class RelayGroupFilterBuildersTest { val filter = buildRelayGroupAuxFilter(GroupId("g1", relayA), 42L) assertEquals(relayA, filter.relay) - assertEquals(listOf(DeletionEvent.KIND, ReactionEvent.KIND, DeleteEventEvent.KIND), filter.filter.kinds) + assertEquals(listOf(DeletionRequestEvent.KIND, ReactionEvent.KIND, GroupDeleteEventEvent.KIND), filter.filter.kinds) assertEquals(listOf("g1"), filter.filter.tags!!["h"]) assertEquals(42L, filter.filter.since) assertEquals(RELAY_GROUP_AUX_LIMIT, filter.filter.limit) @@ -293,7 +293,7 @@ class RelayGroupFilterBuildersTest { @Test fun `directory kinds are 39000-39003 and exclude the pin list`() { assertEquals( - listOf(GroupMetadataEvent.KIND, GroupAdminsEvent.KIND, GroupMembersEvent.KIND, SupportedRolesEvent.KIND), + listOf(GroupMetadataEvent.KIND, GroupAdminsEvent.KIND, GroupMembersEvent.KIND, GroupRolesEvent.KIND), RELAY_GROUP_DIRECTORY_KINDS, ) assertFalse(RELAY_GROUP_DIRECTORY_KINDS.contains(GroupPinnedEvent.KIND), "the directory doesn't fetch each group's pins") diff --git a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/HomeMediaKindCoverageTest.kt b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/HomeMediaKindCoverageTest.kt index c51e367053..813879a187 100644 --- a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/HomeMediaKindCoverageTest.kt +++ b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/HomeMediaKindCoverageTest.kt @@ -26,10 +26,10 @@ import com.vitorpamplona.amethyst.commons.relayClient.home.nip65Follows.HomePost import com.vitorpamplona.amethyst.commons.relayClient.home.nip72Communities.HomePostsFromCommunityKinds import com.vitorpamplona.amethyst.commons.relayClient.home.nip72Communities.HomePostsFromCommunityKindsStr import com.vitorpamplona.quartz.nip68Picture.PictureEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue @@ -46,8 +46,8 @@ class HomeMediaKindCoverageTest { PictureEvent.KIND, VideoNormalEvent.KIND, VideoShortEvent.KIND, - VideoHorizontalEvent.KIND, - VideoVerticalEvent.KIND, + AddressableNormalVideoEvent.KIND, + AddressableShortVideoEvent.KIND, ) private fun assertCarriesMedia( diff --git a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip90AlgoFeeds/FilterHomePostsByAlgoFeedIdsTest.kt b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip90AlgoFeeds/FilterHomePostsByAlgoFeedIdsTest.kt index fd94ee87ee..5376b735b3 100644 --- a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip90AlgoFeeds/FilterHomePostsByAlgoFeedIdsTest.kt +++ b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/home/nip90AlgoFeeds/FilterHomePostsByAlgoFeedIdsTest.kt @@ -23,8 +23,8 @@ package com.vitorpamplona.amethyst.commons.relayClient.home.nip90AlgoFeeds import com.vitorpamplona.amethyst.commons.model.topNavFeeds.favoriteAlgoFeeds.FavoriteAlgoFeedTopNavPerRelayFilter import com.vitorpamplona.amethyst.commons.model.topNavFeeds.favoriteAlgoFeeds.FavoriteAlgoFeedTopNavPerRelayFilterSet import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.NIP90ContentDiscoveryResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.status.NIP90StatusEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.DvmContentDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.status.DvmStatusEvent import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull @@ -83,7 +83,7 @@ class FilterHomePostsByAlgoFeedIdsTest { val listen = filters.single() assertEquals(dvmRelay, listen.relay) assertEquals( - listOf(NIP90ContentDiscoveryResponseEvent.KIND, NIP90StatusEvent.KIND), + listOf(DvmContentDiscoveryResponseEvent.KIND, DvmStatusEvent.KIND), listen.filter.kinds, ) val eTag = listen.filter.tags?.get("e") diff --git a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/search/SearchResultSorterTest.kt b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/search/SearchResultSorterTest.kt index 96217a9904..0afcf06b9e 100644 --- a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/search/SearchResultSorterTest.kt +++ b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/search/SearchResultSorterTest.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.commons.model.User import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip01Core.metadata.UserMetadata -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue @@ -51,14 +51,14 @@ class SearchResultSorterTest { createdAt: Long, content: String = "", title: String? = null, - ): LongTextNoteEvent { + ): LongFormContentEvent { val tags = if (title != null) { arrayOf(arrayOf("title", title)) } else { emptyArray() } - return LongTextNoteEvent( + return LongFormContentEvent( id = id, pubKey = "abc123def456abc123def456abc123def456abc123def456abc123def456abcd", createdAt = createdAt, diff --git a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/search/SearchSeedTest.kt b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/search/SearchSeedTest.kt index 2d1ed9f50f..5cc5a7bf18 100644 --- a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/search/SearchSeedTest.kt +++ b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/search/SearchSeedTest.kt @@ -22,7 +22,7 @@ package com.vitorpamplona.amethyst.commons.search import com.vitorpamplona.amethyst.commons.model.topNavFeeds.TopFilter import com.vitorpamplona.quartz.nip01Core.core.Address -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent import kotlinx.collections.immutable.persistentListOf import kotlin.test.Test @@ -46,7 +46,7 @@ class SearchSeedTest { @Test fun aKindWindowArrivesAsTheSameKinds() { - val seed = SearchSeed.ofKinds(LongTextNoteEvent.KIND) + val seed = SearchSeed.ofKinds(LongFormContentEvent.KIND) assertEquals("kind:article", QuerySerializer.serialize(seed)) assertEquals(seed, throughTheField(seed)) } @@ -196,7 +196,7 @@ class SearchSeedTest { assertTrue(SearchQuery(scopes = persistentListOf(ExternalScope("isbn", "123"))).pinsToNotes) assertTrue(SearchQuery(groups = persistentListOf("abc")).pinsToNotes) // Every seeded feed window pins it too. - assertTrue(SearchSeed.ofKinds(LongTextNoteEvent.KIND).pinsToNotes) + assertTrue(SearchSeed.ofKinds(LongFormContentEvent.KIND).pinsToNotes) } @Test diff --git a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/RoomZapsStateTest.kt b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/RoomZapsStateTest.kt index bc67bc0981..6ac9dc3d7d 100644 --- a/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/RoomZapsStateTest.kt +++ b/commons/src/commonTest/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/RoomZapsStateTest.kt @@ -20,7 +20,7 @@ */ package com.vitorpamplona.amethyst.commons.viewmodels -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNull @@ -46,13 +46,13 @@ class RoomZapsStateTest { to: String?, createdAt: Long, id: String = (nextEventId++).toString(16).padStart(64, '0'), - ): LnZapEvent { + ): ZapReceiptEvent { val tags = buildList> { add(arrayOf("a", "30312:host:room")) if (to != null) add(arrayOf("p", to)) }.toTypedArray() - return LnZapEvent( + return ZapReceiptEvent( id = id, pubKey = from, createdAt = createdAt, diff --git a/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/cashu/ops/CashuWalletOps.kt b/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/cashu/ops/CashuWalletOps.kt index 99def91987..e26b1471d1 100644 --- a/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/cashu/ops/CashuWalletOps.kt +++ b/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/cashu/ops/CashuWalletOps.kt @@ -29,7 +29,7 @@ import com.vitorpamplona.quartz.nip01Core.hints.EventHintBundle import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.tags.aTag.aTag -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip60Cashu.bdhke.Bdhke import com.vitorpamplona.quartz.nip60Cashu.history.CashuSpendingHistoryEvent import com.vitorpamplona.quartz.nip60Cashu.history.SpendingDirection @@ -195,7 +195,7 @@ class CashuWalletOps( * bails when it has no shared mint or no P2PK pubkey. This is the * durable signal. * 2. NIP-09 delete the now-empty kind:10019 by its address coordinate - * (DeletionEvent.build adds the `a` tag automatically because the + * (DeletionRequestEvent.build adds the `a` tag automatically because the * event is replaceable) so relays that DO honor deletions drop it * entirely. Deletions are optional on Nostr, which is why step 1 * runs first as the fallback. @@ -209,7 +209,7 @@ class CashuWalletOps( val emptyEvent = signer.sign(emptyTemplate) publish(emptyEvent) - val delTemplate = DeletionEvent.build(listOf(emptyEvent)) + val delTemplate = DeletionRequestEvent.build(listOf(emptyEvent)) val delEvent = signer.sign(delTemplate) publish(delEvent) } @@ -230,7 +230,7 @@ class CashuWalletOps( suspend fun deleteWallet(walletEvent: CashuWalletEvent) { stopNutzaps() - val delTemplate = DeletionEvent.build(listOf(walletEvent)) + val delTemplate = DeletionRequestEvent.build(listOf(walletEvent)) val delEvent = signer.sign(delTemplate) publish(delEvent) } @@ -286,7 +286,7 @@ class CashuWalletOps( * fired anyway; running it twice on a missing event is harmless. */ suspend fun cancelMintQuote(quoteEvent: CashuMintQuoteEvent) { - val delTemplate = DeletionEvent.build(listOf(quoteEvent)) + val delTemplate = DeletionRequestEvent.build(listOf(quoteEvent)) val delEvent = signer.sign(delTemplate) publish(delEvent) } @@ -363,7 +363,7 @@ class CashuWalletOps( publish(historyEvent) // NIP-09 delete the now-fulfilled quote event. - val delTemplate = DeletionEvent.build(listOf(quoteEvent)) + val delTemplate = DeletionRequestEvent.build(listOf(quoteEvent)) val delEvent = signer.sign(delTemplate) publish(delEvent) @@ -527,11 +527,11 @@ class CashuWalletOps( } // NIP-09 delete the source token events. Per spec, also need k=7375 tag, - // which DeletionEvent.build adds automatically from the source event kind. + // which DeletionRequestEvent.build adds automatically from the source event kind. val deleteEvent = run { val toDelete = selected.map { it.event } + listOfNotNull(prePaidChangeEvent.takeIf { finalChangeEvent != null }) - val delTemplate = DeletionEvent.build(toDelete) + val delTemplate = DeletionRequestEvent.build(toDelete) signer.sign(delTemplate).also { publish(it) } } @@ -598,7 +598,7 @@ class CashuWalletOps( val deleteEvent = run { - val template = DeletionEvent.build(selected.map { it.event }) + val template = DeletionRequestEvent.build(selected.map { it.event }) signer.sign(template).also { publish(it) } } @@ -769,7 +769,7 @@ class CashuWalletOps( // NIP-09 delete the source token events. val deleteEvent = run { - val template = DeletionEvent.build(selected.map { it.event }) + val template = DeletionRequestEvent.build(selected.map { it.event }) signer.sign(template).also { publish(it) } @@ -1001,7 +1001,7 @@ class CashuWalletOps( entry.content.proofs.any { states[it.secret] == ProofState.SPENT } } if (stale.isEmpty()) return emptyList() - val delTemplate = DeletionEvent.build(stale.map { it.event }) + val delTemplate = DeletionRequestEvent.build(stale.map { it.event }) publish(signer.sign(delTemplate)) return stale.map { it.event } } @@ -1046,7 +1046,7 @@ class CashuWalletOps( val signed = signer.sign(template) publish(signed) - val delTemplate = DeletionEvent.build(entries.map { it.event }) + val delTemplate = DeletionRequestEvent.build(entries.map { it.event }) val delEvent = signer.sign(delTemplate) publish(delEvent) @@ -1088,7 +1088,7 @@ class CashuWalletOps( * kind:38000 is parameterized-replaceable — a delete with an `a` tag * pointing at the address coordinate (kind:pubkey:dTag) drops all * versions on compliant relays. We also include the original event id - * via DeletionEvent.build so relays that only track by event id still + * via DeletionRequestEvent.build so relays that only track by event id still * remove it. MintRecommendationEvent doesn't extend AddressableEvent * today, so we compute and add the `a` tag ourselves. */ @@ -1099,7 +1099,7 @@ class CashuWalletOps( // d-tag still get a NIP-09 `e`-only delete (the default build path). val dTag = event.dTag() val template = - DeletionEvent.build(listOf(event)) { + DeletionRequestEvent.build(listOf(event)) { if (dTag != null) aTag(Address(event.kind, event.pubKey, dTag)) } val delEvent = signer.sign(template) @@ -1497,14 +1497,14 @@ data class MeltCompleted( val paidAmount: Long, val fees: Long, val historyEvent: CashuSpendingHistoryEvent, - val deleteEvent: DeletionEvent, + val deleteEvent: DeletionRequestEvent, val newTokenEvent: CashuTokenEvent?, ) data class SendTokenCompleted( val cashuToken: String, val amount: Long, - val deleteEvent: DeletionEvent, + val deleteEvent: DeletionRequestEvent, val keepEvent: CashuTokenEvent?, val historyEvent: CashuSpendingHistoryEvent, ) @@ -1519,7 +1519,7 @@ data class RedeemCompleted( data class NutzapSent( val nutzapEvent: NutzapEvent, val keepEvent: CashuTokenEvent?, - val deleteEvent: DeletionEvent, + val deleteEvent: DeletionRequestEvent, val historyEvent: CashuSpendingHistoryEvent, val amount: Long, ) diff --git a/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/model/nip52Calendar/IcsExport.kt b/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/model/nip52Calendar/IcsExport.kt index ecf32fda47..2c5e7b579b 100644 --- a/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/model/nip52Calendar/IcsExport.kt +++ b/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/model/nip52Calendar/IcsExport.kt @@ -23,7 +23,7 @@ package com.vitorpamplona.amethyst.commons.model.nip52Calendar import com.vitorpamplona.quartz.nip01Core.core.Address import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import java.time.Instant import java.time.LocalDate import java.time.ZoneOffset @@ -71,7 +71,7 @@ object IcsExport { * haven't been fetched from relays yet. */ fun calendarToIcs( - calendar: CalendarEvent, + calendar: CalendarCollectionEvent, memberEvents: List>, nowSeconds: Long, ): String { @@ -110,7 +110,7 @@ object IcsExport { return safeFilename(title ?: address.dTag) + ".ics" } - fun calendarFilename(calendar: CalendarEvent): String = safeFilename(calendar.title() ?: "calendar") + ".ics" + fun calendarFilename(calendar: CalendarCollectionEvent): String = safeFilename(calendar.title() ?: "calendar") + ".ics" private fun safeFilename(raw: String): String = raw diff --git a/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/model/nip57Zaps/ZapAction.kt b/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/model/nip57Zaps/ZapAction.kt index 34e116b43b..0066a7ed89 100644 --- a/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/model/nip57Zaps/ZapAction.kt +++ b/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/model/nip57Zaps/ZapAction.kt @@ -24,8 +24,8 @@ import com.vitorpamplona.amethyst.commons.service.lnurl.LightningAddressResolver import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent /** * Handles NIP-57 zap requests and invoice fetching. @@ -66,7 +66,7 @@ object ZapAction { relays: Set, signer: NostrSigner, resolver: LightningAddressResolver, - zapType: LnZapEvent.ZapType = LnZapEvent.ZapType.PUBLIC, + zapType: ZapReceiptEvent.ZapType = ZapReceiptEvent.ZapType.PUBLIC, onProgress: (Float) -> Unit = {}, ): ZapResult { if (!signer.isWriteable()) { @@ -76,7 +76,7 @@ object ZapAction { // Create zap request using quartz factory val zapRequest = try { - LnZapRequestEvent.create( + ZapRequestEvent.create( zappedEvent = targetEvent, relays = relays, signer = signer, @@ -120,7 +120,7 @@ object ZapAction { relays: Set, signer: NostrSigner, resolver: LightningAddressResolver, - zapType: LnZapEvent.ZapType = LnZapEvent.ZapType.PUBLIC, + zapType: ZapReceiptEvent.ZapType = ZapReceiptEvent.ZapType.PUBLIC, onProgress: (Float) -> Unit = {}, ): ZapResult { if (!signer.isWriteable()) { @@ -130,7 +130,7 @@ object ZapAction { // Create zap request for user val zapRequest = try { - LnZapRequestEvent.create( + ZapRequestEvent.create( userHex = userPubHex, relays = relays, signer = signer, diff --git a/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/service/lnurl/LightningAddressResolver.kt b/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/service/lnurl/LightningAddressResolver.kt index 5acca96399..a675147433 100644 --- a/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/service/lnurl/LightningAddressResolver.kt +++ b/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/service/lnurl/LightningAddressResolver.kt @@ -23,7 +23,7 @@ package com.vitorpamplona.amethyst.commons.service.lnurl import com.fasterxml.jackson.databind.ObjectMapper import com.vitorpamplona.quartz.lightning.LnInvoiceUtil import com.vitorpamplona.quartz.lightning.Lud06 -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip57Zaps.validate.LnurlEndpointCache import com.vitorpamplona.quartz.nip57Zaps.validate.LnurlEndpointInfo import kotlinx.coroutines.Dispatchers @@ -94,7 +94,7 @@ class LightningAddressResolver( lnAddress: String, milliSats: Long, message: String = "", - zapRequest: LnZapRequestEvent? = null, + zapRequest: ZapRequestEvent? = null, onProgress: (Float) -> Unit = {}, ): Result = withContext(Dispatchers.IO) { @@ -209,7 +209,7 @@ class LightningAddressResolver( callbackUrl: String, milliSats: Long, message: String, - zapRequest: LnZapRequestEvent?, + zapRequest: ZapRequestEvent?, ): String? = withContext(Dispatchers.IO) { try { diff --git a/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/service/lnurl/OkHttpLnurlEndpointResolver.kt b/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/service/lnurl/OkHttpLnurlEndpointResolver.kt index dd162f881c..2755642c0f 100644 --- a/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/service/lnurl/OkHttpLnurlEndpointResolver.kt +++ b/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/service/lnurl/OkHttpLnurlEndpointResolver.kt @@ -32,7 +32,7 @@ import okhttp3.coroutines.executeAsync import kotlin.coroutines.cancellation.CancellationException /** - * OkHttp-backed [LnurlEndpointResolver]. Used by `LocalCache.consume(LnZapEvent)` + * OkHttp-backed [LnurlEndpointResolver]. Used by `LocalCache.consume(ZapReceiptEvent)` * to look up a recipient's LNURL provider's `nostrPubkey` when validating an * incoming zap receipt (NIP-57 Appendix F). * diff --git a/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/NestViewModel.kt b/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/NestViewModel.kt index 80ad79160f..faf5d970f1 100644 --- a/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/NestViewModel.kt +++ b/commons/src/jvmAndroid/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/NestViewModel.kt @@ -629,7 +629,7 @@ class NestViewModel( * same window so the visual cadence matches the React button. */ fun onZapEvent( - event: com.vitorpamplona.quartz.nip57Zaps.LnZapEvent, + event: com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent, nowSec: Long, windowSec: Long = REACTION_WINDOW_SEC, ) { diff --git a/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/marmot/MarmotEditsAndSystemRowsTest.kt b/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/marmot/MarmotEditsAndSystemRowsTest.kt index 6e27962957..e2ea1de62e 100644 --- a/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/marmot/MarmotEditsAndSystemRowsTest.kt +++ b/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/marmot/MarmotEditsAndSystemRowsTest.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.quartz.marmot.mip01Groups.MarmotGroupData import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import kotlinx.coroutines.runBlocking import kotlin.test.Test import kotlin.test.assertEquals @@ -130,7 +130,7 @@ class MarmotEditsAndSystemRowsTest { val forged = MarmotAppEvent.build( pubKey = impostor, - kind = DeletionEvent.KIND, + kind = DeletionRequestEvent.KIND, content = "", createdAt = 1_800_000_000L, tags = arrayOf(arrayOf("e", mine.innerEvent.id)), @@ -168,7 +168,7 @@ class MarmotEditsAndSystemRowsTest { val forged = MarmotAppEvent.build( pubKey = f.signer.pubKey, - kind = DeletionEvent.KIND, + kind = DeletionRequestEvent.KIND, content = "", createdAt = 1_800_000_000L, tags = arrayOf(arrayOf("e", absent)), diff --git a/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/model/nip52Calendar/IcsExportTest.kt b/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/model/nip52Calendar/IcsExportTest.kt index f6e5ec7e81..11cdde002e 100644 --- a/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/model/nip52Calendar/IcsExportTest.kt +++ b/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/model/nip52Calendar/IcsExportTest.kt @@ -23,7 +23,7 @@ package com.vitorpamplona.amethyst.commons.model.nip52Calendar import com.vitorpamplona.quartz.nip01Core.core.Address import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue @@ -181,7 +181,7 @@ class IcsExportTest { sig = "sig", ) val calendar = - CalendarEvent( + CalendarCollectionEvent( id = "cal", pubKey = "pub", createdAt = 0L, diff --git a/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/model/nip71Video/DivineVideoInteropTest.kt b/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/model/nip71Video/DivineVideoInteropTest.kt index c476dab342..db2424d860 100644 --- a/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/model/nip71Video/DivineVideoInteropTest.kt +++ b/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/model/nip71Video/DivineVideoInteropTest.kt @@ -31,7 +31,7 @@ import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip51Lists.videoCurationSet.VideoCurationSetEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.credits.CreditTarget import com.vitorpamplona.quartz.nip71Video.credits.VideoCredit import com.vitorpamplona.quartz.nip71Video.textTrack.TextTrackEvent @@ -86,20 +86,20 @@ class DivineVideoInteropTest { fun aShortVideoIsAnAddressableVerticalVideo() { val event = Event.fromJson(video) - assertTrue(event is VideoVerticalEvent) + assertTrue(event is AddressableShortVideoEvent) // The address must come from the `d` tag: an `a` tag elsewhere on the network points at // `34236::`, and a class on the wrong base would split the cache in two. assertEquals( "34236:4d7dccc0a5116daa057348ef79c573873cddd9eff066fc6a5f3d37e8264afbeb:c855df3d07ba963e9097d5a151b0c14a0a3d494e4ff9b04a389bc0b5f5c16862", (event as AddressableEvent).address().toValue(), ) - assertEquals("Xmas Already??", (event as VideoVerticalEvent).title()) + assertEquals("Xmas Already??", (event as AddressableShortVideoEvent).title()) assertEquals(6, event.duration()) } @Test fun theBlossomUrlIsPlayedAsAVideoDespiteHavingNoFileExtension() { - val track = (Event.fromJson(video) as VideoVerticalEvent).selectVideoTrack() + val track = (Event.fromJson(video) as AddressableShortVideoEvent).selectVideoTrack() assertNotNull(track) assertEquals("https://media.divine.video/c855df3d07ba963e9097d5a151b0c14a0a3d494e4ff9b04a389bc0b5f5c16862", track!!.url) @@ -125,7 +125,7 @@ class DivineVideoInteropTest { // itself. LocalCache.computeReplyTo has no branch for video events, so this never turns // the post into a reply — which would drop it out of the home feed and thread it under // whatever video the audio came from. - val event = Event.fromJson(video) as VideoVerticalEvent + val event = Event.fromJson(video) as AddressableShortVideoEvent val audio = event.tags.first { it[0] == "e" } assertEquals("218af5fc90d66a16ce273f00a4e412a71443441c04c67d1e34ff99c654871d3d", audio[1]) @@ -136,7 +136,7 @@ class DivineVideoInteropTest { fun captionsComeFromTheTextTrackTagsAndNotTheAudioPointer() { // textTrack() used to run ETag::parse, so it returned the `e` tags instead — on this // event, the reused-soundtrack pointer, which is not a caption track at all. - val tracks = (Event.fromJson(video) as VideoVerticalEvent).textTrack() + val tracks = (Event.fromJson(video) as AddressableShortVideoEvent).textTrack() assertEquals(2, tracks.size) // Divine publishes the same track twice: the WebVTT file on Blossom, and the addressable @@ -153,7 +153,7 @@ class DivineVideoInteropTest { @Test fun theTwoFormsOfTheSameCaptionTrackCollapseIntoOne() { - val video = Event.fromJson(video) as VideoVerticalEvent + val video = Event.fromJson(video) as AddressableShortVideoEvent val refs = video.captionTracks() // One `text-track` is directly loadable, the other has to be fetched first. @@ -230,7 +230,7 @@ class DivineVideoInteropTest { @Test fun creditsReadTheMarkerWhicheverSlotItIsIn() { // divine-mobile: ["p", , , "inspired-by"] and ["e", , , "audio"]. - val credits = (Event.fromJson(videoWithCredits) as VideoVerticalEvent).credits() + val credits = (Event.fromJson(videoWithCredits) as AddressableShortVideoEvent).credits() val person = credits.filterIsInstance().first { it.target is CreditTarget.Person } assertEquals("0db19e8f1b13e03cd07379edd37a71f07b08a4fb5e7eac222ba1d2c823807075", (person.target as CreditTarget.Person).pubKey) @@ -250,7 +250,7 @@ class DivineVideoInteropTest { // divine-web's collaborator invite writes ["p", , ""] — no relay hint at all, // so the slot PTag reads for a hint holds the label instead. val invite = - VideoVerticalEvent( + AddressableShortVideoEvent( id = "a".repeat(64), pubKey = "b".repeat(64), createdAt = 1789666628, @@ -269,7 +269,7 @@ class DivineVideoInteropTest { // No marker means nothing is being credited — printing "references " for a stray // threading tag would invent an attribution the publisher never made. val stray = - VideoVerticalEvent( + AddressableShortVideoEvent( id = "a".repeat(64), pubKey = "b".repeat(64), createdAt = 1789666628, diff --git a/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/model/nip71Video/VideoTrackSelectionTest.kt b/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/model/nip71Video/VideoTrackSelectionTest.kt index 0a7453ddc8..e92f88c732 100644 --- a/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/model/nip71Video/VideoTrackSelectionTest.kt +++ b/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/model/nip71Video/VideoTrackSelectionTest.kt @@ -20,8 +20,8 @@ */ package com.vitorpamplona.amethyst.commons.model.nip71Video +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoMeta -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip94FileMetadata.tags.DimensionTag import org.junit.Assert.assertEquals import org.junit.Assert.assertNull @@ -36,7 +36,7 @@ class VideoTrackSelectionTest { private val hls = "application/vnd.apple.mpegurl" private fun event(vararg metas: VideoMeta) = - VideoVerticalEvent( + AddressableShortVideoEvent( id = "bfe2f2244fefc7cebc7b2eae825495f99dabb4649ee3f90ab1fa33bcd1e9bb9f", pubKey = "3b6187c08b9dd5617150ea047e788a0fdd44b4394cb5566cba76f683ddc027d2", createdAt = 1780894816, diff --git a/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/nip17Dm/DmInboxRelayResolverOutboxTest.kt b/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/nip17Dm/DmInboxRelayResolverOutboxTest.kt index 417ef9478d..d539f693fc 100644 --- a/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/nip17Dm/DmInboxRelayResolverOutboxTest.kt +++ b/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/relayClient/nip17Dm/DmInboxRelayResolverOutboxTest.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.client.INostrClient import com.vitorpamplona.quartz.nip01Core.relay.client.reqs.SubscriptionListener import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent import kotlinx.coroutines.runBlocking import org.junit.Assert.assertEquals @@ -60,11 +60,11 @@ class DmInboxRelayResolverOutboxTest { ) private fun dm10050(inbox: List) = - ChatMessageRelayListEvent( + DmRelayListEvent( id = "c".repeat(64), pubKey = peer, createdAt = 1_700_000_050, - tags = ChatMessageRelayListEvent.createTagArray(inbox), + tags = DmRelayListEvent.createTagArray(inbox), content = "", sig = dummySig(), ) @@ -115,7 +115,7 @@ class DmInboxRelayResolverOutboxTest { // Indexer knows WHERE the peer writes (10002) but not their 10050. client.scriptEvent(AdvertisedRelayListEvent.KIND, indexer, listOf(outbox10002(listOf(peerOutbox)))) // The peer's own write relay serves their 10050. - client.scriptEvent(ChatMessageRelayListEvent.KIND, peerOutbox, listOf(dm10050(listOf(peerDmInbox)))) + client.scriptEvent(DmRelayListEvent.KIND, peerOutbox, listOf(dm10050(listOf(peerDmInbox)))) val resolver = DmInboxRelayResolver( @@ -136,7 +136,7 @@ class DmInboxRelayResolverOutboxTest { runBlocking { val client = ScriptedClient() // No 10002 on the indexer; the write relay is only known from cache. - client.scriptEvent(ChatMessageRelayListEvent.KIND, peerOutbox, listOf(dm10050(listOf(peerDmInbox)))) + client.scriptEvent(DmRelayListEvent.KIND, peerOutbox, listOf(dm10050(listOf(peerDmInbox)))) val resolver = DmInboxRelayResolver( diff --git a/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/NestViewModelTest.kt b/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/NestViewModelTest.kt index 10293574a4..5c27c8c828 100644 --- a/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/NestViewModelTest.kt +++ b/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/viewmodels/NestViewModelTest.kt @@ -36,7 +36,7 @@ import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -589,7 +589,7 @@ class NestViewModelTest { fromPublicKey: String, ): String = error("not used") - override suspend fun decryptZapEvent(event: LnZapRequestEvent): LnZapPrivateEvent = error("not used") + override suspend fun decryptZapEvent(event: ZapRequestEvent): LnZapPrivateEvent = error("not used") override suspend fun deriveKey(nonce: String): String = error("not used") diff --git a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/nip17Dm/ui/IncognitoBadge.kt b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/nip17Dm/ui/IncognitoBadge.kt index 2c7269e112..d0af55cff6 100644 --- a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/nip17Dm/ui/IncognitoBadge.kt +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/nip17Dm/ui/IncognitoBadge.kt @@ -29,11 +29,11 @@ import com.vitorpamplona.amethyst.commons.model.Note import com.vitorpamplona.amethyst.commons.ui.theme.IncognitoIconModifier import com.vitorpamplona.amethyst.commons.ui.theme.StdHorzSpacer import com.vitorpamplona.amethyst.commons.ui.theme.placeholderText -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent @Composable fun IncognitoBadge(baseNote: Note) { - if (baseNote.event is PrivateDmEvent) { + if (baseNote.event is EncryptedDmEvent) { Icon( symbol = MaterialSymbols.NoEncryption, contentDescription = null, diff --git a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/note/CalendarCollectionCard.kt b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/note/CalendarCollectionCard.kt index ba22fa6639..6066ad2cab 100644 --- a/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/note/CalendarCollectionCard.kt +++ b/commonsUI/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/ui/note/CalendarCollectionCard.kt @@ -41,12 +41,12 @@ import com.vitorpamplona.amethyst.commons.resources.Res import com.vitorpamplona.amethyst.commons.resources.calendar_collection_count import com.vitorpamplona.amethyst.commons.ui.theme.StdVertSpacer import com.vitorpamplona.amethyst.commons.ui.theme.replyModifier -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import org.jetbrains.compose.resources.pluralStringResource /** Card for a NIP-52 calendar collection (kind 31924): title, description, and event count. */ @Composable -fun CalendarCollectionCard(event: CalendarEvent) { +fun CalendarCollectionCard(event: CalendarCollectionEvent) { val title = remember(event) { event.title() } val eventCount = remember(event) { event.calendarEventAddresses().size } diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/Main.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/Main.kt index c3aa87d9c9..a25cac2394 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/Main.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/Main.kt @@ -167,7 +167,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip01Core.relay.sockets.okhttp.BasicOkHttpWebSocket import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKeyable -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent import com.vitorpamplona.quartz.nip47WalletConnect.Nip47WalletConnect import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent @@ -1817,7 +1817,7 @@ fun MainContent( kinds = listOf( AdvertisedRelayListEvent.KIND, - ChatMessageRelayListEvent.KIND, + DmRelayListEvent.KIND, SearchRelayListEvent.KIND, BlockedRelayListEvent.KIND, BlossomServersEvent.KIND, @@ -1845,7 +1845,7 @@ fun MainContent( // dmInboxRelaysStrict, self-copy resolution) alongside // accountRelays' persisted copy. if (event is AdvertisedRelayListEvent || - event is ChatMessageRelayListEvent || + event is DmRelayListEvent || event is BlossomServersEvent || event is MuteListEvent ) { @@ -1877,7 +1877,7 @@ fun MainContent( kinds = listOf( AdvertisedRelayListEvent.KIND, - ChatMessageRelayListEvent.KIND, + DmRelayListEvent.KIND, SearchRelayListEvent.KIND, BlockedRelayListEvent.KIND, BlossomServersEvent.KIND, @@ -1926,7 +1926,7 @@ fun MainContent( // Process into chatroomList based on event type when (event) { - is com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent -> { + is com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent -> { iAccount.chatroomList.addMessage( event.chatroomKey(iAccount.pubKey), note, diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/cache/DesktopLocalCache.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/cache/DesktopLocalCache.kt index 1d201d6c6c..39db2557dd 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/cache/DesktopLocalCache.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/cache/DesktopLocalCache.kt @@ -44,7 +44,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.tags.aTag.taggedAddresses import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip18Reposts.quotes.QAddressableTag @@ -52,17 +52,17 @@ import com.vitorpamplona.quartz.nip18Reposts.quotes.QEventTag import com.vitorpamplona.quartz.nip18Reposts.quotes.taggedQuotes import com.vitorpamplona.quartz.nip19Bech32.decodePublicKeyAsHexOrNull import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.OldBookmarkListEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip88Polls.response.PollResponseEvent @@ -310,11 +310,11 @@ class DesktopLocalCache : ICacheProvider { consumeReaction(event, relay) } - is LnZapRequestEvent -> { + is ZapRequestEvent -> { consumeZapRequest(event, relay) } - is LnZapEvent -> { + is ZapReceiptEvent -> { consumeZap(event, relay) } @@ -330,7 +330,7 @@ class DesktopLocalCache : ICacheProvider { consumeContactList(event) } - is LongTextNoteEvent -> { + is LongFormContentEvent -> { consumeLongTextNote(event, relay) } @@ -342,7 +342,7 @@ class DesktopLocalCache : ICacheProvider { consumeOldBookmarkList(event) } - is FollowListEvent -> { + is StarterPackEvent -> { consumeFollowList(event) } @@ -354,7 +354,7 @@ class DesktopLocalCache : ICacheProvider { consumeAdvertisedRelayList(event, relay) } - is ChatMessageRelayListEvent -> { + is DmRelayListEvent -> { consumeChatMessageRelayList(event, relay) } @@ -436,7 +436,7 @@ class DesktopLocalCache : ICacheProvider { * the event stream because the UI doesn't render kind 10050s directly. */ private fun consumeChatMessageRelayList( - event: ChatMessageRelayListEvent, + event: DmRelayListEvent, relay: NormalizedRelayUrl?, ): Boolean { val addressableNote = getOrCreateAddressableNote(event.address()) @@ -586,10 +586,10 @@ class DesktopLocalCache : ICacheProvider { /** * Consumes a kind 9734 zap request event. - * Must be consumed before the corresponding LnZapEvent (kind 9735). + * Must be consumed before the corresponding ZapReceiptEvent (kind 9735). */ private fun consumeZapRequest( - event: LnZapRequestEvent, + event: ZapRequestEvent, relay: NormalizedRelayUrl?, ): Boolean { val note = getOrCreateNote(event.id) @@ -605,7 +605,7 @@ class DesktopLocalCache : ICacheProvider { * Links zap to target notes via the embedded zap request. */ private fun consumeZap( - event: LnZapEvent, + event: ZapReceiptEvent, relay: NormalizedRelayUrl?, ): Boolean { val note = getOrCreateNote(event.id) @@ -739,7 +739,7 @@ class DesktopLocalCache : ICacheProvider { * Creates Note in cache like TextNoteEvent. */ private fun consumeLongTextNote( - event: LongTextNoteEvent, + event: LongFormContentEvent, relay: NormalizedRelayUrl?, ): Boolean { val note = getOrCreateNote(event.id) @@ -788,7 +788,7 @@ class DesktopLocalCache : ICacheProvider { private val _followPackVersion = MutableStateFlow(0L) val followPackVersion: StateFlow = _followPackVersion.asStateFlow() - private fun consumeFollowList(event: FollowListEvent): Boolean { + private fun consumeFollowList(event: StarterPackEvent): Boolean { val address = event.address() val addressableNote = getOrCreateAddressableNote(address) val author = getOrCreateUser(event.pubKey) @@ -883,14 +883,14 @@ class DesktopLocalCache : ICacheProvider { } /** - * Snapshot all 39089 (FollowListEvent) addressable notes currently in cache. + * Snapshot all 39089 (StarterPackEvent) addressable notes currently in cache. * Use [followPackVersion] to drive reactive recomputation. */ - fun snapshotFollowPacks(): List { - val out = mutableListOf() + fun snapshotFollowPacks(): List { + val out = mutableListOf() addressableNotes.forEach { _, note -> val ev = note.event - if (ev is FollowListEvent) out.add(ev) + if (ev is StarterPackEvent) out.add(ev) } return out } @@ -908,10 +908,10 @@ class DesktopLocalCache : ICacheProvider { * @return true if event was processed, false if already seen */ fun consume( - event: LnZapPaymentRequestEvent, + event: NwcRequestEvent, zappedNote: Note?, relay: NormalizedRelayUrl?, - onResponse: suspend (LnZapPaymentResponseEvent) -> Unit, + onResponse: suspend (NwcResponseEvent) -> Unit, wasVerified: Boolean = false, ): Boolean { if (!wasVerified && !justVerify(event)) return false @@ -945,7 +945,7 @@ class DesktopLocalCache : ICacheProvider { */ @OptIn(DelicateCoroutinesApi::class) fun consume( - event: LnZapPaymentResponseEvent, + event: NwcResponseEvent, relay: NormalizedRelayUrl?, wasVerified: Boolean = false, ): Boolean { diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/feeds/DesktopFeedFilters.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/feeds/DesktopFeedFilters.kt index 2dba33235d..9e0830cebe 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/feeds/DesktopFeedFilters.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/feeds/DesktopFeedFilters.kt @@ -35,9 +35,9 @@ import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent private fun isFeedNote(event: Event?): Boolean = @@ -317,11 +317,11 @@ class DesktopReadsFeedFilter( override fun feed(): List = cache.notes - .filterIntoSet { _, note -> note.event is LongTextNoteEvent && !note.isHiddenFor(hidden()) } + .filterIntoSet { _, note -> note.event is LongFormContentEvent && !note.isHiddenFor(hidden()) } .sortedWith(DefaultFeedOrder) .take(limit()) - override fun applyFilter(newItems: Set): Set = newItems.filterTo(HashSet()) { it.event is LongTextNoteEvent && !it.isHiddenFor(hidden()) } + override fun applyFilter(newItems: Set): Set = newItems.filterTo(HashSet()) { it.event is LongFormContentEvent && !it.isHiddenFor(hidden()) } override fun sort(items: Set): List = items.sortedWith(DefaultFeedOrder) @@ -342,7 +342,7 @@ class DesktopNotificationFeedFilter( setOf( TextNoteEvent.KIND, ReactionEvent.KIND, - LnZapEvent.KIND, + ZapReceiptEvent.KIND, ) } diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/BulkFollowAction.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/BulkFollowAction.kt index bcae97ce02..440f4aee46 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/BulkFollowAction.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/BulkFollowAction.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.desktop.cache.DesktopLocalCache import com.vitorpamplona.amethyst.desktop.model.DesktopIAccount import com.vitorpamplona.amethyst.desktop.network.RelayConnectionManager import com.vitorpamplona.quartz.nip01Core.core.HexKey -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent data class BulkFollowPreview( val totalMembers: Int, @@ -52,7 +52,7 @@ object BulkFollowAction { * cached metadata (so the bulk-follow always carries relay hints). */ fun computePreview( - pack: FollowListEvent, + pack: StarterPackEvent, cache: DesktopLocalCache, currentFollows: Set, myPubkey: HexKey, @@ -101,7 +101,7 @@ object BulkFollowAction { /** Unfollows every pack member that the user currently follows. */ suspend fun commitUnfollowAll( - pack: FollowListEvent, + pack: StarterPackEvent, iAccount: DesktopIAccount, relayManager: RelayConnectionManager, cache: DesktopLocalCache, diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/FollowPackEditor.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/FollowPackEditor.kt index 0e11b07b30..d08cf586f1 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/FollowPackEditor.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/FollowPackEditor.kt @@ -21,7 +21,7 @@ package com.vitorpamplona.amethyst.desktop.followpacks import com.vitorpamplona.quartz.nip01Core.core.Address -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent /** * Lightweight helpers for follow-pack viewing actions. @@ -30,12 +30,12 @@ import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent */ object FollowPackEditor { /** Encodes the pack as a `nostr:naddr1…` URI for sharing via clipboard. */ - fun toShareUri(pack: FollowListEvent): String { + fun toShareUri(pack: StarterPackEvent): String { val naddr = com.vitorpamplona.quartz.nip19Bech32.entities .NAddress .create( - kind = FollowListEvent.KIND, + kind = StarterPackEvent.KIND, pubKeyHex = pack.pubKey, dTag = pack.dTag(), relays = emptyList(), @@ -44,5 +44,5 @@ object FollowPackEditor { } /** Address coordinate (e.g. "39089::") — stable identity. */ - fun aTag(pack: FollowListEvent): String = Address.assemble(FollowListEvent.KIND, pack.pubKey, pack.dTag()) + fun aTag(pack: StarterPackEvent): String = Address.assemble(StarterPackEvent.KIND, pack.pubKey, pack.dTag()) } diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/FollowPacksState.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/FollowPacksState.kt index cb506f3282..baac2023fc 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/FollowPacksState.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/FollowPacksState.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.client.reqs.SubscriptionListener import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay @@ -81,7 +81,7 @@ class FollowPacksState( } /** All 39089 events currently in the cache. Recomputes on cache change. */ - val allPacks: StateFlow> = + val allPacks: StateFlow> = cache.followPackVersion .map { cache.snapshotFollowPacks().sortedByDescending { it.createdAt } } .stateIn( @@ -91,7 +91,7 @@ class FollowPacksState( ) /** Packs authored by accounts the user follows. Top-3 for sidebar. */ - val followedAuthorsPacks: StateFlow> = + val followedAuthorsPacks: StateFlow> = combine(allPacks, followedAuthors) { packs, followed -> packs.filter { it.pubKey in followed } }.stateIn( @@ -104,7 +104,7 @@ class FollowPacksState( * Sidebar top-3: own packs + packs by people user follows. * Falls back to most-recent-from-relays when user has no follow-derived packs. */ - val sidebarTopPacks: StateFlow> = + val sidebarTopPacks: StateFlow> = followedAuthorsPacks .map { followedPacks -> if (followedPacks.isNotEmpty()) { @@ -128,8 +128,8 @@ class FollowPacksState( private val recentlyShown = ArrayDeque(5) - private val featuredPackInternal = MutableStateFlow(null) - val featuredPack: StateFlow = featuredPackInternal.asStateFlow() + private val featuredPackInternal = MutableStateFlow(null) + val featuredPack: StateFlow = featuredPackInternal.asStateFlow() init { // Recompute featured on cache or shuffle change. @@ -147,7 +147,7 @@ class FollowPacksState( shuffleTickInternal.value++ } - private fun pickRandom(packs: List): FollowListEvent? { + private fun pickRandom(packs: List): StarterPackEvent? { if (packs.isEmpty()) return null val candidates = packs.filter { it.address().toValue() !in recentlyShown } val pool = if (candidates.isEmpty()) packs else candidates @@ -182,7 +182,7 @@ class FollowPacksState( relayManager.subscribeOnRelay( relay = relay, subId = "$SUB_ID-${relay.url.hashCode()}", - filters = listOf(Filter(kinds = listOf(FollowListEvent.KIND), limit = 200)), + filters = listOf(Filter(kinds = listOf(StarterPackEvent.KIND), limit = 200)), onEvent = { event, r -> cache.consume(event, r) }, ) // Suppress unused variable warning @@ -193,5 +193,5 @@ class FollowPacksState( } /** Returns hashtags present on this pack, lowercase + deduped. */ - fun hashtagsFor(pack: FollowListEvent): List = pack.hashtags().map { it.lowercase() }.distinct() + fun hashtagsFor(pack: StarterPackEvent): List = pack.hashtags().map { it.lowercase() }.distinct() } diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/DiscoverScreen.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/DiscoverScreen.kt index 13a34faf40..ad675bc830 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/DiscoverScreen.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/DiscoverScreen.kt @@ -71,7 +71,7 @@ import com.vitorpamplona.amethyst.desktop.model.DesktopIAccount import com.vitorpamplona.amethyst.desktop.network.RelayConnectionManager import com.vitorpamplona.amethyst.desktop.ui.ZapFeedback import com.vitorpamplona.amethyst.desktop.ui.live.LivesSection -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import kotlinx.coroutines.launch import java.awt.Toolkit import java.awt.datatransfer.StringSelection @@ -280,7 +280,7 @@ fun DiscoverScreen( @Composable private fun MiniPackThumb( - pack: FollowListEvent, + pack: StarterPackEvent, onClick: () -> Unit, ) { val title = pack.title()?.ifBlank { null } ?: "Untitled pack" diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/FollowAllConfirmDialog.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/FollowAllConfirmDialog.kt index d5ffe5d4e5..16f8d6b122 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/FollowAllConfirmDialog.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/FollowAllConfirmDialog.kt @@ -42,7 +42,7 @@ import com.vitorpamplona.amethyst.desktop.followpacks.BulkFollowAction import com.vitorpamplona.amethyst.desktop.followpacks.BulkFollowPreview import com.vitorpamplona.amethyst.desktop.model.DesktopIAccount import com.vitorpamplona.amethyst.desktop.network.RelayConnectionManager -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import kotlinx.coroutines.delay import kotlinx.coroutines.launch @@ -54,7 +54,7 @@ import kotlinx.coroutines.launch */ @Composable fun FollowAllConfirmDialog( - pack: FollowListEvent, + pack: StarterPackEvent, iAccount: DesktopIAccount, cache: DesktopLocalCache, relayManager: RelayConnectionManager, diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/FollowPackBrowseAllScreen.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/FollowPackBrowseAllScreen.kt index 60ed6c4164..4dfd5696ad 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/FollowPackBrowseAllScreen.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/FollowPackBrowseAllScreen.kt @@ -53,7 +53,7 @@ import com.vitorpamplona.amethyst.desktop.followpacks.FollowPackEditor import com.vitorpamplona.amethyst.desktop.followpacks.FollowPacksState import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip19Bech32.decodePublicKeyAsHexOrNull -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent /** * Search-all view for follow packs. @@ -138,10 +138,10 @@ fun FollowPackBrowseAllScreen( } private fun filter( - packs: List, + packs: List, raw: String, cache: DesktopLocalCache, -): List { +): List { val q = raw.lowercase() val asHex: HexKey? = decodePublicKeyAsHexOrNull(raw) return packs.filter { pack -> diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/FollowPackComponents.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/FollowPackComponents.kt index a3c78d9a1e..5a0524f2ab 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/FollowPackComponents.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/FollowPackComponents.kt @@ -62,7 +62,7 @@ import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols import com.vitorpamplona.amethyst.commons.ui.components.UserAvatar import com.vitorpamplona.amethyst.desktop.cache.DesktopLocalCache import com.vitorpamplona.quartz.nip01Core.core.HexKey -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent /** * Stack of overlapping circular avatars for pack members. @@ -143,7 +143,7 @@ fun FollowPackAvatarStack( */ @Composable fun FollowPackHeroCard( - pack: FollowListEvent, + pack: StarterPackEvent, cache: DesktopLocalCache, onFollowAll: () -> Unit, onShare: () -> Unit, @@ -284,7 +284,7 @@ fun FollowPackChipRail( */ @Composable fun FollowPackRow( - pack: FollowListEvent, + pack: StarterPackEvent, cache: DesktopLocalCache, onClick: () -> Unit, modifier: Modifier = Modifier, diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/FollowPackDetailScreen.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/FollowPackDetailScreen.kt index ae07b1d85d..b7f82a76b3 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/FollowPackDetailScreen.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/FollowPackDetailScreen.kt @@ -68,7 +68,7 @@ import com.vitorpamplona.amethyst.desktop.followpacks.subscribeMetadataFor import com.vitorpamplona.amethyst.desktop.model.DesktopIAccount import com.vitorpamplona.amethyst.desktop.network.RelayConnectionManager import com.vitorpamplona.quartz.nip01Core.core.HexKey -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import kotlinx.coroutines.launch /** @@ -94,7 +94,7 @@ fun FollowPackDetailScreen( @Suppress("UNUSED_VARIABLE") val metadataVersion by cache.metadataVersion.collectAsState() - val pack: FollowListEvent? = + val pack: StarterPackEvent? = remember(addressTag, allPacks) { allPacks.firstOrNull { FollowPackEditor.aTag(it) == addressTag } } @@ -208,7 +208,7 @@ fun FollowPackDetailScreen( @Composable private fun PackHeroDetail( - pack: FollowListEvent, + pack: StarterPackEvent, cache: DesktopLocalCache, onFollowAll: () -> Unit, onShare: () -> Unit, diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/RenderFollowPackCard.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/RenderFollowPackCard.kt index 3a1bc3f9b6..255e223ef7 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/RenderFollowPackCard.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/followpacks/ui/RenderFollowPackCard.kt @@ -58,7 +58,7 @@ import com.vitorpamplona.amethyst.desktop.model.DesktopIAccount import com.vitorpamplona.amethyst.desktop.network.RelayConnectionManager import com.vitorpamplona.quartz.nip01Core.core.Address import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip19Bech32.entities.NAddress as NAddressEntity /** @@ -81,7 +81,7 @@ fun RenderFollowPackCard( val packVersion by cache.followPackVersion.collectAsState() val aTag = remember(address) { Address.assemble(address.kind, address.author, address.dTag) } - val pack: FollowListEvent? = + val pack: StarterPackEvent? = remember(packVersion, aTag) { cache.snapshotFollowPacks().firstOrNull { FollowPackEditor.aTag(it) == aTag } } diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopAccountRelays.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopAccountRelays.kt index 6a911cb6af..ef8963f466 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopAccountRelays.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopAccountRelays.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BlockedRelayListEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent @@ -45,7 +45,7 @@ import java.util.prefs.Preferences * simpler relay management. * * On Android, Account.dmRelays aggregates: - * - DmRelayListState (ChatMessageRelayListEvent, kind 10050) + * - DmRelayListState (DmRelayListEvent, kind 10050) * - Nip65RelayListState (NIP-65 advertised relays) * - PrivateStorageRelayListState * - LocalRelayListState @@ -119,8 +119,8 @@ class DesktopAccountRelays( private fun loadFromPersistence() { // Load DM relays from event or URL cache - val dmEvent = loadEvent(ChatMessageRelayListEvent.KIND) - if (dmEvent is ChatMessageRelayListEvent) { + val dmEvent = loadEvent(DmRelayListEvent.KIND) + if (dmEvent is DmRelayListEvent) { _dmRelayList.value = dmEvent.relays().toSet() lastDmCreatedAt.set(dmEvent.createdAt) } else { @@ -160,8 +160,8 @@ class DesktopAccountRelays( true } - ChatMessageRelayListEvent.KIND -> { - if (event is ChatMessageRelayListEvent && event.createdAt >= lastDmCreatedAt.get()) { + DmRelayListEvent.KIND -> { + if (event is DmRelayListEvent && event.createdAt >= lastDmCreatedAt.get()) { lastDmCreatedAt.set(event.createdAt) val relays = event.relays().toSet() _dmRelayList.value = relays diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopDmRelayState.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopDmRelayState.kt index 3a193f95ec..9bd76f9ef6 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopDmRelayState.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopDmRelayState.kt @@ -33,7 +33,7 @@ import kotlinx.coroutines.flow.stateIn * Desktop equivalent of DmInboxRelayState. * * Aggregates DM inbox relays from multiple sources: - * - DM relay list (NIP-17 ChatMessageRelayListEvent, kind 10050) + * - DM relay list (NIP-17 DmRelayListEvent, kind 10050) * - Connected relays (fallback when no DM-specific relays are configured) * * On Android, the full Account class manages four relay sources: diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopHiddenUsersState.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopHiddenUsersState.kt index 81356eadc7..b298746177 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopHiddenUsersState.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopHiddenUsersState.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.amethyst.commons.model.nip51Lists.muteList.MuteListDecr import com.vitorpamplona.amethyst.commons.model.nip51Lists.peopleList.PeopleListDecryptionCache import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import com.vitorpamplona.quartz.utils.DualCase import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -43,7 +43,7 @@ import kotlinx.coroutines.flow.stateIn * Desktop mute/block state holder. * * Assembles the user's NIP-51 mute list (kind 10000, [MuteListEvent]) and the - * legacy block people list (kind 30000 `d=mute`, [PeopleListEvent]) into a single + * legacy block people list (kind 30000 `d=mute`, [FollowSetEvent]) into a single * [LiveHiddenUsers] value that [com.vitorpamplona.amethyst.desktop.model.DesktopIAccount] * feeds to [com.vitorpamplona.amethyst.commons.model.Note.isHiddenFor]. * @@ -69,7 +69,7 @@ class DesktopHiddenUsersState( // Strong refs so the GC keeps these addressable notes (and their decrypt caches) alive. private val muteListNote = cache.getOrCreateAddressableNote(MuteListEvent.createAddress(signer.pubKey)) - private val blockListNote = cache.getOrCreateAddressableNote(PeopleListEvent.createBlockAddress(signer.pubKey)) + private val blockListNote = cache.getOrCreateAddressableNote(FollowSetEvent.createBlockAddress(signer.pubKey)) /** Session-only user hides (e.g. "hide this spammer" without persisting a mute). */ val transientHiddenUsers = MutableStateFlow>(emptySet()) @@ -79,7 +79,7 @@ class DesktopHiddenUsersState( private suspend fun assemble( muteEvent: MuteListEvent?, - blockEvent: PeopleListEvent?, + blockEvent: FollowSetEvent?, transient: Set, showSensitive: Boolean?, ): LiveHiddenUsers { @@ -118,7 +118,7 @@ class DesktopHiddenUsersState( ) { muteState, blockState, transient, showSensitive -> assemble( muteState.note.event as? MuteListEvent, - blockState.note.event as? PeopleListEvent, + blockState.note.event as? FollowSetEvent, transient, showSensitive, ) diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopIAccount.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopIAccount.kt index e68f95c233..b1c29e32ee 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopIAccount.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopIAccount.kt @@ -46,12 +46,12 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip17Dm.NIP17Factory import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip47WalletConnect.rpc.Request import com.vitorpamplona.quartz.nip47WalletConnect.rpc.Response import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent @@ -222,9 +222,9 @@ class DesktopIAccount( override val nip47SignerState: INwcSignerState = object : INwcSignerState { - override suspend fun decryptResponse(event: LnZapPaymentResponseEvent): Response? = null + override suspend fun decryptResponse(event: NwcResponseEvent): Response? = null - override suspend fun decryptRequest(event: LnZapPaymentRequestEvent): Request? = null + override suspend fun decryptRequest(event: NwcRequestEvent): Request? = null override fun isNIP47Author(pubKey: String?): Boolean = false } @@ -249,7 +249,7 @@ class DesktopIAccount( return !note.isHiddenFor(hiddenUsersState.flow.value) } - override suspend fun sendNip04PrivateMessage(eventTemplate: EventTemplate) { + override suspend fun sendNip04PrivateMessage(eventTemplate: EventTemplate) { if (!isWriteable()) return val signedEvent = signer.sign(eventTemplate) diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopRelayListMutator.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopRelayListMutator.kt index d704b2b7d6..07dfb77539 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopRelayListMutator.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/model/DesktopRelayListMutator.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.amethyst.commons.relays.health.RelayRemovalResult import com.vitorpamplona.amethyst.desktop.network.RelayConnectionManager import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BlockedRelayListEvent import kotlinx.coroutines.async @@ -80,7 +80,7 @@ class DesktopRelayListMutator( async { runCatching { val newRelays = (dmRelays - url).toList() - val event = ChatMessageRelayListEvent.create(newRelays, signer) + val event = DmRelayListEvent.create(newRelays, signer) accountRelays.consumePublishedEvent(event) relayManager.broadcastToAll(event) }.fold(onSuccess = { null }, onFailure = { RelayListKind.DmInbox }) diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/nwc/NwcPaymentHandler.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/nwc/NwcPaymentHandler.kt index 4fcd463061..514d85b0b2 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/nwc/NwcPaymentHandler.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/nwc/NwcPaymentHandler.kt @@ -29,8 +29,8 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip47WalletConnect.Nip47Client import com.vitorpamplona.quartz.nip47WalletConnect.Nip47WalletConnect -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip47WalletConnect.rpc.GetBalanceSuccessResponse import com.vitorpamplona.quartz.nip47WalletConnect.rpc.IErrorResponseLike import com.vitorpamplona.quartz.nip47WalletConnect.rpc.MakeInvoiceSuccessResponse @@ -93,7 +93,7 @@ class NwcPaymentHandler( // Create payment request event val requestEvent = - LnZapPaymentRequestEvent.create( + NwcRequestEvent.create( lnInvoice = bolt11, walletServicePubkey = nwcConnection.pubKeyHex, signer = nwcSigner, @@ -126,7 +126,7 @@ class NwcPaymentHandler( suspendCancellableCoroutine { continuation -> val filter = Filter( - kinds = listOf(LnZapPaymentResponseEvent.KIND), + kinds = listOf(NwcResponseEvent.KIND), authors = listOf(nwcConnection.pubKeyHex), tags = mapOf("e" to listOf(requestId)), ) @@ -138,7 +138,7 @@ class NwcPaymentHandler( subId = subId, filters = listOf(filter), onEvent = { event, relay -> - if (event is LnZapPaymentResponseEvent && event.requestId() == requestId) { + if (event is NwcResponseEvent && event.requestId() == requestId) { // Move verify + cache mutation + decrypt off the relay's // WebSocket reader thread; Schnorr verify is non-trivial // CPU work and shouldn't block frame parsing. @@ -313,7 +313,7 @@ class NwcPaymentHandler( suspendCancellableCoroutine { continuation -> val filter = Filter( - kinds = listOf(LnZapPaymentResponseEvent.KIND), + kinds = listOf(NwcResponseEvent.KIND), authors = listOf(nwcConnection.pubKeyHex), tags = mapOf("e" to listOf(requestId)), ) @@ -325,7 +325,7 @@ class NwcPaymentHandler( subId = subId, filters = listOf(filter), onEvent = { event, _ -> - if (event is LnZapPaymentResponseEvent && event.requestId() == requestId) { + if (event is NwcResponseEvent && event.requestId() == requestId) { @OptIn(kotlinx.coroutines.DelicateCoroutinesApi::class) kotlinx.coroutines.GlobalScope.launch(kotlinx.coroutines.Dispatchers.IO) { if (!localCache.justVerify(event)) return@launch diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/subscriptions/DesktopRelaySubscriptionsCoordinator.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/subscriptions/DesktopRelaySubscriptionsCoordinator.kt index 78c1cffa71..d72846949e 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/subscriptions/DesktopRelaySubscriptionsCoordinator.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/subscriptions/DesktopRelaySubscriptionsCoordinator.kt @@ -310,7 +310,7 @@ class DesktopRelaySubscriptionsCoordinator( ), // Zap receipts (kind 9735) targeting these notes Filter( - kinds = listOf(com.vitorpamplona.quartz.nip57Zaps.LnZapEvent.KIND), + kinds = listOf(com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent.KIND), tags = mapOf("e" to noteIds), ), // Reposts (kind 6) targeting these notes diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/subscriptions/FilterBuilders.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/subscriptions/FilterBuilders.kt index 525013809f..0b2d354bdd 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/subscriptions/FilterBuilders.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/subscriptions/FilterBuilders.kt @@ -447,7 +447,7 @@ object FilterBuilders { limit: Int? = null, ): Filter = Filter( - kinds = listOf(9735), // LnZapEvent.KIND + kinds = listOf(9735), // ZapReceiptEvent.KIND tags = mapOf("e" to eventIds), limit = limit, ) @@ -517,7 +517,7 @@ object FilterBuilders { since: Long? = null, ): Filter = Filter( - kinds = listOf(4), // PrivateDmEvent.KIND + kinds = listOf(4), // EncryptedDmEvent.KIND tags = mapOf("p" to listOf(pubKeyHex)), limit = limit, since = since, @@ -537,7 +537,7 @@ object FilterBuilders { since: Long? = null, ): Filter = Filter( - kinds = listOf(4), // PrivateDmEvent.KIND + kinds = listOf(4), // EncryptedDmEvent.KIND authors = listOf(pubKeyHex), limit = limit, since = since, @@ -569,7 +569,7 @@ object FilterBuilders { */ fun dmRelayList(pubKeyHex: String): Filter = Filter( - kinds = listOf(10050), // ChatMessageRelayListEvent.KIND + kinds = listOf(10050), // DmRelayListEvent.KIND authors = listOf(pubKeyHex), limit = 1, ) @@ -588,7 +588,7 @@ object FilterBuilders { until: Long? = null, ): Filter = Filter( - kinds = listOf(30023), // LongTextNoteEvent.KIND + kinds = listOf(30023), // LongFormContentEvent.KIND limit = limit, since = since, until = until, @@ -606,7 +606,7 @@ object FilterBuilders { dTag: String, ): Filter = Filter( - kinds = listOf(30023), // LongTextNoteEvent.KIND + kinds = listOf(30023), // LongFormContentEvent.KIND authors = listOf(pubkey), tags = mapOf("d" to listOf(dTag)), limit = 1, @@ -628,7 +628,7 @@ object FilterBuilders { until: Long? = null, ): Filter = Filter( - kinds = listOf(30023), // LongTextNoteEvent.KIND + kinds = listOf(30023), // LongFormContentEvent.KIND authors = authors, limit = limit, since = since, diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/subscriptions/FilterDMs.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/subscriptions/FilterDMs.kt index 9ab82738b8..e9f52e6115 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/subscriptions/FilterDMs.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/subscriptions/FilterDMs.kt @@ -24,7 +24,7 @@ import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.EphemeralGiftWrapEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent @@ -50,7 +50,7 @@ object FilterDMs { limit: Int? = null, ): Filter = Filter( - kinds = listOf(PrivateDmEvent.KIND), + kinds = listOf(EncryptedDmEvent.KIND), tags = mapOf("p" to listOf(userPubKeyHex)), since = since, limit = limit, @@ -70,7 +70,7 @@ object FilterDMs { limit: Int? = null, ): Filter = Filter( - kinds = listOf(PrivateDmEvent.KIND), + kinds = listOf(EncryptedDmEvent.KIND), authors = listOf(userPubKeyHex), since = since, limit = limit, @@ -96,14 +96,14 @@ object FilterDMs { return listOf( // Messages TO me from conversation participants Filter( - kinds = listOf(PrivateDmEvent.KIND), + kinds = listOf(EncryptedDmEvent.KIND), authors = conversationPubKeys.toList(), tags = mapOf("p" to listOf(userPubKeyHex)), since = since, ), // Messages FROM me to conversation participants Filter( - kinds = listOf(PrivateDmEvent.KIND), + kinds = listOf(EncryptedDmEvent.KIND), authors = listOf(userPubKeyHex), tags = mapOf("p" to conversationPubKeys.toList()), since = since, diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/ArticleReaderScreen.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/ArticleReaderScreen.kt index 8092de6e4e..4a97e66179 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/ArticleReaderScreen.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/ArticleReaderScreen.kt @@ -91,11 +91,11 @@ import com.vitorpamplona.amethyst.desktop.subscriptions.rememberSubscription import com.vitorpamplona.amethyst.desktop.ui.highlights.ArticleHighlightsPanel import com.vitorpamplona.amethyst.desktop.ui.highlights.HighlightAnnotationDialog import com.vitorpamplona.quartz.nip18Reposts.RepostEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip47WalletConnect.Nip47WalletConnect import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import kotlinx.coroutines.launch import java.text.DateFormat import java.util.Date @@ -144,7 +144,7 @@ fun ArticleReaderScreen( val dTag = parsed?.third // Article state - var article by remember(addressTag) { mutableStateOf(null) } + var article by remember(addressTag) { mutableStateOf(null) } var eoseReceived by remember(addressTag) { mutableStateOf(false) } // Zoom level for article text @@ -212,7 +212,7 @@ fun ArticleReaderScreen( filters = listOf(FilterBuilders.longFormByAddress(pubkey, dTag)), relays = configuredRelays, onEvent = { event, _, _, _ -> - if (event is LongTextNoteEvent) { + if (event is LongFormContentEvent) { // Keep the most recent version val current = article if (current == null || event.createdAt > current.createdAt) { @@ -246,7 +246,7 @@ fun ArticleReaderScreen( relays = configuredRelays, eventIds = eventIds, onEvent = { event, _, _, _ -> - if (event is LnZapEvent) { + if (event is ZapReceiptEvent) { val receipt = event.toZapReceipt(localCache) ?: return@createZapsSubscription if (zapReceipts.none { it.createdAt == receipt.createdAt && it.senderPubKey == receipt.senderPubKey }) { zapReceipts = zapReceipts + receipt diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/NoteActions.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/NoteActions.kt index 34cdbcfae5..9d4c62415b 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/NoteActions.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/NoteActions.kt @@ -102,7 +102,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip47WalletConnect.Nip47WalletConnect import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip88Polls.poll.tags.PollType import com.vitorpamplona.quartz.nip88Polls.response.PollResponseEvent @@ -168,9 +168,9 @@ data class ZapReceipt( ) /** - * Converts an LnZapEvent to a ZapReceipt for display. + * Converts an ZapReceiptEvent to a ZapReceipt for display. */ -fun LnZapEvent.toZapReceipt(localCache: DesktopLocalCache): ZapReceipt? { +fun ZapReceiptEvent.toZapReceipt(localCache: DesktopLocalCache): ZapReceipt? { val senderPubKey = zappedRequestAuthor() ?: return null val amountSats = amount?.toLong() ?: return null @@ -484,7 +484,7 @@ fun ZapReceiptsPopup( val name = user?.toBestDisplayName() ?: pubKey.take(12) val pictureUrl = user?.profilePicture() val amount = - (receipt?.event as? LnZapEvent)?.amount?.toLong() + (receipt?.event as? ZapReceiptEvent)?.amount?.toLong() ?: return@mapNotNull null val message = request.event?.content?.ifBlank { null } ZapEntry(pubKey, pictureUrl, name, amount, message) diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/NotificationsScreen.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/NotificationsScreen.kt index 4bdb8f1083..3791bfcfbf 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/NotificationsScreen.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/NotificationsScreen.kt @@ -87,7 +87,7 @@ import com.vitorpamplona.amethyst.desktop.ui.notifications.NotificationGroup import com.vitorpamplona.amethyst.desktop.ui.notifications.groupNotifications import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.core.hexToByteArrayOrNull -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent @@ -97,7 +97,7 @@ import com.vitorpamplona.quartz.nip19Bech32.toNpub import com.vitorpamplona.quartz.nip22Comments.CommentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nip61Nutzaps.nutzap.NutzapEvent @@ -157,7 +157,7 @@ sealed class NotificationItem( val NotificationItem.effectiveAuthorPubKey: String get() = when (val e = event) { - is LnZapEvent -> e.zapRequest?.pubKey ?: e.pubKey + is ZapReceiptEvent -> e.zapRequest?.pubKey ?: e.pubKey else -> event.pubKey } @@ -169,7 +169,7 @@ private fun classifyNotification(event: Event): NotificationItem? = when (event) { is ReactionEvent -> NotificationItem.Reaction(event, event.createdAt, event.content) is RepostEvent, is GenericRepostEvent -> NotificationItem.Repost(event, event.createdAt) - is LnZapEvent -> NotificationItem.Zap(event, event.createdAt, event.amount?.toLong()) + is ZapReceiptEvent -> NotificationItem.Zap(event, event.createdAt, event.amount?.toLong()) // Nutzaps: treat like a zap; sats amount extraction requires the Cashu // token proof and is deferred to when Desktop renders zap detail. is NutzapEvent -> NotificationItem.Zap(event, event.createdAt, null) @@ -186,7 +186,7 @@ private fun classifyNotification(event: Event): NotificationItem? = // NIP-28 channel messages read like public mentions. is ChannelMessageEvent -> NotificationItem.Mention(event, event.createdAt) // DMs (NIP-04 legacy + NIP-17 gift-wrap + rumor + file-header). - is PrivateDmEvent, + is EncryptedDmEvent, is ChatMessageEvent, is GiftWrapEvent, is ChatMessageEncryptedFileHeaderEvent, diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/ReadsScreen.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/ReadsScreen.kt index 96a44b0cee..42fd5cfb90 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/ReadsScreen.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/ReadsScreen.kt @@ -67,7 +67,7 @@ import com.vitorpamplona.amethyst.desktop.subscriptions.createFollowingLongFormF import com.vitorpamplona.amethyst.desktop.subscriptions.createLongFormFeedSubscription import com.vitorpamplona.amethyst.desktop.subscriptions.rememberSubscription import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip47WalletConnect.Nip47WalletConnect import java.text.DateFormat import java.util.Date @@ -83,7 +83,7 @@ private fun formatDate(timestamp: Long): String = dateFormat.format(Date(timesta */ @Composable fun LongFormCard( - event: LongTextNoteEvent, + event: LongFormContentEvent, localCache: DesktopLocalCache, onAuthorClick: (String) -> Unit = {}, onClick: () -> Unit = {}, @@ -185,9 +185,9 @@ fun ReadsScreen( val eventState = remember { - EventCollectionState( + EventCollectionState( getId = { it.id }, - sortComparator = compareByDescending { it.publishedAt() ?: it.createdAt }.thenBy { it.id }, + sortComparator = compareByDescending { it.publishedAt() ?: it.createdAt }.thenBy { it.id }, maxSize = 100, scope = scope, ) @@ -204,10 +204,10 @@ fun ReadsScreen( LaunchedEffect(Unit) { val cached = localCache.notes.filterIntoSet { _, note -> - note.event is LongTextNoteEvent + note.event is LongFormContentEvent } cached.forEach { note -> - (note.event as? LongTextNoteEvent)?.let { eventState.addItem(it) } + (note.event as? LongFormContentEvent)?.let { eventState.addItem(it) } } if (cached.isNotEmpty()) eoseReceivedCount++ } @@ -249,7 +249,7 @@ fun ReadsScreen( relays = connectedRelays, onEvent = { event, _, relay, _ -> subscriptionsCoordinator?.consumeEvent(event, relay) - if (event is LongTextNoteEvent) { + if (event is LongFormContentEvent) { eventState.addItem(event) } }, @@ -266,7 +266,7 @@ fun ReadsScreen( followedUsers = followedUsers.toList(), onEvent = { event, _, relay, _ -> subscriptionsCoordinator?.consumeEvent(event, relay) - if (event is LongTextNoteEvent) { + if (event is LongFormContentEvent) { eventState.addItem(event) } }, diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/UserProfileScreen.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/UserProfileScreen.kt index bf08ddbbc2..7264e2d71b 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/UserProfileScreen.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/UserProfileScreen.kt @@ -117,7 +117,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip19Bech32.toNpub -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip39ExtIdentities.ExternalIdentitiesEvent import com.vitorpamplona.quartz.nip39ExtIdentities.GitHubIdentity import com.vitorpamplona.quartz.nip39ExtIdentities.MastodonIdentity @@ -125,9 +125,9 @@ import com.vitorpamplona.quartz.nip39ExtIdentities.TwitterIdentity import com.vitorpamplona.quartz.nip39ExtIdentities.identityClaims import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.tags.EventBookmark -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip51Lists.muteList.tags.UserTag -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent @@ -231,7 +231,7 @@ fun UserProfileScreen( var showProfileReportDialog by remember(pubKeyHex) { mutableStateOf(false) } var showAddToListMenu by remember(pubKeyHex) { mutableStateOf(false) } val followPacksState = LocalFollowPacksState.current - val followPacks by (followPacksState?.allPacks ?: MutableStateFlow(emptyList())).collectAsState() + val followPacks by (followPacksState?.allPacks ?: MutableStateFlow(emptyList())).collectAsState() val profileHidden by (iAccount?.hiddenUsers ?: kotlinx.coroutines.flow.MutableStateFlow(com.vitorpamplona.amethyst.commons.model.LiveHiddenUsers.EMPTY)).collectAsState() val isUserMuted = profileHidden.isUserHidden(pubKeyHex) @@ -351,7 +351,7 @@ fun UserProfileScreen( var selectedTab by remember { mutableStateOf(0) } var lightboxState by remember { mutableStateOf(null) } val pictureEvents = remember { mutableStateListOf() } - val articleEvents = remember { mutableStateListOf() } + val articleEvents = remember { mutableStateListOf() } val highlightEvents = remember { mutableStateListOf() } // Followers / Following user lists (pubkeys) and the profile's relay list. @@ -361,7 +361,7 @@ fun UserProfileScreen( var relayList by remember(pubKeyHex) { mutableStateOf>>(emptyList()) } // Zaps received: raw zap receipts, aggregated per zapper (pubkey → total sats). - val zapEvents = remember(pubKeyHex) { mutableStateListOf() } + val zapEvents = remember(pubKeyHex) { mutableStateListOf() } var zapAmounts by remember(pubKeyHex) { mutableStateOf>>(emptyList()) } var zapTotalSats by remember(pubKeyHex) { mutableStateOf(BigDecimal.ZERO) } @@ -559,13 +559,13 @@ fun UserProfileScreen( listOf( FilterBuilders.byAuthors( authors = listOf(pubKeyHex), - kinds = listOf(LongTextNoteEvent.KIND), + kinds = listOf(LongFormContentEvent.KIND), limit = 50, ), ), relays = connectedRelays, onEvent = { event, _, _, _ -> - if (event is LongTextNoteEvent && articleEvents.none { it.id == event.id }) { + if (event is LongFormContentEvent && articleEvents.none { it.id == event.id }) { articleEvents.add(event) } }, @@ -710,13 +710,13 @@ fun UserProfileScreen( listOf( FilterBuilders.byPTags( pubKeys = listOf(pubKeyHex), - kinds = listOf(LnZapEvent.KIND), + kinds = listOf(ZapReceiptEvent.KIND), limit = 500, ), ), relays = connectedRelays, onEvent = { event, _, _, _ -> - if (event is LnZapEvent && zapEvents.none { it.id == event.id }) { + if (event is ZapReceiptEvent && zapEvents.none { it.id == event.id }) { zapEvents.add(event) } }, @@ -971,7 +971,7 @@ fun UserProfileScreen( scope.launch { try { val updated = - FollowListEvent.add( + StarterPackEvent.add( pack, UserTag(pubKeyHex, null), acct.signer, @@ -1447,7 +1447,7 @@ fun UserProfileScreen( } } else { items( - articleEvents.sortedWith(compareByDescending { it.publishedAt() ?: it.createdAt }.thenBy { it.id }), + articleEvents.sortedWith(compareByDescending { it.publishedAt() ?: it.createdAt }.thenBy { it.id }), key = { "art-${it.id}" }, ) { article -> LongFormCard( @@ -1455,7 +1455,7 @@ fun UserProfileScreen( localCache = localCache, onAuthorClick = { onNavigateToProfile(article.pubKey) }, onClick = { - val addressTag = "${LongTextNoteEvent.KIND}:${article.pubKey}:${article.dTag()}" + val addressTag = "${LongFormContentEvent.KIND}:${article.pubKey}:${article.dTag()}" onNavigateToArticle(addressTag) }, ) diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/chats/ChatPane.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/chats/ChatPane.kt index 1c3fc89cf5..c34aea979b 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/chats/ChatPane.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/chats/ChatPane.kt @@ -125,7 +125,7 @@ import com.vitorpamplona.amethyst.desktop.ui.media.QualitySelectorChip import com.vitorpamplona.amethyst.desktop.ui.note.DesktopRichText import com.vitorpamplona.amethyst.desktop.ui.note.RichTextCallbacks import com.vitorpamplona.quartz.nip01Core.hints.EventHintBundle -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip17Dm.NIP17Factory import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKey import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent @@ -714,7 +714,7 @@ private fun MessageWithReactions( LaunchedEffect(note.idHex, event) { decryptedContent = when (event) { - is PrivateDmEvent -> { + is EncryptedDmEvent -> { try { event.decryptContent(account.signer) } catch (_: Exception) { @@ -776,7 +776,7 @@ private fun MessageWithReactions( ) { // Encryption badge when (event) { - is PrivateDmEvent -> { + is EncryptedDmEvent -> { Icon( MaterialSymbols.LockOpen, contentDescription = "NIP-04 (legacy)", @@ -947,7 +947,7 @@ private fun MessageReplyContext( preview = when (val e = parent.event) { is ChatMessageEncryptedFileHeaderEvent -> "📎 Attachment" - is PrivateDmEvent -> + is EncryptedDmEvent -> try { e.decryptContent(account.signer) } catch (_: Exception) { @@ -1076,7 +1076,7 @@ private fun ReplyPreviewBar( preview = when (event) { is ChatMessageEncryptedFileHeaderEvent -> "📎 Attachment" - is PrivateDmEvent -> + is EncryptedDmEvent -> try { event.decryptContent(account.signer) } catch (_: Exception) { diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/chats/ChatroomListState.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/chats/ChatroomListState.kt index 2b18254d14..34873597ac 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/chats/ChatroomListState.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/chats/ChatroomListState.kt @@ -33,7 +33,7 @@ import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip01Core.relay.client.reqs.SubscriptionListener import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip17Dm.base.ChatroomKey import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -138,7 +138,7 @@ class ChatroomListState( private suspend fun decryptPreview(event: com.vitorpamplona.quartz.nip01Core.core.Event?): String { if (event == null) return "" return when (event) { - is PrivateDmEvent -> { + is EncryptedDmEvent -> { decryptedContentCache.getOrPut(event.id) { try { event.decryptContent(account.signer) diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/chats/composer/GifResult.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/chats/composer/GifResult.kt index f8eaa49707..302b3651dd 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/chats/composer/GifResult.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/chats/composer/GifResult.kt @@ -23,7 +23,7 @@ package com.vitorpamplona.amethyst.desktop.ui.chats.composer import com.vitorpamplona.quartz.nip01Core.relay.client.INostrClient import com.vitorpamplona.quartz.nip01Core.relay.client.accessories.fetchAll import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent /** A single GIF result surfaced from a NIP-94 (kind 1063) metadata event. */ data class GifResult( @@ -47,7 +47,7 @@ suspend fun searchGifs( val trimmed = query.trim() val filter = Filter( - kinds = listOf(FileHeaderEvent.KIND), + kinds = listOf(FileMetadataEvent.KIND), tags = mapOf("m" to listOf("image/gif")), limit = limitPerRelay, search = trimmed.ifBlank { null }, @@ -59,7 +59,7 @@ suspend fun searchGifs( runCatching { client.fetchAll(relay, filter, idleTimeoutMs = 8_000L) } .getOrDefault(emptyList()) for (event in events) { - val fileHeader = event as? FileHeaderEvent ?: continue + val fileHeader = event as? FileMetadataEvent ?: continue val url = fileHeader.url() ?: continue raw.add(GifResult(url = url, description = fileHeader.content)) } diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/note/DesktopRichText.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/note/DesktopRichText.kt index 62f67372bb..6c6e49ad14 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/note/DesktopRichText.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/note/DesktopRichText.kt @@ -376,7 +376,7 @@ private fun RenderBechSegment( .NAddress .parse(segment.segmentText) } - if (naddr != null && naddr.kind == com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent.KIND) { + if (naddr != null && naddr.kind == com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent.KIND) { val followPacks = com.vitorpamplona.amethyst.desktop.ui.deck.LocalFollowPacksState.current val relayManager = com.vitorpamplona.amethyst.desktop.ui.deck.LocalRelayManager.current if (localCache != null && relayManager != null && followPacks != null) { diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/notifications/DesktopNotificationAutoDispatcher.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/notifications/DesktopNotificationAutoDispatcher.kt index 23981aab22..6ec6fd2e7c 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/notifications/DesktopNotificationAutoDispatcher.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/notifications/DesktopNotificationAutoDispatcher.kt @@ -30,7 +30,7 @@ import com.vitorpamplona.amethyst.commons.moderation.notifications.nowEpochSecon import com.vitorpamplona.amethyst.commons.moderation.notifications.sanitizeForToast import com.vitorpamplona.amethyst.desktop.cache.DesktopLocalCache import com.vitorpamplona.quartz.nip01Core.core.Event -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent @@ -39,7 +39,7 @@ import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nip61Nutzaps.nutzap.NutzapEvent import com.vitorpamplona.quartz.nipBCOnchainZaps.zap.OnchainZapEvent @@ -178,14 +178,14 @@ class DesktopNotificationAutoDispatcher( when (event) { is ReactionEvent -> NotifKind.REACTION is RepostEvent, is GenericRepostEvent -> NotifKind.REPOST - is LnZapEvent, is NutzapEvent, is OnchainZapEvent -> NotifKind.ZAP + is ZapReceiptEvent, is NutzapEvent, is OnchainZapEvent -> NotifKind.ZAP is TextNoteEvent -> { val isReply = event.tags.any { it.size > 1 && it[0] == "e" } if (isReply) NotifKind.REPLY else NotifKind.MENTION } is CommentEvent -> NotifKind.REPLY is ChannelMessageEvent -> NotifKind.MENTION - is PrivateDmEvent, + is EncryptedDmEvent, is ChatMessageEvent, is GiftWrapEvent, is ChatMessageEncryptedFileHeaderEvent, @@ -199,7 +199,7 @@ class DesktopNotificationAutoDispatcher( ): NotificationSpec { val effectivePubKey = when (event) { - is LnZapEvent -> event.zapRequest?.pubKey ?: event.pubKey + is ZapReceiptEvent -> event.zapRequest?.pubKey ?: event.pubKey else -> event.pubKey } val displayName = @@ -207,7 +207,7 @@ class DesktopNotificationAutoDispatcher( ?: "Someone" val amountText = - (event as? LnZapEvent)?.amount?.let { " ${it.toLong() / 1000} sats" } ?: "" + (event as? ZapReceiptEvent)?.amount?.let { " ${it.toLong() / 1000} sats" } ?: "" val title = when (kind) { diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/relay/DmRelayEditor.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/relay/DmRelayEditor.kt index e4063ffaf2..86673cc80b 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/relay/DmRelayEditor.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/relay/DmRelayEditor.kt @@ -57,7 +57,7 @@ import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.displayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import kotlinx.coroutines.delay import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.launch @@ -181,7 +181,7 @@ fun DmRelayEditor( } scope.launch { try { - val event = ChatMessageRelayListEvent.create(localRelays.toList(), signer) + val event = DmRelayListEvent.create(localRelays.toList(), signer) onPublish(event) onDmRelaysUpdated(localRelays.toSet()) savedMessage = "Published ${localRelays.size} relay(s)" diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/search/SearchResultsList.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/search/SearchResultsList.kt index c225256ee4..3b0fab764f 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/search/SearchResultsList.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/search/SearchResultsList.kt @@ -69,7 +69,7 @@ import com.vitorpamplona.amethyst.desktop.ui.note.NoteCard import com.vitorpamplona.amethyst.desktop.ui.note.SpamCheckedNoteRender import com.vitorpamplona.amethyst.desktop.ui.note.WoTBadge import com.vitorpamplona.amethyst.desktop.ui.rememberDisplayData -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent @Composable @@ -96,9 +96,9 @@ fun SearchResultsList( // Group notes by kind val textNotes = notes.filter { it.kind == 1 } - val articles = notes.filter { it.kind == LongTextNoteEvent.KIND } + val articles = notes.filter { it.kind == LongFormContentEvent.KIND } val polls = notes.filter { it.kind == PollEvent.KIND } - val otherNotes = notes.filter { it.kind != 1 && it.kind != LongTextNoteEvent.KIND && it.kind != PollEvent.KIND } + val otherNotes = notes.filter { it.kind != 1 && it.kind != LongFormContentEvent.KIND && it.kind != PollEvent.KIND } // Per-section collapsed state (absent = expanded) val collapsedSections = remember { mutableStateMapOf() } diff --git a/desktopApp/src/jvmTest/kotlin/com/vitorpamplona/amethyst/desktop/cache/DesktopDmRelayListConsumeTest.kt b/desktopApp/src/jvmTest/kotlin/com/vitorpamplona/amethyst/desktop/cache/DesktopDmRelayListConsumeTest.kt index 8d0cbd22ce..ee625359b3 100644 --- a/desktopApp/src/jvmTest/kotlin/com/vitorpamplona/amethyst/desktop/cache/DesktopDmRelayListConsumeTest.kt +++ b/desktopApp/src/jvmTest/kotlin/com/vitorpamplona/amethyst/desktop/cache/DesktopDmRelayListConsumeTest.kt @@ -23,7 +23,7 @@ package com.vitorpamplona.amethyst.desktop.cache import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNull @@ -50,7 +50,7 @@ class DesktopDmRelayListConsumeTest { signer: NostrSignerSync, relays: List = dmInbox, createdAt: Long = 1_700_000_000, - ): ChatMessageRelayListEvent = ChatMessageRelayListEvent.create(relays, signer, createdAt) + ): DmRelayListEvent = DmRelayListEvent.create(relays, signer, createdAt) @Test fun `consume routes kind 10050 into the User model`() { diff --git a/desktopApp/src/jvmTest/kotlin/com/vitorpamplona/amethyst/desktop/nwc/NwcPaymentHandlerTest.kt b/desktopApp/src/jvmTest/kotlin/com/vitorpamplona/amethyst/desktop/nwc/NwcPaymentHandlerTest.kt index 752deaf576..28ef0d7dc8 100644 --- a/desktopApp/src/jvmTest/kotlin/com/vitorpamplona/amethyst/desktop/nwc/NwcPaymentHandlerTest.kt +++ b/desktopApp/src/jvmTest/kotlin/com/vitorpamplona/amethyst/desktop/nwc/NwcPaymentHandlerTest.kt @@ -24,7 +24,7 @@ import com.vitorpamplona.quartz.nip01Core.core.toHexKey import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip47WalletConnect.Nip47WalletConnect -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip47WalletConnect.rpc.GetBalanceSuccessResponse import com.vitorpamplona.quartz.nip47WalletConnect.rpc.MakeInvoiceSuccessResponse import com.vitorpamplona.quartz.nip47WalletConnect.rpc.NwcTransaction @@ -157,8 +157,8 @@ class NwcPaymentHandlerTest { // -- Response event structure -- @Test - fun `LnZapPaymentResponseEvent has correct KIND`() { - assertEquals(23195, LnZapPaymentResponseEvent.KIND) + fun `NwcResponseEvent has correct KIND`() { + assertEquals(23195, NwcResponseEvent.KIND) } // -- PayInvoiceSuccessResponse structure -- diff --git a/desktopApp/src/jvmTest/kotlin/com/vitorpamplona/amethyst/desktop/nwc/NwcRpcIntegrationTest.kt b/desktopApp/src/jvmTest/kotlin/com/vitorpamplona/amethyst/desktop/nwc/NwcRpcIntegrationTest.kt index ce6bf5f8a5..04d1f2e080 100644 --- a/desktopApp/src/jvmTest/kotlin/com/vitorpamplona/amethyst/desktop/nwc/NwcRpcIntegrationTest.kt +++ b/desktopApp/src/jvmTest/kotlin/com/vitorpamplona/amethyst/desktop/nwc/NwcRpcIntegrationTest.kt @@ -25,8 +25,8 @@ import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip47WalletConnect.Nip47Client -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip47WalletConnect.rpc.GetBalanceMethod import com.vitorpamplona.quartz.nip47WalletConnect.rpc.GetBalanceSuccessResponse import com.vitorpamplona.quartz.nip47WalletConnect.rpc.MakeInvoiceMethod @@ -66,7 +66,7 @@ class NwcRpcIntegrationTest { val requestEvent = client.payInvoice("lnbc50n1pjtest...") // Verify request event structure - assertEquals(LnZapPaymentRequestEvent.KIND, requestEvent.kind) + assertEquals(NwcRequestEvent.KIND, requestEvent.kind) assertTrue(requestEvent.content.isNotBlank()) // Wallet decrypts the request @@ -82,7 +82,7 @@ class NwcRpcIntegrationTest { val requestEvent = client.getBalance() // Verify it's a valid NWC request - assertEquals(LnZapPaymentRequestEvent.KIND, requestEvent.kind) + assertEquals(NwcRequestEvent.KIND, requestEvent.kind) // Wallet decrypts and verifies method type val decrypted = requestEvent.decryptRequest(walletSigner) @@ -90,7 +90,7 @@ class NwcRpcIntegrationTest { // Wallet builds encrypted response val responseEvent = - LnZapPaymentResponseEvent.createResponse( + NwcResponseEvent.createResponse( response = GetBalanceSuccessResponse( result = GetBalanceSuccessResponse.GetBalanceResult(balance = 125_000), @@ -100,7 +100,7 @@ class NwcRpcIntegrationTest { ) // Verify response event structure - assertEquals(LnZapPaymentResponseEvent.KIND, responseEvent.kind) + assertEquals(NwcResponseEvent.KIND, responseEvent.kind) assertEquals(requestEvent.id, responseEvent.requestId()) // Client decrypts response @@ -124,7 +124,7 @@ class NwcRpcIntegrationTest { // Wallet responds with invoice val fakeInvoice = "lnbc500n1pjgenerated..." val responseEvent = - LnZapPaymentResponseEvent.createResponse( + NwcResponseEvent.createResponse( response = MakeInvoiceSuccessResponse( result = @@ -153,7 +153,7 @@ class NwcRpcIntegrationTest { val requestEvent = client.payInvoice("lnbc100n1...") val responseEvent = - LnZapPaymentResponseEvent.createResponse( + NwcResponseEvent.createResponse( response = PayInvoiceSuccessResponse( result = @@ -183,7 +183,7 @@ class NwcRpcIntegrationTest { // Build a request and verify it works val requestEvent = client.getBalance() - assertEquals(LnZapPaymentRequestEvent.KIND, requestEvent.kind) + assertEquals(NwcRequestEvent.KIND, requestEvent.kind) // Wallet can decrypt it val decrypted = requestEvent.decryptRequest(walletSigner) diff --git a/geode/src/test/kotlin/com/vitorpamplona/geode/ConcordPlaneKeyDeletionTest.kt b/geode/src/test/kotlin/com/vitorpamplona/geode/ConcordPlaneKeyDeletionTest.kt index 15c5fcd7a1..051c1736f8 100644 --- a/geode/src/test/kotlin/com/vitorpamplona/geode/ConcordPlaneKeyDeletionTest.kt +++ b/geode/src/test/kotlin/com/vitorpamplona/geode/ConcordPlaneKeyDeletionTest.kt @@ -34,7 +34,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip62RequestToVanish.RequestToVanishEvent import com.vitorpamplona.quartz.utils.RandomInstance import com.vitorpamplona.quartz.utils.TimeUtils @@ -177,7 +177,7 @@ class ConcordPlaneKeyDeletionTest { // The banned member still derives `plane`, and every wrap above IS authored by it — so // this kind-5 satisfies a same-author check. It must still be refused. - val deletion = planeSigner().sign(DeletionEvent.build(history, createdAt = now + 10)) + val deletion = planeSigner().sign(DeletionRequestEvent.build(history, createdAt = now + 10)) assertEquals(true, client.publishAndConfirm(deletion, setOf(relayUrl)), "the relay accepts the event itself") assertEquals( @@ -230,7 +230,7 @@ class ConcordPlaneKeyDeletionTest { assertEquals(true, client.publishAndConfirm(addressedWrap, setOf(relayUrl))) assertEquals(1, query(Filter(ids = listOf(addressedWrap.id))).size) - val deletion = mallory.sign(DeletionEvent.build(listOf(addressedWrap), createdAt = now + 1)) + val deletion = mallory.sign(DeletionRequestEvent.build(listOf(addressedWrap), createdAt = now + 1)) assertEquals(true, client.publishAndConfirm(deletion, setOf(relayUrl))) assertEquals( diff --git a/geode/src/test/kotlin/com/vitorpamplona/geode/DeletionSettleBenchmark.kt b/geode/src/test/kotlin/com/vitorpamplona/geode/DeletionSettleBenchmark.kt index 46e4b7a1ca..5f229740d9 100644 --- a/geode/src/test/kotlin/com/vitorpamplona/geode/DeletionSettleBenchmark.kt +++ b/geode/src/test/kotlin/com/vitorpamplona/geode/DeletionSettleBenchmark.kt @@ -29,7 +29,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.client.accessories.negentropySet import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync import com.vitorpamplona.quartz.nip01Core.store.sqlite.EventStore -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.utils.TimeUtils import kotlinx.coroutines.runBlocking @@ -81,7 +81,7 @@ class DeletionSettleBenchmark : RelayClientTest() { // The last K are the ones we deleted locally. val deleted = notes.takeLast(k) val kept = notes.dropLast(k) - val deletions = deleted.map { signer.sign(DeletionEvent.build(listOf(it), createdAt = it.createdAt + 1)) } + val deletions = deleted.map { signer.sign(DeletionRequestEvent.build(listOf(it), createdAt = it.createdAt + 1)) } // Relay holds all N notes; we hold the N-K we didn't delete, plus the K kind-5s. defaultRelay.preload(notes) diff --git a/geode/src/test/kotlin/com/vitorpamplona/geode/DeletionSyncTest.kt b/geode/src/test/kotlin/com/vitorpamplona/geode/DeletionSyncTest.kt index f3a7ef4306..22b07e8be7 100644 --- a/geode/src/test/kotlin/com/vitorpamplona/geode/DeletionSyncTest.kt +++ b/geode/src/test/kotlin/com/vitorpamplona/geode/DeletionSyncTest.kt @@ -35,7 +35,7 @@ import com.vitorpamplona.quartz.nip01Core.store.IdAndTime import com.vitorpamplona.quartz.nip01Core.store.deletionsCovering import com.vitorpamplona.quartz.nip01Core.store.sqlite.EventStore import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip62RequestToVanish.RequestToVanishEvent import kotlinx.coroutines.runBlocking @@ -69,7 +69,7 @@ class DeletionSyncTest : RelayClientTest() { fun idBasedDeletionCoversByETag() = runBlocking { val target = note("delete me") - val deletion = signer.sign(DeletionEvent.build(listOf(target), createdAt = target.createdAt + 1)) + val deletion = signer.sign(DeletionRequestEvent.build(listOf(target), createdAt = target.createdAt + 1)) store.insert(deletion) assertEquals(listOf(deletion.id), store.deletionsCovering(listOf(target), here).map { it.id }) @@ -82,7 +82,7 @@ class DeletionSyncTest : RelayClientTest() { runBlocking { val contacts = ContactListEvent.createFromScratch(emptyList(), null, signer) // Address-only deletion (no `e` tag) → only the `a`-tag path can match it. - val delAddr = signer.sign(DeletionEvent.buildAddressOnly(listOf(contacts), createdAt = contacts.createdAt + 1)) + val delAddr = signer.sign(DeletionRequestEvent.buildAddressOnly(listOf(contacts), createdAt = contacts.createdAt + 1)) store.insert(delAddr) assertEquals( @@ -93,7 +93,7 @@ class DeletionSyncTest : RelayClientTest() { // NIP-09 cutoff: a deletion OLDER than the event does not delete it. val stale = EventStore(null) - stale.insert(signer.sign(DeletionEvent.buildAddressOnly(listOf(contacts), createdAt = contacts.createdAt - 1))) + stale.insert(signer.sign(DeletionRequestEvent.buildAddressOnly(listOf(contacts), createdAt = contacts.createdAt - 1))) assertTrue(stale.deletionsCovering(listOf(contacts), here).isEmpty(), "an older address deletion does not cover") stale.close() } @@ -129,7 +129,7 @@ class DeletionSyncTest : RelayClientTest() { fun sendsCoveringDeletionSoRelayRemovesTheNote() = runBlocking { val target = note("delete me e2e") - val deletion = signer.sign(DeletionEvent.build(listOf(target), createdAt = target.createdAt + 1)) + val deletion = signer.sign(DeletionRequestEvent.build(listOf(target), createdAt = target.createdAt + 1)) // Relay holds the note; we already deleted it locally (hold only the kind-5). defaultRelay.preload(listOf(target)) @@ -163,7 +163,7 @@ class DeletionSyncTest : RelayClientTest() { fun appliesRelaysDeletionSoLocalRemovesTheNote() = runBlocking { val target = note("delete me down") - val deletion = signer.sign(DeletionEvent.build(listOf(target), createdAt = target.createdAt + 1)) + val deletion = signer.sign(DeletionRequestEvent.build(listOf(target), createdAt = target.createdAt + 1)) // Relay already applied the deletion → holds only the kind-5. defaultRelay.preload(listOf(target, deletion)) @@ -190,7 +190,7 @@ class DeletionSyncTest : RelayClientTest() { val ourEvents = local.store.query(Filter(ids = diff.haveIds)) val relayDeletions = deletionsCovering(ourEvents, defaultRelayUrl) { f -> defaultRelay.store.query(f) } assertEquals(listOf(deletion.id), relayDeletions.map { it.id }) - relayDeletions.filterIsInstance().forEach { local.store.insert(it) } + relayDeletions.filterIsInstance().forEach { local.store.insert(it) } assertTrue( local.store.query(Filter(ids = listOf(target.id))).isEmpty(), @@ -206,7 +206,7 @@ class DeletionSyncTest : RelayClientTest() { fun settleSendsOurDeletionUp() = runBlocking { val target = note("settle up") - val deletion = signer.sign(DeletionEvent.build(listOf(target), createdAt = target.createdAt + 1)) + val deletion = signer.sign(DeletionRequestEvent.build(listOf(target), createdAt = target.createdAt + 1)) val localStore = EventStore(null) localStore.insert(target) localStore.insert(deletion) // deletes target locally, keeps the kind-5 @@ -239,7 +239,7 @@ class DeletionSyncTest : RelayClientTest() { fun settleAppliesRelayDeletionDown() = runBlocking { val target = note("settle down") - val deletion = signer.sign(DeletionEvent.build(listOf(target), createdAt = target.createdAt + 1)) + val deletion = signer.sign(DeletionRequestEvent.build(listOf(target), createdAt = target.createdAt + 1)) defaultRelay.preload(listOf(target, deletion)) // relay deletes target, keeps the kind-5 val localStore = EventStore(null) localStore.insert(target) diff --git a/geode/src/test/kotlin/com/vitorpamplona/geode/Nip01ComplianceTest.kt b/geode/src/test/kotlin/com/vitorpamplona/geode/Nip01ComplianceTest.kt index 7f69de4c89..9326acbb7f 100644 --- a/geode/src/test/kotlin/com/vitorpamplona/geode/Nip01ComplianceTest.kt +++ b/geode/src/test/kotlin/com/vitorpamplona/geode/Nip01ComplianceTest.kt @@ -33,7 +33,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.Channel.Factory.UNLIMITED import kotlinx.coroutines.runBlocking @@ -350,7 +350,7 @@ class Nip01ComplianceTest : RelayClientTest() { /** * Addressable events (kind 30000-39999, NIP-01 §"Kinds") are replaced - * by `(pubkey, kind, d)`. Uses a real signed [LongTextNoteEvent] because + * by `(pubkey, kind, d)`. Uses a real signed [LongFormContentEvent] because * the SQLite store dispatches on the typed `AddressableEvent` subclass * to extract the d-tag — synthetic plain `Event`s aren't recognised. */ @@ -358,15 +358,15 @@ class Nip01ComplianceTest : RelayClientTest() { fun parameterizedReplaceableEventsKeepNewestPerDTag() = runBlocking { val signer = NostrSignerSync(KeyPair()) - val v1 = signer.sign(LongTextNoteEvent.build("old", "title", dTag = "list-a", createdAt = 100)) - val v2 = signer.sign(LongTextNoteEvent.build("new", "title", dTag = "list-a", createdAt = 200)) - val v3 = signer.sign(LongTextNoteEvent.build("list-b", "title", dTag = "list-b", createdAt = 100)) + val v1 = signer.sign(LongFormContentEvent.build("old", "title", dTag = "list-a", createdAt = 100)) + val v2 = signer.sign(LongFormContentEvent.build("new", "title", dTag = "list-a", createdAt = 200)) + val v3 = signer.sign(LongFormContentEvent.build("list-b", "title", dTag = "list-b", createdAt = 100)) preload(v1, v2, v3) val (events, _) = client.collectUntilEose( defaultRelayUrl, - Filter(kinds = listOf(LongTextNoteEvent.KIND), authors = listOf(signer.pubKey)), + Filter(kinds = listOf(LongFormContentEvent.KIND), authors = listOf(signer.pubKey)), ) assertEquals(2, events.size) diff --git a/geode/src/test/kotlin/com/vitorpamplona/geode/Nip09DeletionTest.kt b/geode/src/test/kotlin/com/vitorpamplona/geode/Nip09DeletionTest.kt index 914da8e385..03336f4779 100644 --- a/geode/src/test/kotlin/com/vitorpamplona/geode/Nip09DeletionTest.kt +++ b/geode/src/test/kotlin/com/vitorpamplona/geode/Nip09DeletionTest.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -123,7 +123,7 @@ class Nip09DeletionTest { runBlocking { val signer = NostrSignerSync(KeyPair()) val note = signer.sign(TextNoteEvent.build("delete me")) - val deletion = signer.sign(DeletionEvent.build(listOf(note), createdAt = note.createdAt + 1)) + val deletion = signer.sign(DeletionRequestEvent.build(listOf(note), createdAt = note.createdAt + 1)) // Publish original, confirm it's stored. assertEquals(true, client.publishAndConfirm(note, setOf(relayUrl))) @@ -139,12 +139,12 @@ class Nip09DeletionTest { runBlocking { val signer = NostrSignerSync(KeyPair()) val note = signer.sign(TextNoteEvent.build("a")) - val deletion = signer.sign(DeletionEvent.build(listOf(note), createdAt = note.createdAt + 1)) + val deletion = signer.sign(DeletionRequestEvent.build(listOf(note), createdAt = note.createdAt + 1)) client.publishAndConfirm(note, setOf(relayUrl)) client.publishAndConfirm(deletion, setOf(relayUrl)) - val results = query(Filter(kinds = listOf(DeletionEvent.KIND), authors = listOf(signer.pubKey))) + val results = query(Filter(kinds = listOf(DeletionRequestEvent.KIND), authors = listOf(signer.pubKey))) assertEquals(1, results.size) assertEquals(deletion.id, results[0].id) } @@ -154,7 +154,7 @@ class Nip09DeletionTest { runBlocking { val signer = NostrSignerSync(KeyPair()) val note = signer.sign(TextNoteEvent.build("once-upon-a-time")) - val deletion = signer.sign(DeletionEvent.build(listOf(note), createdAt = note.createdAt + 1)) + val deletion = signer.sign(DeletionRequestEvent.build(listOf(note), createdAt = note.createdAt + 1)) client.publishAndConfirm(note, setOf(relayUrl)) client.publishAndConfirm(deletion, setOf(relayUrl)) @@ -178,7 +178,7 @@ class Nip09DeletionTest { // kind-5 event itself (it's just an event), but the SQL DELETE // is owner-scoped, so Alice's event survives. val malloryDelete = - mallory.sign(DeletionEvent.build(listOf(aliceNote), createdAt = aliceNote.createdAt + 1)) + mallory.sign(DeletionRequestEvent.build(listOf(aliceNote), createdAt = aliceNote.createdAt + 1)) client.publishAndConfirm(malloryDelete, setOf(relayUrl)) assertEquals( diff --git a/quartz/CLIENT.md b/quartz/CLIENT.md index 99338a8821..0b03c120ab 100644 --- a/quartz/CLIENT.md +++ b/quartz/CLIENT.md @@ -460,9 +460,9 @@ Common event kinds you'll work with: | 0 | NIP-01 | `MetadataEvent` | User metadata (name, picture, about) | | 1 | NIP-01 | `TextNoteEvent` | Text note (short post) | | 3 | NIP-02 | `ContactListEvent` | Contact list / follow list | -| 4 | NIP-04 | `PrivateDmEvent` | Encrypted direct message | +| 4 | NIP-04 | `EncryptedDmEvent` | Encrypted direct message | | 7 | NIP-25 | `ReactionEvent` | Reaction (like, emoji) | -| 30023 | NIP-23 | `LongTextNoteEvent` | Long-form content (articles) | +| 30023 | NIP-23 | `LongFormContentEvent` | Long-form content (articles) | ## Multi-Relay Subscriptions diff --git a/quartz/src/androidDeviceTest/kotlin/com/vitorpamplona/quartz/nip01Core/EventSigCheck.kt b/quartz/src/androidDeviceTest/kotlin/com/vitorpamplona/quartz/nip01Core/EventSigCheck.kt index 7b53776a8f..3bac4762e7 100644 --- a/quartz/src/androidDeviceTest/kotlin/com/vitorpamplona/quartz/nip01Core/EventSigCheck.kt +++ b/quartz/src/androidDeviceTest/kotlin/com/vitorpamplona/quartz/nip01Core/EventSigCheck.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.crypto.verifyId import com.vitorpamplona.quartz.nip01Core.crypto.verifySignature import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.EventMessage import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent import com.vitorpamplona.quartz.utils.EventFactory import org.junit.Assert.assertEquals @@ -139,7 +139,7 @@ class EventSigCheck { @Test fun checkSerializationLargeZap() { val event = - EventFactory.create( + EventFactory.create( id = "e7f09fddf39fc6cb604708b6af7b4d4adbb07b412847ebb004064040fe8c4b1e", pubKey = "79f00d3f5a19ec806189fcab03c1be4ff81d18ee4f653c88fac41fe03570f432", createdAt = 1728921077, diff --git a/quartz/src/androidDeviceTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/LnZapPaymentRequestNip44EventTest.kt b/quartz/src/androidDeviceTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/LnZapPaymentRequestNip44EventTest.kt index d588554f74..e3e0232e4f 100644 --- a/quartz/src/androidDeviceTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/LnZapPaymentRequestNip44EventTest.kt +++ b/quartz/src/androidDeviceTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/LnZapPaymentRequestNip44EventTest.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.core.toHexKey import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent import com.vitorpamplona.quartz.nip47WalletConnect.rpc.GetBalanceMethod import com.vitorpamplona.quartz.nip47WalletConnect.rpc.GetInfoMethod import kotlinx.coroutines.test.runTest @@ -47,7 +47,7 @@ class LnZapPaymentRequestNip44EventTest { val request = GetBalanceMethod.create() val event = - LnZapPaymentRequestEvent.createRequest( + NwcRequestEvent.createRequest( request = request, walletServicePubkey = walletServicePubkey, signer = clientSigner, @@ -71,7 +71,7 @@ class LnZapPaymentRequestNip44EventTest { val request = GetInfoMethod.create() val event = - LnZapPaymentRequestEvent.createRequest( + NwcRequestEvent.createRequest( request = request, walletServicePubkey = walletServicePubkey, signer = clientSigner, diff --git a/quartz/src/androidDeviceTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/PrivateZapTests.kt b/quartz/src/androidDeviceTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/PrivateZapTests.kt index 367c45a736..232e0f9708 100644 --- a/quartz/src/androidDeviceTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/PrivateZapTests.kt +++ b/quartz/src/androidDeviceTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/PrivateZapTests.kt @@ -92,13 +92,13 @@ class PrivateZapTests { ) val privateZapRequest = - LnZapRequestEvent.create( + ZapRequestEvent.create( zappedEvent = poll, relays = setOf(RelayUrlNormalizer.normalize("wss://relay.damus.io/")), signer = loggedIn, pollOption = 0, message = "", - zapType = LnZapEvent.ZapType.PRIVATE, + zapType = ZapReceiptEvent.ZapType.PRIVATE, toUserPubHex = null, ) @@ -151,7 +151,7 @@ class PrivateZapTests { ) val privateZapRequest = - LnZapRequestEvent.create( + ZapRequestEvent.create( zappedEvent = textNote, relays = setOf( @@ -162,7 +162,7 @@ class PrivateZapTests { signer = loggedIn, pollOption = null, message = "test", - zapType = LnZapEvent.ZapType.PRIVATE, + zapType = ZapReceiptEvent.ZapType.PRIVATE, toUserPubHex = null, ) diff --git a/quartz/src/androidDeviceTest/kotlin/com/vitorpamplona/quartz/nip59GiftWraps/GiftWrapEventTest.kt b/quartz/src/androidDeviceTest/kotlin/com/vitorpamplona/quartz/nip59GiftWraps/GiftWrapEventTest.kt index 47455faeb5..ebdd83efbc 100644 --- a/quartz/src/androidDeviceTest/kotlin/com/vitorpamplona/quartz/nip59GiftWraps/GiftWrapEventTest.kt +++ b/quartz/src/androidDeviceTest/kotlin/com/vitorpamplona/quartz/nip59GiftWraps/GiftWrapEventTest.kt @@ -31,7 +31,7 @@ import com.vitorpamplona.quartz.nip01Core.tags.people.PTag import com.vitorpamplona.quartz.nip01Core.tags.people.isTaggedUser import com.vitorpamplona.quartz.nip17Dm.NIP17Factory import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.utils.Hex import kotlinx.coroutines.test.runTest @@ -65,7 +65,7 @@ class GiftWrapEventTest { val eventsReceiverGets = events.wraps.filter { it.isTaggedUser(receiver.pubKey) } eventsReceiverGets.forEach { val event = it.unwrapThrowing(receiver) - if (event is SealedRumorEvent) { + if (event is SealEvent) { val innerData = event.unsealThrowing(receiver) assertEquals(message, innerData.content) } else { @@ -77,7 +77,7 @@ class GiftWrapEventTest { val eventsSenderGets = events.wraps.filter { it.isTaggedUser(sender.pubKey) } eventsSenderGets.forEach { val event = it.unwrapThrowing(sender) - if (event is SealedRumorEvent) { + if (event is SealEvent) { val innerData = event.unsealThrowing(sender) assertEquals(message, innerData.content) } else { @@ -118,7 +118,7 @@ class GiftWrapEventTest { val eventsReceiverGets = events.wraps.filter { it.isTaggedUser(receiver.pubKey) } eventsReceiverGets.forEach { val event = it.unwrapThrowing(receiver) - if (event is SealedRumorEvent) { + if (event is SealEvent) { val innerData = event.unsealThrowing(receiver) assertEquals(message, innerData.content) } else { @@ -131,7 +131,7 @@ class GiftWrapEventTest { val eventsSenderGets = events.wraps.filter { it.isTaggedUser(sender.pubKey) } eventsSenderGets.forEach { val event = it.unwrapThrowing(sender) - if (event is SealedRumorEvent) { + if (event is SealEvent) { val innerData = event.unsealThrowing(sender) assertEquals(message, innerData.content) } else { @@ -155,7 +155,7 @@ class GiftWrapEventTest { ) // MsgFor the Receiver val encMsgFromSenderToReceiver = - SealedRumorEvent.create( + SealEvent.create( event = senderMessage, encryptTo = receiver.pubKey, signer = sender, @@ -184,7 +184,7 @@ class GiftWrapEventTest { // MsgFor the Sender val encMsgFromSenderToSender = - SealedRumorEvent.create( + SealEvent.create( event = senderMessage, encryptTo = sender.pubKey, signer = sender, @@ -221,10 +221,10 @@ class GiftWrapEventTest { assertNotNull(giftWrapToReceiver) val unwrappedMsgForSenderBySender = giftWrapToSender.unwrapThrowing(sender) - assertEquals(SealedRumorEvent.KIND, unwrappedMsgForSenderBySender.kind) - assertTrue(unwrappedMsgForSenderBySender is SealedRumorEvent) + assertEquals(SealEvent.KIND, unwrappedMsgForSenderBySender.kind) + assertTrue(unwrappedMsgForSenderBySender is SealEvent) - if (unwrappedMsgForSenderBySender is SealedRumorEvent) { + if (unwrappedMsgForSenderBySender is SealEvent) { val unwrappedRumorToSenderBySender = unwrappedMsgForSenderBySender.unsealThrowing(sender) assertEquals("Hi There!", unwrappedRumorToSenderBySender.content) @@ -242,10 +242,10 @@ class GiftWrapEventTest { } val unwrappedMsgForReceiverByReceiver = giftWrapToReceiver.unwrapThrowing(receiver) - assertEquals(SealedRumorEvent.KIND, unwrappedMsgForReceiverByReceiver.kind) - assertTrue(unwrappedMsgForReceiverByReceiver is SealedRumorEvent) + assertEquals(SealEvent.KIND, unwrappedMsgForReceiverByReceiver.kind) + assertTrue(unwrappedMsgForReceiverByReceiver is SealEvent) - if (unwrappedMsgForReceiverByReceiver is SealedRumorEvent) { + if (unwrappedMsgForReceiverByReceiver is SealEvent) { val unwrappedRumorToReceiverByReceiver = unwrappedMsgForReceiverByReceiver.unsealThrowing(receiver) assertEquals("Hi There!", unwrappedRumorToReceiverByReceiver.content) @@ -273,7 +273,7 @@ class GiftWrapEventTest { ) val msgFromSenderToReceiverA = - SealedRumorEvent.create( + SealEvent.create( event = senderMessage, encryptTo = receiverA.pubKey, signer = sender, @@ -302,7 +302,7 @@ class GiftWrapEventTest { assertEquals(giftWrapForReceiverA.recipientPubKey(), receiverA.pubKey) val msgFromSenderToReceiverB = - SealedRumorEvent.create( + SealEvent.create( event = senderMessage, encryptTo = receiverB.pubKey, signer = sender, @@ -331,7 +331,7 @@ class GiftWrapEventTest { assertEquals(giftWrapForReceiverB.recipientPubKey(), receiverB.pubKey) val msgFromSenderToSender = - SealedRumorEvent.create( + SealEvent.create( event = senderMessage, encryptTo = sender.pubKey, signer = sender, @@ -371,9 +371,9 @@ class GiftWrapEventTest { assertNotNull(giftWrapForReceiverB) val unwrappedMsgForSenderBySender = giftWrapToSender.unwrapThrowing(sender) - assertEquals(SealedRumorEvent.KIND, unwrappedMsgForSenderBySender.kind) + assertEquals(SealEvent.KIND, unwrappedMsgForSenderBySender.kind) - if (unwrappedMsgForSenderBySender is SealedRumorEvent) { + if (unwrappedMsgForSenderBySender is SealEvent) { unwrappedMsgForSenderBySender.unsealOrNull(receiverA)?.let { _ -> fail() } @@ -399,9 +399,9 @@ class GiftWrapEventTest { } val unwrappedMsgForReceiverAByReceiverA = giftWrapForReceiverA.unwrapThrowing(receiverA) - assertEquals(SealedRumorEvent.KIND, unwrappedMsgForReceiverAByReceiverA.kind) + assertEquals(SealEvent.KIND, unwrappedMsgForReceiverAByReceiverA.kind) - if (unwrappedMsgForReceiverAByReceiverA is SealedRumorEvent) { + if (unwrappedMsgForReceiverAByReceiverA is SealEvent) { val unwrappedRumorToReceiverAByReceiverA = unwrappedMsgForReceiverAByReceiverA.unsealThrowing(receiverA) assertEquals("Who is going to the party tonight?", unwrappedRumorToReceiverAByReceiverA.content) @@ -426,9 +426,9 @@ class GiftWrapEventTest { } val unwrappedMsgForReceiverBByReceiverB = giftWrapForReceiverB.unwrapThrowing(receiverB) - assertEquals(SealedRumorEvent.KIND, unwrappedMsgForReceiverBByReceiverB.kind) + assertEquals(SealEvent.KIND, unwrappedMsgForReceiverBByReceiverB.kind) - if (unwrappedMsgForReceiverBByReceiverB is SealedRumorEvent) { + if (unwrappedMsgForReceiverBByReceiverB is SealEvent) { unwrappedMsgForReceiverBByReceiverB.unsealOrNull(receiverA)?.let { unwrappedRumorToReceiverBByReceiverA -> fail() } @@ -617,7 +617,7 @@ class GiftWrapEventTest { assertEquals(signer.pubKey, wrap.recipientPubKey()) val event = wrap.unwrapThrowing(signer) - return if (event is SealedRumorEvent) { + return if (event is SealEvent) { event.unsealThrowing(signer) } else { println(event.toJson()) diff --git a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip55AndroidSigner/api/foreground/intents/requests/DecryptZapRequest.kt b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip55AndroidSigner/api/foreground/intents/requests/DecryptZapRequest.kt index cdd96dc214..1e74fa6b8f 100644 --- a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip55AndroidSigner/api/foreground/intents/requests/DecryptZapRequest.kt +++ b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip55AndroidSigner/api/foreground/intents/requests/DecryptZapRequest.kt @@ -24,12 +24,12 @@ import android.content.Intent import androidx.core.net.toUri import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip55AndroidSigner.api.CommandType -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent class DecryptZapRequest { companion object { fun assemble( - event: LnZapRequestEvent, + event: ZapRequestEvent, loggedInUser: HexKey, packageName: String, ): Intent { diff --git a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip55AndroidSigner/client/NostrSignerExternal.kt b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip55AndroidSigner/client/NostrSignerExternal.kt index 2da61eba2a..c5d1a6c388 100644 --- a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip55AndroidSigner/client/NostrSignerExternal.kt +++ b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip55AndroidSigner/client/NostrSignerExternal.kt @@ -37,7 +37,7 @@ import com.vitorpamplona.quartz.nip55AndroidSigner.api.ZapEventDecryptionResult import com.vitorpamplona.quartz.nip55AndroidSigner.client.handlers.BackgroundRequestHandler import com.vitorpamplona.quartz.nip55AndroidSigner.client.handlers.ForegroundRequestHandler import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent class NostrSignerExternal( pubKey: HexKey, @@ -163,7 +163,7 @@ class NostrSignerExternal( throw convertExceptions("Could not derive key", result) } - override suspend fun decryptZapEvent(event: LnZapRequestEvent): LnZapPrivateEvent { + override suspend fun decryptZapEvent(event: ZapRequestEvent): LnZapPrivateEvent { if (!event.isPrivateZap()) throw SignerExceptions.NothingToDecrypt() val result = backgroundQuery.decryptZapEvent(event) ?: foregroundQuery.decryptZapEvent(event) diff --git a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip55AndroidSigner/client/handlers/BackgroundRequestHandler.kt b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip55AndroidSigner/client/handlers/BackgroundRequestHandler.kt index d6d7cec689..941d9a8c5e 100644 --- a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip55AndroidSigner/client/handlers/BackgroundRequestHandler.kt +++ b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip55AndroidSigner/client/handlers/BackgroundRequestHandler.kt @@ -40,7 +40,7 @@ import com.vitorpamplona.quartz.nip55AndroidSigner.api.background.queries.Nip44D import com.vitorpamplona.quartz.nip55AndroidSigner.api.background.queries.Nip44EncryptQuery import com.vitorpamplona.quartz.nip55AndroidSigner.api.background.queries.SignPsbtQuery import com.vitorpamplona.quartz.nip55AndroidSigner.api.background.queries.SignQuery -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent class BackgroundRequestHandler( loggedInUser: HexKey, @@ -81,7 +81,7 @@ class BackgroundRequestHandler( fromPubKey: HexKey, ) = nip44Decrypt.query(ciphertext, fromPubKey) as? SignerResult.RequestAddressed - fun decryptZapEvent(event: LnZapRequestEvent) = decryptZap.query(event) as? SignerResult.RequestAddressed + fun decryptZapEvent(event: ZapRequestEvent) = decryptZap.query(event) as? SignerResult.RequestAddressed fun deriveKey(nonce: HexKey) = deriveKey.query(nonce) as? SignerResult.RequestAddressed diff --git a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip55AndroidSigner/client/handlers/ForegroundRequestHandler.kt b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip55AndroidSigner/client/handlers/ForegroundRequestHandler.kt index 78841f3172..0d695c61c0 100644 --- a/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip55AndroidSigner/client/handlers/ForegroundRequestHandler.kt +++ b/quartz/src/androidMain/kotlin/com/vitorpamplona/quartz/nip55AndroidSigner/client/handlers/ForegroundRequestHandler.kt @@ -39,7 +39,7 @@ import com.vitorpamplona.quartz.nip55AndroidSigner.api.foreground.intents.respon import com.vitorpamplona.quartz.nip55AndroidSigner.api.foreground.intents.responses.Nip44EncryptResponse import com.vitorpamplona.quartz.nip55AndroidSigner.api.foreground.intents.responses.SignPsbtResponse import com.vitorpamplona.quartz.nip55AndroidSigner.api.foreground.intents.responses.SignResponse -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent class ForegroundRequestHandler( val loggedInUser: HexKey, @@ -86,7 +86,7 @@ class ForegroundRequestHandler( parser = Nip44DecryptResponse::parse, ) - suspend fun decryptZapEvent(event: LnZapRequestEvent) = + suspend fun decryptZapEvent(event: ZapRequestEvent) = launcher.launchWaitAndParse( requestIntentBuilder = { DecryptZapRequest.assemble(event, loggedInUser, packageName) }, parser = DecryptZapResponse::parse, diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/buzz/README.md b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/buzz/README.md index cd8bc2c7ac..e1d2491c59 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/buzz/README.md +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/buzz/README.md @@ -121,7 +121,7 @@ root as a pinned message. Covered by `nip29RelayGroups/PinEventsTest`. | Kind | Buzz class | Incumbent (registered) | |---|---|---| -| 9041 | `moderation.ModerationUnbanEvent` | `nip75ZapGoals.GoalEvent` | +| 9041 | `moderation.ModerationUnbanEvent` | `nip75ZapGoals.ZapGoalEvent` | | 49001 | `media.MediaUploadEvent` | — (Buzz's own `kind.rs` marks 49001 "Not a relay event kind") | | 30078 | `rsReadState` (helpers) | `nip78AppData.AppSpecificDataEvent` (NIP-RS reuses 30078) | diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/buzz/moderation/ModerationUnbanEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/buzz/moderation/ModerationUnbanEvent.kt index 7823ddea73..ee3dac4e73 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/buzz/moderation/ModerationUnbanEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/buzz/moderation/ModerationUnbanEvent.kt @@ -35,8 +35,8 @@ import com.vitorpamplona.quartz.utils.TimeUtils * `buzz-sdk/src/builders.rs::build_moderation_unban`. * * WARNING — KIND COLLISION: `9041` is also - * [com.vitorpamplona.quartz.nip75ZapGoals.GoalEvent]'s kind in Quartz. This class MUST NOT - * be registered in `utils/EventFactory.kt` (the NIP-75 GoalEvent owns 9041 there). Buzz + * [com.vitorpamplona.quartz.nip75ZapGoals.ZapGoalEvent]'s kind in Quartz. This class MUST NOT + * be registered in `utils/EventFactory.kt` (the NIP-75 ZapGoalEvent owns 9041 there). Buzz * relays dispatch moderation commands by connection context, not by the shared `EventFactory` * kind switch, so leaving 9041 unregistered is correct — construct/parse this type explicitly. */ @@ -53,7 +53,7 @@ class ModerationUnbanEvent( fun target() = tags.moderationTarget() companion object { - /** Kind 9041 — COLLIDES with NIP-75 GoalEvent. Do not register in EventFactory. */ + /** Kind 9041 — COLLIDES with NIP-75 ZapGoalEvent. Do not register in EventFactory. */ const val KIND = 9041 fun build( diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/concord/cord05Invites/ConcordDirectInvite.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/concord/cord05Invites/ConcordDirectInvite.kt index 910eaedb68..f4b1277a9e 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/concord/cord05Invites/ConcordDirectInvite.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/concord/cord05Invites/ConcordDirectInvite.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip59Giftwrap.rumors.RumorAssembler -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent /** @@ -57,7 +57,7 @@ object ConcordDirectInvite { createdAt: Long, ): GiftWrapEvent { val rumor = RumorAssembler.assembleRumor(senderSigner.pubKey, createdAt, KIND, emptyArray(), json(invite)) - val seal = SealedRumorEvent.create(rumor, recipientPubKey, senderSigner, createdAt = createdAt) + val seal = SealEvent.create(rumor, recipientPubKey, senderSigner, createdAt = createdAt) // Wrap with a random ephemeral key, adding the ["k","3313"] index tag. val wrapSigner = NostrSignerInternal(KeyPair()) @@ -80,7 +80,7 @@ object ConcordDirectInvite { recipientSigner: NostrSigner, ): CommunityInvite? { val seal = wrap.unwrapOrNull(recipientSigner) ?: return null - if (seal !is SealedRumorEvent) return null + if (seal !is SealEvent) return null val rumor = seal.unsealOrNull(recipientSigner) ?: return null if (rumor.kind != KIND) return null return ConcordJson.decodeOrNull(rumor.content) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/decentralizedLists/assistant/CurationCopy.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/decentralizedLists/assistant/CurationCopy.kt index bb6d37a238..2245686765 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/decentralizedLists/assistant/CurationCopy.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/decentralizedLists/assistant/CurationCopy.kt @@ -37,7 +37,7 @@ import com.vitorpamplona.quartz.nip01Core.tags.events.ETag import com.vitorpamplona.quartz.nip01Core.tags.hashtags.HashtagTag import com.vitorpamplona.quartz.nip01Core.tags.kinds.KindTag import com.vitorpamplona.quartz.nip01Core.tags.people.PTag -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.utils.TimeUtils import com.vitorpamplona.quartz.utils.sha256.sha256 @@ -109,7 +109,7 @@ object CurationCopy { fun buildRemoval( copy: AddressableListItemEvent, createdAt: Long = TimeUtils.now(), - ) = eventTemplate(DeletionEvent.KIND, "", createdAt) { + ) = eventTemplate(DeletionRequestEvent.KIND, "", createdAt) { add(ATag.assemble(copy.address(), null)) add(ETag.assemble(copy.id, null, null)) add(KindTag.assemble(AddressableListItemEvent.KIND)) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/graperank/GrapeRankCrawler.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/graperank/GrapeRankCrawler.kt index 4cba6e0c9f..628df753e7 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/graperank/GrapeRankCrawler.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/graperank/GrapeRankCrawler.kt @@ -35,7 +35,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip01Core.store.IEventStore import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent @@ -951,7 +951,7 @@ class GrapeRankCrawler( // deleter-must-be-author check the caller runs rejects it. val chunkIds = authorChunk.flatMap { idsByAuthor[it].orEmpty() } for (idChunk in chunkIds.chunked(AUTHORS_PER_FILTER)) { - add(Filter(kinds = listOf(DeletionEvent.KIND), authors = authorChunk, tags = mapOf("e" to idChunk))) + add(Filter(kinds = listOf(DeletionRequestEvent.KIND), authors = authorChunk, tags = mapOf("e" to idChunk))) } } } diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/graperank/GrapeRankPublisher.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/graperank/GrapeRankPublisher.kt index 89b90b79a4..bad314d356 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/graperank/GrapeRankPublisher.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/graperank/GrapeRankPublisher.kt @@ -29,8 +29,8 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.store.IEventStore -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent import com.vitorpamplona.quartz.nip85TrustedAssertions.users.followerCount import com.vitorpamplona.quartz.nip85TrustedAssertions.users.hops import com.vitorpamplona.quartz.nip85TrustedAssertions.users.rank @@ -45,7 +45,7 @@ import kotlinx.coroutines.coroutineScope import kotlin.coroutines.cancellation.CancellationException /** - * Persists a set of GrapeRank scores as NIP-85 kind:30382 [ContactCardEvent] + * Persists a set of GrapeRank scores as NIP-85 kind:30382 [UserAssertionEvent] * trusted assertions in the local [IEventStore] — the durable, reusable form of a * score run — and pushes that local card set out to the operator's relays on * demand. The store is the source of truth; the two halves are separable: @@ -168,10 +168,10 @@ class GrapeRankPublisher( idleTimeoutMs: Long = 30_000L, publishTimeoutSecs: Long = 15, ): SyncResult { - val cards = store.query(Filter(kinds = listOf(ContactCardEvent.KIND), authors = listOf(providerPubkey))) - val deletions = store.query(Filter(kinds = listOf(DeletionEvent.KIND), authors = listOf(providerPubkey))) + val cards = store.query(Filter(kinds = listOf(UserAssertionEvent.KIND), authors = listOf(providerPubkey))) + val deletions = store.query(Filter(kinds = listOf(DeletionRequestEvent.KIND), authors = listOf(providerPubkey))) - val filter = Filter(kinds = listOf(ContactCardEvent.KIND, DeletionEvent.KIND), authors = listOf(providerPubkey)) + val filter = Filter(kinds = listOf(UserAssertionEvent.KIND, DeletionRequestEvent.KIND), authors = listOf(providerPubkey)) val groups = NegentropyStoreSync( client = client, @@ -214,10 +214,10 @@ class GrapeRankPublisher( * store. Locally-retracted cards never show up — inserting their kind:5 * removed them — so a target can be re-carded later without fighting a ghost. */ - private suspend fun existingCards(providerPubkey: HexKey): Map = + private suspend fun existingCards(providerPubkey: HexKey): Map = store - .query(Filter(kinds = listOf(ContactCardEvent.KIND), authors = listOf(providerPubkey))) - .filterIsInstance() + .query(Filter(kinds = listOf(UserAssertionEvent.KIND), authors = listOf(providerPubkey))) + .filterIsInstance() .groupBy { it.aboutUser() } .mapNotNull { (target, cards) -> val t = target.ifBlank { return@mapNotNull null } @@ -230,7 +230,7 @@ class GrapeRankPublisher( * produces no new signature; a missing tag reads null and so differs from a * desired non-null value (the one-time migration onto the new tags). */ - private fun cardValues(card: ContactCardEvent): Triple = Triple(card.rank(), card.followerCount(), card.hops()) + private fun cardValues(card: UserAssertionEvent): Triple = Triple(card.rank(), card.followerCount(), card.hops()) /** The (rank, followers, hops) triple a [ScoredCard] would write. */ private fun desiredValues(card: ScoredCard): Triple = Triple(card.rank, card.followers, card.hops) @@ -254,7 +254,7 @@ class GrapeRankPublisher( batch .map { card -> async(Dispatchers.Default) { - ContactCardEvent.create( + UserAssertionEvent.create( targetUser = card.target, signer = signer, createdAt = createdAt, @@ -285,13 +285,13 @@ class GrapeRankPublisher( */ private suspend fun insertRetractions( signer: NostrSigner, - cards: List, + cards: List, createdAt: Long, ): Int { if (cards.isEmpty()) return 0 var retracted = 0 for (chunk in cards.chunked(DELETE_PER_EVENT)) { - val deletion = signer.sign(DeletionEvent.build(chunk, createdAt)) + val deletion = signer.sign(DeletionRequestEvent.build(chunk, createdAt)) if (insertQuietly(deletion)) retracted += chunk.size } return retracted diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/nip82SoftwareApps/release/Nip82ReleaseDetector.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/nip82SoftwareApps/release/Nip82ReleaseDetector.kt index a8932e8ec0..088ad5934a 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/nip82SoftwareApps/release/Nip82ReleaseDetector.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/nip82SoftwareApps/release/Nip82ReleaseDetector.kt @@ -24,22 +24,24 @@ import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.tags.AppI import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.tags.VersionTag import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.core.hasTagWithContent +import com.vitorpamplona.quartz.nip51Lists.releaseArtifactSet.ReleaseArtifactSetEvent /** * NIP-82 reuses kind 30063 which was already taken by NIP-51's - * `ReleaseArtifactSetEvent`. Both are valid; they coexist on the wire. + * [ReleaseArtifactSetEvent]. Both are valid; they coexist on the wire and the + * same class parses both. * * We disambiguate by inspecting the tag set: a NIP-82 Software Release MUST * carry both `i` (app identifier) and `version` tags. NIP-51 release artifact * sets do not. */ fun Event.isNip82SoftwareRelease() = - kind == SoftwareReleaseEvent.KIND && + kind == ReleaseArtifactSetEvent.KIND && tags.hasTagWithContent(AppIdTag.TAG_NAME) && tags.hasTagWithContent(VersionTag.TAG_NAME) /** - * Reinterprets `this` as a [SoftwareReleaseEvent]. Use [isNip82SoftwareRelease] + * Reinterprets `this` as a [ReleaseArtifactSetEvent]. Use [isNip82SoftwareRelease] * to gate the call. */ -fun Event.asSoftwareRelease() = SoftwareReleaseEvent(id, pubKey, createdAt, tags, content, sig) +fun Event.asSoftwareRelease() = this as? ReleaseArtifactSetEvent ?: ReleaseArtifactSetEvent(id, pubKey, createdAt, tags, content, sig) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/nip82SoftwareApps/release/SoftwareReleaseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/nip82SoftwareApps/release/SoftwareReleaseEvent.kt index e48460d7c7..86712d1400 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/nip82SoftwareApps/release/SoftwareReleaseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/nip82SoftwareApps/release/SoftwareReleaseEvent.kt @@ -20,91 +20,15 @@ */ package com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release -import androidx.compose.runtime.Immutable -import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.asset.SoftwareAssetEvent -import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.tags.AssetTag -import com.vitorpamplona.quartz.nip01Core.core.BaseAddressableEvent -import com.vitorpamplona.quartz.nip01Core.core.HexKey -import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder -import com.vitorpamplona.quartz.nip01Core.hints.EventHintBundle -import com.vitorpamplona.quartz.nip01Core.hints.EventHintProvider -import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate -import com.vitorpamplona.quartz.nip01Core.tags.dTag.dTag -import com.vitorpamplona.quartz.nip50Search.IndexableFieldVisitor -import com.vitorpamplona.quartz.nip50Search.SearchableEvent -import com.vitorpamplona.quartz.utils.TimeUtils +import com.vitorpamplona.quartz.nip51Lists.releaseArtifactSet.ReleaseArtifactSetEvent /** - * NIP-82 Software Release (kind 30063). - * - * A parameterizable replaceable event grouping a set of [SoftwareAssetEvent]s - * under a named release version. The `d` tag is `@` and the - * event's `created_at` must be the release date. - * - * NOTE: kind 30063 was also used by NIP-51 `ReleaseArtifactSetEvent`. This - * experimental NIP-82 event is intentionally not registered in `EventFactory` - * to avoid colliding with the existing registration. Callers can instantiate - * or wrap [SoftwareReleaseEvent] directly when they know the event is a NIP-82 - * release. + * NIP-82 software releases share kind 30063 with NIP-51 release artifact sets, and + * [ReleaseArtifactSetEvent] now parses both. This used to be a second class for the same + * kind that `EventFactory` never built. */ -@Immutable -class SoftwareReleaseEvent( - id: HexKey, - pubKey: HexKey, - createdAt: Long, - tags: Array>, - content: String, - sig: HexKey, -) : BaseAddressableEvent(id, pubKey, createdAt, KIND, tags, content, sig), - EventHintProvider, - SearchableEvent { - // content carries the release notes (free-text). NOTE: kind 30063 collides - // with NIP-51 ReleaseArtifactSetEvent, which is what EventFactory builds for - // stored events — so in practice this override is not exercised at runtime. - override fun indexableContent() = content - - // The read path: the same fields indexableContent() joins, handed over without - // building the joined string a scan would throw away. - override fun forEachIndexableField(visitor: IndexableFieldVisitor) { - visitor.visit(content) - } - - override fun eventHints() = tags.mapNotNull(AssetTag::parseAsHint) - - override fun linkedEventIds() = tags.mapNotNull(AssetTag::parseId) - - fun appId() = tags.appId() - - fun version() = tags.version() - - fun channel() = tags.channel() - - fun assets() = tags.assets() - - companion object { - const val KIND = 30063 - - /** NIP-82 requires `d = @`. */ - fun buildDTag( - appId: String, - version: String, - ) = "$appId@$version" - - fun build( - appId: String, - version: String, - channel: String, - assets: List>, - releaseNotes: String = "", - createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, - ) = eventTemplate(KIND, releaseNotes, createdAt) { - dTag(buildDTag(appId, version)) - appId(appId) - version(version) - channel(channel) - assets(assets) - initializer() - } - } -} +@Deprecated( + "Kind 30063 is parsed by ReleaseArtifactSetEvent, which also exposes the NIP-82 fields. Use ReleaseArtifactSetEvent.buildSoftwareRelease to build one.", + ReplaceWith("ReleaseArtifactSetEvent", "com.vitorpamplona.quartz.nip51Lists.releaseArtifactSet.ReleaseArtifactSetEvent"), +) +typealias SoftwareReleaseEvent = ReleaseArtifactSetEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/nip82SoftwareApps/release/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/nip82SoftwareApps/release/TagArrayBuilderExt.kt index 42d9195f63..25801b8d75 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/nip82SoftwareApps/release/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/nip82SoftwareApps/release/TagArrayBuilderExt.kt @@ -27,13 +27,14 @@ import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.tags.Chan import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.tags.VersionTag import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder import com.vitorpamplona.quartz.nip01Core.hints.EventHintBundle +import com.vitorpamplona.quartz.nip51Lists.releaseArtifactSet.ReleaseArtifactSetEvent -fun TagArrayBuilder.appId(appId: String) = addUnique(AppIdTag.assemble(appId)) +fun TagArrayBuilder.appId(appId: String) = addUnique(AppIdTag.assemble(appId)) -fun TagArrayBuilder.version(version: String) = addUnique(VersionTag.assemble(version)) +fun TagArrayBuilder.version(version: String) = addUnique(VersionTag.assemble(version)) -fun TagArrayBuilder.channel(channel: String) = addUnique(ChannelTag.assemble(channel)) +fun TagArrayBuilder.channel(channel: String) = addUnique(ChannelTag.assemble(channel)) -fun TagArrayBuilder.asset(asset: EventHintBundle) = add(AssetTag.assemble(asset)) +fun TagArrayBuilder.asset(asset: EventHintBundle) = add(AssetTag.assemble(asset)) -fun TagArrayBuilder.assets(assets: List>) = addAll(AssetTag.assemble(assets)) +fun TagArrayBuilder.assets(assets: List>) = addAll(AssetTag.assemble(assets)) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/publications/PublicationSectionRef.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/publications/PublicationSectionRef.kt index c28219fe8b..bb264bc95f 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/publications/PublicationSectionRef.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/experimental/publications/PublicationSectionRef.kt @@ -28,8 +28,8 @@ import com.vitorpamplona.quartz.nip01Core.core.Tag import com.vitorpamplona.quartz.nip01Core.core.TagArray import com.vitorpamplona.quartz.nip01Core.core.has import com.vitorpamplona.quartz.nip01Core.core.isValid -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent /** * One entry in a kind-30040 publication's table of contents. @@ -72,8 +72,8 @@ data class PublicationSectionRef( setOf( PublicationContentEvent.KIND, PublicationIndexEvent.KIND, - LongTextNoteEvent.KIND, - WikiNoteEvent.KIND, + LongFormContentEvent.KIND, + WikiArticleEvent.KIND, NipTextEvent.KIND, ) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/kinds/KindNames.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/kinds/KindNames.kt index b1ff7a9483..fd07f11def 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/kinds/KindNames.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/kinds/KindNames.kt @@ -88,8 +88,8 @@ import com.vitorpamplona.quartz.marmot.mip05PushNotifications.TokenRequestEvent import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent import com.vitorpamplona.quartz.nip03Timestamp.OtsEvent -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip15Marketplace.auction.AuctionEvent import com.vitorpamplona.quartz.nip15Marketplace.bid.BidEvent @@ -99,35 +99,35 @@ import com.vitorpamplona.quartz.nip15Marketplace.product.ProductEvent import com.vitorpamplona.quartz.nip15Marketplace.stall.StallEvent import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip25Reactions.ExternalReactionEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelHideMessageEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMetadataEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMuteUserEvent -import com.vitorpamplona.quartz.nip28PublicChat.list.ChannelListEvent +import com.vitorpamplona.quartz.nip28PublicChat.list.PublicChatListEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupAdminsEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMembersEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMetadataEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupParticipantsEvent -import com.vitorpamplona.quartz.nip29RelayGroups.metadata.SupportedRolesEvent +import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupRolesEvent import com.vitorpamplona.quartz.nip29RelayGroups.moderation.CreateGroupEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.CreateInviteEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.DeleteEventEvent import com.vitorpamplona.quartz.nip29RelayGroups.moderation.DeleteGroupEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.EditMetadataEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.PutUserEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.RemoveUserEvent -import com.vitorpamplona.quartz.nip29RelayGroups.request.JoinRequestEvent -import com.vitorpamplona.quartz.nip29RelayGroups.request.LeaveRequestEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupCreateInviteEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupDeleteEventEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupEditMetadataEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupPutUserEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupRemoveUserEvent +import com.vitorpamplona.quartz.nip29RelayGroups.request.GroupJoinRequestEvent +import com.vitorpamplona.quartz.nip29RelayGroups.request.GroupLeaveRequestEvent import com.vitorpamplona.quartz.nip30CustomEmoji.pack.EmojiPackEvent -import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiPackSelectionEvent +import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiListEvent import com.vitorpamplona.quartz.nip32Labeling.LabelEvent import com.vitorpamplona.quartz.nip34Git.grasp.UserGraspListEvent import com.vitorpamplona.quartz.nip34Git.issue.GitIssueEvent @@ -141,7 +141,7 @@ import com.vitorpamplona.quartz.nip35Torrents.TorrentCommentEvent import com.vitorpamplona.quartz.nip35Torrents.TorrentEvent import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent import com.vitorpamplona.quartz.nip37Drafts.privateOutbox.PrivateOutboxRelayListEvent -import com.vitorpamplona.quartz.nip38UserStatus.StatusEvent +import com.vitorpamplona.quartz.nip38UserStatus.UserStatusEvent import com.vitorpamplona.quartz.nip39ExtIdentities.ExternalIdentitiesEvent import com.vitorpamplona.quartz.nip42RelayAuth.RelayAuthEvent import com.vitorpamplona.quartz.nip43RelayMembers.addMember.RelayAddMemberEvent @@ -151,10 +151,10 @@ import com.vitorpamplona.quartz.nip43RelayMembers.leaveRequest.RelayLeaveRequest import com.vitorpamplona.quartz.nip43RelayMembers.list.RelayMembershipListEvent import com.vitorpamplona.quartz.nip43RelayMembers.removeMember.RelayRemoveMemberEvent import com.vitorpamplona.quartz.nip46RemoteSigner.NostrConnectEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcInfoEvent import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcNotificationEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent import com.vitorpamplona.quartz.nip51Lists.PinListEvent import com.vitorpamplona.quartz.nip51Lists.appCurationSet.AppCurationSetEvent @@ -162,26 +162,26 @@ import com.vitorpamplona.quartz.nip51Lists.articleCurationSet.ArticleCurationSet import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.OldBookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.favoriteAlgoFeedsList.FavoriteAlgoFeedsListEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip51Lists.geohashList.GeohashListEvent import com.vitorpamplona.quartz.nip51Lists.gitAuthorList.GitAuthorListEvent import com.vitorpamplona.quartz.nip51Lists.gitRepositoryList.GitRepositoryListEvent import com.vitorpamplona.quartz.nip51Lists.goodWikiAuthorList.GoodWikiAuthorListEvent import com.vitorpamplona.quartz.nip51Lists.goodWikiRelayList.GoodWikiRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent import com.vitorpamplona.quartz.nip51Lists.interestSet.InterestSetEvent import com.vitorpamplona.quartz.nip51Lists.kindMuteSet.KindMuteSetEvent -import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.LabeledBookmarkListEvent +import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.BookmarkSetEvent import com.vitorpamplona.quartz.nip51Lists.mediaFollowList.MediaFollowListEvent import com.vitorpamplona.quartz.nip51Lists.mediaStarterPack.MediaStarterPackEvent import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import com.vitorpamplona.quartz.nip51Lists.pictureCurationSet.PictureCurationSetEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BlockedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BroadcastRelayListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.ProxyRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relaySets.RelaySetEvent import com.vitorpamplona.quartz.nip51Lists.releaseArtifactSet.ReleaseArtifactSetEvent @@ -189,7 +189,7 @@ import com.vitorpamplona.quartz.nip51Lists.simpleGroupList.SimpleGroupListEvent import com.vitorpamplona.quartz.nip51Lists.videoCurationSet.VideoCurationSetEvent import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import com.vitorpamplona.quartz.nip52Calendar.rsvp.CalendarRSVPEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.clip.LiveActivitiesClipEvent @@ -199,19 +199,19 @@ import com.vitorpamplona.quartz.nip53LiveActivities.nestsServers.NestsServersEve import com.vitorpamplona.quartz.nip53LiveActivities.presence.MeetingRoomPresenceEvent import com.vitorpamplona.quartz.nip53LiveActivities.raid.LiveActivitiesRaidEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip54Wiki.WikiMergeAcceptanceEvent import com.vitorpamplona.quartz.nip54Wiki.WikiMergeRequestEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent import com.vitorpamplona.quartz.nip54Wiki.WikiRedirectEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip58Badges.accepted.AcceptedBadgeSetEvent import com.vitorpamplona.quartz.nip58Badges.award.BadgeAwardEvent import com.vitorpamplona.quartz.nip58Badges.definition.BadgeDefinitionEvent import com.vitorpamplona.quartz.nip58Badges.profile.ProfileBadgesEvent -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.EphemeralGiftWrapEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nip5aStaticWebsites.NamedSiteEvent @@ -238,15 +238,15 @@ import com.vitorpamplona.quartz.nip66RelayMonitor.discovery.RelayDiscoveryEvent import com.vitorpamplona.quartz.nip66RelayMonitor.monitor.RelayMonitorEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent import com.vitorpamplona.quartz.nip69P2pOrderEvents.P2POrderEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent import com.vitorpamplona.quartz.nip72ModCommunities.follow.CommunityListEvent import com.vitorpamplona.quartz.nip72ModCommunities.rules.CommunityRulesEvent -import com.vitorpamplona.quartz.nip75ZapGoals.GoalEvent +import com.vitorpamplona.quartz.nip75ZapGoals.ZapGoalEvent import com.vitorpamplona.quartz.nip78AppData.AppDataEvent import com.vitorpamplona.quartz.nip78AppData.AppSpecificDataEvent import com.vitorpamplona.quartz.nip7DThreads.ThreadEvent @@ -255,7 +255,7 @@ import com.vitorpamplona.quartz.nip85TrustedAssertions.addressables.AddressableA import com.vitorpamplona.quartz.nip85TrustedAssertions.events.EventAssertionEvent import com.vitorpamplona.quartz.nip85TrustedAssertions.externalIds.ExternalIdAssertionEvent import com.vitorpamplona.quartz.nip85TrustedAssertions.list.TrustProviderListEvent -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent import com.vitorpamplona.quartz.nip87Ecash.cashu.CashuMintEvent import com.vitorpamplona.quartz.nip87Ecash.fedimint.FedimintEvent import com.vitorpamplona.quartz.nip87Ecash.recommendation.MintRecommendationEvent @@ -263,46 +263,46 @@ import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip88Polls.response.PollResponseEvent import com.vitorpamplona.quartz.nip89AppHandlers.definition.AppDefinitionEvent import com.vitorpamplona.quartz.nip89AppHandlers.recommendation.AppRecommendationEvent -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.NIP90ContentDiscoveryRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.NIP90ContentDiscoveryResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.contentSearch.NIP90ContentSearchRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.contentSearch.NIP90ContentSearchResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.eventCount.NIP90EventCountRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.eventCount.NIP90EventCountResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.eventPowDelegation.NIP90EventPowDelegationRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.eventPowDelegation.NIP90EventPowDelegationResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.eventPublishSchedule.NIP90EventPublishScheduleRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.eventPublishSchedule.NIP90EventPublishScheduleResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.eventTimestamping.NIP90EventTimestampingRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.eventTimestamping.NIP90EventTimestampingResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.imageGeneration.NIP90ImageGenerationRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.imageGeneration.NIP90ImageGenerationResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.imageToVideo.NIP90ImageToVideoRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.imageToVideo.NIP90ImageToVideoResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.malwareScanning.NIP90MalwareScanRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.malwareScanning.NIP90MalwareScanResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.opReturn.NIP90OpReturnRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.opReturn.NIP90OpReturnResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.peopleSearch.NIP90PeopleSearchRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.peopleSearch.NIP90PeopleSearchResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.status.NIP90StatusEvent -import com.vitorpamplona.quartz.nip90Dvms.summarization.NIP90SummarizationRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.summarization.NIP90SummarizationResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.textExtraction.NIP90TextExtractionRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.textExtraction.NIP90TextExtractionResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.textGeneration.NIP90TextGenerationRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.textGeneration.NIP90TextGenerationResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.textToSpeech.NIP90TextToSpeechRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.textToSpeech.NIP90TextToSpeechResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.translation.NIP90TranslationRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.translation.NIP90TranslationResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.userDiscoveryRequest.NIP90UserDiscoveryRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.userDiscoveryResponse.NIP90UserDiscoveryResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.videoConversion.NIP90VideoConversionRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.videoConversion.NIP90VideoConversionResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.videoTranslation.NIP90VideoTranslationRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.videoTranslation.NIP90VideoTranslationResponseEvent -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.DvmContentDiscoveryRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.DvmContentDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.contentSearch.DvmContentSearchRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.contentSearch.DvmContentSearchResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.eventCount.DvmEventCountRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.eventCount.DvmEventCountResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.eventPowDelegation.DvmEventPowDelegationRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.eventPowDelegation.DvmEventPowDelegationResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.eventPublishSchedule.DvmEventPublishScheduleRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.eventPublishSchedule.DvmEventPublishScheduleResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.eventTimestamping.DvmEventTimestampingRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.eventTimestamping.DvmEventTimestampingResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.imageGeneration.DvmImageGenerationRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.imageGeneration.DvmImageGenerationResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.imageToVideo.DvmImageToVideoRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.imageToVideo.DvmImageToVideoResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.malwareScanning.DvmMalwareScanRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.malwareScanning.DvmMalwareScanResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.opReturn.DvmOpReturnRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.opReturn.DvmOpReturnResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.peopleSearch.DvmPeopleSearchRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.peopleSearch.DvmPeopleSearchResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.status.DvmStatusEvent +import com.vitorpamplona.quartz.nip90Dvms.summarization.DvmSummarizationRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.summarization.DvmSummarizationResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.textExtraction.DvmTextExtractionRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.textExtraction.DvmTextExtractionResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.textGeneration.DvmTextGenerationRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.textGeneration.DvmTextGenerationResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.textToSpeech.DvmTextToSpeechRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.textToSpeech.DvmTextToSpeechResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.translation.DvmTranslationRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.translation.DvmTranslationResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.userDiscoveryRequest.DvmUserDiscoveryRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.userDiscoveryResponse.DvmUserDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.videoConversion.DvmVideoConversionRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.videoConversion.DvmVideoConversionResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.videoTranslation.DvmVideoTranslationRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.videoTranslation.DvmVideoTranslationResponseEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent import com.vitorpamplona.quartz.nip96FileStorage.config.FileServersEvent import com.vitorpamplona.quartz.nip98HttpAuth.HTTPAuthorizationEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent @@ -387,12 +387,12 @@ object KindNames { BookmarkListEvent.KIND to KindName("Bookmark List", "51"), OldBookmarkListEvent.KIND to KindName("Old Bookmark List", "51"), CalendarDateSlotEvent.KIND to KindName("Day Appointment", "52"), - CalendarEvent.KIND to KindName("Calendar", "52"), + CalendarCollectionEvent.KIND to KindName("Calendar", "52"), CalendarTimeSlotEvent.KIND to KindName("Appointment", "52"), CalendarRSVPEvent.KIND to KindName("Appt RSVP", "52"), ChessGameEvent.KIND to KindName("Chess Games", "64"), JesterEvent.KIND to KindName("Chess Auth", "64"), - RelayFeedsListEvent.KIND to KindName("Favorite Relays", "51"), + FavoriteRelayListEvent.KIND to KindName("Favorite Relays", "51"), LiveChessGameChallengeEvent.KIND to KindName("Chess Challenges", "64"), LiveChessGameAcceptEvent.KIND to KindName("Chess Game Accept", "64"), LiveChessMoveEvent.KIND to KindName("Chess Move", "64"), @@ -400,13 +400,13 @@ object KindNames { LiveChessDrawOfferEvent.KIND to KindName("Chess Draw Offer", "64"), ChannelCreateEvent.KIND to KindName("Channel Definition", "28"), ChannelHideMessageEvent.KIND to KindName("Channel Hide Msg", "28"), - ChannelListEvent.KIND to KindName("Channel List", "28"), + PublicChatListEvent.KIND to KindName("Channel List", "28"), ChannelMessageEvent.KIND to KindName("Channel Message", "28"), ChannelMetadataEvent.KIND to KindName("Channel Metadata", "28"), ChannelMuteUserEvent.KIND to KindName("Channel Mute User", "28"), ChatMessageEncryptedFileHeaderEvent.KIND to KindName("DM File", "17"), ChatMessageEvent.KIND to KindName("DM Message", "17"), - ChatMessageRelayListEvent.KIND to KindName("DM Relays", "17"), + DmRelayListEvent.KIND to KindName("DM Relays", "17"), ClassifiedsEvent.KIND to KindName("Classifieds", "99"), CommentEvent.KIND to KindName("Comments", "22"), GeocacheListingEvent.KIND to KindName("Geocache", "CC"), @@ -417,19 +417,19 @@ object KindNames { CommunityListEvent.KIND to KindName("Community List", "72"), CommunityPostApprovalEvent.KIND to KindName("Community Post", "72"), ContactListEvent.KIND to KindName("Follow List", "02"), - DeletionEvent.KIND to KindName("Deletions", "09"), + DeletionRequestEvent.KIND to KindName("Deletions", "09"), DraftWrapEvent.KIND to KindName("Drafts", "37"), EmojiPackEvent.KIND to KindName("Emoji Packs", "30"), - EmojiPackSelectionEvent.KIND to KindName("Emoji Pack List", "30"), + EmojiListEvent.KIND to KindName("Emoji Pack List", "30"), EphemeralChatEvent.KIND to KindName("Ephemeral Chat", null), EphemeralChatListEvent.KIND to KindName("Ephemeral Chatrooms", null), - FileHeaderEvent.KIND to KindName("File Headers", "94"), + FileMetadataEvent.KIND to KindName("File Headers", "94"), ProfileGalleryEntryEvent.KIND to KindName("Profile Gallery", null), FileServersEvent.KIND to KindName("File Servers", "96"), FileStorageEvent.KIND to KindName("Blob Data", null), FileStorageHeaderEvent.KIND to KindName("Blob Headers", null), FhirResourceEvent.KIND to KindName("Medical Data", null), - FollowListEvent.KIND to KindName("Follow Packs", "51"), + StarterPackEvent.KIND to KindName("Follow Packs", "51"), GenericRepostEvent.KIND to KindName("Reposts (16)", "18"), GeohashListEvent.KIND to KindName("Geohash Follows", "51"), GiftWrapEvent.KIND to KindName("GiftWraps", "59"), @@ -438,23 +438,23 @@ object KindNames { GitPatchEvent.KIND to KindName("Git Patch", "34"), GitRepositoryEvent.KIND to KindName("Git Repo", "34"), GitReplyEvent.KIND to KindName("Git Reply", "34"), - GoalEvent.KIND to KindName("Zap Goals", "75"), - HashtagListEvent.KIND to KindName("Hashtag Follows", "51"), + ZapGoalEvent.KIND to KindName("Zap Goals", "75"), + InterestListEvent.KIND to KindName("Hashtag Follows", "51"), HighlightEvent.KIND to KindName("Highlights", "84"), HTTPAuthorizationEvent.KIND to KindName("Http Auth", "98"), IndexerRelayListEvent.KIND to KindName("Index Relay List", "51"), InteractiveStoryPrologueEvent.KIND to KindName("Adventure Prologue", null), InteractiveStorySceneEvent.KIND to KindName("Adventure Scene", null), InteractiveStoryReadingStateEvent.KIND to KindName("Adventure Reading", null), - LabeledBookmarkListEvent.KIND to KindName("Named Bookmarks", "51"), + BookmarkSetEvent.KIND to KindName("Named Bookmarks", "51"), LiveActivitiesChatMessageEvent.KIND to KindName("Live Chats", "53"), LiveActivitiesEvent.KIND to KindName("Live Streams", "53"), - LnZapEvent.KIND to KindName("Zaps", "57"), - LnZapPaymentRequestEvent.KIND to KindName("NWC Request", "47"), - LnZapPaymentResponseEvent.KIND to KindName("NWC Response", "47"), + ZapReceiptEvent.KIND to KindName("Zaps", "57"), + NwcRequestEvent.KIND to KindName("NWC Request", "47"), + NwcResponseEvent.KIND to KindName("NWC Response", "47"), LnZapPrivateEvent.KIND to KindName("Private Zaps", "57"), - LnZapRequestEvent.KIND to KindName("Zap Req", "57"), - LongTextNoteEvent.KIND to KindName("Blogs", "23"), + ZapRequestEvent.KIND to KindName("Zap Req", "57"), + LongFormContentEvent.KIND to KindName("Blogs", "23"), MeetingRoomEvent.KIND to KindName("Meeting Room", "53"), MeetingRoomPresenceEvent.KIND to KindName("Room Presence", "53"), MeetingSpaceEvent.KIND to KindName("Meeting Space", "53"), @@ -463,14 +463,14 @@ object KindNames { NNSEvent.KIND to KindName("NNS", null), NipTextEvent.KIND to KindName("NIP", null), NostrConnectEvent.KIND to KindName("Nostr Connect", "46"), - NIP90StatusEvent.KIND to KindName("DVM Status", "90"), - NIP90ContentDiscoveryRequestEvent.KIND to KindName("DVM Content Req", "90"), - NIP90ContentDiscoveryResponseEvent.KIND to KindName("DVM Content Resp", "90"), - NIP90UserDiscoveryRequestEvent.KIND to KindName("DVM User Req", "90"), - NIP90UserDiscoveryResponseEvent.KIND to KindName("DVM User Resp", "90"), + DvmStatusEvent.KIND to KindName("DVM Status", "90"), + DvmContentDiscoveryRequestEvent.KIND to KindName("DVM Content Req", "90"), + DvmContentDiscoveryResponseEvent.KIND to KindName("DVM Content Resp", "90"), + DvmUserDiscoveryRequestEvent.KIND to KindName("DVM User Req", "90"), + DvmUserDiscoveryResponseEvent.KIND to KindName("DVM User Resp", "90"), OtsEvent.KIND to KindName("OTS", "03"), PaymentTargetsEvent.KIND to KindName("PayTo", null), - PeopleListEvent.KIND to KindName("People Lists", "51"), + FollowSetEvent.KIND to KindName("People Lists", "51"), ProfileBadgesEvent.KIND to KindName("Profile Badges", "58"), PictureEvent.KIND to KindName("Pictures", "68"), WorkoutRecordEvent.KIND to KindName("Workouts", null), @@ -478,12 +478,12 @@ object KindNames { ZapPollEvent.KIND to KindName("Zap Poll", null), PollEvent.KIND to KindName("Poll", "88"), PollResponseEvent.KIND to KindName("Poll Response", "88"), - PrivateDmEvent.KIND to KindName("NIP-04 DMs", "04"), + EncryptedDmEvent.KIND to KindName("NIP-04 DMs", "04"), PrivateOutboxRelayListEvent.KIND to KindName("Private Relays", "37"), ProxyRelayListEvent.KIND to KindName("Proxy Relays", "51"), PublicMessageEvent.KIND to KindName("Public Message", "A4"), ReactionEvent.KIND to KindName("Reactions", "25"), - ContactCardEvent.KIND to KindName("Contact Card", "85"), + UserAssertionEvent.KIND to KindName("Contact Card", "85"), RelayAuthEvent.KIND to KindName("Relay Auth", "42"), RelayDiscoveryEvent.KIND to KindName("Relay Discovery", "66"), RelayMonitorEvent.KIND to KindName("Relay Monitor Announcement", "66"), @@ -491,24 +491,24 @@ object KindNames { ReportEvent.KIND to KindName("Reports", "56"), RepostEvent.KIND to KindName("Reposts", "18"), RequestToVanishEvent.KIND to KindName("User Delete", "62"), - SealedRumorEvent.KIND to KindName("Seals", "59"), + SealEvent.KIND to KindName("Seals", "59"), SearchRelayListEvent.KIND to KindName("Search Relays", "50"), - StatusEvent.KIND to KindName("User Status", "38"), + UserStatusEvent.KIND to KindName("User Status", "38"), TextNoteEvent.KIND to KindName("Notes", "10"), TextNoteModificationEvent.KIND to KindName("Edits", null), TorrentEvent.KIND to KindName("Torrents", "35"), TorrentCommentEvent.KIND to KindName("Torrent Comments", "35"), TrustedRelayListEvent.KIND to KindName("Trusted Relays", "51"), TrustProviderListEvent.KIND to KindName("Trusted Providers", "85"), - VideoHorizontalEvent.KIND to KindName("Video (Repl)", "71"), - VideoVerticalEvent.KIND to KindName("Shorts (Repl)", "71"), + AddressableNormalVideoEvent.KIND to KindName("Video (Repl)", "71"), + AddressableShortVideoEvent.KIND to KindName("Shorts (Repl)", "71"), VideoNormalEvent.KIND to KindName("Video", "71"), VideoShortEvent.KIND to KindName("Shorts", "71"), VoiceEvent.KIND to KindName("Voice Msg", "A0"), VoiceReplyEvent.KIND to KindName("Voice Reply", "A0"), WakeUpEvent.KIND to KindName("WakeUp", null), WebBookmarkEvent.KIND to KindName("Web Bookmark", "B0"), - WikiNoteEvent.KIND to KindName("Wiki", "54"), + WikiArticleEvent.KIND to KindName("Wiki", "54"), WikiMergeRequestEvent.KIND to KindName("Wiki Merge Request", "54"), WikiMergeAcceptanceEvent.KIND to KindName("Wiki Merge Accepted", null), WikiRedirectEvent.KIND to KindName("Wiki Redirect", "54"), @@ -544,41 +544,41 @@ object KindNames { LabelEvent.KIND to KindName("Label", "32"), SoftwareAssetEvent.KIND to KindName("Software Asset", "82"), AdminCommandEvent.KIND to KindName("Nests Admin Command", null), - NIP90TextExtractionRequestEvent.KIND to KindName("DVM Text Extraction Req", "90"), - NIP90SummarizationRequestEvent.KIND to KindName("DVM Summarization Req", "90"), - NIP90TranslationRequestEvent.KIND to KindName("DVM Translation Req", "90"), - NIP90TextGenerationRequestEvent.KIND to KindName("DVM Text Generation Req", "90"), - NIP90ImageGenerationRequestEvent.KIND to KindName("DVM Image Generation Req", "90"), + DvmTextExtractionRequestEvent.KIND to KindName("DVM Text Extraction Req", "90"), + DvmSummarizationRequestEvent.KIND to KindName("DVM Summarization Req", "90"), + DvmTranslationRequestEvent.KIND to KindName("DVM Translation Req", "90"), + DvmTextGenerationRequestEvent.KIND to KindName("DVM Text Generation Req", "90"), + DvmImageGenerationRequestEvent.KIND to KindName("DVM Image Generation Req", "90"), NappletSnapshotEvent.KIND to KindName("Napplet Snapshot", "5D"), - NIP90VideoConversionRequestEvent.KIND to KindName("DVM Video Conversion Req", "90"), - NIP90VideoTranslationRequestEvent.KIND to KindName("DVM Video Translation Req", "90"), - NIP90ImageToVideoRequestEvent.KIND to KindName("DVM Image To Video Req", "90"), - NIP90TextToSpeechRequestEvent.KIND to KindName("DVM Text To Speech Req", "90"), - NIP90ContentSearchRequestEvent.KIND to KindName("DVM Content Search Req", "90"), - NIP90PeopleSearchRequestEvent.KIND to KindName("DVM People Search Req", "90"), - NIP90EventCountRequestEvent.KIND to KindName("DVM Event Count Req", "90"), - NIP90MalwareScanRequestEvent.KIND to KindName("DVM Malware Scan Req", "90"), - NIP90EventTimestampingRequestEvent.KIND to KindName("DVM Timestamping Req", "90"), - NIP90OpReturnRequestEvent.KIND to KindName("DVM OpReturn Req", "90"), - NIP90EventPublishScheduleRequestEvent.KIND to KindName("DVM Publish Schedule Req", "90"), - NIP90EventPowDelegationRequestEvent.KIND to KindName("DVM PoW Delegation Req", "90"), - NIP90TextExtractionResponseEvent.KIND to KindName("DVM Text Extraction Resp", "90"), - NIP90SummarizationResponseEvent.KIND to KindName("DVM Summarization Resp", "90"), - NIP90TranslationResponseEvent.KIND to KindName("DVM Translation Resp", "90"), - NIP90TextGenerationResponseEvent.KIND to KindName("DVM Text Generation Resp", "90"), - NIP90ImageGenerationResponseEvent.KIND to KindName("DVM Image Generation Resp", "90"), - NIP90VideoConversionResponseEvent.KIND to KindName("DVM Video Conversion Resp", "90"), - NIP90VideoTranslationResponseEvent.KIND to KindName("DVM Video Translation Resp", "90"), - NIP90ImageToVideoResponseEvent.KIND to KindName("DVM Image To Video Resp", "90"), - NIP90TextToSpeechResponseEvent.KIND to KindName("DVM Text To Speech Resp", "90"), - NIP90ContentSearchResponseEvent.KIND to KindName("DVM Content Search Resp", "90"), - NIP90PeopleSearchResponseEvent.KIND to KindName("DVM People Search Resp", "90"), - NIP90EventCountResponseEvent.KIND to KindName("DVM Event Count Resp", "90"), - NIP90MalwareScanResponseEvent.KIND to KindName("DVM Malware Scan Resp", "90"), - NIP90EventTimestampingResponseEvent.KIND to KindName("DVM Timestamping Resp", "90"), - NIP90OpReturnResponseEvent.KIND to KindName("DVM OpReturn Resp", "90"), - NIP90EventPublishScheduleResponseEvent.KIND to KindName("DVM Publish Schedule Resp", "90"), - NIP90EventPowDelegationResponseEvent.KIND to KindName("DVM PoW Delegation Resp", "90"), + DvmVideoConversionRequestEvent.KIND to KindName("DVM Video Conversion Req", "90"), + DvmVideoTranslationRequestEvent.KIND to KindName("DVM Video Translation Req", "90"), + DvmImageToVideoRequestEvent.KIND to KindName("DVM Image To Video Req", "90"), + DvmTextToSpeechRequestEvent.KIND to KindName("DVM Text To Speech Req", "90"), + DvmContentSearchRequestEvent.KIND to KindName("DVM Content Search Req", "90"), + DvmPeopleSearchRequestEvent.KIND to KindName("DVM People Search Req", "90"), + DvmEventCountRequestEvent.KIND to KindName("DVM Event Count Req", "90"), + DvmMalwareScanRequestEvent.KIND to KindName("DVM Malware Scan Req", "90"), + DvmEventTimestampingRequestEvent.KIND to KindName("DVM Timestamping Req", "90"), + DvmOpReturnRequestEvent.KIND to KindName("DVM OpReturn Req", "90"), + DvmEventPublishScheduleRequestEvent.KIND to KindName("DVM Publish Schedule Req", "90"), + DvmEventPowDelegationRequestEvent.KIND to KindName("DVM PoW Delegation Req", "90"), + DvmTextExtractionResponseEvent.KIND to KindName("DVM Text Extraction Resp", "90"), + DvmSummarizationResponseEvent.KIND to KindName("DVM Summarization Resp", "90"), + DvmTranslationResponseEvent.KIND to KindName("DVM Translation Resp", "90"), + DvmTextGenerationResponseEvent.KIND to KindName("DVM Text Generation Resp", "90"), + DvmImageGenerationResponseEvent.KIND to KindName("DVM Image Generation Resp", "90"), + DvmVideoConversionResponseEvent.KIND to KindName("DVM Video Conversion Resp", "90"), + DvmVideoTranslationResponseEvent.KIND to KindName("DVM Video Translation Resp", "90"), + DvmImageToVideoResponseEvent.KIND to KindName("DVM Image To Video Resp", "90"), + DvmTextToSpeechResponseEvent.KIND to KindName("DVM Text To Speech Resp", "90"), + DvmContentSearchResponseEvent.KIND to KindName("DVM Content Search Resp", "90"), + DvmPeopleSearchResponseEvent.KIND to KindName("DVM People Search Resp", "90"), + DvmEventCountResponseEvent.KIND to KindName("DVM Event Count Resp", "90"), + DvmMalwareScanResponseEvent.KIND to KindName("DVM Malware Scan Resp", "90"), + DvmEventTimestampingResponseEvent.KIND to KindName("DVM Timestamping Resp", "90"), + DvmOpReturnResponseEvent.KIND to KindName("DVM OpReturn Resp", "90"), + DvmEventPublishScheduleResponseEvent.KIND to KindName("DVM Publish Schedule Resp", "90"), + DvmEventPowDelegationResponseEvent.KIND to KindName("DVM PoW Delegation Resp", "90"), CashuMintQuoteEvent.KIND to KindName("Cashu Mint Quote", "60"), CashuTokenEvent.KIND to KindName("Cashu Token", "60"), CashuSpendingHistoryEvent.KIND to KindName("Cashu History", "60"), @@ -587,15 +587,15 @@ object KindNames { OnchainZapEvent.KIND to KindName("Onchain Zap", "BC"), Bolt12ZapEvent.KIND to KindName("Bolt12 Zap", "B1"), Bolt12OfferListEvent.KIND to KindName("Bolt12 Offers", "B1"), - PutUserEvent.KIND to KindName("Group Put User", "29"), - RemoveUserEvent.KIND to KindName("Group Remove User", "29"), - EditMetadataEvent.KIND to KindName("Group Edit Metadata", "29"), - DeleteEventEvent.KIND to KindName("Group Delete Event", "29"), + GroupPutUserEvent.KIND to KindName("Group Put User", "29"), + GroupRemoveUserEvent.KIND to KindName("Group Remove User", "29"), + GroupEditMetadataEvent.KIND to KindName("Group Edit Metadata", "29"), + GroupDeleteEventEvent.KIND to KindName("Group Delete Event", "29"), CreateGroupEvent.KIND to KindName("Group Create", "29"), DeleteGroupEvent.KIND to KindName("Group Delete", "29"), - CreateInviteEvent.KIND to KindName("Group Create Invite", "29"), - JoinRequestEvent.KIND to KindName("Group Join Request", "29"), - LeaveRequestEvent.KIND to KindName("Group Leave Request", "29"), + GroupCreateInviteEvent.KIND to KindName("Group Create Invite", "29"), + GroupJoinRequestEvent.KIND to KindName("Group Join Request", "29"), + GroupLeaveRequestEvent.KIND to KindName("Group Leave Request", "29"), NutzapEvent.KIND to KindName("Nutzap", "61"), SimpleGroupListEvent.KIND to KindName("Group List", "51"), ExternalIdentitiesEvent.KIND to KindName("External Identities", "39"), @@ -668,7 +668,7 @@ object KindNames { GroupMetadataEvent.KIND to KindName("Group Metadata", "29"), GroupAdminsEvent.KIND to KindName("Group Admins", "29"), GroupMembersEvent.KIND to KindName("Group Members", "29"), - SupportedRolesEvent.KIND to KindName("Group Roles", "29"), + GroupRolesEvent.KIND to KindName("Group Roles", "29"), GroupParticipantsEvent.KIND to KindName("Group Participants", "29"), MediaStarterPackEvent.KIND to KindName("Media Starter Pack", "51"), ) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/marmot/MarmotWelcomeSender.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/marmot/MarmotWelcomeSender.kt index 051aaf9742..d83d539c10 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/marmot/MarmotWelcomeSender.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/marmot/MarmotWelcomeSender.kt @@ -50,7 +50,7 @@ data class WelcomeDelivery( * * Delivery pipeline: * Welcome bytes → base64 → WelcomeEvent (kind:444, unsigned rumor) - * → SealedRumorEvent (kind:13, encrypted with sender's key) + * → SealEvent (kind:13, encrypted with sender's key) * → GiftWrapEvent (kind:1059, encrypted with ephemeral key) */ class MarmotWelcomeSender( diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/marmot/RecipientRelayFetcher.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/marmot/RecipientRelayFetcher.kt index 846b6c1237..56d268fda5 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/marmot/RecipientRelayFetcher.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/marmot/RecipientRelayFetcher.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.client.INostrClient import com.vitorpamplona.quartz.nip01Core.relay.client.accessories.fetchAll import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent /** @@ -100,7 +100,7 @@ object RecipientRelayFetcher { Filter( kinds = listOf( - ChatMessageRelayListEvent.KIND, + DmRelayListEvent.KIND, KeyPackageRelayListEvent.KIND, AdvertisedRelayListEvent.KIND, ), @@ -113,7 +113,7 @@ object RecipientRelayFetcher { idleTimeoutMs = idleTimeoutMs, ) - var dm: ChatMessageRelayListEvent? = null + var dm: DmRelayListEvent? = null var kp: KeyPackageRelayListEvent? = null var nip65: AdvertisedRelayListEvent? = null for (event in events) { @@ -122,7 +122,7 @@ object RecipientRelayFetcher { // route someone else's wrapped welcome to the wrong inbox. if (event.pubKey != pubKey) continue when (event) { - is ChatMessageRelayListEvent -> { + is DmRelayListEvent -> { if (dm == null || event.createdAt > dm.createdAt) dm = event } diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/marmot/mip00KeyPackages/KeyPackageRelayListEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/marmot/mip00KeyPackages/KeyPackageRelayListEvent.kt index e9eb595b97..3f98a91dec 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/marmot/mip00KeyPackages/KeyPackageRelayListEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/marmot/mip00KeyPackages/KeyPackageRelayListEvent.kt @@ -42,7 +42,7 @@ import com.vitorpamplona.quartz.utils.TimeUtils * Replaceable event that advertises which relays hold this user's MLS KeyPackages. * Other clients query this to discover where to fetch KeyPackages for group invitations. * - * Uses the same "relay" tag format as NIP-17's ChatMessageRelayListEvent (kind 10050) + * Uses the same "relay" tag format as NIP-17's DmRelayListEvent (kind 10050) * but serves a different purpose: KeyPackage discovery vs DM inbox routing. */ @Immutable diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/marmot/mip02Welcome/WelcomeGiftWrap.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/marmot/mip02Welcome/WelcomeGiftWrap.kt index 6ee4406313..2f4cc00f48 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/marmot/mip02Welcome/WelcomeGiftWrap.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/marmot/mip02Welcome/WelcomeGiftWrap.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip59Giftwrap.rumors.Rumor import com.vitorpamplona.quartz.nip59Giftwrap.rumors.RumorAssembler -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.utils.TimeUtils @@ -35,7 +35,7 @@ import com.vitorpamplona.quartz.utils.TimeUtils * * The delivery flow: * WelcomeEvent (unsigned rumor, kind:444) - * → SealedRumorEvent (kind:13, encrypted with sender's key) + * → SealEvent (kind:13, encrypted with sender's key) * → GiftWrapEvent (kind:1059, encrypted with ephemeral key to recipient) * * CRITICAL: The Commit that adds the new member MUST be confirmed by relays @@ -64,7 +64,7 @@ object WelcomeGiftWrap { ): GiftWrapEvent { // Step 1: Build the WelcomeEvent template directly as an unsigned rumor. // Per NIP-59 rumors MUST have an empty sig field, so we skip the outer - // signature entirely and let the SealedRumorEvent carry authorship. + // signature entirely and let the SealEvent carry authorship. val welcomeTemplate = WelcomeEvent.build( welcomeBase64 = welcomeBase64, @@ -82,7 +82,7 @@ object WelcomeGiftWrap { // Step 2: Create a Rumor from the unsigned event and seal it (kind:13) val rumor = Rumor.create(welcomeRumor) val sealedRumor = - SealedRumorEvent.create( + SealEvent.create( rumor = rumor, encryptTo = recipientPubKey, signer = signer, diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/cache/projection/EventStoreProjection.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/cache/projection/EventStoreProjection.kt index 58c3ecc6ff..df861928f5 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/cache/projection/EventStoreProjection.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/cache/projection/EventStoreProjection.kt @@ -30,7 +30,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.store.ObservableEventStore import com.vitorpamplona.quartz.nip01Core.store.ObservableEventStore.StoreChange import com.vitorpamplona.quartz.nip01Core.store.owner -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip40Expiration.isExpirationBefore import com.vitorpamplona.quartz.nip62RequestToVanish.RequestToVanishEvent import com.vitorpamplona.quartz.utils.SortedList @@ -156,7 +156,7 @@ class EventStoreProjection( // NIP-09 / NIP-62 side effects come first — a deletion event // that arrives at the same instant as a matching event still // removes its targets. - if (event is DeletionEvent) { + if (event is DeletionRequestEvent) { if (handleDeletion(event)) changed = true } if (event is RequestToVanishEvent && event.shouldVanishFrom(store.relay)) { @@ -260,7 +260,7 @@ class EventStoreProjection( return changed } - private fun handleDeletion(deletion: DeletionEvent): Boolean { + private fun handleDeletion(deletion: DeletionRequestEvent): Boolean { var changed = false // NIP-09 by id, only if the deletion's author owns the target. diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/accessories/NostrClientNegentropyDeletionSettleExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/accessories/NostrClientNegentropyDeletionSettleExt.kt index 67e770f1de..48ec8f2474 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/accessories/NostrClientNegentropyDeletionSettleExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/client/accessories/NostrClientNegentropyDeletionSettleExt.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.store.IEventStore import com.vitorpamplona.quartz.nip01Core.store.deletionsCovering -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent /** * Outcome of a [negentropySettleDeletions] run. @@ -129,7 +129,7 @@ suspend fun INostrClient.negentropySettleDeletions( for (chunk in diff.haveIds.chunked(batchSize)) { val ours = store.query(Filter(ids = chunk)) val relayDeletions = deletionsCovering(ours, relay) { f -> fetchAll(relay, f, idleTimeoutMs) } - for (del in relayDeletions.filterIsInstance()) { + for (del in relayDeletions.filterIsInstance()) { if (del.verify() && appliedDown.add(del.id)) { store.insert(del) resolved++ diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/signers/NostrSigner.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/signers/NostrSigner.kt index 70836a44b9..b87513ce80 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/signers/NostrSigner.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/signers/NostrSigner.kt @@ -24,7 +24,7 @@ import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip04Dm.crypto.EncryptedInfo import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent abstract class NostrSigner( pubKey: HexKey, @@ -67,7 +67,7 @@ abstract class NostrSigner( fromPublicKey: HexKey, ): String - abstract suspend fun decryptZapEvent(event: LnZapRequestEvent): LnZapPrivateEvent + abstract suspend fun decryptZapEvent(event: ZapRequestEvent): LnZapPrivateEvent abstract suspend fun deriveKey(nonce: HexKey): HexKey diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/signers/NostrSignerInternal.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/signers/NostrSignerInternal.kt index b308afbd06..acb512e5c6 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/signers/NostrSignerInternal.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/signers/NostrSignerInternal.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.core.toHexKey import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import kotlinx.coroutines.CancellationException class NostrSignerInternal( @@ -89,7 +89,7 @@ class NostrSignerInternal( // always ready override fun hasForegroundSupport() = true - override suspend fun decryptZapEvent(event: LnZapRequestEvent): LnZapPrivateEvent { + override suspend fun decryptZapEvent(event: ZapRequestEvent): LnZapPrivateEvent { if (!event.isPrivateZap()) throw SignerExceptions.NothingToDecrypt() return runWrapErrors { diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/signers/NostrSignerSync.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/signers/NostrSignerSync.kt index 9ca2935bf5..90566d4e7c 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/signers/NostrSignerSync.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/signers/NostrSignerSync.kt @@ -31,8 +31,8 @@ import com.vitorpamplona.quartz.nip04Dm.crypto.EncryptedInfo import com.vitorpamplona.quartz.nip04Dm.crypto.Nip04 import com.vitorpamplona.quartz.nip44Encryption.Nip44 import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent import com.vitorpamplona.quartz.nip57Zaps.PrivateZapRequestBuilder +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nipBCOnchainZaps.psbt.Psbt import com.vitorpamplona.quartz.nipBCOnchainZaps.psbt.PsbtSigner @@ -62,7 +62,7 @@ class NostrSignerSync( kind: Int, tags: Array>, ): Boolean = - kind == LnZapRequestEvent.KIND && + kind == ZapRequestEvent.KIND && tags.any { t -> t.size > 1 && t[0] == "anon" && t[1].isBlank() } fun signNormal( @@ -129,7 +129,7 @@ class NostrSignerSync( ) } - fun decryptZapEvent(event: LnZapRequestEvent): LnZapPrivateEvent = PrivateZapRequestBuilder().decryptZapEvent(event, this) + fun decryptZapEvent(event: ZapRequestEvent): LnZapPrivateEvent = PrivateZapRequestBuilder().decryptZapEvent(event, this) /** * NIP-BC `sign_psbt`: sign the key-path P2TR inputs of [psbtHex] this key diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/EventStoreDeletionsExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/EventStoreDeletionsExt.kt index 0c5a8203dc..ba070507e1 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/EventStoreDeletionsExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/EventStoreDeletionsExt.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.core.isAddressable import com.vitorpamplona.quartz.nip01Core.core.isReplaceable import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip62RequestToVanish.RequestToVanishEvent /** The addressable/replaceable coordinate of [event] as a NIP-01 `a`-tag value. */ @@ -68,15 +68,15 @@ suspend fun deletionsCovering( val covering = LinkedHashMap() // 1. id-based NIP-09: a kind-5 `e`-tagging an event's id. - query(Filter(kinds = listOf(DeletionEvent.KIND), tags = mapOf("e" to events.map { it.id }))) + query(Filter(kinds = listOf(DeletionRequestEvent.KIND), tags = mapOf("e" to events.map { it.id }))) .forEach { covering[it.id] = it } // 2. address-based NIP-09: a kind-5 `a`-tagging an event's coordinate, cutoff-checked. val byAddress = events.filter { it.kind.isAddressable() || it.kind.isReplaceable() }.groupBy(::addressValue) if (byAddress.isNotEmpty()) { - query(Filter(kinds = listOf(DeletionEvent.KIND), tags = mapOf("a" to byAddress.keys.toList()))) + query(Filter(kinds = listOf(DeletionRequestEvent.KIND), tags = mapOf("a" to byAddress.keys.toList()))) .forEach { del -> - if (del !is DeletionEvent) return@forEach + if (del !is DeletionRequestEvent) return@forEach for (addr in del.deleteAddresses()) { val hit = byAddress[addr.toValue()] ?: continue if (hit.any { it.createdAt <= del.createdAt }) { diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/DeletionRequestModule.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/DeletionRequestModule.kt index 448296a4ae..880e1f4630 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/DeletionRequestModule.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/DeletionRequestModule.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.core.isAddressable import com.vitorpamplona.quartz.nip01Core.core.isReplaceable -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent class DeletionRequestModule( val hasher: (db: SQLiteConnection) -> TagNameValueHasher, @@ -83,7 +83,7 @@ class DeletionRequestModule( event: Event, db: SQLiteConnection, ): Int { - if (event !is DeletionEvent) return 0 + if (event !is DeletionRequestEvent) return 0 val idValues = event.deleteEventIds() val addresses = event.deleteAddresses() diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/SQLiteEventStore.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/SQLiteEventStore.kt index e57e7c0882..9f267c3d6c 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/SQLiteEventStore.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/SQLiteEventStore.kt @@ -38,7 +38,7 @@ import com.vitorpamplona.quartz.nip01Core.store.IEventStore import com.vitorpamplona.quartz.nip01Core.store.IdAndTime import com.vitorpamplona.quartz.nip01Core.store.RawEvent import com.vitorpamplona.quartz.nip01Core.store.RejectionReason -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip40Expiration.isExpired import com.vitorpamplona.quartz.nip50Search.strippingSearchExtensions import com.vitorpamplona.quartz.nip62RequestToVanish.RequestToVanishEvent @@ -349,7 +349,7 @@ class SQLiteEventStore( invalidateAll = true return } - if (event is DeletionEvent && deletedRows > 0) { + if (event is DeletionRequestEvent && deletedRows > 0) { // Only a kind-5 that actually removed rows costs a rebuild. // The common case — a delete broadcast for events this relay // never stored — deletes nothing and records as a plain row, diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip04Dm/PrivateDMCache.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip04Dm/PrivateDMCache.kt index 84ad273dfc..18b9c6a075 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip04Dm/PrivateDMCache.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip04Dm/PrivateDMCache.kt @@ -23,14 +23,14 @@ package com.vitorpamplona.quartz.nip04Dm import androidx.collection.LruCache import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.caches.DecryptCache -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent class PrivateDMCache( signer: NostrSigner, ) { private val decryptionCache = - object : LruCache(10000) { - override fun create(key: PrivateDmEvent): PrivateDMDecryptCache? { + object : LruCache(10000) { + override fun create(key: EncryptedDmEvent): PrivateDMDecryptCache? { val canDecrypt = key.isIncluded(signer.pubKey) return if (key.content.isNotBlank() && canDecrypt) { PrivateDMDecryptCache(signer) @@ -40,16 +40,16 @@ class PrivateDMCache( } } - fun cachedDM(event: PrivateDmEvent): String? = decryptionCache[event]?.cached() + fun cachedDM(event: EncryptedDmEvent): String? = decryptionCache[event]?.cached() - suspend fun decryptDM(event: PrivateDmEvent) = decryptionCache[event]?.decrypt(event) + suspend fun decryptDM(event: EncryptedDmEvent) = decryptionCache[event]?.decrypt(event) } class PrivateDMDecryptCache( signer: NostrSigner, -) : DecryptCache(signer) { +) : DecryptCache(signer) { override suspend fun decryptAndParse( - event: PrivateDmEvent, + event: EncryptedDmEvent, signer: NostrSigner, ) = event.decryptContent(signer) } diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip04Dm/messages/PrivateDmEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip04Dm/messages/EncryptedDmEvent.kt similarity index 92% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip04Dm/messages/PrivateDmEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip04Dm/messages/EncryptedDmEvent.kt index 9b774e3c49..fc5ec3dd8e 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip04Dm/messages/PrivateDmEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip04Dm/messages/EncryptedDmEvent.kt @@ -42,7 +42,7 @@ import com.vitorpamplona.quartz.utils.TimeUtils import kotlinx.collections.immutable.persistentSetOf @Immutable -class PrivateDmEvent( +class EncryptedDmEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -124,10 +124,10 @@ class PrivateDmEvent( toUser: PTag, message: String, imetas: List? = null, - replyingTo: EventHintBundle? = null, + replyingTo: EventHintBundle? = null, createdAt: Long = TimeUtils.now(), signer: NostrSigner, - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate( kind = KIND, description = @@ -147,9 +147,15 @@ class PrivateDmEvent( to: PTag, message: String, imetas: List? = null, - replyingTo: EventHintBundle?, + replyingTo: EventHintBundle?, createdAt: Long = TimeUtils.now(), signer: NostrSigner, ) = signer.sign(build(to, message, imetas, replyingTo, createdAt, signer)) } } + +@Deprecated( + "Renamed to EncryptedDmEvent. NIP-04 names kind 4 the encrypted direct message.", + ReplaceWith("EncryptedDmEvent", "com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent"), +) +typealias PrivateDmEvent = EncryptedDmEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip04Dm/messages/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip04Dm/messages/TagArrayBuilderExt.kt index 06d7a5e0b7..8a9d4559ab 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip04Dm/messages/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip04Dm/messages/TagArrayBuilderExt.kt @@ -26,6 +26,6 @@ import com.vitorpamplona.quartz.nip01Core.tags.events.EventReference import com.vitorpamplona.quartz.nip10Notes.tags.MarkedETag import com.vitorpamplona.quartz.nip10Notes.tags.toMarkedETag -fun TagArrayBuilder.reply(tag: EventReference) = add(MarkedETag.assemble(tag.eventId, tag.relayHint, MarkedETag.MARKER.REPLY, tag.author)) +fun TagArrayBuilder.reply(tag: EventReference) = add(MarkedETag.assemble(tag.eventId, tag.relayHint, MarkedETag.MARKER.REPLY, tag.author)) -fun TagArrayBuilder.reply(tag: EventHintBundle) = add(tag.toMarkedETag(MarkedETag.MARKER.REPLY).toTagArray()) +fun TagArrayBuilder.reply(tag: EventHintBundle) = add(tag.toMarkedETag(MarkedETag.MARKER.REPLY).toTagArray()) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip09Deletions/DeletionIndex.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip09Deletions/DeletionIndex.kt index a26c716af2..93099829a4 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip09Deletions/DeletionIndex.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip09Deletions/DeletionIndex.kt @@ -45,10 +45,10 @@ class DeletionIndex { // stores a set of id OR atags (kind:pubkey:dtag) by pubkey with the created at of the deletion event. // Anything newer than the date should not be deleted. - private val deletedReferencesBefore = LargeCache() + private val deletedReferencesBefore = LargeCache() fun add( - event: DeletionEvent, + event: DeletionRequestEvent, wasVerified: Boolean, ): Boolean { var atLeastOne = false @@ -74,7 +74,7 @@ class DeletionIndex { private fun add( ref: String, byPubKey: HexKey, - deletionEvent: DeletionEvent, + deletionEvent: DeletionRequestEvent, wasVerified: Boolean, ): Boolean { val key = DeletionRequest(ref, byPubKey) @@ -89,7 +89,7 @@ class DeletionIndex { return false } - fun hasBeenDeletedBy(event: Event): DeletionEvent? { + fun hasBeenDeletedBy(event: Event): DeletionRequestEvent? { deletedReferencesBefore.get(DeletionRequest(event.id, event.pubKey))?.let { return it } diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip09Deletions/DeletionEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip09Deletions/DeletionRequestEvent.kt similarity index 90% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip09Deletions/DeletionEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip09Deletions/DeletionRequestEvent.kt index ec2f1de70a..b3aad126d8 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip09Deletions/DeletionEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip09Deletions/DeletionRequestEvent.kt @@ -44,7 +44,7 @@ import com.vitorpamplona.quartz.nip01Core.tags.people.pTagIds import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class DeletionEvent( +class DeletionRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -80,7 +80,7 @@ class DeletionEvent( fun build( deleteEvents: List, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { deleteEvents.forEach { eTag(ETag(it.id)) @@ -98,7 +98,7 @@ class DeletionEvent( fun buildAddressOnly( deleteEvents: List, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { deleteEvents.forEach { if (it is AddressableEvent) { @@ -115,7 +115,7 @@ class DeletionEvent( fun buildForVersionOnly( deleteEvents: List, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { deleteEvents.forEach { pTag(PTag(it.pubKey)) @@ -128,3 +128,9 @@ class DeletionEvent( } } } + +@Deprecated( + "Renamed to DeletionRequestEvent. NIP-09 names kind 5 the event deletion request.", + ReplaceWith("DeletionRequestEvent", "com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent"), +) +typealias DeletionEvent = DeletionRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip10Notes/BaseThreadedEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip10Notes/BaseThreadedEvent.kt index b8379fb628..a1f57456d9 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip10Notes/BaseThreadedEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip10Notes/BaseThreadedEvent.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.tags.aTag.taggedATags import com.vitorpamplona.quartz.nip01Core.tags.people.taggedUsers import com.vitorpamplona.quartz.nip10Notes.tags.MarkedETag -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent import com.vitorpamplona.quartz.utils.lastNotNullOfOrNull @@ -90,7 +90,7 @@ open class BaseThreadedEvent( val tagAddresses = taggedATags() .filter { aTag -> - aTag.kind != CommunityDefinitionEvent.KIND && (kind != WikiNoteEvent.KIND || aTag.kind != WikiNoteEvent.KIND) && (kind != NipTextEvent.KIND || aTag.kind != NipTextEvent.KIND) + aTag.kind != CommunityDefinitionEvent.KIND && (kind != WikiArticleEvent.KIND || aTag.kind != WikiArticleEvent.KIND) && (kind != NipTextEvent.KIND || aTag.kind != NipTextEvent.KIND) // removes forks from itself. }.map { it.toTag() diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip13Pow/signer/PoWNostrSigner.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip13Pow/signer/PoWNostrSigner.kt index de180cdbb6..3e9e00597d 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip13Pow/signer/PoWNostrSigner.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip13Pow/signer/PoWNostrSigner.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip13Pow.miner.PoWMiner import com.vitorpamplona.quartz.nip13Pow.tags.PoWTag import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent /** * A [NostrSigner] decorator that mines a NIP-13 proof of work into the unsigned @@ -98,7 +98,7 @@ class PoWNostrSigner( fromPublicKey: HexKey, ): String = signer.nip44Decrypt(ciphertext, fromPublicKey) - override suspend fun decryptZapEvent(event: LnZapRequestEvent): LnZapPrivateEvent = signer.decryptZapEvent(event) + override suspend fun decryptZapEvent(event: ZapRequestEvent): LnZapPrivateEvent = signer.decryptZapEvent(event) override suspend fun deriveKey(nonce: HexKey): HexKey = signer.deriveKey(nonce) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip17Dm/NIP17Factory.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip17Dm/NIP17Factory.kt index 5b8284f329..605ce5df89 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip17Dm/NIP17Factory.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip17Dm/NIP17Factory.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.tags.people.taggedUserIds -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent @@ -35,7 +35,7 @@ import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip30CustomEmoji.EmojiUrlTag import com.vitorpamplona.quartz.nip40Expiration.expiration import com.vitorpamplona.quartz.nip46RemoteSigner.signer.NostrSignerRemote -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapTemplateConversion import com.vitorpamplona.quartz.utils.mapNotNullAsync @@ -88,7 +88,7 @@ class NIP17Factory { AddressedSeal( recipient = next, seal = - SealedRumorEvent.create( + SealEvent.create( event = event, encryptTo = next, expirationDelta = innerExpDelta, @@ -169,7 +169,7 @@ class NIP17Factory { val build: suspend () -> GiftWrapEvent = { GiftWrapEvent.create( event = - SealedRumorEvent.create( + SealEvent.create( event = event, encryptTo = next, expirationDelta = innerExpDelta, @@ -258,7 +258,7 @@ class NIP17Factory { * it would e-tag the private rumor id onto public relays. */ suspend fun createDeletionNIP17( - template: EventTemplate, + template: EventTemplate, to: List, signer: NostrSigner, ): Result { diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip17Dm/settings/ChatMessageRelayListEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip17Dm/settings/DmRelayListEvent.kt similarity index 86% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip17Dm/settings/ChatMessageRelayListEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip17Dm/settings/DmRelayListEvent.kt index da8184c850..c66c51610b 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip17Dm/settings/ChatMessageRelayListEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip17Dm/settings/DmRelayListEvent.kt @@ -37,7 +37,7 @@ import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayListDiff import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class ChatMessageRelayListEvent( +class DmRelayListEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -47,7 +47,7 @@ class ChatMessageRelayListEvent( ) : BaseReplaceableEvent(id, pubKey, createdAt, KIND, tags, content, sig), DiffableEvent { override fun diffFrom(older: Event): RelayListDiff? { - if (older !is ChatMessageRelayListEvent || older.pubKey != pubKey) return null + if (older !is DmRelayListEvent || older.pubKey != pubKey) return null return RelayListDiff(ListDiff.of(older.relays(), relays(), { it }), ContentChange.NONE) } @@ -71,11 +71,11 @@ class ChatMessageRelayListEvent( .toTypedArray() suspend fun updateRelayList( - earlierVersion: ChatMessageRelayListEvent, + earlierVersion: DmRelayListEvent, relays: List, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): ChatMessageRelayListEvent { + ): DmRelayListEvent { val tags = earlierVersion.tags .filter(RelayTag::notMatch) @@ -89,12 +89,18 @@ class ChatMessageRelayListEvent( relays: List, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): ChatMessageRelayListEvent = signer.sign(createdAt, KIND, createTagArray(relays), "") + ): DmRelayListEvent = signer.sign(createdAt, KIND, createTagArray(relays), "") fun create( relays: List, signer: NostrSignerSync, createdAt: Long = TimeUtils.now(), - ): ChatMessageRelayListEvent = signer.sign(createdAt, KIND, createTagArray(relays), "") + ): DmRelayListEvent = signer.sign(createdAt, KIND, createTagArray(relays), "") } } + +@Deprecated( + "Renamed to DmRelayListEvent. NIP-17 kind 10050 is the relay list to receive DMs.", + ReplaceWith("DmRelayListEvent", "com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent"), +) +typealias ChatMessageRelayListEvent = DmRelayListEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip23LongContent/LongTextNoteEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip23LongContent/LongFormContentEvent.kt similarity index 94% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip23LongContent/LongTextNoteEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip23LongContent/LongFormContentEvent.kt index 501b0ea929..b4bc6a5cc6 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip23LongContent/LongTextNoteEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip23LongContent/LongFormContentEvent.kt @@ -56,7 +56,7 @@ import kotlin.uuid.ExperimentalUuidApi import kotlin.uuid.Uuid @Immutable -class LongTextNoteEvent( +class LongFormContentEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -162,7 +162,7 @@ class LongTextNoteEvent( publishedAt: Long? = null, dTag: String = Uuid.random().toString(), createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, description, createdAt) { dTag(dTag) @@ -175,3 +175,9 @@ class LongTextNoteEvent( } } } + +@Deprecated( + "Renamed to LongFormContentEvent. NIP-23 names kind 30023 long-form content.", + ReplaceWith("LongFormContentEvent", "com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent"), +) +typealias LongTextNoteEvent = LongFormContentEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip23LongContent/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip23LongContent/TagArrayBuilderExt.kt index be24865911..174d59c9d0 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip23LongContent/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip23LongContent/TagArrayBuilderExt.kt @@ -26,10 +26,10 @@ import com.vitorpamplona.quartz.nip23LongContent.tags.PublishedAtTag import com.vitorpamplona.quartz.nip23LongContent.tags.SummaryTag import com.vitorpamplona.quartz.nip23LongContent.tags.TitleTag -fun TagArrayBuilder.title(title: String) = addUnique(TitleTag.assemble(title)) +fun TagArrayBuilder.title(title: String) = addUnique(TitleTag.assemble(title)) -fun TagArrayBuilder.summary(summary: String) = addUnique(SummaryTag.assemble(summary)) +fun TagArrayBuilder.summary(summary: String) = addUnique(SummaryTag.assemble(summary)) -fun TagArrayBuilder.image(imageUrl: String) = addUnique(ImageTag.assemble(imageUrl)) +fun TagArrayBuilder.image(imageUrl: String) = addUnique(ImageTag.assemble(imageUrl)) -fun TagArrayBuilder.publishedAt(publishedAt: Long) = addUnique(PublishedAtTag.assemble(publishedAt)) +fun TagArrayBuilder.publishedAt(publishedAt: Long) = addUnique(PublishedAtTag.assemble(publishedAt)) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip28PublicChat/list/ChannelListEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip28PublicChat/list/PublicChatListEvent.kt similarity index 89% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip28PublicChat/list/ChannelListEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip28PublicChat/list/PublicChatListEvent.kt index 27f84bb63c..08cdbbb345 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip28PublicChat/list/ChannelListEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip28PublicChat/list/PublicChatListEvent.kt @@ -42,7 +42,7 @@ import com.vitorpamplona.quartz.nip51Lists.removeParsing import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class ChannelListEvent( +class PublicChatListEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -53,7 +53,7 @@ class ChannelListEvent( DiffableEvent, EventHintProvider { override fun diffFrom(older: Event): ChannelListDiff? { - if (older !is ChannelListEvent || older.pubKey != pubKey || older.dTag() != dTag()) return null + if (older !is PublicChatListEvent || older.pubKey != pubKey || older.dTag() != dTag()) return null return ChannelListDiff( ListDiff.of(older.tags.channels(), tags.channels(), { it.eventId }, { a, b -> a.relay == b.relay }), privateItemsChangeFrom(older), @@ -87,7 +87,7 @@ class ChannelListEvent( isPrivate: Boolean, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): ChannelListEvent = + ): PublicChatListEvent = if (isPrivate) { create( publicChannels = emptyList(), @@ -105,7 +105,7 @@ class ChannelListEvent( } suspend fun add( - earlierVersion: ChannelListEvent, + earlierVersion: PublicChatListEvent, channel: ChannelTag, isPrivate: Boolean, signer: NostrSigner, @@ -119,12 +119,12 @@ class ChannelListEvent( ) suspend fun add( - earlierVersion: ChannelListEvent, + earlierVersion: PublicChatListEvent, channels: List, isPrivate: Boolean, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): ChannelListEvent = + ): PublicChatListEvent = if (isPrivate) { val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException() resign( @@ -143,11 +143,11 @@ class ChannelListEvent( } suspend fun remove( - earlierVersion: ChannelListEvent, + earlierVersion: PublicChatListEvent, channel: ChannelTag, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): ChannelListEvent { + ): PublicChatListEvent { val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException() return resign( privateTags = privateTags.removeParsing(ChannelTag::parseId, channel.eventId), @@ -174,14 +174,14 @@ class ChannelListEvent( tags: TagArray, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): ChannelListEvent = signer.sign(createdAt, KIND, tags, content) + ): PublicChatListEvent = signer.sign(createdAt, KIND, tags, content) suspend fun create( publicChannels: List = emptyList(), privateChannels: List = emptyList(), signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): ChannelListEvent { + ): PublicChatListEvent { val template = build(publicChannels, privateChannels, signer, createdAt) return signer.sign(template) } @@ -191,7 +191,7 @@ class ChannelListEvent( privateChannels: List = emptyList(), signer: NostrSignerSync, createdAt: Long = TimeUtils.now(), - ): ChannelListEvent { + ): PublicChatListEvent { val privateTagArray = privateChannels.map { it.toTagArray() }.toTypedArray() val publicTagArray = publicChannels.map { it.toTagArray() }.toTypedArray() return signer.signNip51List(createdAt, KIND, publicTagArray, privateTagArray) @@ -202,8 +202,8 @@ class ChannelListEvent( privateChannels: List = emptyList(), signer: NostrSigner, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, - ) = eventTemplate( + initializer: TagArrayBuilder.() -> Unit = {}, + ) = eventTemplate( kind = KIND, description = PrivateTagsInContent.encryptNip44(privateChannels.map { it.toTagArray() }.toTypedArray(), signer), createdAt = createdAt, @@ -214,3 +214,9 @@ class ChannelListEvent( } } } + +@Deprecated( + "Renamed to PublicChatListEvent. NIP-51 names kind 10005 the public chats list.", + ReplaceWith("PublicChatListEvent", "com.vitorpamplona.quartz.nip28PublicChat.list.PublicChatListEvent"), +) +typealias ChannelListEvent = PublicChatListEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip28PublicChat/list/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip28PublicChat/list/TagArrayBuilderExt.kt index a26e2947f4..fd2acae60b 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip28PublicChat/list/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip28PublicChat/list/TagArrayBuilderExt.kt @@ -26,9 +26,9 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.tags.events.ETag import com.vitorpamplona.quartz.nip28PublicChat.list.tags.ChannelTag -fun TagArrayBuilder.followChat( +fun TagArrayBuilder.followChat( eventId: HexKey, relayUrl: NormalizedRelayUrl, ) = addUnique(ETag.assemble(eventId, relayUrl, null)) -fun TagArrayBuilder.channels(rooms: List) = addAll(rooms.map { it.toTagArray() }) +fun TagArrayBuilder.channels(rooms: List) = addAll(rooms.map { it.toTagArray() }) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/metadata/GroupPinnedEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/metadata/GroupPinnedEvent.kt index a15aa5f589..aa3a653e01 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/metadata/GroupPinnedEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/metadata/GroupPinnedEvent.kt @@ -31,7 +31,7 @@ import com.vitorpamplona.quartz.utils.TimeUtils /** * NIP-29 relay-signed list of a group's pinned messages (kind 39005). The relay - * regenerates it from the accepted [com.vitorpamplona.quartz.nip29RelayGroups.moderation.UpdatePinListEvent] + * regenerates it from the accepted [com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupUpdatePinListEvent] * (kind 9010) moderation actions, so this is the read side clients render — the * source of truth for which messages are pinned and in what display order. * diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/metadata/SupportedRolesEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/metadata/GroupRolesEvent.kt similarity index 83% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/metadata/SupportedRolesEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/metadata/GroupRolesEvent.kt index 5efe39736b..9673adce52 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/metadata/SupportedRolesEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/metadata/GroupRolesEvent.kt @@ -30,7 +30,7 @@ import com.vitorpamplona.quartz.nip29RelayGroups.tags.RoleTag import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class SupportedRolesEvent( +class GroupRolesEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -49,7 +49,7 @@ class SupportedRolesEvent( groupId: String, roles: List, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { dTag(groupId) addAll(RoleTag.assemble(roles)) @@ -57,3 +57,9 @@ class SupportedRolesEvent( } } } + +@Deprecated( + "Renamed to GroupRolesEvent. NIP-29 names kind 39003 the group roles. NIP-29 group events carry the Group prefix to keep them apart from NIP-43 relay membership events.", + ReplaceWith("GroupRolesEvent", "com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupRolesEvent"), +) +typealias SupportedRolesEvent = GroupRolesEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/CreateInviteEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupCreateInviteEvent.kt similarity index 82% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/CreateInviteEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupCreateInviteEvent.kt index 6b5ce7f322..ad4fedd9f8 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/CreateInviteEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupCreateInviteEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class CreateInviteEvent( +class GroupCreateInviteEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -47,7 +47,7 @@ class CreateInviteEvent( groupId: String, code: String, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { groupId(groupId) inviteCode(code) @@ -55,3 +55,9 @@ class CreateInviteEvent( } } } + +@Deprecated( + "Renamed to GroupCreateInviteEvent. NIP-29 group events carry the Group prefix to keep them apart from NIP-43 relay membership events.", + ReplaceWith("GroupCreateInviteEvent", "com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupCreateInviteEvent"), +) +typealias CreateInviteEvent = GroupCreateInviteEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/DeleteEventEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupDeleteEventEvent.kt similarity index 84% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/DeleteEventEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupDeleteEventEvent.kt index 25ebd16183..342c1cba71 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/DeleteEventEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupDeleteEventEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class DeleteEventEvent( +class GroupDeleteEventEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -50,7 +50,7 @@ class DeleteEventEvent( eventIds: List, previousEvents: List = emptyList(), createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { groupId(groupId) eventIds.forEach { add(arrayOf("e", it)) } @@ -59,3 +59,9 @@ class DeleteEventEvent( } } } + +@Deprecated( + "Renamed to GroupDeleteEventEvent. NIP-29 group events carry the Group prefix to keep them apart from NIP-43 relay membership events.", + ReplaceWith("GroupDeleteEventEvent", "com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupDeleteEventEvent"), +) +typealias DeleteEventEvent = GroupDeleteEventEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/EditMetadataEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupEditMetadataEvent.kt similarity index 92% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/EditMetadataEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupEditMetadataEvent.kt index 76d0b93ac1..1944ace1a7 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/EditMetadataEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupEditMetadataEvent.kt @@ -36,7 +36,7 @@ import com.vitorpamplona.quartz.nip50Search.SearchableEvent import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class EditMetadataEvent( +class GroupEditMetadataEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -97,7 +97,7 @@ class EditMetadataEvent( visibility: String? = null, archived: Boolean? = null, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { groupId(groupId) name?.let { add(arrayOf("name", it)) } @@ -116,3 +116,9 @@ class EditMetadataEvent( } } } + +@Deprecated( + "Renamed to GroupEditMetadataEvent. NIP-29 group events carry the Group prefix to keep them apart from NIP-43 relay membership events.", + ReplaceWith("GroupEditMetadataEvent", "com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupEditMetadataEvent"), +) +typealias EditMetadataEvent = GroupEditMetadataEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/PutUserEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupPutUserEvent.kt similarity index 88% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/PutUserEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupPutUserEvent.kt index d2f9382413..6faf482d43 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/PutUserEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupPutUserEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class PutUserEvent( +class GroupPutUserEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -62,7 +62,7 @@ class PutUserEvent( previousEvents: List = emptyList(), buzzRole: String? = null, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { groupId(groupId) pubKeysWithRoles.forEach { (pubKey, roles) -> @@ -74,3 +74,9 @@ class PutUserEvent( } } } + +@Deprecated( + "Renamed to GroupPutUserEvent. NIP-29 group events carry the Group prefix to keep them apart from NIP-43 relay membership events.", + ReplaceWith("GroupPutUserEvent", "com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupPutUserEvent"), +) +typealias PutUserEvent = GroupPutUserEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/RemoveUserEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupRemoveUserEvent.kt similarity index 84% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/RemoveUserEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupRemoveUserEvent.kt index 09d7ea35fb..9a690605ee 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/RemoveUserEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupRemoveUserEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class RemoveUserEvent( +class GroupRemoveUserEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -50,7 +50,7 @@ class RemoveUserEvent( pubKeys: List, previousEvents: List = emptyList(), createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { groupId(groupId) pubKeys.forEach { userPubKey(it) } @@ -59,3 +59,9 @@ class RemoveUserEvent( } } } + +@Deprecated( + "Renamed to GroupRemoveUserEvent. NIP-29 group events carry the Group prefix to keep them apart from NIP-43 relay membership events.", + ReplaceWith("GroupRemoveUserEvent", "com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupRemoveUserEvent"), +) +typealias RemoveUserEvent = GroupRemoveUserEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/UpdatePinListEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupUpdatePinListEvent.kt similarity index 85% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/UpdatePinListEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupUpdatePinListEvent.kt index 9a53d7e7cc..fe224d5d21 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/UpdatePinListEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/moderation/GroupUpdatePinListEvent.kt @@ -35,7 +35,7 @@ import com.vitorpamplona.quartz.utils.TimeUtils * kind-39005 [com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupPinnedEvent]. */ @Immutable -class UpdatePinListEvent( +class GroupUpdatePinListEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -54,7 +54,7 @@ class UpdatePinListEvent( groupId: String, pinnedEventIds: List, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { groupId(groupId) pinnedEventIds.forEach { add(arrayOf("e", it)) } @@ -62,3 +62,9 @@ class UpdatePinListEvent( } } } + +@Deprecated( + "Renamed to GroupUpdatePinListEvent. NIP-29 group events carry the Group prefix to keep them apart from NIP-43 relay membership events.", + ReplaceWith("GroupUpdatePinListEvent", "com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupUpdatePinListEvent"), +) +typealias UpdatePinListEvent = GroupUpdatePinListEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/request/JoinRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/request/GroupJoinRequestEvent.kt similarity index 84% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/request/JoinRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/request/GroupJoinRequestEvent.kt index 2db9b25108..86953702f6 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/request/JoinRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/request/GroupJoinRequestEvent.kt @@ -30,7 +30,7 @@ import com.vitorpamplona.quartz.nip29RelayGroups.moderation.inviteCode import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class JoinRequestEvent( +class GroupJoinRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -50,7 +50,7 @@ class JoinRequestEvent( reason: String = "", inviteCode: String? = null, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, reason, createdAt) { groupId(groupId) inviteCode?.let { inviteCode(it) } @@ -58,3 +58,9 @@ class JoinRequestEvent( } } } + +@Deprecated( + "Renamed to GroupJoinRequestEvent. NIP-29 group events carry the Group prefix to keep them apart from NIP-43 relay membership events.", + ReplaceWith("GroupJoinRequestEvent", "com.vitorpamplona.quartz.nip29RelayGroups.request.GroupJoinRequestEvent"), +) +typealias JoinRequestEvent = GroupJoinRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/request/LeaveRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/request/GroupLeaveRequestEvent.kt similarity index 82% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/request/LeaveRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/request/GroupLeaveRequestEvent.kt index 429750cc61..574c5cc38d 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/request/LeaveRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/request/GroupLeaveRequestEvent.kt @@ -29,7 +29,7 @@ import com.vitorpamplona.quartz.nip29RelayGroups.moderation.groupId import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class LeaveRequestEvent( +class GroupLeaveRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -46,10 +46,16 @@ class LeaveRequestEvent( groupId: String, reason: String = "", createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, reason, createdAt) { groupId(groupId) initializer() } } } + +@Deprecated( + "Renamed to GroupLeaveRequestEvent. NIP-29 group events carry the Group prefix to keep them apart from NIP-43 relay membership events.", + ReplaceWith("GroupLeaveRequestEvent", "com.vitorpamplona.quartz.nip29RelayGroups.request.GroupLeaveRequestEvent"), +) +typealias LeaveRequestEvent = GroupLeaveRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip30CustomEmoji/selection/EmojiPackSelectionEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip30CustomEmoji/selection/EmojiListEvent.kt similarity index 85% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip30CustomEmoji/selection/EmojiPackSelectionEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip30CustomEmoji/selection/EmojiListEvent.kt index 774f834730..1d2a17c5b6 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip30CustomEmoji/selection/EmojiPackSelectionEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip30CustomEmoji/selection/EmojiListEvent.kt @@ -35,7 +35,7 @@ import com.vitorpamplona.quartz.nip30CustomEmoji.pack.EmojiPackEvent import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class EmojiPackSelectionEvent( +class EmojiListEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -61,20 +61,20 @@ class EmojiPackSelectionEvent( fun createAddressTag(pubKey: HexKey) = Address.assemble(KIND, pubKey, FIXED_D_TAG) fun add( - currentSelection: EmojiPackSelectionEvent, + currentSelection: EmojiListEvent, packToAdd: EventHintBundle, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventUpdate(currentSelection, createdAt) { pack(packToAdd.toATag()) initializer() } fun remove( - currentSelection: EmojiPackSelectionEvent, + currentSelection: EmojiListEvent, packToRemove: EmojiPackEvent, createdAt: Long = TimeUtils.now(), - updater: TagArrayBuilder.() -> Unit = {}, + updater: TagArrayBuilder.() -> Unit = {}, ) = eventUpdate(currentSelection, createdAt) { removePack(packToRemove.address()) updater() @@ -83,10 +83,16 @@ class EmojiPackSelectionEvent( fun build( listOfEmojiPacks: List>, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { packs(listOfEmojiPacks.map { it.toATag() }) initializer() } } } + +@Deprecated( + "Renamed to EmojiListEvent. NIP-51 names kind 10030 the user emoji list.", + ReplaceWith("EmojiListEvent", "com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiListEvent"), +) +typealias EmojiPackSelectionEvent = EmojiListEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip30CustomEmoji/selection/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip30CustomEmoji/selection/TagArrayBuilderExt.kt index c97a08a7fb..455d33dfef 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip30CustomEmoji/selection/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip30CustomEmoji/selection/TagArrayBuilderExt.kt @@ -27,8 +27,8 @@ import com.vitorpamplona.quartz.nip01Core.tags.aTag.aTag import com.vitorpamplona.quartz.nip01Core.tags.aTag.aTags import com.vitorpamplona.quartz.nip01Core.tags.aTag.removeAddress -fun TagArrayBuilder.pack(tag: ATag) = aTag(tag) +fun TagArrayBuilder.pack(tag: ATag) = aTag(tag) -fun TagArrayBuilder.packs(tags: List) = aTags(tags) +fun TagArrayBuilder.packs(tags: List) = aTags(tags) -fun TagArrayBuilder.removePack(address: Address) = removeAddress(address) +fun TagArrayBuilder.removePack(address: Address) = removeAddress(address) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip38UserStatus/StatusEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip38UserStatus/UserStatusEvent.kt similarity index 90% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip38UserStatus/StatusEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip38UserStatus/UserStatusEvent.kt index 1ddc25cbc9..db4faeae99 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip38UserStatus/StatusEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip38UserStatus/UserStatusEvent.kt @@ -34,7 +34,7 @@ import com.vitorpamplona.quartz.nip50Search.SearchableEvent import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class StatusEvent( +class UserStatusEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -70,7 +70,7 @@ class StatusEvent( emojiTags: List? = null, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): StatusEvent { + ): UserStatusEvent { val tags = mutableListOf>() tags.add(arrayOf("d", type)) @@ -85,23 +85,29 @@ class StatusEvent( } suspend fun update( - event: StatusEvent, + event: UserStatusEvent, newStatus: String, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): StatusEvent { + ): UserStatusEvent { val tags = event.tags return signer.sign(createdAt, KIND, tags, newStatus) } suspend fun clear( - event: StatusEvent, + event: UserStatusEvent, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): StatusEvent { + ): UserStatusEvent { val msg = "" val tags = event.tags.filter { it.size > 1 && it[0] == "d" } return signer.sign(createdAt, KIND, tags.toTypedArray(), msg) } } } + +@Deprecated( + "Renamed to UserStatusEvent. NIP-38 names kind 30315 the user status.", + ReplaceWith("UserStatusEvent", "com.vitorpamplona.quartz.nip38UserStatus.UserStatusEvent"), +) +typealias StatusEvent = UserStatusEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip46RemoteSigner/signer/NostrSignerRemote.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip46RemoteSigner/signer/NostrSignerRemote.kt index 5ca77a0410..f58bd0ad69 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip46RemoteSigner/signer/NostrSignerRemote.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip46RemoteSigner/signer/NostrSignerRemote.kt @@ -41,7 +41,7 @@ import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerRequestPing import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerRequestSign import com.vitorpamplona.quartz.nip46RemoteSigner.NostrConnectEvent import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.utils.Hex import com.vitorpamplona.quartz.utils.Log import kotlinx.coroutines.CoroutineScope @@ -325,7 +325,7 @@ class NostrSignerRemote( throw convertExceptions("Could not get public key", result) } - override suspend fun decryptZapEvent(event: LnZapRequestEvent): LnZapPrivateEvent { + override suspend fun decryptZapEvent(event: ZapRequestEvent): LnZapPrivateEvent { TODO("Not yet implemented") } diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/Nip47Client.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/Nip47Client.kt index 4ee11947c6..acee4cec7c 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/Nip47Client.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/Nip47Client.kt @@ -27,10 +27,10 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcInfoEvent import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcNotificationEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip47WalletConnect.rpc.CancelHoldInvoiceMethod import com.vitorpamplona.quartz.nip47WalletConnect.rpc.GetBalanceMethod import com.vitorpamplona.quartz.nip47WalletConnect.rpc.GetBudgetMethod @@ -115,7 +115,7 @@ class Nip47Client( suspend fun payInvoice( bolt11: String, amount: Long? = null, - ): LnZapPaymentRequestEvent = + ): NwcRequestEvent = buildRequest( if (amount != null) { PayInvoiceMethod.create(bolt11, amount) @@ -132,17 +132,17 @@ class Nip47Client( pubkey: String, preimage: String? = null, tlvRecords: List? = null, - ): LnZapPaymentRequestEvent = buildRequest(PayKeysendMethod.create(amount, pubkey, preimage, tlvRecords)) + ): NwcRequestEvent = buildRequest(PayKeysendMethod.create(amount, pubkey, preimage, tlvRecords)) /** * Builds a get_balance request event. */ - suspend fun getBalance(): LnZapPaymentRequestEvent = buildRequest(GetBalanceMethod.create()) + suspend fun getBalance(): NwcRequestEvent = buildRequest(GetBalanceMethod.create()) /** * Builds a get_info request event. */ - suspend fun getInfo(): LnZapPaymentRequestEvent = buildRequest(GetInfoMethod.create()) + suspend fun getInfo(): NwcRequestEvent = buildRequest(GetInfoMethod.create()) /** * Builds a make_invoice request event. @@ -152,17 +152,17 @@ class Nip47Client( description: String? = null, descriptionHash: String? = null, expiry: Long? = null, - ): LnZapPaymentRequestEvent = buildRequest(MakeInvoiceMethod.create(amount, description, descriptionHash, expiry)) + ): NwcRequestEvent = buildRequest(MakeInvoiceMethod.create(amount, description, descriptionHash, expiry)) /** * Builds a lookup_invoice request event by payment hash. */ - suspend fun lookupInvoiceByHash(paymentHash: String): LnZapPaymentRequestEvent = buildRequest(LookupInvoiceMethod.createByHash(paymentHash)) + suspend fun lookupInvoiceByHash(paymentHash: String): NwcRequestEvent = buildRequest(LookupInvoiceMethod.createByHash(paymentHash)) /** * Builds a lookup_invoice request event by BOLT11 invoice. */ - suspend fun lookupInvoiceByInvoice(invoice: String): LnZapPaymentRequestEvent = buildRequest(LookupInvoiceMethod.createByInvoice(invoice)) + suspend fun lookupInvoiceByInvoice(invoice: String): NwcRequestEvent = buildRequest(LookupInvoiceMethod.createByInvoice(invoice)) /** * Builds a list_transactions request event. @@ -174,17 +174,17 @@ class Nip47Client( offset: Int? = null, unpaid: Boolean? = null, type: String? = null, - ): LnZapPaymentRequestEvent = buildRequest(ListTransactionsMethod.create(from, until, limit, offset, unpaid, type)) + ): NwcRequestEvent = buildRequest(ListTransactionsMethod.create(from, until, limit, offset, unpaid, type)) /** * Builds a get_budget request event. */ - suspend fun getBudget(): LnZapPaymentRequestEvent = buildRequest(GetBudgetMethod.create()) + suspend fun getBudget(): NwcRequestEvent = buildRequest(GetBudgetMethod.create()) /** * Builds a sign_message request event. */ - suspend fun signMessage(message: String): LnZapPaymentRequestEvent = buildRequest(SignMessageMethod.create(message)) + suspend fun signMessage(message: String): NwcRequestEvent = buildRequest(SignMessageMethod.create(message)) /** * Builds a make_hold_invoice request event. @@ -196,24 +196,24 @@ class Nip47Client( descriptionHash: String? = null, expiry: Long? = null, minCltvExpiryDelta: Int? = null, - ): LnZapPaymentRequestEvent = buildRequest(MakeHoldInvoiceMethod.create(amount, paymentHash, description, descriptionHash, expiry, minCltvExpiryDelta)) + ): NwcRequestEvent = buildRequest(MakeHoldInvoiceMethod.create(amount, paymentHash, description, descriptionHash, expiry, minCltvExpiryDelta)) /** * Builds a cancel_hold_invoice request event. */ - suspend fun cancelHoldInvoice(paymentHash: String): LnZapPaymentRequestEvent = buildRequest(CancelHoldInvoiceMethod.create(paymentHash)) + suspend fun cancelHoldInvoice(paymentHash: String): NwcRequestEvent = buildRequest(CancelHoldInvoiceMethod.create(paymentHash)) /** * Builds a settle_hold_invoice request event. */ - suspend fun settleHoldInvoice(preimage: String): LnZapPaymentRequestEvent = buildRequest(SettleHoldInvoiceMethod.create(preimage)) + suspend fun settleHoldInvoice(preimage: String): NwcRequestEvent = buildRequest(SettleHoldInvoiceMethod.create(preimage)) /** * Builds a request event from any [Request] object. * This is the low-level method used by all convenience methods above. */ - suspend fun buildRequest(request: Request): LnZapPaymentRequestEvent = - LnZapPaymentRequestEvent.createRequest( + suspend fun buildRequest(request: Request): NwcRequestEvent = + NwcRequestEvent.createRequest( request = request, walletServicePubkey = walletPubKeyHex, signer = signer, @@ -225,7 +225,7 @@ class Nip47Client( /** * Decrypts and parses a response event from the wallet. */ - suspend fun parseResponse(event: LnZapPaymentResponseEvent): Response = event.decrypt(signer) + suspend fun parseResponse(event: NwcResponseEvent): Response = event.decrypt(signer) /** * Decrypts and parses a notification event from the wallet. @@ -240,7 +240,7 @@ class Nip47Client( */ fun responseFilter(requestEventId: HexKey): Filter = Filter( - kinds = listOf(LnZapPaymentResponseEvent.KIND), + kinds = listOf(NwcResponseEvent.KIND), authors = listOf(walletPubKeyHex), tags = mapOf("e" to listOf(requestEventId)), ) @@ -251,7 +251,7 @@ class Nip47Client( */ fun allResponsesFilter(since: Long? = null): Filter = Filter( - kinds = listOf(LnZapPaymentResponseEvent.KIND), + kinds = listOf(NwcResponseEvent.KIND), authors = listOf(walletPubKeyHex), tags = mapOf("p" to listOf(signer.pubKey)), since = since, diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/Nip47Server.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/Nip47Server.kt index 739351ca16..da7baebe4c 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/Nip47Server.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/Nip47Server.kt @@ -23,10 +23,10 @@ package com.vitorpamplona.quartz.nip47WalletConnect import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcInfoEvent import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcNotificationEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip47WalletConnect.rpc.GetBalanceSuccessResponse import com.vitorpamplona.quartz.nip47WalletConnect.rpc.GetBudgetSuccessResponse import com.vitorpamplona.quartz.nip47WalletConnect.rpc.GetInfoSuccessResponse @@ -105,7 +105,7 @@ class Nip47Server( /** * Decrypts and parses an incoming client request. */ - suspend fun parseRequest(event: LnZapPaymentRequestEvent): Request = event.decryptRequest(signer) + suspend fun parseRequest(event: NwcRequestEvent): Request = event.decryptRequest(signer) // --- Response builders --- @@ -114,9 +114,9 @@ class Nip47Server( */ suspend fun buildResponse( response: Response, - requestEvent: LnZapPaymentRequestEvent, - ): LnZapPaymentResponseEvent = - LnZapPaymentResponseEvent.createResponse( + requestEvent: NwcRequestEvent, + ): NwcResponseEvent = + NwcResponseEvent.createResponse( response = response, requestEvent = requestEvent, signer = signer, @@ -127,11 +127,11 @@ class Nip47Server( * Builds an error response for any method. */ suspend fun respondError( - requestEvent: LnZapPaymentRequestEvent, + requestEvent: NwcRequestEvent, code: NwcErrorCode, message: String, resultType: String? = null, - ): LnZapPaymentResponseEvent { + ): NwcResponseEvent { val method = resultType ?: requestEvent.decryptRequest(signer).method ?: NwcMethod.PAY_INVOICE return buildResponse(NwcErrorResponse(method, NwcError(code, message)), requestEvent) } @@ -140,10 +140,10 @@ class Nip47Server( * Builds a pay_invoice success response. */ suspend fun respondPayInvoice( - requestEvent: LnZapPaymentRequestEvent, + requestEvent: NwcRequestEvent, preimage: String? = null, feesPaid: Long? = null, - ): LnZapPaymentResponseEvent = + ): NwcResponseEvent = buildResponse( PayInvoiceSuccessResponse(PayInvoiceSuccessResponse.PayInvoiceResultParams(preimage, feesPaid)), requestEvent, @@ -153,10 +153,10 @@ class Nip47Server( * Builds a pay_keysend success response. */ suspend fun respondPayKeysend( - requestEvent: LnZapPaymentRequestEvent, + requestEvent: NwcRequestEvent, preimage: String? = null, feesPaid: Long? = null, - ): LnZapPaymentResponseEvent = + ): NwcResponseEvent = buildResponse( PayKeysendSuccessResponse(PayKeysendSuccessResponse.PayKeysendResult(preimage, feesPaid)), requestEvent, @@ -166,9 +166,9 @@ class Nip47Server( * Builds a get_balance success response. */ suspend fun respondGetBalance( - requestEvent: LnZapPaymentRequestEvent, + requestEvent: NwcRequestEvent, balance: Long, - ): LnZapPaymentResponseEvent = + ): NwcResponseEvent = buildResponse( GetBalanceSuccessResponse(GetBalanceSuccessResponse.GetBalanceResult(balance)), requestEvent, @@ -178,7 +178,7 @@ class Nip47Server( * Builds a get_info success response. */ suspend fun respondGetInfo( - requestEvent: LnZapPaymentRequestEvent, + requestEvent: NwcRequestEvent, alias: String? = null, color: String? = null, pubkey: String? = null, @@ -188,7 +188,7 @@ class Nip47Server( methods: List? = null, notifications: List? = null, lud16: String? = null, - ): LnZapPaymentResponseEvent = + ): NwcResponseEvent = buildResponse( GetInfoSuccessResponse( GetInfoSuccessResponse.GetInfoResult( @@ -211,26 +211,26 @@ class Nip47Server( * Builds a make_invoice success response. */ suspend fun respondMakeInvoice( - requestEvent: LnZapPaymentRequestEvent, + requestEvent: NwcRequestEvent, transaction: NwcTransaction, - ): LnZapPaymentResponseEvent = buildResponse(MakeInvoiceSuccessResponse(transaction), requestEvent) + ): NwcResponseEvent = buildResponse(MakeInvoiceSuccessResponse(transaction), requestEvent) /** * Builds a lookup_invoice success response. */ suspend fun respondLookupInvoice( - requestEvent: LnZapPaymentRequestEvent, + requestEvent: NwcRequestEvent, transaction: NwcTransaction, - ): LnZapPaymentResponseEvent = buildResponse(LookupInvoiceSuccessResponse(transaction), requestEvent) + ): NwcResponseEvent = buildResponse(LookupInvoiceSuccessResponse(transaction), requestEvent) /** * Builds a list_transactions success response. */ suspend fun respondListTransactions( - requestEvent: LnZapPaymentRequestEvent, + requestEvent: NwcRequestEvent, transactions: List, totalCount: Long? = null, - ): LnZapPaymentResponseEvent = + ): NwcResponseEvent = buildResponse( ListTransactionsSuccessResponse( ListTransactionsSuccessResponse.ListTransactionsResult(transactions, totalCount), @@ -242,12 +242,12 @@ class Nip47Server( * Builds a get_budget success response. */ suspend fun respondGetBudget( - requestEvent: LnZapPaymentRequestEvent, + requestEvent: NwcRequestEvent, usedBudget: Long? = null, totalBudget: Long? = null, renewsAt: Long? = null, renewalPeriod: String? = null, - ): LnZapPaymentResponseEvent = + ): NwcResponseEvent = buildResponse( GetBudgetSuccessResponse( GetBudgetSuccessResponse.GetBudgetResult(usedBudget, totalBudget, renewsAt, renewalPeriod), @@ -259,10 +259,10 @@ class Nip47Server( * Builds a sign_message success response. */ suspend fun respondSignMessage( - requestEvent: LnZapPaymentRequestEvent, + requestEvent: NwcRequestEvent, message: String, signature: String, - ): LnZapPaymentResponseEvent = + ): NwcResponseEvent = buildResponse( SignMessageSuccessResponse(SignMessageSuccessResponse.SignMessageResult(message, signature)), requestEvent, @@ -317,7 +317,7 @@ class Nip47Server( */ fun requestsFilter(since: Long? = null): Filter = Filter( - kinds = listOf(LnZapPaymentRequestEvent.KIND), + kinds = listOf(NwcRequestEvent.KIND), tags = mapOf("p" to listOf(signer.pubKey)), since = since, ) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/README.md b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/README.md index 0d372e1a49..7ee4df5c25 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/README.md +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/README.md @@ -92,8 +92,8 @@ nip47WalletConnect/ ├── NwcErrorCode.kt # Error codes enum + NwcError ├── NwcTransaction.kt # Transaction, state, budget, TLV models ├── NwcInfoEvent.kt # Kind 13194 — wallet capabilities -├── LnZapPaymentRequestEvent.kt # Kind 23194 — client → wallet request -├── LnZapPaymentResponseEvent.kt # Kind 23195 — wallet → client response +├── NwcRequestEvent.kt # Kind 23194 — client → wallet request +├── NwcResponseEvent.kt # Kind 23195 — wallet → client response ├── NwcNotificationEvent.kt # Kind 23197 — wallet → client notification ├── NostrWalletConnectRequestCache.kt # Request decryption cache ├── NostrWalletConnectResponseCache.kt # Response decryption cache @@ -107,8 +107,8 @@ nip47WalletConnect/ | Kind | Class | Direction | Purpose | |-------|------------------------------|-----------------|----------------------| | 13194 | `NwcInfoEvent` | Wallet → Relay | Service capabilities | -| 23194 | `LnZapPaymentRequestEvent` | Client → Wallet | NWC request | -| 23195 | `LnZapPaymentResponseEvent` | Wallet → Client | NWC response | +| 23194 | `NwcRequestEvent` | Client → Wallet | NWC request | +| 23195 | `NwcResponseEvent` | Wallet → Client | NWC response | | 23196 | `NwcNotificationEvent` | Wallet → Client | Notification (NIP-04, legacy) | | 23197 | `NwcNotificationEvent` | Wallet → Client | Notification (NIP-44) | @@ -161,7 +161,7 @@ val clientSigner = NostrSignerInternal( ```kotlin val balanceRequest = GetBalanceMethod.create() -val event = LnZapPaymentRequestEvent.createRequest( +val event = NwcRequestEvent.createRequest( request = balanceRequest, walletServicePubkey = nwcConfig.pubKeyHex, signer = clientSigner, @@ -172,7 +172,7 @@ val event = LnZapPaymentRequestEvent.createRequest( To use NIP-44 encryption instead of NIP-04: ```kotlin -val event = LnZapPaymentRequestEvent.createRequest( +val event = NwcRequestEvent.createRequest( request = GetInfoMethod.create(), walletServicePubkey = nwcConfig.pubKeyHex, signer = clientSigner, @@ -238,7 +238,7 @@ val request: Request = requestEvent.decryptRequest(walletSigner) val balanceResponse = GetBalanceSuccessResponse( GetBalanceSuccessResponse.GetBalanceResult(balance = 2100000L) ) -val responseEvent = LnZapPaymentResponseEvent.createResponse( +val responseEvent = NwcResponseEvent.createResponse( response = balanceResponse, requestEvent = requestEvent, signer = walletSigner, @@ -249,7 +249,7 @@ val errorResponse = NwcErrorResponse( resultType = NwcMethod.PAY_INVOICE, error = NwcError(NwcErrorCode.INSUFFICIENT_BALANCE, "Not enough funds"), ) -val errorEvent = LnZapPaymentResponseEvent.createResponse( +val errorEvent = NwcResponseEvent.createResponse( response = errorResponse, requestEvent = requestEvent, signer = walletSigner, diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/cache/NostrWalletConnectRequestCache.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/cache/NostrWalletConnectRequestCache.kt index 59a160871f..b76e0320ac 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/cache/NostrWalletConnectRequestCache.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/cache/NostrWalletConnectRequestCache.kt @@ -23,15 +23,15 @@ package com.vitorpamplona.quartz.nip47WalletConnect.cache import androidx.collection.LruCache import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.caches.DecryptCache -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent import com.vitorpamplona.quartz.nip47WalletConnect.rpc.Request class NostrWalletConnectRequestCache( signer: NostrSigner, ) { private val decryptionCache = - object : LruCache(50) { - override fun create(key: LnZapPaymentRequestEvent): NWCRequestDecryptCache? = + object : LruCache(50) { + override fun create(key: NwcRequestEvent): NWCRequestDecryptCache? = if (key.content.isNotBlank() && key.canDecrypt(signer)) { NWCRequestDecryptCache(signer) } else { @@ -39,16 +39,16 @@ class NostrWalletConnectRequestCache( } } - fun cachedRequest(event: LnZapPaymentRequestEvent): Request? = decryptionCache[event]?.cached() + fun cachedRequest(event: NwcRequestEvent): Request? = decryptionCache[event]?.cached() - suspend fun decryptRequest(event: LnZapPaymentRequestEvent) = decryptionCache[event]?.decrypt(event) + suspend fun decryptRequest(event: NwcRequestEvent) = decryptionCache[event]?.decrypt(event) } class NWCRequestDecryptCache( signer: NostrSigner, -) : DecryptCache(signer) { +) : DecryptCache(signer) { override suspend fun decryptAndParse( - event: LnZapPaymentRequestEvent, + event: NwcRequestEvent, signer: NostrSigner, ) = event.decryptRequest(signer) } diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/cache/NostrWalletConnectResponseCache.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/cache/NostrWalletConnectResponseCache.kt index c291c2c988..818b1041dc 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/cache/NostrWalletConnectResponseCache.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/cache/NostrWalletConnectResponseCache.kt @@ -23,15 +23,15 @@ package com.vitorpamplona.quartz.nip47WalletConnect.cache import androidx.collection.LruCache import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.caches.DecryptCache -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip47WalletConnect.rpc.Response class NostrWalletConnectResponseCache( signer: NostrSigner, ) { private val decryptionCache = - object : LruCache(50) { - override fun create(key: LnZapPaymentResponseEvent): NWCResponseDecryptCache? = + object : LruCache(50) { + override fun create(key: NwcResponseEvent): NWCResponseDecryptCache? = if (key.content.isNotBlank() && key.canDecrypt(signer)) { NWCResponseDecryptCache(signer) } else { @@ -39,16 +39,16 @@ class NostrWalletConnectResponseCache( } } - fun cachedResponse(event: LnZapPaymentResponseEvent): Response? = decryptionCache[event]?.cached() + fun cachedResponse(event: NwcResponseEvent): Response? = decryptionCache[event]?.cached() - suspend fun decryptResponse(event: LnZapPaymentResponseEvent) = decryptionCache[event]?.decrypt(event) + suspend fun decryptResponse(event: NwcResponseEvent) = decryptionCache[event]?.decrypt(event) } class NWCResponseDecryptCache( signer: NostrSigner, -) : DecryptCache(signer) { +) : DecryptCache(signer) { override suspend fun decryptAndParse( - event: LnZapPaymentResponseEvent, + event: NwcResponseEvent, signer: NostrSigner, ) = event.decrypt(signer) } diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/events/LnZapPaymentRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/events/NwcRequestEvent.kt similarity index 91% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/events/LnZapPaymentRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/events/NwcRequestEvent.kt index 010ebbef74..fc549558fc 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/events/LnZapPaymentRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/events/NwcRequestEvent.kt @@ -31,7 +31,7 @@ import com.vitorpamplona.quartz.nip47WalletConnect.rpc.Request import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class LnZapPaymentRequestEvent( +class NwcRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -64,7 +64,7 @@ class LnZapPaymentRequestEvent( signer: NostrSigner, createdAt: Long = TimeUtils.now(), useNip44: Boolean = false, - ): LnZapPaymentRequestEvent = + ): NwcRequestEvent = createRequest( PayInvoiceMethod.create(lnInvoice), walletServicePubkey, @@ -79,7 +79,7 @@ class LnZapPaymentRequestEvent( signer: NostrSigner, createdAt: Long = TimeUtils.now(), useNip44: Boolean = false, - ): LnZapPaymentRequestEvent { + ): NwcRequestEvent { val serializedRequest = OptimizedJsonMapper.toJson(request) val tags = @@ -100,3 +100,9 @@ class LnZapPaymentRequestEvent( } } } + +@Deprecated( + "Renamed to NwcRequestEvent. Kind 23194 is the generic NIP-47 wallet request, not only a zap payment.", + ReplaceWith("NwcRequestEvent", "com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent"), +) +typealias LnZapPaymentRequestEvent = NwcRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/events/LnZapPaymentResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/events/NwcResponseEvent.kt similarity index 90% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/events/LnZapPaymentResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/events/NwcResponseEvent.kt index 88b6519e95..7c8769191a 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/events/LnZapPaymentResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/events/NwcResponseEvent.kt @@ -30,7 +30,7 @@ import com.vitorpamplona.quartz.nip47WalletConnect.rpc.Response import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class LnZapPaymentResponseEvent( +class NwcResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -69,11 +69,11 @@ class LnZapPaymentResponseEvent( */ suspend fun createResponse( response: Response, - requestEvent: LnZapPaymentRequestEvent, + requestEvent: NwcRequestEvent, signer: NostrSigner, useNip44: Boolean = false, createdAt: Long = TimeUtils.now(), - ): LnZapPaymentResponseEvent { + ): NwcResponseEvent { val serializedResponse = OptimizedJsonMapper.toJson(response) val clientPubkey = requestEvent.pubKey @@ -95,3 +95,9 @@ class LnZapPaymentResponseEvent( } } } + +@Deprecated( + "Renamed to NwcResponseEvent. Kind 23195 is the generic NIP-47 wallet response, not only a zap payment.", + ReplaceWith("NwcResponseEvent", "com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent"), +) +typealias LnZapPaymentResponseEvent = NwcResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/rpc/NwcTransactionMetadata.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/rpc/NwcTransactionMetadata.kt index d5fca147f8..4a8d5dbf98 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/rpc/NwcTransactionMetadata.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/rpc/NwcTransactionMetadata.kt @@ -179,7 +179,7 @@ class NwcTransactionMetadata( * * NIP-57 sets a zap invoice's `description_hash` to the sha256 of the raw * JSON the LNURL callback received in `nostr=`, and that is - * `LnZapRequestEvent.toJson()` — the exact string used here. A wallet can + * `ZapRequestEvent.toJson()` — the exact string used here. A wallet can * therefore bind this stored event to the invoice it labels, which is what * turns "the client says it paid X" into something the wallet checked. * diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip50Search/SearchFieldExtractor.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip50Search/SearchFieldExtractor.kt index 97fcb8b7cb..e6176a77fb 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip50Search/SearchFieldExtractor.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip50Search/SearchFieldExtractor.kt @@ -56,11 +56,11 @@ import com.vitorpamplona.quartz.nip15Marketplace.marketplace.MarketplaceEvent import com.vitorpamplona.quartz.nip15Marketplace.product.ProductEvent import com.vitorpamplona.quartz.nip15Marketplace.stall.StallEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMetadataEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMetadataEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.EditMetadataEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupEditMetadataEvent import com.vitorpamplona.quartz.nip30CustomEmoji.pack.EmojiPackEvent import com.vitorpamplona.quartz.nip32Labeling.LabelEvent import com.vitorpamplona.quartz.nip34Git.issue.GitIssueEvent @@ -71,24 +71,24 @@ import com.vitorpamplona.quartz.nip51Lists.appCurationSet.AppCurationSetEvent import com.vitorpamplona.quartz.nip51Lists.articleCurationSet.ArticleCurationSetEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.OldBookmarkListEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip51Lists.interestSet.InterestSetEvent -import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.LabeledBookmarkListEvent +import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.BookmarkSetEvent import com.vitorpamplona.quartz.nip51Lists.mediaStarterPack.MediaStarterPackEvent -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import com.vitorpamplona.quartz.nip51Lists.pictureCurationSet.PictureCurationSetEvent import com.vitorpamplona.quartz.nip51Lists.relaySets.RelaySetEvent import com.vitorpamplona.quartz.nip51Lists.releaseArtifactSet.ReleaseArtifactSetEvent import com.vitorpamplona.quartz.nip51Lists.videoCurationSet.VideoCurationSetEvent import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.clip.LiveActivitiesClipEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingRoomEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingSpaceEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip58Badges.definition.BadgeDefinitionEvent import com.vitorpamplona.quartz.nip5aStaticWebsites.NamedSiteEvent import com.vitorpamplona.quartz.nip5aStaticWebsites.RootSiteEvent @@ -100,13 +100,13 @@ import com.vitorpamplona.quartz.nip69P2pOrderEvents.P2POrderEvent import com.vitorpamplona.quartz.nip71Video.AddressableVideoEvent import com.vitorpamplona.quartz.nip71Video.RegularVideoEvent import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent -import com.vitorpamplona.quartz.nip75ZapGoals.GoalEvent +import com.vitorpamplona.quartz.nip75ZapGoals.ZapGoalEvent import com.vitorpamplona.quartz.nip7DThreads.ThreadEvent import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip89AppHandlers.definition.AppDefinitionEvent -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent import com.vitorpamplona.quartz.nipB0WebBookmarks.WebBookmarkEvent import com.vitorpamplona.quartz.nipC0CodeSnippets.CodeSnippetEvent @@ -158,11 +158,11 @@ object SearchFieldExtractor { } } - is LongTextNoteEvent -> { + is LongFormContentEvent -> { tiers(event, event.title(), event.summary(), event.content) } - is WikiNoteEvent -> { + is WikiArticleEvent -> { tiers(event, event.title(), event.summary(), event.content) } @@ -263,7 +263,7 @@ object SearchFieldExtractor { tiers(event, event.title(), null, event.content) } - is CalendarEvent -> { + is CalendarCollectionEvent -> { tiers(event, event.title(), null, event.content) } @@ -352,7 +352,7 @@ object SearchFieldExtractor { // kind 9002 edits the very metadata kind 39000 publishes, so it // splits the same way -- it was the only half of the pair falling // through. Its hashtags() is `t`, carried once by the funnel. - is EditMetadataEvent -> { + is GroupEditMetadataEvent -> { tiers(event, event.name(), event.about(), null) } @@ -360,7 +360,7 @@ object SearchFieldExtractor { tiers(event, event.title(), event.description(), null) } - is FollowListEvent -> { + is StarterPackEvent -> { tiers(event, event.title(), event.description(), null) } @@ -448,7 +448,7 @@ object SearchFieldExtractor { // concatenates the topics INTO the body while the funnel added // them as hashtags. Whether that role is tokenized or kept as // keywords is the backend's call, per IndexableFields. - is ContactCardEvent -> { + is UserAssertionEvent -> { tiers(event, event.petName(), event.summary(), null) } @@ -456,11 +456,11 @@ object SearchFieldExtractor { tiers(event, event.title(), null, null) } - is LabeledBookmarkListEvent -> { + is BookmarkSetEvent -> { tiers(event, event.titleOrName(), event.description(), null) } - is PeopleListEvent -> { + is FollowSetEvent -> { tiers(event, event.titleOrName(), event.description(), null) } @@ -472,7 +472,7 @@ object SearchFieldExtractor { tiers(event, event.title(), null, null) } - is GoalEvent -> { + is ZapGoalEvent -> { tiers(event, null, event.summary(), event.content) } @@ -480,7 +480,7 @@ object SearchFieldExtractor { tiers(event, emptyList(), listOf(event.comment(), event.context()), event.content) } - is FileHeaderEvent -> { + is FileMetadataEvent -> { tiers(event, null, event.summary(), event.content) } diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip50Search/SearchableKinds.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip50Search/SearchableKinds.kt index 7c7eb0e954..357eb0c7e2 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip50Search/SearchableKinds.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip50Search/SearchableKinds.kt @@ -71,7 +71,7 @@ object SearchableKinds { 54, // PodcastEpisodeEvent 818, // WikiMergeRequestEvent 1010, // TextNoteModificationEvent - 1063, // FileHeaderEvent + 1063, // FileMetadataEvent 1065, // FileStorageHeaderEvent 1068, // PollEvent 1111, // CommentEvent @@ -96,20 +96,20 @@ object SearchableKinds { 2004, // TorrentCommentEvent 2473, // BirdDetectionEvent 3302, // ConcordChatEditEvent - 5050, // NIP90TextGenerationRequestEvent - 5100, // NIP90ImageGenerationRequestEvent + 5050, // DvmTextGenerationRequestEvent + 5100, // DvmImageGenerationRequestEvent 5129, // NappletSnapshotEvent - 5250, // NIP90TextToSpeechRequestEvent - 5302, // NIP90ContentSearchRequestEvent - 5303, // NIP90PeopleSearchRequestEvent + 5250, // DvmTextToSpeechRequestEvent + 5302, // DvmContentSearchRequestEvent + 5303, // DvmPeopleSearchRequestEvent 6969, // ZapPollEvent 7516, // GeocacheFoundLogEvent 8333, // OnchainZapEvent - 9002, // EditMetadataEvent - 9041, // GoalEvent + 9002, // GroupEditMetadataEvent + 9041, // ZapGoalEvent 9321, // NutzapEvent - 9734, // LnZapRequestEvent - 9735, // LnZapEvent + 9734, // ZapRequestEvent + 9735, // ZapReceiptEvent 9736, // Bolt12ZapEvent 9737, // Bolt12ZapIntentEvent 9802, // HighlightEvent @@ -122,10 +122,10 @@ object SearchableKinds { 12473, // BirdexEvent 15128, // RootSiteEvent 15129, // RootNappletEvent - 30000, // PeopleListEvent + 30000, // FollowSetEvent 30001, // OldBookmarkListEvent 30002, // RelaySetEvent - 30003, // LabeledBookmarkListEvent + 30003, // BookmarkSetEvent 30004, // ArticleCurationSetEvent 30005, // VideoCurationSetEvent 30006, // PictureCurationSetEvent @@ -135,7 +135,7 @@ object SearchableKinds { 30018, // ProductEvent 30019, // MarketplaceEvent 30020, // AuctionEvent - 30023, // LongTextNoteEvent + 30023, // LongFormContentEvent 30030, // EmojiPackEvent 30040, // PublicationIndexEvent 30041, // PublicationContentEvent @@ -153,8 +153,8 @@ object SearchableKinds { 30311, // LiveActivitiesEvent 30312, // MeetingSpaceEvent 30313, // MeetingRoomEvent - 30315, // StatusEvent - 30382, // ContactCardEvent + 30315, // UserStatusEvent + 30382, // UserAssertionEvent 30392, // UserTrustedListEvent 30393, // EventTrustedListEvent 30394, // AddressableTrustedListEvent @@ -163,14 +163,14 @@ object SearchableKinds { 30617, // GitRepositoryEvent 30620, // WorkflowDefEvent 30817, // NipTextEvent - 30818, // WikiNoteEvent + 30818, // WikiArticleEvent 31337, // AudioTrackEvent 31871, // AttestationEvent 31872, // AttestationRequestEvent 31873, // AttestorRecommendationEvent 31922, // CalendarDateSlotEvent 31923, // CalendarTimeSlotEvent - 31924, // CalendarEvent + 31924, // CalendarCollectionEvent 31925, // CalendarRSVPEvent 31987, // RelayReviewEvent 31990, // AppDefinitionEvent @@ -179,8 +179,8 @@ object SearchableKinds { 33401, // ExerciseTemplateEvent 33863, // FundraiserEvent 34139, // MusicPlaylistEvent - 34235, // VideoHorizontalEvent - 34236, // VideoVerticalEvent + 34235, // AddressableNormalVideoEvent + 34236, // AddressableShortVideoEvent 34259, // EntityRatingEvent 34550, // CommunityDefinitionEvent 35128, // NamedSiteEvent @@ -192,7 +192,7 @@ object SearchableKinds { 38192, // Ps1SaveEvent 38383, // P2POrderEvent 39000, // GroupMetadataEvent - 39089, // FollowListEvent + 39089, // StarterPackEvent 39092, // MediaStarterPackEvent 39307, // TextTrackEvent 39701, // WebBookmarkEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/followList/FollowListEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/followList/StarterPackEvent.kt similarity index 90% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/followList/FollowListEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/followList/StarterPackEvent.kt index edcc791377..c38841df66 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/followList/FollowListEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/followList/StarterPackEvent.kt @@ -42,7 +42,7 @@ import kotlin.uuid.ExperimentalUuidApi import kotlin.uuid.Uuid @Immutable -class FollowListEvent( +class StarterPackEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -99,7 +99,7 @@ class FollowListEvent( signer: NostrSigner, dTag: String = Uuid.random().toString(), createdAt: Long = TimeUtils.now(), - ): FollowListEvent = + ): StarterPackEvent = create( name = name, people = listOf(person), @@ -109,11 +109,11 @@ class FollowListEvent( ) suspend fun addUsers( - earlierVersion: FollowListEvent, + earlierVersion: StarterPackEvent, people: List, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): FollowListEvent = + ): StarterPackEvent = resign( content = earlierVersion.content, tags = earlierVersion.tags.plus(people.map { it.toTagArray() }), @@ -122,18 +122,18 @@ class FollowListEvent( ) suspend fun add( - earlierVersion: FollowListEvent, + earlierVersion: StarterPackEvent, person: UserTag, signer: NostrSigner, createdAt: Long = TimeUtils.now(), ) = addUsers(earlierVersion, listOf(person), signer, createdAt) suspend fun remove( - earlierVersion: FollowListEvent, + earlierVersion: StarterPackEvent, person: UserTag, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): FollowListEvent = + ): StarterPackEvent = resign( content = earlierVersion.content, tags = earlierVersion.tags.remove(person.toTagIdOnly()), @@ -146,7 +146,7 @@ class FollowListEvent( tags: Array>, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): FollowListEvent { + ): StarterPackEvent { val newTags = tags return signer.sign(createdAt, KIND, newTags, content) @@ -159,7 +159,7 @@ class FollowListEvent( signer: NostrSigner, dTag: String = Uuid.random().toString(), createdAt: Long = TimeUtils.now(), - ): FollowListEvent { + ): StarterPackEvent { val template = build(name, people, dTag, createdAt) return signer.sign(template) } @@ -170,7 +170,7 @@ class FollowListEvent( people: List = emptyList(), dTag: String = Uuid.random().toString(), createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate( kind = KIND, description = "", @@ -184,3 +184,9 @@ class FollowListEvent( } } } + +@Deprecated( + "Renamed to StarterPackEvent. Kind 39089 is a NIP-51 starter pack. The NIP-02 follow list is kind 3 (ContactListEvent).", + ReplaceWith("StarterPackEvent", "com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent"), +) +typealias FollowListEvent = StarterPackEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/followList/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/followList/TagArrayBuilderExt.kt index 60eac2631c..6b5cf9bc13 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/followList/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/followList/TagArrayBuilderExt.kt @@ -28,24 +28,24 @@ import com.vitorpamplona.quartz.nip51Lists.tags.DescriptionTag import com.vitorpamplona.quartz.nip51Lists.tags.ImageTag import com.vitorpamplona.quartz.nip51Lists.tags.TitleTag -fun TagArrayBuilder.title(title: String) = addUnique(TitleTag.assemble(title)) +fun TagArrayBuilder.title(title: String) = addUnique(TitleTag.assemble(title)) -fun TagArrayBuilder.description(desc: String) = addUnique(DescriptionTag.assemble(desc)) +fun TagArrayBuilder.description(desc: String) = addUnique(DescriptionTag.assemble(desc)) -fun TagArrayBuilder.image(imageUrl: String) = addUnique(ImageTag.assemble(imageUrl)) +fun TagArrayBuilder.image(imageUrl: String) = addUnique(ImageTag.assemble(imageUrl)) -fun TagArrayBuilder.people(peoples: List) = addAll(peoples.map { it.toTagArray() }) +fun TagArrayBuilder.people(peoples: List) = addAll(peoples.map { it.toTagArray() }) -fun TagArrayBuilder.person(person: UserTag) = add(person.toTagArray()) +fun TagArrayBuilder.person(person: UserTag) = add(person.toTagArray()) -fun TagArrayBuilder.person( +fun TagArrayBuilder.person( pubkey: HexKey, relayHint: NormalizedRelayUrl?, ) = add(UserTag.assemble(pubkey, relayHint)) -fun TagArrayBuilder.personFirst( +fun TagArrayBuilder.personFirst( pubkey: HexKey, relayHint: NormalizedRelayUrl?, ) = addFirst(UserTag.assemble(pubkey, relayHint)) -fun TagArrayBuilder.removePerson(pubkey: HexKey) = remove(UserTag.TAG_NAME, pubkey) +fun TagArrayBuilder.removePerson(pubkey: HexKey) = remove(UserTag.TAG_NAME, pubkey) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/hashtagList/HashtagListEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/hashtagList/InterestListEvent.kt similarity index 90% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/hashtagList/HashtagListEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/hashtagList/InterestListEvent.kt index 67af6cddc7..950fb6c7a9 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/hashtagList/HashtagListEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/hashtagList/InterestListEvent.kt @@ -41,7 +41,7 @@ import com.vitorpamplona.quartz.nip51Lists.removeIgnoreCase import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class HashtagListEvent( +class InterestListEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -51,7 +51,7 @@ class HashtagListEvent( ) : PrivateTagArrayEvent(id, pubKey, createdAt, KIND, tags, content, sig), DiffableEvent { override fun diffFrom(older: Event): HashtagListDiff? { - if (older !is HashtagListEvent || older.pubKey != pubKey || older.dTag() != dTag()) return null + if (older !is InterestListEvent || older.pubKey != pubKey || older.dTag() != dTag()) return null return HashtagListDiff( ListDiff.of(older.publicHashtags(), publicHashtags(), { it.lowercase() }), privateItemsChangeFrom(older), @@ -83,7 +83,7 @@ class HashtagListEvent( isPrivate: Boolean, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): HashtagListEvent = + ): InterestListEvent = if (isPrivate) { create( publicHashtags = emptyList(), @@ -101,7 +101,7 @@ class HashtagListEvent( } suspend fun add( - earlierVersion: HashtagListEvent, + earlierVersion: InterestListEvent, hashtag: String, isPrivate: Boolean, signer: NostrSigner, @@ -115,12 +115,12 @@ class HashtagListEvent( ) suspend fun add( - earlierVersion: HashtagListEvent, + earlierVersion: InterestListEvent, hashtags: List, isPrivate: Boolean, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): HashtagListEvent { + ): InterestListEvent { val hashtags = hashtags.map { HashtagTag.assemble(it) } return if (isPrivate) { val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException() @@ -141,11 +141,11 @@ class HashtagListEvent( } suspend fun remove( - earlierVersion: HashtagListEvent, + earlierVersion: InterestListEvent, hashtag: String, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): HashtagListEvent { + ): InterestListEvent { val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException() return resign( privateTags = privateTags.removeIgnoreCase(HashtagTag.assemble(hashtag)), @@ -172,7 +172,7 @@ class HashtagListEvent( tags: TagArray, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): HashtagListEvent { + ): InterestListEvent { val newTags = tags return signer.sign(createdAt, KIND, newTags, content) @@ -183,7 +183,7 @@ class HashtagListEvent( privateHashtags: List = emptyList(), signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): HashtagListEvent { + ): InterestListEvent { val template = build(publicHashtags, privateHashtags, signer, createdAt) return signer.sign(template) } @@ -193,7 +193,7 @@ class HashtagListEvent( privateHashtags: List = emptyList(), signer: NostrSignerSync, createdAt: Long = TimeUtils.now(), - ): HashtagListEvent { + ): InterestListEvent { val privateTagArray = publicHashtags.map { HashtagTag.assemble(it) }.toTypedArray() val publicTagArray = privateHashtags.map { HashtagTag.assemble(it) }.toTypedArray() return signer.signNip51List(createdAt, KIND, publicTagArray, privateTagArray) @@ -204,8 +204,8 @@ class HashtagListEvent( privateHashtags: List = emptyList(), signer: NostrSigner, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, - ) = eventTemplate( + initializer: TagArrayBuilder.() -> Unit = {}, + ) = eventTemplate( kind = KIND, description = PrivateTagsInContent.encryptNip44(privateHashtags.map { HashtagTag.assemble(it) }.toTypedArray(), signer), createdAt = createdAt, @@ -216,3 +216,9 @@ class HashtagListEvent( } } } + +@Deprecated( + "Renamed to InterestListEvent. NIP-51 names kind 10015 the interests list.", + ReplaceWith("InterestListEvent", "com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent"), +) +typealias HashtagListEvent = InterestListEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/hashtagList/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/hashtagList/TagArrayBuilderExt.kt index 5d271de593..70977ca9b7 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/hashtagList/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/hashtagList/TagArrayBuilderExt.kt @@ -23,6 +23,6 @@ package com.vitorpamplona.quartz.nip51Lists.hashtagList import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder import com.vitorpamplona.quartz.nip01Core.tags.hashtags.HashtagTag -fun TagArrayBuilder.followHashTag(hashtag: String) = add(HashtagTag.assemble(hashtag)) +fun TagArrayBuilder.followHashTag(hashtag: String) = add(HashtagTag.assemble(hashtag)) -fun TagArrayBuilder.hashtags(hashtags: List) = addAll(hashtags.map { HashtagTag.assemble(it) }) +fun TagArrayBuilder.hashtags(hashtags: List) = addAll(hashtags.map { HashtagTag.assemble(it) }) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/labeledBookmarkList/LabeledBookmarkListEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/labeledBookmarkList/BookmarkSetEvent.kt similarity index 94% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/labeledBookmarkList/LabeledBookmarkListEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/labeledBookmarkList/BookmarkSetEvent.kt index 2edbdca9e1..01494372a3 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/labeledBookmarkList/LabeledBookmarkListEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/labeledBookmarkList/BookmarkSetEvent.kt @@ -49,7 +49,7 @@ import kotlin.uuid.ExperimentalUuidApi import kotlin.uuid.Uuid @Immutable -class LabeledBookmarkListEvent( +class BookmarkSetEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -113,7 +113,7 @@ class LabeledBookmarkListEvent( optionalListDescription: String? = null, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): LabeledBookmarkListEvent = + ): BookmarkSetEvent = if (isPrivate) { create( title = title, @@ -135,12 +135,12 @@ class LabeledBookmarkListEvent( } suspend fun addBookmark( - earlierVersion: LabeledBookmarkListEvent, + earlierVersion: BookmarkSetEvent, bookmarkIdTag: BookmarkIdTag, isPrivate: Boolean, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): LabeledBookmarkListEvent = + ): BookmarkSetEvent = if (isPrivate) { val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException() resign( @@ -159,12 +159,12 @@ class LabeledBookmarkListEvent( } suspend fun moveBookmark( - earlierVersion: LabeledBookmarkListEvent, + earlierVersion: BookmarkSetEvent, bookmarkIdTag: BookmarkIdTag, isCurrentlyPrivate: Boolean, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): LabeledBookmarkListEvent = + ): BookmarkSetEvent = if (isCurrentlyPrivate) { val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException() resign( @@ -184,12 +184,12 @@ class LabeledBookmarkListEvent( } suspend fun removeBookmark( - earlierVersion: LabeledBookmarkListEvent, + earlierVersion: BookmarkSetEvent, bookmarkIdTag: BookmarkIdTag, isPrivate: Boolean, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): LabeledBookmarkListEvent = + ): BookmarkSetEvent = if (isPrivate) { val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException() resign( @@ -208,11 +208,11 @@ class LabeledBookmarkListEvent( } suspend fun modifyName( - earlierVersion: LabeledBookmarkListEvent, + earlierVersion: BookmarkSetEvent, newTitle: String, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): LabeledBookmarkListEvent { + ): BookmarkSetEvent { val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException() val currentTitle = earlierVersion.tags.first { it[0] == NameTag.TAG_NAME || it[0] == TitleTag.TAG_NAME } val newTitleTag = @@ -231,11 +231,11 @@ class LabeledBookmarkListEvent( } suspend fun modifyDescription( - earlierVersion: LabeledBookmarkListEvent, + earlierVersion: BookmarkSetEvent, newDescription: String?, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): LabeledBookmarkListEvent? { + ): BookmarkSetEvent? { val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException() val currentDescriptionTag = earlierVersion.tags.firstOrNull { it[0] == DescriptionTag.TAG_NAME } val currentDescription = currentDescriptionTag?.get(1) @@ -288,7 +288,7 @@ class LabeledBookmarkListEvent( tags: TagArray, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): LabeledBookmarkListEvent { + ): BookmarkSetEvent { val newTags = tags return signer.sign(createdAt, KIND, newTags, content) @@ -304,7 +304,7 @@ class LabeledBookmarkListEvent( dTag: String = Uuid.random().toString(), signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): LabeledBookmarkListEvent { + ): BookmarkSetEvent { val template = build(title, publicBookmarks, privateBookmarks, signer, dTag, createdAt) { if (description != null) description(description) @@ -321,7 +321,7 @@ class LabeledBookmarkListEvent( signer: NostrSigner, dTag: String = Uuid.random().toString(), createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate( kind = KIND, description = PrivateTagsInContent.encryptNip44(privateBookmarks.map { it.toTagArray() }.toTypedArray(), signer), @@ -335,3 +335,9 @@ class LabeledBookmarkListEvent( } } } + +@Deprecated( + "Renamed to BookmarkSetEvent. NIP-51 names kind 30003 bookmark sets.", + ReplaceWith("BookmarkSetEvent", "com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.BookmarkSetEvent"), +) +typealias LabeledBookmarkListEvent = BookmarkSetEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/labeledBookmarkList/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/labeledBookmarkList/TagArrayBuilderExt.kt index 109d81a516..5754f4f9f2 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/labeledBookmarkList/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/labeledBookmarkList/TagArrayBuilderExt.kt @@ -28,12 +28,12 @@ import com.vitorpamplona.quartz.nip51Lists.tags.NameTag import com.vitorpamplona.quartz.nip51Lists.tags.TitleTag @Deprecated("NIP-51 has deprecated name. Use title instead", ReplaceWith("title()")) -fun TagArrayBuilder.name(name: String) = addUnique(NameTag.assemble(name)) +fun TagArrayBuilder.name(name: String) = addUnique(NameTag.assemble(name)) -fun TagArrayBuilder.title(title: String) = addUnique(TitleTag.assemble(title)) +fun TagArrayBuilder.title(title: String) = addUnique(TitleTag.assemble(title)) -fun TagArrayBuilder.bookmarks(bookmarks: List) = addAll(bookmarks.map { it.toTagArray() }) +fun TagArrayBuilder.bookmarks(bookmarks: List) = addAll(bookmarks.map { it.toTagArray() }) -fun TagArrayBuilder.description(listDescription: String) = addUnique(DescriptionTag.assemble(listDescription)) +fun TagArrayBuilder.description(listDescription: String) = addUnique(DescriptionTag.assemble(listDescription)) -fun TagArrayBuilder.image(url: String) = addUnique(ImageTag.assemble(url)) +fun TagArrayBuilder.image(url: String) = addUnique(ImageTag.assemble(url)) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/peopleList/PeopleListEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/peopleList/FollowSetEvent.kt similarity index 93% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/peopleList/PeopleListEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/peopleList/FollowSetEvent.kt index 906f06587e..d10d7de69b 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/peopleList/PeopleListEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/peopleList/FollowSetEvent.kt @@ -48,7 +48,7 @@ import kotlin.uuid.ExperimentalUuidApi import kotlin.uuid.Uuid @Immutable -class PeopleListEvent( +class FollowSetEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -121,7 +121,7 @@ class PeopleListEvent( signer: NostrSigner, dTag: String = Uuid.random().toString(), createdAt: Long = TimeUtils.now(), - ): PeopleListEvent = + ): FollowSetEvent = if (isPrivate) { create( title = title, @@ -143,12 +143,12 @@ class PeopleListEvent( } suspend fun add( - earlierVersion: PeopleListEvent, + earlierVersion: FollowSetEvent, person: UserTag, isPrivate: Boolean, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): PeopleListEvent = + ): FollowSetEvent = if (isPrivate) { val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException() resign( @@ -167,12 +167,12 @@ class PeopleListEvent( } suspend fun addFirst( - earlierVersion: PeopleListEvent, + earlierVersion: FollowSetEvent, person: UserTag, isPrivate: Boolean, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): PeopleListEvent = + ): FollowSetEvent = if (isPrivate) { val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException() resign( @@ -191,11 +191,11 @@ class PeopleListEvent( } suspend fun remove( - earlierVersion: PeopleListEvent, + earlierVersion: FollowSetEvent, person: MuteTag, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): PeopleListEvent { + ): FollowSetEvent { val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException() return resign( @@ -207,11 +207,11 @@ class PeopleListEvent( } suspend fun removeAll( - earlierVersion: PeopleListEvent, + earlierVersion: FollowSetEvent, persons: List, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): PeopleListEvent { + ): FollowSetEvent { val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException() val ids = persons.map { it.toTagIdOnly() } @@ -224,12 +224,12 @@ class PeopleListEvent( } suspend fun remove( - earlierVersion: PeopleListEvent, + earlierVersion: FollowSetEvent, person: UserTag, isPrivate: Boolean, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): PeopleListEvent { + ): FollowSetEvent { if (isPrivate) { val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException() return resign( @@ -265,7 +265,7 @@ class PeopleListEvent( tags: Array>, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): PeopleListEvent { + ): FollowSetEvent { val newTags = tags return signer.sign(createdAt, KIND, newTags, content) @@ -279,7 +279,7 @@ class PeopleListEvent( signer: NostrSigner, dTag: String = Uuid.random().toString(), createdAt: Long = TimeUtils.now(), - ): PeopleListEvent { + ): FollowSetEvent { val template = build(title, publicMembers, privateMembers, signer, dTag, createdAt) return signer.sign(template) } @@ -292,8 +292,8 @@ class PeopleListEvent( signer: NostrSigner, dTag: String = Uuid.random().toString(), createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, - ) = eventTemplate( + initializer: TagArrayBuilder.() -> Unit = {}, + ) = eventTemplate( kind = KIND, description = PrivateTagsInContent.encryptNip44(privateMembers.map { it.toTagArray() }.toTypedArray(), signer), createdAt = createdAt, @@ -313,7 +313,7 @@ class PeopleListEvent( privateMembers: List = emptyList(), signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): PeopleListEvent { + ): FollowSetEvent { val newListTemplate = build( title = title, @@ -336,7 +336,7 @@ class PeopleListEvent( privateMembers: List = emptyList(), signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): PeopleListEvent { + ): FollowSetEvent { val cloneTemplate = build( title = title, @@ -358,7 +358,7 @@ class PeopleListEvent( isPrivate: Boolean, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): PeopleListEvent = + ): FollowSetEvent = create( title = title, person = UserTag(pubKey = pubKeyHex), @@ -368,13 +368,13 @@ class PeopleListEvent( ) suspend fun addUser( - earlierVersion: PeopleListEvent, + earlierVersion: FollowSetEvent, pubKeyHex: String, relayHint: NormalizedRelayUrl?, isPrivate: Boolean, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): PeopleListEvent = + ): FollowSetEvent = add( earlierVersion = earlierVersion, person = UserTag(pubKey = pubKeyHex, relayHint), @@ -384,13 +384,13 @@ class PeopleListEvent( ) suspend fun addUserFirst( - earlierVersion: PeopleListEvent, + earlierVersion: FollowSetEvent, pubKeyHex: String, relayHint: NormalizedRelayUrl?, isPrivate: Boolean, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): PeopleListEvent = + ): FollowSetEvent = addFirst( earlierVersion = earlierVersion, person = UserTag(pubKey = pubKeyHex, relayHint), @@ -400,12 +400,12 @@ class PeopleListEvent( ) suspend fun removeUser( - earlierVersion: PeopleListEvent, + earlierVersion: FollowSetEvent, pubKeyHex: String, isUserPrivate: Boolean, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): PeopleListEvent = + ): FollowSetEvent = remove( earlierVersion = earlierVersion, person = UserTag(pubKey = pubKeyHex), @@ -415,3 +415,9 @@ class PeopleListEvent( ) } } + +@Deprecated( + "Renamed to FollowSetEvent. NIP-51 names kind 30000 follow sets.", + ReplaceWith("FollowSetEvent", "com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent"), +) +typealias PeopleListEvent = FollowSetEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/peopleList/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/peopleList/TagArrayBuilderExt.kt index 5129023f76..9a07db2fec 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/peopleList/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/peopleList/TagArrayBuilderExt.kt @@ -28,12 +28,12 @@ import com.vitorpamplona.quartz.nip51Lists.tags.NameTag import com.vitorpamplona.quartz.nip51Lists.tags.TitleTag @Deprecated("NIP-51 has deprecated name. Use title instead", ReplaceWith("title()")) -fun TagArrayBuilder.name(name: String) = addUnique(NameTag.assemble(name)) +fun TagArrayBuilder.name(name: String) = addUnique(NameTag.assemble(name)) -fun TagArrayBuilder.title(name: String) = addUnique(TitleTag.assemble(name)) +fun TagArrayBuilder.title(name: String) = addUnique(TitleTag.assemble(name)) -fun TagArrayBuilder.description(desc: String) = addUnique(DescriptionTag.assemble(desc)) +fun TagArrayBuilder.description(desc: String) = addUnique(DescriptionTag.assemble(desc)) -fun TagArrayBuilder.image(url: String) = addUnique(ImageTag.assemble(url)) +fun TagArrayBuilder.image(url: String) = addUnique(ImageTag.assemble(url)) -fun TagArrayBuilder.peoples(peoples: List) = addAll(peoples.map { it.toTagArray() }) +fun TagArrayBuilder.peoples(peoples: List) = addAll(peoples.map { it.toTagArray() }) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/RelayFeedsListEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/FavoriteRelayListEvent.kt similarity index 88% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/RelayFeedsListEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/FavoriteRelayListEvent.kt index a758db06d1..29179f5d54 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/RelayFeedsListEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/FavoriteRelayListEvent.kt @@ -44,7 +44,7 @@ import com.vitorpamplona.quartz.nip51Lists.splitRelayListUpdate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class RelayFeedsListEvent( +class FavoriteRelayListEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -54,7 +54,7 @@ class RelayFeedsListEvent( ) : PrivateTagArrayEvent(id, pubKey, createdAt, KIND, tags, content, sig), DiffableEvent { override fun diffFrom(older: Event): RelayListDiff? { - if (older !is RelayFeedsListEvent || older.pubKey != pubKey || older.dTag() != dTag()) return null + if (older !is FavoriteRelayListEvent || older.pubKey != pubKey || older.dTag() != dTag()) return null return RelayListDiff(ListDiff.of(older.publicRelays(), publicRelays(), { it }), privateItemsChangeFrom(older)) } @@ -74,11 +74,11 @@ class RelayFeedsListEvent( fun createAddressTag(pubKey: HexKey): String = Address.Companion.assemble(KIND, pubKey, "") suspend fun updateRelayList( - earlierVersion: RelayFeedsListEvent, + earlierVersion: FavoriteRelayListEvent, relays: List, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): RelayFeedsListEvent { + ): FavoriteRelayListEvent { val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException() // Keeps public relays public and private relays private: rewriting them all as @@ -95,7 +95,7 @@ class RelayFeedsListEvent( relays: List, signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): RelayFeedsListEvent { + ): FavoriteRelayListEvent { val privateTagArray = relays.map { RelayTag.assemble(it) }.toTypedArray() return signer.signNip51List(createdAt, KIND, emptyArray(), privateTagArray) } @@ -104,7 +104,7 @@ class RelayFeedsListEvent( relays: List, signer: NostrSignerSync, createdAt: Long = TimeUtils.now(), - ): RelayFeedsListEvent { + ): FavoriteRelayListEvent { val privateTagArray = relays.map { RelayTag.assemble(it) }.toTypedArray() return signer.signNip51List(createdAt, KIND, emptyArray(), privateTagArray) } @@ -114,8 +114,8 @@ class RelayFeedsListEvent( privateRelays: List = emptyList(), signer: NostrSigner, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, - ) = eventTemplate( + initializer: TagArrayBuilder.() -> Unit = {}, + ) = eventTemplate( kind = KIND, description = PrivateTagsInContent.encryptNip44(privateRelays.map { RelayTag.assemble(it) }.toTypedArray(), signer), createdAt = createdAt, @@ -126,3 +126,9 @@ class RelayFeedsListEvent( } } } + +@Deprecated( + "Renamed to FavoriteRelayListEvent. NIP-51 names kind 10012 the favorite relays list.", + ReplaceWith("FavoriteRelayListEvent", "com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent"), +) +typealias RelayFeedsListEvent = FavoriteRelayListEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/tags/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/tags/TagArrayBuilderExt.kt index ecbc663eea..c2dfb98574 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/tags/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/tags/TagArrayBuilderExt.kt @@ -27,9 +27,9 @@ import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent import com.vitorpamplona.quartz.nip51Lists.PrivateTagArrayEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BlockedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BroadcastRelayListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.ProxyRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relaySets.RelaySetEvent import com.vitorpamplona.quartz.nip51Lists.tags.NameTag @@ -52,4 +52,4 @@ fun TagArrayBuilder.privateRelays(relays: List.relaySet(relays: List) = addAll(relays.map { RelayTag.assemble(it) }) -fun TagArrayBuilder.relayFeeds(relays: List) = addAll(relays.map { RelayTag.assemble(it) }) +fun TagArrayBuilder.relayFeeds(relays: List) = addAll(relays.map { RelayTag.assemble(it) }) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/releaseArtifactSet/ReleaseArtifactSetEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/releaseArtifactSet/ReleaseArtifactSetEvent.kt index 99bb13f527..b3c2dee634 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/releaseArtifactSet/ReleaseArtifactSetEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip51Lists/releaseArtifactSet/ReleaseArtifactSetEvent.kt @@ -21,11 +21,18 @@ package com.vitorpamplona.quartz.nip51Lists.releaseArtifactSet import androidx.compose.runtime.Immutable +import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.asset.SoftwareAssetEvent +import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.appId +import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.assets +import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.channel +import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.version import com.vitorpamplona.quartz.nip01Core.core.Address +import com.vitorpamplona.quartz.nip01Core.core.BaseAddressableEvent import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.core.TagArray import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder import com.vitorpamplona.quartz.nip01Core.hints.AddressHintProvider +import com.vitorpamplona.quartz.nip01Core.hints.EventHintBundle import com.vitorpamplona.quartz.nip01Core.hints.EventHintProvider import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate @@ -42,6 +49,15 @@ import com.vitorpamplona.quartz.utils.TimeUtils import kotlin.uuid.ExperimentalUuidApi import kotlin.uuid.Uuid +/** + * Kind 30063: the artifacts of one software release. + * + * Two specs publish this kind and both are parsed here: + * - NIP-51 "release artifact set": a `title`, a `description` and `e`/`a` items. + * - NIP-82 "software release": `d = @`, `i` (app id), `version`, + * `c` (channel), `e` tags to its kind 3063 assets, and the release notes as content. + * Use `isNip82SoftwareRelease()` to tell them apart. + */ @Immutable class ReleaseArtifactSetEvent( id: HexKey, @@ -50,7 +66,7 @@ class ReleaseArtifactSetEvent( tags: Array>, content: String, sig: HexKey, -) : com.vitorpamplona.quartz.nip01Core.core.BaseAddressableEvent(id, pubKey, createdAt, KIND, tags, content, sig), +) : BaseAddressableEvent(id, pubKey, createdAt, KIND, tags, content, sig), EventHintProvider, AddressHintProvider, SearchableEvent { @@ -77,9 +93,48 @@ class ReleaseArtifactSetEvent( fun items(): List = tags.mapNotNull(BookmarkIdTag::parse) + /** NIP-82: the application identifier (`i` tag). */ + fun appId() = tags.appId() + + /** NIP-82: the release version. */ + fun version() = tags.version() + + /** NIP-82: the release channel (`c` tag). */ + fun channel() = tags.channel() + + /** NIP-82: the kind 3063 assets of this release. */ + fun assets() = tags.assets() + + /** NIP-82: the release notes. */ + fun releaseNotes() = content + companion object { const val KIND = 30063 + /** NIP-82 requires `d = @`. */ + fun buildSoftwareReleaseDTag( + appId: String, + version: String, + ) = "$appId@$version" + + /** Builds a NIP-82 software release. */ + fun buildSoftwareRelease( + appId: String, + version: String, + channel: String, + assets: List>, + releaseNotes: String = "", + createdAt: Long = TimeUtils.now(), + initializer: TagArrayBuilder.() -> Unit = {}, + ) = eventTemplate(KIND, releaseNotes, createdAt) { + dTag(buildSoftwareReleaseDTag(appId, version)) + appId(appId) + version(version) + channel(channel) + assets(assets) + initializer() + } + fun createAddress( pubKey: HexKey, dTag: String, diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip52Calendar/calendar/CalendarEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip52Calendar/calendar/CalendarCollectionEvent.kt similarity index 89% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip52Calendar/calendar/CalendarEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip52Calendar/calendar/CalendarCollectionEvent.kt index 5bbebfda64..f9347efae3 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip52Calendar/calendar/CalendarEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip52Calendar/calendar/CalendarCollectionEvent.kt @@ -37,7 +37,7 @@ import kotlin.uuid.ExperimentalUuidApi import kotlin.uuid.Uuid @Immutable -class CalendarEvent( +class CalendarCollectionEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -76,7 +76,7 @@ class CalendarEvent( content: String = "", dTag: String = Uuid.random().toString(), createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, content, createdAt) { dTag(dTag) title(title) @@ -84,3 +84,9 @@ class CalendarEvent( } } } + +@Deprecated( + "Renamed to CalendarCollectionEvent. NIP-52 kind 31924 is a calendar (a collection of calendar events), not a calendar event.", + ReplaceWith("CalendarCollectionEvent", "com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent"), +) +typealias CalendarEvent = CalendarCollectionEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip52Calendar/calendar/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip52Calendar/calendar/TagArrayBuilderExt.kt index 5e0a174929..2376bb6f97 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip52Calendar/calendar/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip52Calendar/calendar/TagArrayBuilderExt.kt @@ -23,6 +23,6 @@ package com.vitorpamplona.quartz.nip52Calendar.calendar import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder import com.vitorpamplona.quartz.nip23LongContent.tags.TitleTag -// CalendarEvent builder extensions +// CalendarCollectionEvent builder extensions -fun TagArrayBuilder.title(title: String) = addUnique(TitleTag.assemble(title)) +fun TagArrayBuilder.title(title: String) = addUnique(TitleTag.assemble(title)) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip54Wiki/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip54Wiki/TagArrayBuilderExt.kt index fc7bcb353a..eb73b29190 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip54Wiki/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip54Wiki/TagArrayBuilderExt.kt @@ -26,10 +26,10 @@ import com.vitorpamplona.quartz.nip23LongContent.tags.PublishedAtTag import com.vitorpamplona.quartz.nip23LongContent.tags.SummaryTag import com.vitorpamplona.quartz.nip23LongContent.tags.TitleTag -fun TagArrayBuilder.title(title: String) = addUnique(TitleTag.assemble(title)) +fun TagArrayBuilder.title(title: String) = addUnique(TitleTag.assemble(title)) -fun TagArrayBuilder.summary(summary: String) = addUnique(SummaryTag.assemble(summary)) +fun TagArrayBuilder.summary(summary: String) = addUnique(SummaryTag.assemble(summary)) -fun TagArrayBuilder.image(imageUrl: String) = addUnique(ImageTag.assemble(imageUrl)) +fun TagArrayBuilder.image(imageUrl: String) = addUnique(ImageTag.assemble(imageUrl)) -fun TagArrayBuilder.publishedAt(publishedAt: Long) = addUnique(PublishedAtTag.assemble(publishedAt)) +fun TagArrayBuilder.publishedAt(publishedAt: Long) = addUnique(PublishedAtTag.assemble(publishedAt)) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip54Wiki/WikiNoteEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip54Wiki/WikiArticleEvent.kt similarity index 95% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip54Wiki/WikiNoteEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip54Wiki/WikiArticleEvent.kt index 42cae11b8a..ce75d16efb 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip54Wiki/WikiNoteEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip54Wiki/WikiArticleEvent.kt @@ -62,7 +62,7 @@ import kotlin.uuid.ExperimentalUuidApi import kotlin.uuid.Uuid @Immutable -class WikiNoteEvent( +class WikiArticleEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -177,8 +177,8 @@ class WikiNoteEvent( publishedAt: Long? = null, dTag: String = Uuid.random().toString(), createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, - ): EventTemplate = + initializer: TagArrayBuilder.() -> Unit = {}, + ): EventTemplate = eventTemplate(KIND, description, createdAt) { dTag(dTag) @@ -191,3 +191,9 @@ class WikiNoteEvent( } } } + +@Deprecated( + "Renamed to WikiArticleEvent. NIP-54 names kind 30818 the wiki article.", + ReplaceWith("WikiArticleEvent", "com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent"), +) +typealias WikiNoteEvent = WikiArticleEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/IPrivateZapsDecryptionCache.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/IPrivateZapsDecryptionCache.kt index 2b717721b2..bae51c5c4f 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/IPrivateZapsDecryptionCache.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/IPrivateZapsDecryptionCache.kt @@ -25,7 +25,7 @@ package com.vitorpamplona.quartz.nip57Zaps * Used by Note.kt for checking private zap status. */ interface IPrivateZapsDecryptionCache { - fun cachedPrivateZap(event: LnZapRequestEvent): LnZapPrivateEvent? + fun cachedPrivateZap(event: ZapRequestEvent): LnZapPrivateEvent? - suspend fun decryptPrivateZap(event: LnZapRequestEvent): LnZapPrivateEvent? + suspend fun decryptPrivateZap(event: ZapRequestEvent): LnZapPrivateEvent? } diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/PrivateZapCache.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/PrivateZapCache.kt index 129d64a346..57eb0a796c 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/PrivateZapCache.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/PrivateZapCache.kt @@ -28,8 +28,8 @@ class PrivateZapCache( signer: NostrSigner, ) : IPrivateZapsDecryptionCache { private val decryptionCache = - object : LruCache(1000) { - override fun create(key: LnZapRequestEvent): PrivateZapDecryptCache? { + object : LruCache(1000) { + override fun create(key: ZapRequestEvent): PrivateZapDecryptCache? { val zappedAuthor = key.zappedAuthor().firstOrNull() return if (key.isPrivateZap() && zappedAuthor != null) { PrivateZapDecryptCache(signer) @@ -39,20 +39,20 @@ class PrivateZapCache( } } - fun delete(event: LnZapRequestEvent) { + fun delete(event: ZapRequestEvent) { decryptionCache.remove(event) } - override fun cachedPrivateZap(event: LnZapRequestEvent): LnZapPrivateEvent? = decryptionCache[event]?.cached() + override fun cachedPrivateZap(event: ZapRequestEvent): LnZapPrivateEvent? = decryptionCache[event]?.cached() - override suspend fun decryptPrivateZap(event: LnZapRequestEvent) = decryptionCache[event]?.decrypt(event) + override suspend fun decryptPrivateZap(event: ZapRequestEvent) = decryptionCache[event]?.decrypt(event) } class PrivateZapDecryptCache( signer: NostrSigner, -) : DecryptCache(signer) { +) : DecryptCache(signer) { override suspend fun decryptAndParse( - event: LnZapRequestEvent, + event: ZapRequestEvent, signer: NostrSigner, ): LnZapPrivateEvent = signer.decryptZapEvent(event) } diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/PrivateZapRequestBuilder.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/PrivateZapRequestBuilder.kt index 2b91ea6934..595dc24600 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/PrivateZapRequestBuilder.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/PrivateZapRequestBuilder.kt @@ -73,7 +73,7 @@ class PrivateZapRequestBuilder { } fun decryptZapEvent( - event: LnZapRequestEvent, + event: ZapRequestEvent, signer: NostrSignerSync, ): LnZapPrivateEvent { if (signer.keyPair.privKey == null) throw SignerExceptions.ReadOnlyException() diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/ZapReceiptEvent.kt similarity index 87% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/ZapReceiptEvent.kt index 5bbf5d889e..c8df2c63a9 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/ZapReceiptEvent.kt @@ -36,7 +36,7 @@ import com.vitorpamplona.quartz.nip50Search.SearchableEvent import com.vitorpamplona.quartz.utils.Log @Immutable -class LnZapEvent( +class ZapReceiptEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -44,7 +44,7 @@ class LnZapEvent( content: String, sig: HexKey, ) : Event(id, pubKey, createdAt, KIND, tags, content, sig), - LnZapEventInterface, + ZapReceiptEventInterface, EventHintProvider, AddressHintProvider, PubKeyHintProvider, @@ -75,23 +75,23 @@ class LnZapEvent( // This event is also kept in LocalCache (same object) @kotlinx.serialization.Transient @kotlin.jvm.Transient - val zapRequest: LnZapRequestEvent? + val zapRequest: ZapRequestEvent? // Keeps this as a field because it's a heavier function used everywhere. val amount by lazy { try { lnInvoice()?.let { LnInvoiceUtil.getAmountInSats(it) } } catch (e: Exception) { - Log.e("LnZapEvent", "Failed to Parse LnInvoice ${lnInvoice()}", e) + Log.e("ZapReceiptEvent", "Failed to Parse LnInvoice ${lnInvoice()}", e) null } } - override fun containedPost(): LnZapRequestEvent? = + override fun containedPost(): ZapRequestEvent? = try { - description()?.ifBlank { null }?.let { fromJson(it) } as? LnZapRequestEvent + description()?.ifBlank { null }?.let { fromJson(it) } as? ZapRequestEvent } catch (e: Exception) { - Log.w("LnZapEvent", "Failed to Parse Contained Post ${description()} in event $id", e) + Log.w("ZapReceiptEvent", "Failed to Parse Contained Post ${description()} in event $id", e) null } @@ -111,7 +111,7 @@ class LnZapEvent( ?.get(1) ?.toInt() } catch (e: Exception) { - Log.e("LnZapEvent", "ZappedPollOption failed to parse", e) + Log.e("ZapReceiptEvent", "ZappedPollOption failed to parse", e) null } @@ -135,3 +135,9 @@ class LnZapEvent( NONZAP, } } + +@Deprecated( + "Renamed to ZapReceiptEvent. NIP-57 names kind 9735 the zap receipt.", + ReplaceWith("ZapReceiptEvent", "com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent"), +) +typealias LnZapEvent = ZapReceiptEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapEventInterface.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/ZapReceiptEventInterface.kt similarity index 82% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapEventInterface.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/ZapReceiptEventInterface.kt index d5fc8c0d96..5a188986a1 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapEventInterface.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/ZapReceiptEventInterface.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.utils.BigDecimal @Immutable -interface LnZapEventInterface { +interface ZapReceiptEventInterface { fun zappedPost(): List fun zappedPollOption(): Int? @@ -38,3 +38,9 @@ interface LnZapEventInterface { fun containedPost(): Event? } + +@Deprecated( + "Renamed to ZapReceiptEventInterface. Follows the LnZapEvent to ZapReceiptEvent rename (NIP-57 zap receipt).", + ReplaceWith("ZapReceiptEventInterface", "com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEventInterface"), +) +typealias LnZapEventInterface = ZapReceiptEventInterface diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/ZapRequestEvent.kt similarity index 91% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/ZapRequestEvent.kt index 7347f6bf62..7896537350 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/ZapRequestEvent.kt @@ -43,7 +43,7 @@ import com.vitorpamplona.quartz.nip50Search.SearchableEvent import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class LnZapRequestEvent( +class ZapRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -113,12 +113,12 @@ class LnZapRequestEvent( signer: NostrSigner, pollOption: Int?, message: String, - zapType: LnZapEvent.ZapType, + zapType: ZapReceiptEvent.ZapType, toUserPubHex: String?, amountMillisats: Long? = null, lnurl: String? = null, createdAt: Long = TimeUtils.now(), - ): LnZapRequestEvent { + ): ZapRequestEvent { var tags = listOf( arrayOf("e", zappedEvent.id), @@ -146,21 +146,21 @@ class LnZapRequestEvent( } return when (zapType) { - LnZapEvent.ZapType.PUBLIC -> { + ZapReceiptEvent.ZapType.PUBLIC -> { signer.sign(createdAt, KIND, tags.toTypedArray(), message) } - LnZapEvent.ZapType.ANONYMOUS -> { + ZapReceiptEvent.ZapType.ANONYMOUS -> { tags = tags + listOf(arrayOf("anon")) NostrSignerInternal(KeyPair()).sign(createdAt, KIND, tags.toTypedArray(), message) } - LnZapEvent.ZapType.PRIVATE -> { + ZapReceiptEvent.ZapType.PRIVATE -> { tags = tags + listOf(arrayOf("anon", "")) signer.sign(createdAt, KIND, tags.toTypedArray(), message) } - LnZapEvent.ZapType.NONZAP -> { + ZapReceiptEvent.ZapType.NONZAP -> { throw IllegalArgumentException("Invalid zap type") } } @@ -171,11 +171,11 @@ class LnZapRequestEvent( relays: Set, signer: NostrSigner, message: String, - zapType: LnZapEvent.ZapType, + zapType: ZapReceiptEvent.ZapType, amountMillisats: Long? = null, lnurl: String? = null, createdAt: Long = TimeUtils.now(), - ): LnZapRequestEvent { + ): ZapRequestEvent { var tags = arrayOf( arrayOf("p", userHex), @@ -189,11 +189,11 @@ class LnZapRequestEvent( } return when (zapType) { - LnZapEvent.ZapType.PUBLIC -> { + ZapReceiptEvent.ZapType.PUBLIC -> { signer.sign(createdAt, KIND, tags, message) } - LnZapEvent.ZapType.ANONYMOUS -> { + ZapReceiptEvent.ZapType.ANONYMOUS -> { // Valueless `anon` tag: a blank-valued one (`["anon", ""]`) is the // marker for an *unsigned private* zap and would make the throwaway // signer encrypt the message instead of keeping it public. @@ -201,15 +201,21 @@ class LnZapRequestEvent( NostrSignerInternal(KeyPair()).sign(createdAt, KIND, tags, message) } - LnZapEvent.ZapType.PRIVATE -> { + ZapReceiptEvent.ZapType.PRIVATE -> { tags += arrayOf(arrayOf("anon", "")) signer.sign(createdAt, KIND, tags, message) } - LnZapEvent.ZapType.NONZAP -> { + ZapReceiptEvent.ZapType.NONZAP -> { throw IllegalArgumentException("Invalid zap type") } } } } } + +@Deprecated( + "Renamed to ZapRequestEvent. NIP-57 names kind 9734 the zap request.", + ReplaceWith("ZapRequestEvent", "com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent"), +) +typealias LnZapRequestEvent = ZapRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/validate/LnZapReceiptValidator.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/validate/LnZapReceiptValidator.kt index c6206814f5..da42cdb131 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/validate/LnZapReceiptValidator.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip57Zaps/validate/LnZapReceiptValidator.kt @@ -22,8 +22,8 @@ package com.vitorpamplona.quartz.nip57Zaps.validate import com.vitorpamplona.quartz.lightning.LnInvoiceUtil import com.vitorpamplona.quartz.nip01Core.core.HexKey -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.utils.BigDecimal /** @@ -84,7 +84,7 @@ object LnZapReceiptValidator { * When true, a missing `amount` tag is treated as a failure. */ fun validate( - receipt: LnZapEvent, + receipt: ZapReceiptEvent, expectedNostrPubkey: HexKey?, expectedLnurl: String?, strictAmount: Boolean = false, @@ -141,13 +141,13 @@ object LnZapReceiptValidator { return Result.Valid } - private fun LnZapRequestEvent.amountMillisats(): Long? = + private fun ZapRequestEvent.amountMillisats(): Long? = tags .firstOrNull { it.size > 1 && it[0] == "amount" } ?.get(1) ?.toLongOrNull() - private fun LnZapRequestEvent.lnurl(): String? = + private fun ZapRequestEvent.lnurl(): String? = tags .firstOrNull { it.size > 1 && it[0] == "lnurl" } ?.get(1) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip59Giftwrap/HasInnerEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip59Giftwrap/HasInnerEvent.kt index 45b0b0af55..1e948258c7 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip59Giftwrap/HasInnerEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip59Giftwrap/HasInnerEvent.kt @@ -24,7 +24,7 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey /** * Marker for NIP-59 wrappers that carry an inner-event id once decrypted — - * GiftWrapEvent (and its subclasses) and SealedRumorEvent. Lets callers walk + * GiftWrapEvent (and its subclasses) and SealEvent. Lets callers walk * to the wrapped event without branching on the concrete wrapper type. */ interface HasInnerEvent { diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip59Giftwrap/rumors/Rumor.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip59Giftwrap/rumors/Rumor.kt index c1ca788297..6d3d79d0b8 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip59Giftwrap/rumors/Rumor.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip59Giftwrap/rumors/Rumor.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.core.OptimizedJsonMapper import com.vitorpamplona.quartz.nip01Core.core.OptimizedSerializable import com.vitorpamplona.quartz.nip01Core.crypto.EventHasher import com.vitorpamplona.quartz.nip59Giftwrap.rumors.kotlinSerialization.RumorKSerializer -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.utils.EventFactory import kotlinx.serialization.Serializable @@ -41,7 +41,7 @@ class Rumor( val tags: Array>?, val content: String?, ) : OptimizedSerializable { - fun mergeWith(event: SealedRumorEvent): Event { + fun mergeWith(event: SealEvent): Event { val newPubKey = event.pubKey // forces to be the pubkey of the seal to make sure impersonators don't impersonate val newCreatedAt = if (createdAt != null && createdAt > 1000) createdAt else event.createdAt val newKind = kind ?: -1 diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip59Giftwrap/seals/SealedRumorEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip59Giftwrap/seals/SealEvent.kt similarity index 93% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip59Giftwrap/seals/SealedRumorEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip59Giftwrap/seals/SealEvent.kt index d37a771984..badc0cbc7d 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip59Giftwrap/seals/SealedRumorEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip59Giftwrap/seals/SealEvent.kt @@ -32,7 +32,7 @@ import com.vitorpamplona.quartz.utils.TimeUtils import kotlin.concurrent.Volatile @Immutable -class SealedRumorEvent( +class SealEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -48,9 +48,9 @@ class SealedRumorEvent( @Volatile override var innerEventId: HexKey? = null - fun copyNoContent(): SealedRumorEvent { + fun copyNoContent(): SealEvent { val copy = - SealedRumorEvent( + SealEvent( id, pubKey, createdAt, @@ -98,7 +98,7 @@ class SealedRumorEvent( signer: NostrSigner, expirationDelta: Long? = null, createdAt: Long = TimeUtils.now(), - ): SealedRumorEvent { + ): SealEvent { val rumor = Rumor.create(event) return create(rumor, encryptTo, signer, expirationDelta, createdAt) } @@ -109,7 +109,7 @@ class SealedRumorEvent( signer: NostrSigner, expirationDelta: Long? = null, createdAt: Long = TimeUtils.randomWithTwoDays(), - ): SealedRumorEvent { + ): SealEvent { val msg = Rumor.toJson(rumor) val tags = @@ -128,3 +128,9 @@ class SealedRumorEvent( } } } + +@Deprecated( + "Renamed to SealEvent. NIP-59 names kind 13 the seal.", + ReplaceWith("SealEvent", "com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent"), +) +typealias SealedRumorEvent = SealEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip60Cashu/history/CashuSpendingHistoryEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip60Cashu/history/CashuSpendingHistoryEvent.kt index adcd455875..66cf469bf6 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip60Cashu/history/CashuSpendingHistoryEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip60Cashu/history/CashuSpendingHistoryEvent.kt @@ -25,10 +25,15 @@ import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.core.TagArray import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder +import com.vitorpamplona.quartz.nip01Core.hints.EventHintProvider +import com.vitorpamplona.quartz.nip01Core.hints.PubKeyHintProvider import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate +import com.vitorpamplona.quartz.nip01Core.tags.events.ETag +import com.vitorpamplona.quartz.nip01Core.tags.people.PTag import com.vitorpamplona.quartz.nip51Lists.encryption.PrivateTagsInContent +import com.vitorpamplona.quartz.nip61Nutzaps.redemption.redeemedNutzaps import com.vitorpamplona.quartz.utils.TimeUtils /** @@ -43,6 +48,10 @@ import com.vitorpamplona.quartz.utils.TimeUtils * * The "e" tags with "redeemed" marker SHOULD be left unencrypted in the tags array. * All other "e" tags should be encrypted in the content. + * + * NIP-61 nutzap redemptions are this same kind: a history entry whose public tags + * carry the redeemed nutzap (`["e", , , "redeemed"]`) and the + * sender's `p` tag. See `buildNutzapRedemption` in `nip61Nutzaps.redemption`. */ @Immutable class CashuSpendingHistoryEvent( @@ -52,7 +61,22 @@ class CashuSpendingHistoryEvent( tags: Array>, content: String, sig: HexKey, -) : Event(id, pubKey, createdAt, KIND, tags, content, sig) { +) : Event(id, pubKey, createdAt, KIND, tags, content, sig), + EventHintProvider, + PubKeyHintProvider { + override fun eventHints() = tags.mapNotNull(ETag::parseAsHint) + + override fun linkedEventIds() = tags.mapNotNull(ETag::parseId) + + override fun pubKeyHints() = tags.mapNotNull(PTag::parseAsHint) + + override fun linkedPubKeys() = tags.mapNotNull(PTag::parseKey) + + /** + * NIP-61: the nutzaps this entry redeemed, from the public `e` tags marked `redeemed`. + */ + fun redeemedNutzaps() = tags.redeemedNutzaps() + /** * Decrypts the content to get the private spending history tags. */ diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/redemption/NutzapRedemptionEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/redemption/NutzapRedemptionEvent.kt index 8cfc908eef..1382f57b12 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/redemption/NutzapRedemptionEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/redemption/NutzapRedemptionEvent.kt @@ -20,52 +20,37 @@ */ package com.vitorpamplona.quartz.nip61Nutzaps.redemption -import androidx.compose.runtime.Immutable -import com.vitorpamplona.quartz.nip01Core.core.Event -import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder import com.vitorpamplona.quartz.nip01Core.hints.EventHintBundle -import com.vitorpamplona.quartz.nip01Core.hints.EventHintProvider -import com.vitorpamplona.quartz.nip01Core.hints.PubKeyHintProvider import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate -import com.vitorpamplona.quartz.nip01Core.tags.events.ETag -import com.vitorpamplona.quartz.nip01Core.tags.people.PTag +import com.vitorpamplona.quartz.nip60Cashu.history.CashuSpendingHistoryEvent import com.vitorpamplona.quartz.nip61Nutzaps.nutzap.NutzapEvent import com.vitorpamplona.quartz.utils.TimeUtils -@Immutable -class NutzapRedemptionEvent( - id: HexKey, - pubKey: HexKey, - createdAt: Long, - tags: Array>, - content: String, - sig: HexKey, -) : Event(id, pubKey, createdAt, KIND, tags, content, sig), - EventHintProvider, - PubKeyHintProvider { - override fun eventHints() = tags.mapNotNull(ETag::parseAsHint) - - override fun linkedEventIds() = tags.mapNotNull(ETag::parseId) - - override fun pubKeyHints() = tags.mapNotNull(PTag::parseAsHint) - - override fun linkedPubKeys() = tags.mapNotNull(PTag::parseKey) - - fun redeemedNutzaps() = tags.redeemedNutzaps() - - companion object { - const val KIND = 7376 - - fun build( - nutzap: EventHintBundle, - encryptedContent: String, - createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, - ) = eventTemplate(KIND, encryptedContent, createdAt) { - redeemedNutzap(nutzap) - notifySender(nutzap) - initializer() - } - } +/** + * Builds a NIP-61 nutzap redemption: a NIP-60 spending history event (kind 7376) + * that publicly marks [nutzap] as redeemed and notifies its sender. + * + * [encryptedContent] is the NIP-44 encrypted history payload (direction, amount, ...). + */ +fun CashuSpendingHistoryEvent.Companion.buildNutzapRedemption( + nutzap: EventHintBundle, + encryptedContent: String, + createdAt: Long = TimeUtils.now(), + initializer: TagArrayBuilder.() -> Unit = {}, +) = eventTemplate(KIND, encryptedContent, createdAt) { + redeemedNutzap(nutzap) + notifySender(nutzap) + initializer() } + +/** + * NIP-61 redemptions are NIP-60 spending history events (kind 7376). This used to be a + * second class for the same kind, which `EventFactory` could never instantiate because + * [CashuSpendingHistoryEvent] matched first. + */ +@Deprecated( + "Kind 7376 is the NIP-60 spending history event. Use CashuSpendingHistoryEvent and CashuSpendingHistoryEvent.buildNutzapRedemption.", + ReplaceWith("CashuSpendingHistoryEvent", "com.vitorpamplona.quartz.nip60Cashu.history.CashuSpendingHistoryEvent"), +) +typealias NutzapRedemptionEvent = CashuSpendingHistoryEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/redemption/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/redemption/TagArrayBuilderExt.kt index 26ffc67ab9..cfd334df4e 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/redemption/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/redemption/TagArrayBuilderExt.kt @@ -23,10 +23,11 @@ package com.vitorpamplona.quartz.nip61Nutzaps.redemption import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder import com.vitorpamplona.quartz.nip01Core.hints.EventHintBundle import com.vitorpamplona.quartz.nip01Core.tags.people.PTag +import com.vitorpamplona.quartz.nip60Cashu.history.CashuSpendingHistoryEvent import com.vitorpamplona.quartz.nip61Nutzaps.nutzap.NutzapEvent import com.vitorpamplona.quartz.utils.arrayOfNotNull -fun TagArrayBuilder.redeemedNutzap(nutzap: EventHintBundle) = +fun TagArrayBuilder.redeemedNutzap(nutzap: EventHintBundle) = add( arrayOfNotNull( "e", @@ -36,4 +37,4 @@ fun TagArrayBuilder.redeemedNutzap(nutzap: EventHintBundl ), ) -fun TagArrayBuilder.notifySender(nutzap: EventHintBundle) = add(PTag.assemble(nutzap.event.pubKey, nutzap.authorHomeRelay)) +fun TagArrayBuilder.notifySender(nutzap: EventHintBundle) = add(PTag.assemble(nutzap.event.pubKey, nutzap.authorHomeRelay)) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/token/TokenEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/token/TokenEvent.kt index 0970ccde4a..0e72608c50 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/token/TokenEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/token/TokenEvent.kt @@ -20,31 +20,15 @@ */ package com.vitorpamplona.quartz.nip61Nutzaps.token -import androidx.compose.runtime.Immutable -import com.vitorpamplona.quartz.nip01Core.core.Event -import com.vitorpamplona.quartz.nip01Core.core.HexKey -import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder -import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate -import com.vitorpamplona.quartz.utils.TimeUtils +import com.vitorpamplona.quartz.nip60Cashu.token.CashuTokenEvent -@Immutable -class TokenEvent( - id: HexKey, - pubKey: HexKey, - createdAt: Long, - tags: Array>, - content: String, - sig: HexKey, -) : Event(id, pubKey, createdAt, KIND, tags, content, sig) { - companion object { - const val KIND = 7375 - - fun build( - encryptedContent: String, - createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, - ) = eventTemplate(KIND, encryptedContent, createdAt) { - initializer() - } - } -} +/** + * NIP-61 does not define its own kind 7375: redeemed nutzap proofs are stored as + * ordinary NIP-60 wallet token events. This used to be a second class for the same + * kind, which `EventFactory` could never instantiate because [CashuTokenEvent] matched first. + */ +@Deprecated( + "Kind 7375 is the NIP-60 Cashu wallet token event. Use CashuTokenEvent.", + ReplaceWith("CashuTokenEvent", "com.vitorpamplona.quartz.nip60Cashu.token.CashuTokenEvent"), +) +typealias TokenEvent = CashuTokenEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip71Video/VideoHorizontalEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip71Video/AddressableNormalVideoEvent.kt similarity index 82% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip71Video/VideoHorizontalEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip71Video/AddressableNormalVideoEvent.kt index 67abb889ff..9f979d38f0 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip71Video/VideoHorizontalEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip71Video/AddressableNormalVideoEvent.kt @@ -32,7 +32,7 @@ import kotlin.uuid.Uuid @Immutable @OptIn(ExperimentalUuidApi::class) -class VideoHorizontalEvent( +class AddressableNormalVideoEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -49,7 +49,7 @@ class VideoHorizontalEvent( description: String, dTag: String = Uuid.random().toString(), createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = build(description, dTag, createdAt) { videoIMeta(video) initializer() @@ -60,7 +60,7 @@ class VideoHorizontalEvent( description: String, dTag: String = Uuid.random().toString(), createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = build(description, dTag, createdAt) { videoIMetas(video) initializer() @@ -70,10 +70,16 @@ class VideoHorizontalEvent( description: String, dTag: String = Uuid.random().toString(), createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, description, createdAt) { dTag(dTag) initializer() } } } + +@Deprecated( + "Renamed to AddressableNormalVideoEvent. NIP-71 names kind 34235 the addressable normal video.", + ReplaceWith("AddressableNormalVideoEvent", "com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent"), +) +typealias VideoHorizontalEvent = AddressableNormalVideoEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip71Video/VideoVerticalEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip71Video/AddressableShortVideoEvent.kt similarity index 83% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip71Video/VideoVerticalEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip71Video/AddressableShortVideoEvent.kt index 880c8bf885..0c0347707d 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip71Video/VideoVerticalEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip71Video/AddressableShortVideoEvent.kt @@ -32,7 +32,7 @@ import kotlin.uuid.Uuid @Immutable @OptIn(ExperimentalUuidApi::class) -class VideoVerticalEvent( +class AddressableShortVideoEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -49,7 +49,7 @@ class VideoVerticalEvent( description: String, dTag: String = Uuid.random().toString(), createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = build(description, dTag, createdAt) { videoIMeta(video) initializer() @@ -59,10 +59,16 @@ class VideoVerticalEvent( description: String, dTag: String = Uuid.random().toString(), createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, description, createdAt) { dTag(dTag) initializer() } } } + +@Deprecated( + "Renamed to AddressableShortVideoEvent. NIP-71 names kind 34236 the addressable short video.", + ReplaceWith("AddressableShortVideoEvent", "com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent"), +) +typealias VideoVerticalEvent = AddressableShortVideoEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip75ZapGoals/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip75ZapGoals/TagArrayBuilderExt.kt index 117e00a207..3bde9fbdd1 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip75ZapGoals/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip75ZapGoals/TagArrayBuilderExt.kt @@ -30,16 +30,16 @@ import com.vitorpamplona.quartz.nip75ZapGoals.tags.AmountTag import com.vitorpamplona.quartz.nip75ZapGoals.tags.ClosedAtTag import com.vitorpamplona.quartz.nip75ZapGoals.tags.RelayListTag -fun TagArrayBuilder.amount(amountInMillisats: Long) = addUnique(AmountTag.assemble(amountInMillisats)) +fun TagArrayBuilder.amount(amountInMillisats: Long) = addUnique(AmountTag.assemble(amountInMillisats)) -fun TagArrayBuilder.relays(urls: List) = add(RelayListTag.assemble(urls)) +fun TagArrayBuilder.relays(urls: List) = add(RelayListTag.assemble(urls)) -fun TagArrayBuilder.summary(summary: String) = addUnique(SummaryTag.assemble(summary)) +fun TagArrayBuilder.summary(summary: String) = addUnique(SummaryTag.assemble(summary)) -fun TagArrayBuilder.image(imageUrl: String) = addUnique(ImageTag.assemble(imageUrl)) +fun TagArrayBuilder.image(imageUrl: String) = addUnique(ImageTag.assemble(imageUrl)) -fun TagArrayBuilder.closedAt(closedAt: Long) = addUnique(ClosedAtTag.assemble(closedAt)) +fun TagArrayBuilder.closedAt(closedAt: Long) = addUnique(ClosedAtTag.assemble(closedAt)) -fun TagArrayBuilder.linked(tag: ETag) = addUnique(tag.toTagArray()) +fun TagArrayBuilder.linked(tag: ETag) = addUnique(tag.toTagArray()) -fun TagArrayBuilder.linked(tag: ATag) = addUnique(tag.toATagArray()) +fun TagArrayBuilder.linked(tag: ATag) = addUnique(tag.toATagArray()) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip75ZapGoals/GoalEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip75ZapGoals/ZapGoalEvent.kt similarity index 94% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip75ZapGoals/GoalEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip75ZapGoals/ZapGoalEvent.kt index da7b923c80..66f3007031 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip75ZapGoals/GoalEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip75ZapGoals/ZapGoalEvent.kt @@ -48,7 +48,7 @@ import com.vitorpamplona.quartz.nip75ZapGoals.tags.RelayListTag import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class GoalEvent( +class ZapGoalEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -106,7 +106,7 @@ class GoalEvent( websiteUrl: String? = null, linkedEvent: EventHintBundle? = null, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, description, createdAt) { amount(amount) relays(relays) @@ -124,3 +124,9 @@ class GoalEvent( } } } + +@Deprecated( + "Renamed to ZapGoalEvent. NIP-75 names kind 9041 the zap goal.", + ReplaceWith("ZapGoalEvent", "com.vitorpamplona.quartz.nip75ZapGoals.ZapGoalEvent"), +) +typealias GoalEvent = ZapGoalEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip85TrustedAssertions/users/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip85TrustedAssertions/users/TagArrayBuilderExt.kt index 161912e25d..1cdb5412b7 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip85TrustedAssertions/users/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip85TrustedAssertions/users/TagArrayBuilderExt.kt @@ -42,42 +42,42 @@ import com.vitorpamplona.quartz.nip85TrustedAssertions.users.tags.ZapAvgAmountDa import com.vitorpamplona.quartz.nip85TrustedAssertions.users.tags.ZapCountReceivedTag import com.vitorpamplona.quartz.nip85TrustedAssertions.users.tags.ZapCountSentTag -fun TagArrayBuilder.rank(rank: Int) = addUnique(RankTag.assemble(rank)) +fun TagArrayBuilder.rank(rank: Int) = addUnique(RankTag.assemble(rank)) -fun TagArrayBuilder.followers(count: Int) = addUnique(FollowerCountTag.assemble(count)) +fun TagArrayBuilder.followers(count: Int) = addUnique(FollowerCountTag.assemble(count)) -fun TagArrayBuilder.hops(hops: Int) = addUnique(HopsTag.assemble(hops)) +fun TagArrayBuilder.hops(hops: Int) = addUnique(HopsTag.assemble(hops)) -fun TagArrayBuilder.firstCreatedAt(timestamp: Long) = addUnique(FirstCreatedAtTag.assemble(timestamp)) +fun TagArrayBuilder.firstCreatedAt(timestamp: Long) = addUnique(FirstCreatedAtTag.assemble(timestamp)) -fun TagArrayBuilder.postCount(count: Int) = addUnique(PostCountTag.assemble(count)) +fun TagArrayBuilder.postCount(count: Int) = addUnique(PostCountTag.assemble(count)) -fun TagArrayBuilder.replyCount(count: Int) = addUnique(ReplyCountTag.assemble(count)) +fun TagArrayBuilder.replyCount(count: Int) = addUnique(ReplyCountTag.assemble(count)) -fun TagArrayBuilder.reactionsCount(count: Int) = addUnique(ReactionsCountTag.assemble(count)) +fun TagArrayBuilder.reactionsCount(count: Int) = addUnique(ReactionsCountTag.assemble(count)) -fun TagArrayBuilder.zapAmountReceived(sats: Long) = addUnique(ZapAmountReceivedTag.assemble(sats)) +fun TagArrayBuilder.zapAmountReceived(sats: Long) = addUnique(ZapAmountReceivedTag.assemble(sats)) -fun TagArrayBuilder.zapAmountSent(sats: Long) = addUnique(ZapAmountSentTag.assemble(sats)) +fun TagArrayBuilder.zapAmountSent(sats: Long) = addUnique(ZapAmountSentTag.assemble(sats)) -fun TagArrayBuilder.zapCountReceived(count: Int) = addUnique(ZapCountReceivedTag.assemble(count)) +fun TagArrayBuilder.zapCountReceived(count: Int) = addUnique(ZapCountReceivedTag.assemble(count)) -fun TagArrayBuilder.zapCountSent(count: Int) = addUnique(ZapCountSentTag.assemble(count)) +fun TagArrayBuilder.zapCountSent(count: Int) = addUnique(ZapCountSentTag.assemble(count)) -fun TagArrayBuilder.zapAvgAmountDayReceived(sats: Long) = addUnique(ZapAvgAmountDayReceivedTag.assemble(sats)) +fun TagArrayBuilder.zapAvgAmountDayReceived(sats: Long) = addUnique(ZapAvgAmountDayReceivedTag.assemble(sats)) -fun TagArrayBuilder.zapAvgAmountDaySent(sats: Long) = addUnique(ZapAvgAmountDaySentTag.assemble(sats)) +fun TagArrayBuilder.zapAvgAmountDaySent(sats: Long) = addUnique(ZapAvgAmountDaySentTag.assemble(sats)) -fun TagArrayBuilder.reportsCountReceived(count: Int) = addUnique(ReportsCountReceivedTag.assemble(count)) +fun TagArrayBuilder.reportsCountReceived(count: Int) = addUnique(ReportsCountReceivedTag.assemble(count)) -fun TagArrayBuilder.reportsCountSent(count: Int) = addUnique(ReportsCountSentTag.assemble(count)) +fun TagArrayBuilder.reportsCountSent(count: Int) = addUnique(ReportsCountSentTag.assemble(count)) -fun TagArrayBuilder.topic(topic: String) = add(TopicTag.assemble(topic)) +fun TagArrayBuilder.topic(topic: String) = add(TopicTag.assemble(topic)) -fun TagArrayBuilder.activeHoursStart(hour: Int) = addUnique(ActiveHoursStartTag.assemble(hour)) +fun TagArrayBuilder.activeHoursStart(hour: Int) = addUnique(ActiveHoursStartTag.assemble(hour)) -fun TagArrayBuilder.activeHoursEnd(hour: Int) = addUnique(ActiveHoursEndTag.assemble(hour)) +fun TagArrayBuilder.activeHoursEnd(hour: Int) = addUnique(ActiveHoursEndTag.assemble(hour)) -fun TagArrayBuilder.petName(name: String) = addUnique(PetNameTag.assemble(name)) +fun TagArrayBuilder.petName(name: String) = addUnique(PetNameTag.assemble(name)) -fun TagArrayBuilder.summary(summary: String) = addUnique(SummaryTag.assemble(summary)) +fun TagArrayBuilder.summary(summary: String) = addUnique(SummaryTag.assemble(summary)) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip85TrustedAssertions/users/ContactCardEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip85TrustedAssertions/users/UserAssertionEvent.kt similarity index 89% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip85TrustedAssertions/users/ContactCardEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip85TrustedAssertions/users/UserAssertionEvent.kt index 91e7d58355..055df00154 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip85TrustedAssertions/users/ContactCardEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip85TrustedAssertions/users/UserAssertionEvent.kt @@ -43,7 +43,7 @@ import com.vitorpamplona.quartz.nip85TrustedAssertions.users.tags.SummaryTag import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class ContactCardEvent( +class UserAssertionEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -127,9 +127,9 @@ class ContactCardEvent( emojis: List = emptyList(), signer: NostrSigner, createdAt: Long = TimeUtils.now(), - publicInitializer: TagArrayBuilder.() -> Unit = {}, - privateInitializer: TagArrayBuilder.() -> Unit = {}, - ): ContactCardEvent = signer.sign(build(targetUser, petName, summary, emojis, signer, createdAt, publicInitializer, privateInitializer)) + publicInitializer: TagArrayBuilder.() -> Unit = {}, + privateInitializer: TagArrayBuilder.() -> Unit = {}, + ): UserAssertionEvent = signer.sign(build(targetUser, petName, summary, emojis, signer, createdAt, publicInitializer, privateInitializer)) /** * Unsigned template for a new card about [targetUser]. The petname, summary @@ -143,9 +143,9 @@ class ContactCardEvent( emojis: List = emptyList(), signer: NostrSigner, createdAt: Long = TimeUtils.now(), - publicInitializer: TagArrayBuilder.() -> Unit = {}, - privateInitializer: TagArrayBuilder.() -> Unit = {}, - ): EventTemplate { + publicInitializer: TagArrayBuilder.() -> Unit = {}, + privateInitializer: TagArrayBuilder.() -> Unit = {}, + ): EventTemplate { val privateTags = tagArray { petName?.let { petName(it) } @@ -174,13 +174,13 @@ class ContactCardEvent( * [signer] only decrypts/encrypts here; the caller signs the template. */ suspend fun updatePetNameAndSummary( - earlierVersion: ContactCardEvent, + earlierVersion: UserAssertionEvent, petName: String? = null, summary: String? = null, emojis: List = emptyList(), signer: NostrSigner, createdAt: Long = TimeUtils.now(), - ): EventTemplate { + ): EventTemplate { val privateTags = earlierVersion.privateTags(signer) ?: throw SignerExceptions.UnauthorizedDecryptionException() @@ -211,3 +211,9 @@ class ContactCardEvent( } } } + +@Deprecated( + "Renamed to UserAssertionEvent. NIP-85 names kind 30382 the user trusted assertion.", + ReplaceWith("UserAssertionEvent", "com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent"), +) +typealias ContactCardEvent = UserAssertionEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip89AppHandlers/clientTag/NostrSignerWithClientTag.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip89AppHandlers/clientTag/NostrSignerWithClientTag.kt index 7cd234f925..48c72d8de2 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip89AppHandlers/clientTag/NostrSignerWithClientTag.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip89AppHandlers/clientTag/NostrSignerWithClientTag.kt @@ -25,7 +25,7 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent /** * A [NostrSigner] decorator that automatically appends a NIP-89 client tag @@ -94,7 +94,7 @@ class NostrSignerWithClientTag( fromPublicKey: HexKey, ): String = inner.nip44Decrypt(ciphertext, fromPublicKey) - override suspend fun decryptZapEvent(event: LnZapRequestEvent): LnZapPrivateEvent = inner.decryptZapEvent(event) + override suspend fun decryptZapEvent(event: ZapRequestEvent): LnZapPrivateEvent = inner.decryptZapEvent(event) override suspend fun deriveKey(nonce: HexKey): HexKey = inner.deriveKey(nonce) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryRequest/NIP90ContentDiscoveryRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryRequest/DvmContentDiscoveryRequestEvent.kt similarity index 85% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryRequest/NIP90ContentDiscoveryRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryRequest/DvmContentDiscoveryRequestEvent.kt index d6df3c9589..d7b0825f50 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryRequest/NIP90ContentDiscoveryRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryRequest/DvmContentDiscoveryRequestEvent.kt @@ -34,7 +34,7 @@ import com.vitorpamplona.quartz.utils.TimeUtils @Stable @Immutable -class NIP90ContentDiscoveryRequestEvent( +class DvmContentDiscoveryRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -62,7 +62,7 @@ class NIP90ContentDiscoveryRequestEvent( forUser: HexKey, relays: Set, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { dvmPubKey(dvmPublicKey) relays(relays) @@ -72,3 +72,9 @@ class NIP90ContentDiscoveryRequestEvent( } } } + +@Deprecated( + "Renamed to DvmContentDiscoveryRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmContentDiscoveryRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.DvmContentDiscoveryRequestEvent"), +) +typealias NIP90ContentDiscoveryRequestEvent = DvmContentDiscoveryRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryRequest/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryRequest/TagArrayBuilderExt.kt index b9ca5e65de..0af5322d05 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryRequest/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryRequest/TagArrayBuilderExt.kt @@ -26,11 +26,11 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.tags.ParamTag import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.tags.RelaysTag -fun TagArrayBuilder.dvmPubKey(pubKey: HexKey) = addUnique(arrayOf("p", pubKey)) +fun TagArrayBuilder.dvmPubKey(pubKey: HexKey) = addUnique(arrayOf("p", pubKey)) -fun TagArrayBuilder.relays(relays: Set) = addUnique(RelaysTag.assemble(relays)) +fun TagArrayBuilder.relays(relays: Set) = addUnique(RelaysTag.assemble(relays)) -fun TagArrayBuilder.param( +fun TagArrayBuilder.param( key: String, value: String, ) = add(ParamTag.assemble(key, value)) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryResponse/NIP90ContentDiscoveryResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryResponse/DvmContentDiscoveryResponseEvent.kt similarity index 82% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryResponse/NIP90ContentDiscoveryResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryResponse/DvmContentDiscoveryResponseEvent.kt index 105a1d1fde..8b2cd681f7 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryResponse/NIP90ContentDiscoveryResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentDiscoveryResponse/DvmContentDiscoveryResponseEvent.kt @@ -30,7 +30,7 @@ import com.vitorpamplona.quartz.utils.Log import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90ContentDiscoveryResponseEvent( +class DvmContentDiscoveryResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -61,7 +61,7 @@ class NIP90ContentDiscoveryResponseEvent( } } } catch (e: Throwable) { - Log.w("NIP90ContentDiscoveryResponseEvent") { "Error parsing the JSON ${e.message}" } + Log.w("DvmContentDiscoveryResponseEvent") { "Error parsing the JSON ${e.message}" } } return events ?: listOf() @@ -72,9 +72,15 @@ class NIP90ContentDiscoveryResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmContentDiscoveryResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmContentDiscoveryResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.DvmContentDiscoveryResponseEvent"), +) +typealias NIP90ContentDiscoveryResponseEvent = DvmContentDiscoveryResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentSearch/NIP90ContentSearchRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentSearch/DvmContentSearchRequestEvent.kt similarity index 89% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentSearch/NIP90ContentSearchRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentSearch/DvmContentSearchRequestEvent.kt index ca04176d38..910922bd11 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentSearch/NIP90ContentSearchRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentSearch/DvmContentSearchRequestEvent.kt @@ -36,7 +36,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.param import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90ContentSearchRequestEvent( +class DvmContentSearchRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -76,7 +76,7 @@ class NIP90ContentSearchRequestEvent( until: Long? = null, maxResults: Int? = null, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { inputText(searchQuery) users?.let { param("users", it) } @@ -87,3 +87,9 @@ class NIP90ContentSearchRequestEvent( } } } + +@Deprecated( + "Renamed to DvmContentSearchRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmContentSearchRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.contentSearch.DvmContentSearchRequestEvent"), +) +typealias NIP90ContentSearchRequestEvent = DvmContentSearchRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentSearch/NIP90ContentSearchResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentSearch/DvmContentSearchResponseEvent.kt similarity index 83% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentSearch/NIP90ContentSearchResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentSearch/DvmContentSearchResponseEvent.kt index 894a70dc90..013fa3abc7 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentSearch/NIP90ContentSearchResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/contentSearch/DvmContentSearchResponseEvent.kt @@ -30,7 +30,7 @@ import com.vitorpamplona.quartz.utils.Log import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90ContentSearchResponseEvent( +class DvmContentSearchResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -61,7 +61,7 @@ class NIP90ContentSearchResponseEvent( } } } catch (e: Throwable) { - Log.w("NIP90ContentSearchResponseEvent") { "Error parsing the JSON ${e.message}" } + Log.w("DvmContentSearchResponseEvent") { "Error parsing the JSON ${e.message}" } } return events ?: listOf() @@ -72,9 +72,15 @@ class NIP90ContentSearchResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmContentSearchResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmContentSearchResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.contentSearch.DvmContentSearchResponseEvent"), +) +typealias NIP90ContentSearchResponseEvent = DvmContentSearchResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventCount/NIP90EventCountRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventCount/DvmEventCountRequestEvent.kt similarity index 86% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventCount/NIP90EventCountRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventCount/DvmEventCountRequestEvent.kt index 504672ea10..408c2be134 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventCount/NIP90EventCountRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventCount/DvmEventCountRequestEvent.kt @@ -33,7 +33,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.param import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90EventCountRequestEvent( +class DvmEventCountRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -58,7 +58,7 @@ class NIP90EventCountRequestEvent( groups: List = emptyList(), filterJson: String = "", createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, filterJson, createdAt) { inputs.forEach { inputText(it) } relays.forEach { param("relay", it) } @@ -67,3 +67,9 @@ class NIP90EventCountRequestEvent( } } } + +@Deprecated( + "Renamed to DvmEventCountRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmEventCountRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.eventCount.DvmEventCountRequestEvent"), +) +typealias NIP90EventCountRequestEvent = DvmEventCountRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventCount/NIP90EventCountResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventCount/DvmEventCountResponseEvent.kt similarity index 82% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventCount/NIP90EventCountResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventCount/DvmEventCountResponseEvent.kt index 84f0d173d6..10e0e62444 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventCount/NIP90EventCountResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventCount/DvmEventCountResponseEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90EventCountResponseEvent( +class DvmEventCountResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -43,9 +43,15 @@ class NIP90EventCountResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmEventCountResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmEventCountResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.eventCount.DvmEventCountResponseEvent"), +) +typealias NIP90EventCountResponseEvent = DvmEventCountResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPowDelegation/NIP90EventPowDelegationRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPowDelegation/DvmEventPowDelegationRequestEvent.kt similarity index 83% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPowDelegation/NIP90EventPowDelegationRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPowDelegation/DvmEventPowDelegationRequestEvent.kt index 1f0d7570ae..ee577cb305 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPowDelegation/NIP90EventPowDelegationRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPowDelegation/DvmEventPowDelegationRequestEvent.kt @@ -33,7 +33,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.param import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90EventPowDelegationRequestEvent( +class DvmEventPowDelegationRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -54,7 +54,7 @@ class NIP90EventPowDelegationRequestEvent( eventJson: String, pow: Int, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { inputText(eventJson) param("pow", pow.toString()) @@ -62,3 +62,9 @@ class NIP90EventPowDelegationRequestEvent( } } } + +@Deprecated( + "Renamed to DvmEventPowDelegationRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmEventPowDelegationRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.eventPowDelegation.DvmEventPowDelegationRequestEvent"), +) +typealias NIP90EventPowDelegationRequestEvent = DvmEventPowDelegationRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPowDelegation/NIP90EventPowDelegationResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPowDelegation/DvmEventPowDelegationResponseEvent.kt similarity index 79% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPowDelegation/NIP90EventPowDelegationResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPowDelegation/DvmEventPowDelegationResponseEvent.kt index ab46d67d28..0174d11e57 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPowDelegation/NIP90EventPowDelegationResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPowDelegation/DvmEventPowDelegationResponseEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90EventPowDelegationResponseEvent( +class DvmEventPowDelegationResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -41,9 +41,15 @@ class NIP90EventPowDelegationResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmEventPowDelegationResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmEventPowDelegationResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.eventPowDelegation.DvmEventPowDelegationResponseEvent"), +) +typealias NIP90EventPowDelegationResponseEvent = DvmEventPowDelegationResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPublishSchedule/NIP90EventPublishScheduleRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPublishSchedule/DvmEventPublishScheduleRequestEvent.kt similarity index 84% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPublishSchedule/NIP90EventPublishScheduleRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPublishSchedule/DvmEventPublishScheduleRequestEvent.kt index a6eab69fa8..5160350b86 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPublishSchedule/NIP90EventPublishScheduleRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPublishSchedule/DvmEventPublishScheduleRequestEvent.kt @@ -33,7 +33,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.param import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90EventPublishScheduleRequestEvent( +class DvmEventPublishScheduleRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -54,7 +54,7 @@ class NIP90EventPublishScheduleRequestEvent( eventJson: String, relays: List = emptyList(), createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { inputText(eventJson) if (relays.isNotEmpty()) { @@ -64,3 +64,9 @@ class NIP90EventPublishScheduleRequestEvent( } } } + +@Deprecated( + "Renamed to DvmEventPublishScheduleRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmEventPublishScheduleRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.eventPublishSchedule.DvmEventPublishScheduleRequestEvent"), +) +typealias NIP90EventPublishScheduleRequestEvent = DvmEventPublishScheduleRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPublishSchedule/NIP90EventPublishScheduleResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPublishSchedule/DvmEventPublishScheduleResponseEvent.kt similarity index 79% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPublishSchedule/NIP90EventPublishScheduleResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPublishSchedule/DvmEventPublishScheduleResponseEvent.kt index 1dfa2e5980..8a5fde2e6e 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPublishSchedule/NIP90EventPublishScheduleResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventPublishSchedule/DvmEventPublishScheduleResponseEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90EventPublishScheduleResponseEvent( +class DvmEventPublishScheduleResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -43,9 +43,15 @@ class NIP90EventPublishScheduleResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmEventPublishScheduleResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmEventPublishScheduleResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.eventPublishSchedule.DvmEventPublishScheduleResponseEvent"), +) +typealias NIP90EventPublishScheduleResponseEvent = DvmEventPublishScheduleResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventTimestamping/NIP90EventTimestampingRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventTimestamping/DvmEventTimestampingRequestEvent.kt similarity index 83% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventTimestamping/NIP90EventTimestampingRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventTimestamping/DvmEventTimestampingRequestEvent.kt index 4280ea87ca..454e3574a2 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventTimestamping/NIP90EventTimestampingRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventTimestamping/DvmEventTimestampingRequestEvent.kt @@ -32,7 +32,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.inputs import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90EventTimestampingRequestEvent( +class DvmEventTimestampingRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -50,10 +50,16 @@ class NIP90EventTimestampingRequestEvent( fun build( eventId: HexKey, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { inputEvent(eventId) initializer() } } } + +@Deprecated( + "Renamed to DvmEventTimestampingRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmEventTimestampingRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.eventTimestamping.DvmEventTimestampingRequestEvent"), +) +typealias NIP90EventTimestampingRequestEvent = DvmEventTimestampingRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventTimestamping/NIP90EventTimestampingResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventTimestamping/DvmEventTimestampingResponseEvent.kt similarity index 80% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventTimestamping/NIP90EventTimestampingResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventTimestamping/DvmEventTimestampingResponseEvent.kt index 604079190e..d4a1125fea 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventTimestamping/NIP90EventTimestampingResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/eventTimestamping/DvmEventTimestampingResponseEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90EventTimestampingResponseEvent( +class DvmEventTimestampingResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -43,9 +43,15 @@ class NIP90EventTimestampingResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmEventTimestampingResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmEventTimestampingResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.eventTimestamping.DvmEventTimestampingResponseEvent"), +) +typealias NIP90EventTimestampingResponseEvent = DvmEventTimestampingResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageGeneration/NIP90ImageGenerationRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageGeneration/DvmImageGenerationRequestEvent.kt similarity index 89% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageGeneration/NIP90ImageGenerationRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageGeneration/DvmImageGenerationRequestEvent.kt index 08dc291512..7ffb56dad8 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageGeneration/NIP90ImageGenerationRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageGeneration/DvmImageGenerationRequestEvent.kt @@ -37,7 +37,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.param import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90ImageGenerationRequestEvent( +class DvmImageGenerationRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -85,7 +85,7 @@ class NIP90ImageGenerationRequestEvent( size: String? = null, negativePrompt: String? = null, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { sourceImageUrl?.let { inputUrl(it) } inputText(prompt) @@ -98,3 +98,9 @@ class NIP90ImageGenerationRequestEvent( } } } + +@Deprecated( + "Renamed to DvmImageGenerationRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmImageGenerationRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.imageGeneration.DvmImageGenerationRequestEvent"), +) +typealias NIP90ImageGenerationRequestEvent = DvmImageGenerationRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageGeneration/NIP90ImageGenerationResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageGeneration/DvmImageGenerationResponseEvent.kt similarity index 80% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageGeneration/NIP90ImageGenerationResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageGeneration/DvmImageGenerationResponseEvent.kt index ef07dd5fee..7978dc4aab 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageGeneration/NIP90ImageGenerationResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageGeneration/DvmImageGenerationResponseEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90ImageGenerationResponseEvent( +class DvmImageGenerationResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -41,9 +41,15 @@ class NIP90ImageGenerationResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmImageGenerationResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmImageGenerationResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.imageGeneration.DvmImageGenerationResponseEvent"), +) +typealias NIP90ImageGenerationResponseEvent = DvmImageGenerationResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageToVideo/NIP90ImageToVideoRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageToVideo/DvmImageToVideoRequestEvent.kt similarity index 84% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageToVideo/NIP90ImageToVideoRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageToVideo/DvmImageToVideoRequestEvent.kt index 98557b94d5..a4d875fbaa 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageToVideo/NIP90ImageToVideoRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageToVideo/DvmImageToVideoRequestEvent.kt @@ -32,7 +32,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.inputs import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90ImageToVideoRequestEvent( +class DvmImageToVideoRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -50,10 +50,16 @@ class NIP90ImageToVideoRequestEvent( fun build( imageUrl: String, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { inputUrl(imageUrl) initializer() } } } + +@Deprecated( + "Renamed to DvmImageToVideoRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmImageToVideoRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.imageToVideo.DvmImageToVideoRequestEvent"), +) +typealias NIP90ImageToVideoRequestEvent = DvmImageToVideoRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageToVideo/NIP90ImageToVideoResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageToVideo/DvmImageToVideoResponseEvent.kt similarity index 81% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageToVideo/NIP90ImageToVideoResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageToVideo/DvmImageToVideoResponseEvent.kt index 9e3c21edfa..2fe0247505 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageToVideo/NIP90ImageToVideoResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/imageToVideo/DvmImageToVideoResponseEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90ImageToVideoResponseEvent( +class DvmImageToVideoResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -41,9 +41,15 @@ class NIP90ImageToVideoResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmImageToVideoResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmImageToVideoResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.imageToVideo.DvmImageToVideoResponseEvent"), +) +typealias NIP90ImageToVideoResponseEvent = DvmImageToVideoResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/malwareScanning/NIP90MalwareScanRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/malwareScanning/DvmMalwareScanRequestEvent.kt similarity index 84% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/malwareScanning/NIP90MalwareScanRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/malwareScanning/DvmMalwareScanRequestEvent.kt index af90743b08..9486fb274c 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/malwareScanning/NIP90MalwareScanRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/malwareScanning/DvmMalwareScanRequestEvent.kt @@ -32,7 +32,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.inputs import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90MalwareScanRequestEvent( +class DvmMalwareScanRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -50,10 +50,16 @@ class NIP90MalwareScanRequestEvent( fun build( fileUrl: String, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { inputUrl(fileUrl) initializer() } } } + +@Deprecated( + "Renamed to DvmMalwareScanRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmMalwareScanRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.malwareScanning.DvmMalwareScanRequestEvent"), +) +typealias NIP90MalwareScanRequestEvent = DvmMalwareScanRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/malwareScanning/NIP90MalwareScanResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/malwareScanning/DvmMalwareScanResponseEvent.kt similarity index 81% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/malwareScanning/NIP90MalwareScanResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/malwareScanning/DvmMalwareScanResponseEvent.kt index 37aae8e6df..d6cdace38d 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/malwareScanning/NIP90MalwareScanResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/malwareScanning/DvmMalwareScanResponseEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90MalwareScanResponseEvent( +class DvmMalwareScanResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -43,9 +43,15 @@ class NIP90MalwareScanResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmMalwareScanResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmMalwareScanResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.malwareScanning.DvmMalwareScanResponseEvent"), +) +typealias NIP90MalwareScanResponseEvent = DvmMalwareScanResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/opReturn/NIP90OpReturnRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/opReturn/DvmOpReturnRequestEvent.kt similarity index 85% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/opReturn/NIP90OpReturnRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/opReturn/DvmOpReturnRequestEvent.kt index 2cf9def354..478ab68e93 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/opReturn/NIP90OpReturnRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/opReturn/DvmOpReturnRequestEvent.kt @@ -32,7 +32,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.inputs import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90OpReturnRequestEvent( +class DvmOpReturnRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -51,10 +51,16 @@ class NIP90OpReturnRequestEvent( fun build( text: String, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { inputText(text) initializer() } } } + +@Deprecated( + "Renamed to DvmOpReturnRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmOpReturnRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.opReturn.DvmOpReturnRequestEvent"), +) +typealias NIP90OpReturnRequestEvent = DvmOpReturnRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/opReturn/NIP90OpReturnResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/opReturn/DvmOpReturnResponseEvent.kt similarity index 82% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/opReturn/NIP90OpReturnResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/opReturn/DvmOpReturnResponseEvent.kt index 9e9b8e986c..32007e843e 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/opReturn/NIP90OpReturnResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/opReturn/DvmOpReturnResponseEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90OpReturnResponseEvent( +class DvmOpReturnResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -43,9 +43,15 @@ class NIP90OpReturnResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmOpReturnResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmOpReturnResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.opReturn.DvmOpReturnResponseEvent"), +) +typealias NIP90OpReturnResponseEvent = DvmOpReturnResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/peopleSearch/NIP90PeopleSearchRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/peopleSearch/DvmPeopleSearchRequestEvent.kt similarity index 87% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/peopleSearch/NIP90PeopleSearchRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/peopleSearch/DvmPeopleSearchRequestEvent.kt index d542a5ccc9..a44279270c 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/peopleSearch/NIP90PeopleSearchRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/peopleSearch/DvmPeopleSearchRequestEvent.kt @@ -36,7 +36,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.param import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90PeopleSearchRequestEvent( +class DvmPeopleSearchRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -67,7 +67,7 @@ class NIP90PeopleSearchRequestEvent( searchQuery: String, maxResults: Int? = null, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { inputText(searchQuery) maxResults?.let { param("max_results", it.toString()) } @@ -75,3 +75,9 @@ class NIP90PeopleSearchRequestEvent( } } } + +@Deprecated( + "Renamed to DvmPeopleSearchRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmPeopleSearchRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.peopleSearch.DvmPeopleSearchRequestEvent"), +) +typealias NIP90PeopleSearchRequestEvent = DvmPeopleSearchRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/peopleSearch/NIP90PeopleSearchResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/peopleSearch/DvmPeopleSearchResponseEvent.kt similarity index 83% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/peopleSearch/NIP90PeopleSearchResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/peopleSearch/DvmPeopleSearchResponseEvent.kt index 6156985d53..05c7c163ac 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/peopleSearch/NIP90PeopleSearchResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/peopleSearch/DvmPeopleSearchResponseEvent.kt @@ -30,7 +30,7 @@ import com.vitorpamplona.quartz.utils.Log import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90PeopleSearchResponseEvent( +class DvmPeopleSearchResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -61,7 +61,7 @@ class NIP90PeopleSearchResponseEvent( } } } catch (e: Throwable) { - Log.w("NIP90PeopleSearchResponseEvent") { "Error parsing the JSON ${e.message}" } + Log.w("DvmPeopleSearchResponseEvent") { "Error parsing the JSON ${e.message}" } } return people ?: listOf() @@ -72,9 +72,15 @@ class NIP90PeopleSearchResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmPeopleSearchResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmPeopleSearchResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.peopleSearch.DvmPeopleSearchResponseEvent"), +) +typealias NIP90PeopleSearchResponseEvent = DvmPeopleSearchResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/status/NIP90StatusEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/status/DvmStatusEvent.kt similarity index 85% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/status/NIP90StatusEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/status/DvmStatusEvent.kt index c01eb4cc38..e14e41468c 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/status/NIP90StatusEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/status/DvmStatusEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90StatusEvent( +class DvmStatusEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -45,9 +45,15 @@ class NIP90StatusEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmStatusEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmStatusEvent", "com.vitorpamplona.quartz.nip90Dvms.status.DvmStatusEvent"), +) +typealias NIP90StatusEvent = DvmStatusEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/status/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/status/TagArrayBuilderExt.kt index ff12777c74..bc919bff57 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/status/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/status/TagArrayBuilderExt.kt @@ -24,14 +24,14 @@ import com.vitorpamplona.quartz.nip01Core.core.TagArrayBuilder import com.vitorpamplona.quartz.nip90Dvms.status.tags.AmountTag import com.vitorpamplona.quartz.nip90Dvms.status.tags.StatusTag -fun TagArrayBuilder.status( +fun TagArrayBuilder.status( code: String, description: String, ) = addUnique(StatusTag.assemble(code, description)) -fun TagArrayBuilder.amount(amount: Long) = addUnique(AmountTag.assemble(amount)) +fun TagArrayBuilder.amount(amount: Long) = addUnique(AmountTag.assemble(amount)) -fun TagArrayBuilder.amount( +fun TagArrayBuilder.amount( amount: Long, lnInvoice: String, ) = addUnique(AmountTag.assemble(amount, lnInvoice)) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/summarization/NIP90SummarizationRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/summarization/DvmSummarizationRequestEvent.kt similarity index 85% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/summarization/NIP90SummarizationRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/summarization/DvmSummarizationRequestEvent.kt index 3e7cf4a0db..aaf23220b0 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/summarization/NIP90SummarizationRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/summarization/DvmSummarizationRequestEvent.kt @@ -35,7 +35,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.param import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90SummarizationRequestEvent( +class DvmSummarizationRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -57,7 +57,7 @@ class NIP90SummarizationRequestEvent( length: String? = null, outputMimeType: String? = null, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { eventIds.forEach { inputEvent(it) } length?.let { param("length", it) } @@ -66,3 +66,9 @@ class NIP90SummarizationRequestEvent( } } } + +@Deprecated( + "Renamed to DvmSummarizationRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmSummarizationRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.summarization.DvmSummarizationRequestEvent"), +) +typealias NIP90SummarizationRequestEvent = DvmSummarizationRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/summarization/NIP90SummarizationResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/summarization/DvmSummarizationResponseEvent.kt similarity index 80% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/summarization/NIP90SummarizationResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/summarization/DvmSummarizationResponseEvent.kt index d4b97ca533..9b04b3ffa0 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/summarization/NIP90SummarizationResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/summarization/DvmSummarizationResponseEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90SummarizationResponseEvent( +class DvmSummarizationResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -41,9 +41,15 @@ class NIP90SummarizationResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmSummarizationResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmSummarizationResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.summarization.DvmSummarizationResponseEvent"), +) +typealias NIP90SummarizationResponseEvent = DvmSummarizationResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textExtraction/NIP90TextExtractionRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textExtraction/DvmTextExtractionRequestEvent.kt similarity index 87% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textExtraction/NIP90TextExtractionRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textExtraction/DvmTextExtractionRequestEvent.kt index c61c29b542..8ea2ad8cca 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textExtraction/NIP90TextExtractionRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textExtraction/DvmTextExtractionRequestEvent.kt @@ -36,7 +36,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.param import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90TextExtractionRequestEvent( +class DvmTextExtractionRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -64,7 +64,7 @@ class NIP90TextExtractionRequestEvent( rangeEnd: String? = null, alignment: String? = null, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { inputUrl(inputUrl) outputMimeType?.let { output(it) } @@ -76,3 +76,9 @@ class NIP90TextExtractionRequestEvent( } } } + +@Deprecated( + "Renamed to DvmTextExtractionRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmTextExtractionRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.textExtraction.DvmTextExtractionRequestEvent"), +) +typealias NIP90TextExtractionRequestEvent = DvmTextExtractionRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textExtraction/NIP90TextExtractionResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textExtraction/DvmTextExtractionResponseEvent.kt similarity index 80% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textExtraction/NIP90TextExtractionResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textExtraction/DvmTextExtractionResponseEvent.kt index ae808faa45..814f311d3e 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textExtraction/NIP90TextExtractionResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textExtraction/DvmTextExtractionResponseEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90TextExtractionResponseEvent( +class DvmTextExtractionResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -41,9 +41,15 @@ class NIP90TextExtractionResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmTextExtractionResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmTextExtractionResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.textExtraction.DvmTextExtractionResponseEvent"), +) +typealias NIP90TextExtractionResponseEvent = DvmTextExtractionResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textGeneration/NIP90TextGenerationRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textGeneration/DvmTextGenerationRequestEvent.kt similarity index 90% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textGeneration/NIP90TextGenerationRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textGeneration/DvmTextGenerationRequestEvent.kt index 6554dd73ab..2e0f57fdde 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textGeneration/NIP90TextGenerationRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textGeneration/DvmTextGenerationRequestEvent.kt @@ -37,7 +37,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.param import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90TextGenerationRequestEvent( +class DvmTextGenerationRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -88,7 +88,7 @@ class NIP90TextGenerationRequestEvent( frequencyPenalty: Double? = null, outputMimeType: String? = null, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { inputPrompt(prompt) model?.let { param("model", it) } @@ -102,3 +102,9 @@ class NIP90TextGenerationRequestEvent( } } } + +@Deprecated( + "Renamed to DvmTextGenerationRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmTextGenerationRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.textGeneration.DvmTextGenerationRequestEvent"), +) +typealias NIP90TextGenerationRequestEvent = DvmTextGenerationRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textGeneration/NIP90TextGenerationResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textGeneration/DvmTextGenerationResponseEvent.kt similarity index 80% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textGeneration/NIP90TextGenerationResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textGeneration/DvmTextGenerationResponseEvent.kt index ded0df9d9b..2619816759 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textGeneration/NIP90TextGenerationResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textGeneration/DvmTextGenerationResponseEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90TextGenerationResponseEvent( +class DvmTextGenerationResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -41,9 +41,15 @@ class NIP90TextGenerationResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmTextGenerationResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmTextGenerationResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.textGeneration.DvmTextGenerationResponseEvent"), +) +typealias NIP90TextGenerationResponseEvent = DvmTextGenerationResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textToSpeech/NIP90TextToSpeechRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textToSpeech/DvmTextToSpeechRequestEvent.kt similarity index 87% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textToSpeech/NIP90TextToSpeechRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textToSpeech/DvmTextToSpeechRequestEvent.kt index 251fe7b510..41427dbb9e 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textToSpeech/NIP90TextToSpeechRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textToSpeech/DvmTextToSpeechRequestEvent.kt @@ -36,7 +36,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.param import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90TextToSpeechRequestEvent( +class DvmTextToSpeechRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -67,7 +67,7 @@ class NIP90TextToSpeechRequestEvent( text: String, language: String? = null, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { inputText(text) language?.let { param("language", it) } @@ -75,3 +75,9 @@ class NIP90TextToSpeechRequestEvent( } } } + +@Deprecated( + "Renamed to DvmTextToSpeechRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmTextToSpeechRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.textToSpeech.DvmTextToSpeechRequestEvent"), +) +typealias NIP90TextToSpeechRequestEvent = DvmTextToSpeechRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textToSpeech/NIP90TextToSpeechResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textToSpeech/DvmTextToSpeechResponseEvent.kt similarity index 81% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textToSpeech/NIP90TextToSpeechResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textToSpeech/DvmTextToSpeechResponseEvent.kt index 01cbf1e0ca..2a76d0f54a 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textToSpeech/NIP90TextToSpeechResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/textToSpeech/DvmTextToSpeechResponseEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90TextToSpeechResponseEvent( +class DvmTextToSpeechResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -41,9 +41,15 @@ class NIP90TextToSpeechResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmTextToSpeechResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmTextToSpeechResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.textToSpeech.DvmTextToSpeechResponseEvent"), +) +typealias NIP90TextToSpeechResponseEvent = DvmTextToSpeechResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/translation/NIP90TranslationRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/translation/DvmTranslationRequestEvent.kt similarity index 85% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/translation/NIP90TranslationRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/translation/DvmTranslationRequestEvent.kt index aed285ea54..560842a3cd 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/translation/NIP90TranslationRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/translation/DvmTranslationRequestEvent.kt @@ -33,7 +33,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.param import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90TranslationRequestEvent( +class DvmTranslationRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -52,7 +52,7 @@ class NIP90TranslationRequestEvent( eventIds: List, language: String, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { eventIds.forEach { inputEvent(it) } param("language", language) @@ -60,3 +60,9 @@ class NIP90TranslationRequestEvent( } } } + +@Deprecated( + "Renamed to DvmTranslationRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmTranslationRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.translation.DvmTranslationRequestEvent"), +) +typealias NIP90TranslationRequestEvent = DvmTranslationRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/translation/NIP90TranslationResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/translation/DvmTranslationResponseEvent.kt similarity index 81% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/translation/NIP90TranslationResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/translation/DvmTranslationResponseEvent.kt index b43ef64283..a051d8a242 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/translation/NIP90TranslationResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/translation/DvmTranslationResponseEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90TranslationResponseEvent( +class DvmTranslationResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -41,9 +41,15 @@ class NIP90TranslationResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmTranslationResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmTranslationResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.translation.DvmTranslationResponseEvent"), +) +typealias NIP90TranslationResponseEvent = DvmTranslationResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/userDiscoveryRequest/NIP90UserDiscoveryRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/userDiscoveryRequest/DvmUserDiscoveryRequestEvent.kt similarity index 83% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/userDiscoveryRequest/NIP90UserDiscoveryRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/userDiscoveryRequest/DvmUserDiscoveryRequestEvent.kt index be937e06fe..a3482cd7e7 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/userDiscoveryRequest/NIP90UserDiscoveryRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/userDiscoveryRequest/DvmUserDiscoveryRequestEvent.kt @@ -31,7 +31,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.inputs import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90UserDiscoveryRequestEvent( +class DvmUserDiscoveryRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -50,9 +50,15 @@ class NIP90UserDiscoveryRequestEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmUserDiscoveryRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmUserDiscoveryRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.userDiscoveryRequest.DvmUserDiscoveryRequestEvent"), +) +typealias NIP90UserDiscoveryRequestEvent = DvmUserDiscoveryRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/userDiscoveryResponse/NIP90UserDiscoveryResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/userDiscoveryResponse/DvmUserDiscoveryResponseEvent.kt similarity index 82% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/userDiscoveryResponse/NIP90UserDiscoveryResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/userDiscoveryResponse/DvmUserDiscoveryResponseEvent.kt index ba220f40bd..28d3d42e05 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/userDiscoveryResponse/NIP90UserDiscoveryResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/userDiscoveryResponse/DvmUserDiscoveryResponseEvent.kt @@ -30,7 +30,7 @@ import com.vitorpamplona.quartz.utils.Log import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90UserDiscoveryResponseEvent( +class DvmUserDiscoveryResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -61,7 +61,7 @@ class NIP90UserDiscoveryResponseEvent( } } } catch (e: Throwable) { - Log.w("NIP90UserDiscoveryResponseEvent") { "Error parsing the JSON ${e.message}" } + Log.w("DvmUserDiscoveryResponseEvent") { "Error parsing the JSON ${e.message}" } } return people ?: listOf() @@ -72,9 +72,15 @@ class NIP90UserDiscoveryResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmUserDiscoveryResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmUserDiscoveryResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.userDiscoveryResponse.DvmUserDiscoveryResponseEvent"), +) +typealias NIP90UserDiscoveryResponseEvent = DvmUserDiscoveryResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoConversion/NIP90VideoConversionRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoConversion/DvmVideoConversionRequestEvent.kt similarity index 86% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoConversion/NIP90VideoConversionRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoConversion/DvmVideoConversionRequestEvent.kt index ffc3adc0c5..d438273af9 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoConversion/NIP90VideoConversionRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoConversion/DvmVideoConversionRequestEvent.kt @@ -35,7 +35,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.param import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90VideoConversionRequestEvent( +class DvmVideoConversionRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -60,7 +60,7 @@ class NIP90VideoConversionRequestEvent( rangeStart: String? = null, rangeEnd: String? = null, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { inputUrl(videoUrl) outputMimeType?.let { output(it) } @@ -71,3 +71,9 @@ class NIP90VideoConversionRequestEvent( } } } + +@Deprecated( + "Renamed to DvmVideoConversionRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmVideoConversionRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.videoConversion.DvmVideoConversionRequestEvent"), +) +typealias NIP90VideoConversionRequestEvent = DvmVideoConversionRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoConversion/NIP90VideoConversionResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoConversion/DvmVideoConversionResponseEvent.kt similarity index 80% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoConversion/NIP90VideoConversionResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoConversion/DvmVideoConversionResponseEvent.kt index ebd7a9031c..923217e476 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoConversion/NIP90VideoConversionResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoConversion/DvmVideoConversionResponseEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90VideoConversionResponseEvent( +class DvmVideoConversionResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -41,9 +41,15 @@ class NIP90VideoConversionResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmVideoConversionResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmVideoConversionResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.videoConversion.DvmVideoConversionResponseEvent"), +) +typealias NIP90VideoConversionResponseEvent = DvmVideoConversionResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoTranslation/NIP90VideoTranslationRequestEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoTranslation/DvmVideoTranslationRequestEvent.kt similarity index 87% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoTranslation/NIP90VideoTranslationRequestEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoTranslation/DvmVideoTranslationRequestEvent.kt index 859be0382c..7df77e7a7f 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoTranslation/NIP90VideoTranslationRequestEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoTranslation/DvmVideoTranslationRequestEvent.kt @@ -36,7 +36,7 @@ import com.vitorpamplona.quartz.nip90Dvms.tags.param import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90VideoTranslationRequestEvent( +class DvmVideoTranslationRequestEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -67,7 +67,7 @@ class NIP90VideoTranslationRequestEvent( rangeEnd: String? = null, outputFormat: String? = null, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { inputUrl(videoUrl) param("language", language) @@ -80,3 +80,9 @@ class NIP90VideoTranslationRequestEvent( } } } + +@Deprecated( + "Renamed to DvmVideoTranslationRequestEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmVideoTranslationRequestEvent", "com.vitorpamplona.quartz.nip90Dvms.videoTranslation.DvmVideoTranslationRequestEvent"), +) +typealias NIP90VideoTranslationRequestEvent = DvmVideoTranslationRequestEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoTranslation/NIP90VideoTranslationResponseEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoTranslation/DvmVideoTranslationResponseEvent.kt similarity index 80% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoTranslation/NIP90VideoTranslationResponseEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoTranslation/DvmVideoTranslationResponseEvent.kt index cea768fdd5..a1ee14aa54 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoTranslation/NIP90VideoTranslationResponseEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip90Dvms/videoTranslation/DvmVideoTranslationResponseEvent.kt @@ -28,7 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.eventTemplate import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class NIP90VideoTranslationResponseEvent( +class DvmVideoTranslationResponseEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -41,9 +41,15 @@ class NIP90VideoTranslationResponseEvent( fun build( createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, "", createdAt) { initializer() } } } + +@Deprecated( + "Renamed to DvmVideoTranslationResponseEvent. NIP-90 Data Vending Machine events use the Dvm prefix.", + ReplaceWith("DvmVideoTranslationResponseEvent", "com.vitorpamplona.quartz.nip90Dvms.videoTranslation.DvmVideoTranslationResponseEvent"), +) +typealias NIP90VideoTranslationResponseEvent = DvmVideoTranslationResponseEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip94FileMetadata/FileHeaderEvent.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip94FileMetadata/FileMetadataEvent.kt similarity index 93% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip94FileMetadata/FileHeaderEvent.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip94FileMetadata/FileMetadataEvent.kt index 6ac3a389cf..d4e9cfd79d 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip94FileMetadata/FileHeaderEvent.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip94FileMetadata/FileMetadataEvent.kt @@ -46,7 +46,7 @@ import com.vitorpamplona.quartz.nip94FileMetadata.tags.UrlTag import com.vitorpamplona.quartz.utils.TimeUtils @Immutable -class FileHeaderEvent( +class FileMetadataEvent( id: HexKey, pubKey: HexKey, createdAt: Long, @@ -105,7 +105,7 @@ class FileHeaderEvent( url: String, caption: String?, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, caption ?: "", createdAt) { url(url) // NIP-94 accessibility description of the file (kept; the deprecated @@ -127,7 +127,7 @@ class FileHeaderEvent( magnetUri: String? = null, torrentInfoHash: String? = null, createdAt: Long = TimeUtils.now(), - initializer: TagArrayBuilder.() -> Unit = {}, + initializer: TagArrayBuilder.() -> Unit = {}, ) = eventTemplate(KIND, caption ?: "", createdAt) { url(url) // NIP-94 accessibility description of the file (kept; the deprecated @@ -148,3 +148,9 @@ class FileHeaderEvent( } } } + +@Deprecated( + "Renamed to FileMetadataEvent. NIP-94 names kind 1063 file metadata.", + ReplaceWith("FileMetadataEvent", "com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent"), +) +typealias FileHeaderEvent = FileMetadataEvent diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip94FileMetadata/TagArrayBuilderExt.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip94FileMetadata/TagArrayBuilderExt.kt index e000583d6e..d89c862235 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip94FileMetadata/TagArrayBuilderExt.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip94FileMetadata/TagArrayBuilderExt.kt @@ -38,32 +38,32 @@ import com.vitorpamplona.quartz.nip94FileMetadata.tags.ThumbhashTag import com.vitorpamplona.quartz.nip94FileMetadata.tags.TorrentInfoHash import com.vitorpamplona.quartz.nip94FileMetadata.tags.UrlTag -fun TagArrayBuilder.url(url: String) = add(UrlTag.assemble(url)) +fun TagArrayBuilder.url(url: String) = add(UrlTag.assemble(url)) -fun TagArrayBuilder.mimeType(mimeType: String) = add(MimeTypeTag.assemble(mimeType)) +fun TagArrayBuilder.mimeType(mimeType: String) = add(MimeTypeTag.assemble(mimeType)) -fun TagArrayBuilder.hash(hash: HexKey) = add(HashSha256Tag.assemble(hash)) +fun TagArrayBuilder.hash(hash: HexKey) = add(HashSha256Tag.assemble(hash)) -fun TagArrayBuilder.fileSize(size: Int) = add(SizeTag.assemble(size)) +fun TagArrayBuilder.fileSize(size: Int) = add(SizeTag.assemble(size)) -fun TagArrayBuilder.dimension(dim: DimensionTag) = add(DimensionTag.assemble(dim)) +fun TagArrayBuilder.dimension(dim: DimensionTag) = add(DimensionTag.assemble(dim)) -fun TagArrayBuilder.blurhash(blurhash: String) = add(BlurhashTag.assemble(blurhash)) +fun TagArrayBuilder.blurhash(blurhash: String) = add(BlurhashTag.assemble(blurhash)) -fun TagArrayBuilder.thumbhash(thumbhash: String) = add(ThumbhashTag.assemble(thumbhash)) +fun TagArrayBuilder.thumbhash(thumbhash: String) = add(ThumbhashTag.assemble(thumbhash)) -fun TagArrayBuilder.originalHash(hash: HexKey) = add(OriginalHashTag.assemble(hash)) +fun TagArrayBuilder.originalHash(hash: HexKey) = add(OriginalHashTag.assemble(hash)) -fun TagArrayBuilder.torrentInfohash(hash: String) = add(TorrentInfoHash.assemble(hash)) +fun TagArrayBuilder.torrentInfohash(hash: String) = add(TorrentInfoHash.assemble(hash)) -fun TagArrayBuilder.magnet(magnetUri: String) = add(MagnetTag.assemble(magnetUri)) +fun TagArrayBuilder.magnet(magnetUri: String) = add(MagnetTag.assemble(magnetUri)) -fun TagArrayBuilder.image(imageUrl: HexKey) = add(ImageTag.assemble(imageUrl)) +fun TagArrayBuilder.image(imageUrl: HexKey) = add(ImageTag.assemble(imageUrl)) -fun TagArrayBuilder.thumb(trumbUrl: HexKey) = add(ThumbTag.assemble(trumbUrl)) +fun TagArrayBuilder.thumb(trumbUrl: HexKey) = add(ThumbTag.assemble(trumbUrl)) -fun TagArrayBuilder.summary(summary: HexKey) = add(SummaryTag.assemble(summary)) +fun TagArrayBuilder.summary(summary: HexKey) = add(SummaryTag.assemble(summary)) -fun TagArrayBuilder.fallback(fallbackUrl: HexKey) = add(FallbackTag.assemble(fallbackUrl)) +fun TagArrayBuilder.fallback(fallbackUrl: HexKey) = add(FallbackTag.assemble(fallbackUrl)) -fun TagArrayBuilder.service(service: HexKey) = add(ServiceTag.assemble(service)) +fun TagArrayBuilder.service(service: HexKey) = add(ServiceTag.assemble(service)) diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/EventFactory.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/EventFactory.kt index 15d8d83388..d852130e87 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/EventFactory.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/EventFactory.kt @@ -181,8 +181,8 @@ import com.vitorpamplona.quartz.nip01Core.crypto.EventHasher import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent import com.vitorpamplona.quartz.nip03Timestamp.OtsEvent -import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip04Dm.messages.EncryptedDmEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip15Marketplace.auction.AuctionEvent import com.vitorpamplona.quartz.nip15Marketplace.bid.BidEvent @@ -192,38 +192,38 @@ import com.vitorpamplona.quartz.nip15Marketplace.product.ProductEvent import com.vitorpamplona.quartz.nip15Marketplace.stall.StallEvent import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent -import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent +import com.vitorpamplona.quartz.nip17Dm.settings.DmRelayListEvent import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent import com.vitorpamplona.quartz.nip18Reposts.RepostEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip25Reactions.ExternalReactionEvent import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelHideMessageEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMetadataEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelMuteUserEvent -import com.vitorpamplona.quartz.nip28PublicChat.list.ChannelListEvent +import com.vitorpamplona.quartz.nip28PublicChat.list.PublicChatListEvent import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupAdminsEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMembersEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMetadataEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupParticipantsEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupPinnedEvent -import com.vitorpamplona.quartz.nip29RelayGroups.metadata.SupportedRolesEvent +import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupRolesEvent import com.vitorpamplona.quartz.nip29RelayGroups.moderation.CreateGroupEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.CreateInviteEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.DeleteEventEvent import com.vitorpamplona.quartz.nip29RelayGroups.moderation.DeleteGroupEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.EditMetadataEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.PutUserEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.RemoveUserEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.UpdatePinListEvent -import com.vitorpamplona.quartz.nip29RelayGroups.request.JoinRequestEvent -import com.vitorpamplona.quartz.nip29RelayGroups.request.LeaveRequestEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupCreateInviteEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupDeleteEventEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupEditMetadataEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupPutUserEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupRemoveUserEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupUpdatePinListEvent +import com.vitorpamplona.quartz.nip29RelayGroups.request.GroupJoinRequestEvent +import com.vitorpamplona.quartz.nip29RelayGroups.request.GroupLeaveRequestEvent import com.vitorpamplona.quartz.nip29RelayGroups.tags.GroupIdTag import com.vitorpamplona.quartz.nip30CustomEmoji.pack.EmojiPackEvent -import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiPackSelectionEvent +import com.vitorpamplona.quartz.nip30CustomEmoji.selection.EmojiListEvent import com.vitorpamplona.quartz.nip32Labeling.LabelEvent import com.vitorpamplona.quartz.nip34Git.grasp.UserGraspListEvent import com.vitorpamplona.quartz.nip34Git.issue.GitIssueEvent @@ -241,7 +241,7 @@ import com.vitorpamplona.quartz.nip35Torrents.TorrentCommentEvent import com.vitorpamplona.quartz.nip35Torrents.TorrentEvent import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent import com.vitorpamplona.quartz.nip37Drafts.privateOutbox.PrivateOutboxRelayListEvent -import com.vitorpamplona.quartz.nip38UserStatus.StatusEvent +import com.vitorpamplona.quartz.nip38UserStatus.UserStatusEvent import com.vitorpamplona.quartz.nip39ExtIdentities.ExternalIdentitiesEvent import com.vitorpamplona.quartz.nip42RelayAuth.RelayAuthEvent import com.vitorpamplona.quartz.nip43RelayMembers.addMember.RelayAddMemberEvent @@ -251,10 +251,10 @@ import com.vitorpamplona.quartz.nip43RelayMembers.leaveRequest.RelayLeaveRequest import com.vitorpamplona.quartz.nip43RelayMembers.list.RelayMembershipListEvent import com.vitorpamplona.quartz.nip43RelayMembers.removeMember.RelayRemoveMemberEvent import com.vitorpamplona.quartz.nip46RemoteSigner.NostrConnectEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcInfoEvent import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcNotificationEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent import com.vitorpamplona.quartz.nip51Lists.PinListEvent import com.vitorpamplona.quartz.nip51Lists.appCurationSet.AppCurationSetEvent @@ -262,26 +262,26 @@ import com.vitorpamplona.quartz.nip51Lists.articleCurationSet.ArticleCurationSet import com.vitorpamplona.quartz.nip51Lists.bookmarkList.BookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.bookmarkList.OldBookmarkListEvent import com.vitorpamplona.quartz.nip51Lists.favoriteAlgoFeedsList.FavoriteAlgoFeedsListEvent -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip51Lists.geohashList.GeohashListEvent import com.vitorpamplona.quartz.nip51Lists.gitAuthorList.GitAuthorListEvent import com.vitorpamplona.quartz.nip51Lists.gitRepositoryList.GitRepositoryListEvent import com.vitorpamplona.quartz.nip51Lists.goodWikiAuthorList.GoodWikiAuthorListEvent import com.vitorpamplona.quartz.nip51Lists.goodWikiRelayList.GoodWikiRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.hashtagList.HashtagListEvent +import com.vitorpamplona.quartz.nip51Lists.hashtagList.InterestListEvent import com.vitorpamplona.quartz.nip51Lists.interestSet.InterestSetEvent import com.vitorpamplona.quartz.nip51Lists.kindMuteSet.KindMuteSetEvent -import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.LabeledBookmarkListEvent +import com.vitorpamplona.quartz.nip51Lists.labeledBookmarkList.BookmarkSetEvent import com.vitorpamplona.quartz.nip51Lists.mediaFollowList.MediaFollowListEvent import com.vitorpamplona.quartz.nip51Lists.mediaStarterPack.MediaStarterPackEvent import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent -import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent +import com.vitorpamplona.quartz.nip51Lists.peopleList.FollowSetEvent import com.vitorpamplona.quartz.nip51Lists.pictureCurationSet.PictureCurationSetEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BlockedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.BroadcastRelayListEvent +import com.vitorpamplona.quartz.nip51Lists.relayLists.FavoriteRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.IndexerRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.ProxyRelayListEvent -import com.vitorpamplona.quartz.nip51Lists.relayLists.RelayFeedsListEvent import com.vitorpamplona.quartz.nip51Lists.relayLists.TrustedRelayListEvent import com.vitorpamplona.quartz.nip51Lists.relaySets.RelaySetEvent import com.vitorpamplona.quartz.nip51Lists.releaseArtifactSet.ReleaseArtifactSetEvent @@ -289,7 +289,7 @@ import com.vitorpamplona.quartz.nip51Lists.simpleGroupList.SimpleGroupListEvent import com.vitorpamplona.quartz.nip51Lists.videoCurationSet.VideoCurationSetEvent import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import com.vitorpamplona.quartz.nip52Calendar.rsvp.CalendarRSVPEvent import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent import com.vitorpamplona.quartz.nip53LiveActivities.clip.LiveActivitiesClipEvent @@ -299,19 +299,19 @@ import com.vitorpamplona.quartz.nip53LiveActivities.nestsServers.NestsServersEve import com.vitorpamplona.quartz.nip53LiveActivities.presence.MeetingRoomPresenceEvent import com.vitorpamplona.quartz.nip53LiveActivities.raid.LiveActivitiesRaidEvent import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent +import com.vitorpamplona.quartz.nip54Wiki.WikiArticleEvent import com.vitorpamplona.quartz.nip54Wiki.WikiMergeAcceptanceEvent import com.vitorpamplona.quartz.nip54Wiki.WikiMergeRequestEvent -import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent import com.vitorpamplona.quartz.nip54Wiki.WikiRedirectEvent import com.vitorpamplona.quartz.nip56Reports.ReportEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.nip58Badges.accepted.AcceptedBadgeSetEvent import com.vitorpamplona.quartz.nip58Badges.award.BadgeAwardEvent import com.vitorpamplona.quartz.nip58Badges.definition.BadgeDefinitionEvent import com.vitorpamplona.quartz.nip58Badges.profile.ProfileBadgesEvent -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.EphemeralGiftWrapEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nip5aStaticWebsites.NamedSiteEvent @@ -325,8 +325,6 @@ import com.vitorpamplona.quartz.nip60Cashu.token.CashuTokenEvent import com.vitorpamplona.quartz.nip60Cashu.wallet.CashuWalletEvent import com.vitorpamplona.quartz.nip61Nutzaps.info.NutzapInfoEvent import com.vitorpamplona.quartz.nip61Nutzaps.nutzap.NutzapEvent -import com.vitorpamplona.quartz.nip61Nutzaps.redemption.NutzapRedemptionEvent -import com.vitorpamplona.quartz.nip61Nutzaps.token.TokenEvent import com.vitorpamplona.quartz.nip62RequestToVanish.RequestToVanishEvent import com.vitorpamplona.quartz.nip64Chess.challenge.accept.LiveChessGameAcceptEvent import com.vitorpamplona.quartz.nip64Chess.challenge.offer.LiveChessGameChallengeEvent @@ -340,16 +338,16 @@ import com.vitorpamplona.quartz.nip66RelayMonitor.discovery.RelayDiscoveryEvent import com.vitorpamplona.quartz.nip66RelayMonitor.monitor.RelayMonitorEvent import com.vitorpamplona.quartz.nip68Picture.PictureEvent import com.vitorpamplona.quartz.nip69P2pOrderEvents.P2POrderEvent -import com.vitorpamplona.quartz.nip71Video.VideoHorizontalEvent +import com.vitorpamplona.quartz.nip71Video.AddressableNormalVideoEvent +import com.vitorpamplona.quartz.nip71Video.AddressableShortVideoEvent import com.vitorpamplona.quartz.nip71Video.VideoNormalEvent import com.vitorpamplona.quartz.nip71Video.VideoShortEvent -import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent import com.vitorpamplona.quartz.nip71Video.textTrack.TextTrackEvent import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent import com.vitorpamplona.quartz.nip72ModCommunities.definition.CommunityDefinitionEvent import com.vitorpamplona.quartz.nip72ModCommunities.follow.CommunityListEvent import com.vitorpamplona.quartz.nip72ModCommunities.rules.CommunityRulesEvent -import com.vitorpamplona.quartz.nip75ZapGoals.GoalEvent +import com.vitorpamplona.quartz.nip75ZapGoals.ZapGoalEvent import com.vitorpamplona.quartz.nip78AppData.AppDataEvent import com.vitorpamplona.quartz.nip78AppData.AppSpecificDataEvent import com.vitorpamplona.quartz.nip7DThreads.ThreadEvent @@ -358,7 +356,7 @@ import com.vitorpamplona.quartz.nip85TrustedAssertions.addressables.AddressableA import com.vitorpamplona.quartz.nip85TrustedAssertions.events.EventAssertionEvent import com.vitorpamplona.quartz.nip85TrustedAssertions.externalIds.ExternalIdAssertionEvent import com.vitorpamplona.quartz.nip85TrustedAssertions.list.TrustProviderListEvent -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent import com.vitorpamplona.quartz.nip87Ecash.cashu.CashuMintEvent import com.vitorpamplona.quartz.nip87Ecash.fedimint.FedimintEvent import com.vitorpamplona.quartz.nip87Ecash.recommendation.MintRecommendationEvent @@ -366,47 +364,47 @@ import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip88Polls.response.PollResponseEvent import com.vitorpamplona.quartz.nip89AppHandlers.definition.AppDefinitionEvent import com.vitorpamplona.quartz.nip89AppHandlers.recommendation.AppRecommendationEvent -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.NIP90ContentDiscoveryRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.NIP90ContentDiscoveryResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.contentSearch.NIP90ContentSearchRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.contentSearch.NIP90ContentSearchResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryRequest.DvmContentDiscoveryRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.contentDiscoveryResponse.DvmContentDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.contentSearch.DvmContentSearchRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.contentSearch.DvmContentSearchResponseEvent import com.vitorpamplona.quartz.nip90Dvms.dvmHeartbeat.DvmHeartbeatEvent -import com.vitorpamplona.quartz.nip90Dvms.eventCount.NIP90EventCountRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.eventCount.NIP90EventCountResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.eventPowDelegation.NIP90EventPowDelegationRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.eventPowDelegation.NIP90EventPowDelegationResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.eventPublishSchedule.NIP90EventPublishScheduleRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.eventPublishSchedule.NIP90EventPublishScheduleResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.eventTimestamping.NIP90EventTimestampingRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.eventTimestamping.NIP90EventTimestampingResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.imageGeneration.NIP90ImageGenerationRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.imageGeneration.NIP90ImageGenerationResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.imageToVideo.NIP90ImageToVideoRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.imageToVideo.NIP90ImageToVideoResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.malwareScanning.NIP90MalwareScanRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.malwareScanning.NIP90MalwareScanResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.opReturn.NIP90OpReturnRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.opReturn.NIP90OpReturnResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.peopleSearch.NIP90PeopleSearchRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.peopleSearch.NIP90PeopleSearchResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.status.NIP90StatusEvent -import com.vitorpamplona.quartz.nip90Dvms.summarization.NIP90SummarizationRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.summarization.NIP90SummarizationResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.textExtraction.NIP90TextExtractionRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.textExtraction.NIP90TextExtractionResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.textGeneration.NIP90TextGenerationRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.textGeneration.NIP90TextGenerationResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.textToSpeech.NIP90TextToSpeechRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.textToSpeech.NIP90TextToSpeechResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.translation.NIP90TranslationRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.translation.NIP90TranslationResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.userDiscoveryRequest.NIP90UserDiscoveryRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.userDiscoveryResponse.NIP90UserDiscoveryResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.videoConversion.NIP90VideoConversionRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.videoConversion.NIP90VideoConversionResponseEvent -import com.vitorpamplona.quartz.nip90Dvms.videoTranslation.NIP90VideoTranslationRequestEvent -import com.vitorpamplona.quartz.nip90Dvms.videoTranslation.NIP90VideoTranslationResponseEvent -import com.vitorpamplona.quartz.nip94FileMetadata.FileHeaderEvent +import com.vitorpamplona.quartz.nip90Dvms.eventCount.DvmEventCountRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.eventCount.DvmEventCountResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.eventPowDelegation.DvmEventPowDelegationRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.eventPowDelegation.DvmEventPowDelegationResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.eventPublishSchedule.DvmEventPublishScheduleRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.eventPublishSchedule.DvmEventPublishScheduleResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.eventTimestamping.DvmEventTimestampingRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.eventTimestamping.DvmEventTimestampingResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.imageGeneration.DvmImageGenerationRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.imageGeneration.DvmImageGenerationResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.imageToVideo.DvmImageToVideoRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.imageToVideo.DvmImageToVideoResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.malwareScanning.DvmMalwareScanRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.malwareScanning.DvmMalwareScanResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.opReturn.DvmOpReturnRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.opReturn.DvmOpReturnResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.peopleSearch.DvmPeopleSearchRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.peopleSearch.DvmPeopleSearchResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.status.DvmStatusEvent +import com.vitorpamplona.quartz.nip90Dvms.summarization.DvmSummarizationRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.summarization.DvmSummarizationResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.textExtraction.DvmTextExtractionRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.textExtraction.DvmTextExtractionResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.textGeneration.DvmTextGenerationRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.textGeneration.DvmTextGenerationResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.textToSpeech.DvmTextToSpeechRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.textToSpeech.DvmTextToSpeechResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.translation.DvmTranslationRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.translation.DvmTranslationResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.userDiscoveryRequest.DvmUserDiscoveryRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.userDiscoveryResponse.DvmUserDiscoveryResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.videoConversion.DvmVideoConversionRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.videoConversion.DvmVideoConversionResponseEvent +import com.vitorpamplona.quartz.nip90Dvms.videoTranslation.DvmVideoTranslationRequestEvent +import com.vitorpamplona.quartz.nip90Dvms.videoTranslation.DvmVideoTranslationResponseEvent +import com.vitorpamplona.quartz.nip94FileMetadata.FileMetadataEvent import com.vitorpamplona.quartz.nip96FileStorage.config.FileServersEvent import com.vitorpamplona.quartz.nip98HttpAuth.HTTPAuthorizationEvent import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent @@ -570,7 +568,7 @@ class EventFactory { BookmarkListEvent.KIND -> BookmarkListEvent(id, pubKey, createdAt, tags, content, sig) OldBookmarkListEvent.KIND -> OldBookmarkListEvent(id, pubKey, createdAt, tags, content, sig) CalendarDateSlotEvent.KIND -> CalendarDateSlotEvent(id, pubKey, createdAt, tags, content, sig) - CalendarEvent.KIND -> CalendarEvent(id, pubKey, createdAt, tags, content, sig) + CalendarCollectionEvent.KIND -> CalendarCollectionEvent(id, pubKey, createdAt, tags, content, sig) CalendarTimeSlotEvent.KIND -> CalendarTimeSlotEvent(id, pubKey, createdAt, tags, content, sig) CalendarRSVPEvent.KIND -> CalendarRSVPEvent(id, pubKey, createdAt, tags, content, sig) CallAnswerEvent.KIND -> CallAnswerEvent(id, pubKey, createdAt, tags, content, sig) @@ -585,19 +583,19 @@ class EventFactory { CashuSpendingHistoryEvent.KIND -> CashuSpendingHistoryEvent(id, pubKey, createdAt, tags, content, sig) CashuWalletEvent.KIND -> CashuWalletEvent(id, pubKey, createdAt, tags, content, sig) ChatEvent.KIND -> ChatEvent(id, pubKey, createdAt, tags, content, sig) - PutUserEvent.KIND -> PutUserEvent(id, pubKey, createdAt, tags, content, sig) - RemoveUserEvent.KIND -> RemoveUserEvent(id, pubKey, createdAt, tags, content, sig) - EditMetadataEvent.KIND -> EditMetadataEvent(id, pubKey, createdAt, tags, content, sig) - DeleteEventEvent.KIND -> DeleteEventEvent(id, pubKey, createdAt, tags, content, sig) + GroupPutUserEvent.KIND -> GroupPutUserEvent(id, pubKey, createdAt, tags, content, sig) + GroupRemoveUserEvent.KIND -> GroupRemoveUserEvent(id, pubKey, createdAt, tags, content, sig) + GroupEditMetadataEvent.KIND -> GroupEditMetadataEvent(id, pubKey, createdAt, tags, content, sig) + GroupDeleteEventEvent.KIND -> GroupDeleteEventEvent(id, pubKey, createdAt, tags, content, sig) CreateGroupEvent.KIND -> CreateGroupEvent(id, pubKey, createdAt, tags, content, sig) DeleteGroupEvent.KIND -> DeleteGroupEvent(id, pubKey, createdAt, tags, content, sig) - CreateInviteEvent.KIND -> CreateInviteEvent(id, pubKey, createdAt, tags, content, sig) - JoinRequestEvent.KIND -> JoinRequestEvent(id, pubKey, createdAt, tags, content, sig) - LeaveRequestEvent.KIND -> LeaveRequestEvent(id, pubKey, createdAt, tags, content, sig) + GroupCreateInviteEvent.KIND -> GroupCreateInviteEvent(id, pubKey, createdAt, tags, content, sig) + GroupJoinRequestEvent.KIND -> GroupJoinRequestEvent(id, pubKey, createdAt, tags, content, sig) + GroupLeaveRequestEvent.KIND -> GroupLeaveRequestEvent(id, pubKey, createdAt, tags, content, sig) GroupMetadataEvent.KIND -> GroupMetadataEvent(id, pubKey, createdAt, tags, content, sig) GroupAdminsEvent.KIND -> GroupAdminsEvent(id, pubKey, createdAt, tags, content, sig) GroupMembersEvent.KIND -> GroupMembersEvent(id, pubKey, createdAt, tags, content, sig) - SupportedRolesEvent.KIND -> SupportedRolesEvent(id, pubKey, createdAt, tags, content, sig) + GroupRolesEvent.KIND -> GroupRolesEvent(id, pubKey, createdAt, tags, content, sig) GroupParticipantsEvent.KIND -> GroupParticipantsEvent(id, pubKey, createdAt, tags, content, sig) // kind:39005 is shared by two relay-signed, addressable events that never coexist on // one relay: NIP-29's group pin list (relay29 family) and Buzz's NIP-CW thread @@ -618,10 +616,10 @@ class EventFactory { } else { GroupPinnedEvent(id, pubKey, createdAt, tags, content, sig) } - UpdatePinListEvent.KIND -> UpdatePinListEvent(id, pubKey, createdAt, tags, content, sig) + GroupUpdatePinListEvent.KIND -> GroupUpdatePinListEvent(id, pubKey, createdAt, tags, content, sig) ChessGameEvent.KIND -> ChessGameEvent(id, pubKey, createdAt, tags, content, sig) CodeSnippetEvent.KIND -> CodeSnippetEvent(id, pubKey, createdAt, tags, content, sig) - RelayFeedsListEvent.KIND -> RelayFeedsListEvent(id, pubKey, createdAt, tags, content, sig) + FavoriteRelayListEvent.KIND -> FavoriteRelayListEvent(id, pubKey, createdAt, tags, content, sig) JesterEvent.KIND -> JesterEvent(id, pubKey, createdAt, tags, content, sig) LiveChessGameChallengeEvent.KIND -> LiveChessGameChallengeEvent(id, pubKey, createdAt, tags, content, sig) LiveChessGameAcceptEvent.KIND -> LiveChessGameAcceptEvent(id, pubKey, createdAt, tags, content, sig) @@ -630,13 +628,13 @@ class EventFactory { LiveChessDrawOfferEvent.KIND -> LiveChessDrawOfferEvent(id, pubKey, createdAt, tags, content, sig) ChannelCreateEvent.KIND -> ChannelCreateEvent(id, pubKey, createdAt, tags, content, sig) ChannelHideMessageEvent.KIND -> ChannelHideMessageEvent(id, pubKey, createdAt, tags, content, sig) - ChannelListEvent.KIND -> ChannelListEvent(id, pubKey, createdAt, tags, content, sig) + PublicChatListEvent.KIND -> PublicChatListEvent(id, pubKey, createdAt, tags, content, sig) ChannelMessageEvent.KIND -> ChannelMessageEvent(id, pubKey, createdAt, tags, content, sig) ChannelMetadataEvent.KIND -> ChannelMetadataEvent(id, pubKey, createdAt, tags, content, sig) ChannelMuteUserEvent.KIND -> ChannelMuteUserEvent(id, pubKey, createdAt, tags, content, sig) ChatMessageEncryptedFileHeaderEvent.KIND -> ChatMessageEncryptedFileHeaderEvent(id.ifBlank { EventHasher.hashId(pubKey, createdAt, kind, tags, content) }, pubKey, createdAt, tags, content, sig) ChatMessageEvent.KIND -> ChatMessageEvent(id.ifBlank { EventHasher.hashId(pubKey, createdAt, kind, tags, content) }, pubKey, createdAt, tags, content, sig) - ChatMessageRelayListEvent.KIND -> ChatMessageRelayListEvent(id, pubKey, createdAt, tags, content, sig) + DmRelayListEvent.KIND -> DmRelayListEvent(id, pubKey, createdAt, tags, content, sig) ClassifiedsEvent.KIND -> ClassifiedsEvent(id, pubKey, createdAt, tags, content, sig) CommentEvent.KIND -> CommentEvent(id, pubKey, createdAt, tags, content, sig) CommunityDefinitionEvent.KIND -> CommunityDefinitionEvent(id, pubKey, createdAt, tags, content, sig) @@ -644,21 +642,21 @@ class EventFactory { CommunityPostApprovalEvent.KIND -> CommunityPostApprovalEvent(id, pubKey, createdAt, tags, content, sig) CommunityRulesEvent.KIND -> CommunityRulesEvent(id, pubKey, createdAt, tags, content, sig) ContactListEvent.KIND -> ContactListEvent(id, pubKey, createdAt, tags, content, sig) - DeletionEvent.KIND -> DeletionEvent(id, pubKey, createdAt, tags, content, sig) + DeletionRequestEvent.KIND -> DeletionRequestEvent(id, pubKey, createdAt, tags, content, sig) DraftWrapEvent.KIND -> DraftWrapEvent(id, pubKey, createdAt, tags, content, sig) EmojiPackEvent.KIND -> EmojiPackEvent(id, pubKey, createdAt, tags, content, sig) - EmojiPackSelectionEvent.KIND -> EmojiPackSelectionEvent(id, pubKey, createdAt, tags, content, sig) + EmojiListEvent.KIND -> EmojiListEvent(id, pubKey, createdAt, tags, content, sig) EphemeralChatEvent.KIND -> EphemeralChatEvent(id, pubKey, createdAt, tags, content, sig) EphemeralChatListEvent.KIND -> EphemeralChatListEvent(id, pubKey, createdAt, tags, content, sig) ExternalIdentitiesEvent.KIND -> ExternalIdentitiesEvent(id, pubKey, createdAt, tags, content, sig) FedimintEvent.KIND -> FedimintEvent(id, pubKey, createdAt, tags, content, sig) - FileHeaderEvent.KIND -> FileHeaderEvent(id, pubKey, createdAt, tags, content, sig) + FileMetadataEvent.KIND -> FileMetadataEvent(id, pubKey, createdAt, tags, content, sig) ProfileGalleryEntryEvent.KIND -> ProfileGalleryEntryEvent(id, pubKey, createdAt, tags, content, sig) FileServersEvent.KIND -> FileServersEvent(id, pubKey, createdAt, tags, content, sig) FileStorageEvent.KIND -> FileStorageEvent(id, pubKey, createdAt, tags, content, sig) FileStorageHeaderEvent.KIND -> FileStorageHeaderEvent(id, pubKey, createdAt, tags, content, sig) FhirResourceEvent.KIND -> FhirResourceEvent(id, pubKey, createdAt, tags, content, sig) - FollowListEvent.KIND -> FollowListEvent(id, pubKey, createdAt, tags, content, sig) + StarterPackEvent.KIND -> StarterPackEvent(id, pubKey, createdAt, tags, content, sig) FundraiserEvent.KIND -> FundraiserEvent(id, pubKey, createdAt, tags, content, sig) GenericRepostEvent.KIND -> GenericRepostEvent(id, pubKey, createdAt, tags, content, sig) CyberspaceBagEvent.KIND -> CyberspaceBagEvent(id, pubKey, createdAt, tags, content, sig) @@ -701,9 +699,9 @@ class EventFactory { UserGraspListEvent.KIND -> UserGraspListEvent(id, pubKey, createdAt, tags, content, sig) GoodWikiAuthorListEvent.KIND -> GoodWikiAuthorListEvent(id, pubKey, createdAt, tags, content, sig) GoodWikiRelayListEvent.KIND -> GoodWikiRelayListEvent(id, pubKey, createdAt, tags, content, sig) - GoalEvent.KIND -> GoalEvent(id, pubKey, createdAt, tags, content, sig) + ZapGoalEvent.KIND -> ZapGoalEvent(id, pubKey, createdAt, tags, content, sig) FavoriteAlgoFeedsListEvent.KIND -> FavoriteAlgoFeedsListEvent(id, pubKey, createdAt, tags, content, sig) - HashtagListEvent.KIND -> HashtagListEvent(id, pubKey, createdAt, tags, content, sig) + InterestListEvent.KIND -> InterestListEvent(id, pubKey, createdAt, tags, content, sig) HighlightEvent.KIND -> HighlightEvent(id, pubKey, createdAt, tags, content, sig) HTTPAuthorizationEvent.KIND -> HTTPAuthorizationEvent(id, pubKey, createdAt, tags, content, sig) IndexerRelayListEvent.KIND -> IndexerRelayListEvent(id, pubKey, createdAt, tags, content, sig) @@ -713,14 +711,14 @@ class EventFactory { InteractiveStoryReadingStateEvent.KIND -> InteractiveStoryReadingStateEvent(id, pubKey, createdAt, tags, content, sig) LabelEvent.KIND -> LabelEvent(id, pubKey, createdAt, tags, content, sig) KindMuteSetEvent.KIND -> KindMuteSetEvent(id, pubKey, createdAt, tags, content, sig) - LabeledBookmarkListEvent.KIND -> LabeledBookmarkListEvent(id, pubKey, createdAt, tags, content, sig) + BookmarkSetEvent.KIND -> BookmarkSetEvent(id, pubKey, createdAt, tags, content, sig) LiveActivitiesChatMessageEvent.KIND -> LiveActivitiesChatMessageEvent(id, pubKey, createdAt, tags, content, sig) LiveActivitiesClipEvent.KIND -> LiveActivitiesClipEvent(id, pubKey, createdAt, tags, content, sig) LiveActivitiesEvent.KIND -> LiveActivitiesEvent(id, pubKey, createdAt, tags, content, sig) LiveActivitiesRaidEvent.KIND -> LiveActivitiesRaidEvent(id, pubKey, createdAt, tags, content, sig) - LnZapEvent.KIND -> LnZapEvent(id, pubKey, createdAt, tags, content, sig) - LnZapPaymentRequestEvent.KIND -> LnZapPaymentRequestEvent(id, pubKey, createdAt, tags, content, sig) - LnZapPaymentResponseEvent.KIND -> LnZapPaymentResponseEvent(id, pubKey, createdAt, tags, content, sig) + ZapReceiptEvent.KIND -> ZapReceiptEvent(id, pubKey, createdAt, tags, content, sig) + NwcRequestEvent.KIND -> NwcRequestEvent(id, pubKey, createdAt, tags, content, sig) + NwcResponseEvent.KIND -> NwcResponseEvent(id, pubKey, createdAt, tags, content, sig) OfferEvent.KIND -> OfferEvent(id, pubKey, createdAt, tags, content, sig) DebitEvent.KIND -> DebitEvent(id, pubKey, createdAt, tags, content, sig) ManageEvent.KIND -> ManageEvent(id, pubKey, createdAt, tags, content, sig) @@ -728,8 +726,8 @@ class EventFactory { NwcNotificationEvent.KIND -> NwcNotificationEvent(id, pubKey, createdAt, tags, content, sig) NwcNotificationEvent.LEGACY_KIND -> NwcNotificationEvent(id, pubKey, createdAt, tags, content, sig) LnZapPrivateEvent.KIND -> LnZapPrivateEvent(id, pubKey, createdAt, tags, content, sig) - LnZapRequestEvent.KIND -> LnZapRequestEvent(id, pubKey, createdAt, tags, content, sig) - LongTextNoteEvent.KIND -> LongTextNoteEvent(id, pubKey, createdAt, tags, content, sig) + ZapRequestEvent.KIND -> ZapRequestEvent(id, pubKey, createdAt, tags, content, sig) + LongFormContentEvent.KIND -> LongFormContentEvent(id, pubKey, createdAt, tags, content, sig) MarketplaceEvent.KIND -> MarketplaceEvent(id, pubKey, createdAt, tags, content, sig) MeetingRoomEvent.KIND -> MeetingRoomEvent(id, pubKey, createdAt, tags, content, sig) MeetingRoomPresenceEvent.KIND -> MeetingRoomPresenceEvent(id, pubKey, createdAt, tags, content, sig) @@ -758,55 +756,54 @@ class EventFactory { NipTextEvent.KIND -> NipTextEvent(id, pubKey, createdAt, tags, content, sig) NutzapEvent.KIND -> NutzapEvent(id, pubKey, createdAt, tags, content, sig) NutzapInfoEvent.KIND -> NutzapInfoEvent(id, pubKey, createdAt, tags, content, sig) - NutzapRedemptionEvent.KIND -> NutzapRedemptionEvent(id, pubKey, createdAt, tags, content, sig) NostrConnectEvent.KIND -> NostrConnectEvent(id, pubKey, createdAt, tags, content, sig) - NIP90StatusEvent.KIND -> NIP90StatusEvent(id, pubKey, createdAt, tags, content, sig) + DvmStatusEvent.KIND -> DvmStatusEvent(id, pubKey, createdAt, tags, content, sig) DvmHeartbeatEvent.KIND -> DvmHeartbeatEvent(id, pubKey, createdAt, tags, content, sig) - NIP90TextExtractionRequestEvent.KIND -> NIP90TextExtractionRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90TextExtractionResponseEvent.KIND -> NIP90TextExtractionResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90SummarizationRequestEvent.KIND -> NIP90SummarizationRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90SummarizationResponseEvent.KIND -> NIP90SummarizationResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90TranslationRequestEvent.KIND -> NIP90TranslationRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90TranslationResponseEvent.KIND -> NIP90TranslationResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90TextGenerationRequestEvent.KIND -> NIP90TextGenerationRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90TextGenerationResponseEvent.KIND -> NIP90TextGenerationResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90ImageGenerationRequestEvent.KIND -> NIP90ImageGenerationRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90ImageGenerationResponseEvent.KIND -> NIP90ImageGenerationResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90VideoConversionRequestEvent.KIND -> NIP90VideoConversionRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90VideoConversionResponseEvent.KIND -> NIP90VideoConversionResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90VideoTranslationRequestEvent.KIND -> NIP90VideoTranslationRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90VideoTranslationResponseEvent.KIND -> NIP90VideoTranslationResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90ImageToVideoRequestEvent.KIND -> NIP90ImageToVideoRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90ImageToVideoResponseEvent.KIND -> NIP90ImageToVideoResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90TextToSpeechRequestEvent.KIND -> NIP90TextToSpeechRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90TextToSpeechResponseEvent.KIND -> NIP90TextToSpeechResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90ContentDiscoveryRequestEvent.KIND -> NIP90ContentDiscoveryRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90ContentDiscoveryResponseEvent.KIND -> NIP90ContentDiscoveryResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90UserDiscoveryRequestEvent.KIND -> NIP90UserDiscoveryRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90UserDiscoveryResponseEvent.KIND -> NIP90UserDiscoveryResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90ContentSearchRequestEvent.KIND -> NIP90ContentSearchRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90ContentSearchResponseEvent.KIND -> NIP90ContentSearchResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90PeopleSearchRequestEvent.KIND -> NIP90PeopleSearchRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90PeopleSearchResponseEvent.KIND -> NIP90PeopleSearchResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90EventCountRequestEvent.KIND -> NIP90EventCountRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90EventCountResponseEvent.KIND -> NIP90EventCountResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90MalwareScanRequestEvent.KIND -> NIP90MalwareScanRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90MalwareScanResponseEvent.KIND -> NIP90MalwareScanResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90EventTimestampingRequestEvent.KIND -> NIP90EventTimestampingRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90EventTimestampingResponseEvent.KIND -> NIP90EventTimestampingResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90OpReturnRequestEvent.KIND -> NIP90OpReturnRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90OpReturnResponseEvent.KIND -> NIP90OpReturnResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90EventPublishScheduleRequestEvent.KIND -> NIP90EventPublishScheduleRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90EventPublishScheduleResponseEvent.KIND -> NIP90EventPublishScheduleResponseEvent(id, pubKey, createdAt, tags, content, sig) - NIP90EventPowDelegationRequestEvent.KIND -> NIP90EventPowDelegationRequestEvent(id, pubKey, createdAt, tags, content, sig) - NIP90EventPowDelegationResponseEvent.KIND -> NIP90EventPowDelegationResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmTextExtractionRequestEvent.KIND -> DvmTextExtractionRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmTextExtractionResponseEvent.KIND -> DvmTextExtractionResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmSummarizationRequestEvent.KIND -> DvmSummarizationRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmSummarizationResponseEvent.KIND -> DvmSummarizationResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmTranslationRequestEvent.KIND -> DvmTranslationRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmTranslationResponseEvent.KIND -> DvmTranslationResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmTextGenerationRequestEvent.KIND -> DvmTextGenerationRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmTextGenerationResponseEvent.KIND -> DvmTextGenerationResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmImageGenerationRequestEvent.KIND -> DvmImageGenerationRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmImageGenerationResponseEvent.KIND -> DvmImageGenerationResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmVideoConversionRequestEvent.KIND -> DvmVideoConversionRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmVideoConversionResponseEvent.KIND -> DvmVideoConversionResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmVideoTranslationRequestEvent.KIND -> DvmVideoTranslationRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmVideoTranslationResponseEvent.KIND -> DvmVideoTranslationResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmImageToVideoRequestEvent.KIND -> DvmImageToVideoRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmImageToVideoResponseEvent.KIND -> DvmImageToVideoResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmTextToSpeechRequestEvent.KIND -> DvmTextToSpeechRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmTextToSpeechResponseEvent.KIND -> DvmTextToSpeechResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmContentDiscoveryRequestEvent.KIND -> DvmContentDiscoveryRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmContentDiscoveryResponseEvent.KIND -> DvmContentDiscoveryResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmUserDiscoveryRequestEvent.KIND -> DvmUserDiscoveryRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmUserDiscoveryResponseEvent.KIND -> DvmUserDiscoveryResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmContentSearchRequestEvent.KIND -> DvmContentSearchRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmContentSearchResponseEvent.KIND -> DvmContentSearchResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmPeopleSearchRequestEvent.KIND -> DvmPeopleSearchRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmPeopleSearchResponseEvent.KIND -> DvmPeopleSearchResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmEventCountRequestEvent.KIND -> DvmEventCountRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmEventCountResponseEvent.KIND -> DvmEventCountResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmMalwareScanRequestEvent.KIND -> DvmMalwareScanRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmMalwareScanResponseEvent.KIND -> DvmMalwareScanResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmEventTimestampingRequestEvent.KIND -> DvmEventTimestampingRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmEventTimestampingResponseEvent.KIND -> DvmEventTimestampingResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmOpReturnRequestEvent.KIND -> DvmOpReturnRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmOpReturnResponseEvent.KIND -> DvmOpReturnResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmEventPublishScheduleRequestEvent.KIND -> DvmEventPublishScheduleRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmEventPublishScheduleResponseEvent.KIND -> DvmEventPublishScheduleResponseEvent(id, pubKey, createdAt, tags, content, sig) + DvmEventPowDelegationRequestEvent.KIND -> DvmEventPowDelegationRequestEvent(id, pubKey, createdAt, tags, content, sig) + DvmEventPowDelegationResponseEvent.KIND -> DvmEventPowDelegationResponseEvent(id, pubKey, createdAt, tags, content, sig) OnchainZapEvent.KIND -> OnchainZapEvent(id, pubKey, createdAt, tags, content, sig) Bolt12ZapEvent.KIND -> Bolt12ZapEvent(id, pubKey, createdAt, tags, content, sig) Bolt12ZapIntentEvent.KIND -> Bolt12ZapIntentEvent(id, pubKey, createdAt, tags, content, sig) Bolt12OfferListEvent.KIND -> Bolt12OfferListEvent(id, pubKey, createdAt, tags, content, sig) OtsEvent.KIND -> OtsEvent(id, pubKey, createdAt, tags, content, sig) PaymentTargetsEvent.KIND -> PaymentTargetsEvent(id, pubKey, createdAt, tags, content, sig) - PeopleListEvent.KIND -> PeopleListEvent(id, pubKey, createdAt, tags, content, sig) + FollowSetEvent.KIND -> FollowSetEvent(id, pubKey, createdAt, tags, content, sig) PictureCurationSetEvent.KIND -> PictureCurationSetEvent(id, pubKey, createdAt, tags, content, sig) P2POrderEvent.KIND -> P2POrderEvent(id, pubKey, createdAt, tags, content, sig) PictureEvent.KIND -> PictureEvent(id, pubKey, createdAt, tags, content, sig) @@ -823,7 +820,7 @@ class EventFactory { Podcasting20EpisodeEvent.KIND -> Podcasting20EpisodeEvent(id, pubKey, createdAt, tags, content, sig) Podcasting20TrailerEvent.KIND -> Podcasting20TrailerEvent(id, pubKey, createdAt, tags, content, sig) ProductEvent.KIND -> ProductEvent(id, pubKey, createdAt, tags, content, sig) - PrivateDmEvent.KIND -> PrivateDmEvent(id, pubKey, createdAt, tags, content, sig) + EncryptedDmEvent.KIND -> EncryptedDmEvent(id, pubKey, createdAt, tags, content, sig) PrivateOutboxRelayListEvent.KIND -> PrivateOutboxRelayListEvent(id, pubKey, createdAt, tags, content, sig) ProxyRelayListEvent.KIND -> ProxyRelayListEvent(id, pubKey, createdAt, tags, content, sig) PublicMessageEvent.KIND -> PublicMessageEvent(id, pubKey, createdAt, tags, content, sig) @@ -842,7 +839,7 @@ class EventFactory { PublicationIndexEvent.KIND -> PublicationIndexEvent(id, pubKey, createdAt, tags, content, sig) PublicationContentEvent.KIND -> PublicationContentEvent(id, pubKey, createdAt, tags, content, sig) RelayReviewEvent.KIND -> RelayReviewEvent(id, pubKey, createdAt, tags, content, sig) - ContactCardEvent.KIND -> ContactCardEvent(id, pubKey, createdAt, tags, content, sig) + UserAssertionEvent.KIND -> UserAssertionEvent(id, pubKey, createdAt, tags, content, sig) EventAssertionEvent.KIND -> EventAssertionEvent(id, pubKey, createdAt, tags, content, sig) AddressableAssertionEvent.KIND -> AddressableAssertionEvent(id, pubKey, createdAt, tags, content, sig) ExternalIdAssertionEvent.KIND -> ExternalIdAssertionEvent(id, pubKey, createdAt, tags, content, sig) @@ -875,24 +872,23 @@ class EventFactory { ControlEditionEvent.KIND -> ControlEditionEvent(id, pubKey, createdAt, tags, content, sig) ConcordInviteListEvent.KIND -> ConcordInviteListEvent(id, pubKey, createdAt, tags, content, sig) ConcordInviteBundleEvent.KIND -> ConcordInviteBundleEvent(id, pubKey, createdAt, tags, content, sig) - SealedRumorEvent.KIND -> SealedRumorEvent(id, pubKey, createdAt, tags, content, sig) + SealEvent.KIND -> SealEvent(id, pubKey, createdAt, tags, content, sig) SearchRelayListEvent.KIND -> SearchRelayListEvent(id, pubKey, createdAt, tags, content, sig) SimpleGroupListEvent.KIND -> SimpleGroupListEvent(id, pubKey, createdAt, tags, content, sig) SoftwareApplicationEvent.KIND -> SoftwareApplicationEvent(id, pubKey, createdAt, tags, content, sig) SoftwareAssetEvent.KIND -> SoftwareAssetEvent(id, pubKey, createdAt, tags, content, sig) StallEvent.KIND -> StallEvent(id, pubKey, createdAt, tags, content, sig) - StatusEvent.KIND -> StatusEvent(id, pubKey, createdAt, tags, content, sig) + UserStatusEvent.KIND -> UserStatusEvent(id, pubKey, createdAt, tags, content, sig) TextNoteEvent.KIND -> TextNoteEvent(id, pubKey, createdAt, tags, content, sig) ThreadEvent.KIND -> ThreadEvent(id, pubKey, createdAt, tags, content, sig) TextNoteModificationEvent.KIND -> TextNoteModificationEvent(id, pubKey, createdAt, tags, content, sig) - TokenEvent.KIND -> TokenEvent(id, pubKey, createdAt, tags, content, sig) TorrentEvent.KIND -> TorrentEvent(id, pubKey, createdAt, tags, content, sig) TorrentCommentEvent.KIND -> TorrentCommentEvent(id, pubKey, createdAt, tags, content, sig) TrustedRelayListEvent.KIND -> TrustedRelayListEvent(id, pubKey, createdAt, tags, content, sig) TrustProviderListEvent.KIND -> TrustProviderListEvent(id, pubKey, createdAt, tags, content, sig) VideoCurationSetEvent.KIND -> VideoCurationSetEvent(id, pubKey, createdAt, tags, content, sig) - VideoHorizontalEvent.KIND -> VideoHorizontalEvent(id, pubKey, createdAt, tags, content, sig) - VideoVerticalEvent.KIND -> VideoVerticalEvent(id, pubKey, createdAt, tags, content, sig) + AddressableNormalVideoEvent.KIND -> AddressableNormalVideoEvent(id, pubKey, createdAt, tags, content, sig) + AddressableShortVideoEvent.KIND -> AddressableShortVideoEvent(id, pubKey, createdAt, tags, content, sig) TextTrackEvent.KIND -> TextTrackEvent(id, pubKey, createdAt, tags, content, sig) VideoCollaborationEvent.KIND -> VideoCollaborationEvent(id, pubKey, createdAt, tags, content, sig) VideoNormalEvent.KIND -> VideoNormalEvent(id, pubKey, createdAt, tags, content, sig) @@ -901,7 +897,7 @@ class EventFactory { VoiceReplyEvent.KIND -> VoiceReplyEvent(id, pubKey, createdAt, tags, content, sig) WakeUpEvent.KIND -> WakeUpEvent(id, pubKey, createdAt, tags, content, sig) WebBookmarkEvent.KIND -> WebBookmarkEvent(id, pubKey, createdAt, tags, content, sig) - WikiNoteEvent.KIND -> WikiNoteEvent(id, pubKey, createdAt, tags, content, sig) + WikiArticleEvent.KIND -> WikiArticleEvent(id, pubKey, createdAt, tags, content, sig) WorkoutRecordEvent.KIND -> WorkoutRecordEvent(id, pubKey, createdAt, tags, content, sig) ExerciseTemplateEvent.KIND -> ExerciseTemplateEvent(id, pubKey, createdAt, tags, content, sig) else -> factories[kind]?.build(id, pubKey, createdAt, tags, content, sig) ?: Event(id, pubKey, createdAt, kind, tags, content, sig) diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/buzz/moderation/ModerationUnbanEventTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/buzz/moderation/ModerationUnbanEventTest.kt index 0f53a118c3..ec1a31dea2 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/buzz/moderation/ModerationUnbanEventTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/buzz/moderation/ModerationUnbanEventTest.kt @@ -20,7 +20,7 @@ */ package com.vitorpamplona.quartz.buzz.moderation -import com.vitorpamplona.quartz.nip75ZapGoals.GoalEvent +import com.vitorpamplona.quartz.nip75ZapGoals.ZapGoalEvent import kotlin.test.Test import kotlin.test.assertEquals @@ -40,7 +40,7 @@ class ModerationUnbanEventTest { @Test fun kindCollidesWithNip75GoalEvent() { // Documents the collision: this kind must NOT be registered in EventFactory, - // where 9041 already belongs to the NIP-75 GoalEvent. - assertEquals(GoalEvent.KIND, ModerationUnbanEvent.KIND) + // where 9041 already belongs to the NIP-75 ZapGoalEvent. + assertEquals(ZapGoalEvent.KIND, ModerationUnbanEvent.KIND) } } diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/experimental/graperank/GrapeRankPublisherTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/experimental/graperank/GrapeRankPublisherTest.kt index a5ef8d76eb..241e13ed53 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/experimental/graperank/GrapeRankPublisherTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/experimental/graperank/GrapeRankPublisherTest.kt @@ -27,8 +27,8 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip01Core.store.IEventStore import com.vitorpamplona.quartz.nip01Core.store.sqlite.EventStore -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent import kotlinx.coroutines.runBlocking import kotlin.test.Test import kotlin.test.assertEquals @@ -48,8 +48,8 @@ class GrapeRankPublisherTest { provider: String, ): Map = store - .query(Filter(kinds = listOf(ContactCardEvent.KIND), authors = listOf(provider))) - .filterIsInstance() + .query(Filter(kinds = listOf(UserAssertionEvent.KIND), authors = listOf(provider))) + .filterIsInstance() .associate { it.aboutUser() to it.rank() } @Test @@ -72,7 +72,7 @@ class GrapeRankPublisherTest { assertEquals(mapOf(a to 50, b to 10), cardsByTarget(store, provider)) val firstIds = store - .query(Filter(kinds = listOf(ContactCardEvent.KIND), authors = listOf(provider))) + .query(Filter(kinds = listOf(UserAssertionEvent.KIND), authors = listOf(provider))) .map { it.id } .toSet() @@ -83,7 +83,7 @@ class GrapeRankPublisherTest { assertEquals(0, r2.retracted) val secondIds = store - .query(Filter(kinds = listOf(ContactCardEvent.KIND), authors = listOf(provider))) + .query(Filter(kinds = listOf(UserAssertionEvent.KIND), authors = listOf(provider))) .map { it.id } .toSet() assertEquals(firstIds, secondIds) @@ -98,7 +98,7 @@ class GrapeRankPublisherTest { assertEquals(mapOf(a to 60, c to 5), cardsByTarget(store, provider)) // …but its kind:5 tombstone remains, ready to sync to relays. - val deletions = store.query(Filter(kinds = listOf(DeletionEvent.KIND), authors = listOf(provider))) + val deletions = store.query(Filter(kinds = listOf(DeletionRequestEvent.KIND), authors = listOf(provider))) assertEquals(1, deletions.size) store.close() @@ -137,10 +137,10 @@ class GrapeRankPublisherTest { val a = hexKey(0xA) - suspend fun cardFor(target: String): ContactCardEvent = + suspend fun cardFor(target: String): UserAssertionEvent = store - .query(Filter(kinds = listOf(ContactCardEvent.KIND), authors = listOf(provider))) - .filterIsInstance() + .query(Filter(kinds = listOf(UserAssertionEvent.KIND), authors = listOf(provider))) + .filterIsInstance() .first { it.aboutUser() == target } // A card carrying rank + followers + hops persists all three tags. diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/experimental/nip82SoftwareApps/SoftwareApplicationEventTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/experimental/nip82SoftwareApps/SoftwareApplicationEventTest.kt index c92f07fb5a..25990b13ff 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/experimental/nip82SoftwareApps/SoftwareApplicationEventTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/experimental/nip82SoftwareApps/SoftwareApplicationEventTest.kt @@ -32,15 +32,17 @@ import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.asset.SoftwareAss import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.asset.apkCertificateHash import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.asset.platform import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.asset.versionCode -import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.SoftwareReleaseEvent import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.asSoftwareRelease import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.release.isNip82SoftwareRelease import com.vitorpamplona.quartz.experimental.nip82SoftwareApps.shared.Platform import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hashtag +import com.vitorpamplona.quartz.nip51Lists.releaseArtifactSet.ReleaseArtifactSetEvent +import com.vitorpamplona.quartz.utils.EventFactory import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse +import kotlin.test.assertIs import kotlin.test.assertNotNull import kotlin.test.assertTrue @@ -107,7 +109,7 @@ class SoftwareApplicationEventTest { id = "0".repeat(64), pubKey = "1".repeat(64), createdAt = 0, - kind = SoftwareReleaseEvent.KIND, + kind = ReleaseArtifactSetEvent.KIND, tags = arrayOf( arrayOf("d", "com.example.app@1.0.0"), @@ -126,7 +128,7 @@ class SoftwareApplicationEventTest { id = "0".repeat(64), pubKey = "1".repeat(64), createdAt = 0, - kind = SoftwareReleaseEvent.KIND, + kind = ReleaseArtifactSetEvent.KIND, tags = arrayOf(arrayOf("d", "some-uuid"), arrayOf("title", "My Release")), content = "", sig = "", @@ -141,7 +143,7 @@ class SoftwareApplicationEventTest { id = "0".repeat(64), pubKey = "1".repeat(64), createdAt = 0, - kind = SoftwareReleaseEvent.KIND, + kind = ReleaseArtifactSetEvent.KIND, tags = arrayOf( arrayOf("d", "com.example.app@1.0.0"), @@ -158,6 +160,53 @@ class SoftwareApplicationEventTest { assertEquals("main", release.channel()) } + @Test + fun eventFactory_parsesNip82ReleaseAsReleaseArtifactSet() { + val event = + EventFactory.create( + id = "0".repeat(64), + pubKey = "1".repeat(64), + createdAt = 0, + kind = ReleaseArtifactSetEvent.KIND, + tags = + arrayOf( + arrayOf("d", "com.example.app@1.0.0"), + arrayOf("i", "com.example.app"), + arrayOf("version", "1.0.0"), + arrayOf("c", "main"), + arrayOf("e", "2".repeat(64)), + ), + content = "Initial release", + sig = "", + ) + val release = assertIs(event) + assertTrue(release.isNip82SoftwareRelease()) + assertEquals("com.example.app", release.appId()) + assertEquals("1.0.0", release.version()) + assertEquals("main", release.channel()) + assertEquals(1, release.assets().size) + assertEquals("Initial release", release.releaseNotes()) + } + + @Test + fun buildSoftwareRelease_roundTripsNip82Fields() { + val template = + ReleaseArtifactSetEvent.buildSoftwareRelease( + appId = "com.example.app", + version = "2.0.0", + channel = "beta", + assets = emptyList(), + releaseNotes = "notes", + ) + assertEquals(ReleaseArtifactSetEvent.KIND, template.kind) + val tagsByName = template.tags.associate { it[0] to it.getOrNull(1) } + assertEquals("com.example.app@2.0.0", tagsByName["d"]) + assertEquals("com.example.app", tagsByName["i"]) + assertEquals("2.0.0", tagsByName["version"]) + assertEquals("beta", tagsByName["c"]) + assertEquals("notes", template.content) + } + @Test fun parses_realWorldAmethystEvent() { // Real NIP-82 event published for Amethyst — used as a regression fixture so renderer diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/experimental/nip85TrustedAssertions/AssertionEventTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/experimental/nip85TrustedAssertions/AssertionEventTest.kt index 7eccdaf3dd..bc225b0cb9 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/experimental/nip85TrustedAssertions/AssertionEventTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/experimental/nip85TrustedAssertions/AssertionEventTest.kt @@ -23,7 +23,7 @@ package com.vitorpamplona.quartz.experimental.nip85TrustedAssertions import com.vitorpamplona.quartz.nip85TrustedAssertions.addressables.AddressableAssertionEvent import com.vitorpamplona.quartz.nip85TrustedAssertions.events.EventAssertionEvent import com.vitorpamplona.quartz.nip85TrustedAssertions.externalIds.ExternalIdAssertionEvent -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNull @@ -36,7 +36,7 @@ class AssertionEventTest { fun parseUserAssertionWithAllTags() { val targetUser = "e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411" val event = - ContactCardEvent( + UserAssertionEvent( id = "abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234", pubKey = servicePubKey, createdAt = 1700000000, @@ -89,7 +89,7 @@ class AssertionEventTest { @Test fun parseUserAssertionMinimalTags() { val event = - ContactCardEvent( + UserAssertionEvent( id = "abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234", pubKey = servicePubKey, createdAt = 1700000000, @@ -228,7 +228,7 @@ class AssertionEventTest { @Test fun eventKindsAreCorrect() { - assertEquals(30382, ContactCardEvent.KIND) + assertEquals(30382, UserAssertionEvent.KIND) assertEquals(30383, EventAssertionEvent.KIND) assertEquals(30384, AddressableAssertionEvent.KIND) assertEquals(30385, ExternalIdAssertionEvent.KIND) diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/experimental/nip85TrustedAssertions/ContactCardPetNameTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/experimental/nip85TrustedAssertions/ContactCardPetNameTest.kt index 17d1f2d14b..1f58771e64 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/experimental/nip85TrustedAssertions/ContactCardPetNameTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/experimental/nip85TrustedAssertions/ContactCardPetNameTest.kt @@ -23,7 +23,7 @@ package com.vitorpamplona.quartz.experimental.nip85TrustedAssertions import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip30CustomEmoji.EmojiUrlTag -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent import com.vitorpamplona.quartz.nip85TrustedAssertions.users.tags.PetNameTag import com.vitorpamplona.quartz.nip85TrustedAssertions.users.tags.SummaryTag import kotlinx.coroutines.test.runTest @@ -36,15 +36,15 @@ class ContactCardPetNameTest { val signer = NostrSignerInternal(KeyPair()) val targetUser = "e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411" - private suspend fun ContactCardEvent.privatePetName() = privateTags(signer)?.firstNotNullOfOrNull(PetNameTag::parse) + private suspend fun UserAssertionEvent.privatePetName() = privateTags(signer)?.firstNotNullOfOrNull(PetNameTag::parse) - private suspend fun ContactCardEvent.privateSummary() = privateTags(signer)?.firstNotNullOfOrNull(SummaryTag::parse) + private suspend fun UserAssertionEvent.privateSummary() = privateTags(signer)?.firstNotNullOfOrNull(SummaryTag::parse) @Test fun createKeepsPetNameAndSummaryEncrypted() = runTest { val card = - ContactCardEvent.create( + UserAssertionEvent.create( targetUser = targetUser, petName = "Bob from work", summary = "Met at the conference", @@ -66,7 +66,7 @@ class ContactCardPetNameTest { fun updateReplacesPetNameAndKeepsOtherPrivateTags() = runTest { val card = - ContactCardEvent.create( + UserAssertionEvent.create( targetUser = targetUser, petName = "Bob", summary = "old summary", @@ -77,7 +77,7 @@ class ContactCardPetNameTest { val updated = signer.sign( - ContactCardEvent.updatePetNameAndSummary( + UserAssertionEvent.updatePetNameAndSummary( earlierVersion = card, petName = "Bobby", summary = "new summary", @@ -102,7 +102,7 @@ class ContactCardPetNameTest { fun updateWithNullsClearsBothFields() = runTest { val card = - ContactCardEvent.create( + UserAssertionEvent.create( targetUser = targetUser, petName = "Bob", summary = "summary", @@ -111,7 +111,7 @@ class ContactCardPetNameTest { val cleared = signer.sign( - ContactCardEvent.updatePetNameAndSummary( + UserAssertionEvent.updatePetNameAndSummary( earlierVersion = card, petName = null, summary = null, @@ -130,7 +130,7 @@ class ContactCardPetNameTest { val newEmoji = EmojiUrlTag("soapbox", "https://new.example/soapbox.png") val card = - ContactCardEvent.create( + UserAssertionEvent.create( targetUser = targetUser, petName = "Bob :wave:", emojis = listOf(oldEmoji), @@ -140,7 +140,7 @@ class ContactCardPetNameTest { val updated = signer.sign( - ContactCardEvent.updatePetNameAndSummary( + UserAssertionEvent.updatePetNameAndSummary( earlierVersion = card, petName = "Bob :soapbox:", emojis = listOf(newEmoji), @@ -159,7 +159,7 @@ class ContactCardPetNameTest { runTest { // a card that (incorrectly) carries public petname/summary tags val card = - ContactCardEvent.create( + UserAssertionEvent.create( targetUser = targetUser, signer = signer, publicInitializer = { @@ -171,7 +171,7 @@ class ContactCardPetNameTest { val updated = signer.sign( - ContactCardEvent.updatePetNameAndSummary( + UserAssertionEvent.updatePetNameAndSummary( earlierVersion = card, petName = "private bob", signer = signer, diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/cache/projection/EventStoreProjectionTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/cache/projection/EventStoreProjectionTest.kt index d16e03b68f..be617307b3 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/cache/projection/EventStoreProjectionTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/cache/projection/EventStoreProjectionTest.kt @@ -29,9 +29,9 @@ import com.vitorpamplona.quartz.nip01Core.store.ObservableEventStore import com.vitorpamplona.quartz.nip01Core.store.ObservableEventStore.StoreChange import com.vitorpamplona.quartz.nip01Core.store.sqlite.EventStore import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hashtag -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip40Expiration.expiration import com.vitorpamplona.quartz.nip62RequestToVanish.RequestToVanishEvent import com.vitorpamplona.quartz.utils.TimeUtils @@ -186,13 +186,13 @@ class EventStoreProjectionTest { fun addressableUpdateMutatesSlotInPlace() = runBlocking { val time = TimeUtils.now() - val v1 = signer.sign(LongTextNoteEvent.build("blog v1", "title", dTag = "blog", createdAt = time)) + val v1 = signer.sign(LongFormContentEvent.build("blog v1", "title", dTag = "blog", createdAt = time)) observable.insert(v1) val projection = - projectionOf( + projectionOf( Filter( - kinds = listOf(LongTextNoteEvent.KIND), + kinds = listOf(LongFormContentEvent.KIND), authors = listOf(v1.pubKey), tags = mapOf("d" to listOf("blog")), ), @@ -201,7 +201,7 @@ class EventStoreProjectionTest { val seedList = projection.items val slot = seedList[0] - val v2 = signer.sign(LongTextNoteEvent.build("blog v2", "title", dTag = "blog", createdAt = time + 1)) + val v2 = signer.sign(LongFormContentEvent.build("blog v2", "title", dTag = "blog", createdAt = time + 1)) observable.insert(v2) awaitFlow(slot) { it.id == v2.id } @@ -220,7 +220,7 @@ class EventStoreProjectionTest { // v1 carries tag "nostr"; v2 changes the tag to "bitcoin". val v1 = signer.sign( - LongTextNoteEvent.build("blog v1", "title", dTag = "blog", createdAt = time) { + LongFormContentEvent.build("blog v1", "title", dTag = "blog", createdAt = time) { hashtag("nostr") }, ) @@ -228,9 +228,9 @@ class EventStoreProjectionTest { // Filter narrows to events that ALSO carry hashtag "nostr". val projection = - projectionOf( + projectionOf( Filter( - kinds = listOf(LongTextNoteEvent.KIND), + kinds = listOf(LongFormContentEvent.KIND), authors = listOf(v1.pubKey), tags = mapOf("t" to listOf("nostr")), ), @@ -240,7 +240,7 @@ class EventStoreProjectionTest { val v2 = signer.sign( - LongTextNoteEvent.build("blog v2", "title", dTag = "blog", createdAt = time + 1) { + LongFormContentEvent.build("blog v2", "title", dTag = "blog", createdAt = time + 1) { hashtag("bitcoin") }, ) @@ -300,7 +300,7 @@ class EventStoreProjectionTest { projection.awaitLoaded() assertEquals(2, projection.items.size) - val deletion = signer.sign(DeletionEvent.build(listOf(a))) + val deletion = signer.sign(DeletionRequestEvent.build(listOf(a))) observable.insert(deletion) val after = projection.awaitItems { it.size == 1 } @@ -322,7 +322,7 @@ class EventStoreProjectionTest { val seed = projection.items assertEquals(1, seed.size) - val foreignDeletion = otherSigner.sign(DeletionEvent.build(listOf(a))) + val foreignDeletion = otherSigner.sign(DeletionRequestEvent.build(listOf(a))) observable.insert(foreignDeletion) // Give the projection time to process the event. diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/AddressableTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/AddressableTest.kt index 759d1b223b..8c26a66714 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/AddressableTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/AddressableTest.kt @@ -23,7 +23,7 @@ package com.vitorpamplona.quartz.nip01Core.store.sqlite import androidx.sqlite.SQLiteException import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.utils.TimeUtils import kotlin.test.Test import kotlin.test.assertEquals @@ -36,9 +36,9 @@ class AddressableTest : BaseDBTest() { fun testReplacingAddressables() = forEachDB { db -> val time = TimeUtils.now() - val version1 = signer.sign(LongTextNoteEvent.build("my cool blog, version 1", "title", dTag = "my-cool-blog", createdAt = time)) - val version2 = signer.sign(LongTextNoteEvent.build("my cool blog, version 2", "title", dTag = "my-cool-blog", createdAt = time + 1)) - val version3 = signer.sign(LongTextNoteEvent.build("my cool blog, version 3", "title", dTag = "my-cool-blog", createdAt = time + 2)) + val version1 = signer.sign(LongFormContentEvent.build("my cool blog, version 1", "title", dTag = "my-cool-blog", createdAt = time)) + val version2 = signer.sign(LongFormContentEvent.build("my cool blog, version 2", "title", dTag = "my-cool-blog", createdAt = time + 1)) + val version3 = signer.sign(LongFormContentEvent.build("my cool blog, version 3", "title", dTag = "my-cool-blog", createdAt = time + 2)) val addressableQuery = Filter(kinds = listOf(version1.kind), authors = listOf(version1.pubKey), tags = mapOf("d" to listOf(version1.dTag()))) @@ -65,9 +65,9 @@ class AddressableTest : BaseDBTest() { fun testBlockingOldAddressables() = forEachDB { db -> val time = TimeUtils.now() - val version1 = signer.sign(LongTextNoteEvent.build("my cool blog, version 1", "title", dTag = "my-cool-blog", createdAt = time)) - val version2 = signer.sign(LongTextNoteEvent.build("my cool blog, version 2", "title", dTag = "my-cool-blog", createdAt = time + 1)) - val version3 = signer.sign(LongTextNoteEvent.build("my cool blog, version 3", "title", dTag = "my-cool-blog", createdAt = time + 2)) + val version1 = signer.sign(LongFormContentEvent.build("my cool blog, version 1", "title", dTag = "my-cool-blog", createdAt = time)) + val version2 = signer.sign(LongFormContentEvent.build("my cool blog, version 2", "title", dTag = "my-cool-blog", createdAt = time + 1)) + val version3 = signer.sign(LongFormContentEvent.build("my cool blog, version 3", "title", dTag = "my-cool-blog", createdAt = time + 2)) val addressableQuery = Filter(kinds = listOf(version1.kind), authors = listOf(version1.pubKey), tags = mapOf("d" to listOf(version1.dTag()))) @@ -97,7 +97,7 @@ class AddressableTest : BaseDBTest() { // different content -> different ids. NIP-01 says the lower-id wins. val a = signer.sign( - LongTextNoteEvent.build( + LongFormContentEvent.build( "version A", "title", dTag = "tie", @@ -106,7 +106,7 @@ class AddressableTest : BaseDBTest() { ) val b = signer.sign( - LongTextNoteEvent.build( + LongFormContentEvent.build( "version B", "title", dTag = "tie", @@ -129,7 +129,7 @@ class AddressableTest : BaseDBTest() { val time = TimeUtils.now() val a = signer.sign( - LongTextNoteEvent.build( + LongFormContentEvent.build( "version A", "title", dTag = "tie", @@ -138,7 +138,7 @@ class AddressableTest : BaseDBTest() { ) val b = signer.sign( - LongTextNoteEvent.build( + LongFormContentEvent.build( "version B", "title", dTag = "tie", diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/AuthorsMissingOutboxTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/AuthorsMissingOutboxTest.kt index 103eb82d3c..d70bdd6952 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/AuthorsMissingOutboxTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/AuthorsMissingOutboxTest.kt @@ -21,7 +21,7 @@ package com.vitorpamplona.quartz.nip01Core.store.sqlite import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent @@ -83,7 +83,7 @@ class AuthorsMissingOutboxTest : BaseDBTest() { // NIP-09: the author deletes their own relay list. No 10002 row // remains, so the anti-join reports them as missing again. - db.insert(signer.sign(DeletionEvent.build(listOf(relayList)))) + db.insert(signer.sign(DeletionRequestEvent.build(listOf(relayList)))) assertEquals(setOf(signer.pubKey), db.authorsMissingOutbox().toSet()) } diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/BasicTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/BasicTest.kt index 6c695ff744..bff21ff649 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/BasicTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/BasicTest.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync import com.vitorpamplona.quartz.nip01Core.tags.hashtags.hashtag import com.vitorpamplona.quartz.nip01Core.tags.hashtags.isTaggedHash -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent import kotlin.test.Test @@ -261,7 +261,7 @@ class BasicTest : BaseDBTest() { forEachDB { db -> // Pre-load a target event and a deletion that blocks re-insertion. val deletedTarget = signer.sign(TextNoteEvent.build("target", createdAt = 1)) - val deletion = signer.sign(DeletionEvent.build(listOf(deletedTarget), createdAt = 100)) + val deletion = signer.sign(DeletionRequestEvent.build(listOf(deletedTarget), createdAt = 100)) db.insert(deletion) db.assertQuery(deletion, Filter(ids = listOf(deletion.id))) diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/DeletionTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/DeletionTest.kt index 811e9b5323..62ab2e4183 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/DeletionTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/DeletionTest.kt @@ -24,9 +24,9 @@ import androidx.sqlite.SQLiteException import com.vitorpamplona.quartz.nip01Core.core.Address import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.utils.TimeUtils import kotlin.test.Test @@ -51,7 +51,7 @@ class DeletionTest : BaseDBTest() { db.assertQuery(note2, Filter(ids = listOf(note2.id))) db.assertQuery(note3, Filter(ids = listOf(note3.id))) - val deletion = signer.sign(DeletionEvent.build(listOf(note1))) + val deletion = signer.sign(DeletionRequestEvent.build(listOf(note1))) db.insert(deletion) @@ -74,9 +74,9 @@ class DeletionTest : BaseDBTest() { fun testInsertDeleteEventOfAddressable() = forEachDB { db -> val time = TimeUtils.now() - val note1 = signer.sign(LongTextNoteEvent.build("my cool blog, version 1", "title", dTag = "my-cool-blog", createdAt = time)) - val note2 = signer.sign(LongTextNoteEvent.build("my cool blog, version 2", "title", dTag = "my-cool-blog", createdAt = time + 1)) - val note3 = signer.sign(LongTextNoteEvent.build("my cool blog, version 3", "title", dTag = "my-cool-blog", createdAt = time + 2)) + val note1 = signer.sign(LongFormContentEvent.build("my cool blog, version 1", "title", dTag = "my-cool-blog", createdAt = time)) + val note2 = signer.sign(LongFormContentEvent.build("my cool blog, version 2", "title", dTag = "my-cool-blog", createdAt = time + 1)) + val note3 = signer.sign(LongFormContentEvent.build("my cool blog, version 3", "title", dTag = "my-cool-blog", createdAt = time + 2)) db.insert(note1) @@ -95,7 +95,7 @@ class DeletionTest : BaseDBTest() { // Deletion must be timestamped >= note3.createdAt for it to // remove the latest addressable per NIP-09. - val deletion = signer.sign(DeletionEvent.build(listOf(note1), createdAt = time + 100)) + val deletion = signer.sign(DeletionRequestEvent.build(listOf(note1), createdAt = time + 100)) db.insert(deletion) @@ -118,9 +118,9 @@ class DeletionTest : BaseDBTest() { fun testInsertDeleteEventOfAddressable2() = forEachDB { db -> val time = TimeUtils.now() - val note1 = signer.sign(LongTextNoteEvent.build("my cool blog, version 1", "title", dTag = "my-cool-blog", createdAt = time)) - val note2 = signer.sign(LongTextNoteEvent.build("my cool blog, version 2", "title", dTag = "my-cool-blog", createdAt = time + 1)) - val note3 = signer.sign(LongTextNoteEvent.build("my cool blog, version 3", "title", dTag = "my-cool-blog", createdAt = time + 2)) + val note1 = signer.sign(LongFormContentEvent.build("my cool blog, version 1", "title", dTag = "my-cool-blog", createdAt = time)) + val note2 = signer.sign(LongFormContentEvent.build("my cool blog, version 2", "title", dTag = "my-cool-blog", createdAt = time + 1)) + val note3 = signer.sign(LongFormContentEvent.build("my cool blog, version 3", "title", dTag = "my-cool-blog", createdAt = time + 2)) db.insert(note1) db.insert(note2) @@ -130,7 +130,7 @@ class DeletionTest : BaseDBTest() { db.assertQuery(null, Filter(ids = listOf(note2.id))) db.assertQuery(note3, Filter(ids = listOf(note3.id))) - val deletion = signer.sign(DeletionEvent.buildAddressOnly(listOf(note1), createdAt = time + 100)) + val deletion = signer.sign(DeletionRequestEvent.buildAddressOnly(listOf(note1), createdAt = time + 100)) db.insert(deletion) @@ -165,7 +165,7 @@ class DeletionTest : BaseDBTest() { db.assertQuery(wrap1, Filter(ids = listOf(wrap1.id))) db.assertQuery(wrap2, Filter(ids = listOf(wrap2.id))) - val randomDeletionToWrap = signer.sign(DeletionEvent.build(listOf(wrap1))) + val randomDeletionToWrap = signer.sign(DeletionRequestEvent.build(listOf(wrap1))) db.insert(randomDeletionToWrap) @@ -173,7 +173,7 @@ class DeletionTest : BaseDBTest() { db.assertQuery(wrap1, Filter(ids = listOf(wrap1.id))) db.assertQuery(wrap2, Filter(ids = listOf(wrap2.id))) - val deletion = me.sign(DeletionEvent.build(listOf(wrap1))) + val deletion = me.sign(DeletionRequestEvent.build(listOf(wrap1))) db.insert(deletion) @@ -427,14 +427,14 @@ class DeletionTest : BaseDBTest() { // A deletion event from a *different* author must not remove the // target — only the original author can delete via NIP-09. - val strangerDeletion = stranger.sign(DeletionEvent.build(listOf(target))) + val strangerDeletion = stranger.sign(DeletionRequestEvent.build(listOf(target))) db.insert(strangerDeletion) db.assertQuery(target, Filter(ids = listOf(target.id))) db.assertQuery(strangerDeletion, Filter(ids = listOf(strangerDeletion.id))) // The owner's deletion still works after a failed third-party attempt. - val ownerDeletion = owner.sign(DeletionEvent.build(listOf(target))) + val ownerDeletion = owner.sign(DeletionRequestEvent.build(listOf(target))) db.insert(ownerDeletion) db.assertQuery(null, Filter(ids = listOf(target.id))) } @@ -447,7 +447,7 @@ class DeletionTest : BaseDBTest() { // a second deletion that removes the first. Cross-author // deletion of a kind-5 must NOT work. val target = signer.sign(TextNoteEvent.build("target")) - val firstDeletion = signer.sign(DeletionEvent.build(listOf(target), createdAt = 100)) + val firstDeletion = signer.sign(DeletionRequestEvent.build(listOf(target), createdAt = 100)) db.insert(target) db.insert(firstDeletion) @@ -457,13 +457,13 @@ class DeletionTest : BaseDBTest() { // Stranger cannot delete the kind-5. val stranger = NostrSignerSync() val strangerDeletion = - stranger.sign(DeletionEvent.build(listOf(firstDeletion), createdAt = 200)) + stranger.sign(DeletionRequestEvent.build(listOf(firstDeletion), createdAt = 200)) db.insert(strangerDeletion) db.assertQuery(firstDeletion, Filter(ids = listOf(firstDeletion.id))) // Same author can delete their previous kind-5. val secondDeletion = - signer.sign(DeletionEvent.build(listOf(firstDeletion), createdAt = 300)) + signer.sign(DeletionRequestEvent.build(listOf(firstDeletion), createdAt = 300)) db.insert(secondDeletion) db.assertQuery(null, Filter(ids = listOf(firstDeletion.id))) db.assertQuery(secondDeletion, Filter(ids = listOf(secondDeletion.id))) @@ -493,17 +493,17 @@ class DeletionTest : BaseDBTest() { // Inner author (the "sender") cannot delete a wrap addressed to // someone else — sender pubkey != wrap's pubkey_owner_hash. - val senderDeletion = sender.sign(DeletionEvent.build(listOf(wrap))) + val senderDeletion = sender.sign(DeletionRequestEvent.build(listOf(wrap))) db.insert(senderDeletion) db.assertQuery(wrap, Filter(ids = listOf(wrap.id))) // An unrelated third party can't delete it either. - val unrelatedDeletion = unrelated.sign(DeletionEvent.build(listOf(wrap))) + val unrelatedDeletion = unrelated.sign(DeletionRequestEvent.build(listOf(wrap))) db.insert(unrelatedDeletion) db.assertQuery(wrap, Filter(ids = listOf(wrap.id))) // The recipient (whose pubkey matches pubkey_owner_hash) can. - val recipientDeletion = recipient.sign(DeletionEvent.build(listOf(wrap))) + val recipientDeletion = recipient.sign(DeletionRequestEvent.build(listOf(wrap))) db.insert(recipientDeletion) db.assertQuery(null, Filter(ids = listOf(wrap.id))) } @@ -514,7 +514,7 @@ class DeletionTest : BaseDBTest() { // Old addressable (will be deleted by deletion request) val old = signer.sign( - LongTextNoteEvent.build( + LongFormContentEvent.build( "version 1", "title", dTag = "blog-1", @@ -528,7 +528,7 @@ class DeletionTest : BaseDBTest() { // Deletion targeting the address with created_at = 1500 val deletion = signer.sign( - DeletionEvent.buildAddressOnly( + DeletionRequestEvent.buildAddressOnly( listOf(old), createdAt = 1500, ), @@ -542,7 +542,7 @@ class DeletionTest : BaseDBTest() { // created_at AFTER the deletion. NIP-09 says it must be kept. val newer = signer.sign( - LongTextNoteEvent.build( + LongFormContentEvent.build( "version 2", "title", dTag = "blog-1", diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/InsertOutcomeClassificationTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/InsertOutcomeClassificationTest.kt index 6507de40f4..2bdcba4dc0 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/InsertOutcomeClassificationTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/InsertOutcomeClassificationTest.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync import com.vitorpamplona.quartz.nip01Core.store.IEventStore import com.vitorpamplona.quartz.nip01Core.store.RejectionReason import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.utils.TimeUtils import kotlin.test.Test import kotlin.test.assertEquals @@ -111,8 +111,8 @@ class InsertOutcomeClassificationTest : BaseDBTest() { fun olderAddressableIsRejectedAsSuperseded() = forEachDB { db -> val time = TimeUtils.now() - val older = signer.sign(LongTextNoteEvent.build("v1", "title", dTag = "blog", createdAt = time)) - val newer = signer.sign(LongTextNoteEvent.build("v2", "title", dTag = "blog", createdAt = time + 1)) + val older = signer.sign(LongFormContentEvent.build("v1", "title", dTag = "blog", createdAt = time)) + val newer = signer.sign(LongFormContentEvent.build("v2", "title", dTag = "blog", createdAt = time + 1)) assertEquals(IEventStore.InsertOutcome.Accepted, db.batchInsert(listOf(newer))[0]) assertRejected(RejectionReason.SUPERSEDED, db.batchInsert(listOf(older))[0]) diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/QueryAssemblerTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/QueryAssemblerTest.kt index ac034e6af3..496def0887 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/QueryAssemblerTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/QueryAssemblerTest.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip37Drafts.DraftWrapEvent import com.vitorpamplona.quartz.nip50Search.SearchRelayListEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent import kotlin.test.Test import kotlin.test.assertEquals @@ -984,7 +984,7 @@ class QueryAssemblerTest : BaseDBTest() { forEachDB { db -> val filter = Filter( - kinds = listOf(ContactCardEvent.KIND), + kinds = listOf(UserAssertionEvent.KIND), authors = listOf("460c25e682fda7832b52d1f22d3d22b3176d972f60dcdc3212ed8c92ef85065c"), tags = mapOf( diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/SearchTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/SearchTest.kt index 7f238e30e6..23024b8be5 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/SearchTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/sqlite/SearchTest.kt @@ -29,10 +29,10 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import com.vitorpamplona.quartz.nip28PublicChat.admin.ChannelCreateEvent import com.vitorpamplona.quartz.nip34Git.repository.GitRepositoryEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import com.vitorpamplona.quartz.utils.TimeUtils import kotlin.test.Test @@ -134,7 +134,7 @@ class SearchTest : BaseDBTest() { val time = TimeUtils.now() val v1 = signer.sign( - LongTextNoteEvent.build( + LongFormContentEvent.build( "first version uniqalpha", title = "blog title", dTag = "fts-rotation", @@ -143,7 +143,7 @@ class SearchTest : BaseDBTest() { ) val v2 = signer.sign( - LongTextNoteEvent.build( + LongFormContentEvent.build( "second version uniqbeta", title = "blog title", dTag = "fts-rotation", @@ -163,10 +163,10 @@ class SearchTest : BaseDBTest() { @Test fun testNewlySearchableKinds() = forEachDB { db -> - // CalendarEvent indexes the title tag plus the free-text content. + // CalendarCollectionEvent indexes the title tag plus the free-text content. val cal = signer.sign( - CalendarEvent.build( + CalendarCollectionEvent.build( title = "uniqtitle Meetup", content = "annual uniqbody gathering", ), @@ -254,7 +254,7 @@ class SearchTest : BaseDBTest() { // events that were stored before their kind became searchable. val cal = signer.sign( - CalendarEvent.build( + CalendarCollectionEvent.build( title = "uniqtitle Meetup", content = "annual uniqbody gathering", ), diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/ChannelSettingsTagTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/ChannelSettingsTagTest.kt index 080e477790..6f0f7e4b28 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/ChannelSettingsTagTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/ChannelSettingsTagTest.kt @@ -21,7 +21,7 @@ package com.vitorpamplona.quartz.nip29RelayGroups import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMetadataEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.EditMetadataEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupEditMetadataEvent import com.vitorpamplona.quartz.utils.EventFactory import kotlin.test.Test import kotlin.test.assertEquals @@ -48,22 +48,22 @@ class ChannelSettingsTagTest { @Test fun editEmitsVisibilityTagOnlyWhenSet() { - val priv = EditMetadataEvent.build(gid, visibility = "private") + val priv = GroupEditMetadataEvent.build(gid, visibility = "private") assertEquals("private", tagValue(priv.tags, "visibility")) - val open = EditMetadataEvent.build(gid, visibility = "open") + val open = GroupEditMetadataEvent.build(gid, visibility = "open") assertEquals("open", tagValue(open.tags, "visibility")) // Absent by default so an ordinary metadata edit doesn't reclassify visibility. - assertNull(tagValue(EditMetadataEvent.build(gid, name = "x").tags, "visibility")) + assertNull(tagValue(GroupEditMetadataEvent.build(gid, name = "x").tags, "visibility")) } @Test fun editEmitsArchivedTagAsTrueFalse() { - assertEquals("true", tagValue(EditMetadataEvent.build(gid, archived = true).tags, "archived")) - assertEquals("false", tagValue(EditMetadataEvent.build(gid, archived = false).tags, "archived")) + assertEquals("true", tagValue(GroupEditMetadataEvent.build(gid, archived = true).tags, "archived")) + assertEquals("false", tagValue(GroupEditMetadataEvent.build(gid, archived = false).tags, "archived")) // Null archived means "don't touch it" — no tag emitted. - assertNull(tagValue(EditMetadataEvent.build(gid, name = "x").tags, "archived")) + assertNull(tagValue(GroupEditMetadataEvent.build(gid, name = "x").tags, "archived")) } @Test diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/Nip29ArmadaInteropTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/Nip29ArmadaInteropTest.kt index dae29d1b8c..6d7949047d 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/Nip29ArmadaInteropTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/Nip29ArmadaInteropTest.kt @@ -32,16 +32,16 @@ import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupAdminsEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMembersEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMetadataEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupParticipantsEvent -import com.vitorpamplona.quartz.nip29RelayGroups.metadata.SupportedRolesEvent +import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupRolesEvent import com.vitorpamplona.quartz.nip29RelayGroups.moderation.CreateGroupEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.CreateInviteEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.DeleteEventEvent import com.vitorpamplona.quartz.nip29RelayGroups.moderation.DeleteGroupEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.EditMetadataEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.PutUserEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.RemoveUserEvent -import com.vitorpamplona.quartz.nip29RelayGroups.request.JoinRequestEvent -import com.vitorpamplona.quartz.nip29RelayGroups.request.LeaveRequestEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupCreateInviteEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupDeleteEventEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupEditMetadataEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupPutUserEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupRemoveUserEvent +import com.vitorpamplona.quartz.nip29RelayGroups.request.GroupJoinRequestEvent +import com.vitorpamplona.quartz.nip29RelayGroups.request.GroupLeaveRequestEvent import com.vitorpamplona.quartz.nip51Lists.simpleGroupList.GroupTag import com.vitorpamplona.quartz.nip51Lists.simpleGroupList.SimpleGroupListEvent import com.vitorpamplona.quartz.nip7DThreads.ThreadEvent @@ -169,12 +169,12 @@ class Nip29ArmadaInteropTest { fun parsesGroupRoles() { val e = parse( - SupportedRolesEvent.KIND, + GroupRolesEvent.KIND, arrayOf( arrayOf("role", "admin", "Full control"), arrayOf("role", "moderator"), ), - ) as SupportedRolesEvent + ) as GroupRolesEvent val roles = e.roles() assertEquals("admin", roles[0].name) assertEquals("Full control", roles[0].description) @@ -202,37 +202,37 @@ class Nip29ArmadaInteropTest { assertTrue(parse(CreateGroupEvent.KIND, arrayOf(arrayOf("h", gid)), pubKey = alice) is CreateGroupEvent) assertTrue(parse(DeleteGroupEvent.KIND, arrayOf(arrayOf("h", gid)), pubKey = alice) is DeleteGroupEvent) - val put = parse(PutUserEvent.KIND, arrayOf(arrayOf("h", gid), arrayOf("p", bob, "moderator")), pubKey = alice) as PutUserEvent + val put = parse(GroupPutUserEvent.KIND, arrayOf(arrayOf("h", gid), arrayOf("p", bob, "moderator")), pubKey = alice) as GroupPutUserEvent assertEquals(gid, put.groupId()) assertEquals(listOf(bob), put.userPubKeys()) - val remove = parse(RemoveUserEvent.KIND, arrayOf(arrayOf("h", gid), arrayOf("p", bob)), content = "spam", pubKey = alice) as RemoveUserEvent + val remove = parse(GroupRemoveUserEvent.KIND, arrayOf(arrayOf("h", gid), arrayOf("p", bob)), content = "spam", pubKey = alice) as GroupRemoveUserEvent assertEquals(listOf(bob), remove.userPubKeys()) assertEquals("spam", remove.content) - val del = parse(DeleteEventEvent.KIND, arrayOf(arrayOf("h", gid), arrayOf("e", "de".repeat(32))), pubKey = alice) as DeleteEventEvent + val del = parse(GroupDeleteEventEvent.KIND, arrayOf(arrayOf("h", gid), arrayOf("e", "de".repeat(32))), pubKey = alice) as GroupDeleteEventEvent assertEquals(listOf("de".repeat(32)), del.deletedEventIds()) - val invite = parse(CreateInviteEvent.KIND, arrayOf(arrayOf("h", gid), arrayOf("code", "abc123")), pubKey = alice) as CreateInviteEvent + val invite = parse(GroupCreateInviteEvent.KIND, arrayOf(arrayOf("h", gid), arrayOf("code", "abc123")), pubKey = alice) as GroupCreateInviteEvent assertEquals("abc123", invite.code()) - val edit = parse(EditMetadataEvent.KIND, arrayOf(arrayOf("h", gid), arrayOf("name", "N"), arrayOf("public"), arrayOf("open")), pubKey = alice) as EditMetadataEvent + val edit = parse(GroupEditMetadataEvent.KIND, arrayOf(arrayOf("h", gid), arrayOf("name", "N"), arrayOf("public"), arrayOf("open")), pubKey = alice) as GroupEditMetadataEvent assertEquals("N", edit.name()) assertEquals(gid, edit.groupId()) } @Test fun parsesJoinAndLeaveRequests() { - val join = parse(JoinRequestEvent.KIND, arrayOf(arrayOf("h", gid), arrayOf("code", "inv1")), content = "let me in", pubKey = alice) as JoinRequestEvent + val join = parse(GroupJoinRequestEvent.KIND, arrayOf(arrayOf("h", gid), arrayOf("code", "inv1")), content = "let me in", pubKey = alice) as GroupJoinRequestEvent assertEquals(gid, join.groupId()) assertEquals("inv1", join.inviteCode()) assertEquals("let me in", join.content) // Armada also sends a join with no code. - val joinNoCode = parse(JoinRequestEvent.KIND, arrayOf(arrayOf("h", gid)), pubKey = alice) as JoinRequestEvent + val joinNoCode = parse(GroupJoinRequestEvent.KIND, arrayOf(arrayOf("h", gid)), pubKey = alice) as GroupJoinRequestEvent assertNull(joinNoCode.inviteCode()) - val leave = parse(LeaveRequestEvent.KIND, arrayOf(arrayOf("h", gid)), pubKey = alice) as LeaveRequestEvent + val leave = parse(GroupLeaveRequestEvent.KIND, arrayOf(arrayOf("h", gid)), pubKey = alice) as GroupLeaveRequestEvent assertEquals(gid, leave.groupId()) } @@ -399,7 +399,7 @@ class Nip29ArmadaInteropTest { @Test fun buildsEditMetadataWithTopicsAndGeohashes() { val edit = - EditMetadataEvent.build( + GroupEditMetadataEvent.build( groupId = gid, name = "Bitcoin Devs", hashtags = listOf("bitcoin"), @@ -412,12 +412,12 @@ class Nip29ArmadaInteropTest { @Test fun buildsCreateAndModerationEvents() { assertTrue(CreateGroupEvent.build(gid).tags.any { it[0] == "h" && it[1] == gid }) - assertTrue(CreateInviteEvent.build(gid, "code42").tags.any { it[0] == "code" && it[1] == "code42" }) + assertTrue(GroupCreateInviteEvent.build(gid, "code42").tags.any { it[0] == "code" && it[1] == "code42" }) - val put = PutUserEvent.build(gid, listOf(bob to listOf("moderator"))).tags + val put = GroupPutUserEvent.build(gid, listOf(bob to listOf("moderator"))).tags assertTrue(put.any { it[0] == "p" && it[1] == bob && it.contains("moderator") }) - val remove = RemoveUserEvent.build(gid, listOf(bob)).tags + val remove = GroupRemoveUserEvent.build(gid, listOf(bob)).tags assertTrue(remove.any { it[0] == "p" && it[1] == bob }) // relay29 forks are avoided by NOT emitting `previous` when none provided. @@ -466,12 +466,12 @@ class Nip29ArmadaInteropTest { @Test fun buildsJoinLeaveAndGroupScopedChat() { - val join = JoinRequestEvent.build(gid, reason = "hi", inviteCode = "inv9") + val join = GroupJoinRequestEvent.build(gid, reason = "hi", inviteCode = "inv9") assertEquals("hi", join.content) assertTrue(join.tags.any { it[0] == "h" && it[1] == gid }) assertTrue(join.tags.any { it[0] == "code" && it[1] == "inv9" }) - assertTrue(LeaveRequestEvent.build(gid).tags.any { it[0] == "h" && it[1] == gid }) + assertTrue(GroupLeaveRequestEvent.build(gid).tags.any { it[0] == "h" && it[1] == gid }) // Group-scope a plain kind-9 chat message via the shared `hTag` helper. val chat = ChatEvent.build("gm") { hTag(gid) } diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/PinEventsTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/PinEventsTest.kt index b5ee8e80f3..27dea39abd 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/PinEventsTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/PinEventsTest.kt @@ -24,7 +24,7 @@ import com.vitorpamplona.quartz.buzz.cwChannelWindow.ThreadSummaryContent import com.vitorpamplona.quartz.buzz.cwChannelWindow.ThreadSummaryEvent import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupPinnedEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.UpdatePinListEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupUpdatePinListEvent import com.vitorpamplona.quartz.nip29RelayGroups.tags.GroupIdTag import com.vitorpamplona.quartz.utils.EventFactory import kotlin.test.Test @@ -90,19 +90,19 @@ class PinEventsTest { @Test fun updatePinListEventParsesGroupAndIds() { val tags = arrayOf(arrayOf("h", gid), arrayOf("e", id1), arrayOf("e", id2)) - val event: Event = EventFactory.create("00".repeat(32), relaySelf, 100, UpdatePinListEvent.KIND, tags, "", "22".repeat(64)) + val event: Event = EventFactory.create("00".repeat(32), relaySelf, 100, GroupUpdatePinListEvent.KIND, tags, "", "22".repeat(64)) - assertEquals(true, event is UpdatePinListEvent) - event as UpdatePinListEvent + assertEquals(true, event is GroupUpdatePinListEvent) + event as GroupUpdatePinListEvent assertEquals(gid, event.groupId()) assertEquals(listOf(id1, id2), event.pinnedEventIds()) } @Test fun updatePinListBuildCarriesHTagAndFullList() { - val template = UpdatePinListEvent.build(gid, listOf(id1, id2)) + val template = GroupUpdatePinListEvent.build(gid, listOf(id1, id2)) - assertEquals(UpdatePinListEvent.KIND, template.kind) + assertEquals(GroupUpdatePinListEvent.KIND, template.kind) assertEquals(gid, template.tags.firstOrNull { it[0] == GroupIdTag.TAG_NAME }?.getOrNull(1)) assertEquals(listOf(id1, id2), template.tags.filter { it[0] == "e" }.map { it[1] }) } diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/SubgroupTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/SubgroupTest.kt index cc4360e828..58d16706f6 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/SubgroupTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/SubgroupTest.kt @@ -21,7 +21,7 @@ package com.vitorpamplona.quartz.nip29RelayGroups import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMetadataEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.EditMetadataEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupEditMetadataEvent import com.vitorpamplona.quartz.utils.EventFactory import kotlin.test.Test import kotlin.test.assertEquals @@ -66,8 +66,8 @@ class SubgroupTest { @Test fun editMetadataRoundTripsParentAndChildren() { - val template = EditMetadataEvent.build("nostr", name = "Nostr", parent = "social", children = listOf("nip29")) - val event = EventFactory.create(id, relaySelf, template.createdAt, EditMetadataEvent.KIND, template.tags, "", sig) as EditMetadataEvent + val template = GroupEditMetadataEvent.build("nostr", name = "Nostr", parent = "social", children = listOf("nip29")) + val event = EventFactory.create(id, relaySelf, template.createdAt, GroupEditMetadataEvent.KIND, template.tags, "", sig) as GroupEditMetadataEvent assertEquals("nostr", event.groupId()) assertEquals("social", event.parent()) @@ -76,8 +76,8 @@ class SubgroupTest { @Test fun editMetadataWithoutParentRoots() { - val template = EditMetadataEvent.build("nostr", name = "Nostr") - val event = EventFactory.create(id, relaySelf, template.createdAt, EditMetadataEvent.KIND, template.tags, "", sig) as EditMetadataEvent + val template = GroupEditMetadataEvent.build("nostr", name = "Nostr") + val event = EventFactory.create(id, relaySelf, template.createdAt, GroupEditMetadataEvent.KIND, template.tags, "", sig) as GroupEditMetadataEvent assertNull(event.parent()) } diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip46RemoteSigner/server/BunkerRequestProcessorConcurrencyTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip46RemoteSigner/server/BunkerRequestProcessorConcurrencyTest.kt index 7ee9fdc303..5226a302ce 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip46RemoteSigner/server/BunkerRequestProcessorConcurrencyTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip46RemoteSigner/server/BunkerRequestProcessorConcurrencyTest.kt @@ -31,7 +31,7 @@ import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerRequestSign import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerResponse import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerResponseEvent import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.launch import kotlinx.coroutines.test.runTest @@ -101,7 +101,7 @@ class BunkerRequestProcessorConcurrencyTest { fromPublicKey: HexKey, ) = "" - override suspend fun decryptZapEvent(event: LnZapRequestEvent): LnZapPrivateEvent = throw NotImplementedError() + override suspend fun decryptZapEvent(event: ZapRequestEvent): LnZapPrivateEvent = throw NotImplementedError() override suspend fun deriveKey(nonce: HexKey): HexKey = throw NotImplementedError() diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip46RemoteSigner/server/BunkerRequestProcessorTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip46RemoteSigner/server/BunkerRequestProcessorTest.kt index 3533bb2959..bc5598a518 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip46RemoteSigner/server/BunkerRequestProcessorTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip46RemoteSigner/server/BunkerRequestProcessorTest.kt @@ -41,7 +41,7 @@ import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerResponseGetRelays import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerResponsePong import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerResponsePublicKey import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import kotlinx.coroutines.test.runTest import kotlin.test.Test import kotlin.test.assertEquals @@ -116,7 +116,7 @@ class BunkerRequestProcessorTest { return "nip44dec:$ciphertext" } - override suspend fun decryptZapEvent(event: LnZapRequestEvent): LnZapPrivateEvent = throw NotImplementedError() + override suspend fun decryptZapEvent(event: ZapRequestEvent): LnZapPrivateEvent = throw NotImplementedError() override suspend fun deriveKey(nonce: HexKey): HexKey = throw NotImplementedError() @@ -371,7 +371,7 @@ class BunkerRequestProcessorTest { fromPublicKey: HexKey, ) = "" - override suspend fun decryptZapEvent(event: LnZapRequestEvent): LnZapPrivateEvent = throw NotImplementedError() + override suspend fun decryptZapEvent(event: ZapRequestEvent): LnZapPrivateEvent = throw NotImplementedError() override suspend fun deriveKey(nonce: HexKey): HexKey = throw NotImplementedError() diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip46RemoteSigner/server/NostrConnectSignerServiceTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip46RemoteSigner/server/NostrConnectSignerServiceTest.kt index 3dcf86afd1..0e631bc3e1 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip46RemoteSigner/server/NostrConnectSignerServiceTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip46RemoteSigner/server/NostrConnectSignerServiceTest.kt @@ -39,7 +39,7 @@ import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerResponseEvent import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerResponsePublicKey import com.vitorpamplona.quartz.nip46RemoteSigner.NostrConnectEvent import com.vitorpamplona.quartz.nip57Zaps.LnZapPrivateEvent -import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapRequestEvent import com.vitorpamplona.quartz.utils.RandomInstance import com.vitorpamplona.quartz.utils.TimeUtils import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -112,7 +112,7 @@ class NostrConnectSignerServiceTest { fromPublicKey: HexKey, ) = ciphertext - override suspend fun decryptZapEvent(event: LnZapRequestEvent): LnZapPrivateEvent = throw NotImplementedError() + override suspend fun decryptZapEvent(event: ZapRequestEvent): LnZapPrivateEvent = throw NotImplementedError() override suspend fun deriveKey(nonce: HexKey): HexKey = throw NotImplementedError() diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/LnZapPaymentRequestNip44EventTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/LnZapPaymentRequestNip44EventTest.kt index 4e9a209c09..edc3143ba5 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/LnZapPaymentRequestNip44EventTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/LnZapPaymentRequestNip44EventTest.kt @@ -24,7 +24,7 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.core.toHexKey import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent import com.vitorpamplona.quartz.nip47WalletConnect.rpc.GetBalanceMethod import com.vitorpamplona.quartz.nip47WalletConnect.rpc.GetInfoMethod import kotlinx.coroutines.test.runTest @@ -44,7 +44,7 @@ class LnZapPaymentRequestNip44EventTest { val request = GetBalanceMethod.Companion.create() val event = - LnZapPaymentRequestEvent.Companion.createRequest( + NwcRequestEvent.Companion.createRequest( request = request, walletServicePubkey = walletServicePubkey, signer = clientSigner, @@ -68,7 +68,7 @@ class LnZapPaymentRequestNip44EventTest { val request = GetInfoMethod.Companion.create() val event = - LnZapPaymentRequestEvent.Companion.createRequest( + NwcRequestEvent.Companion.createRequest( request = request, walletServicePubkey = walletServicePubkey, signer = clientSigner, diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/NwcOutgoingMetadataTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/NwcOutgoingMetadataTest.kt index 8bddfc1446..c7020dc022 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/NwcOutgoingMetadataTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/NwcOutgoingMetadataTest.kt @@ -84,7 +84,7 @@ class NwcOutgoingMetadataTest { /** * THE INTEROP PROPERTY. NIP-57 sets a zap invoice's `description_hash` to the * sha256 of the raw JSON the LNURL callback received in `nostr=` — which is - * `LnZapRequestEvent.toJson()` (see LightningAddressResolver). A wallet that + * `ZapRequestEvent.toJson()` (see LightningAddressResolver). A wallet that * binds a stored zap request to the invoice it labels hashes the bytes of the * `nostr` member, so anything short of byte-identity reads as a forged event * and the row is silently stored unlabelled. diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/NwcRefusalRoundTripTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/NwcRefusalRoundTripTest.kt index e90ea7e6a2..9c69def4ca 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/NwcRefusalRoundTripTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/NwcRefusalRoundTripTest.kt @@ -23,8 +23,8 @@ package com.vitorpamplona.quartz.nip47WalletConnect import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip47WalletConnect.cache.NostrWalletConnectResponseCache -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentResponseEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcResponseEvent import com.vitorpamplona.quartz.nip47WalletConnect.rpc.IErrorResponseLike import com.vitorpamplona.quartz.nip47WalletConnect.rpc.PayInvoiceMethod import kotlinx.coroutines.test.runTest @@ -50,14 +50,14 @@ class NwcRefusalRoundTripTest { for (useNip44 in listOf(false, true)) { val request = - LnZapPaymentRequestEvent.createRequest( + NwcRequestEvent.createRequest( PayInvoiceMethod.create("lnbc50n1pjtest"), walletSigner.pubKey, clientSigner, useNip44 = useNip44, ) - // Encrypted by hand rather than through LnZapPaymentResponseEvent.createResponse, + // Encrypted by hand rather than through NwcResponseEvent.createResponse, // which re-serializes a Response: the point is the wallet's bytes, verbatim. val encrypted = if (useNip44) { @@ -66,9 +66,9 @@ class NwcRefusalRoundTripTest { walletSigner.nip04Encrypt(walletJson, clientSigner.pubKey) } val reply = - walletSigner.sign( + walletSigner.sign( request.createdAt, - LnZapPaymentResponseEvent.KIND, + NwcResponseEvent.KIND, arrayOf(arrayOf("p", clientSigner.pubKey), arrayOf("e", request.id)), encrypted, ) diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/LnZapPaymentRequestEventTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/NwcRequestEventTest.kt similarity index 93% rename from quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/LnZapPaymentRequestEventTest.kt rename to quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/NwcRequestEventTest.kt index 07fa5ac130..2b3f56f594 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/LnZapPaymentRequestEventTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip47WalletConnect/NwcRequestEventTest.kt @@ -24,7 +24,7 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.core.toHexKey import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal -import com.vitorpamplona.quartz.nip47WalletConnect.events.LnZapPaymentRequestEvent +import com.vitorpamplona.quartz.nip47WalletConnect.events.NwcRequestEvent import com.vitorpamplona.quartz.nip47WalletConnect.rpc.GetBalanceMethod import com.vitorpamplona.quartz.nip47WalletConnect.rpc.MakeInvoiceMethod import com.vitorpamplona.quartz.nip47WalletConnect.rpc.PayInvoiceMethod @@ -36,10 +36,10 @@ import kotlin.test.assertNotNull import kotlin.test.assertNull import kotlin.test.assertTrue -class LnZapPaymentRequestEventTest { +class NwcRequestEventTest { @Test fun testEventKind() { - assertEquals(23194, LnZapPaymentRequestEvent.KIND) + assertEquals(23194, NwcRequestEvent.KIND) } @Test @@ -52,7 +52,7 @@ class LnZapPaymentRequestEventTest { walletKeyPair.pubKey.toHexKey() val event = - LnZapPaymentRequestEvent.create( + NwcRequestEvent.create( lnInvoice = "lnbc50n1...", walletServicePubkey = walletServicePubkey, signer = clientSigner, @@ -77,7 +77,7 @@ class LnZapPaymentRequestEventTest { val request = GetBalanceMethod.create() val event = - LnZapPaymentRequestEvent.createRequest( + NwcRequestEvent.createRequest( request = request, walletServicePubkey = walletServicePubkey, signer = clientSigner, @@ -101,7 +101,7 @@ class LnZapPaymentRequestEventTest { walletKeyPair.pubKey.toHexKey() val event = - LnZapPaymentRequestEvent.create( + NwcRequestEvent.create( lnInvoice = "lnbc50n1...", walletServicePubkey = walletServicePubkey, signer = clientSigner, @@ -125,7 +125,7 @@ class LnZapPaymentRequestEventTest { val request = MakeInvoiceMethod.create(5000L, "test payment") val event = - LnZapPaymentRequestEvent.createRequest( + NwcRequestEvent.createRequest( request = request, walletServicePubkey = walletServicePubkey, signer = clientSigner, @@ -150,7 +150,7 @@ class LnZapPaymentRequestEventTest { walletKeyPair.pubKey.toHexKey() val event = - LnZapPaymentRequestEvent.create( + NwcRequestEvent.create( lnInvoice = "lnbc50n1...", walletServicePubkey = walletServicePubkey, signer = clientSigner, diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip50Search/SearchFieldExtractorTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip50Search/SearchFieldExtractorTest.kt index 3075095a39..5d044ecb52 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip50Search/SearchFieldExtractorTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip50Search/SearchFieldExtractorTest.kt @@ -33,15 +33,15 @@ import com.vitorpamplona.quartz.nip15Marketplace.product.ProductEvent import com.vitorpamplona.quartz.nip15Marketplace.stall.StallEvent import com.vitorpamplona.quartz.nip17Dm.messages.ChatMessageEvent import com.vitorpamplona.quartz.nip22Comments.CommentEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent -import com.vitorpamplona.quartz.nip29RelayGroups.moderation.EditMetadataEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent +import com.vitorpamplona.quartz.nip29RelayGroups.moderation.GroupEditMetadataEvent import com.vitorpamplona.quartz.nip32Labeling.LabelEvent import com.vitorpamplona.quartz.nip34Git.repository.GitRepositoryEvent import com.vitorpamplona.quartz.nip35Torrents.TorrentEvent import com.vitorpamplona.quartz.nip53LiveActivities.meetingSpaces.MeetingSpaceEvent import com.vitorpamplona.quartz.nip5aStaticWebsites.NamedSiteEvent import com.vitorpamplona.quartz.nip69P2pOrderEvents.P2POrderEvent -import com.vitorpamplona.quartz.nip85TrustedAssertions.users.ContactCardEvent +import com.vitorpamplona.quartz.nip85TrustedAssertions.users.UserAssertionEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent import com.vitorpamplona.quartz.nip89AppHandlers.definition.AppDefinitionEvent import com.vitorpamplona.quartz.nipB0WebBookmarks.WebBookmarkEvent @@ -72,7 +72,7 @@ class SearchFieldExtractorTest { @Test fun longFormDecomposesIntoTitleSummaryHashtagsContent() { val tags = arrayOf(arrayOf("d", "post"), arrayOf("title", "My Post"), arrayOf("summary", "tl;dr"), arrayOf("t", "nostr"), arrayOf("t", "search")) - val fields = SearchFieldExtractor.extract(LongTextNoteEvent("2".repeat(64), alice, 1L, tags, "the whole article", "")) + val fields = SearchFieldExtractor.extract(LongFormContentEvent("2".repeat(64), alice, 1L, tags, "the whole article", "")) assertEquals(IndexableFields.Tiered(primary = listOf("My Post"), secondary = listOf("tl;dr"), text = "the whole article", hashtags = listOf("nostr", "search")), fields) } @@ -165,7 +165,7 @@ class SearchFieldExtractorTest { arrayOf("t", "bitcoin"), arrayOf("rank", "87"), ) - val fields = SearchFieldExtractor.extract(ContactCardEvent("f".repeat(64), alice, 1L, tags, "", "")) + val fields = SearchFieldExtractor.extract(UserAssertionEvent("f".repeat(64), alice, 1L, tags, "", "")) assertEquals( IndexableFields.Tiered( primary = listOf("Verified Human"), @@ -184,7 +184,7 @@ class SearchFieldExtractorTest { // role, once -- and a hashtags-only extraction must not normalize to // None (Tiered.isEmpty() compares against a fully-empty Tiered). val tags = arrayOf(arrayOf("d", alice), arrayOf("t", "bitcoin"), arrayOf("t", "nostr"), arrayOf("rank", "87")) - val fields = SearchFieldExtractor.extract(ContactCardEvent("2a".repeat(32), alice, 1L, tags, "encrypted", "")) + val fields = SearchFieldExtractor.extract(UserAssertionEvent("2a".repeat(32), alice, 1L, tags, "encrypted", "")) assertEquals(IndexableFields.Tiered(hashtags = listOf("bitcoin", "nostr")), fields) } @@ -194,7 +194,7 @@ class SearchFieldExtractorTest { // encrypted content, which is never indexed -- so a card carrying only // scores has nothing to search. val tags = arrayOf(arrayOf("d", alice), arrayOf("rank", "87"), arrayOf("followers", "1200")) - assertEquals(IndexableFields.None, SearchFieldExtractor.extract(ContactCardEvent("1a".repeat(32), alice, 1L, tags, "encrypted", ""))) + assertEquals(IndexableFields.None, SearchFieldExtractor.extract(UserAssertionEvent("1a".repeat(32), alice, 1L, tags, "encrypted", ""))) } @Test @@ -270,7 +270,7 @@ class SearchFieldExtractorTest { // kind 9002 edits what kind 39000 publishes; it was the only half of // the pair without a branch. Its hashtags() is `t`: carried once. val tags = arrayOf(arrayOf("h", "grp"), arrayOf("name", "Nostr Devs"), arrayOf("about", "we build"), arrayOf("t", "nostr")) - val fields = SearchFieldExtractor.extract(EditMetadataEvent("23".repeat(32), alice, 1L, tags, "", "")) + val fields = SearchFieldExtractor.extract(GroupEditMetadataEvent("23".repeat(32), alice, 1L, tags, "", "")) assertEquals( IndexableFields.Tiered(primary = listOf("Nostr Devs"), secondary = listOf("we build"), hashtags = listOf("nostr")), fields, diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/RelayFeedsListEventTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/FavoriteRelayListEventTest.kt similarity index 87% rename from quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/RelayFeedsListEventTest.kt rename to quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/FavoriteRelayListEventTest.kt index 40af5a2166..62e54bdc8f 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/RelayFeedsListEventTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/FavoriteRelayListEventTest.kt @@ -28,7 +28,7 @@ import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue -class RelayFeedsListEventTest { +class FavoriteRelayListEventTest { private val signer = NostrSignerInternal("nsec10g0wheggqn9dawlc0yuv6adnat6n09anr7eyykevw2dm8xa5fffs0wsdsr".nsecToKeyPair()) private val damus = RelayUrlNormalizer.normalize("wss://relay.damus.io") @@ -37,7 +37,7 @@ class RelayFeedsListEventTest { @Test fun kindMatchesSpec() { - assertEquals(10012, RelayFeedsListEvent.KIND) + assertEquals(10012, FavoriteRelayListEvent.KIND) } /** @@ -49,8 +49,8 @@ class RelayFeedsListEventTest { fun removingOneRelayKeepsTheOtherPublicEntriesPublic() = runTest { val fromAnotherClient = - signer.sign( - RelayFeedsListEvent.build( + signer.sign( + FavoriteRelayListEvent.build( publicRelays = listOf(damus, nosLol), signer = signer, createdAt = 1740669816, @@ -60,7 +60,7 @@ class RelayFeedsListEventTest { assertEquals(listOf(damus, nosLol), fromAnotherClient.publicRelays()) val afterRemoval = - RelayFeedsListEvent.updateRelayList( + FavoriteRelayListEvent.updateRelayList( earlierVersion = fromAnotherClient, relays = listOf(damus), signer = signer, @@ -79,8 +79,8 @@ class RelayFeedsListEventTest { fun privateRelaysStayPrivate() = runTest { val mixed = - signer.sign( - RelayFeedsListEvent.build( + signer.sign( + FavoriteRelayListEvent.build( publicRelays = listOf(damus), privateRelays = listOf(nosLol, primal), signer = signer, @@ -89,7 +89,7 @@ class RelayFeedsListEventTest { ) val afterRemoval = - RelayFeedsListEvent.updateRelayList( + FavoriteRelayListEvent.updateRelayList( earlierVersion = mixed, relays = listOf(damus, nosLol), signer = signer, @@ -104,8 +104,8 @@ class RelayFeedsListEventTest { fun newRelaysFollowTheConventionOfTheList() = runTest { val publicOnly = - signer.sign( - RelayFeedsListEvent.build( + signer.sign( + FavoriteRelayListEvent.build( publicRelays = listOf(damus), signer = signer, createdAt = 1740669816, @@ -113,7 +113,7 @@ class RelayFeedsListEventTest { ) val afterAdd = - RelayFeedsListEvent.updateRelayList( + FavoriteRelayListEvent.updateRelayList( earlierVersion = publicOnly, relays = listOf(damus, nosLol), signer = signer, @@ -127,8 +127,8 @@ class RelayFeedsListEventTest { ) val privateOnly = - signer.sign( - RelayFeedsListEvent.build( + signer.sign( + FavoriteRelayListEvent.build( privateRelays = listOf(damus), signer = signer, createdAt = 1740669816, @@ -136,7 +136,7 @@ class RelayFeedsListEventTest { ) val afterPrivateAdd = - RelayFeedsListEvent.updateRelayList( + FavoriteRelayListEvent.updateRelayList( earlierVersion = privateOnly, relays = listOf(damus, nosLol), signer = signer, @@ -151,8 +151,8 @@ class RelayFeedsListEventTest { fun keepsUnrelatedTags() = runTest { val withTitle = - signer.sign( - RelayFeedsListEvent.build( + signer.sign( + FavoriteRelayListEvent.build( publicRelays = listOf(damus, nosLol), signer = signer, createdAt = 1740669816, @@ -162,7 +162,7 @@ class RelayFeedsListEventTest { ) val afterRemoval = - RelayFeedsListEvent.updateRelayList( + FavoriteRelayListEvent.updateRelayList( earlierVersion = withTitle, relays = listOf(nosLol), signer = signer, diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/RelayListPublicEntriesTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/RelayListPublicEntriesTest.kt index a4eb27a872..5111ca4c15 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/RelayListPublicEntriesTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip51Lists/relayLists/RelayListPublicEntriesTest.kt @@ -62,8 +62,8 @@ class RelayListPublicEntriesTest { @Test fun relayFeedsListKeepsTheSurvivorPublic() = runTest { - val before = publicListFromAnotherClient(RelayFeedsListEvent.KIND) - val after = RelayFeedsListEvent.updateRelayList(before, listOf(damus), signer, 1740669817) + val before = publicListFromAnotherClient(FavoriteRelayListEvent.KIND) + val after = FavoriteRelayListEvent.updateRelayList(before, listOf(damus), signer, 1740669817) assertEquals(listOf(damus), after.tags.relays()) } diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip52Calendar/CalendarHintProviderTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip52Calendar/CalendarHintProviderTest.kt index dba5cf91cd..42fc62755e 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip52Calendar/CalendarHintProviderTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip52Calendar/CalendarHintProviderTest.kt @@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.hints.PubKeyHintProvider import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip52Calendar.appt.day.CalendarDateSlotEvent import com.vitorpamplona.quartz.nip52Calendar.appt.time.CalendarTimeSlotEvent -import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarEvent +import com.vitorpamplona.quartz.nip52Calendar.calendar.CalendarCollectionEvent import com.vitorpamplona.quartz.nip52Calendar.rsvp.CalendarRSVPEvent import kotlin.test.Test import kotlin.test.assertEquals @@ -66,7 +66,7 @@ class CalendarHintProviderTest { ) private fun calendar(vararg tags: Array) = - CalendarEvent( + CalendarCollectionEvent( id = "33".repeat(32), pubKey = host, createdAt = 1700000000, diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip54Wiki/WikiCollaborationTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip54Wiki/WikiCollaborationTest.kt index 6a81dd3b56..1d015a2d68 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip54Wiki/WikiCollaborationTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip54Wiki/WikiCollaborationTest.kt @@ -36,7 +36,7 @@ class WikiCollaborationTest { private fun mergeRequest(vararg tags: Array) = WikiMergeRequestEvent("id", "pk", 0L, arrayOf(*tags), "why", "sig") - private fun coordinate() = "${WikiNoteEvent.KIND}:$destination:hot-ice-creams" + private fun coordinate() = "${WikiArticleEvent.KIND}:$destination:hot-ice-creams" // ---- kind 818 -------------------------------------------------------------------------- @@ -115,7 +115,7 @@ class WikiCollaborationTest { fun buildsWithTheSpecMarker() { val template = WikiMergeRequestEvent.build( - targetArticle = Address(WikiNoteEvent.KIND, destination, "hot-ice-creams"), + targetArticle = Address(WikiArticleEvent.KIND, destination, "hot-ice-creams"), destinationAuthor = destination, mergeSourceId = fork, explanation = "I added a section", @@ -180,7 +180,7 @@ class WikiCollaborationTest { 0L, arrayOf( arrayOf("d", "shell-structure"), - arrayOf("a", "${WikiNoteEvent.KIND}:$destination:thin-shell-structure"), + arrayOf("a", "${WikiArticleEvent.KIND}:$destination:thin-shell-structure"), ), "", "sig", @@ -232,11 +232,11 @@ class WikiCollaborationTest { @Test fun buildsARedirectWithANormalizedSlug() { val template = - WikiRedirectEvent.build("Shell Structure", Address(WikiNoteEvent.KIND, destination, "thin-shell-structure")) + WikiRedirectEvent.build("Shell Structure", Address(WikiArticleEvent.KIND, destination, "thin-shell-structure")) val tags = template.tags.associate { it[0] to it[1] } assertEquals("shell-structure", tags["d"]) - assertEquals("${WikiNoteEvent.KIND}:$destination:thin-shell-structure", tags["a"]) + assertEquals("${WikiArticleEvent.KIND}:$destination:thin-shell-structure", tags["a"]) assertEquals("", template.content) } } diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapRequestAnonTagTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapRequestAnonTagTest.kt index e22a2030d5..9592029d3c 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapRequestAnonTagTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapRequestAnonTagTest.kt @@ -57,8 +57,8 @@ class LnZapRequestAnonTagTest { sig = "b".repeat(128), ) - private suspend fun request(zapType: LnZapEvent.ZapType) = - LnZapRequestEvent.create( + private suspend fun request(zapType: ZapReceiptEvent.ZapType) = + ZapRequestEvent.create( zappedEvent = zappedEvent, relays = relays, signer = signer, @@ -71,7 +71,7 @@ class LnZapRequestAnonTagTest { @Test fun `public zap request has no anon tag and is signed by the sender`() = runTest { - val zapRequest = request(LnZapEvent.ZapType.PUBLIC) + val zapRequest = request(ZapReceiptEvent.ZapType.PUBLIC) assertFalse(zapRequest.hasAnonTag()) assertFalse(zapRequest.isPrivateZap()) @@ -81,7 +81,7 @@ class LnZapRequestAnonTagTest { @Test fun `anonymous zap request has anon tag but is not private`() = runTest { - val zapRequest = request(LnZapEvent.ZapType.ANONYMOUS) + val zapRequest = request(ZapReceiptEvent.ZapType.ANONYMOUS) assertTrue(zapRequest.hasAnonTag()) assertFalse(zapRequest.isPrivateZap()) @@ -98,12 +98,12 @@ class LnZapRequestAnonTagTest { fun `anonymous profile zap request keeps the message public`() = runTest { val zapRequest = - LnZapRequestEvent.create( + ZapRequestEvent.create( userHex = receiverPubKey, relays = relays, signer = signer, message = "great work", - zapType = LnZapEvent.ZapType.ANONYMOUS, + zapType = ZapReceiptEvent.ZapType.ANONYMOUS, ) assertTrue(zapRequest.hasAnonTag()) @@ -115,7 +115,7 @@ class LnZapRequestAnonTagTest { @Test fun `private zap request has anon tag and is private and hides the sender key`() = runTest { - val zapRequest = request(LnZapEvent.ZapType.PRIVATE) + val zapRequest = request(ZapReceiptEvent.ZapType.PRIVATE) assertTrue(zapRequest.hasAnonTag()) assertTrue(zapRequest.isPrivateZap()) diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapRequestGroupTagTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapRequestGroupTagTest.kt index 2553b9e31d..07451237b4 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapRequestGroupTagTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapRequestGroupTagTest.kt @@ -63,13 +63,13 @@ class LnZapRequestGroupTagTest { ) private suspend fun zapRequestFor(zapped: Event) = - LnZapRequestEvent.create( + ZapRequestEvent.create( zappedEvent = zapped, relays = relays, signer = nostrSigner, pollOption = null, message = "", - zapType = LnZapEvent.ZapType.PUBLIC, + zapType = ZapReceiptEvent.ZapType.PUBLIC, toUserPubHex = null, ) diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapRequestKindTagTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapRequestKindTagTest.kt index 0ba8202418..1ba8c3c279 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapRequestKindTagTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/LnZapRequestKindTagTest.kt @@ -52,13 +52,13 @@ class LnZapRequestKindTagTest { val relays = setOf(NormalizedRelayUrl("wss://relay.example.com/")) val zapRequest = - LnZapRequestEvent.create( + ZapRequestEvent.create( zappedEvent = publicMsg, relays = relays, signer = nostrSigner, pollOption = null, message = "", - zapType = LnZapEvent.ZapType.PUBLIC, + zapType = ZapReceiptEvent.ZapType.PUBLIC, toUserPubHex = null, ) @@ -84,13 +84,13 @@ class LnZapRequestKindTagTest { val relays = setOf(NormalizedRelayUrl("wss://relay.example.com/")) val zapRequest = - LnZapRequestEvent.create( + ZapRequestEvent.create( zappedEvent = kind1Event, relays = relays, signer = nostrSigner, pollOption = null, message = "", - zapType = LnZapEvent.ZapType.PUBLIC, + zapType = ZapReceiptEvent.ZapType.PUBLIC, toUserPubHex = null, ) @@ -105,12 +105,12 @@ class LnZapRequestKindTagTest { val relays = setOf(NormalizedRelayUrl("wss://relay.example.com/")) val zapRequest = - LnZapRequestEvent.create( + ZapRequestEvent.create( userHex = receiverPubKey, relays = relays, signer = nostrSigner, message = "", - zapType = LnZapEvent.ZapType.PUBLIC, + zapType = ZapReceiptEvent.ZapType.PUBLIC, ) val kTag = zapRequest.tags.firstOrNull { it[0] == "k" } diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/validate/LnZapReceiptValidatorTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/validate/LnZapReceiptValidatorTest.kt index a3ce50b8d2..ef3344b0b0 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/validate/LnZapReceiptValidatorTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip57Zaps/validate/LnZapReceiptValidatorTest.kt @@ -20,7 +20,7 @@ */ package com.vitorpamplona.quartz.nip57Zaps.validate -import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent +import com.vitorpamplona.quartz.nip57Zaps.ZapReceiptEvent import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertIs @@ -62,13 +62,13 @@ class LnZapReceiptValidatorTest { signerPubkey: String = providerPubkey, bolt11: String? = invoice100kSats, description: String? = zapRequestJson(), - ): LnZapEvent { + ): ZapReceiptEvent { val tags = mutableListOf>() tags.add(arrayOf("p", recipientPubkey)) if (bolt11 != null) tags.add(arrayOf("bolt11", bolt11)) if (description != null) tags.add(arrayOf("description", description)) - return LnZapEvent( + return ZapReceiptEvent( id = "f".repeat(64), pubKey = signerPubkey, createdAt = 1700000001, diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/NutzapInfoEventTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/NutzapInfoEventTest.kt index 4b9c4dd50e..06eb717482 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/NutzapInfoEventTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/NutzapInfoEventTest.kt @@ -22,7 +22,7 @@ package com.vitorpamplona.quartz.nip61Nutzaps import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip61Nutzaps.info.NutzapInfoEvent import com.vitorpamplona.quartz.nip61Nutzaps.info.tags.NutzapMintTag import com.vitorpamplona.quartz.utils.nsecToKeyPair @@ -75,7 +75,7 @@ class NutzapInfoEventTest { fun deletionTargetsTheReplaceableAddress() = runTest { val empty = signer.sign(NutzapInfoEvent.buildEmpty()) - val deletion = signer.sign(DeletionEvent.build(listOf(empty))) + val deletion = signer.sign(DeletionRequestEvent.build(listOf(empty))) // NIP-09 deletion of a replaceable event needs the `a` address // coordinate so compliant relays drop all versions, plus the `e` diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/NutzapRedemptionTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/NutzapRedemptionTest.kt new file mode 100644 index 0000000000..28500b137b --- /dev/null +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip61Nutzaps/NutzapRedemptionTest.kt @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2025 Vitor Pamplona + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the + * Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +package com.vitorpamplona.quartz.nip61Nutzaps + +import com.vitorpamplona.quartz.nip01Core.core.Event +import com.vitorpamplona.quartz.nip01Core.hints.EventHintBundle +import com.vitorpamplona.quartz.nip60Cashu.history.CashuSpendingHistoryEvent +import com.vitorpamplona.quartz.nip60Cashu.token.CashuTokenEvent +import com.vitorpamplona.quartz.nip61Nutzaps.nutzap.NutzapEvent +import com.vitorpamplona.quartz.nip61Nutzaps.redemption.buildNutzapRedemption +import com.vitorpamplona.quartz.utils.EventFactory +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertIs + +/** + * NIP-61 reuses the NIP-60 wallet kinds: redeemed tokens are kind 7375 wallet token + * events and redemptions are kind 7376 spending history events. Each kind has a + * single class, so what EventFactory builds must expose the NIP-61 fields. + */ +class NutzapRedemptionTest { + private val sender = "1".repeat(64) + private val nutzap = NutzapEvent("a".repeat(64), sender, 1, emptyArray(), "", "b".repeat(128)) + + @Test + fun redemptionIsParsedAsSpendingHistory() { + val template = CashuSpendingHistoryEvent.buildNutzapRedemption(EventHintBundle(nutzap), "encrypted") + assertEquals(CashuSpendingHistoryEvent.KIND, template.kind) + + val event = EventFactory.create("c".repeat(64), "2".repeat(64), 2, template.kind, template.tags, template.content, "d".repeat(128)) + val history = assertIs(event) + + assertEquals(listOf(nutzap.id), history.redeemedNutzaps().map { it.eventId }) + assertEquals(listOf(nutzap.id), history.redeemedReferences().map { it.eventId }) + assertEquals(listOf(sender), history.linkedPubKeys()) + } + + @Test + fun walletTokenKindHasOneClass() { + val event = EventFactory.create("c".repeat(64), "2".repeat(64), 2, CashuTokenEvent.KIND, emptyArray(), "", "d".repeat(128)) + assertIs(event) + } +} diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip71Video/AddressableVideoEventAddressTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip71Video/AddressableVideoEventAddressTest.kt index e31e88f745..283756ee98 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip71Video/AddressableVideoEventAddressTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip71Video/AddressableVideoEventAddressTest.kt @@ -53,7 +53,7 @@ class AddressableVideoEventAddressTest { @Test fun verticalVideoAddressUsesDTag() { val event = - VideoVerticalEvent( + AddressableShortVideoEvent( id = "bfe2f2244fefc7cebc7b2eae825495f99dabb4649ee3f90ab1fa33bcd1e9bb9f", pubKey = pubkey, createdAt = 1780894816, @@ -62,13 +62,13 @@ class AddressableVideoEventAddressTest { sig = "", ) - assertAddressUsesDTag(VideoVerticalEvent.KIND, event) + assertAddressUsesDTag(AddressableShortVideoEvent.KIND, event) } @Test fun horizontalVideoAddressUsesDTag() { val event = - VideoHorizontalEvent( + AddressableNormalVideoEvent( id = "bfe2f2244fefc7cebc7b2eae825495f99dabb4649ee3f90ab1fa33bcd1e9bb9f", pubKey = pubkey, createdAt = 1780894816, @@ -77,13 +77,13 @@ class AddressableVideoEventAddressTest { sig = "", ) - assertAddressUsesDTag(VideoHorizontalEvent.KIND, event) + assertAddressUsesDTag(AddressableNormalVideoEvent.KIND, event) } @Test fun videoWithoutDTagFallsBackToEmptyAddress() { val event = - VideoVerticalEvent( + AddressableShortVideoEvent( id = "bfe2f2244fefc7cebc7b2eae825495f99dabb4649ee3f90ab1fa33bcd1e9bb9f", pubKey = pubkey, createdAt = 1780894816, @@ -93,7 +93,7 @@ class AddressableVideoEventAddressTest { ) assertEquals("", event.dTag()) - assertEquals(Address(VideoVerticalEvent.KIND, pubkey, ""), event.address()) - assertEquals("${VideoVerticalEvent.KIND}:$pubkey:", event.addressTag()) + assertEquals(Address(AddressableShortVideoEvent.KIND, pubkey, ""), event.address()) + assertEquals("${AddressableShortVideoEvent.KIND}:$pubkey:", event.addressTag()) } } diff --git a/quartz/src/jvmAndroidTest/kotlin/com/vitorpamplona/quartz/marmot/MarmotMipBehaviorTest.kt b/quartz/src/jvmAndroidTest/kotlin/com/vitorpamplona/quartz/marmot/MarmotMipBehaviorTest.kt index 711852c67e..32d09a3046 100644 --- a/quartz/src/jvmAndroidTest/kotlin/com/vitorpamplona/quartz/marmot/MarmotMipBehaviorTest.kt +++ b/quartz/src/jvmAndroidTest/kotlin/com/vitorpamplona/quartz/marmot/MarmotMipBehaviorTest.kt @@ -33,7 +33,7 @@ import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray import com.vitorpamplona.quartz.nip01Core.core.toHexKey import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal -import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealedRumorEvent +import com.vitorpamplona.quartz.nip59Giftwrap.seals.SealEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import kotlinx.coroutines.runBlocking import kotlin.test.Test @@ -350,8 +350,8 @@ class MarmotMipBehaviorTest { // Bob unwraps: kind:1059 → kind:13 (Seal) → kind:444 (Rumor). val sealed = delivery.giftWrapEvent.unwrapThrowing(bobSigner) - assertEquals(SealedRumorEvent.KIND, sealed.kind, "Middle layer MUST be NIP-59 Seal kind:13") - assertIs(sealed) + assertEquals(SealEvent.KIND, sealed.kind, "Middle layer MUST be NIP-59 Seal kind:13") + assertIs(sealed) val rumor = sealed.unsealThrowing(bobSigner) assertEquals(WelcomeEvent.KIND, rumor.kind, "Innermost rumor MUST be kind:444") diff --git a/quartz/src/jvmAndroidTest/kotlin/com/vitorpamplona/quartz/nip01Core/jackson/JacksonMapperTest.kt b/quartz/src/jvmAndroidTest/kotlin/com/vitorpamplona/quartz/nip01Core/jackson/JacksonMapperTest.kt index fb949ca47d..76022f4303 100644 --- a/quartz/src/jvmAndroidTest/kotlin/com/vitorpamplona/quartz/nip01Core/jackson/JacksonMapperTest.kt +++ b/quartz/src/jvmAndroidTest/kotlin/com/vitorpamplona/quartz/nip01Core/jackson/JacksonMapperTest.kt @@ -23,7 +23,7 @@ package com.vitorpamplona.quartz.nip01Core.jackson import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip59Giftwrap.rumors.Rumor import kotlin.test.Test import kotlin.test.assertContentEquals @@ -46,7 +46,7 @@ class JacksonMapperTest { ) val followCard = - FollowListEvent( + StarterPackEvent( id = "eca31634fce7c9068b56fa8db9f387da70bdcceb3986a77ca1a9844f3128eb5f", pubKey = "3c39a7b53dec9ac85acf08b267637a9841e6df7b7b0f5e2ac56a8cf107de37da", createdAt = 1761736286, diff --git a/quartz/src/jvmAndroidTest/kotlin/com/vitorpamplona/quartz/nip01Core/kotlinSerialization/KotlinSerializationMapperTest.kt b/quartz/src/jvmAndroidTest/kotlin/com/vitorpamplona/quartz/nip01Core/kotlinSerialization/KotlinSerializationMapperTest.kt index 40e7aa5884..a3ee938277 100644 --- a/quartz/src/jvmAndroidTest/kotlin/com/vitorpamplona/quartz/nip01Core/kotlinSerialization/KotlinSerializationMapperTest.kt +++ b/quartz/src/jvmAndroidTest/kotlin/com/vitorpamplona/quartz/nip01Core/kotlinSerialization/KotlinSerializationMapperTest.kt @@ -39,7 +39,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerRequest import com.vitorpamplona.quartz.nip46RemoteSigner.BunkerResponse -import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent +import com.vitorpamplona.quartz.nip51Lists.followList.StarterPackEvent import com.vitorpamplona.quartz.nip59Giftwrap.rumors.Rumor import kotlin.test.Test import kotlin.test.assertContentEquals @@ -65,7 +65,7 @@ class KotlinSerializationMapperTest { ) val followCard = - FollowListEvent( + StarterPackEvent( id = "eca31634fce7c9068b56fa8db9f387da70bdcceb3986a77ca1a9844f3128eb5f", pubKey = "3c39a7b53dec9ac85acf08b267637a9841e6df7b7b0f5e2ac56a8cf107de37da", createdAt = 1761736286, @@ -194,7 +194,7 @@ class KotlinSerializationMapperTest { fun deserializeEventWithSpecialCharactersInContent() { val content = "Hello \"world\" \n\ttab\\backslash" val event = - FollowListEvent( + StarterPackEvent( id = "abc", pubKey = "def", createdAt = 1000, @@ -769,7 +769,7 @@ class KotlinSerializationMapperTest { @Test fun emptyContentEvent() { val event = - FollowListEvent( + StarterPackEvent( id = "a".repeat(64), pubKey = "b".repeat(64), createdAt = 0, @@ -796,7 +796,7 @@ class KotlinSerializationMapperTest { fun eventWithUnicodeContent() { val content = "Hello \uD83D\uDE00 world \u00E9\u00E8\u00EA" val event = - FollowListEvent( + StarterPackEvent( id = "a".repeat(64), pubKey = "b".repeat(64), createdAt = 1000, diff --git a/quartz/src/jvmAndroidTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/RelayGroupFilterServingRelayTest.kt b/quartz/src/jvmAndroidTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/RelayGroupFilterServingRelayTest.kt index 1bf3edf89c..bd1395c3df 100644 --- a/quartz/src/jvmAndroidTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/RelayGroupFilterServingRelayTest.kt +++ b/quartz/src/jvmAndroidTest/kotlin/com/vitorpamplona/quartz/nip29RelayGroups/RelayGroupFilterServingRelayTest.kt @@ -31,7 +31,7 @@ import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupAdminsEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMembersEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupMetadataEvent import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupPinnedEvent -import com.vitorpamplona.quartz.nip29RelayGroups.metadata.SupportedRolesEvent +import com.vitorpamplona.quartz.nip29RelayGroups.metadata.GroupRolesEvent import com.vitorpamplona.quartz.nip29RelayGroups.tags.GroupIdTag import com.vitorpamplona.quartz.nip7DThreads.ThreadEvent import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent @@ -72,7 +72,7 @@ class RelayGroupFilterServingRelayTest : RelayClientTest() { GroupMetadataEvent.KIND -> GroupMetadataEvent(id, relayKey, 100L, tags, "", sig) GroupAdminsEvent.KIND -> GroupAdminsEvent(id, relayKey, 100L, tags, "", sig) GroupMembersEvent.KIND -> GroupMembersEvent(id, relayKey, 100L, tags, "", sig) - SupportedRolesEvent.KIND -> SupportedRolesEvent(id, relayKey, 100L, tags, "", sig) + GroupRolesEvent.KIND -> GroupRolesEvent(id, relayKey, 100L, tags, "", sig) GroupPinnedEvent.KIND -> GroupPinnedEvent(id, relayKey, 100L, tags, "", sig) else -> error("unexpected state kind $kind") } @@ -105,7 +105,7 @@ class RelayGroupFilterServingRelayTest : RelayClientTest() { state(1, GroupMetadataEvent.KIND), state(2, GroupAdminsEvent.KIND), state(3, GroupMembersEvent.KIND), - state(4, SupportedRolesEvent.KIND), + state(4, GroupRolesEvent.KIND), state(5, GroupPinnedEvent.KIND), ), ) @@ -119,7 +119,7 @@ class RelayGroupFilterServingRelayTest : RelayClientTest() { GroupMetadataEvent.KIND, GroupAdminsEvent.KIND, GroupMembersEvent.KIND, - SupportedRolesEvent.KIND, + GroupRolesEvent.KIND, GroupPinnedEvent.KIND, ), tags = mapOf("d" to listOf("g1")), @@ -268,7 +268,7 @@ class RelayGroupFilterServingRelayTest : RelayClientTest() { GroupMetadataEvent.KIND, GroupAdminsEvent.KIND, GroupMembersEvent.KIND, - SupportedRolesEvent.KIND, + GroupRolesEvent.KIND, ), limit = 500, ), diff --git a/quartz/src/jvmMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsEventStore.kt b/quartz/src/jvmMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsEventStore.kt index 38cc465830..62616dd7ef 100644 --- a/quartz/src/jvmMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsEventStore.kt +++ b/quartz/src/jvmMain/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsEventStore.kt @@ -33,7 +33,7 @@ import com.vitorpamplona.quartz.nip01Core.store.IEventStore import com.vitorpamplona.quartz.nip01Core.store.sqlite.DefaultIndexingStrategy import com.vitorpamplona.quartz.nip01Core.store.sqlite.IndexingStrategy import com.vitorpamplona.quartz.nip01Core.store.sqlite.TagNameValueHasher -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip40Expiration.expiration import com.vitorpamplona.quartz.nip50Search.SearchableEvent import com.vitorpamplona.quartz.nip50Search.strippingSearchExtensions @@ -136,7 +136,7 @@ open class FsEventStore( if (slot != null && existingSlot?.id != event.id) { slots.install(slot, canonical, event, existingSlot) } - if (event is DeletionEvent) processDeletion(event, canonical) + if (event is DeletionRequestEvent) processDeletion(event, canonical) if (event is RequestToVanishEvent) processVanish(event, canonical) return } @@ -158,7 +158,7 @@ open class FsEventStore( if (slot != null) { slots.install(slot, canonical, event, existingSlot) } - if (event is DeletionEvent) processDeletion(event, canonical) + if (event is DeletionRequestEvent) processDeletion(event, canonical) if (event is RequestToVanishEvent) processVanish(event, canonical) } catch (t: Throwable) { Files.deleteIfExists(tmp) @@ -223,7 +223,7 @@ open class FsEventStore( * future re-inserts are blocked. */ private fun processDeletion( - deletion: DeletionEvent, + deletion: DeletionRequestEvent, deletionCanonical: java.nio.file.Path, ) { val ownerHashOfDeletion = hasher.hash(deletion.pubKey) diff --git a/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/buzz/interop/BuzzRelayLiveInteropTest.kt b/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/buzz/interop/BuzzRelayLiveInteropTest.kt index 429936584d..fd513e3b49 100644 --- a/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/buzz/interop/BuzzRelayLiveInteropTest.kt +++ b/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/buzz/interop/BuzzRelayLiveInteropTest.kt @@ -29,8 +29,8 @@ import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerInternal import com.vitorpamplona.quartz.nip29RelayGroups.moderation.CreateGroupEvent -import com.vitorpamplona.quartz.nip29RelayGroups.request.JoinRequestEvent -import com.vitorpamplona.quartz.nip29RelayGroups.request.LeaveRequestEvent +import com.vitorpamplona.quartz.nip29RelayGroups.request.GroupJoinRequestEvent +import com.vitorpamplona.quartz.nip29RelayGroups.request.GroupLeaveRequestEvent import com.vitorpamplona.quartz.nip42RelayAuth.RelayAuthEvent import kotlinx.coroutines.runBlocking import okhttp3.OkHttpClient @@ -238,7 +238,7 @@ class BuzzRelayLiveInteropTest { val (ws2, frames2) = authedSocket(joiner) val join = joiner.sign( - JoinRequestEvent.build(channelId), + GroupJoinRequestEvent.build(channelId), ) ws2.send("""["EVENT",${join.toJson()}]""") val joinOk = frames2.nextOf("OK") @@ -250,7 +250,7 @@ class BuzzRelayLiveInteropTest { assertTrue("true" in frames2.nextOf("OK"), "post after join should be accepted") // LEAVE: kind 9022, the NIP-29 leave request. - val leave = joiner.sign(LeaveRequestEvent.build(channelId)) + val leave = joiner.sign(GroupLeaveRequestEvent.build(channelId)) ws2.send("""["EVENT",${leave.toJson()}]""") assertTrue("true" in frames2.nextOf("OK"), "leave (9022) should be accepted") diff --git a/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsAuthorsMissingOutboxTest.kt b/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsAuthorsMissingOutboxTest.kt index 09238d03b2..1d57a7d042 100644 --- a/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsAuthorsMissingOutboxTest.kt +++ b/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsAuthorsMissingOutboxTest.kt @@ -21,7 +21,7 @@ package com.vitorpamplona.quartz.nip01Core.store.fs import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent import com.vitorpamplona.quartz.nip59Giftwrap.wraps.GiftWrapEvent import com.vitorpamplona.quartz.nip65RelayList.AdvertisedRelayListEvent @@ -95,7 +95,7 @@ class FsAuthorsMissingOutboxTest { store.insert(relayList) assertEquals(emptySet(), store.authorsMissingOutbox().toSet()) - store.insert(signer.sign(DeletionEvent.build(listOf(relayList)))) + store.insert(signer.sign(DeletionRequestEvent.build(listOf(relayList)))) assertEquals(setOf(signer.pubKey), store.authorsMissingOutbox().toSet()) } } diff --git a/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsDeletionTest.kt b/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsDeletionTest.kt index 88cc2d05b5..cbb23808b2 100644 --- a/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsDeletionTest.kt +++ b/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsDeletionTest.kt @@ -22,9 +22,9 @@ package com.vitorpamplona.quartz.nip01Core.store.fs import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import kotlinx.coroutines.runBlocking import java.nio.file.Files import java.nio.file.Path @@ -67,9 +67,9 @@ class FsDeletionTest { body: String, ts: Long, signer: NostrSignerSync = this.signer, - ) = signer.sign( + ) = signer.sign( createdAt = ts, - kind = LongTextNoteEvent.KIND, + kind = LongFormContentEvent.KIND, tags = arrayOf(arrayOf("d", slug)), content = body, ) @@ -92,12 +92,12 @@ class FsDeletionTest { store.insert(n1) store.insert(n2) - val del = signer.sign(DeletionEvent.build(listOf(n1), createdAt = 30)) + val del = signer.sign(DeletionRequestEvent.build(listOf(n1), createdAt = 30)) store.insert(del) assertEquals(emptyList(), store.query(Filter(ids = listOf(n1.id))).map { it.id }) assertEquals(listOf(n2.id), store.query(Filter(ids = listOf(n2.id))).map { it.id }) - assertEquals(listOf(del.id), store.query(Filter(ids = listOf(del.id))).map { it.id }) + assertEquals(listOf(del.id), store.query(Filter(ids = listOf(del.id))).map { it.id }) } @Test @@ -106,7 +106,7 @@ class FsDeletionTest { val n1 = note("one", 10) store.insert(n1) - val del = signer.sign(DeletionEvent.build(listOf(n1), createdAt = 30)) + val del = signer.sign(DeletionRequestEvent.build(listOf(n1), createdAt = 30)) store.insert(del) store.insert(n1) // should be blocked @@ -121,7 +121,7 @@ class FsDeletionTest { store.insert(theirs) // Our signer attempts to delete it. - val del = signer.sign(DeletionEvent.build(listOf(theirs), createdAt = 30)) + val del = signer.sign(DeletionRequestEvent.build(listOf(theirs), createdAt = 30)) store.insert(del) // Cascade did NOT run — not our author. @@ -150,14 +150,14 @@ class FsDeletionTest { store.insert(v1) store.insert(v2) - val del = signer.sign(DeletionEvent.build(listOf(v2), createdAt = 30)) + val del = signer.sign(DeletionRequestEvent.build(listOf(v2), createdAt = 30)) store.insert(del) // Slot cleared, canonical removed, indexes gone. val dHash = FsLayout.sha256Hex("intro") - val slot = root.resolve("addressable/${LongTextNoteEvent.KIND}/${signer.pubKey}/$dHash.json") + val slot = root.resolve("addressable/${LongFormContentEvent.KIND}/${signer.pubKey}/$dHash.json") assertFalse(slot.exists(), "addressable slot should be cleared") - assertEquals(emptyList(), store.query(Filter(authors = listOf(signer.pubKey), kinds = listOf(LongTextNoteEvent.KIND))).map { it.id }) + assertEquals(emptyList(), store.query(Filter(authors = listOf(signer.pubKey), kinds = listOf(LongFormContentEvent.KIND))).map { it.id }) } @Test @@ -166,14 +166,14 @@ class FsDeletionTest { val v1 = article("intro", "draft 1", 10) store.insert(v1) - val del = signer.sign(DeletionEvent.build(listOf(v1), createdAt = 20)) + val del = signer.sign(DeletionRequestEvent.build(listOf(v1), createdAt = 20)) store.insert(del) // A newer addressable at the same address should still be accepted. val v3 = article("intro", "draft 3", 30) store.insert(v3) - val got = store.query(Filter(authors = listOf(signer.pubKey), kinds = listOf(LongTextNoteEvent.KIND))) + val got = store.query(Filter(authors = listOf(signer.pubKey), kinds = listOf(LongFormContentEvent.KIND))) assertEquals(listOf(v3.id), got.map { it.id }) } @@ -183,13 +183,13 @@ class FsDeletionTest { val v1 = article("intro", "draft 1", 10) store.insert(v1) - val del = signer.sign(DeletionEvent.build(listOf(v1), createdAt = 20)) + val del = signer.sign(DeletionRequestEvent.build(listOf(v1), createdAt = 20)) store.insert(del) // Attempting to re-insert an event authored earlier than the deletion should fail. val older = article("intro", "even-older", 5) store.insert(older) - assertEquals(emptyList(), store.query(Filter(ids = listOf(older.id))).map { it.id }) + assertEquals(emptyList(), store.query(Filter(ids = listOf(older.id))).map { it.id }) } @Test @@ -198,12 +198,12 @@ class FsDeletionTest { val v = article("intro", "v", 10) store.insert(v) - val del = signer.sign(DeletionEvent.build(listOf(v), createdAt = 15)) + val del = signer.sign(DeletionRequestEvent.build(listOf(v), createdAt = 15)) store.insert(del) val equal = article("intro", "equal", 15) store.insert(equal) - assertEquals(emptyList(), store.query(Filter(ids = listOf(equal.id))).map { it.id }) + assertEquals(emptyList(), store.query(Filter(ids = listOf(equal.id))).map { it.id }) } // ------------------------------------------------------------------ @@ -216,18 +216,18 @@ class FsDeletionTest { val v = article("intro", "v", 10) store.insert(v) - val del1 = signer.sign(DeletionEvent.build(listOf(v), createdAt = 20)) + val del1 = signer.sign(DeletionRequestEvent.build(listOf(v), createdAt = 20)) store.insert(del1) val del2Target = article("intro", "v2", 30) // inserted only to give del2 a target store.insert(del2Target) - val del2 = signer.sign(DeletionEvent.build(listOf(del2Target), createdAt = 40)) + val del2 = signer.sign(DeletionRequestEvent.build(listOf(del2Target), createdAt = 40)) store.insert(del2) // Cutoff should now be 40, so an event at createdAt=35 is blocked. val mid = article("intro", "mid", 35) store.insert(mid) - assertEquals(emptyList(), store.query(Filter(ids = listOf(mid.id))).map { it.id }) + assertEquals(emptyList(), store.query(Filter(ids = listOf(mid.id))).map { it.id }) } @Test @@ -238,23 +238,23 @@ class FsDeletionTest { store.insert(v1) store.insert(v2) - val strongDel = signer.sign(DeletionEvent.build(listOf(v2), createdAt = 100)) + val strongDel = signer.sign(DeletionRequestEvent.build(listOf(v2), createdAt = 100)) store.insert(strongDel) // Now insert a weaker (earlier) deletion for the same address. val weakTarget = article("slug", "target-for-weak", 30) store.insert(weakTarget) // this passes? No: cutoff=100, target@30 is blocked. Actually we want to - // construct a DeletionEvent that targets the slug address directly. The simplest way: + // construct a DeletionRequestEvent that targets the slug address directly. The simplest way: val weakDel = - signer.sign( - DeletionEvent.buildAddressOnly(listOf(v1), createdAt = 50), + signer.sign( + DeletionRequestEvent.buildAddressOnly(listOf(v1), createdAt = 50), ) store.insert(weakDel) // Cutoff should still be 100 — an event at 60 must still be blocked. val blocked = article("slug", "should-be-blocked", 60) store.insert(blocked) - assertEquals(emptyList(), store.query(Filter(ids = listOf(blocked.id))).map { it.id }) + assertEquals(emptyList(), store.query(Filter(ids = listOf(blocked.id))).map { it.id }) } // ------------------------------------------------------------------ @@ -266,10 +266,10 @@ class FsDeletionTest { runBlocking { val n = note("x", 10) store.insert(n) - val del = signer.sign(DeletionEvent.build(listOf(n), createdAt = 20)) + val del = signer.sign(DeletionRequestEvent.build(listOf(n), createdAt = 20)) store.insert(del) - val byKind = store.query(Filter(kinds = listOf(DeletionEvent.KIND))) + val byKind = store.query(Filter(kinds = listOf(DeletionRequestEvent.KIND))) assertEquals(listOf(del.id), byKind.map { it.id }) } @@ -289,10 +289,10 @@ class FsDeletionTest { // `event_tags.pubkey_hash = NEW.pubkey_owner_hash` guard. val v1 = otherArticle("shared", "v1", 10) store.insert(v1) - assertEquals(listOf(v1.id), store.query(Filter(ids = listOf(v1.id))).map { it.id }) + assertEquals(listOf(v1.id), store.query(Filter(ids = listOf(v1.id))).map { it.id }) val strangerDel = - signer.sign(DeletionEvent.build(listOf(v1), createdAt = 20)) + signer.sign(DeletionRequestEvent.build(listOf(v1), createdAt = 20)) store.insert(strangerDel) // Bob can still publish a newer version at the same address. Since @@ -300,7 +300,7 @@ class FsDeletionTest { // exists to block. val v2 = otherArticle("shared", "v2", 30) store.insert(v2) - assertEquals(listOf(v2.id), store.query(Filter(ids = listOf(v2.id))).map { it.id }) + assertEquals(listOf(v2.id), store.query(Filter(ids = listOf(v2.id))).map { it.id }) } @Test @@ -308,7 +308,7 @@ class FsDeletionTest { runBlocking { val n = note("x", 10) store.insert(n) - val del = signer.sign(DeletionEvent.build(listOf(n), createdAt = 20)) + val del = signer.sign(DeletionRequestEvent.build(listOf(n), createdAt = 20)) store.insert(del) val tomb = root.resolve("tombstones/id/${n.id}.json") diff --git a/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsParityTest.kt b/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsParityTest.kt index a9603f8996..0a79e052d5 100644 --- a/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsParityTest.kt +++ b/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsParityTest.kt @@ -25,9 +25,9 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync import com.vitorpamplona.quartz.nip01Core.store.sqlite.EventStore -import com.vitorpamplona.quartz.nip09Deletions.DeletionEvent +import com.vitorpamplona.quartz.nip09Deletions.DeletionRequestEvent import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import kotlinx.coroutines.runBlocking import java.nio.file.Files import java.nio.file.Path @@ -121,10 +121,10 @@ class FsParityTest { slug: String, body: String, ts: Long, - ): LongTextNoteEvent = + ): LongFormContentEvent = signer.sign( createdAt = ts, - kind = LongTextNoteEvent.KIND, + kind = LongFormContentEvent.KIND, tags = arrayOf(arrayOf("d", slug)), content = body, ) @@ -234,7 +234,7 @@ class FsParityTest { insertBoth(v2) insertBoth(v3) - assertParity(Filter(authors = listOf(signer.pubKey), kinds = listOf(LongTextNoteEvent.KIND))) + assertParity(Filter(authors = listOf(signer.pubKey), kinds = listOf(LongFormContentEvent.KIND))) } @Test @@ -284,7 +284,7 @@ class FsParityTest { assertParity( Filter( authors = listOf(signer.pubKey), - kinds = listOf(LongTextNoteEvent.KIND), + kinds = listOf(LongFormContentEvent.KIND), tags = mapOf("d" to listOf("tie")), ), ) @@ -303,12 +303,12 @@ class FsParityTest { insertBoth(a) insertBoth(b) - val del = signer.sign(DeletionEvent.build(listOf(a), createdAt = 30)) + val del = signer.sign(DeletionRequestEvent.build(listOf(a), createdAt = 30)) insertBoth(del) assertParity(Filter(ids = listOf(a.id))) assertParity(Filter(ids = listOf(b.id))) - assertParity(Filter(kinds = listOf(DeletionEvent.KIND))) + assertParity(Filter(kinds = listOf(DeletionRequestEvent.KIND))) // Re-insert blocked. insertBoth(a) @@ -321,16 +321,16 @@ class FsParityTest { val v = article("intro", "v1", 10) insertBoth(v) - val del = signer.sign(DeletionEvent.build(listOf(v), createdAt = 20)) + val del = signer.sign(DeletionRequestEvent.build(listOf(v), createdAt = 20)) insertBoth(del) - assertParity(Filter(authors = listOf(signer.pubKey), kinds = listOf(LongTextNoteEvent.KIND))) + assertParity(Filter(authors = listOf(signer.pubKey), kinds = listOf(LongFormContentEvent.KIND))) // Older event at this address must be blocked, newer must pass. insertBoth(article("intro", "older", 5)) insertBoth(article("intro", "newer", 100)) - assertParity(Filter(authors = listOf(signer.pubKey), kinds = listOf(LongTextNoteEvent.KIND))) + assertParity(Filter(authors = listOf(signer.pubKey), kinds = listOf(LongFormContentEvent.KIND))) } // ------------------------------------------------------------------ @@ -429,7 +429,7 @@ class FsParityTest { val artB = article("b", "B v1", 30) val artBv2 = article("b", "B v2", 50) // Deletion of n1 - val del = signer.sign(DeletionEvent.build(listOf(n1), createdAt = 40)) + val del = signer.sign(DeletionRequestEvent.build(listOf(n1), createdAt = 40)) listOf(n1, n2, meta1, meta2, artA, artB, artBv2, del).forEach { insertBoth(it) } @@ -437,8 +437,8 @@ class FsParityTest { assertParity(Filter(ids = listOf(n1.id)), "n1 deleted") assertParity(Filter(ids = listOf(n2.id)), "n2 alive") assertParity(Filter(authors = listOf(signer.pubKey), kinds = listOf(0)), "metadata winner") - assertParity(Filter(authors = listOf(signer.pubKey), kinds = listOf(LongTextNoteEvent.KIND)), "articles set") - assertParity(Filter(authors = listOf(signer.pubKey), kinds = listOf(DeletionEvent.KIND)), "deletion present") + assertParity(Filter(authors = listOf(signer.pubKey), kinds = listOf(LongFormContentEvent.KIND)), "articles set") + assertParity(Filter(authors = listOf(signer.pubKey), kinds = listOf(DeletionRequestEvent.KIND)), "deletion present") } // ------------------------------------------------------------------ diff --git a/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsSearchTest.kt b/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsSearchTest.kt index ccd9400ae9..ddfdadacb0 100644 --- a/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsSearchTest.kt +++ b/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsSearchTest.kt @@ -24,7 +24,7 @@ import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import kotlinx.coroutines.runBlocking import java.nio.file.Files import java.nio.file.Path @@ -166,7 +166,7 @@ class FsSearchTest { val n = note("uniqnote bitcoin", ts = 100) val long = signer.sign( - LongTextNoteEvent.build( + LongFormContentEvent.build( "uniqlong body", title = "title", dTag = "d1", diff --git a/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsSlotsTest.kt b/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsSlotsTest.kt index 26ac6f6463..4ebda49500 100644 --- a/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsSlotsTest.kt +++ b/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/nip01Core/store/fs/FsSlotsTest.kt @@ -24,7 +24,7 @@ import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync -import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent +import com.vitorpamplona.quartz.nip23LongContent.LongFormContentEvent import kotlinx.coroutines.runBlocking import java.nio.file.Files import java.nio.file.Path @@ -224,10 +224,10 @@ class FsSlotsTest { } val got = - store.query( + store.query( Filter( authors = listOf(signer.pubKey), - kinds = listOf(LongTextNoteEvent.KIND), + kinds = listOf(LongFormContentEvent.KIND), tags = mapOf("d" to listOf("intro")), ), ) @@ -255,10 +255,10 @@ class FsSlotsTest { slug: String, body: String, createdAt: Long, - ): LongTextNoteEvent = + ): LongFormContentEvent = signer.sign( createdAt = createdAt, - kind = LongTextNoteEvent.KIND, + kind = LongFormContentEvent.KIND, tags = arrayOf(arrayOf("d", slug)), content = body, ) @@ -271,7 +271,7 @@ class FsSlotsTest { store.insert(v1) store.insert(v2) - val got = store.query(Filter(authors = listOf(signer.pubKey), kinds = listOf(LongTextNoteEvent.KIND))) + val got = store.query(Filter(authors = listOf(signer.pubKey), kinds = listOf(LongFormContentEvent.KIND))) assertEquals(listOf(v2.id), got.map { it.id }) assertFalse(store.hasCanonical(v1.id), "older draft canonical should be removed") } @@ -284,7 +284,7 @@ class FsSlotsTest { store.insert(intro) store.insert(about) - val got = store.query(Filter(authors = listOf(signer.pubKey), kinds = listOf(LongTextNoteEvent.KIND))) + val got = store.query(Filter(authors = listOf(signer.pubKey), kinds = listOf(LongFormContentEvent.KIND))) assertEquals(setOf(intro.id, about.id), got.map { it.id }.toSet()) } @@ -296,7 +296,7 @@ class FsSlotsTest { store.insert(newer) store.insert(older) - val got = store.query(Filter(authors = listOf(signer.pubKey))) + val got = store.query(Filter(authors = listOf(signer.pubKey))) assertEquals(listOf(newer.id), got.map { it.id }) } @@ -307,7 +307,7 @@ class FsSlotsTest { store.insert(v) val dHash = FsLayout.sha256Hex("intro") - val slot = root.resolve("addressable/${LongTextNoteEvent.KIND}/${signer.pubKey}/$dHash.json") + val slot = root.resolve("addressable/${LongFormContentEvent.KIND}/${signer.pubKey}/$dHash.json") assertTrue(slot.exists()) val parsed = Event.fromJson(slot.readText()) assertEquals(v.id, parsed.id) @@ -320,7 +320,7 @@ class FsSlotsTest { store.insert(v) val dHash = FsLayout.sha256Hex("") - val slot = root.resolve("addressable/${LongTextNoteEvent.KIND}/${signer.pubKey}/$dHash.json") + val slot = root.resolve("addressable/${LongFormContentEvent.KIND}/${signer.pubKey}/$dHash.json") assertTrue(slot.exists()) } @@ -330,7 +330,7 @@ class FsSlotsTest { val v = article("intro", "hello", 10) store.insert(v) val dHash = FsLayout.sha256Hex("intro") - val slot = root.resolve("addressable/${LongTextNoteEvent.KIND}/${signer.pubKey}/$dHash.json") + val slot = root.resolve("addressable/${LongFormContentEvent.KIND}/${signer.pubKey}/$dHash.json") assertTrue(slot.exists()) store.delete(v.id)