From 3f2a9e841b5d5393eb1e76fc937aa18f2113e589 Mon Sep 17 00:00:00 2001 From: David Murdoch <187813+davidmurdoch@users.noreply.github.com> Date: Thu, 12 Sep 2024 17:31:59 -0400 Subject: [PATCH] move `getSelectedInternalAccount` from `selectors.js` to `accounts.ts` --- test/data/mock-state.json | 7 ++ .../selected-account-component.test.js | 2 +- .../interactive-replacement-token-modal.tsx | 2 +- ...ractive-replacement-token-notification.tsx | 3 + ui/ducks/bridge/selectors.ts | 2 +- ui/ducks/metamask/metamask.js | 4 +- ui/hooks/bridge/useBridging.ts | 1 + ui/hooks/useMultichainSelector.ts | 1 + ui/pages/asset/components/token-buttons.tsx | 1 + .../interactive-replacement-token-page.tsx | 2 +- .../security-tab/security-tab.container.js | 2 +- ui/selectors/accounts.test.ts | 73 +++++++++++++++++ ui/selectors/accounts.ts | 7 +- ui/selectors/index.js | 1 + ui/selectors/institutional/selectors.ts | 5 +- ui/selectors/multichain.ts | 3 +- ui/selectors/permissions.js | 2 +- ui/selectors/selectors.js | 6 +- ui/selectors/selectors.test.js | 79 +++---------------- ui/selectors/transactions.js | 3 +- 20 files changed, 119 insertions(+), 87 deletions(-) diff --git a/test/data/mock-state.json b/test/data/mock-state.json index 654e915a1305..2865478912f3 100644 --- a/test/data/mock-state.json +++ b/test/data/mock-state.json @@ -420,6 +420,7 @@ "address": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc", "id": "cf8dace4-9439-4bd4-b3a8-88c821c8fcb3", "metadata": { + "importTime": 0, "name": "Test Account", "keyring": { "type": "HD Key Tree" @@ -439,6 +440,7 @@ "address": "0xec1adf982415d2ef5ec55899b9bfb8bc0f29251b", "id": "07c2cfec-36c9-46c4-8115-3836d3ac9047", "metadata": { + "importTime": 0, "name": "Test Account 2", "keyring": { "type": "HD Key Tree" @@ -458,6 +460,7 @@ "address": "0xc42edfcc21ed14dda456aa0756c153f7985d8813", "id": "15e69915-2a1a-4019-93b3-916e11fd432f", "metadata": { + "importTime": 0, "name": "Ledger Hardware 2", "keyring": { "type": "Ledger Hardware" @@ -477,6 +480,7 @@ "address": "0xeb9e64b93097bc15f01f13eae97015c57ab64823", "id": "784225f4-d30b-4e77-a900-c8bbce735b88", "metadata": { + "importTime": 0, "name": "Test Account 3", "keyring": { "type": "HD Key Tree" @@ -496,6 +500,7 @@ "address": "0xca8f1F0245530118D0cf14a06b01Daf8f76Cf281", "id": "694225f4-d30b-4e77-a900-c8bbce735b42", "metadata": { + "importTime": 0, "name": "Test Account 4", "keyring": { "type": "Custody test" @@ -515,11 +520,13 @@ "address": "0xb552685e3d2790efd64a175b00d51f02cdafee5d", "id": "c3deeb99-ba0d-4a4e-a0aa-033fc1f79ae3", "metadata": { + "importTime": 0, "name": "Snap Account 1", "keyring": { "type": "Snap Keyring" }, "snap": { + "enabled": true, "id": "snap-id", "name": "snap-name" } diff --git a/ui/components/app/selected-account/selected-account-component.test.js b/ui/components/app/selected-account/selected-account-component.test.js index 290e737c0808..9545580bebbb 100644 --- a/ui/components/app/selected-account/selected-account-component.test.js +++ b/ui/components/app/selected-account/selected-account-component.test.js @@ -111,7 +111,7 @@ describe('SelectedAccount Component', () => { const tooltipTitle = await waitFor(() => container.querySelector( - '[data-original-title="This account is not set up for use with goerli"]', + '[data-original-title="This account is not set up for use with Goerli"]', ), ); diff --git a/ui/components/institutional/interactive-replacement-token-modal/interactive-replacement-token-modal.tsx b/ui/components/institutional/interactive-replacement-token-modal/interactive-replacement-token-modal.tsx index 06fe1336ca7e..e76dabc7add7 100644 --- a/ui/components/institutional/interactive-replacement-token-modal/interactive-replacement-token-modal.tsx +++ b/ui/components/institutional/interactive-replacement-token-modal/interactive-replacement-token-modal.tsx @@ -4,7 +4,7 @@ import { ICustodianType } from '@metamask-institutional/types'; import { useI18nContext } from '../../../hooks/useI18nContext'; import { MetaMetricsContext } from '../../../contexts/metametrics'; import { hideModal } from '../../../store/actions'; -import { getSelectedInternalAccount } from '../../../selectors/selectors'; +import { getSelectedInternalAccount } from '../../../selectors/accounts'; import { toChecksumHexAddress } from '../../../../shared/modules/hexstring-utils'; import { Box, diff --git a/ui/components/institutional/interactive-replacement-token-notification/interactive-replacement-token-notification.tsx b/ui/components/institutional/interactive-replacement-token-notification/interactive-replacement-token-notification.tsx index 10dc049b8678..7c1d0f60488f 100644 --- a/ui/components/institutional/interactive-replacement-token-notification/interactive-replacement-token-notification.tsx +++ b/ui/components/institutional/interactive-replacement-token-notification/interactive-replacement-token-notification.tsx @@ -56,6 +56,7 @@ const InteractiveReplacementTokenNotification: React.FC< interactiveReplacementToken && Boolean(Object.keys(interactiveReplacementToken).length); + // @ts-expect-error keyring type is wrong maybe? if (!/^Custody/u.test(keyring.type) || !hasInteractiveReplacementToken) { setShowNotification(false); return; @@ -66,6 +67,7 @@ const InteractiveReplacementTokenNotification: React.FC< )) as unknown as string; const custodyAccountDetails = await dispatch( mmiActions.getAllCustodianAccountsWithToken( + // @ts-expect-error keyring type is wrong maybe? keyring.type.split(' - ')[1], token, ), @@ -105,6 +107,7 @@ const InteractiveReplacementTokenNotification: React.FC< interactiveReplacementToken?.oldRefreshToken, isUnlocked, dispatch, + // @ts-expect-error keyring type is wrong maybe? keyring.type, interactiveReplacementToken, mmiActions, diff --git a/ui/ducks/bridge/selectors.ts b/ui/ducks/bridge/selectors.ts index d0dcd8fca51b..568d62e7a2d4 100644 --- a/ui/ducks/bridge/selectors.ts +++ b/ui/ducks/bridge/selectors.ts @@ -8,7 +8,7 @@ import { getIsBridgeEnabled, getSwapsDefaultToken, SwapsEthToken, -} from '../../selectors'; +} from '../../selectors/selectors'; import { ALLOWED_BRIDGE_CHAIN_IDS } from '../../../shared/constants/bridge'; import { BridgeControllerState, diff --git a/ui/ducks/metamask/metamask.js b/ui/ducks/metamask/metamask.js index d7fa8211b3b7..9627608eb709 100644 --- a/ui/ducks/metamask/metamask.js +++ b/ui/ducks/metamask/metamask.js @@ -17,9 +17,9 @@ import { checkNetworkAndAccountSupports1559, getAddressBook, getSelectedNetworkClientId, - getSelectedInternalAccount, getNetworkConfigurationsByChainId, -} from '../../selectors'; +} from '../../selectors/selectors'; +import { getSelectedInternalAccount } from '../../selectors/accounts'; import * as actionConstants from '../../store/actionConstants'; import { updateTransactionGasFees } from '../../store/actions'; import { setCustomGasLimit, setCustomGasPrice } from '../gas/gas.duck'; diff --git a/ui/hooks/bridge/useBridging.ts b/ui/hooks/bridge/useBridging.ts index a68aeb361bdd..fe7a21e2206f 100644 --- a/ui/hooks/bridge/useBridging.ts +++ b/ui/hooks/bridge/useBridging.ts @@ -43,6 +43,7 @@ const useBridging = () => { const isMarketingEnabled = useSelector(getDataCollectionForMarketing); const providerConfig = useSelector(getProviderConfig); const keyring = useSelector(getCurrentKeyring); + // @ts-expect-error keyring type is wrong maybe? const usingHardwareWallet = isHardwareKeyring(keyring.type); const isBridgeSupported = useSelector(getIsBridgeEnabled); diff --git a/ui/hooks/useMultichainSelector.ts b/ui/hooks/useMultichainSelector.ts index 326ac79bf9cd..9bd979df7e7e 100644 --- a/ui/hooks/useMultichainSelector.ts +++ b/ui/hooks/useMultichainSelector.ts @@ -11,6 +11,7 @@ export function useMultichainSelector< ) { return useSelector((state: TState) => { // We either pass an account or fallback to the currently selected one + // @ts-expect-error state types don't match return selector(state, account || getSelectedInternalAccount(state)); }); } diff --git a/ui/pages/asset/components/token-buttons.tsx b/ui/pages/asset/components/token-buttons.tsx index 7921af85f2ce..988bd72963e2 100644 --- a/ui/pages/asset/components/token-buttons.tsx +++ b/ui/pages/asset/components/token-buttons.tsx @@ -71,6 +71,7 @@ const TokenButtons = ({ ///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) const keyring = useSelector(getCurrentKeyring); + // @ts-expect-error keyring type is wrong maybe? const usingHardwareWallet = isHardwareKeyring(keyring.type); ///: END:ONLY_INCLUDE_IF diff --git a/ui/pages/institutional/interactive-replacement-token-page/interactive-replacement-token-page.tsx b/ui/pages/institutional/interactive-replacement-token-page/interactive-replacement-token-page.tsx index c7258d1b2e38..5c00eb4ffa10 100644 --- a/ui/pages/institutional/interactive-replacement-token-page/interactive-replacement-token-page.tsx +++ b/ui/pages/institutional/interactive-replacement-token-page/interactive-replacement-token-page.tsx @@ -27,7 +27,7 @@ import { useI18nContext } from '../../../hooks/useI18nContext'; import { useCopyToClipboard } from '../../../hooks/useCopyToClipboard'; import { getMetaMaskAccounts } from '../../../selectors'; import { getInstitutionalConnectRequests } from '../../../ducks/institutional/institutional'; -import { getSelectedInternalAccount } from '../../../selectors/selectors'; +import { getSelectedInternalAccount } from '../../../selectors/accounts'; import { toChecksumHexAddress } from '../../../../shared/modules/hexstring-utils'; import { SWAPS_CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP } from '../../../../shared/constants/swaps'; import { CHAIN_IDS } from '../../../../shared/constants/network'; diff --git a/ui/pages/settings/security-tab/security-tab.container.js b/ui/pages/settings/security-tab/security-tab.container.js index 224072ef2b10..fa529c1ad3df 100644 --- a/ui/pages/settings/security-tab/security-tab.container.js +++ b/ui/pages/settings/security-tab/security-tab.container.js @@ -27,7 +27,7 @@ import { getNetworkConfigurationsByChainId, getMetaMetricsDataDeletionId, getPetnamesEnabled, -} from '../../../selectors'; +} from '../../../selectors/selectors'; import { openBasicFunctionalityModal } from '../../../ducks/app/app'; import SecurityTab from './security-tab.component'; diff --git a/ui/selectors/accounts.test.ts b/ui/selectors/accounts.test.ts index 61a0059989ba..639da0185b72 100644 --- a/ui/selectors/accounts.test.ts +++ b/ui/selectors/accounts.test.ts @@ -1,3 +1,5 @@ +import { EthAccountType } from '@metamask/keyring-api'; +import { ETH_EOA_METHODS } from '../../shared/constants/eth-methods'; import { MOCK_ACCOUNTS, MOCK_ACCOUNT_EOA, @@ -5,12 +7,14 @@ import { MOCK_ACCOUNT_BIP122_P2WPKH, MOCK_ACCOUNT_BIP122_P2WPKH_TESTNET, } from '../../test/data/mock-accounts'; +import mockState from '../../test/data/mock-state.json'; import { AccountsState, isSelectedInternalAccountEth, isSelectedInternalAccountBtc, hasCreatedBtcMainnetAccount, hasCreatedBtcTestnetAccount, + getSelectedInternalAccount, } from './accounts'; const MOCK_STATE: AccountsState = { @@ -23,6 +27,75 @@ const MOCK_STATE: AccountsState = { }; describe('Accounts Selectors', () => { + describe('#getSelectedInternalAccount', () => { + it('returns selected internalAccount', () => { + expect( + getSelectedInternalAccount(mockState as AccountsState), + ).toStrictEqual({ + address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', + id: 'cf8dace4-9439-4bd4-b3a8-88c821c8fcb3', + metadata: { + importTime: 0, + name: 'Test Account', + keyring: { + type: 'HD Key Tree', + }, + }, + options: {}, + methods: [ + 'personal_sign', + 'eth_signTransaction', + 'eth_signTypedData_v1', + 'eth_signTypedData_v3', + 'eth_signTypedData_v4', + ], + type: 'eip155:eoa', + }); + }); + + it('returns undefined if selectedAccount is undefined', () => { + expect( + getSelectedInternalAccount({ + metamask: { + internalAccounts: { + accounts: {}, + selectedAccount: '', + }, + }, + }), + ).toBeUndefined(); + }); + + it('returns selectedAccount', () => { + const mockInternalAccount = { + address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', + id: 'cf8dace4-9439-4bd4-b3a8-88c821c8fcb3', + metadata: { + importTime: 0, + name: 'Test Account', + keyring: { + type: 'HD Key Tree', + }, + }, + options: {}, + methods: ETH_EOA_METHODS, + type: EthAccountType.Eoa, + }; + expect( + getSelectedInternalAccount({ + metamask: { + internalAccounts: { + accounts: { + [mockInternalAccount.id]: mockInternalAccount, + }, + selectedAccount: mockInternalAccount.id, + }, + }, + }), + ).toStrictEqual(mockInternalAccount); + }); + }); + describe('isSelectedInternalAccountEth', () => { // @ts-expect-error This is missing from the Mocha type definitions it.each([ diff --git a/ui/selectors/accounts.ts b/ui/selectors/accounts.ts index bd33d5af1f89..d69cd130f9aa 100644 --- a/ui/selectors/accounts.ts +++ b/ui/selectors/accounts.ts @@ -8,7 +8,7 @@ import { isBtcMainnetAddress, isBtcTestnetAddress, } from '../../shared/lib/multichain'; -import { getSelectedInternalAccount, getInternalAccounts } from './selectors'; +import { getInternalAccounts } from './selectors'; export type AccountsState = { metamask: AccountsControllerState; @@ -20,6 +20,11 @@ function isBtcAccount(account: InternalAccount) { return Boolean(account && account.type === P2wpkh); } +export function getSelectedInternalAccount(state: AccountsState) { + const accountId = state.metamask.internalAccounts.selectedAccount; + return state.metamask.internalAccounts.accounts[accountId]; +} + export function isSelectedInternalAccountEth(state: AccountsState) { const account = getSelectedInternalAccount(state); const { Eoa, Erc4337 } = EthAccountType; diff --git a/ui/selectors/index.js b/ui/selectors/index.js index 6c65a481a709..290c70fb2a31 100644 --- a/ui/selectors/index.js +++ b/ui/selectors/index.js @@ -7,3 +7,4 @@ export * from './permissions'; export * from './selectors'; export * from './transactions'; export * from './approvals'; +export * from './accounts'; diff --git a/ui/selectors/institutional/selectors.ts b/ui/selectors/institutional/selectors.ts index edaaf5278ae7..05bd13b52509 100644 --- a/ui/selectors/institutional/selectors.ts +++ b/ui/selectors/institutional/selectors.ts @@ -1,5 +1,6 @@ import { toChecksumAddress } from 'ethereumjs-util'; -import { getAccountType, getSelectedInternalAccount } from '../selectors'; +import { getAccountType } from '../selectors'; +import { getSelectedInternalAccount } from '../accounts'; import { getProviderConfig } from '../../ducks/metamask/metamask'; import { hexToDecimal } from '../../../shared/modules/conversion.utils'; // TODO: Remove restricted import @@ -166,6 +167,7 @@ export function getCustodianIconForAddress(state: State, address: string) { export function getIsCustodianSupportedChain(state: State) { try { + // @ts-expect-error state types don't match const selectedAccount = getSelectedInternalAccount(state); const accountType = getAccountType(state); const providerConfig = getProviderConfig(state); @@ -207,6 +209,7 @@ export function getIsCustodianSupportedChain(state: State) { export function getMMIAddressFromModalOrAddress(state: State) { const modalAddress = state?.appState?.modal?.modalState?.props?.address; + // @ts-expect-error state types don't match const selectedAddress = getSelectedInternalAccount(state)?.address; return modalAddress || selectedAddress; diff --git a/ui/selectors/multichain.ts b/ui/selectors/multichain.ts index 308dc104b6d6..96266687b6df 100644 --- a/ui/selectors/multichain.ts +++ b/ui/selectors/multichain.ts @@ -24,7 +24,7 @@ import { CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP, TEST_NETWORK_IDS, } from '../../shared/constants/network'; -import { AccountsState } from './accounts'; +import { AccountsState, getSelectedInternalAccount } from './accounts'; import { getCurrentChainId, getCurrentCurrency, @@ -33,7 +33,6 @@ import { getNativeCurrencyImage, getNetworkConfigurationsByChainId, getSelectedAccountCachedBalance, - getSelectedInternalAccount, getShouldShowFiat, getShowFiatInTestnets, } from './selectors'; diff --git a/ui/selectors/permissions.js b/ui/selectors/permissions.js index 4031b8e881a3..00468f2f948d 100644 --- a/ui/selectors/permissions.js +++ b/ui/selectors/permissions.js @@ -10,9 +10,9 @@ import { getInternalAccount, getMetaMaskAccountsOrdered, getOriginOfCurrentTab, - getSelectedInternalAccount, getTargetSubjectMetadata, } from './selectors'; +import { getSelectedInternalAccount } from './accounts'; // selectors diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index ac8a6394bf6b..bb7ef5f796d7 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -117,6 +117,7 @@ import { getOrderedConnectedAccountsForConnectedDapp, getSubjectMetadata, } from './permissions'; +import { getSelectedInternalAccount } from './accounts'; import { createDeepEqualSelector } from './util'; import { getMultichainBalances, getMultichainNetwork } from './multichain'; @@ -353,11 +354,6 @@ export function getMaybeSelectedInternalAccount(state) { : undefined; } -export function getSelectedInternalAccount(state) { - const accountId = state.metamask.internalAccounts.selectedAccount; - return state.metamask.internalAccounts.accounts[accountId]; -} - export function checkIfMethodIsEnabled(state, methodName) { const internalAccount = getSelectedInternalAccount(state); return Boolean(internalAccount.methods.includes(methodName)); diff --git a/ui/selectors/selectors.test.js b/ui/selectors/selectors.test.js index 5772f9642805..459864c1e1f3 100644 --- a/ui/selectors/selectors.test.js +++ b/ui/selectors/selectors.test.js @@ -6,15 +6,14 @@ import { } from '@metamask/keyring-api'; import { deepClone } from '@metamask/snaps-utils'; import { TransactionStatus } from '@metamask/transaction-controller'; -import { ETH_EOA_METHODS } from '../../shared/constants/eth-methods'; import { KeyringType } from '../../shared/constants/keyring'; -import { DeleteRegulationStatus } from '../../shared/constants/metametrics'; -import { CHAIN_IDS, NETWORK_TYPES } from '../../shared/constants/network'; import mockState from '../../test/data/mock-state.json'; +import { CHAIN_IDS, NETWORK_TYPES } from '../../shared/constants/network'; import { createMockInternalAccount } from '../../test/jest/mocks'; +import { getProviderConfig } from '../ducks/metamask/metamask'; import { mockNetworkState } from '../../test/stub/networks'; +import { DeleteRegulationStatus } from '../../shared/constants/metametrics'; import { selectSwitchedNetworkNeverShowMessage } from '../components/app/toast-master/selectors'; -import { getProviderConfig } from '../ducks/metamask/metamask'; import * as selectors from './selectors'; jest.mock('../../app/scripts/lib/util', () => ({ @@ -79,49 +78,6 @@ describe('Selectors', () => { }); }); - describe('#getSelectedInternalAccount', () => { - it('returns undefined if selectedAccount is undefined', () => { - expect( - selectors.getSelectedInternalAccount({ - metamask: { - internalAccounts: { - accounts: {}, - selectedAccount: '', - }, - }, - }), - ).toBeUndefined(); - }); - - it('returns selectedAccount', () => { - const mockInternalAccount = { - address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', - id: 'cf8dace4-9439-4bd4-b3a8-88c821c8fcb3', - metadata: { - name: 'Test Account', - keyring: { - type: 'HD Key Tree', - }, - }, - options: {}, - methods: ETH_EOA_METHODS, - type: EthAccountType.Eoa, - }; - expect( - selectors.getSelectedInternalAccount({ - metamask: { - internalAccounts: { - accounts: { - [mockInternalAccount.id]: mockInternalAccount, - }, - selectedAccount: mockInternalAccount.id, - }, - }, - }), - ).toStrictEqual(mockInternalAccount); - }); - }); - describe('#checkIfMethodIsEnabled', () => { it('returns true if the method is enabled', () => { expect( @@ -974,28 +930,6 @@ describe('Selectors', () => { }); }); - it('returns selected internalAccount', () => { - expect(selectors.getSelectedInternalAccount(mockState)).toStrictEqual({ - address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', - id: 'cf8dace4-9439-4bd4-b3a8-88c821c8fcb3', - metadata: { - name: 'Test Account', - keyring: { - type: 'HD Key Tree', - }, - }, - options: {}, - methods: [ - 'personal_sign', - 'eth_signTransaction', - 'eth_signTypedData_v1', - 'eth_signTypedData_v3', - 'eth_signTypedData_v4', - ], - type: 'eip155:eoa', - }); - }); - it('returns selected account', () => { const account = selectors.getSelectedAccount(mockState); expect(account.balance).toStrictEqual('0x346ba7725f412cbfdb'); @@ -1475,6 +1409,7 @@ describe('Selectors', () => { balance: '0x0', id: '07c2cfec-36c9-46c4-8115-3836d3ac9047', metadata: { + importTime: 0, name: 'Test Account 2', keyring: { type: 'HD Key Tree', @@ -1499,6 +1434,7 @@ describe('Selectors', () => { balance: '0x0', id: '784225f4-d30b-4e77-a900-c8bbce735b88', metadata: { + importTime: 0, name: 'Test Account 3', keyring: { type: 'HD Key Tree', @@ -1522,6 +1458,7 @@ describe('Selectors', () => { address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', id: 'cf8dace4-9439-4bd4-b3a8-88c821c8fcb3', metadata: { + importTime: 0, name: 'Test Account', keyring: { type: 'HD Key Tree', @@ -1547,6 +1484,7 @@ describe('Selectors', () => { address: '0xc42edfcc21ed14dda456aa0756c153f7985d8813', id: '15e69915-2a1a-4019-93b3-916e11fd432f', metadata: { + importTime: 0, name: 'Ledger Hardware 2', keyring: { type: 'Ledger Hardware', @@ -1574,8 +1512,10 @@ describe('Selectors', () => { keyring: { type: 'Snap Keyring', }, + importTime: 0, name: 'Snap Account 1', snap: { + enabled: true, id: 'snap-id', name: 'snap-name', }, @@ -1596,6 +1536,7 @@ describe('Selectors', () => { { id: '694225f4-d30b-4e77-a900-c8bbce735b42', metadata: { + importTime: 0, name: 'Test Account 4', keyring: { type: 'Custody test', diff --git a/ui/selectors/transactions.js b/ui/selectors/transactions.js index 2c5fb8fe4b98..3074fd4bfde4 100644 --- a/ui/selectors/transactions.js +++ b/ui/selectors/transactions.js @@ -13,7 +13,8 @@ import txHelper from '../helpers/utils/tx-helper'; import { SmartTransactionStatus } from '../../shared/constants/transaction'; import { hexToDecimal } from '../../shared/modules/conversion.utils'; import { getProviderConfig } from '../ducks/metamask/metamask'; -import { getCurrentChainId, getSelectedInternalAccount } from './selectors'; +import { getCurrentChainId } from './selectors'; +import { getSelectedInternalAccount } from './accounts'; import { hasPendingApprovals, getApprovalRequestsByType } from './approvals'; import { createDeepEqualSelector,