Skip to content

Commit

Permalink
Add accountInfo parameter to the useDeprecatedAccount hook
Browse files Browse the repository at this point in the history
  • Loading branch information
reyraa committed Oct 21, 2022
1 parent d285cb2 commit 51844c3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/modules/account/hooks/useDeprecatedAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import authActionTypes from '@auth/store/actionTypes';
import { useCurrentAccount } from './useCurrentAccount';

// eslint-disable-next-line import/prefer-default-export,max-statements
export const useDeprecatedAccount = () => {
export const useDeprecatedAccount = (accountInfo) => {
const [currentAccount] = useCurrentAccount();
const dispatch = useDispatch();
const { pubkey, address } = currentAccount.metadata;
const { pubkey, address } = accountInfo ?? currentAccount.metadata;
const [account, setAccount] = useState({
summary: {
address,
publicKey: '',
publicKey: pubkey,
legacyAddress: '',
// balance: @todo account has multiple balance now
username: '',
Expand Down Expand Up @@ -69,7 +69,8 @@ export const useDeprecatedAccount = () => {
...state,
summary: {
...state.summary,
publicKey: auth?.meta?.publicKey || pubkey,
address,
publicKey: pubkey,
username: auth?.meta?.name || '',
isMultisignature: auth?.data?.numberOfSignatures > 1,
},
Expand Down

0 comments on commit 51844c3

Please sign in to comment.