diff --git a/src/hooks/adapter/adapter.ts b/src/hooks/adapter/adapter.ts index 2207e898..afe2d4b8 100644 --- a/src/hooks/adapter/adapter.ts +++ b/src/hooks/adapter/adapter.ts @@ -1,5 +1,5 @@ import { PAGE_SIZE, TRANSACTIONS_TABLE_FIELDS } from 'appConstants'; -import { AccountRolesTypeEnum } from 'types'; +import { AccountRolesTypeEnum, GetAccountType } from 'types'; import { BaseApiType, GetBlocksType, @@ -224,14 +224,8 @@ export const useAdapter = () => { /* Account */ - getAccount: ({ - address, - ...rest - }: { - address: string; - fields?: string; - withGuardianInfo?: boolean; - }) => provider({ url: `/accounts/${address}`, params: rest }), + getAccount: ({ address, ...rest }: GetAccountType) => + provider({ url: `/accounts/${address}`, params: rest }), getAccounts: ({ page, diff --git a/src/layouts/AccountLayout/AccountLayout.tsx b/src/layouts/AccountLayout/AccountLayout.tsx index d8eb9103..c71fc373 100644 --- a/src/layouts/AccountLayout/AccountLayout.tsx +++ b/src/layouts/AccountLayout/AccountLayout.tsx @@ -31,15 +31,18 @@ export const AccountLayout = () => { const fetchBalanceAndCount = () => { if (address) { - getAccount({ address, withGuardianInfo: true }).then( - ({ success, data }) => { - if (success && data) { - dispatch(setAccount({ isFetched: true, account: data })); - } - - setIsDataReady(success); + getAccount({ + address, + withGuardianInfo: true, + withAssets: true, + withTxCount: true + }).then(({ success, data }) => { + if (success && data) { + dispatch(setAccount({ isFetched: true, account: data })); } - ); + + setIsDataReady(success); + }); } }; diff --git a/src/types/adapter.types.ts b/src/types/adapter.types.ts index e26e3068..0e72d87c 100644 --- a/src/types/adapter.types.ts +++ b/src/types/adapter.types.ts @@ -19,6 +19,14 @@ export interface SortableApiType extends BaseApiType { order?: SortOrderEnum; } +export interface GetAccountType { + address: string; + withGuardianInfo?: boolean; + withTxCount?: boolean; + withScrCount?: boolean; + withAssets?: boolean; +} + export interface GetAccountsType extends SortableApiType { ownerAddress?: string; isSmartContract?: boolean; @@ -26,6 +34,7 @@ export interface GetAccountsType extends SortableApiType { withDeployInfo?: boolean; withTxCount?: boolean; withScrCount?: boolean; + withAssets?: boolean; } export interface GetBlocksType extends BaseApiType { shard?: number;