diff --git a/damus/Models/HomeModel.swift b/damus/Models/HomeModel.swift index 6ffaaa3b..6fbb3cc9 100644 --- a/damus/Models/HomeModel.swift +++ b/damus/Models/HomeModel.swift @@ -265,6 +265,11 @@ class HomeModel: ContactsDelegate { return } + guard nwc.relay == relay else { return } // Don't process NWC responses coming from relays other than our designated one + guard ev.referenced_pubkeys.first == nwc.keypair.pubkey else { + return // This message is not for us. Ignore it. + } + var resp: WalletConnect.FullWalletResponse? = nil do { resp = try await WalletConnect.FullWalletResponse(from: ev, nwc: nwc) diff --git a/damus/Util/WalletConnect/WalletConnect+.swift b/damus/Util/WalletConnect/WalletConnect+.swift index 3b2c16df..689b6548 100644 --- a/damus/Util/WalletConnect/WalletConnect+.swift +++ b/damus/Util/WalletConnect/WalletConnect+.swift @@ -20,6 +20,7 @@ extension WalletConnect { static func subscribe(url: WalletConnectURL, pool: RelayPool) { var filter = NostrFilter(kinds: [.nwc_response]) filter.authors = [url.pubkey] + filter.pubkeys = [url.keypair.pubkey] filter.limit = 0 let sub = NostrSubscribe(filters: [filter], sub_id: "nwc")