From e6cb4089ba4952268095ffd3de27d99e29d55f28 Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Tue, 3 Sep 2024 11:58:53 +0530 Subject: [PATCH] fix: pubkey prompt even after reasonable preset set --- .../background-script/permissions/hasPermissionFor.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/extension/background-script/permissions/hasPermissionFor.ts b/src/extension/background-script/permissions/hasPermissionFor.ts index 1fd3b266bf..ca58faecc6 100644 --- a/src/extension/background-script/permissions/hasPermissionFor.ts +++ b/src/extension/background-script/permissions/hasPermissionFor.ts @@ -1,6 +1,10 @@ import db from "~/extension/background-script/db"; import state from "~/extension/background-script/state"; +function delay(ms: number) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + export async function hasPermissionFor(method: string, host: string) { if (!host) { return false; @@ -21,6 +25,8 @@ export async function hasPermissionFor(method: string, host: string) { throw new Error("Account doesn't exist"); } + await delay(1000); + const findPermission = await db.permissions.get({ host, method,