From 19fc4864cbceec078ced290390a856ff3565c7f1 Mon Sep 17 00:00:00 2001 From: codytseng Date: Mon, 2 Jun 2025 01:03:12 +0800 Subject: [PATCH] feat: send contacts events to big relays --- src/providers/NostrProvider/index.tsx | 32 +++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/providers/NostrProvider/index.tsx b/src/providers/NostrProvider/index.tsx index adb1912f..f633ddd9 100644 --- a/src/providers/NostrProvider/index.tsx +++ b/src/providers/NostrProvider/index.tsx @@ -485,6 +485,21 @@ export function NostrProvider({ children }: { children: React.ReactNode }) { throw new Error('You need to login first') } + const event = await signEvent(draftEvent) + + if (event.pubkey !== account.pubkey) { + const eventAuthor = await client.fetchProfile(event.pubkey) + const result = confirm( + t( + 'You are about to publish an event signed by [{{eventAuthorName}}]. You are currently logged in as [{{currentUsername}}]. Are you sure?', + { eventAuthorName: eventAuthor?.username, currentUsername: profile?.username } + ) + ) + if (!result) { + throw new Error(t('Cancelled')) + } + } + const additionalRelayUrls: string[] = [] if ( !specifiedRelayUrls?.length && @@ -514,25 +529,10 @@ export function NostrProvider({ children }: { children: React.ReactNode }) { }) } } - if ([kinds.RelayList, ExtendedKind.FAVORITE_RELAYS].includes(draftEvent.kind)) { + if ([kinds.RelayList, kinds.Contacts, ExtendedKind.FAVORITE_RELAYS].includes(draftEvent.kind)) { additionalRelayUrls.push(...BIG_RELAY_URLS) } - const event = await signEvent(draftEvent) - - if (event.pubkey !== account.pubkey) { - const eventAuthor = await client.fetchProfile(event.pubkey) - const result = confirm( - t( - 'You are about to publish an event signed by [{{eventAuthorName}}]. You are currently logged in as [{{currentUsername}}]. Are you sure?', - { eventAuthorName: eventAuthor?.username, currentUsername: profile?.username } - ) - ) - if (!result) { - throw new Error(t('Cancelled')) - } - } - let relays: string[] if (specifiedRelayUrls?.length) { relays = specifiedRelayUrls