From a698e810f03ca2a7183391d0d3554e8beb70f77b Mon Sep 17 00:00:00 2001 From: AricRedemption Date: Sat, 12 Oct 2024 16:30:12 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20VERSION:=203.3.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fix: App failing to open on first attempt - chore: Support unlocking with the Enter key - fix: get token balance api --- src/lib/actions/token/get-balance.ts | 6 +++--- src/lib/assets.ts | 4 ++-- src/main.ts | 5 +---- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/lib/actions/token/get-balance.ts b/src/lib/actions/token/get-balance.ts index 18c7b5e8..9466148f 100644 --- a/src/lib/actions/token/get-balance.ts +++ b/src/lib/actions/token/get-balance.ts @@ -1,5 +1,5 @@ -import assetsManager from '../../assets' +import { getTokenBalance } from '@/lib/assets' -export async function process() { - return await assetsManager.getTokenBalance() +export async function process(_: unknown, { password }: { host: string; password: string }) { + return await getTokenBalance(password) } diff --git a/src/lib/assets.ts b/src/lib/assets.ts index 2ae2e0c1..1549efe1 100644 --- a/src/lib/assets.ts +++ b/src/lib/assets.ts @@ -50,8 +50,8 @@ export async function removeAssetsDisplay(asset: string) { await setAccount(account) } -export async function getTokenBalance() { - const wallet = await getCurrentWallet(Chain.MVC) +export async function getTokenBalance(password?: string) { + const wallet = await getCurrentWallet(Chain.MVC, { password }) const address = wallet.getAddress() return await fetchMVCTokens(address) } diff --git a/src/main.ts b/src/main.ts index e66e4a09..e7ab7ce8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -12,16 +12,13 @@ import { VueQueryPlugin } from '@tanstack/vue-query' import Notification from './components/Notification.vue' const maxRetries = 3 -const retryDelay = 100 const fetchWithRetry = async (retries = maxRetries) => { - if(IS_DEV) return + if (IS_DEV) return try { return await notifyBg('ping')() } catch (error) { if (retries > 0) { - console.warn(`Request failed, retrying in ${retryDelay / 1000} seconds... Remaining retries: ${retries}`) - await new Promise((resolve) => setTimeout(resolve, retryDelay)) return fetchWithRetry(retries - 1) } else { console.error('Request failed, maximum retry attempts reached')