diff --git a/frontend/src/store/wallet.ts b/frontend/src/store/wallet.ts index 484daad14..5fbb3f6db 100644 --- a/frontend/src/store/wallet.ts +++ b/frontend/src/store/wallet.ts @@ -631,11 +631,19 @@ const hasSetPublicKeysLegacy = async (name: string, provider: Provider) => { // Helper method to check if user has registered public keys in the StealthKeyRegistry async function getRegisteredStealthKeys(account: string, provider: Provider) { - try { - const stealthPubKeys = await utils.lookupRecipient(account, provider); // throws if no keys found - return stealthPubKeys; - } catch (err) { - window.logger.warn(err); - return null; + let retryCounter = 0; + while (retryCounter < 3) { + try { + console.log(`getting stealth keys for ${account}, try ${retryCounter + 1} of 3`); + const stealthPubKeys = await utils.lookupRecipient(account, provider); // throws if no keys found + return stealthPubKeys; + } catch (err) { + window.logger.warn(err); + retryCounter++; + if (retryCounter < 3) { + await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for 2 seconds + } + } } + return null; }