Skip to content

Commit

Permalink
Merge pull request #148 from multiversx/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
radumojic authored Jan 10, 2025
2 parents 7f19867 + 2e585ca commit e400593
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
12 changes: 3 additions & 9 deletions src/hooks/adapter/adapter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PAGE_SIZE, TRANSACTIONS_TABLE_FIELDS } from 'appConstants';
import { AccountRolesTypeEnum } from 'types';
import { AccountRolesTypeEnum, GetAccountType } from 'types';
import {
BaseApiType,
GetBlocksType,
Expand Down Expand Up @@ -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,
Expand Down
19 changes: 11 additions & 8 deletions src/layouts/AccountLayout/AccountLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
};

Expand Down
9 changes: 9 additions & 0 deletions src/types/adapter.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@ 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;
withOwnerAssets?: boolean;
withDeployInfo?: boolean;
withTxCount?: boolean;
withScrCount?: boolean;
withAssets?: boolean;
}
export interface GetBlocksType extends BaseApiType {
shard?: number;
Expand Down

0 comments on commit e400593

Please sign in to comment.