mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 01:47:00 +01:00
Dead and redundant code removal (#17512)
This commit is contained in:
parent
3fc26521d4
commit
02b2d7fa42
@ -25,9 +25,7 @@
|
||||
"name": "confTx",
|
||||
"context": 0
|
||||
},
|
||||
"accountDetail": {
|
||||
"subview": "transactions"
|
||||
},
|
||||
"accountDetail": {},
|
||||
"transForward": false,
|
||||
"isLoading": false,
|
||||
"warning": null,
|
||||
|
@ -87,7 +87,7 @@ export default class AccountMenu extends Component {
|
||||
keyrings: PropTypes.array,
|
||||
lockMetamask: PropTypes.func,
|
||||
selectedAddress: PropTypes.string,
|
||||
showAccountDetail: PropTypes.func,
|
||||
setSelectedAccount: PropTypes.func,
|
||||
toggleAccountMenu: PropTypes.func,
|
||||
addressConnectedSubjectMap: PropTypes.object,
|
||||
originOfCurrentTab: PropTypes.string,
|
||||
@ -173,7 +173,7 @@ export default class AccountMenu extends Component {
|
||||
accounts,
|
||||
selectedAddress,
|
||||
keyrings,
|
||||
showAccountDetail,
|
||||
setSelectedAccount,
|
||||
addressConnectedSubjectMap,
|
||||
originOfCurrentTab,
|
||||
} = this.props;
|
||||
@ -219,7 +219,7 @@ export default class AccountMenu extends Component {
|
||||
location: 'Main Menu',
|
||||
},
|
||||
});
|
||||
showAccountDetail(identity.address);
|
||||
setSelectedAccount(identity.address);
|
||||
}}
|
||||
key={identity.address}
|
||||
data-testid="account-menu__account"
|
||||
|
@ -3,7 +3,7 @@ import { compose } from 'redux';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import {
|
||||
toggleAccountMenu,
|
||||
showAccountDetail,
|
||||
setSelectedAccount,
|
||||
lockMetamask,
|
||||
hideWarning,
|
||||
} from '../../../store/actions';
|
||||
@ -51,8 +51,8 @@ function mapStateToProps(state) {
|
||||
function mapDispatchToProps(dispatch) {
|
||||
return {
|
||||
toggleAccountMenu: () => dispatch(toggleAccountMenu()),
|
||||
showAccountDetail: (address) => {
|
||||
dispatch(showAccountDetail(address));
|
||||
setSelectedAccount: (address) => {
|
||||
dispatch(setSelectedAccount(address));
|
||||
dispatch(toggleAccountMenu());
|
||||
},
|
||||
lockMetamask: () => {
|
||||
|
@ -47,7 +47,7 @@ describe('Account Menu', () => {
|
||||
],
|
||||
prevIsAccountMenuOpen: false,
|
||||
lockMetamask: sinon.spy(),
|
||||
showAccountDetail: sinon.spy(),
|
||||
setSelectedAccount: sinon.spy(),
|
||||
showRemoveAccountConfirmationModal: sinon.spy(),
|
||||
toggleAccountMenu: sinon.spy(),
|
||||
history: {
|
||||
@ -80,8 +80,8 @@ describe('Account Menu', () => {
|
||||
const click = screen.getAllByTestId('account-menu__account');
|
||||
fireEvent.click(click[0]);
|
||||
|
||||
expect(props.showAccountDetail.calledOnce).toStrictEqual(true);
|
||||
expect(props.showAccountDetail.getCall(0).args[0]).toStrictEqual('0x00');
|
||||
expect(props.setSelectedAccount.calledOnce).toStrictEqual(true);
|
||||
expect(props.setSelectedAccount.getCall(0).args[0]).toStrictEqual('0x00');
|
||||
});
|
||||
|
||||
it('render imported account label', () => {
|
||||
|
@ -24,7 +24,7 @@ export default function reduceApp(state = {}, action) {
|
||||
qrCodeData: null,
|
||||
networkDropdownOpen: false,
|
||||
accountDetail: {
|
||||
subview: 'transactions',
|
||||
privateKey: '',
|
||||
},
|
||||
// Used to display loading indicator
|
||||
isLoading: false,
|
||||
@ -38,7 +38,6 @@ export default function reduceApp(state = {}, action) {
|
||||
lattice: `m/44'/60'/0'/0`,
|
||||
},
|
||||
networksTabSelectedRpcUrl: '',
|
||||
loadingMethodData: false,
|
||||
requestAccountTabs: {},
|
||||
openMetaMaskTabs: {},
|
||||
currentWindowTab: {},
|
||||
@ -143,7 +142,9 @@ export default function reduceApp(state = {}, action) {
|
||||
case actionConstants.CLEAR_ACCOUNT_DETAILS:
|
||||
return {
|
||||
...appState,
|
||||
accountDetail: {},
|
||||
accountDetail: {
|
||||
privateKey: '',
|
||||
},
|
||||
};
|
||||
|
||||
case actionConstants.SHOW_SEND_TOKEN_PAGE:
|
||||
@ -164,23 +165,11 @@ export default function reduceApp(state = {}, action) {
|
||||
return {
|
||||
...appState,
|
||||
accountDetail: {
|
||||
subview: 'transactions',
|
||||
accountExport: 'none',
|
||||
privateKey: '',
|
||||
},
|
||||
warning: null,
|
||||
};
|
||||
|
||||
case actionConstants.SHOW_ACCOUNT_DETAIL:
|
||||
return {
|
||||
...appState,
|
||||
accountDetail: {
|
||||
subview: 'transactions',
|
||||
accountExport: 'none',
|
||||
privateKey: '',
|
||||
},
|
||||
};
|
||||
|
||||
case actionConstants.SHOW_ACCOUNTS_PAGE:
|
||||
return {
|
||||
...appState,
|
||||
@ -322,18 +311,6 @@ export default function reduceApp(state = {}, action) {
|
||||
portfolioTooltipWasShownInThisSession: true,
|
||||
};
|
||||
|
||||
case actionConstants.LOADING_METHOD_DATA_STARTED:
|
||||
return {
|
||||
...appState,
|
||||
loadingMethodData: true,
|
||||
};
|
||||
|
||||
case actionConstants.LOADING_METHOD_DATA_FINISHED:
|
||||
return {
|
||||
...appState,
|
||||
loadingMethodData: false,
|
||||
};
|
||||
|
||||
case actionConstants.SET_REQUEST_ACCOUNT_TABS:
|
||||
return {
|
||||
...appState,
|
||||
|
@ -121,27 +121,13 @@ describe('App State', () => {
|
||||
type: actions.GO_HOME,
|
||||
});
|
||||
|
||||
expect(state.accountDetail.subview).toStrictEqual('transactions');
|
||||
expect(state.accountDetail.accountExport).toStrictEqual('none');
|
||||
expect(state.accountDetail.privateKey).toStrictEqual('');
|
||||
expect(state.warning).toBeNull();
|
||||
});
|
||||
|
||||
it('shows account detail', () => {
|
||||
const state = reduceApp(metamaskState, {
|
||||
type: actions.SHOW_ACCOUNT_DETAIL,
|
||||
value: 'context address',
|
||||
});
|
||||
expect(state.accountDetail.subview).toStrictEqual('transactions'); // default
|
||||
expect(state.accountDetail.accountExport).toStrictEqual('none'); // default
|
||||
expect(state.accountDetail.privateKey).toStrictEqual(''); // default
|
||||
});
|
||||
|
||||
it('clears account details', () => {
|
||||
const exportPrivKeyModal = {
|
||||
accountDetail: {
|
||||
subview: 'export',
|
||||
accountExport: 'completed',
|
||||
privateKey: 'a-priv-key',
|
||||
},
|
||||
};
|
||||
@ -151,10 +137,10 @@ describe('App State', () => {
|
||||
type: actions.CLEAR_ACCOUNT_DETAILS,
|
||||
});
|
||||
|
||||
expect(newState.accountDetail).toStrictEqual({});
|
||||
expect(newState.accountDetail).toStrictEqual({ privateKey: '' });
|
||||
});
|
||||
|
||||
it('shoes account page', () => {
|
||||
it('shows account page', () => {
|
||||
const state = reduceApp(metamaskState, {
|
||||
type: actions.SHOW_ACCOUNTS_PAGE,
|
||||
});
|
||||
@ -220,7 +206,6 @@ describe('App State', () => {
|
||||
});
|
||||
|
||||
expect(state.warning).toBeNull();
|
||||
expect(state.accountDetail.subview).toStrictEqual('transactions');
|
||||
});
|
||||
|
||||
it('sets default warning when unlock fails', () => {
|
||||
@ -314,8 +299,6 @@ describe('App State', () => {
|
||||
value: 'private key',
|
||||
});
|
||||
|
||||
expect(state.accountDetail.subview).toStrictEqual('export');
|
||||
expect(state.accountDetail.accountExport).toStrictEqual('completed');
|
||||
expect(state.accountDetail.privateKey).toStrictEqual('private key');
|
||||
});
|
||||
|
||||
|
@ -5,7 +5,6 @@ import {
|
||||
GasEstimateTypes,
|
||||
NetworkCongestionThresholds,
|
||||
} from '../../../shared/constants/gas';
|
||||
import { NETWORK_TYPES } from '../../../shared/constants/network';
|
||||
import {
|
||||
accountsWithSendEtherInfoSelector,
|
||||
checkNetworkAndAccountSupports1559,
|
||||
@ -82,31 +81,6 @@ export default function reduceMetamask(state = initialState, action) {
|
||||
isUnlocked: false,
|
||||
};
|
||||
|
||||
case actionConstants.SET_RPC_TARGET:
|
||||
return {
|
||||
...metamaskState,
|
||||
provider: {
|
||||
type: NETWORK_TYPES.RPC,
|
||||
rpcUrl: action.value,
|
||||
},
|
||||
};
|
||||
|
||||
case actionConstants.SET_PROVIDER_TYPE:
|
||||
return {
|
||||
...metamaskState,
|
||||
provider: {
|
||||
type: action.value,
|
||||
},
|
||||
};
|
||||
|
||||
case actionConstants.SHOW_ACCOUNT_DETAIL:
|
||||
return {
|
||||
...metamaskState,
|
||||
isUnlocked: true,
|
||||
isInitialized: true,
|
||||
selectedAddress: action.value,
|
||||
};
|
||||
|
||||
case actionConstants.SET_ACCOUNT_LABEL: {
|
||||
const { account } = action.value;
|
||||
const name = action.value.label;
|
||||
@ -152,18 +126,6 @@ export default function reduceMetamask(state = initialState, action) {
|
||||
participateInMetaMetrics: action.value,
|
||||
};
|
||||
|
||||
case actionConstants.SET_USE_BLOCKIE:
|
||||
return {
|
||||
...metamaskState,
|
||||
useBlockie: action.value,
|
||||
};
|
||||
|
||||
case actionConstants.UPDATE_FEATURE_FLAGS:
|
||||
return {
|
||||
...metamaskState,
|
||||
featureFlags: action.value,
|
||||
};
|
||||
|
||||
case actionConstants.CLOSE_WELCOME_SCREEN:
|
||||
return {
|
||||
...metamaskState,
|
||||
@ -183,16 +145,6 @@ export default function reduceMetamask(state = initialState, action) {
|
||||
};
|
||||
}
|
||||
|
||||
case actionConstants.UPDATE_PREFERENCES: {
|
||||
return {
|
||||
...metamaskState,
|
||||
preferences: {
|
||||
...metamaskState.preferences,
|
||||
...action.payload,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
case actionConstants.COMPLETE_ONBOARDING: {
|
||||
return {
|
||||
...metamaskState,
|
||||
|
@ -128,42 +128,6 @@ describe('MetaMask Reducers', () => {
|
||||
expect(lockMetaMask.isUnlocked).toStrictEqual(false);
|
||||
});
|
||||
|
||||
it('sets rpc target', () => {
|
||||
const state = reduceMetamask(
|
||||
{},
|
||||
{
|
||||
type: actionConstants.SET_RPC_TARGET,
|
||||
value: 'https://custom.rpc',
|
||||
},
|
||||
);
|
||||
|
||||
expect(state.provider.rpcUrl).toStrictEqual('https://custom.rpc');
|
||||
});
|
||||
|
||||
it('sets provider type', () => {
|
||||
const state = reduceMetamask(
|
||||
{},
|
||||
{
|
||||
type: actionConstants.SET_PROVIDER_TYPE,
|
||||
value: 'provider type',
|
||||
},
|
||||
);
|
||||
|
||||
expect(state.provider.type).toStrictEqual('provider type');
|
||||
});
|
||||
|
||||
it('shows account detail', () => {
|
||||
const state = reduceMetamask(
|
||||
{},
|
||||
{
|
||||
type: actionConstants.SHOW_ACCOUNT_DETAIL,
|
||||
},
|
||||
);
|
||||
|
||||
expect(state.isUnlocked).toStrictEqual(true);
|
||||
expect(state.isInitialized).toStrictEqual(true);
|
||||
});
|
||||
|
||||
it('sets account label', () => {
|
||||
const state = reduceMetamask(
|
||||
{},
|
||||
@ -211,32 +175,6 @@ describe('MetaMask Reducers', () => {
|
||||
expect(state.currentNetworkTxList[0].txParams).toStrictEqual('bar');
|
||||
});
|
||||
|
||||
it('sets blockies', () => {
|
||||
const state = reduceMetamask(
|
||||
{},
|
||||
{
|
||||
type: actionConstants.SET_USE_BLOCKIE,
|
||||
value: true,
|
||||
},
|
||||
);
|
||||
|
||||
expect(state.useBlockie).toStrictEqual(true);
|
||||
});
|
||||
|
||||
it('updates an arbitrary feature flag', () => {
|
||||
const state = reduceMetamask(
|
||||
{},
|
||||
{
|
||||
type: actionConstants.UPDATE_FEATURE_FLAGS,
|
||||
value: {
|
||||
foo: true,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
expect(state.featureFlags.foo).toStrictEqual(true);
|
||||
});
|
||||
|
||||
it('close welcome screen', () => {
|
||||
const state = reduceMetamask(
|
||||
{},
|
||||
|
@ -1,36 +1,8 @@
|
||||
import freeze from 'deep-freeze-strict';
|
||||
import reducers from '../ducks';
|
||||
import { NETWORK_TYPES } from '../../shared/constants/network';
|
||||
import * as actionConstants from './actionConstants';
|
||||
|
||||
describe('Redux actionConstants', () => {
|
||||
describe('SET_RPC_TARGET', () => {
|
||||
const initialState = {
|
||||
metamask: {
|
||||
frequentRpcList: [],
|
||||
provider: {
|
||||
rpcUrl: 'bar',
|
||||
},
|
||||
},
|
||||
appState: {
|
||||
currentView: {
|
||||
name: 'accounts',
|
||||
},
|
||||
},
|
||||
};
|
||||
freeze(initialState);
|
||||
it('sets the state.metamask.rpcUrl property of the state to the action.value', () => {
|
||||
const action = {
|
||||
type: actionConstants.SET_RPC_TARGET,
|
||||
value: 'foo',
|
||||
};
|
||||
|
||||
const result = reducers(initialState, action);
|
||||
expect(result.metamask.provider.type).toStrictEqual(NETWORK_TYPES.RPC);
|
||||
expect(result.metamask.provider.rpcUrl).toStrictEqual('foo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('SET_ACCOUNT_LABEL', () => {
|
||||
it('updates the state.metamask.identities[:i].name property of the state to the action.value.label', () => {
|
||||
const initialState = {
|
||||
@ -59,23 +31,4 @@ describe('Redux actionConstants', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('SHOW_ACCOUNT_DETAIL', () => {
|
||||
it('updates metamask state', () => {
|
||||
const initialState = {
|
||||
metamask: {},
|
||||
};
|
||||
freeze(initialState);
|
||||
|
||||
const action = {
|
||||
type: actionConstants.SHOW_ACCOUNT_DETAIL,
|
||||
value: 'bar',
|
||||
};
|
||||
freeze(action);
|
||||
|
||||
const resultingState = reducers(initialState, action);
|
||||
expect(resultingState.metamask.isUnlocked).toStrictEqual(true);
|
||||
expect(resultingState.metamask.isInitialized).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -28,7 +28,6 @@ export const DISPLAY_WARNING = 'DISPLAY_WARNING';
|
||||
export const HIDE_WARNING = 'HIDE_WARNING';
|
||||
export const CAPTURE_SINGLE_EXCEPTION = 'CAPTURE_SINGLE_EXCEPTION';
|
||||
// accounts screen
|
||||
export const SHOW_ACCOUNT_DETAIL = 'SHOW_ACCOUNT_DETAIL';
|
||||
export const SHOW_ACCOUNTS_PAGE = 'SHOW_ACCOUNTS_PAGE';
|
||||
export const SHOW_CONF_TX_PAGE = 'SHOW_CONF_TX_PAGE';
|
||||
// account detail screen
|
||||
@ -42,8 +41,6 @@ export const TRANSACTION_ERROR = 'TRANSACTION_ERROR';
|
||||
export const UPDATE_TRANSACTION_PARAMS = 'UPDATE_TRANSACTION_PARAMS';
|
||||
export const SET_NEXT_NONCE = 'SET_NEXT_NONCE';
|
||||
// config screen
|
||||
export const SET_RPC_TARGET = 'SET_RPC_TARGET';
|
||||
export const SET_PROVIDER_TYPE = 'SET_PROVIDER_TYPE';
|
||||
export const SET_HARDWARE_WALLET_DEFAULT_HD_PATH =
|
||||
'SET_HARDWARE_WALLET_DEFAULT_HD_PATH';
|
||||
// loading overlay
|
||||
@ -55,22 +52,13 @@ export const BUY = 'BUY';
|
||||
export const TOGGLE_ACCOUNT_MENU = 'TOGGLE_ACCOUNT_MENU';
|
||||
|
||||
// preferences
|
||||
export const SET_USE_BLOCKIE = 'SET_USE_BLOCKIE';
|
||||
export const SET_USE_NONCEFIELD = 'SET_USE_NONCEFIELD';
|
||||
export const UPDATE_CUSTOM_NONCE = 'UPDATE_CUSTOM_NONCE';
|
||||
export const SET_IPFS_GATEWAY = 'SET_IPFS_GATEWAY';
|
||||
|
||||
export const SET_PARTICIPATE_IN_METAMETRICS = 'SET_PARTICIPATE_IN_METAMETRICS';
|
||||
|
||||
// locale
|
||||
export const SET_CURRENT_LOCALE = 'SET_CURRENT_LOCALE';
|
||||
|
||||
// Feature Flags
|
||||
export const UPDATE_FEATURE_FLAGS = 'UPDATE_FEATURE_FLAGS';
|
||||
|
||||
// Preferences
|
||||
export const UPDATE_PREFERENCES = 'UPDATE_PREFERENCES';
|
||||
|
||||
// Onboarding
|
||||
export const COMPLETE_ONBOARDING = 'COMPLETE_ONBOARDING';
|
||||
export const ONBOARDED_IN_THIS_UI_SESSION = 'ONBOARDED_IN_THIS_UI_SESSION';
|
||||
@ -98,9 +86,6 @@ export const SET_NEW_CUSTOM_NETWORK_ADDED = 'SET_NEW_CUSTOM_NETWORK_ADDED';
|
||||
export const LOADING_METHOD_DATA_STARTED = 'LOADING_METHOD_DATA_STARTED';
|
||||
export const LOADING_METHOD_DATA_FINISHED = 'LOADING_METHOD_DATA_FINISHED';
|
||||
|
||||
export const LOADING_TOKEN_PARAMS_STARTED = 'LOADING_TOKEN_PARAMS_STARTED';
|
||||
export const LOADING_TOKEN_PARAMS_FINISHED = 'LOADING_TOKEN_PARAMS_FINISHED';
|
||||
|
||||
export const SET_REQUEST_ACCOUNT_TABS = 'SET_REQUEST_ACCOUNT_TABS';
|
||||
export const SET_CURRENT_WINDOW_TAB = 'SET_CURRENT_WINDOW_TAB';
|
||||
export const SET_OPEN_METAMASK_TAB_IDS = 'SET_OPEN_METAMASK_TAB_IDS';
|
||||
|
@ -335,12 +335,6 @@ export function importNewAccount(strategy, args) {
|
||||
}
|
||||
|
||||
dispatch(updateMetamaskState(newState));
|
||||
if (newState.selectedAddress) {
|
||||
dispatch({
|
||||
type: actionConstants.SHOW_ACCOUNT_DETAIL,
|
||||
value: newState.selectedAddress,
|
||||
});
|
||||
}
|
||||
return newState;
|
||||
};
|
||||
}
|
||||
@ -1574,7 +1568,7 @@ export function setSelectedAddress(address) {
|
||||
};
|
||||
}
|
||||
|
||||
export function showAccountDetail(address) {
|
||||
export function setSelectedAccount(address) {
|
||||
return async (dispatch, getState) => {
|
||||
dispatch(showLoadingIndication());
|
||||
log.debug(`background.setSelectedAddress`);
|
||||
@ -1606,10 +1600,6 @@ export function showAccountDetail(address) {
|
||||
dispatch(hideLoadingIndication());
|
||||
}
|
||||
|
||||
dispatch({
|
||||
type: actionConstants.SHOW_ACCOUNT_DETAIL,
|
||||
value: address,
|
||||
});
|
||||
if (
|
||||
unconnectedAccountAccountAlertIsEnabled &&
|
||||
switchingToUnconnectedAddress
|
||||
@ -2076,16 +2066,7 @@ export function setProviderType(type) {
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
dispatch(displayWarning('Had a problem changing networks!'));
|
||||
return;
|
||||
}
|
||||
dispatch(updateProviderType(type));
|
||||
};
|
||||
}
|
||||
|
||||
export function updateProviderType(type) {
|
||||
return {
|
||||
type: actionConstants.SET_PROVIDER_TYPE,
|
||||
value: type,
|
||||
};
|
||||
}
|
||||
|
||||
@ -2112,13 +2093,7 @@ export function updateAndSetCustomRpc(
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
dispatch(displayWarning('Had a problem changing networks!'));
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch({
|
||||
type: actionConstants.SET_RPC_TARGET,
|
||||
value: newRpc,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@ -2151,13 +2126,7 @@ export function editRpc(
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
dispatch(displayWarning('Had a problem changing networks!'));
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch({
|
||||
type: actionConstants.SET_RPC_TARGET,
|
||||
value: newRpc,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@ -2516,7 +2485,6 @@ export function setFeatureFlag(feature, activated, notificationType) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
dispatch(updateFeatureFlags(updatedFeatureFlags));
|
||||
notificationType && dispatch(showModal({ name: notificationType }));
|
||||
resolve(updatedFeatureFlags);
|
||||
},
|
||||
@ -2525,13 +2493,6 @@ export function setFeatureFlag(feature, activated, notificationType) {
|
||||
};
|
||||
}
|
||||
|
||||
export function updateFeatureFlags(updatedFeatureFlags) {
|
||||
return {
|
||||
type: actionConstants.UPDATE_FEATURE_FLAGS,
|
||||
value: updatedFeatureFlags,
|
||||
};
|
||||
}
|
||||
|
||||
export function setPreference(preference, value) {
|
||||
return (dispatch) => {
|
||||
dispatch(showLoadingIndication());
|
||||
@ -2547,8 +2508,6 @@ export function setPreference(preference, value) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch(updatePreferences(updatedPreferences));
|
||||
resolve(updatedPreferences);
|
||||
},
|
||||
);
|
||||
@ -2556,13 +2515,6 @@ export function setPreference(preference, value) {
|
||||
};
|
||||
}
|
||||
|
||||
export function updatePreferences(value) {
|
||||
return {
|
||||
type: actionConstants.UPDATE_PREFERENCES,
|
||||
value,
|
||||
};
|
||||
}
|
||||
|
||||
export function setDefaultHomeActiveTabName(value) {
|
||||
return async (dispatch) => {
|
||||
await submitRequestToBackground('setDefaultHomeActiveTabName', [value]);
|
||||
@ -2676,10 +2628,6 @@ export function setUseBlockie(val) {
|
||||
dispatch(displayWarning(err.message));
|
||||
}
|
||||
});
|
||||
dispatch({
|
||||
type: actionConstants.SET_USE_BLOCKIE,
|
||||
value: val,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@ -2693,10 +2641,6 @@ export function setUseNonceField(val) {
|
||||
dispatch(displayWarning(error.message));
|
||||
}
|
||||
dispatch(hideLoadingIndication());
|
||||
dispatch({
|
||||
type: actionConstants.SET_USE_NONCEFIELD,
|
||||
value: val,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@ -2819,11 +2763,6 @@ export function setIpfsGateway(val) {
|
||||
callBackgroundMethod('setIpfsGateway', [val], (err) => {
|
||||
if (err) {
|
||||
dispatch(displayWarning(err.message));
|
||||
} else {
|
||||
dispatch({
|
||||
type: actionConstants.SET_IPFS_GATEWAY,
|
||||
value: val,
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -3282,18 +3221,6 @@ export function setOutdatedBrowserWarningLastShown(lastShown) {
|
||||
};
|
||||
}
|
||||
|
||||
export function loadingMethodDataStarted() {
|
||||
return {
|
||||
type: actionConstants.LOADING_METHOD_DATA_STARTED,
|
||||
};
|
||||
}
|
||||
|
||||
export function loadingMethodDataFinished() {
|
||||
return {
|
||||
type: actionConstants.LOADING_METHOD_DATA_FINISHED,
|
||||
};
|
||||
}
|
||||
|
||||
export function getContractMethodData(data = '') {
|
||||
return async (dispatch, getState) => {
|
||||
const prefixedData = addHexPrefix(data);
|
||||
@ -3310,12 +3237,10 @@ export function getContractMethodData(data = '') {
|
||||
return knownMethodData[fourBytePrefix];
|
||||
}
|
||||
|
||||
dispatch(loadingMethodDataStarted());
|
||||
log.debug(`loadingMethodData`);
|
||||
|
||||
const { name, params } = await getMethodDataAsync(fourBytePrefix);
|
||||
|
||||
dispatch(loadingMethodDataFinished());
|
||||
callBackgroundMethod(
|
||||
'addKnownMethodData',
|
||||
[fourBytePrefix, { name, params }],
|
||||
@ -3329,18 +3254,6 @@ export function getContractMethodData(data = '') {
|
||||
};
|
||||
}
|
||||
|
||||
export function loadingTokenParamsStarted() {
|
||||
return {
|
||||
type: actionConstants.LOADING_TOKEN_PARAMS_STARTED,
|
||||
};
|
||||
}
|
||||
|
||||
export function loadingTokenParamsFinished() {
|
||||
return {
|
||||
type: actionConstants.LOADING_TOKEN_PARAMS_FINISHED,
|
||||
};
|
||||
}
|
||||
|
||||
export function setSeedPhraseBackedUp(seedPhraseBackupState) {
|
||||
return (dispatch) => {
|
||||
log.debug(`background.setSeedPhraseBackedUp`);
|
||||
|
@ -986,12 +986,12 @@ describe('Actions', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('#showAccountDetail', () => {
|
||||
describe('#setSelectedAccount', () => {
|
||||
afterEach(() => {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
it('#showAccountDetail', async () => {
|
||||
it('#setSelectedAccount', async () => {
|
||||
const store = mockStore({
|
||||
activeTab: {},
|
||||
metamask: { alertEnabledness: {}, selectedAddress: '0x123' },
|
||||
@ -1005,7 +1005,7 @@ describe('Actions', () => {
|
||||
|
||||
_setBackgroundConnection(background.getApi());
|
||||
|
||||
await store.dispatch(actions.showAccountDetail());
|
||||
await store.dispatch(actions.setSelectedAccount());
|
||||
expect(setSelectedAddressSpy.callCount).toStrictEqual(1);
|
||||
});
|
||||
|
||||
@ -1031,7 +1031,7 @@ describe('Actions', () => {
|
||||
{ type: 'HIDE_LOADING_INDICATION' },
|
||||
];
|
||||
|
||||
await store.dispatch(actions.showAccountDetail());
|
||||
await store.dispatch(actions.setSelectedAccount());
|
||||
expect(store.getActions()).toStrictEqual(expectedActions);
|
||||
});
|
||||
});
|
||||
@ -1520,7 +1520,6 @@ describe('Actions', () => {
|
||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
||||
{ type: 'HIDE_LOADING_INDICATION' },
|
||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
||||
{ type: 'SET_USE_BLOCKIE', value: undefined },
|
||||
];
|
||||
|
||||
await store.dispatch(actions.setUseBlockie());
|
||||
|
Loading…
Reference in New Issue
Block a user