From eb4f29248c0ffc6a6183f6887bde947b462adf3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lcio=20Franco?= Date: Thu, 9 Jan 2025 15:28:07 +0800 Subject: [PATCH] chore: get balances from address instead of pub key --- packages/app/src/systems/Account/services/account.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/app/src/systems/Account/services/account.ts b/packages/app/src/systems/Account/services/account.ts index f908ae918..36965055b 100644 --- a/packages/app/src/systems/Account/services/account.ts +++ b/packages/app/src/systems/Account/services/account.ts @@ -11,9 +11,9 @@ import { AssetsCache } from '~/systems/Asset/cache/AssetsCache'; import { chromeStorage } from '~/systems/Core/services/chromeStorage'; import type { Maybe } from '~/systems/Core/types'; import { db } from '~/systems/Core/utils/database'; +import { readFromOPFS } from '~/systems/Core/utils/opfs'; import { getUniqueString } from '~/systems/Core/utils/string'; import { getTestNoDexieDbData } from '../utils/getTestNoDexieDbData'; -import { readFromOPFS } from '~/systems/Core/utils/opfs'; export type AccountInputs = { addAccount: { @@ -106,7 +106,7 @@ export class AccountService { try { const provider = await createProvider(providerUrl!); - const balances = await getBalances(provider, account.publicKey); + const balances = await getBalances(provider, account.address); const balanceAssets = await AssetsCache.fetchAllAssets( provider.getChainId(), balances.map((balance) => balance.assetId) @@ -467,8 +467,7 @@ export class AccountService { // Private methods // ---------------------------------------------------------------------------- -async function getBalances(provider: Provider, publicKey = '0x00') { - const address = Address.fromPublicKey(publicKey); +async function getBalances(provider: Provider, address: string) { const { balances } = await provider.getBalances(address); return balances; }