1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fix import/order issues (#9239)

See [`import/order`](https://eslint.org/docs/rules/import/order) for more information.

This change enables `import/order` and fixes the issues raised by the rule.
This commit is contained in:
Whymarrh Whitby 2020-08-18 16:48:25 -02:30 committed by GitHub
parent b7259e5d6a
commit c1e3c229bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
295 changed files with 415 additions and 411 deletions

View File

@ -50,6 +50,7 @@ module.exports = {
'implicit-arrow-linebreak': 'error',
'import/extensions': ['error', 'never', { 'json': 'always' }],
'import/no-extraneous-dependencies': 'error',
'import/order': 'error',
'import/unambiguous': 'error',
'max-statements-per-line': ['error', { 'max': 1 }],
'no-case-declarations': 'error',

View File

@ -1,11 +1,11 @@
/**
* @file The entry point for the web extension singleton process.
*/
// these need to run before anything else
/* eslint-disable import/order */
import './lib/freezeGlobals'
import setupFetchDebugging from './lib/setupFetchDebugging'
/* eslint-enable import/order */
setupFetchDebugging()
@ -17,14 +17,14 @@ import pump from 'pump'
import debounce from 'debounce-stream'
import log from 'loglevel'
import extension from 'extensionizer'
import ReadOnlyNetworkStore from './lib/network-store'
import LocalStore from './lib/local-store'
import storeTransform from 'obs-store/lib/transform'
import asStream from 'obs-store/lib/asStream'
import ExtensionPlatform from './platforms/extension'
import Migrator from './lib/migrator'
import migrations from './migrations'
import PortStream from 'extension-port-stream'
import migrations from './migrations'
import Migrator from './lib/migrator'
import ExtensionPlatform from './platforms/extension'
import LocalStore from './lib/local-store'
import ReadOnlyNetworkStore from './lib/network-store'
import createStreamSink from './lib/createStreamSink'
import NotificationManager from './lib/notification-manager'
import MetamaskController from './metamask-controller'

View File

@ -1,5 +1,5 @@
import pump from 'pump'
import querystring from 'querystring'
import pump from 'pump'
import LocalMessageDuplexStream from 'post-message-stream'
import ObjectMultiplex from 'obj-multiplex'
import extension from 'extensionizer'

View File

@ -1,5 +1,5 @@
import ObservableStore from 'obs-store'
import EventEmitter from 'events'
import ObservableStore from 'obs-store'
export default class AppStateController extends EventEmitter {
/**

View File

@ -1,11 +1,11 @@
import Web3 from 'web3'
import contracts from 'eth-contract-metadata'
import { warn } from 'loglevel'
import SINGLE_CALL_BALANCES_ABI from 'single-call-balance-checker-abi'
import { MAINNET } from './network/enums'
// By default, poll every 3 minutes
const DEFAULT_INTERVAL = 180 * 1000
import SINGLE_CALL_BALANCES_ABI from 'single-call-balance-checker-abi'
const SINGLE_CALL_BALANCES_ADDRESS = '0xb1f8e55c7f64d203c1400b9d8555d050f94adf39'
/**
* A controller that polls for token exchange

View File

@ -1,6 +1,6 @@
import punycode from 'punycode'
import ethUtil from 'ethereumjs-util'
import ObservableStore from 'obs-store'
import punycode from 'punycode'
import log from 'loglevel'
import Ens from './ens'

View File

@ -1,5 +1,5 @@
import { formatTxMetaForRpcResult } from '../util'
import createAsyncMiddleware from 'json-rpc-engine/src/createAsyncMiddleware'
import { formatTxMetaForRpcResult } from '../util'
export function createPendingNonceMiddleware ({ getPendingNonce }) {
return createAsyncMiddleware(async (req, res, next) => {

View File

@ -6,11 +6,11 @@ import EthQuery from 'eth-query'
import JsonRpcEngine from 'json-rpc-engine'
import providerFromEngine from 'eth-json-rpc-middleware/providerFromEngine'
import log from 'loglevel'
import { createSwappableProxy, createEventEmitterProxy } from 'swappable-obj-proxy'
import createMetamaskMiddleware from './createMetamaskMiddleware'
import createInfuraClient from './createInfuraClient'
import createJsonRpcClient from './createJsonRpcClient'
import createLocalhostClient from './createLocalhostClient'
import { createSwappableProxy, createEventEmitterProxy } from 'swappable-obj-proxy'
const networks = { networkList: {} }

View File

@ -1,7 +1,7 @@
import ObservableStore from 'obs-store'
import { addInternalMethodPrefix } from './permissions'
import { normalize as normalizeAddress } from 'eth-sig-util'
import { isValidAddress, sha3, bufferToHex } from 'ethereumjs-util'
import { addInternalMethodPrefix } from './permissions'
export default class PreferencesController {

View File

@ -1,16 +1,18 @@
import ObservableStore from 'obs-store'
/* eslint-disable import/order */
const Box = process.env.IN_TEST
? require('../../../development/mock-3box')
: require('3box')
/* eslint-enable import/order */
import log from 'loglevel'
import migrations from '../migrations'
import Migrator from '../lib/migrator'
import JsonRpcEngine from 'json-rpc-engine'
import providerFromEngine from 'eth-json-rpc-middleware/providerFromEngine'
import createMetamaskMiddleware from './network/createMetamaskMiddleware'
import Migrator from '../lib/migrator'
import migrations from '../migrations'
import createOriginMiddleware from '../lib/createOriginMiddleware'
import createMetamaskMiddleware from './network/createMetamaskMiddleware'
const SYNC_TIMEOUT = 60 * 1000 // one minute

View File

@ -9,6 +9,8 @@ import abiDecoder from 'abi-decoder'
abiDecoder.addABI(abi)
import NonceTracker from 'nonce-tracker'
import log from 'loglevel'
import {
TOKEN_METHOD_APPROVE,
TOKEN_METHOD_TRANSFER,
@ -18,13 +20,13 @@ import {
CONTRACT_INTERACTION_KEY,
} from '../../../../ui/app/helpers/constants/transactions'
import cleanErrorStack from '../../lib/cleanErrorStack'
import { hexToBn, bnToHex, BnMultiplyByFraction } from '../../lib/util'
import { TRANSACTION_NO_CONTRACT_ERROR_KEY } from '../../../../ui/app/helpers/constants/error-keys'
import TransactionStateManager from './tx-state-manager'
import TxGasUtil from './tx-gas-utils'
import PendingTransactionTracker from './pending-tx-tracker'
import NonceTracker from 'nonce-tracker'
import * as txUtils from './lib/util'
import cleanErrorStack from '../../lib/cleanErrorStack'
import log from 'loglevel'
import {
TRANSACTION_TYPE_CANCEL,
@ -33,8 +35,6 @@ import {
TRANSACTION_STATUS_APPROVED,
} from './enums'
import { hexToBn, bnToHex, BnMultiplyByFraction } from '../../lib/util'
import { TRANSACTION_NO_CONTRACT_ERROR_KEY } from '../../../../ui/app/helpers/constants/error-keys'
const SIMPLE_GAS_COST = '0x5208' // Hex for 21000, cost of a simple send.
const MAX_MEMSTORE_TX_LIST_SIZE = 100 // Number of transactions (by unique nonces) to keep in memory

View File

@ -1,6 +1,6 @@
import EthQuery from 'ethjs-query'
import { hexToBn, BnMultiplyByFraction, bnToHex } from '../../lib/util'
import log from 'loglevel'
import { hexToBn, BnMultiplyByFraction, bnToHex } from '../../lib/util'
/**
* Result of gas analysis, including either a gas estimate for a successful analysis, or

View File

@ -1,8 +1,8 @@
import EventEmitter from 'safe-event-emitter'
import ObservableStore from 'obs-store'
import log from 'loglevel'
import { generateHistoryEntry, replayHistory, snapshotFromTxMeta } from './lib/tx-state-history-helpers'
import createId from '../../lib/random-id'
import { generateHistoryEntry, replayHistory, snapshotFromTxMeta } from './lib/tx-state-history-helpers'
import { getFinalStates, normalizeTxParams } from './lib/util'
/**
TransactionStateManager is responsible for the state of a transaction and

View File

@ -14,7 +14,6 @@ import log from 'loglevel'
import pify from 'pify'
import Web3 from 'web3'
import SINGLE_CALL_BALANCES_ABI from 'single-call-balance-checker-abi'
import { bnToHex } from './util'
import { MAINNET_NETWORK_ID, RINKEBY_NETWORK_ID, ROPSTEN_NETWORK_ID, KOVAN_NETWORK_ID } from '../controllers/network/enums'
import {
@ -23,6 +22,7 @@ import {
SINGLE_CALL_BALANCES_ADDRESS_ROPSTEN,
SINGLE_CALL_BALANCES_ADDRESS_KOVAN,
} from '../controllers/network/contract-addresses'
import { bnToHex } from './util'
export default class AccountTracker {

View File

@ -2,11 +2,11 @@ import EventEmitter from 'events'
import ObservableStore from 'obs-store'
import ethUtil from 'ethereumjs-util'
import { ethErrors } from 'eth-json-rpc-errors'
import log from 'loglevel'
import createId from './random-id'
import { MESSAGE_TYPE } from './enums'
const hexRe = /^[0-9A-Fa-f]+$/ug
import log from 'loglevel'
/**
* Represents, and contains data about, an 'eth_decrypt' type decryption request. These are created when a

View File

@ -1,8 +1,8 @@
import EventEmitter from 'events'
import ObservableStore from 'obs-store'
import { ethErrors } from 'eth-json-rpc-errors'
import createId from './random-id'
import log from 'loglevel'
import createId from './random-id'
import { MESSAGE_TYPE } from './enums'
/**

View File

@ -1,9 +1,9 @@
import namehash from 'eth-ens-namehash'
import Eth from 'ethjs-query'
import EthContract from 'ethjs-contract'
import contentHash from 'content-hash'
import registryAbi from './contracts/registry'
import resolverAbi from './contracts/resolver'
import contentHash from 'content-hash'
export default async function resolveEnsToIpfsContentId ({ provider, name }) {
const eth = new Eth(provider)

View File

@ -2,11 +2,11 @@ import EventEmitter from 'events'
import ObservableStore from 'obs-store'
import ethUtil from 'ethereumjs-util'
import { ethErrors } from 'eth-json-rpc-errors'
import log from 'loglevel'
import createId from './random-id'
import { MESSAGE_TYPE } from './enums'
const hexRe = /^[0-9A-Fa-f]+$/ug
import log from 'loglevel'
/**
* Represents, and contains data about, an 'personal_sign' type signature request. These are created when a

View File

@ -1,12 +1,12 @@
import EventEmitter from 'events'
import ObservableStore from 'obs-store'
import createId from './random-id'
import assert from 'assert'
import ObservableStore from 'obs-store'
import { ethErrors } from 'eth-json-rpc-errors'
import sigUtil from 'eth-sig-util'
import { isValidAddress } from 'ethereumjs-util'
import log from 'loglevel'
import jsonschema from 'jsonschema'
import createId from './random-id'
import { MESSAGE_TYPE } from './enums'
/**

View File

@ -1,6 +1,6 @@
import assert from 'assert'
import extension from 'extensionizer'
import ethUtil from 'ethereumjs-util'
import assert from 'assert'
import BN from 'bn.js'
import { memoize } from 'lodash'

View File

@ -10,22 +10,35 @@ import pump from 'pump'
import Dnode from 'dnode'
import extension from 'extensionizer'
import ObservableStore from 'obs-store'
import ComposableObservableStore from './lib/ComposableObservableStore'
import asStream from 'obs-store/lib/asStream'
import AccountTracker from './lib/account-tracker'
import RpcEngine from 'json-rpc-engine'
import { debounce } from 'lodash'
import createEngineStream from 'json-rpc-middleware-stream/engineStream'
import createFilterMiddleware from 'eth-json-rpc-filters'
import createSubscriptionManager from 'eth-json-rpc-filters/subscriptionManager'
import providerAsMiddleware from 'eth-json-rpc-middleware/providerAsMiddleware'
import KeyringController from 'eth-keyring-controller'
import { Mutex } from 'await-semaphore'
import ethUtil from 'ethereumjs-util'
import log from 'loglevel'
import TrezorKeyring from 'eth-trezor-keyring'
import LedgerBridgeKeyring from '@metamask/eth-ledger-bridge-keyring'
import EthQuery from 'eth-query'
import nanoid from 'nanoid'
import contractMap from 'eth-contract-metadata'
import {
AddressBookController,
CurrencyRateController,
PhishingController,
} from '@metamask/controllers'
import ComposableObservableStore from './lib/ComposableObservableStore'
import AccountTracker from './lib/account-tracker'
import createLoggerMiddleware from './lib/createLoggerMiddleware'
import createMethodMiddleware from './lib/createMethodMiddleware'
import createOriginMiddleware from './lib/createOriginMiddleware'
import createTabIdMiddleware from './lib/createTabIdMiddleware'
import createOnboardingMiddleware from './lib/createOnboardingMiddleware'
import providerAsMiddleware from 'eth-json-rpc-middleware/providerAsMiddleware'
import { setupMultiplex } from './lib/stream-utils'
import KeyringController from 'eth-keyring-controller'
import EnsController from './controllers/ens'
import NetworkController from './controllers/network'
import PreferencesController from './controllers/preferences'
@ -48,22 +61,8 @@ import getRestrictedMethods from './controllers/permissions/restrictedMethods'
import nodeify from './lib/nodeify'
import accountImporter from './account-import-strategies'
import selectChainId from './lib/select-chain-id'
import { Mutex } from 'await-semaphore'
import ethUtil from 'ethereumjs-util'
import seedPhraseVerifier from './lib/seed-phrase-verifier'
import log from 'loglevel'
import TrezorKeyring from 'eth-trezor-keyring'
import LedgerBridgeKeyring from '@metamask/eth-ledger-bridge-keyring'
import EthQuery from 'eth-query'
import nanoid from 'nanoid'
import contractMap from 'eth-contract-metadata'
import {
AddressBookController,
CurrencyRateController,
PhishingController,
} from '@metamask/controllers'
import backgroundMetaMetricsEvent from './lib/background-metametrics'

View File

@ -1,6 +1,6 @@
import querystring from 'querystring'
import dnode from 'dnode'
import { EventEmitter } from 'events'
import dnode from 'dnode'
import PortStream from 'extension-port-stream'
import extension from 'extensionizer'
import { setupMultiplex } from './lib/stream-utils'

View File

@ -6,26 +6,26 @@ import './lib/freezeGlobals'
import 'abortcontroller-polyfill/dist/polyfill-patch-fetch'
import '@formatjs/intl-relativetimeformat/polyfill'
import { EventEmitter } from 'events'
import PortStream from 'extension-port-stream'
import { getEnvironmentType } from './lib/util'
import extension from 'extensionizer'
import Dnode from 'dnode'
import Eth from 'ethjs'
import EthQuery from 'eth-query'
import StreamProvider from 'web3-stream-provider'
import log from 'loglevel'
import launchMetaMaskUi from '../../ui'
import { setupMultiplex } from './lib/stream-utils'
import setupSentry from './lib/setupSentry'
import ExtensionPlatform from './platforms/extension'
import {
ENVIRONMENT_TYPE_FULLSCREEN,
ENVIRONMENT_TYPE_POPUP,
} from './lib/enums'
import extension from 'extensionizer'
import ExtensionPlatform from './platforms/extension'
import setupSentry from './lib/setupSentry'
import { EventEmitter } from 'events'
import Dnode from 'dnode'
import Eth from 'ethjs'
import EthQuery from 'eth-query'
import launchMetaMaskUi from '../../ui'
import StreamProvider from 'web3-stream-provider'
import { setupMultiplex } from './lib/stream-utils'
import log from 'loglevel'
import { getEnvironmentType } from './lib/util'
start().catch(log.error)

View File

@ -1,7 +1,7 @@
const { promises: fs } = require('fs')
const gulp = require('gulp')
const gulpZip = require('gulp-zip')
const del = require('del')
const { promises: fs } = require('fs')
const pify = require('pify')
const pump = pify(require('pump'))
const baseManifest = require('../../app/manifest/_base.json')

View File

@ -17,8 +17,8 @@ const { makeStringTransform } = require('browserify-transform-tools')
const conf = require('rc')('metamask', {})
const { createTask, composeParallel, composeSeries, runInChildProcess } = require('./task')
const packageJSON = require('../../package.json')
const { createTask, composeParallel, composeSeries, runInChildProcess } = require('./task')
module.exports = createScriptTasks

View File

@ -1,5 +1,5 @@
const fs = require('fs-extra')
const path = require('path')
const fs = require('fs-extra')
const watch = require('gulp-watch')
const glob = require('fast-glob')

View File

@ -1,6 +1,8 @@
#!/usr/bin/env node
const childProcess = require('child_process')
const pify = require('pify')
const exec = pify(require('child_process').exec, { multiArgs: true })
const exec = pify(childProcess.exec, { multiArgs: true })
const VERSION = require('../dist/chrome/manifest.json').version // eslint-disable-line import/no-unresolved
start().catch(console.error)

View File

@ -1,6 +1,6 @@
const fs = require('fs')
const { SourceMapConsumer } = require('source-map')
const path = require('path')
const { SourceMapConsumer } = require('source-map')
const pify = require('pify')
const fsAsync = pify(fs)

View File

@ -1,6 +1,7 @@
const assert = require('assert')
const { By, until } = require('selenium-webdriver')
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const {
tinyDelayMs,
regularDelayMs,
@ -8,7 +9,6 @@ const {
} = require('./helpers')
const { buildWebDriver } = require('./webdriver')
const Ganache = require('./ganache')
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const ganacheServer = new Ganache()

View File

@ -2,13 +2,13 @@ const assert = require('assert')
const webdriver = require('selenium-webdriver')
const { By, until } = webdriver
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const {
regularDelayMs,
largeDelayMs,
} = require('./helpers')
const { buildWebDriver } = require('./webdriver')
const Ganache = require('./ganache')
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const ganacheServer = new Ganache()

View File

@ -1,6 +1,6 @@
const { promises: fs } = require('fs')
const Koa = require('koa')
const path = require('path')
const Koa = require('koa')
const CURRENT_STATE_KEY = '__CURRENT__'
const DEFAULT_STATE_KEY = '__DEFAULT__'

View File

@ -2,13 +2,13 @@ const assert = require('assert')
const webdriver = require('selenium-webdriver')
const { By, Key, until } = webdriver
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const {
regularDelayMs,
largeDelayMs,
} = require('./helpers')
const { buildWebDriver } = require('./webdriver')
const Ganache = require('./ganache')
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const ganacheServer = new Ganache()

View File

@ -1,5 +1,5 @@
const ganache = require('ganache-core')
const { promisify } = require('util')
const ganache = require('ganache-core')
const defaultOptions = {
blockTime: 2,

View File

@ -1,8 +1,8 @@
const path = require('path')
const createStaticServer = require('../../development/create-static-server')
const Ganache = require('./ganache')
const FixtureServer = require('./fixture-server')
const { buildWebDriver } = require('./webdriver')
const createStaticServer = require('../../development/create-static-server')
const tinyDelayMs = 200
const regularDelayMs = tinyDelayMs * 2

View File

@ -2,6 +2,7 @@ const assert = require('assert')
const webdriver = require('selenium-webdriver')
const { By, until } = webdriver
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const {
tinyDelayMs,
regularDelayMs,
@ -9,7 +10,6 @@ const {
} = require('./helpers')
const { buildWebDriver } = require('./webdriver')
const Ganache = require('./ganache')
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const ganacheServer = new Ganache()

View File

@ -2,6 +2,7 @@ const assert = require('assert')
const webdriver = require('selenium-webdriver')
const { By, until } = webdriver
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const {
tinyDelayMs,
regularDelayMs,
@ -9,7 +10,6 @@ const {
} = require('./helpers')
const { buildWebDriver } = require('./webdriver')
const Ganache = require('./ganache')
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const ganacheServer = new Ganache()

View File

@ -2,6 +2,7 @@ const assert = require('assert')
const webdriver = require('selenium-webdriver')
const { By, Key, until } = webdriver
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const {
tinyDelayMs,
regularDelayMs,
@ -9,7 +10,6 @@ const {
} = require('./helpers')
const { buildWebDriver } = require('./webdriver')
const Ganache = require('./ganache')
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const ganacheServer = new Ganache()

View File

@ -2,13 +2,13 @@ const assert = require('assert')
const webdriver = require('selenium-webdriver')
const { By, until } = webdriver
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const {
regularDelayMs,
largeDelayMs,
} = require('./helpers')
const { buildWebDriver } = require('./webdriver')
const Ganache = require('./ganache')
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const ganacheServer = new Ganache()

View File

@ -2,6 +2,7 @@ const assert = require('assert')
const webdriver = require('selenium-webdriver')
const { By, until } = webdriver
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const {
tinyDelayMs,
regularDelayMs,
@ -9,7 +10,6 @@ const {
} = require('./helpers')
const { buildWebDriver } = require('./webdriver')
const Ganache = require('./ganache')
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const ganacheServer = new Ganache()

View File

@ -3,6 +3,7 @@ const webdriver = require('selenium-webdriver')
const getPort = require('get-port')
const { By, until } = webdriver
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const {
tinyDelayMs,
regularDelayMs,
@ -10,7 +11,6 @@ const {
} = require('./helpers')
const { buildWebDriver } = require('./webdriver')
const Ganache = require('./ganache')
const enLocaleMessages = require('../../app/_locales/en/messages.json')
const ganacheServer = new Ganache()

View File

@ -1,6 +1,6 @@
const { promises: fs } = require('fs')
const { until, error: webdriverError } = require('selenium-webdriver')
const { strict: assert } = require('assert')
const { until, error: webdriverError } = require('selenium-webdriver')
class Driver {
/**

View File

@ -1,8 +1,8 @@
const { Browser } = require('selenium-webdriver')
const fetchMockResponses = require('../../data/fetch-mocks.json')
const Driver = require('./driver')
const ChromeDriver = require('./chrome')
const FirefoxDriver = require('./firefox')
const fetchMockResponses = require('../../data/fetch-mocks.json')
async function buildWebDriver ({ responsive, port } = {}) {
const browser = process.env.SELENIUM_BROWSER

View File

@ -1,6 +1,6 @@
import assert from 'assert'
import ComposableObservableStore from '../../../app/scripts/lib/ComposableObservableStore'
import ObservableStore from 'obs-store'
import ComposableObservableStore from '../../../app/scripts/lib/ComposableObservableStore'
describe('ComposableObservableStore', function () {
it('should register initial state', function () {

View File

@ -4,10 +4,10 @@ import { cloneDeep } from 'lodash'
import nock from 'nock'
import ethUtil from 'ethereumjs-util'
import { obj as createThoughStream } from 'through2'
import firstTimeState from '../../localhostState'
import createTxMeta from '../../../lib/createTxMeta'
import EthQuery from 'eth-query'
import proxyquire from 'proxyquire'
import firstTimeState from '../../localhostState'
import createTxMeta from '../../../lib/createTxMeta'
const threeBoxSpies = {
init: sinon.stub(),

View File

@ -1,8 +1,8 @@
import assert from 'assert'
import ObservableStore from 'obs-store'
import sinon from 'sinon'
import PreferencesController from '../../../../app/scripts/controllers/preferences'
import { addInternalMethodPrefix } from '../../../../app/scripts/controllers/permissions'
import sinon from 'sinon'
describe('preferences controller', function () {
let preferencesController

View File

@ -1,7 +1,7 @@
import assert from 'assert'
import sinon from 'sinon'
import TokenRatesController from '../../../../app/scripts/controllers/token-rates'
import ObservableStore from 'obs-store'
import TokenRatesController from '../../../../app/scripts/controllers/token-rates'
describe('TokenRatesController', function () {
it('should listen for preferences store updates', function () {

View File

@ -1,5 +1,5 @@
import sinon from 'sinon'
import { strict as assert } from 'assert'
import sinon from 'sinon'
import BN from 'bn.js'
import PendingTransactionTracker from '../../../../../app/scripts/controllers/transactions/pending-tx-tracker'

View File

@ -1,5 +1,5 @@
import getAccountLink from '../../../ui/lib/account-link'
import assert from 'assert'
import getAccountLink from '../../../ui/lib/account-link'
describe('Account link', function () {
describe('getAccountLink', function () {

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import configureMockStore from 'redux-mock-store'
import thunk from 'redux-thunk'
import sinon from 'sinon'

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import { shallow } from 'enzyme'
import sinon from 'sinon'
import * as utils from '../../../../helpers/utils/util'

View File

@ -1,10 +1,10 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import sinon from 'sinon'
import configureMockStore from 'redux-mock-store'
import { Provider } from 'react-redux'
import { mountWithRouter } from '../../../../../../test/lib/render-helpers'
import AccountMenu from '../index'
import { Provider } from 'react-redux'
describe('Account Menu', function () {

View File

@ -1,7 +1,7 @@
import React from 'react'
import { useHistory } from 'react-router-dom'
import { useMetricEvent } from '../../../hooks/useMetricEvent'
import { useI18nContext } from '../../../hooks/useI18nContext'
import { useHistory } from 'react-router-dom'
import { ADD_TOKEN_ROUTE } from '../../../helpers/constants/routes'
import Button from '../../ui/button'

View File

@ -1,8 +1,8 @@
import React from 'react'
import { useSelector } from 'react-redux'
import UnconnectedAccountAlert from './unconnected-account-alert'
import { alertIsOpen as unconnectedAccountAlertIsOpen } from '../../../ducks/alerts/unconnected-account'
import UnconnectedAccountAlert from './unconnected-account-alert'
const Alerts = () => {
const _unconnectedAccountAlertIsOpen = useSelector(unconnectedAccountAlertIsOpen)

View File

@ -2,8 +2,8 @@ import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { compose } from 'redux'
import AppHeader from './app-header.component'
import * as actions from '../../../store/actions'
import AppHeader from './app-header.component'
const mapStateToProps = (state) => {
const { appState, metamask } = state

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import sinon from 'sinon'
import { shallow } from 'enzyme'
import MetaFoxLogo from '../../../ui/metafox-logo'

View File

@ -1,6 +1,8 @@
import React, { useMemo } from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames'
import { useDispatch } from 'react-redux'
import { useHistory } from 'react-router-dom'
import Identicon from '../../ui/identicon'
import ListItem from '../../ui/list-item'
import Tooltip from '../../ui/tooltip'
@ -8,9 +10,7 @@ import InfoIcon from '../../ui/icon/info-icon.component'
import Button from '../../ui/button'
import { useI18nContext } from '../../../hooks/useI18nContext'
import { useMetricEvent } from '../../../hooks/useMetricEvent'
import { useDispatch } from 'react-redux'
import { updateSendToken } from '../../../store/actions'
import { useHistory } from 'react-router-dom'
import { SEND_ROUTE } from '../../../helpers/constants/routes'

View File

@ -1,8 +1,8 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import { shallow } from 'enzyme'
import ConfirmDetailRow from '../confirm-detail-row.component'
import sinon from 'sinon'
import ConfirmDetailRow from '../confirm-detail-row.component'
const propsMethodSpies = {
onHeaderClick: sinon.spy(),

View File

@ -2,9 +2,9 @@ import React, { Component } from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames'
import { Tabs, Tab } from '../../../ui/tabs'
import { ConfirmPageContainerSummary, ConfirmPageContainerWarning } from '.'
import ErrorMessage from '../../../ui/error-message'
import { PageContainerFooter } from '../../../ui/page-container'
import { ConfirmPageContainerSummary, ConfirmPageContainerWarning } from '.'
export default class ConfirmPageContainerContent extends Component {

View File

@ -1,8 +1,8 @@
import PropTypes from 'prop-types'
import React, { PureComponent } from 'react'
import { MenuItem } from '../../ui/menu'
import ConnectedAccountsListItem from './connected-accounts-list-item'
import ConnectedAccountsListOptions from './connected-accounts-list-options'
import { MenuItem } from '../../ui/menu'
export default class ConnectedAccountsList extends PureComponent {
static contextTypes = {

View File

@ -1,6 +1,5 @@
import { findKey } from 'lodash'
import { connect } from 'react-redux'
import ConnectedStatusIndicator from './connected-status-indicator.component'
import {
STATUS_CONNECTED,
STATUS_CONNECTED_TO_ANOTHER_ACCOUNT,
@ -11,6 +10,7 @@ import {
getOriginOfCurrentTab,
getSelectedAddress,
} from '../../../selectors'
import ConnectedStatusIndicator from './connected-status-indicator.component'
const mapStateToProps = (state) => {

View File

@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import Identicon from '../../../ui/identicon'
import classnames from 'classnames'
import Identicon from '../../../ui/identicon'
import { ellipsify } from '../../../../pages/send/send.utils'
function addressesEqual (address1, address2) {

View File

@ -4,9 +4,9 @@ import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { compose } from 'redux'
import * as actions from '../../../store/actions'
import { NETWORKS_ROUTE } from '../../../helpers/constants/routes'
import { Dropdown, DropdownMenuItem } from './components/dropdown'
import NetworkDropdownIcon from './components/network-dropdown-icon'
import { NETWORKS_ROUTE } from '../../../helpers/constants/routes'
// classes from nodes of the toggle element.
const notToggleElementClassnames = [

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import sinon from 'sinon'
import { shallow } from 'enzyme'
import { DropdownMenuItem } from '../components/dropdown'

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import { shallow } from 'enzyme'
import NetworkDropdownIcon from '../components/network-dropdown-icon'

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import configureMockStore from 'redux-mock-store'
import thunk from 'redux-thunk'
import { mountWithRouter } from '../../../../../../test/lib/render-helpers'

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import sinon from 'sinon'
import { mount } from 'enzyme'
import AdvancedTabContent from '../index'

View File

@ -1,7 +1,7 @@
import React from 'react'
import assert from 'assert'
import shallow from '../../../../../../../lib/shallow-with-context'
import React from 'react'
import sinon from 'sinon'
import shallow from '../../../../../../../lib/shallow-with-context'
import AdvancedTabContent from '../advanced-tab-content.component'
import GasPriceChart from '../../../gas-price-chart'

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import shallow from '../../../../../../../lib/shallow-with-context'
import BasicTabContent from '../basic-tab-content.component'
import GasPriceButtonGroup from '../../../gas-price-button-group'

View File

@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import GasModalPageContainer from './gas-modal-page-container.component'
import { captureException } from '@sentry/browser'
import { addHexPrefix } from 'ethereumjs-util'
import {
hideModal,
setGasLimit,
@ -63,8 +63,8 @@ import {
calcGasTotal,
isBalanceSufficient,
} from '../../../../pages/send/send.utils'
import { addHexPrefix } from 'ethereumjs-util'
import { calcMaxAmount } from '../../../../pages/send/send-content/send-amount-row/amount-max-button/amount-max-button.utils'
import GasModalPageContainer from './gas-modal-page-container.component'
const mapStateToProps = (state, ownProps) => {
const { currentNetworkTxList, send } = state.metamask

View File

@ -1,7 +1,7 @@
import React from 'react'
import assert from 'assert'
import shallow from '../../../../../../lib/shallow-with-context'
import React from 'react'
import sinon from 'sinon'
import shallow from '../../../../../../lib/shallow-with-context'
import GasModalPageContainer from '../gas-modal-page-container.component'
import timeout from '../../../../../../lib/test-timeout'

View File

@ -1,7 +1,7 @@
import React from 'react'
import assert from 'assert'
import shallow from '../../../../../../lib/shallow-with-context'
import React from 'react'
import sinon from 'sinon'
import shallow from '../../../../../../lib/shallow-with-context'
import GasPriceButtonGroup from '../gas-price-button-group.component'
import ButtonGroup from '../../../../ui/button-group'

View File

@ -1,9 +1,9 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import proxyquire from 'proxyquire'
import sinon from 'sinon'
import shallow from '../../../../../../lib/shallow-with-context'
import * as d3 from 'd3'
import shallow from '../../../../../../lib/shallow-with-context'
function timeout (time) {
return new Promise((resolve) => {

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import sinon from 'sinon'
import { shallow } from 'enzyme'

View File

@ -1,7 +1,7 @@
import { connect } from 'react-redux'
import LoadingNetworkScreen from './loading-network-screen.component'
import * as actions from '../../../store/actions'
import { getNetworkIdentifier } from '../../../selectors'
import LoadingNetworkScreen from './loading-network-screen.component'
const mapStateToProps = (state) => {
const {

View File

@ -4,13 +4,13 @@ import { useHistory } from 'react-router-dom'
import { useSelector } from 'react-redux'
import SelectedAccount from '../selected-account'
import ConnectedStatusIndicator from '../connected-status-indicator'
import AccountOptionsMenu from './account-options-menu'
import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
import { ENVIRONMENT_TYPE_POPUP } from '../../../../../app/scripts/lib/enums'
import { CONNECTED_ACCOUNTS_ROUTE } from '../../../helpers/constants/routes'
import { useI18nContext } from '../../../hooks/useI18nContext'
import { useMetricEvent } from '../../../hooks/useMetricEvent'
import { getOriginOfCurrentTab } from '../../../selectors'
import AccountOptionsMenu from './account-options-menu'
export default function MenuBar () {
const t = useI18nContext()

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import { Provider } from 'react-redux'
import configureStore from 'redux-mock-store'
import { mountWithRouter } from '../../../../../../test/lib/render-helpers'

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import { shallow } from 'enzyme'
import ModalContent from '../modal-content.component'

View File

@ -1,7 +1,7 @@
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import Button from '../../ui/button'
import classnames from 'classnames'
import Button from '../../ui/button'
export default class Modal extends PureComponent {
static propTypes = {

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import { mount, shallow } from 'enzyme'
import sinon from 'sinon'
import Modal from '../modal.component'

View File

@ -1,7 +1,7 @@
import PropTypes from 'prop-types'
import React from 'react'
import Identicon from '../../../ui/identicon'
import classnames from 'classnames'
import Identicon from '../../../ui/identicon'
export default function AccountModalContainer (props, context) {
const {

View File

@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import AddToAddressBookModal from './add-to-addressbook-modal.component'
import * as actions from '../../../../store/actions'
import AddToAddressBookModal from './add-to-addressbook-modal.component'
function mapStateToProps (state) {
return {

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import { shallow } from 'enzyme'
import CancelTransactionGasFee from '../cancel-transaction-gas-fee.component'
import UserPreferencedCurrencyDisplay from '../../../../user-preferenced-currency-display'

View File

@ -1,8 +1,8 @@
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import Modal from '../../modal'
import CancelTransactionGasFee from './cancel-transaction-gas-fee'
import { SUBMITTED_STATUS } from '../../../../helpers/constants/transactions'
import CancelTransactionGasFee from './cancel-transaction-gas-fee'
export default class CancelTransaction extends PureComponent {
static contextTypes = {

View File

@ -3,9 +3,9 @@ import { compose } from 'redux'
import ethUtil from 'ethereumjs-util'
import { multiplyCurrencies } from '../../../../helpers/utils/conversion-util'
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props'
import CancelTransaction from './cancel-transaction.component'
import { showModal, createCancelTransaction } from '../../../../store/actions'
import { getHexGasTotal } from '../../../../helpers/utils/confirm-tx.util'
import CancelTransaction from './cancel-transaction.component'
const mapStateToProps = (state, ownProps) => {
const { metamask } = state

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import { shallow } from 'enzyme'
import sinon from 'sinon'
import CancelTransaction from '../cancel-transaction.component'

View File

@ -1,8 +1,8 @@
import { connect } from 'react-redux'
import { compose } from 'redux'
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props'
import ConfirmDeleteNetwork from './confirm-delete-network.component'
import { delRpcTarget } from '../../../../store/actions'
import ConfirmDeleteNetwork from './confirm-delete-network.component'
const mapDispatchToProps = (dispatch) => {
return {

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import sinon from 'sinon'
import { mount } from 'enzyme'
import ConfirmDeleteNetwork from '../index'

View File

@ -1,8 +1,8 @@
import { connect } from 'react-redux'
import { compose } from 'redux'
import ConfirmRemoveAccount from './confirm-remove-account.component'
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props'
import { removeAccount } from '../../../../store/actions'
import ConfirmRemoveAccount from './confirm-remove-account.component'
const mapStateToProps = (state) => {
return {

View File

@ -1,7 +1,7 @@
import assert from 'assert'
import React from 'react'
import PropTypes from 'prop-types'
import { Provider } from 'react-redux'
import assert from 'assert'
import sinon from 'sinon'
import configureStore from 'redux-mock-store'
import { mount } from 'enzyme'

View File

@ -1,8 +1,8 @@
import { connect } from 'react-redux'
import { compose } from 'redux'
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props'
import ConfirmResetAccount from './confirm-reset-account.component'
import { resetAccount } from '../../../../store/actions'
import ConfirmResetAccount from './confirm-reset-account.component'
const mapDispatchToProps = (dispatch) => {
return {

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import sinon from 'sinon'
import { mount } from 'enzyme'
import ConfirmResetAccount from '../index'

View File

@ -1,12 +1,12 @@
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import log from 'loglevel'
import classnames from 'classnames'
import BigNumber from 'bignumber.js'
import Modal from '../../modal'
import Identicon from '../../../ui/identicon'
import TextField from '../../../ui/text-field'
import { calcTokenAmount } from '../../../../helpers/utils/token-util'
import classnames from 'classnames'
import BigNumber from 'bignumber.js'
const MAX_UNSIGNED_256_INT = new BigNumber(2).pow(256).minus(1).toString(10)

View File

@ -1,8 +1,8 @@
import { connect } from 'react-redux'
import { compose } from 'redux'
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props'
import EditApprovalPermission from './edit-approval-permission.component'
import { getSelectedIdentity } from '../../../../selectors'
import EditApprovalPermission from './edit-approval-permission.component'
const mapStateToProps = (state) => {
const modalStateProps = state.appState.modal.modalState.props || {}

View File

@ -1,4 +1,4 @@
import LoadingNetworkError from './loading-network-error.component'
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props'
import LoadingNetworkError from './loading-network-error.component'
export default withModalProps(LoadingNetworkError)

View File

@ -1,8 +1,8 @@
import { connect } from 'react-redux'
import { compose } from 'redux'
import MetaMetricsOptInModal from './metametrics-opt-in-modal.component'
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props'
import { setParticipateInMetaMetrics } from '../../../../store/actions'
import MetaMetricsOptInModal from './metametrics-opt-in-modal.component'
const mapStateToProps = (_, ownProps) => {
const { unapprovedTxCount } = ownProps

View File

@ -1,5 +1,5 @@
import React from 'react'
import assert from 'assert'
import React from 'react'
import sinon from 'sinon'
import { mount } from 'enzyme'
import MetaMetricsOptIn from '../index'

View File

@ -9,6 +9,7 @@ import { getEnvironmentType } from '../../../../../app/scripts/lib/util'
import { ENVIRONMENT_TYPE_POPUP } from '../../../../../app/scripts/lib/enums'
// Modal Components
import ConfirmCustomizeGasModal from '../gas-customization/gas-modal-page-container'
import DepositEtherModal from './deposit-ether-modal'
import AccountDetailsModal from './account-details-modal'
import ExportPrivateKeyModal from './export-private-key-modal'
@ -24,7 +25,6 @@ import CancelTransaction from './cancel-transaction'
import FadeModal from './fade-modal'
import MetaMetricsOptInModal from './metametrics-opt-in-modal'
import RejectTransactions from './reject-transactions'
import ConfirmCustomizeGasModal from '../gas-customization/gas-modal-page-container'
import ConfirmDeleteNetwork from './confirm-delete-network'
import AddToAddressBookModal from './add-to-addressbook-modal'
import EditApprovalPermission from './edit-approval-permission'

View File

@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import NewAccountModal from './new-account-modal.component'
import * as actions from '../../../../store/actions'
import NewAccountModal from './new-account-modal.component'
function mapStateToProps (state) {
return {

View File

@ -1,7 +1,7 @@
import { connect } from 'react-redux'
import { hideModal, qrCodeDetected } from '../../../../store/actions'
import QrScanner from './qr-scanner.component'
import { hideModal, qrCodeDetected } from '../../../../store/actions'
const mapDispatchToProps = (dispatch) => {
return {

View File

@ -1,7 +1,7 @@
import { connect } from 'react-redux'
import { compose } from 'redux'
import RejectTransactionsModal from './reject-transactions.component'
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props'
import RejectTransactionsModal from './reject-transactions.component'
const mapStateToProps = (_, ownProps) => {
const { unapprovedTxCount } = ownProps

Some files were not shown because too many files have changed in this diff Show More