From ac4147304d2465d5281d91450c453b9b4367b7c8 Mon Sep 17 00:00:00 2001 From: Satoshi Qazi Muhammed Date: Sun, 14 Jun 2026 07:43:01 -0700 Subject: [PATCH] refactor: type live-balance with ApiPromise (no any/eslint-disable) --- src/components/wallet/TokensCard.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/wallet/TokensCard.tsx b/src/components/wallet/TokensCard.tsx index f655c82..83f672b 100644 --- a/src/components/wallet/TokensCard.tsx +++ b/src/components/wallet/TokensCard.tsx @@ -21,6 +21,7 @@ import { TrendingDown, Fuel, } from 'lucide-react'; +import type { ApiPromise } from '@pezkuwi/api'; import { useWallet } from '@/contexts/WalletContext'; import { useTelegram } from '@/hooks/useTelegram'; import { useTranslation } from '@/i18n'; @@ -225,15 +226,19 @@ export function TokensCard({ onSendToken }: Props) { let peopleBalUnsub: (() => void) | null = null; type AccountInfo = { data: { free: { toString(): string } } }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const liveBalance = async (api: any, setBalance: (v: string) => void, label: string) => { + const liveBalance = async ( + api: ApiPromise | null, + setBalance: (v: string) => void, + label: string + ) => { if (!api) return null; try { // callback form = live subscription, fires on every change - return (await api.query.system.account(address, (info: AccountInfo) => { + const unsub = await api.query.system.account(address, (info: AccountInfo) => { const balanceNum = Number(info.data.free.toString()) / 1e12; setBalance(balanceNum.toFixed(4)); - })) as () => void; + }); + return unsub as unknown as () => void; } catch (err) { console.error(`Error subscribing to ${label} HEZ balance:`, err); return null;