From c38ee032126fe0a955d271499aa33dcf74853fd2 Mon Sep 17 00:00:00 2001 From: artur Date: Fri, 16 Feb 2024 08:41:59 +0300 Subject: [PATCH] Ignore duplicates of auth_url --- ndk/src/signers/nip46/rpc.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ndk/src/signers/nip46/rpc.ts b/ndk/src/signers/nip46/rpc.ts index 53ed381d..b3cb4f5c 100644 --- a/ndk/src/signers/nip46/rpc.ts +++ b/ndk/src/signers/nip46/rpc.ts @@ -121,10 +121,14 @@ export class NDKNostrRpc extends EventEmitter { const remoteUser = this.ndk.getUser({ hexpubkey: remotePubkey }); const request = { id, method, params }; const promise = new Promise((resolve) => { + let gotAuth = false const responseHandler = (response: NDKRpcResponse) => { if (response.result === "auth_url") { this.once(`response-${id}`, responseHandler); - this.emit("authUrl", response.error); + if (!gotAuth) { + gotAuth = true + this.emit("authUrl", response.error); + } } else if (cb) { cb(response); }