Skip to content

Commit

Permalink
chore: get balances from address instead of pub key
Browse files Browse the repository at this point in the history
  • Loading branch information
helciofranco committed Jan 9, 2025
1 parent 40eb407 commit eb4f292
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/app/src/systems/Account/services/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}

0 comments on commit eb4f292

Please sign in to comment.