mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Further improve organization of constants (#10200)
This commit is contained in:
parent
a3de54d86d
commit
90289ec22a
@ -19,6 +19,12 @@ import extension from 'extensionizer'
|
|||||||
import { storeAsStream, storeTransformStream } from '@metamask/obs-store'
|
import { storeAsStream, storeTransformStream } from '@metamask/obs-store'
|
||||||
import PortStream from 'extension-port-stream'
|
import PortStream from 'extension-port-stream'
|
||||||
import { captureException } from '@sentry/browser'
|
import { captureException } from '@sentry/browser'
|
||||||
|
|
||||||
|
import {
|
||||||
|
ENVIRONMENT_TYPE_POPUP,
|
||||||
|
ENVIRONMENT_TYPE_NOTIFICATION,
|
||||||
|
ENVIRONMENT_TYPE_FULLSCREEN,
|
||||||
|
} from '../../shared/constants/app'
|
||||||
import migrations from './migrations'
|
import migrations from './migrations'
|
||||||
import Migrator from './lib/migrator'
|
import Migrator from './lib/migrator'
|
||||||
import ExtensionPlatform from './platforms/extension'
|
import ExtensionPlatform from './platforms/extension'
|
||||||
@ -31,12 +37,6 @@ import rawFirstTimeState from './first-time-state'
|
|||||||
import getFirstPreferredLangCode from './lib/get-first-preferred-lang-code'
|
import getFirstPreferredLangCode from './lib/get-first-preferred-lang-code'
|
||||||
import getObjStructure from './lib/getObjStructure'
|
import getObjStructure from './lib/getObjStructure'
|
||||||
import setupEnsIpfsResolver from './lib/ens-ipfs/setup'
|
import setupEnsIpfsResolver from './lib/ens-ipfs/setup'
|
||||||
|
|
||||||
import {
|
|
||||||
ENVIRONMENT_TYPE_POPUP,
|
|
||||||
ENVIRONMENT_TYPE_NOTIFICATION,
|
|
||||||
ENVIRONMENT_TYPE_FULLSCREEN,
|
|
||||||
} from './lib/enums'
|
|
||||||
/* eslint-enable import/first */
|
/* eslint-enable import/first */
|
||||||
|
|
||||||
const { sentry } = global
|
const { sentry } = global
|
||||||
|
@ -2,12 +2,11 @@ import Web3 from 'web3'
|
|||||||
import contracts from '@metamask/contract-metadata'
|
import contracts from '@metamask/contract-metadata'
|
||||||
import { warn } from 'loglevel'
|
import { warn } from 'loglevel'
|
||||||
import SINGLE_CALL_BALANCES_ABI from 'single-call-balance-checker-abi'
|
import SINGLE_CALL_BALANCES_ABI from 'single-call-balance-checker-abi'
|
||||||
import { MAINNET_CHAIN_ID } from './network/enums'
|
import { MAINNET_CHAIN_ID } from '../../../shared/constants/network'
|
||||||
|
import { SINGLE_CALL_BALANCES_ADDRESS } from '../constants/contracts'
|
||||||
|
|
||||||
// By default, poll every 3 minutes
|
// By default, poll every 3 minutes
|
||||||
const DEFAULT_INTERVAL = 180 * 1000
|
const DEFAULT_INTERVAL = 180 * 1000
|
||||||
const SINGLE_CALL_BALANCES_ADDRESS =
|
|
||||||
'0xb1f8e55c7f64d203c1400b9d8555d050f94adf39'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A controller that polls for token exchange
|
* A controller that polls for token exchange
|
||||||
|
@ -22,7 +22,7 @@ import {
|
|||||||
RINKEBY_CHAIN_ID,
|
RINKEBY_CHAIN_ID,
|
||||||
ROPSTEN,
|
ROPSTEN,
|
||||||
ROPSTEN_CHAIN_ID,
|
ROPSTEN_CHAIN_ID,
|
||||||
} from './network/enums'
|
} from '../../../shared/constants/network'
|
||||||
|
|
||||||
const fetchWithTimeout = getFetchWithTimeout(30000)
|
const fetchWithTimeout = getFetchWithTimeout(30000)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { merge, omit } from 'lodash'
|
import { merge, omit } from 'lodash'
|
||||||
import { ObservableStore } from '@metamask/obs-store'
|
import { ObservableStore } from '@metamask/obs-store'
|
||||||
import { bufferToHex, sha3 } from 'ethereumjs-util'
|
import { bufferToHex, sha3 } from 'ethereumjs-util'
|
||||||
import { ENVIRONMENT_TYPE_BACKGROUND } from '../lib/enums'
|
import { ENVIRONMENT_TYPE_BACKGROUND } from '../../../shared/constants/app'
|
||||||
import {
|
import {
|
||||||
METAMETRICS_ANONYMOUS_ID,
|
METAMETRICS_ANONYMOUS_ID,
|
||||||
METAMETRICS_BACKGROUND_PAGE_OBJECT,
|
METAMETRICS_BACKGROUND_PAGE_OBJECT,
|
||||||
|
@ -8,7 +8,7 @@ import providerFromMiddleware from 'eth-json-rpc-middleware/providerFromMiddlewa
|
|||||||
import createInfuraMiddleware from 'eth-json-rpc-infura'
|
import createInfuraMiddleware from 'eth-json-rpc-infura'
|
||||||
import BlockTracker from 'eth-block-tracker'
|
import BlockTracker from 'eth-block-tracker'
|
||||||
|
|
||||||
import { NETWORK_TYPE_TO_ID_MAP } from './enums'
|
import { NETWORK_TYPE_TO_ID_MAP } from '../../../../shared/constants/network'
|
||||||
|
|
||||||
export default function createInfuraClient({ network, projectId }) {
|
export default function createInfuraClient({ network, projectId }) {
|
||||||
const infuraMiddleware = createInfuraMiddleware({
|
const infuraMiddleware = createInfuraMiddleware({
|
||||||
|
@ -9,10 +9,6 @@ import {
|
|||||||
createEventEmitterProxy,
|
createEventEmitterProxy,
|
||||||
} from 'swappable-obj-proxy'
|
} from 'swappable-obj-proxy'
|
||||||
import EthQuery from 'eth-query'
|
import EthQuery from 'eth-query'
|
||||||
import createMetamaskMiddleware from './createMetamaskMiddleware'
|
|
||||||
import createInfuraClient from './createInfuraClient'
|
|
||||||
import createJsonRpcClient from './createJsonRpcClient'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
RINKEBY,
|
RINKEBY,
|
||||||
MAINNET,
|
MAINNET,
|
||||||
@ -20,7 +16,10 @@ import {
|
|||||||
NETWORK_TYPE_TO_ID_MAP,
|
NETWORK_TYPE_TO_ID_MAP,
|
||||||
MAINNET_CHAIN_ID,
|
MAINNET_CHAIN_ID,
|
||||||
RINKEBY_CHAIN_ID,
|
RINKEBY_CHAIN_ID,
|
||||||
} from './enums'
|
} from '../../../../shared/constants/network'
|
||||||
|
import createMetamaskMiddleware from './createMetamaskMiddleware'
|
||||||
|
import createInfuraClient from './createInfuraClient'
|
||||||
|
import createJsonRpcClient from './createJsonRpcClient'
|
||||||
|
|
||||||
const env = process.env.METAMASK_ENV
|
const env = process.env.METAMASK_ENV
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { NETWORK_TO_NAME_MAP } from './enums'
|
import { NETWORK_TO_NAME_MAP } from '../../../../shared/constants/network'
|
||||||
|
|
||||||
export const getNetworkDisplayName = (key) => NETWORK_TO_NAME_MAP[key]
|
export const getNetworkDisplayName = (key) => NETWORK_TO_NAME_MAP[key]
|
||||||
|
|
||||||
|
@ -10,11 +10,6 @@ export const METADATA_STORE_KEY = 'domainMetadata'
|
|||||||
|
|
||||||
export const METADATA_CACHE_MAX_SIZE = 100
|
export const METADATA_CACHE_MAX_SIZE = 100
|
||||||
|
|
||||||
export const CAVEAT_NAMES = {
|
|
||||||
exposedAccounts: 'exposedAccounts',
|
|
||||||
primaryAccountOnly: 'primaryAccountOnly',
|
|
||||||
}
|
|
||||||
|
|
||||||
export const CAVEAT_TYPES = {
|
export const CAVEAT_TYPES = {
|
||||||
limitResponseLength: 'limitResponseLength',
|
limitResponseLength: 'limitResponseLength',
|
||||||
filterResponse: 'filterResponse',
|
filterResponse: 'filterResponse',
|
||||||
|
@ -6,10 +6,7 @@ import { CapabilitiesController as RpcCap } from 'rpc-cap'
|
|||||||
import { ethErrors } from 'eth-json-rpc-errors'
|
import { ethErrors } from 'eth-json-rpc-errors'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
import createPermissionsMethodMiddleware from './permissionsMethodMiddleware'
|
import { CAVEAT_NAMES } from '../../../../shared/constants/permissions'
|
||||||
import PermissionsLogController from './permissionsLog'
|
|
||||||
|
|
||||||
// Methods that do not require any permissions to use:
|
|
||||||
import {
|
import {
|
||||||
APPROVAL_TYPE,
|
APPROVAL_TYPE,
|
||||||
SAFE_METHODS, // methods that do not require any permissions to use
|
SAFE_METHODS, // methods that do not require any permissions to use
|
||||||
@ -18,11 +15,13 @@ import {
|
|||||||
METADATA_CACHE_MAX_SIZE,
|
METADATA_CACHE_MAX_SIZE,
|
||||||
LOG_STORE_KEY,
|
LOG_STORE_KEY,
|
||||||
HISTORY_STORE_KEY,
|
HISTORY_STORE_KEY,
|
||||||
CAVEAT_NAMES,
|
|
||||||
NOTIFICATION_NAMES,
|
NOTIFICATION_NAMES,
|
||||||
CAVEAT_TYPES,
|
CAVEAT_TYPES,
|
||||||
} from './enums'
|
} from './enums'
|
||||||
|
|
||||||
|
import createPermissionsMethodMiddleware from './permissionsMethodMiddleware'
|
||||||
|
import PermissionsLogController from './permissionsLog'
|
||||||
|
|
||||||
// instanbul ignore next
|
// instanbul ignore next
|
||||||
const noop = () => undefined
|
const noop = () => undefined
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
|
import { CAVEAT_NAMES } from '../../../../shared/constants/permissions'
|
||||||
import {
|
import {
|
||||||
CAVEAT_NAMES,
|
|
||||||
HISTORY_STORE_KEY,
|
HISTORY_STORE_KEY,
|
||||||
LOG_IGNORE_METHODS,
|
LOG_IGNORE_METHODS,
|
||||||
LOG_LIMIT,
|
LOG_LIMIT,
|
||||||
|
@ -7,7 +7,7 @@ import ethers from 'ethers'
|
|||||||
import log from 'loglevel'
|
import log from 'loglevel'
|
||||||
import { isPrefixedFormattedHexString } from '../lib/util'
|
import { isPrefixedFormattedHexString } from '../lib/util'
|
||||||
import { LISTED_CONTRACT_ADDRESSES } from '../../../shared/constants/tokens'
|
import { LISTED_CONTRACT_ADDRESSES } from '../../../shared/constants/tokens'
|
||||||
import { NETWORK_TYPE_TO_ID_MAP } from './network/enums'
|
import { NETWORK_TYPE_TO_ID_MAP } from '../../../shared/constants/network'
|
||||||
|
|
||||||
export default class PreferencesController {
|
export default class PreferencesController {
|
||||||
/**
|
/**
|
||||||
|
@ -19,14 +19,14 @@ import {
|
|||||||
RINKEBY_CHAIN_ID,
|
RINKEBY_CHAIN_ID,
|
||||||
ROPSTEN_CHAIN_ID,
|
ROPSTEN_CHAIN_ID,
|
||||||
KOVAN_CHAIN_ID,
|
KOVAN_CHAIN_ID,
|
||||||
} from '../controllers/network/enums'
|
} from '../../../shared/constants/network'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
SINGLE_CALL_BALANCES_ADDRESS,
|
SINGLE_CALL_BALANCES_ADDRESS,
|
||||||
SINGLE_CALL_BALANCES_ADDRESS_RINKEBY,
|
SINGLE_CALL_BALANCES_ADDRESS_RINKEBY,
|
||||||
SINGLE_CALL_BALANCES_ADDRESS_ROPSTEN,
|
SINGLE_CALL_BALANCES_ADDRESS_ROPSTEN,
|
||||||
SINGLE_CALL_BALANCES_ADDRESS_KOVAN,
|
SINGLE_CALL_BALANCES_ADDRESS_KOVAN,
|
||||||
} from '../controllers/network/contract-addresses'
|
} from '../constants/contracts'
|
||||||
import { bnToHex } from './util'
|
import { bnToHex } from './util'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,9 +3,9 @@ import { ObservableStore } from '@metamask/obs-store'
|
|||||||
import ethUtil from 'ethereumjs-util'
|
import ethUtil from 'ethereumjs-util'
|
||||||
import { ethErrors } from 'eth-json-rpc-errors'
|
import { ethErrors } from 'eth-json-rpc-errors'
|
||||||
import log from 'loglevel'
|
import log from 'loglevel'
|
||||||
|
import { MESSAGE_TYPE } from '../../../shared/constants/app'
|
||||||
import { addHexPrefix } from './util'
|
import { addHexPrefix } from './util'
|
||||||
import createId from './random-id'
|
import createId from './random-id'
|
||||||
import { MESSAGE_TYPE } from './enums'
|
|
||||||
|
|
||||||
const hexRe = /^[0-9A-Fa-f]+$/gu
|
const hexRe = /^[0-9A-Fa-f]+$/gu
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@ import EventEmitter from 'events'
|
|||||||
import { ObservableStore } from '@metamask/obs-store'
|
import { ObservableStore } from '@metamask/obs-store'
|
||||||
import { ethErrors } from 'eth-json-rpc-errors'
|
import { ethErrors } from 'eth-json-rpc-errors'
|
||||||
import log from 'loglevel'
|
import log from 'loglevel'
|
||||||
|
import { MESSAGE_TYPE } from '../../../shared/constants/app'
|
||||||
import createId from './random-id'
|
import createId from './random-id'
|
||||||
import { MESSAGE_TYPE } from './enums'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents, and contains data about, an 'eth_getEncryptionPublicKey' type request. These are created when
|
* Represents, and contains data about, an 'eth_getEncryptionPublicKey' type request. These are created when
|
||||||
|
@ -2,8 +2,8 @@ import EventEmitter from 'events'
|
|||||||
import { ObservableStore } from '@metamask/obs-store'
|
import { ObservableStore } from '@metamask/obs-store'
|
||||||
import ethUtil from 'ethereumjs-util'
|
import ethUtil from 'ethereumjs-util'
|
||||||
import { ethErrors } from 'eth-json-rpc-errors'
|
import { ethErrors } from 'eth-json-rpc-errors'
|
||||||
|
import { MESSAGE_TYPE } from '../../../shared/constants/app'
|
||||||
import createId from './random-id'
|
import createId from './random-id'
|
||||||
import { MESSAGE_TYPE } from './enums'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents, and contains data about, an 'eth_sign' type signature request. These are created when a signature for
|
* Represents, and contains data about, an 'eth_sign' type signature request. These are created when a signature for
|
||||||
|
@ -3,9 +3,9 @@ import { ObservableStore } from '@metamask/obs-store'
|
|||||||
import ethUtil from 'ethereumjs-util'
|
import ethUtil from 'ethereumjs-util'
|
||||||
import { ethErrors } from 'eth-json-rpc-errors'
|
import { ethErrors } from 'eth-json-rpc-errors'
|
||||||
import log from 'loglevel'
|
import log from 'loglevel'
|
||||||
|
import { MESSAGE_TYPE } from '../../../shared/constants/app'
|
||||||
import { addHexPrefix } from './util'
|
import { addHexPrefix } from './util'
|
||||||
import createId from './random-id'
|
import createId from './random-id'
|
||||||
import { MESSAGE_TYPE } from './enums'
|
|
||||||
|
|
||||||
const hexRe = /^[0-9A-Fa-f]+$/gu
|
const hexRe = /^[0-9A-Fa-f]+$/gu
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { MESSAGE_TYPE } from '../../enums'
|
import { MESSAGE_TYPE } from '../../../../../shared/constants/app'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This RPC method gets background state relevant to the provider.
|
* This RPC method gets background state relevant to the provider.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { MESSAGE_TYPE } from '../../enums'
|
import { MESSAGE_TYPE } from '../../../../../shared/constants/app'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This RPC method is called by the inpage provider whenever it detects the
|
* This RPC method is called by the inpage provider whenever it detects the
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { MESSAGE_TYPE } from '../../enums'
|
import { MESSAGE_TYPE } from '../../../../../shared/constants/app'
|
||||||
|
|
||||||
const watchAsset = {
|
const watchAsset = {
|
||||||
methodNames: [MESSAGE_TYPE.WATCH_ASSET, MESSAGE_TYPE.WATCH_ASSET_LEGACY],
|
methodNames: [MESSAGE_TYPE.WATCH_ASSET, MESSAGE_TYPE.WATCH_ASSET_LEGACY],
|
||||||
|
@ -6,8 +6,8 @@ import { typedSignatureHash, TYPED_MESSAGE_SCHEMA } from 'eth-sig-util'
|
|||||||
import { isValidAddress } from 'ethereumjs-util'
|
import { isValidAddress } from 'ethereumjs-util'
|
||||||
import log from 'loglevel'
|
import log from 'loglevel'
|
||||||
import jsonschema from 'jsonschema'
|
import jsonschema from 'jsonschema'
|
||||||
|
import { MESSAGE_TYPE } from '../../../shared/constants/app'
|
||||||
import createId from './random-id'
|
import createId from './random-id'
|
||||||
import { MESSAGE_TYPE } from './enums'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents, and contains data about, an 'eth_signTypedData' type signature request. These are created when a
|
* Represents, and contains data about, an 'eth_signTypedData' type signature request. These are created when a
|
||||||
|
@ -14,7 +14,7 @@ import {
|
|||||||
PLATFORM_CHROME,
|
PLATFORM_CHROME,
|
||||||
PLATFORM_EDGE,
|
PLATFORM_EDGE,
|
||||||
PLATFORM_BRAVE,
|
PLATFORM_BRAVE,
|
||||||
} from './enums'
|
} from '../../../shared/constants/app'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see {@link getEnvironmentType}
|
* @see {@link getEnvironmentType}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import { NETWORK_TYPE_TO_ID_MAP } from '../controllers/network/enums'
|
import { NETWORK_TYPE_TO_ID_MAP } from '../../../shared/constants/network'
|
||||||
|
|
||||||
const version = 51
|
const version = 51
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import extension from 'extensionizer'
|
import extension from 'extensionizer'
|
||||||
import { createExplorerLink as explorerLink } from '@metamask/etherscan-link'
|
import { createExplorerLink as explorerLink } from '@metamask/etherscan-link'
|
||||||
import { getEnvironmentType, checkForError } from '../lib/util'
|
import { getEnvironmentType, checkForError } from '../lib/util'
|
||||||
import { ENVIRONMENT_TYPE_BACKGROUND } from '../lib/enums'
|
import { ENVIRONMENT_TYPE_BACKGROUND } from '../../../shared/constants/app'
|
||||||
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction'
|
import { TRANSACTION_STATUSES } from '../../../shared/constants/transaction'
|
||||||
|
|
||||||
export default class ExtensionPlatform {
|
export default class ExtensionPlatform {
|
||||||
|
@ -12,12 +12,12 @@ import EthQuery from 'eth-query'
|
|||||||
import StreamProvider from 'web3-stream-provider'
|
import StreamProvider from 'web3-stream-provider'
|
||||||
import log from 'loglevel'
|
import log from 'loglevel'
|
||||||
import launchMetaMaskUi from '../../ui'
|
import launchMetaMaskUi from '../../ui'
|
||||||
import ExtensionPlatform from './platforms/extension'
|
|
||||||
import { setupMultiplex } from './lib/stream-utils'
|
|
||||||
import {
|
import {
|
||||||
ENVIRONMENT_TYPE_FULLSCREEN,
|
ENVIRONMENT_TYPE_FULLSCREEN,
|
||||||
ENVIRONMENT_TYPE_POPUP,
|
ENVIRONMENT_TYPE_POPUP,
|
||||||
} from './lib/enums'
|
} from '../../shared/constants/app'
|
||||||
|
import ExtensionPlatform from './platforms/extension'
|
||||||
|
import { setupMultiplex } from './lib/stream-utils'
|
||||||
import { getEnvironmentType } from './lib/util'
|
import { getEnvironmentType } from './lib/util'
|
||||||
|
|
||||||
start().catch(log.error)
|
start().catch(log.error)
|
||||||
|
@ -6,19 +6,18 @@
|
|||||||
* background - The background process that powers the extension
|
* background - The background process that powers the extension
|
||||||
* @typedef {'popup' | 'notification' | 'fullscreen' | 'background'} EnvironmentType
|
* @typedef {'popup' | 'notification' | 'fullscreen' | 'background'} EnvironmentType
|
||||||
*/
|
*/
|
||||||
|
export const ENVIRONMENT_TYPE_POPUP = 'popup'
|
||||||
|
export const ENVIRONMENT_TYPE_NOTIFICATION = 'notification'
|
||||||
|
export const ENVIRONMENT_TYPE_FULLSCREEN = 'fullscreen'
|
||||||
|
export const ENVIRONMENT_TYPE_BACKGROUND = 'background'
|
||||||
|
|
||||||
const ENVIRONMENT_TYPE_POPUP = 'popup'
|
export const PLATFORM_BRAVE = 'Brave'
|
||||||
const ENVIRONMENT_TYPE_NOTIFICATION = 'notification'
|
export const PLATFORM_CHROME = 'Chrome'
|
||||||
const ENVIRONMENT_TYPE_FULLSCREEN = 'fullscreen'
|
export const PLATFORM_EDGE = 'Edge'
|
||||||
const ENVIRONMENT_TYPE_BACKGROUND = 'background'
|
export const PLATFORM_FIREFOX = 'Firefox'
|
||||||
|
export const PLATFORM_OPERA = 'Opera'
|
||||||
|
|
||||||
const PLATFORM_BRAVE = 'Brave'
|
export const MESSAGE_TYPE = {
|
||||||
const PLATFORM_CHROME = 'Chrome'
|
|
||||||
const PLATFORM_EDGE = 'Edge'
|
|
||||||
const PLATFORM_FIREFOX = 'Firefox'
|
|
||||||
const PLATFORM_OPERA = 'Opera'
|
|
||||||
|
|
||||||
const MESSAGE_TYPE = {
|
|
||||||
ETH_DECRYPT: 'eth_decrypt',
|
ETH_DECRYPT: 'eth_decrypt',
|
||||||
ETH_GET_ENCRYPTION_PUBLIC_KEY: 'eth_getEncryptionPublicKey',
|
ETH_GET_ENCRYPTION_PUBLIC_KEY: 'eth_getEncryptionPublicKey',
|
||||||
ETH_SIGN: 'eth_sign',
|
ETH_SIGN: 'eth_sign',
|
||||||
@ -29,16 +28,3 @@ const MESSAGE_TYPE = {
|
|||||||
WATCH_ASSET: 'wallet_watchAsset',
|
WATCH_ASSET: 'wallet_watchAsset',
|
||||||
WATCH_ASSET_LEGACY: 'metamask_watchAsset',
|
WATCH_ASSET_LEGACY: 'metamask_watchAsset',
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
|
||||||
ENVIRONMENT_TYPE_POPUP,
|
|
||||||
ENVIRONMENT_TYPE_NOTIFICATION,
|
|
||||||
ENVIRONMENT_TYPE_FULLSCREEN,
|
|
||||||
ENVIRONMENT_TYPE_BACKGROUND,
|
|
||||||
MESSAGE_TYPE,
|
|
||||||
PLATFORM_BRAVE,
|
|
||||||
PLATFORM_CHROME,
|
|
||||||
PLATFORM_EDGE,
|
|
||||||
PLATFORM_FIREFOX,
|
|
||||||
PLATFORM_OPERA,
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
// Type Imports
|
// Type Imports
|
||||||
/**
|
/**
|
||||||
* @typedef {import('../../app/scripts/lib/enums').EnvironmentType} EnvironmentType
|
* @typedef {import('../../shared/constants/app').EnvironmentType} EnvironmentType
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Type Declarations
|
// Type Declarations
|
||||||
|
4
shared/constants/permissions.js
Normal file
4
shared/constants/permissions.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export const CAVEAT_NAMES = {
|
||||||
|
exposedAccounts: 'exposedAccounts',
|
||||||
|
primaryAccountOnly: 'primaryAccountOnly',
|
||||||
|
}
|
@ -7,10 +7,7 @@ import BigNumber from 'bignumber.js'
|
|||||||
import DetectTokensController from '../../../../app/scripts/controllers/detect-tokens'
|
import DetectTokensController from '../../../../app/scripts/controllers/detect-tokens'
|
||||||
import NetworkController from '../../../../app/scripts/controllers/network/network'
|
import NetworkController from '../../../../app/scripts/controllers/network/network'
|
||||||
import PreferencesController from '../../../../app/scripts/controllers/preferences'
|
import PreferencesController from '../../../../app/scripts/controllers/preferences'
|
||||||
import {
|
import { MAINNET, ROPSTEN } from '../../../../shared/constants/network'
|
||||||
MAINNET,
|
|
||||||
ROPSTEN,
|
|
||||||
} from '../../../../app/scripts/controllers/network/enums'
|
|
||||||
|
|
||||||
describe('DetectTokensController', function () {
|
describe('DetectTokensController', function () {
|
||||||
const sandbox = sinon.createSandbox()
|
const sandbox = sinon.createSandbox()
|
||||||
|
@ -14,7 +14,7 @@ import {
|
|||||||
ROPSTEN,
|
ROPSTEN,
|
||||||
ROPSTEN_CHAIN_ID,
|
ROPSTEN_CHAIN_ID,
|
||||||
ROPSTEN_NETWORK_ID,
|
ROPSTEN_NETWORK_ID,
|
||||||
} from '../../../../app/scripts/controllers/network/enums'
|
} from '../../../../shared/constants/network'
|
||||||
import {
|
import {
|
||||||
TRANSACTION_CATEGORIES,
|
TRANSACTION_CATEGORIES,
|
||||||
TRANSACTION_STATUSES,
|
TRANSACTION_STATUSES,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { strict as assert } from 'assert'
|
import { strict as assert } from 'assert'
|
||||||
import sinon from 'sinon'
|
import sinon from 'sinon'
|
||||||
import MetaMetricsController from '../../../../app/scripts/controllers/metametrics'
|
import MetaMetricsController from '../../../../app/scripts/controllers/metametrics'
|
||||||
import { ENVIRONMENT_TYPE_BACKGROUND } from '../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_BACKGROUND } from '../../../../shared/constants/app'
|
||||||
import { createSegmentMock } from '../../../../app/scripts/lib/segment'
|
import { createSegmentMock } from '../../../../app/scripts/lib/segment'
|
||||||
import {
|
import {
|
||||||
METAMETRICS_ANONYMOUS_ID,
|
METAMETRICS_ANONYMOUS_ID,
|
||||||
|
@ -5,8 +5,8 @@ import { ApprovalController } from '@metamask/controllers'
|
|||||||
|
|
||||||
import _getRestrictedMethods from '../../../../../app/scripts/controllers/permissions/restrictedMethods'
|
import _getRestrictedMethods from '../../../../../app/scripts/controllers/permissions/restrictedMethods'
|
||||||
|
|
||||||
|
import { CAVEAT_NAMES } from '../../../../../shared/constants/permissions'
|
||||||
import {
|
import {
|
||||||
CAVEAT_NAMES,
|
|
||||||
CAVEAT_TYPES,
|
CAVEAT_TYPES,
|
||||||
NOTIFICATION_NAMES,
|
NOTIFICATION_NAMES,
|
||||||
} from '../../../../../app/scripts/controllers/permissions/enums'
|
} from '../../../../../app/scripts/controllers/permissions/enums'
|
||||||
|
@ -8,7 +8,7 @@ import { ObservableStore } from '@metamask/obs-store'
|
|||||||
import {
|
import {
|
||||||
ROPSTEN_NETWORK_ID,
|
ROPSTEN_NETWORK_ID,
|
||||||
MAINNET_NETWORK_ID,
|
MAINNET_NETWORK_ID,
|
||||||
} from '../../../../app/scripts/controllers/network/enums'
|
} from '../../../../shared/constants/network'
|
||||||
import { ETH_SWAPS_TOKEN_ADDRESS } from '../../../../ui/app/helpers/constants/swaps'
|
import { ETH_SWAPS_TOKEN_ADDRESS } from '../../../../ui/app/helpers/constants/swaps'
|
||||||
import { createTestProviderTools } from '../../../stub/provider'
|
import { createTestProviderTools } from '../../../stub/provider'
|
||||||
import SwapsController, {
|
import SwapsController, {
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
ENVIRONMENT_TYPE_NOTIFICATION,
|
ENVIRONMENT_TYPE_NOTIFICATION,
|
||||||
ENVIRONMENT_TYPE_FULLSCREEN,
|
ENVIRONMENT_TYPE_FULLSCREEN,
|
||||||
ENVIRONMENT_TYPE_BACKGROUND,
|
ENVIRONMENT_TYPE_BACKGROUND,
|
||||||
} from '../../../app/scripts/lib/enums'
|
} from '../../../shared/constants/app'
|
||||||
|
|
||||||
describe('app utils', function () {
|
describe('app utils', function () {
|
||||||
describe('getEnvironmentType', function () {
|
describe('getEnvironmentType', function () {
|
||||||
|
@ -3,7 +3,7 @@ import migration51 from '../../../app/scripts/migrations/051'
|
|||||||
import {
|
import {
|
||||||
INFURA_PROVIDER_TYPES,
|
INFURA_PROVIDER_TYPES,
|
||||||
NETWORK_TYPE_TO_ID_MAP,
|
NETWORK_TYPE_TO_ID_MAP,
|
||||||
} from '../../../app/scripts/controllers/network/enums'
|
} from '../../../shared/constants/network'
|
||||||
|
|
||||||
describe('migration #51', function () {
|
describe('migration #51', function () {
|
||||||
it('should update the version metadata', async function () {
|
it('should update the version metadata', async function () {
|
||||||
|
@ -4,7 +4,7 @@ import { debounce } from 'lodash'
|
|||||||
import Fuse from 'fuse.js'
|
import Fuse from 'fuse.js'
|
||||||
import InputAdornment from '@material-ui/core/InputAdornment'
|
import InputAdornment from '@material-ui/core/InputAdornment'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import { ENVIRONMENT_TYPE_POPUP } from '../../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_POPUP } from '../../../../../shared/constants/app'
|
||||||
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
|
||||||
import Identicon from '../../ui/identicon'
|
import Identicon from '../../ui/identicon'
|
||||||
import SiteIcon from '../../ui/site-icon'
|
import SiteIcon from '../../ui/site-icon'
|
||||||
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
|
|||||||
import {
|
import {
|
||||||
ENVIRONMENT_TYPE_POPUP,
|
ENVIRONMENT_TYPE_POPUP,
|
||||||
ENVIRONMENT_TYPE_NOTIFICATION,
|
ENVIRONMENT_TYPE_NOTIFICATION,
|
||||||
} from '../../../../../../app/scripts/lib/enums'
|
} from '../../../../../../shared/constants/app'
|
||||||
import { getEnvironmentType } from '../../../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../../../app/scripts/lib/util'
|
||||||
import NetworkDisplay from '../../network-display'
|
import NetworkDisplay from '../../network-display'
|
||||||
import Identicon from '../../../ui/identicon'
|
import Identicon from '../../../ui/identicon'
|
||||||
|
@ -9,7 +9,7 @@ import {
|
|||||||
NETWORKS_ROUTE,
|
NETWORKS_ROUTE,
|
||||||
NETWORKS_FORM_ROUTE,
|
NETWORKS_FORM_ROUTE,
|
||||||
} from '../../../helpers/constants/routes'
|
} from '../../../helpers/constants/routes'
|
||||||
import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../../shared/constants/app'
|
||||||
import {
|
import {
|
||||||
getEnvironmentType,
|
getEnvironmentType,
|
||||||
isPrefixedFormattedHexString,
|
isPrefixedFormattedHexString,
|
||||||
|
@ -16,7 +16,7 @@ import {
|
|||||||
import { useI18nContext } from '../../../hooks/useI18nContext'
|
import { useI18nContext } from '../../../hooks/useI18nContext'
|
||||||
import { useMetricEvent } from '../../../hooks/useMetricEvent'
|
import { useMetricEvent } from '../../../hooks/useMetricEvent'
|
||||||
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
|
||||||
import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../../shared/constants/app'
|
||||||
|
|
||||||
export default function AccountOptionsMenu({ anchorElement, onClose }) {
|
export default function AccountOptionsMenu({ anchorElement, onClose }) {
|
||||||
const t = useI18nContext()
|
const t = useI18nContext()
|
||||||
|
@ -5,7 +5,7 @@ import { useSelector } from 'react-redux'
|
|||||||
import SelectedAccount from '../selected-account'
|
import SelectedAccount from '../selected-account'
|
||||||
import ConnectedStatusIndicator from '../connected-status-indicator'
|
import ConnectedStatusIndicator from '../connected-status-indicator'
|
||||||
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
|
||||||
import { ENVIRONMENT_TYPE_POPUP } from '../../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_POPUP } from '../../../../../shared/constants/app'
|
||||||
import { CONNECTED_ACCOUNTS_ROUTE } from '../../../helpers/constants/routes'
|
import { CONNECTED_ACCOUNTS_ROUTE } from '../../../helpers/constants/routes'
|
||||||
import { useI18nContext } from '../../../hooks/useI18nContext'
|
import { useI18nContext } from '../../../hooks/useI18nContext'
|
||||||
import { useMetricEvent } from '../../../hooks/useMetricEvent'
|
import { useMetricEvent } from '../../../hooks/useMetricEvent'
|
||||||
|
@ -6,7 +6,7 @@ import * as actions from '../../../store/actions'
|
|||||||
import { resetCustomData as resetCustomGasData } from '../../../ducks/gas/gas.duck'
|
import { resetCustomData as resetCustomGasData } from '../../../ducks/gas/gas.duck'
|
||||||
import isMobileView from '../../../../lib/is-mobile-view'
|
import isMobileView from '../../../../lib/is-mobile-view'
|
||||||
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
|
||||||
import { ENVIRONMENT_TYPE_POPUP } from '../../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_POPUP } from '../../../../../shared/constants/app'
|
||||||
|
|
||||||
// Modal Components
|
// Modal Components
|
||||||
import ConfirmCustomizeGasModal from '../gas-customization/gas-modal-page-container'
|
import ConfirmCustomizeGasModal from '../gas-customization/gas-modal-page-container'
|
||||||
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
|
|||||||
import log from 'loglevel'
|
import log from 'loglevel'
|
||||||
import { BrowserQRCodeReader } from '@zxing/library'
|
import { BrowserQRCodeReader } from '@zxing/library'
|
||||||
import { getEnvironmentType } from '../../../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../../../app/scripts/lib/util'
|
||||||
import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../../../shared/constants/app'
|
||||||
import Spinner from '../../../ui/spinner'
|
import Spinner from '../../../ui/spinner'
|
||||||
import WebcamUtils from '../../../../../lib/webcam-utils'
|
import WebcamUtils from '../../../../../lib/webcam-utils'
|
||||||
import PageContainerFooter from '../../../ui/page-container/page-container-footer/page-container-footer.component'
|
import PageContainerFooter from '../../../ui/page-container/page-container-footer/page-container-footer.component'
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
RINKEBY_NETWORK_ID,
|
RINKEBY_NETWORK_ID,
|
||||||
KOVAN_NETWORK_ID,
|
KOVAN_NETWORK_ID,
|
||||||
GOERLI_NETWORK_ID,
|
GOERLI_NETWORK_ID,
|
||||||
} from '../../../../../app/scripts/controllers/network/enums'
|
} from '../../../../../shared/constants/network'
|
||||||
|
|
||||||
const networkIdToTypeMap = {
|
const networkIdToTypeMap = {
|
||||||
[MAINNET_NETWORK_ID]: 'mainnet',
|
[MAINNET_NETWORK_ID]: 'mainnet',
|
||||||
|
@ -7,7 +7,7 @@ import { ObjectInspector } from 'react-inspector'
|
|||||||
import {
|
import {
|
||||||
ENVIRONMENT_TYPE_NOTIFICATION,
|
ENVIRONMENT_TYPE_NOTIFICATION,
|
||||||
MESSAGE_TYPE,
|
MESSAGE_TYPE,
|
||||||
} from '../../../../../app/scripts/lib/enums'
|
} from '../../../../../shared/constants/app'
|
||||||
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
|
||||||
import Identicon from '../../ui/identicon'
|
import Identicon from '../../ui/identicon'
|
||||||
import AccountListItem from '../account-list-item'
|
import AccountListItem from '../account-list-item'
|
||||||
|
@ -2,7 +2,7 @@ import { connect } from 'react-redux'
|
|||||||
import { compose } from 'redux'
|
import { compose } from 'redux'
|
||||||
import { withRouter } from 'react-router-dom'
|
import { withRouter } from 'react-router-dom'
|
||||||
|
|
||||||
import { MESSAGE_TYPE } from '../../../../../app/scripts/lib/enums'
|
import { MESSAGE_TYPE } from '../../../../../shared/constants/app'
|
||||||
import { goHome } from '../../../store/actions'
|
import { goHome } from '../../../store/actions'
|
||||||
import {
|
import {
|
||||||
accountsWithSendEtherInfoSelector,
|
accountsWithSendEtherInfoSelector,
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../../shared/constants/app'
|
||||||
|
|
||||||
export { ENVIRONMENT_TYPE_NOTIFICATION }
|
export { ENVIRONMENT_TYPE_NOTIFICATION }
|
||||||
|
@ -2,7 +2,7 @@ import { connect } from 'react-redux'
|
|||||||
import { clearConfirmTransaction } from '../../../ducks/confirm-transaction/confirm-transaction.duck'
|
import { clearConfirmTransaction } from '../../../ducks/confirm-transaction/confirm-transaction.duck'
|
||||||
import { accountsWithSendEtherInfoSelector } from '../../../selectors'
|
import { accountsWithSendEtherInfoSelector } from '../../../selectors'
|
||||||
import { getAccountByAddress } from '../../../helpers/utils/util'
|
import { getAccountByAddress } from '../../../helpers/utils/util'
|
||||||
import { MESSAGE_TYPE } from '../../../../../app/scripts/lib/enums'
|
import { MESSAGE_TYPE } from '../../../../../shared/constants/app'
|
||||||
import SignatureRequest from './signature-request.component'
|
import SignatureRequest from './signature-request.component'
|
||||||
|
|
||||||
function mapStateToProps(state) {
|
function mapStateToProps(state) {
|
||||||
|
@ -34,7 +34,7 @@ import {
|
|||||||
setSwapsFromToken,
|
setSwapsFromToken,
|
||||||
} from '../../../ducks/swaps/swaps'
|
} from '../../../ducks/swaps/swaps'
|
||||||
import IconButton from '../../ui/icon-button'
|
import IconButton from '../../ui/icon-button'
|
||||||
import { MAINNET_CHAIN_ID } from '../../../../../app/scripts/controllers/network/enums'
|
import { MAINNET_CHAIN_ID } from '../../../../../shared/constants/network'
|
||||||
import WalletOverview from './wallet-overview'
|
import WalletOverview from './wallet-overview'
|
||||||
|
|
||||||
const EthOverview = ({ className }) => {
|
const EthOverview = ({ className }) => {
|
||||||
|
@ -27,7 +27,7 @@ import {
|
|||||||
getCurrentKeyring,
|
getCurrentKeyring,
|
||||||
getCurrentChainId,
|
getCurrentChainId,
|
||||||
} from '../../../selectors/selectors'
|
} from '../../../selectors/selectors'
|
||||||
import { MAINNET_CHAIN_ID } from '../../../../../app/scripts/controllers/network/enums'
|
import { MAINNET_CHAIN_ID } from '../../../../../shared/constants/network'
|
||||||
|
|
||||||
import SwapIcon from '../../ui/icon/swap-icon.component'
|
import SwapIcon from '../../ui/icon/swap-icon.component'
|
||||||
import SendIcon from '../../ui/icon/overview-send-icon.component'
|
import SendIcon from '../../ui/icon/overview-send-icon.component'
|
||||||
|
@ -4,7 +4,7 @@ import Button from '../../components/ui/button'
|
|||||||
import Identicon from '../../components/ui/identicon'
|
import Identicon from '../../components/ui/identicon'
|
||||||
import TokenBalance from '../../components/ui/token-balance'
|
import TokenBalance from '../../components/ui/token-balance'
|
||||||
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
||||||
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../shared/constants/app'
|
||||||
|
|
||||||
export default class ConfirmAddSuggestedToken extends Component {
|
export default class ConfirmAddSuggestedToken extends Component {
|
||||||
static contextTypes = {
|
static contextTypes = {
|
||||||
|
@ -9,7 +9,7 @@ import Identicon from '../../components/ui/identicon'
|
|||||||
import Tooltip from '../../components/ui/tooltip'
|
import Tooltip from '../../components/ui/tooltip'
|
||||||
import Copy from '../../components/ui/icon/copy-icon.component'
|
import Copy from '../../components/ui/icon/copy-icon.component'
|
||||||
|
|
||||||
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../shared/constants/app'
|
||||||
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
||||||
import { conversionUtil } from '../../helpers/utils/conversion-util'
|
import { conversionUtil } from '../../helpers/utils/conversion-util'
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import AccountListItem from '../../components/app/account-list-item'
|
|||||||
import Button from '../../components/ui/button'
|
import Button from '../../components/ui/button'
|
||||||
import Identicon from '../../components/ui/identicon'
|
import Identicon from '../../components/ui/identicon'
|
||||||
|
|
||||||
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../shared/constants/app'
|
||||||
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
||||||
import { conversionUtil } from '../../helpers/utils/conversion-util'
|
import { conversionUtil } from '../../helpers/utils/conversion-util'
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import ethUtil from 'ethereumjs-util'
|
import ethUtil from 'ethereumjs-util'
|
||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../shared/constants/app'
|
||||||
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
||||||
import ConfirmPageContainer, {
|
import ConfirmPageContainer, {
|
||||||
ConfirmDetailRow,
|
ConfirmDetailRow,
|
||||||
|
@ -14,7 +14,7 @@ import {
|
|||||||
DECRYPT_MESSAGE_REQUEST_PATH,
|
DECRYPT_MESSAGE_REQUEST_PATH,
|
||||||
ENCRYPTION_PUBLIC_KEY_REQUEST_PATH,
|
ENCRYPTION_PUBLIC_KEY_REQUEST_PATH,
|
||||||
} from '../../helpers/constants/routes'
|
} from '../../helpers/constants/routes'
|
||||||
import { MESSAGE_TYPE } from '../../../../app/scripts/lib/enums'
|
import { MESSAGE_TYPE } from '../../../../shared/constants/app'
|
||||||
import { TRANSACTION_CATEGORIES } from '../../../../shared/constants/transaction'
|
import { TRANSACTION_CATEGORIES } from '../../../../shared/constants/transaction'
|
||||||
|
|
||||||
export default class ConfirmTransactionSwitch extends Component {
|
export default class ConfirmTransactionSwitch extends Component {
|
||||||
|
@ -10,7 +10,7 @@ import SignatureRequest from '../../components/app/signature-request'
|
|||||||
import SignatureRequestOriginal from '../../components/app/signature-request-original'
|
import SignatureRequestOriginal from '../../components/app/signature-request-original'
|
||||||
import Loading from '../../components/ui/loading-screen'
|
import Loading from '../../components/ui/loading-screen'
|
||||||
import { getMostRecentOverviewPage } from '../../ducks/history/history'
|
import { getMostRecentOverviewPage } from '../../ducks/history/history'
|
||||||
import { MESSAGE_TYPE } from '../../../../app/scripts/lib/enums'
|
import { MESSAGE_TYPE } from '../../../../shared/constants/app'
|
||||||
import { TRANSACTION_STATUSES } from '../../../../shared/constants/transaction'
|
import { TRANSACTION_STATUSES } from '../../../../shared/constants/transaction'
|
||||||
|
|
||||||
function mapStateToProps(state) {
|
function mapStateToProps(state) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { PureComponent } from 'react'
|
import React, { PureComponent } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
||||||
import { ENVIRONMENT_TYPE_POPUP } from '../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_POPUP } from '../../../../shared/constants/app'
|
||||||
|
|
||||||
class ErrorPage extends PureComponent {
|
class ErrorPage extends PureComponent {
|
||||||
static contextTypes = {
|
static contextTypes = {
|
||||||
|
@ -33,7 +33,7 @@ import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
|||||||
import {
|
import {
|
||||||
ENVIRONMENT_TYPE_NOTIFICATION,
|
ENVIRONMENT_TYPE_NOTIFICATION,
|
||||||
ENVIRONMENT_TYPE_POPUP,
|
ENVIRONMENT_TYPE_POPUP,
|
||||||
} from '../../../../app/scripts/lib/enums'
|
} from '../../../../shared/constants/app'
|
||||||
import {
|
import {
|
||||||
ALERT_TYPES,
|
ALERT_TYPES,
|
||||||
WEB3_SHIM_USAGE_ALERT_STATES,
|
WEB3_SHIM_USAGE_ALERT_STATES,
|
||||||
|
@ -2,7 +2,7 @@ import PropTypes from 'prop-types'
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { Switch, Route } from 'react-router-dom'
|
import { Switch, Route } from 'react-router-dom'
|
||||||
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
||||||
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../shared/constants/app'
|
||||||
import { DEFAULT_ROUTE } from '../../helpers/constants/routes'
|
import { DEFAULT_ROUTE } from '../../helpers/constants/routes'
|
||||||
import PermissionPageContainer from '../../components/app/permission-page-container'
|
import PermissionPageContainer from '../../components/app/permission-page-container'
|
||||||
import ChooseAccount from './choose-account'
|
import ChooseAccount from './choose-account'
|
||||||
|
@ -58,7 +58,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
ENVIRONMENT_TYPE_NOTIFICATION,
|
ENVIRONMENT_TYPE_NOTIFICATION,
|
||||||
ENVIRONMENT_TYPE_POPUP,
|
ENVIRONMENT_TYPE_POPUP,
|
||||||
} from '../../../../app/scripts/lib/enums'
|
} from '../../../../shared/constants/app'
|
||||||
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
||||||
import { TRANSACTION_STATUSES } from '../../../../shared/constants/transaction'
|
import { TRANSACTION_STATUSES } from '../../../../shared/constants/transaction'
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import {
|
|||||||
isValidAddress,
|
isValidAddress,
|
||||||
isValidAddressHead,
|
isValidAddressHead,
|
||||||
} from '../../../../helpers/utils/util'
|
} from '../../../../helpers/utils/util'
|
||||||
import { MAINNET_NETWORK_ID } from '../../../../../../app/scripts/controllers/network/enums'
|
import { MAINNET_NETWORK_ID } from '../../../../../../shared/constants/network'
|
||||||
|
|
||||||
// Local Constants
|
// Local Constants
|
||||||
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
|
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
|
||||||
|
@ -2,7 +2,7 @@ import { compose } from 'redux'
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { withRouter } from 'react-router-dom'
|
import { withRouter } from 'react-router-dom'
|
||||||
import { getAddressBook } from '../../../selectors'
|
import { getAddressBook } from '../../../selectors'
|
||||||
import { ENVIRONMENT_TYPE_POPUP } from '../../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_POPUP } from '../../../../../shared/constants/app'
|
||||||
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -9,7 +9,7 @@ import {
|
|||||||
RINKEBY_CHAIN_ID,
|
RINKEBY_CHAIN_ID,
|
||||||
ROPSTEN,
|
ROPSTEN,
|
||||||
ROPSTEN_CHAIN_ID,
|
ROPSTEN_CHAIN_ID,
|
||||||
} from '../../../../../app/scripts/controllers/network/enums'
|
} from '../../../../../shared/constants/network'
|
||||||
|
|
||||||
const defaultNetworksData = [
|
const defaultNetworksData = [
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
showModal,
|
showModal,
|
||||||
} from '../../../store/actions'
|
} from '../../../store/actions'
|
||||||
import { NETWORKS_FORM_ROUTE } from '../../../helpers/constants/routes'
|
import { NETWORKS_FORM_ROUTE } from '../../../helpers/constants/routes'
|
||||||
import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../../shared/constants/app'
|
||||||
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
|
||||||
import NetworksTab from './networks-tab.component'
|
import NetworksTab from './networks-tab.component'
|
||||||
import { defaultNetworksData } from './networks-tab.constants'
|
import { defaultNetworksData } from './networks-tab.constants'
|
||||||
|
@ -3,7 +3,7 @@ import { connect } from 'react-redux'
|
|||||||
import { withRouter } from 'react-router-dom'
|
import { withRouter } from 'react-router-dom'
|
||||||
import { getAddressBookEntryName } from '../../selectors'
|
import { getAddressBookEntryName } from '../../selectors'
|
||||||
import { isValidAddress } from '../../helpers/utils/util'
|
import { isValidAddress } from '../../helpers/utils/util'
|
||||||
import { ENVIRONMENT_TYPE_POPUP } from '../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_POPUP } from '../../../../shared/constants/app'
|
||||||
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
||||||
import { getMostRecentOverviewPage } from '../../ducks/history/history'
|
import { getMostRecentOverviewPage } from '../../ducks/history/history'
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ import {
|
|||||||
SWAP_FAILED_ERROR,
|
SWAP_FAILED_ERROR,
|
||||||
OFFLINE_FOR_MAINTENANCE,
|
OFFLINE_FOR_MAINTENANCE,
|
||||||
} from '../../helpers/constants/swaps'
|
} from '../../helpers/constants/swaps'
|
||||||
import { MAINNET_CHAIN_ID } from '../../../../app/scripts/controllers/network/enums'
|
import { MAINNET_CHAIN_ID } from '../../../../shared/constants/network'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
resetBackgroundSwapsState,
|
resetBackgroundSwapsState,
|
||||||
|
@ -2,7 +2,7 @@ import { connect } from 'react-redux'
|
|||||||
import { withRouter } from 'react-router-dom'
|
import { withRouter } from 'react-router-dom'
|
||||||
import { compose } from 'redux'
|
import { compose } from 'redux'
|
||||||
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
||||||
import { ENVIRONMENT_TYPE_POPUP } from '../../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_POPUP } from '../../../../shared/constants/app'
|
||||||
import {
|
import {
|
||||||
DEFAULT_ROUTE,
|
DEFAULT_ROUTE,
|
||||||
RESTORE_VAULT_ROUTE,
|
RESTORE_VAULT_ROUTE,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { forOwn } from 'lodash'
|
import { forOwn } from 'lodash'
|
||||||
import { CAVEAT_NAMES } from '../../../app/scripts/controllers/permissions/enums'
|
import { CAVEAT_NAMES } from '../../../shared/constants/permissions'
|
||||||
import {
|
import {
|
||||||
getMetaMaskAccountsOrdered,
|
getMetaMaskAccountsOrdered,
|
||||||
getOriginOfCurrentTab,
|
getOriginOfCurrentTab,
|
||||||
|
@ -12,7 +12,7 @@ import {
|
|||||||
import { getMethodDataAsync } from '../helpers/utils/transactions.util'
|
import { getMethodDataAsync } from '../helpers/utils/transactions.util'
|
||||||
import { fetchSymbolAndDecimals } from '../helpers/utils/token-util'
|
import { fetchSymbolAndDecimals } from '../helpers/utils/token-util'
|
||||||
import switchDirection from '../helpers/utils/switch-direction'
|
import switchDirection from '../helpers/utils/switch-direction'
|
||||||
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../shared/constants/app'
|
||||||
import { hasUnconfirmedTransactions } from '../helpers/utils/confirm-tx.util'
|
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'
|
||||||
|
@ -6,7 +6,7 @@ import { render } from 'react-dom'
|
|||||||
import { getEnvironmentType } from '../app/scripts/lib/util'
|
import { getEnvironmentType } from '../app/scripts/lib/util'
|
||||||
import { ALERT_TYPES } from '../shared/constants/alerts'
|
import { ALERT_TYPES } from '../shared/constants/alerts'
|
||||||
import { SENTRY_STATE } from '../app/scripts/lib/setupSentry'
|
import { SENTRY_STATE } from '../app/scripts/lib/setupSentry'
|
||||||
import { ENVIRONMENT_TYPE_POPUP } from '../app/scripts/lib/enums'
|
import { ENVIRONMENT_TYPE_POPUP } from '../shared/constants/app'
|
||||||
import Root from './app/pages'
|
import Root from './app/pages'
|
||||||
import * as actions from './app/store/actions'
|
import * as actions from './app/store/actions'
|
||||||
import configureStore from './app/store/store'
|
import configureStore from './app/store/store'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as networkEnums from '../../app/scripts/controllers/network/enums'
|
import * as networkEnums from '../../shared/constants/network'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the etherscan.io URL prefix for a given network ID.
|
* Gets the etherscan.io URL prefix for a given network ID.
|
||||||
|
@ -4,7 +4,7 @@ import {
|
|||||||
ENVIRONMENT_TYPE_POPUP,
|
ENVIRONMENT_TYPE_POPUP,
|
||||||
PLATFORM_BRAVE,
|
PLATFORM_BRAVE,
|
||||||
PLATFORM_FIREFOX,
|
PLATFORM_FIREFOX,
|
||||||
} from '../../app/scripts/lib/enums'
|
} from '../../shared/constants/app'
|
||||||
import { getEnvironmentType, getPlatform } from '../../app/scripts/lib/util'
|
import { getEnvironmentType, getPlatform } from '../../app/scripts/lib/util'
|
||||||
|
|
||||||
class WebcamUtils {
|
class WebcamUtils {
|
||||||
|
Loading…
Reference in New Issue
Block a user