From 92ef546436860cb8b8ba655695919ea64e53bd71 Mon Sep 17 00:00:00 2001 From: wentokay <101902546+wentokay@users.noreply.github.com> Date: Fri, 30 Jun 2023 17:41:32 -0500 Subject: [PATCH] fix onboarding issue (#4259) --- packages/secure-background/src/store/SecureStore.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/secure-background/src/store/SecureStore.ts b/packages/secure-background/src/store/SecureStore.ts index b94b360e0..9a3e884bf 100644 --- a/packages/secure-background/src/store/SecureStore.ts +++ b/packages/secure-background/src/store/SecureStore.ts @@ -1,7 +1,9 @@ import type { - Blockchain, BlockchainKeyringJson, + Blockchain, + BlockchainKeyringJson, DeprecatedWalletDataDoNotUse, - Preferences } from "@coral-xyz/common"; + Preferences, +} from "@coral-xyz/common"; import type { SecretPayload } from "./keyring/crypto"; import { decrypt, encrypt } from "./keyring/crypto"; @@ -98,10 +100,7 @@ export class SecureStore { } async setIsCold(publicKey: string, isCold?: boolean) { - let keynames = await this.db.get(KEY_IS_COLD_STORE); - if (!keynames) { - keynames = {}; - } + const keynames = (await this.db.get(KEY_IS_COLD_STORE)) || {}; keynames[publicKey] = isCold; await this.db.set(KEY_IS_COLD_STORE, keynames); } @@ -113,7 +112,7 @@ export class SecureStore { } async setKeyname(publicKey: string, name: string, blockchain: Blockchain) { - let keynames = await this.db.get(KEY_KEYNAME_STORE); + const keynames = (await this.db.get(KEY_KEYNAME_STORE)) || {}; if (!keynames[blockchain]) { keynames[blockchain] = {}; }