From 791854474ca4cb6b361aa61c6cd451272dcf6037 Mon Sep 17 00:00:00 2001 From: koalasat Date: Wed, 28 May 2025 13:15:55 +0200 Subject: [PATCH] Fix chat older versions --- frontend/src/components/TradeBox/EncryptedChat/index.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/TradeBox/EncryptedChat/index.tsx b/frontend/src/components/TradeBox/EncryptedChat/index.tsx index 1cdfa0f0..6c8a2c91 100644 --- a/frontend/src/components/TradeBox/EncryptedChat/index.tsx +++ b/frontend/src/components/TradeBox/EncryptedChat/index.tsx @@ -43,7 +43,7 @@ const EncryptedChat: React.FC = ({ status, }: Props): React.JSX.Element => { const [turtleMode, setTurtleMode] = useState(false); - const { hostUrl, settings } = useContext(AppContext); + const { settings } = useContext(AppContext); const { garage } = useContext(GarageContext); const { federation } = useContext(FederationContext); @@ -72,12 +72,13 @@ const EncryptedChat: React.FC = ({ const sendToNostr = (content: string): void => { const slot = garage.getSlot(); const coordinator = federation.getCoordinator(order.shortAlias); + const publicKey = order.is_maker ? order.taker_nostr_pubkey : order.maker_nostr_pubkey; - if (!slot?.nostrSecKey) return; + if (!slot?.nostrSecKey || !publicKey) return; const recipient = { - publicKey: order.is_maker ? order.taker_nostr_pubkey : order.maker_nostr_pubkey, - relayUrl: coordinator.getRelayUrl(settings.network, hostUrl, settings.selfhostedClient), + publicKey, + relayUrl: coordinator.getRelayUrl(settings.network), }; const wrappedEvent = nip17.wrapEvent(slot?.nostrSecKey, recipient, content);