Export each action constant directly (#8536)

feature/default_network_editable
Whymarrh Whitby 5 years ago committed by GitHub
parent fe9176662a
commit 27e69ec3aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      test/unit/actions/config_test.js
  2. 2
      test/unit/actions/set_account_label_test.js
  3. 2
      test/unit/actions/set_selected_account_test.js
  4. 2
      test/unit/actions/tx_test.js
  5. 2
      test/unit/ui/app/reducers/app.spec.js
  6. 2
      test/unit/ui/app/reducers/metamask.spec.js
  7. 2
      ui/app/ducks/alerts/unconnected-account.js
  8. 2
      ui/app/ducks/app/app.js
  9. 2
      ui/app/ducks/locale/locale.js
  10. 2
      ui/app/ducks/metamask/metamask.js
  11. 231
      ui/app/store/actionConstants.js
  12. 2
      ui/app/store/actions.js

@ -1,7 +1,7 @@
import assert from 'assert' import assert from 'assert'
import freeze from 'deep-freeze-strict' import freeze from 'deep-freeze-strict'
import reducers from '../../../ui/app/ducks' import reducers from '../../../ui/app/ducks'
import actionConstants from '../../../ui/app/store/actionConstants' import * as actionConstants from '../../../ui/app/store/actionConstants'
describe('config view actions', function () { describe('config view actions', function () {
const initialState = { const initialState = {

@ -1,7 +1,7 @@
import assert from 'assert' import assert from 'assert'
import freeze from 'deep-freeze-strict' import freeze from 'deep-freeze-strict'
import reducers from '../../../ui/app/ducks' import reducers from '../../../ui/app/ducks'
import actionConstants from '../../../ui/app/store/actionConstants' import * as actionConstants from '../../../ui/app/store/actionConstants'
describe('SET_ACCOUNT_LABEL', function () { describe('SET_ACCOUNT_LABEL', function () {
it('updates the state.metamask.identities[:i].name property of the state to the action.value.label', function () { it('updates the state.metamask.identities[:i].name property of the state to the action.value.label', function () {

@ -1,7 +1,7 @@
import assert from 'assert' import assert from 'assert'
import freeze from 'deep-freeze-strict' import freeze from 'deep-freeze-strict'
import reducers from '../../../ui/app/ducks' import reducers from '../../../ui/app/ducks'
import actionConstants from '../../../ui/app/store/actionConstants' import * as actionConstants from '../../../ui/app/store/actionConstants'
describe('SHOW_ACCOUNT_DETAIL', function () { describe('SHOW_ACCOUNT_DETAIL', function () {
it('updates metamask state', function () { it('updates metamask state', function () {

@ -2,7 +2,7 @@ import assert from 'assert'
import configureMockStore from 'redux-mock-store' import configureMockStore from 'redux-mock-store'
import thunk from 'redux-thunk' import thunk from 'redux-thunk'
import * as actions from '../../../ui/app/store/actions' import * as actions from '../../../ui/app/store/actions'
import actionConstants from '../../../ui/app/store/actionConstants' import * as actionConstants from '../../../ui/app/store/actionConstants'
const middlewares = [thunk] const middlewares = [thunk]
const mockStore = configureMockStore(middlewares) const mockStore = configureMockStore(middlewares)

@ -1,6 +1,6 @@
import assert from 'assert' import assert from 'assert'
import reduceApp from '../../../../../ui/app/ducks/app/app' import reduceApp from '../../../../../ui/app/ducks/app/app'
import actionConstants from '../../../../../ui/app/store/actionConstants' import * as actionConstants from '../../../../../ui/app/store/actionConstants'
const actions = actionConstants const actions = actionConstants

@ -1,6 +1,6 @@
import assert from 'assert' import assert from 'assert'
import reduceMetamask from '../../../../../ui/app/ducks/metamask/metamask' import reduceMetamask from '../../../../../ui/app/ducks/metamask/metamask'
import actionConstants from '../../../../../ui/app/store/actionConstants' import * as actionConstants from '../../../../../ui/app/store/actionConstants'
describe('MetaMask Reducers', function () { describe('MetaMask Reducers', function () {

@ -1,7 +1,7 @@
import { createSlice } from '@reduxjs/toolkit' import { createSlice } from '@reduxjs/toolkit'
import { captureException } from '@sentry/browser' import { captureException } from '@sentry/browser'
import actionConstants from '../../store/actionConstants' import * as actionConstants from '../../store/actionConstants'
import { addPermittedAccount } from '../../store/actions' import { addPermittedAccount } from '../../store/actions'
import { import {
getOriginOfCurrentTab, getOriginOfCurrentTab,

@ -1,4 +1,4 @@
import actionConstants from '../../store/actionConstants' import * as actionConstants from '../../store/actionConstants'
// actionConstants // actionConstants
const SET_THREEBOX_LAST_UPDATED = 'metamask/app/SET_THREEBOX_LAST_UPDATED' const SET_THREEBOX_LAST_UPDATED = 'metamask/app/SET_THREEBOX_LAST_UPDATED'

@ -1,4 +1,4 @@
import actionConstants from '../../store/actionConstants' import * as actionConstants from '../../store/actionConstants'
export default function reduceLocaleMessages (state = {}, { type, value }) { export default function reduceLocaleMessages (state = {}, { type, value }) {
switch (type) { switch (type) {

@ -1,4 +1,4 @@
import actionConstants from '../../store/actionConstants' import * as actionConstants from '../../store/actionConstants'
export default function reduceMetamask (state = {}, action) { export default function reduceMetamask (state = {}, action) {
const metamaskState = Object.assign({ const metamaskState = Object.assign({

@ -1,117 +1,114 @@
export const GO_HOME = 'GO_HOME'
export default { // modal state
GO_HOME: 'GO_HOME', export const MODAL_OPEN = 'UI_MODAL_OPEN'
// modal state export const MODAL_CLOSE = 'UI_MODAL_CLOSE'
MODAL_OPEN: 'UI_MODAL_OPEN', // notification state
MODAL_CLOSE: 'UI_MODAL_CLOSE', export const CLOSE_NOTIFICATION_WINDOW = 'CLOSE_NOTIFICATION_WINDOW'
// notification state // sidebar state
CLOSE_NOTIFICATION_WINDOW: 'CLOSE_NOTIFICATION_WINDOW', export const SIDEBAR_OPEN = 'UI_SIDEBAR_OPEN'
// sidebar state export const SIDEBAR_CLOSE = 'UI_SIDEBAR_CLOSE'
SIDEBAR_OPEN: 'UI_SIDEBAR_OPEN', // alert state
SIDEBAR_CLOSE: 'UI_SIDEBAR_CLOSE', export const ALERT_OPEN = 'UI_ALERT_OPEN'
// alert state export const ALERT_CLOSE = 'UI_ALERT_CLOSE'
ALERT_OPEN: 'UI_ALERT_OPEN', export const QR_CODE_DETECTED = 'UI_QR_CODE_DETECTED'
ALERT_CLOSE: 'UI_ALERT_CLOSE', // network dropdown open
QR_CODE_DETECTED: 'UI_QR_CODE_DETECTED', export const NETWORK_DROPDOWN_OPEN = 'UI_NETWORK_DROPDOWN_OPEN'
// network dropdown open export const NETWORK_DROPDOWN_CLOSE = 'UI_NETWORK_DROPDOWN_CLOSE'
NETWORK_DROPDOWN_OPEN: 'UI_NETWORK_DROPDOWN_OPEN', // remote state
NETWORK_DROPDOWN_CLOSE: 'UI_NETWORK_DROPDOWN_CLOSE', export const UPDATE_METAMASK_STATE = 'UPDATE_METAMASK_STATE'
// remote state export const SELECTED_ADDRESS_CHANGED = 'SELECTED_ADDRESS_CHANGED'
UPDATE_METAMASK_STATE: 'UPDATE_METAMASK_STATE', export const FORGOT_PASSWORD = 'FORGOT_PASSWORD'
SELECTED_ADDRESS_CHANGED: 'SELECTED_ADDRESS_CHANGED', export const CLOSE_WELCOME_SCREEN = 'CLOSE_WELCOME_SCREEN'
FORGOT_PASSWORD: 'FORGOT_PASSWORD', // unlock screen
CLOSE_WELCOME_SCREEN: 'CLOSE_WELCOME_SCREEN', export const UNLOCK_IN_PROGRESS = 'UNLOCK_IN_PROGRESS'
// unlock screen export const UNLOCK_FAILED = 'UNLOCK_FAILED'
UNLOCK_IN_PROGRESS: 'UNLOCK_IN_PROGRESS', export const UNLOCK_SUCCEEDED = 'UNLOCK_SUCCEEDED'
UNLOCK_FAILED: 'UNLOCK_FAILED', export const LOCK_METAMASK = 'LOCK_METAMASK'
UNLOCK_SUCCEEDED: 'UNLOCK_SUCCEEDED', // error handling
LOCK_METAMASK: 'LOCK_METAMASK', export const DISPLAY_WARNING = 'DISPLAY_WARNING'
// error handling export const HIDE_WARNING = 'HIDE_WARNING'
DISPLAY_WARNING: 'DISPLAY_WARNING', // accounts screen
HIDE_WARNING: 'HIDE_WARNING', export const SET_SELECTED_TOKEN = 'SET_SELECTED_TOKEN'
// accounts screen export const SHOW_ACCOUNT_DETAIL = 'SHOW_ACCOUNT_DETAIL'
SET_SELECTED_TOKEN: 'SET_SELECTED_TOKEN', export const SHOW_ACCOUNTS_PAGE = 'SHOW_ACCOUNTS_PAGE'
SHOW_ACCOUNT_DETAIL: 'SHOW_ACCOUNT_DETAIL', export const SHOW_CONF_TX_PAGE = 'SHOW_CONF_TX_PAGE'
SHOW_ACCOUNTS_PAGE: 'SHOW_ACCOUNTS_PAGE', export const SET_CURRENT_FIAT = 'SET_CURRENT_FIAT'
SHOW_CONF_TX_PAGE: 'SHOW_CONF_TX_PAGE', // account detail screen
SET_CURRENT_FIAT: 'SET_CURRENT_FIAT', export const SHOW_SEND_TOKEN_PAGE = 'SHOW_SEND_TOKEN_PAGE'
// account detail screen export const SHOW_PRIVATE_KEY = 'SHOW_PRIVATE_KEY'
SHOW_SEND_TOKEN_PAGE: 'SHOW_SEND_TOKEN_PAGE', export const SET_ACCOUNT_LABEL = 'SET_ACCOUNT_LABEL'
SHOW_PRIVATE_KEY: 'SHOW_PRIVATE_KEY', // tx conf screen
SET_ACCOUNT_LABEL: 'SET_ACCOUNT_LABEL', export const COMPLETED_TX = 'COMPLETED_TX'
// tx conf screen export const TRANSACTION_ERROR = 'TRANSACTION_ERROR'
COMPLETED_TX: 'COMPLETED_TX', export const UPDATE_TRANSACTION_PARAMS = 'UPDATE_TRANSACTION_PARAMS'
TRANSACTION_ERROR: 'TRANSACTION_ERROR', export const SET_NEXT_NONCE = 'SET_NEXT_NONCE'
UPDATE_TRANSACTION_PARAMS: 'UPDATE_TRANSACTION_PARAMS', // send screen
SET_NEXT_NONCE: 'SET_NEXT_NONCE', export const UPDATE_GAS_LIMIT = 'UPDATE_GAS_LIMIT'
// send screen export const UPDATE_GAS_PRICE = 'UPDATE_GAS_PRICE'
UPDATE_GAS_LIMIT: 'UPDATE_GAS_LIMIT', export const UPDATE_GAS_TOTAL = 'UPDATE_GAS_TOTAL'
UPDATE_GAS_PRICE: 'UPDATE_GAS_PRICE', export const UPDATE_SEND_HEX_DATA = 'UPDATE_SEND_HEX_DATA'
UPDATE_GAS_TOTAL: 'UPDATE_GAS_TOTAL', export const UPDATE_SEND_TOKEN_BALANCE = 'UPDATE_SEND_TOKEN_BALANCE'
UPDATE_SEND_HEX_DATA: 'UPDATE_SEND_HEX_DATA', export const UPDATE_SEND_TO = 'UPDATE_SEND_TO'
UPDATE_SEND_TOKEN_BALANCE: 'UPDATE_SEND_TOKEN_BALANCE', export const UPDATE_SEND_AMOUNT = 'UPDATE_SEND_AMOUNT'
UPDATE_SEND_TO: 'UPDATE_SEND_TO', export const UPDATE_SEND_ERRORS = 'UPDATE_SEND_ERRORS'
UPDATE_SEND_AMOUNT: 'UPDATE_SEND_AMOUNT', export const UPDATE_MAX_MODE = 'UPDATE_MAX_MODE'
UPDATE_SEND_ERRORS: 'UPDATE_SEND_ERRORS', export const UPDATE_SEND = 'UPDATE_SEND'
UPDATE_MAX_MODE: 'UPDATE_MAX_MODE', export const CLEAR_SEND = 'CLEAR_SEND'
UPDATE_SEND: 'UPDATE_SEND', export const GAS_LOADING_STARTED = 'GAS_LOADING_STARTED'
CLEAR_SEND: 'CLEAR_SEND', export const GAS_LOADING_FINISHED = 'GAS_LOADING_FINISHED'
GAS_LOADING_STARTED: 'GAS_LOADING_STARTED', export const UPDATE_SEND_ENS_RESOLUTION = 'UPDATE_SEND_ENS_RESOLUTION'
GAS_LOADING_FINISHED: 'GAS_LOADING_FINISHED', export const UPDATE_SEND_ENS_RESOLUTION_ERROR = 'UPDATE_SEND_ENS_RESOLUTION_ERROR'
UPDATE_SEND_ENS_RESOLUTION: 'UPDATE_SEND_ENS_RESOLUTION', // config screen
UPDATE_SEND_ENS_RESOLUTION_ERROR: 'UPDATE_SEND_ENS_RESOLUTION_ERROR', export const SET_RPC_TARGET = 'SET_RPC_TARGET'
// config screen export const SET_PROVIDER_TYPE = 'SET_PROVIDER_TYPE'
SET_RPC_TARGET: 'SET_RPC_TARGET', export const SET_PREVIOUS_PROVIDER = 'SET_PREVIOUS_PROVIDER'
SET_PROVIDER_TYPE: 'SET_PROVIDER_TYPE', export const UPDATE_TOKENS = 'UPDATE_TOKENS'
SET_PREVIOUS_PROVIDER: 'SET_PREVIOUS_PROVIDER', export const SET_HARDWARE_WALLET_DEFAULT_HD_PATH = 'SET_HARDWARE_WALLET_DEFAULT_HD_PATH'
UPDATE_TOKENS: 'UPDATE_TOKENS', // loading overlay
SET_HARDWARE_WALLET_DEFAULT_HD_PATH: 'SET_HARDWARE_WALLET_DEFAULT_HD_PATH', export const SHOW_LOADING = 'SHOW_LOADING_INDICATION'
// loading overlay export const HIDE_LOADING = 'HIDE_LOADING_INDICATION'
SHOW_LOADING: 'SHOW_LOADING_INDICATION',
HIDE_LOADING: 'HIDE_LOADING_INDICATION', export const BUY_ETH = 'BUY_ETH'
BUY_ETH: 'BUY_ETH', export const TOGGLE_ACCOUNT_MENU = 'TOGGLE_ACCOUNT_MENU'
TOGGLE_ACCOUNT_MENU: 'TOGGLE_ACCOUNT_MENU', export const SET_USE_BLOCKIE = 'SET_USE_BLOCKIE'
export const SET_USE_NONCEFIELD = 'SET_USE_NONCEFIELD'
SET_USE_BLOCKIE: 'SET_USE_BLOCKIE', export const UPDATE_CUSTOM_NONCE = 'UPDATE_CUSTOM_NONCE'
SET_USE_NONCEFIELD: 'SET_USE_NONCEFIELD', export const SET_IPFS_GATEWAY = 'SET_IPFS_GATEWAY'
UPDATE_CUSTOM_NONCE: 'UPDATE_CUSTOM_NONCE',
SET_IPFS_GATEWAY: 'SET_IPFS_GATEWAY', export const SET_PARTICIPATE_IN_METAMETRICS = 'SET_PARTICIPATE_IN_METAMETRICS'
export const SET_METAMETRICS_SEND_COUNT = 'SET_METAMETRICS_SEND_COUNT'
SET_PARTICIPATE_IN_METAMETRICS: 'SET_PARTICIPATE_IN_METAMETRICS',
SET_METAMETRICS_SEND_COUNT: 'SET_METAMETRICS_SEND_COUNT', // locale
export const SET_CURRENT_LOCALE = 'SET_CURRENT_LOCALE'
// locale
SET_CURRENT_LOCALE: 'SET_CURRENT_LOCALE', // Feature Flags
export const UPDATE_FEATURE_FLAGS = 'UPDATE_FEATURE_FLAGS'
// Feature Flags
UPDATE_FEATURE_FLAGS: 'UPDATE_FEATURE_FLAGS', // Preferences
export const UPDATE_PREFERENCES = 'UPDATE_PREFERENCES'
// Preferences
UPDATE_PREFERENCES: 'UPDATE_PREFERENCES', // Onboarding
export const COMPLETE_ONBOARDING = 'COMPLETE_ONBOARDING'
// Onboarding
COMPLETE_ONBOARDING: 'COMPLETE_ONBOARDING', export const SET_MOUSE_USER_STATE = 'SET_MOUSE_USER_STATE'
SET_MOUSE_USER_STATE: 'SET_MOUSE_USER_STATE', // Network
export const SET_PENDING_TOKENS = 'SET_PENDING_TOKENS'
// Network export const CLEAR_PENDING_TOKENS = 'CLEAR_PENDING_TOKENS'
SET_PENDING_TOKENS: 'SET_PENDING_TOKENS',
CLEAR_PENDING_TOKENS: 'CLEAR_PENDING_TOKENS', export const SET_FIRST_TIME_FLOW_TYPE = 'SET_FIRST_TIME_FLOW_TYPE'
SET_FIRST_TIME_FLOW_TYPE: 'SET_FIRST_TIME_FLOW_TYPE', export const SET_SELECTED_SETTINGS_RPC_URL = 'SET_SELECTED_SETTINGS_RPC_URL'
export const SET_NETWORKS_TAB_ADD_MODE = 'SET_NETWORKS_TAB_ADD_MODE'
SET_SELECTED_SETTINGS_RPC_URL: 'SET_SELECTED_SETTINGS_RPC_URL',
SET_NETWORKS_TAB_ADD_MODE: 'SET_NETWORKS_TAB_ADD_MODE', export const LOADING_METHOD_DATA_STARTED = 'LOADING_METHOD_DATA_STARTED'
export const LOADING_METHOD_DATA_FINISHED = 'LOADING_METHOD_DATA_FINISHED'
LOADING_METHOD_DATA_STARTED: 'LOADING_METHOD_DATA_STARTED',
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'
LOADING_TOKEN_PARAMS_STARTED: 'LOADING_TOKEN_PARAMS_STARTED',
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'
SET_REQUEST_ACCOUNT_TABS: 'SET_REQUEST_ACCOUNT_TABS', export const SET_OPEN_METAMASK_TAB_IDS = 'SET_OPEN_METAMASK_TAB_IDS'
SET_CURRENT_WINDOW_TAB: 'SET_CURRENT_WINDOW_TAB',
SET_OPEN_METAMASK_TAB_IDS: 'SET_OPEN_METAMASK_TAB_IDS',
}

@ -14,7 +14,7 @@ import { hasUnconfirmedTransactions } from '../helpers/utils/confirm-tx.util'
import { setCustomGasLimit } from '../ducks/gas/gas.duck' import { setCustomGasLimit } from '../ducks/gas/gas.duck'
import txHelper from '../../lib/tx-helper' import txHelper from '../../lib/tx-helper'
import { getEnvironmentType } from '../../../app/scripts/lib/util' import { getEnvironmentType } from '../../../app/scripts/lib/util'
import actionConstants from './actionConstants' import * as actionConstants from './actionConstants'
import { import {
getPermittedAccountsForCurrentTab, getPermittedAccountsForCurrentTab,
getSelectedAddress, getSelectedAddress,

Loading…
Cancel
Save