mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
yarn lint --fix
This commit is contained in:
parent
5ed921cb76
commit
274a9ecf53
@ -488,7 +488,7 @@ function openPopup () {
|
||||
}
|
||||
|
||||
// On first install, open a new tab with MetaMask
|
||||
extension.runtime.onInstalled.addListener(({reason}) => {
|
||||
extension.runtime.onInstalled.addListener(({ reason }) => {
|
||||
if ((reason === 'install') && (!METAMASK_DEBUG)) {
|
||||
platform.openExtensionInBrowser()
|
||||
}
|
||||
|
@ -7,8 +7,8 @@ class AppStateController {
|
||||
* @param opts
|
||||
*/
|
||||
constructor (opts = {}) {
|
||||
const {initState, onInactiveTimeout, preferencesStore} = opts
|
||||
const {preferences} = preferencesStore.getState()
|
||||
const { initState, onInactiveTimeout, preferencesStore } = opts
|
||||
const { preferences } = preferencesStore.getState()
|
||||
|
||||
this.onInactiveTimeout = onInactiveTimeout || (() => {})
|
||||
this.store = new ObservableStore(extend({
|
||||
@ -62,7 +62,7 @@ class AppStateController {
|
||||
* @private
|
||||
*/
|
||||
_resetTimer () {
|
||||
const {timeoutMinutes} = this.store.getState()
|
||||
const { timeoutMinutes } = this.store.getState()
|
||||
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer)
|
||||
|
@ -4,7 +4,7 @@ const { warn } = require('loglevel')
|
||||
const { MAINNET } = require('./network/enums')
|
||||
// By default, poll every 3 minutes
|
||||
const DEFAULT_INTERVAL = 180 * 1000
|
||||
const ERC20_ABI = [{'constant': true, 'inputs': [{'name': '_owner', 'type': 'address'}], 'name': 'balanceOf', 'outputs': [{'name': 'balance', 'type': 'uint256'}], 'payable': false, 'type': 'function'}]
|
||||
const ERC20_ABI = [{ 'constant': true, 'inputs': [{ 'name': '_owner', 'type': 'address' }], 'name': 'balanceOf', 'outputs': [{ 'name': 'balance', 'type': 'uint256' }], 'payable': false, 'type': 'function' }]
|
||||
const SINGLE_CALL_BALANCES_ABI = require('single-call-balance-checker-abi')
|
||||
const SINGLE_CALL_BALANCES_ADDRESS = '0xb1f8e55c7f64d203c1400b9d8555d050f94adf39'
|
||||
/**
|
||||
|
@ -3,7 +3,7 @@ const createAsyncMiddleware = require('json-rpc-engine/src/createAsyncMiddleware
|
||||
|
||||
function createPendingNonceMiddleware ({ getPendingNonce }) {
|
||||
return createAsyncMiddleware(async (req, res, next) => {
|
||||
const {method, params} = req
|
||||
const { method, params } = req
|
||||
if (method !== 'eth_getTransactionCount') {
|
||||
return next()
|
||||
}
|
||||
@ -17,7 +17,7 @@ function createPendingNonceMiddleware ({ getPendingNonce }) {
|
||||
|
||||
function createPendingTxMiddleware ({ getPendingTransactionByHash }) {
|
||||
return createAsyncMiddleware(async (req, res, next) => {
|
||||
const {method, params} = req
|
||||
const { method, params } = req
|
||||
if (method !== 'eth_getTransactionByHash') {
|
||||
return next()
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ module.exports = function createMethodMiddleware ({
|
||||
return createAsyncMiddleware(async (req, res, next) => {
|
||||
|
||||
if (typeof req.method !== 'string') {
|
||||
res.error = ethErrors.rpc.invalidRequest({ data: req})
|
||||
res.error = ethErrors.rpc.invalidRequest({ data: req })
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ class PreferencesController {
|
||||
|
||||
const identities = addresses.reduce((ids, address, index) => {
|
||||
const oldId = oldIdentities[address] || {}
|
||||
ids[address] = {name: `Account ${index + 1}`, address, ...oldId}
|
||||
ids[address] = { name: `Account ${index + 1}`, address, ...oldId }
|
||||
return ids
|
||||
}, {})
|
||||
const accountTokens = addresses.reduce((tokens, address) => {
|
||||
@ -474,7 +474,7 @@ class PreferencesController {
|
||||
throw new Error('setAccountLabel requires a valid address, got ' + String(account))
|
||||
}
|
||||
const address = normalizeAddress(account)
|
||||
const {identities} = this.store.getState()
|
||||
const { identities } = this.store.getState()
|
||||
identities[address] = identities[address] || {}
|
||||
identities[address].name = label
|
||||
this.store.updateState({ identities })
|
||||
|
@ -219,7 +219,7 @@ class TransactionController extends EventEmitter {
|
||||
// the specified address
|
||||
const permittedAddresses = await this.getPermittedAccounts(origin)
|
||||
if (!permittedAddresses.includes(normalizedTxParams.from)) {
|
||||
throw ethErrors.provider.unauthorized({ data: { origin }})
|
||||
throw ethErrors.provider.unauthorized({ data: { origin } })
|
||||
}
|
||||
}
|
||||
|
||||
@ -690,7 +690,7 @@ class TransactionController extends EventEmitter {
|
||||
// get the confirmed transactions nonce and from address
|
||||
const txMeta = this.txStateManager.getTx(txId)
|
||||
const { nonce, from } = txMeta.txParams
|
||||
const sameNonceTxs = this.txStateManager.getFilteredTxList({nonce, from})
|
||||
const sameNonceTxs = this.txStateManager.getFilteredTxList({ nonce, from })
|
||||
if (!sameNonceTxs.length) {
|
||||
return
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
module.exports = [{'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'resolver', 'outputs': [{'name': '', 'type': 'address'}], 'payable': false, 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'owner', 'outputs': [{'name': '', 'type': 'address'}], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'label', 'type': 'bytes32'}, {'name': 'owner', 'type': 'address'}], 'name': 'setSubnodeOwner', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'ttl', 'type': 'uint64'}], 'name': 'setTTL', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'ttl', 'outputs': [{'name': '', 'type': 'uint64'}], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'resolver', 'type': 'address'}], 'name': 'setResolver', 'outputs': [], 'payable': false, 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'owner', 'type': 'address'}], 'name': 'setOwner', 'outputs': [], 'payable': false, 'type': 'function'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'owner', 'type': 'address'}], 'name': 'Transfer', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': true, 'name': 'label', 'type': 'bytes32'}, {'indexed': false, 'name': 'owner', 'type': 'address'}], 'name': 'NewOwner', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'resolver', 'type': 'address'}], 'name': 'NewResolver', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'ttl', 'type': 'uint64'}], 'name': 'NewTTL', 'type': 'event'}]
|
||||
module.exports = [{ 'constant': true, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }], 'name': 'resolver', 'outputs': [{ 'name': '', 'type': 'address' }], 'payable': false, 'type': 'function' }, { 'constant': true, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }], 'name': 'owner', 'outputs': [{ 'name': '', 'type': 'address' }], 'payable': false, 'type': 'function' }, { 'constant': false, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }, { 'name': 'label', 'type': 'bytes32' }, { 'name': 'owner', 'type': 'address' }], 'name': 'setSubnodeOwner', 'outputs': [], 'payable': false, 'type': 'function' }, { 'constant': false, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }, { 'name': 'ttl', 'type': 'uint64' }], 'name': 'setTTL', 'outputs': [], 'payable': false, 'type': 'function' }, { 'constant': true, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }], 'name': 'ttl', 'outputs': [{ 'name': '', 'type': 'uint64' }], 'payable': false, 'type': 'function' }, { 'constant': false, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }, { 'name': 'resolver', 'type': 'address' }], 'name': 'setResolver', 'outputs': [], 'payable': false, 'type': 'function' }, { 'constant': false, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }, { 'name': 'owner', 'type': 'address' }], 'name': 'setOwner', 'outputs': [], 'payable': false, 'type': 'function' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'name': 'node', 'type': 'bytes32' }, { 'indexed': false, 'name': 'owner', 'type': 'address' }], 'name': 'Transfer', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'name': 'node', 'type': 'bytes32' }, { 'indexed': true, 'name': 'label', 'type': 'bytes32' }, { 'indexed': false, 'name': 'owner', 'type': 'address' }], 'name': 'NewOwner', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'name': 'node', 'type': 'bytes32' }, { 'indexed': false, 'name': 'resolver', 'type': 'address' }], 'name': 'NewResolver', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'name': 'node', 'type': 'bytes32' }, { 'indexed': false, 'name': 'ttl', 'type': 'uint64' }], 'name': 'NewTTL', 'type': 'event' }]
|
||||
|
@ -1,2 +1,2 @@
|
||||
module.exports =
|
||||
[{'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'hash', 'type': 'bytes32'}], 'name': 'setContent', 'outputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'content', 'outputs': [{'name': '', 'type': 'bytes32'}], 'payable': false, 'stateMutability': 'view', 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'interfaceID', 'type': 'bytes4'}], 'name': 'supportsInterface', 'outputs': [{'name': '', 'type': 'bool'}], 'payable': false, 'stateMutability': 'pure', 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'key', 'type': 'string'}, {'name': 'value', 'type': 'string'}], 'name': 'setText', 'outputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'contentTypes', 'type': 'uint256'}], 'name': 'ABI', 'outputs': [{'name': 'contentType', 'type': 'uint256'}, {'name': 'data', 'type': 'bytes'}], 'payable': false, 'stateMutability': 'view', 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'x', 'type': 'bytes32'}, {'name': 'y', 'type': 'bytes32'}], 'name': 'setPubkey', 'outputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'hash', 'type': 'bytes'}], 'name': 'setContenthash', 'outputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'addr', 'outputs': [{'name': '', 'type': 'address'}], 'payable': false, 'stateMutability': 'view', 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'key', 'type': 'string'}], 'name': 'text', 'outputs': [{'name': '', 'type': 'string'}], 'payable': false, 'stateMutability': 'view', 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'contentType', 'type': 'uint256'}, {'name': 'data', 'type': 'bytes'}], 'name': 'setABI', 'outputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'name', 'outputs': [{'name': '', 'type': 'string'}], 'payable': false, 'stateMutability': 'view', 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'name', 'type': 'string'}], 'name': 'setName', 'outputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'contenthash', 'outputs': [{'name': '', 'type': 'bytes'}], 'payable': false, 'stateMutability': 'view', 'type': 'function'}, {'constant': true, 'inputs': [{'name': 'node', 'type': 'bytes32'}], 'name': 'pubkey', 'outputs': [{'name': 'x', 'type': 'bytes32'}, {'name': 'y', 'type': 'bytes32'}], 'payable': false, 'stateMutability': 'view', 'type': 'function'}, {'constant': false, 'inputs': [{'name': 'node', 'type': 'bytes32'}, {'name': 'addr', 'type': 'address'}], 'name': 'setAddr', 'outputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function'}, {'inputs': [{'name': 'ensAddr', 'type': 'address'}], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'constructor'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'a', 'type': 'address'}], 'name': 'AddrChanged', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'name', 'type': 'string'}], 'name': 'NameChanged', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': true, 'name': 'contentType', 'type': 'uint256'}], 'name': 'ABIChanged', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'x', 'type': 'bytes32'}, {'indexed': false, 'name': 'y', 'type': 'bytes32'}], 'name': 'PubkeyChanged', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'indexedKey', 'type': 'string'}, {'indexed': false, 'name': 'key', 'type': 'string'}], 'name': 'TextChanged', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': 'node', 'type': 'bytes32'}, {'indexed': false, 'name': 'hash', 'type': 'bytes'}], 'name': 'ContenthashChanged', 'type': 'event'}]
|
||||
[{ 'constant': false, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }, { 'name': 'hash', 'type': 'bytes32' }], 'name': 'setContent', 'outputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function' }, { 'constant': true, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }], 'name': 'content', 'outputs': [{ 'name': '', 'type': 'bytes32' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' }, { 'constant': true, 'inputs': [{ 'name': 'interfaceID', 'type': 'bytes4' }], 'name': 'supportsInterface', 'outputs': [{ 'name': '', 'type': 'bool' }], 'payable': false, 'stateMutability': 'pure', 'type': 'function' }, { 'constant': false, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }, { 'name': 'key', 'type': 'string' }, { 'name': 'value', 'type': 'string' }], 'name': 'setText', 'outputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function' }, { 'constant': true, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }, { 'name': 'contentTypes', 'type': 'uint256' }], 'name': 'ABI', 'outputs': [{ 'name': 'contentType', 'type': 'uint256' }, { 'name': 'data', 'type': 'bytes' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' }, { 'constant': false, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }, { 'name': 'x', 'type': 'bytes32' }, { 'name': 'y', 'type': 'bytes32' }], 'name': 'setPubkey', 'outputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function' }, { 'constant': false, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }, { 'name': 'hash', 'type': 'bytes' }], 'name': 'setContenthash', 'outputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function' }, { 'constant': true, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }], 'name': 'addr', 'outputs': [{ 'name': '', 'type': 'address' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' }, { 'constant': true, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }, { 'name': 'key', 'type': 'string' }], 'name': 'text', 'outputs': [{ 'name': '', 'type': 'string' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' }, { 'constant': false, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }, { 'name': 'contentType', 'type': 'uint256' }, { 'name': 'data', 'type': 'bytes' }], 'name': 'setABI', 'outputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function' }, { 'constant': true, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }], 'name': 'name', 'outputs': [{ 'name': '', 'type': 'string' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' }, { 'constant': false, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }, { 'name': 'name', 'type': 'string' }], 'name': 'setName', 'outputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function' }, { 'constant': true, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }], 'name': 'contenthash', 'outputs': [{ 'name': '', 'type': 'bytes' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' }, { 'constant': true, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }], 'name': 'pubkey', 'outputs': [{ 'name': 'x', 'type': 'bytes32' }, { 'name': 'y', 'type': 'bytes32' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' }, { 'constant': false, 'inputs': [{ 'name': 'node', 'type': 'bytes32' }, { 'name': 'addr', 'type': 'address' }], 'name': 'setAddr', 'outputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function' }, { 'inputs': [{ 'name': 'ensAddr', 'type': 'address' }], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'constructor' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'name': 'node', 'type': 'bytes32' }, { 'indexed': false, 'name': 'a', 'type': 'address' }], 'name': 'AddrChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'name': 'node', 'type': 'bytes32' }, { 'indexed': false, 'name': 'name', 'type': 'string' }], 'name': 'NameChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'name': 'node', 'type': 'bytes32' }, { 'indexed': true, 'name': 'contentType', 'type': 'uint256' }], 'name': 'ABIChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'name': 'node', 'type': 'bytes32' }, { 'indexed': false, 'name': 'x', 'type': 'bytes32' }, { 'indexed': false, 'name': 'y', 'type': 'bytes32' }], 'name': 'PubkeyChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'name': 'node', 'type': 'bytes32' }, { 'indexed': false, 'name': 'indexedKey', 'type': 'string' }, { 'indexed': false, 'name': 'key', 'type': 'string' }], 'name': 'TextChanged', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'name': 'node', 'type': 'bytes32' }, { 'indexed': false, 'name': 'hash', 'type': 'bytes' }], 'name': 'ContenthashChanged', 'type': 'event' }]
|
||||
|
@ -34,7 +34,7 @@ async function resolveEnsToIpfsContentId ({ provider, name }) {
|
||||
const rawContentHash = contentLookupResult[0]
|
||||
const decodedContentHash = contentHash.decode(rawContentHash)
|
||||
const type = contentHash.getCodec(rawContentHash)
|
||||
return {type: type, hash: decodedContentHash}
|
||||
return { type: type, hash: decodedContentHash }
|
||||
}
|
||||
if (isLegacyResolver[0]) {
|
||||
// lookup content id
|
||||
@ -43,7 +43,7 @@ async function resolveEnsToIpfsContentId ({ provider, name }) {
|
||||
if (hexValueIsEmpty(content)) {
|
||||
throw new Error(`EnsIpfsResolver - no content ID found for name "${name}"`)
|
||||
}
|
||||
return {type: 'swarm-ns', hash: content.slice(2)}
|
||||
return { type: 'swarm-ns', hash: content.slice(2) }
|
||||
}
|
||||
throw new Error(`EnsIpfsResolver - the resolver for name "${name}" is not standard, it should either supports contenthash() or content()`)
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ function setupEnsIpfsResolver ({ provider }) {
|
||||
|
||||
// install listener
|
||||
const urlPatterns = supportedTopLevelDomains.map(tld => `*://*.${tld}/*`)
|
||||
extension.webRequest.onErrorOccurred.addListener(webRequestDidFail, { urls: urlPatterns, types: ['main_frame']})
|
||||
extension.webRequest.onErrorOccurred.addListener(webRequestDidFail, { urls: urlPatterns, types: ['main_frame'] })
|
||||
|
||||
// return api object
|
||||
return {
|
||||
@ -43,7 +43,7 @@ function setupEnsIpfsResolver ({ provider }) {
|
||||
extension.tabs.update(tabId, { url: `loading.html` })
|
||||
let url = `https://app.ens.domains/name/${name}`
|
||||
try {
|
||||
const {type, hash} = await resolveEnsToIpfsContentId({ provider, name })
|
||||
const { type, hash } = await resolveEnsToIpfsContentId({ provider, name })
|
||||
if (type === 'ipfs-ns') {
|
||||
const resolvedUrl = `https://gateway.ipfs.io/ipfs/${hash}${path}${search || ''}${fragment || ''}`
|
||||
try {
|
||||
|
@ -27,7 +27,7 @@ class NotificationManager {
|
||||
// bring focus to existing chrome popup
|
||||
extension.windows.update(popup.id, { focused: true })
|
||||
} else {
|
||||
const {screenX, screenY, outerWidth, outerHeight} = window
|
||||
const { screenX, screenY, outerWidth, outerHeight } = window
|
||||
const notificationTop = Math.round(screenY + (outerHeight / 2) - (NOTIFICATION_HEIGHT / 2))
|
||||
const notificationLeft = Math.round(screenX + (outerWidth / 2) - (NOTIFICATION_WIDTH / 2))
|
||||
const cb = (currentPopup) => {
|
||||
|
@ -21,7 +21,7 @@ const createSubscriptionManager = require('eth-json-rpc-filters/subscriptionMana
|
||||
const createLoggerMiddleware = require('./lib/createLoggerMiddleware')
|
||||
const createOriginMiddleware = require('./lib/createOriginMiddleware')
|
||||
const providerAsMiddleware = require('eth-json-rpc-middleware/providerAsMiddleware')
|
||||
const {setupMultiplex} = require('./lib/stream-utils.js')
|
||||
const { setupMultiplex } = require('./lib/stream-utils.js')
|
||||
const KeyringController = require('eth-keyring-controller')
|
||||
const EnsController = require('./controllers/ens')
|
||||
const NetworkController = require('./controllers/network')
|
||||
@ -45,9 +45,9 @@ const nodeify = require('./lib/nodeify')
|
||||
const accountImporter = require('./account-import-strategies')
|
||||
const getBuyEthUrl = require('./lib/buy-eth-url')
|
||||
const selectChainId = require('./lib/select-chain-id')
|
||||
const {Mutex} = require('await-semaphore')
|
||||
const {version} = require('../manifest.json')
|
||||
const {BN} = require('ethereumjs-util')
|
||||
const { Mutex } = require('await-semaphore')
|
||||
const { version } = require('../manifest.json')
|
||||
const { BN } = require('ethereumjs-util')
|
||||
const GWEI_BN = new BN('1000000000')
|
||||
const percentile = require('percentile')
|
||||
const seedPhraseVerifier = require('./lib/seed-phrase-verifier')
|
||||
@ -929,8 +929,8 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
}
|
||||
})
|
||||
|
||||
const {identities} = this.preferencesController.store.getState()
|
||||
return {...keyState, identities}
|
||||
const { identities } = this.preferencesController.store.getState()
|
||||
return { ...keyState, identities }
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1652,8 +1652,8 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
* @private
|
||||
*/
|
||||
async _onKeyringControllerUpdate (state) {
|
||||
const {isUnlocked, keyrings} = state
|
||||
const addresses = keyrings.reduce((acc, {accounts}) => acc.concat(accounts), [])
|
||||
const { isUnlocked, keyrings } = state
|
||||
const addresses = keyrings.reduce((acc, { accounts }) => acc.concat(accounts), [])
|
||||
|
||||
if (!addresses.length) {
|
||||
return
|
||||
|
@ -30,7 +30,7 @@ function transformState (state) {
|
||||
const tokens = newState.PreferencesController.tokens
|
||||
newState.PreferencesController.accountTokens = {}
|
||||
for (const identity in identities) {
|
||||
newState.PreferencesController.accountTokens[identity] = {'mainnet': tokens}
|
||||
newState.PreferencesController.accountTokens[identity] = { 'mainnet': tokens }
|
||||
}
|
||||
newState.PreferencesController.tokens = []
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ const dnode = require('dnode')
|
||||
const { EventEmitter } = require('events')
|
||||
const PortStream = require('extension-port-stream')
|
||||
const extension = require('extensionizer')
|
||||
const {setupMultiplex} = require('./lib/stream-utils.js')
|
||||
const { setupMultiplex } = require('./lib/stream-utils.js')
|
||||
const { getEnvironmentType } = require('./lib/util')
|
||||
const ExtensionPlatform = require('./platforms/extension')
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
const extension = require('extensionizer')
|
||||
const {createExplorerLink: explorerLink} = require('etherscan-link')
|
||||
const { createExplorerLink: explorerLink } = require('etherscan-link')
|
||||
|
||||
const { getEnvironmentType, checkForError } = require('../lib/util')
|
||||
const {ENVIRONMENT_TYPE_BACKGROUND} = require('../lib/enums')
|
||||
const { ENVIRONMENT_TYPE_BACKGROUND } = require('../lib/enums')
|
||||
|
||||
class ExtensionPlatform {
|
||||
|
||||
@ -94,7 +94,7 @@ class ExtensionPlatform {
|
||||
|
||||
switchToTab (tabId) {
|
||||
return new Promise((resolve, reject) => {
|
||||
extension.tabs.update(tabId, {highlighted: true}, (tab) => {
|
||||
extension.tabs.update(tabId, { highlighted: true }, (tab) => {
|
||||
const err = checkForError()
|
||||
if (err) {
|
||||
reject(err)
|
||||
|
@ -13,14 +13,14 @@ const ExtensionPlatform = require('./platforms/extension')
|
||||
const NotificationManager = require('./lib/notification-manager')
|
||||
const notificationManager = new NotificationManager()
|
||||
const setupSentry = require('./lib/setupSentry')
|
||||
const {EventEmitter} = require('events')
|
||||
const { EventEmitter } = require('events')
|
||||
const Dnode = require('dnode')
|
||||
const Eth = require('ethjs')
|
||||
const EthQuery = require('eth-query')
|
||||
const urlUtil = require('url')
|
||||
const launchMetaMaskUi = require('../../ui')
|
||||
const StreamProvider = require('web3-stream-provider')
|
||||
const {setupMultiplex} = require('./lib/stream-utils.js')
|
||||
const { setupMultiplex } = require('./lib/stream-utils.js')
|
||||
const log = require('loglevel')
|
||||
|
||||
start().catch(log.error)
|
||||
@ -96,9 +96,9 @@ async function queryCurrentActiveTab (windowType) {
|
||||
return
|
||||
}
|
||||
|
||||
extension.tabs.query({active: true, currentWindow: true}, (tabs) => {
|
||||
extension.tabs.query({ active: true, currentWindow: true }, (tabs) => {
|
||||
const [activeTab] = tabs
|
||||
const {title, url} = activeTab
|
||||
const { title, url } = activeTab
|
||||
const { hostname: origin, protocol } = url ? urlUtil.parse(url) : {}
|
||||
resolve({
|
||||
title, origin, protocol, url,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import React, {Component} from 'react'
|
||||
import React, { Component } from 'react'
|
||||
|
||||
export default class Selector extends Component {
|
||||
state = {}
|
||||
|
10
gulpfile.js
10
gulpfile.js
@ -191,7 +191,7 @@ gulp.task('manifest:production', function () {
|
||||
'./dist/chrome/manifest.json',
|
||||
'./dist/brave/manifest.json',
|
||||
'./dist/opera/manifest.json',
|
||||
], {base: './dist/'})
|
||||
], { base: './dist/' })
|
||||
|
||||
// Exclude chromereload script in production:
|
||||
.pipe(jsoneditor(function (json) {
|
||||
@ -208,7 +208,7 @@ gulp.task('manifest:testing', function () {
|
||||
return gulp.src([
|
||||
'./dist/firefox/manifest.json',
|
||||
'./dist/chrome/manifest.json',
|
||||
], {base: './dist/'})
|
||||
], { base: './dist/' })
|
||||
|
||||
// Exclude chromereload script in production:
|
||||
.pipe(jsoneditor(function (json) {
|
||||
@ -227,7 +227,7 @@ gulp.task('manifest:testing-local', function () {
|
||||
return gulp.src([
|
||||
'./dist/firefox/manifest.json',
|
||||
'./dist/chrome/manifest.json',
|
||||
], {base: './dist/'})
|
||||
], { base: './dist/' })
|
||||
|
||||
.pipe(jsoneditor(function (json) {
|
||||
json.background = {
|
||||
@ -246,7 +246,7 @@ gulp.task('manifest:dev', function () {
|
||||
return gulp.src([
|
||||
'./dist/firefox/manifest.json',
|
||||
'./dist/chrome/manifest.json',
|
||||
], {base: './dist/'})
|
||||
], { base: './dist/' })
|
||||
|
||||
.pipe(jsoneditor(function (json) {
|
||||
json.background = {
|
||||
@ -261,7 +261,7 @@ gulp.task('manifest:dev', function () {
|
||||
})
|
||||
|
||||
gulp.task('optimize:images', function () {
|
||||
return gulp.src('./dist/**/images/**', {base: './dist/'})
|
||||
return gulp.src('./dist/**/images/**', { base: './dist/' })
|
||||
.pipe(imagemin())
|
||||
.pipe(gulp.dest('./dist/', { overwrite: true }))
|
||||
})
|
||||
|
@ -123,7 +123,7 @@ const initialize = () => {
|
||||
}
|
||||
|
||||
const initializeAccountButtons = () => {
|
||||
piggybankContract = web3.eth.contract([{'constant': false, 'inputs': [{'name': 'withdrawAmount', 'type': 'uint256'}], 'name': 'withdraw', 'outputs': [{'name': 'remainingBal', 'type': 'uint256'}], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': true, 'inputs': [], 'name': 'owner', 'outputs': [{'name': '', 'type': 'address'}], 'payable': false, 'stateMutability': 'view', 'type': 'function'}, {'constant': false, 'inputs': [], 'name': 'deposit', 'outputs': [{'name': '', 'type': 'uint256'}], 'payable': true, 'stateMutability': 'payable', 'type': 'function'}, {'inputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'constructor'}])
|
||||
piggybankContract = web3.eth.contract([{ 'constant': false, 'inputs': [{ 'name': 'withdrawAmount', 'type': 'uint256' }], 'name': 'withdraw', 'outputs': [{ 'name': 'remainingBal', 'type': 'uint256' }], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function' }, { 'constant': true, 'inputs': [], 'name': 'owner', 'outputs': [{ 'name': '', 'type': 'address' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' }, { 'constant': false, 'inputs': [], 'name': 'deposit', 'outputs': [{ 'name': '', 'type': 'uint256' }], 'payable': true, 'stateMutability': 'payable', 'type': 'function' }, { 'inputs': [], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'constructor' }])
|
||||
deployButton.onclick = async () => {
|
||||
contractStatus.innerHTML = 'Deploying'
|
||||
|
||||
@ -190,7 +190,7 @@ const initialize = () => {
|
||||
const _tokenName = 'TST'
|
||||
const _decimalUnits = 0
|
||||
const _tokenSymbol = 'TST'
|
||||
const humanstandardtokenContract = web3.eth.contract([{'constant': true, 'inputs': [], 'name': 'name', 'outputs': [{'name': '', 'type': 'string'}], 'payable': false, 'stateMutability': 'view', 'type': 'function'}, {'constant': false, 'inputs': [{'name': '_spender', 'type': 'address'}, {'name': '_value', 'type': 'uint256'}], 'name': 'approve', 'outputs': [{'name': 'success', 'type': 'bool'}], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': true, 'inputs': [], 'name': 'totalSupply', 'outputs': [{'name': '', 'type': 'uint256'}], 'payable': false, 'stateMutability': 'view', 'type': 'function'}, {'constant': false, 'inputs': [{'name': '_from', 'type': 'address'}, {'name': '_to', 'type': 'address'}, {'name': '_value', 'type': 'uint256'}], 'name': 'transferFrom', 'outputs': [{'name': 'success', 'type': 'bool'}], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': true, 'inputs': [], 'name': 'decimals', 'outputs': [{'name': '', 'type': 'uint8'}], 'payable': false, 'stateMutability': 'view', 'type': 'function'}, {'constant': true, 'inputs': [], 'name': 'version', 'outputs': [{'name': '', 'type': 'string'}], 'payable': false, 'stateMutability': 'view', 'type': 'function'}, {'constant': true, 'inputs': [{'name': '_owner', 'type': 'address'}], 'name': 'balanceOf', 'outputs': [{'name': 'balance', 'type': 'uint256'}], 'payable': false, 'stateMutability': 'view', 'type': 'function'}, {'constant': true, 'inputs': [], 'name': 'symbol', 'outputs': [{'name': '', 'type': 'string'}], 'payable': false, 'stateMutability': 'view', 'type': 'function'}, {'constant': false, 'inputs': [{'name': '_to', 'type': 'address'}, {'name': '_value', 'type': 'uint256'}], 'name': 'transfer', 'outputs': [{'name': 'success', 'type': 'bool'}], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': false, 'inputs': [{'name': '_spender', 'type': 'address'}, {'name': '_value', 'type': 'uint256'}, {'name': '_extraData', 'type': 'bytes'}], 'name': 'approveAndCall', 'outputs': [{'name': 'success', 'type': 'bool'}], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function'}, {'constant': true, 'inputs': [{'name': '_owner', 'type': 'address'}, {'name': '_spender', 'type': 'address'}], 'name': 'allowance', 'outputs': [{'name': 'remaining', 'type': 'uint256'}], 'payable': false, 'stateMutability': 'view', 'type': 'function'}, {'inputs': [{'name': '_initialAmount', 'type': 'uint256'}, {'name': '_tokenName', 'type': 'string'}, {'name': '_decimalUnits', 'type': 'uint8'}, {'name': '_tokenSymbol', 'type': 'string'}], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'constructor'}, {'payable': false, 'stateMutability': 'nonpayable', 'type': 'fallback'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': '_from', 'type': 'address'}, {'indexed': true, 'name': '_to', 'type': 'address'}, {'indexed': false, 'name': '_value', 'type': 'uint256'}], 'name': 'Transfer', 'type': 'event'}, {'anonymous': false, 'inputs': [{'indexed': true, 'name': '_owner', 'type': 'address'}, {'indexed': true, 'name': '_spender', 'type': 'address'}, {'indexed': false, 'name': '_value', 'type': 'uint256'}], 'name': 'Approval', 'type': 'event'}])
|
||||
const humanstandardtokenContract = web3.eth.contract([{ 'constant': true, 'inputs': [], 'name': 'name', 'outputs': [{ 'name': '', 'type': 'string' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' }, { 'constant': false, 'inputs': [{ 'name': '_spender', 'type': 'address' }, { 'name': '_value', 'type': 'uint256' }], 'name': 'approve', 'outputs': [{ 'name': 'success', 'type': 'bool' }], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function' }, { 'constant': true, 'inputs': [], 'name': 'totalSupply', 'outputs': [{ 'name': '', 'type': 'uint256' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' }, { 'constant': false, 'inputs': [{ 'name': '_from', 'type': 'address' }, { 'name': '_to', 'type': 'address' }, { 'name': '_value', 'type': 'uint256' }], 'name': 'transferFrom', 'outputs': [{ 'name': 'success', 'type': 'bool' }], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function' }, { 'constant': true, 'inputs': [], 'name': 'decimals', 'outputs': [{ 'name': '', 'type': 'uint8' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' }, { 'constant': true, 'inputs': [], 'name': 'version', 'outputs': [{ 'name': '', 'type': 'string' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' }, { 'constant': true, 'inputs': [{ 'name': '_owner', 'type': 'address' }], 'name': 'balanceOf', 'outputs': [{ 'name': 'balance', 'type': 'uint256' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' }, { 'constant': true, 'inputs': [], 'name': 'symbol', 'outputs': [{ 'name': '', 'type': 'string' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' }, { 'constant': false, 'inputs': [{ 'name': '_to', 'type': 'address' }, { 'name': '_value', 'type': 'uint256' }], 'name': 'transfer', 'outputs': [{ 'name': 'success', 'type': 'bool' }], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function' }, { 'constant': false, 'inputs': [{ 'name': '_spender', 'type': 'address' }, { 'name': '_value', 'type': 'uint256' }, { 'name': '_extraData', 'type': 'bytes' }], 'name': 'approveAndCall', 'outputs': [{ 'name': 'success', 'type': 'bool' }], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'function' }, { 'constant': true, 'inputs': [{ 'name': '_owner', 'type': 'address' }, { 'name': '_spender', 'type': 'address' }], 'name': 'allowance', 'outputs': [{ 'name': 'remaining', 'type': 'uint256' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' }, { 'inputs': [{ 'name': '_initialAmount', 'type': 'uint256' }, { 'name': '_tokenName', 'type': 'string' }, { 'name': '_decimalUnits', 'type': 'uint8' }, { 'name': '_tokenSymbol', 'type': 'string' }], 'payable': false, 'stateMutability': 'nonpayable', 'type': 'constructor' }, { 'payable': false, 'stateMutability': 'nonpayable', 'type': 'fallback' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'name': '_from', 'type': 'address' }, { 'indexed': true, 'name': '_to', 'type': 'address' }, { 'indexed': false, 'name': '_value', 'type': 'uint256' }], 'name': 'Transfer', 'type': 'event' }, { 'anonymous': false, 'inputs': [{ 'indexed': true, 'name': '_owner', 'type': 'address' }, { 'indexed': true, 'name': '_spender', 'type': 'address' }, { 'indexed': false, 'name': '_value', 'type': 'uint256' }], 'name': 'Approval', 'type': 'event' }])
|
||||
|
||||
return humanstandardtokenContract.new(
|
||||
_initialAmount,
|
||||
|
@ -97,7 +97,7 @@ async function setupFetchMocking (driver) {
|
||||
return window.origFetch(...args)
|
||||
}
|
||||
if (window.chrome && window.chrome.webRequest) {
|
||||
window.chrome.webRequest.onBeforeRequest.addListener(cancelInfuraRequest, {urls: ['https://*.infura.io/*']}, ['blocking'])
|
||||
window.chrome.webRequest.onBeforeRequest.addListener(cancelInfuraRequest, { urls: ['https://*.infura.io/*'] }, ['blocking'])
|
||||
}
|
||||
function cancelInfuraRequest (requestDetails) {
|
||||
console.log(`fetchMocking - Canceling request: "${requestDetails.url}"`)
|
||||
|
@ -12,14 +12,14 @@ function shallowWithStore (component, store) {
|
||||
const context = {
|
||||
store,
|
||||
}
|
||||
return shallow(component, {context})
|
||||
return shallow(component, { context })
|
||||
}
|
||||
|
||||
function mountWithStore (component, store) {
|
||||
const context = {
|
||||
store,
|
||||
}
|
||||
return mount(component, {context})
|
||||
return mount(component, { context })
|
||||
}
|
||||
|
||||
function mountWithRouter (node) {
|
||||
|
@ -6,7 +6,7 @@ const BalanceController = require('../../../../app/scripts/controllers/balance')
|
||||
const AccountTracker = require('../../../../app/scripts/lib/account-tracker')
|
||||
const TransactionController = require('../../../../app/scripts/controllers/transactions')
|
||||
const { createTestProviderTools } = require('../../../stub/provider')
|
||||
const provider = createTestProviderTools({ scaffold: {}}).provider
|
||||
const provider = createTestProviderTools({ scaffold: {} }).provider
|
||||
|
||||
const TEST_ADDRESS = '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc'
|
||||
|
||||
|
@ -23,7 +23,7 @@ describe('DetectTokensController', () => {
|
||||
.get(/.*/)
|
||||
.reply(200)
|
||||
|
||||
keyringMemStore = new ObservableStore({ isUnlocked: false})
|
||||
keyringMemStore = new ObservableStore({ isUnlocked: false })
|
||||
network = new NetworkController()
|
||||
preferences = new PreferencesController({ network })
|
||||
controller = new DetectTokensController({ preferences: preferences, network: network, keyringMemStore: keyringMemStore })
|
||||
@ -90,8 +90,8 @@ describe('DetectTokensController', () => {
|
||||
.returns(preferences.addToken('0xbc86727e770de68b1060c91f6bb6945c73e10388', 'XNK', 18))
|
||||
|
||||
await controller.detectNewTokens()
|
||||
assert.deepEqual(preferences.store.getState().tokens, [{address: '0x0d262e5dc4a06a0f1c90ce79c7a60c09dfc884e4', decimals: 8, symbol: 'J8T'},
|
||||
{address: '0xbc86727e770de68b1060c91f6bb6945c73e10388', decimals: 18, symbol: 'XNK'}])
|
||||
assert.deepEqual(preferences.store.getState().tokens, [{ address: '0x0d262e5dc4a06a0f1c90ce79c7a60c09dfc884e4', decimals: 8, symbol: 'J8T' },
|
||||
{ address: '0xbc86727e770de68b1060c91f6bb6945c73e10388', decimals: 18, symbol: 'XNK' }])
|
||||
})
|
||||
|
||||
it('should not detect same token while in main network', async () => {
|
||||
@ -107,8 +107,8 @@ describe('DetectTokensController', () => {
|
||||
.returns(preferences.addToken('0xbc86727e770de68b1060c91f6bb6945c73e10388', 'XNK', 18))
|
||||
|
||||
await controller.detectNewTokens()
|
||||
assert.deepEqual(preferences.store.getState().tokens, [{address: '0x0d262e5dc4a06a0f1c90ce79c7a60c09dfc884e4', decimals: 8, symbol: 'J8T'},
|
||||
{address: '0xbc86727e770de68b1060c91f6bb6945c73e10388', decimals: 18, symbol: 'XNK'}])
|
||||
assert.deepEqual(preferences.store.getState().tokens, [{ address: '0x0d262e5dc4a06a0f1c90ce79c7a60c09dfc884e4', decimals: 8, symbol: 'J8T' },
|
||||
{ address: '0xbc86727e770de68b1060c91f6bb6945c73e10388', decimals: 18, symbol: 'XNK' }])
|
||||
})
|
||||
|
||||
it('should trigger detect new tokens when change address', async () => {
|
||||
|
@ -4,7 +4,7 @@ const InfuraController = require('../../../../app/scripts/controllers/infura')
|
||||
|
||||
describe('infura-controller', function () {
|
||||
let infuraController, sandbox, networkStatus
|
||||
const response = {'mainnet': 'degraded', 'ropsten': 'ok', 'kovan': 'ok', 'rinkeby': 'down', 'goerli': 'ok'}
|
||||
const response = { 'mainnet': 'degraded', 'ropsten': 'ok', 'kovan': 'ok', 'rinkeby': 'down', 'goerli': 'ok' }
|
||||
|
||||
before(async function () {
|
||||
infuraController = new InfuraController()
|
||||
|
@ -193,8 +193,8 @@ describe('MetaMaskController', function () {
|
||||
recentBlocks: [
|
||||
{ gasPrices: [ '0x3b9aca00', '0x174876e800'] },
|
||||
{ gasPrices: [ '0x3b9aca00', '0x174876e800'] },
|
||||
{ gasPrices: [ '0x174876e800', '0x174876e800' ]},
|
||||
{ gasPrices: [ '0x174876e800', '0x174876e800' ]},
|
||||
{ gasPrices: [ '0x174876e800', '0x174876e800' ] },
|
||||
{ gasPrices: [ '0x174876e800', '0x174876e800' ] },
|
||||
],
|
||||
}
|
||||
},
|
||||
@ -610,10 +610,10 @@ describe('MetaMaskController', function () {
|
||||
getNetworkstub.returns(42)
|
||||
|
||||
metamaskController.txController.txStateManager._saveTxList([
|
||||
createTxMeta({ id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {from: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc'} }),
|
||||
createTxMeta({ id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {from: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc'} }),
|
||||
createTxMeta({ id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: { from: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc' } }),
|
||||
createTxMeta({ id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: { from: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc' } }),
|
||||
createTxMeta({ id: 2, status: 'rejected', metamaskNetworkId: 32 }),
|
||||
createTxMeta({ id: 3, status: 'submitted', metamaskNetworkId: currentNetworkId, txParams: {from: '0xB09d8505E1F4EF1CeA089D47094f5DD3464083d4'} }),
|
||||
createTxMeta({ id: 3, status: 'submitted', metamaskNetworkId: currentNetworkId, txParams: { from: '0xB09d8505E1F4EF1CeA089D47094f5DD3464083d4' } }),
|
||||
])
|
||||
})
|
||||
|
||||
@ -876,7 +876,7 @@ describe('MetaMaskController', function () {
|
||||
})
|
||||
|
||||
const oldState = metamaskController.getState()
|
||||
await metamaskController._onKeyringControllerUpdate({keyrings: []})
|
||||
await metamaskController._onKeyringControllerUpdate({ keyrings: [] })
|
||||
|
||||
assert.ok(addAddresses.notCalled)
|
||||
assert.ok(syncWithAddresses.notCalled)
|
||||
|
@ -7,7 +7,7 @@ describe('#createPendingNonceMiddleware', function () {
|
||||
const pendingNonceMiddleware = createPendingNonceMiddleware({ getPendingNonce })
|
||||
|
||||
it('should call next if not a eth_getTransactionCount request', (done) => {
|
||||
const req = {method: 'eth_getBlockByNumber'}
|
||||
const req = { method: 'eth_getBlockByNumber' }
|
||||
const res = {}
|
||||
pendingNonceMiddleware(req, res, () => done())
|
||||
})
|
||||
@ -50,7 +50,7 @@ describe('#createPendingTxMiddleware', function () {
|
||||
's': '0x0259b52ee8c58baaa385fb05c3f96116e58de89bcc165cb3bfdfc708672fed8a',
|
||||
}
|
||||
it('should call next if not a eth_getTransactionByHash request', (done) => {
|
||||
const req = {method: 'eth_getBlockByNumber'}
|
||||
const req = { method: 'eth_getBlockByNumber' }
|
||||
const res = {}
|
||||
pendingTxMiddleware(req, res, () => done())
|
||||
})
|
||||
|
@ -9,7 +9,7 @@ describe('preferences controller', function () {
|
||||
let network
|
||||
|
||||
beforeEach(() => {
|
||||
network = {providerStore: new ObservableStore({ type: 'mainnet' })}
|
||||
network = { providerStore: new ObservableStore({ type: 'mainnet' }) }
|
||||
preferencesController = new PreferencesController({ network })
|
||||
})
|
||||
|
||||
@ -20,7 +20,7 @@ describe('preferences controller', function () {
|
||||
'0x7e57e2',
|
||||
])
|
||||
|
||||
const {identities} = preferencesController.store.getState()
|
||||
const { identities } = preferencesController.store.getState()
|
||||
assert.deepEqual(identities, {
|
||||
'0xda22le': {
|
||||
name: 'Account 1',
|
||||
@ -57,7 +57,7 @@ describe('preferences controller', function () {
|
||||
'0x7e57e277',
|
||||
])
|
||||
|
||||
const {identities} = preferencesController.store.getState()
|
||||
const { identities } = preferencesController.store.getState()
|
||||
assert.deepEqual(identities, {
|
||||
'0xda22le77': {
|
||||
name: 'Account 1',
|
||||
@ -246,7 +246,7 @@ describe('preferences controller', function () {
|
||||
assert.equal(tokens.length, 1, 'one token removed')
|
||||
|
||||
const [token1] = tokens
|
||||
assert.deepEqual(token1, {address: '0xb', symbol: 'B', decimals: 5})
|
||||
assert.deepEqual(token1, { address: '0xb', symbol: 'B', decimals: 5 })
|
||||
})
|
||||
|
||||
it('should remove a token from its state on corresponding address', async function () {
|
||||
@ -264,7 +264,7 @@ describe('preferences controller', function () {
|
||||
assert.equal(tokensFirst.length, 1, 'one token removed in account')
|
||||
|
||||
const [token1] = tokensFirst
|
||||
assert.deepEqual(token1, {address: '0xb', symbol: 'B', decimals: 5})
|
||||
assert.deepEqual(token1, { address: '0xb', symbol: 'B', decimals: 5 })
|
||||
|
||||
await preferencesController.setSelectedAddress('0x7e57e3')
|
||||
const tokensSecond = preferencesController.getTokens()
|
||||
@ -286,7 +286,7 @@ describe('preferences controller', function () {
|
||||
assert.equal(tokensFirst.length, 1, 'one token removed in network')
|
||||
|
||||
const [token1] = tokensFirst
|
||||
assert.deepEqual(token1, {address: '0xb', symbol: 'B', decimals: 5})
|
||||
assert.deepEqual(token1, { address: '0xb', symbol: 'B', decimals: 5 })
|
||||
|
||||
network.providerStore.updateState({ type: 'rinkeby' })
|
||||
const tokensSecond = preferencesController.getTokens()
|
||||
@ -347,9 +347,9 @@ describe('preferences controller', function () {
|
||||
const sandbox = sinon.createSandbox()
|
||||
|
||||
beforeEach(() => {
|
||||
req = {params: {}}
|
||||
req = { params: {} }
|
||||
res = {}
|
||||
asy = {next: () => {}, end: () => {}}
|
||||
asy = { next: () => {}, end: () => {} }
|
||||
stubNext = sandbox.stub(asy, 'next')
|
||||
stubEnd = sandbox.stub(asy, 'end').returns(0)
|
||||
stubHandleWatchAssetERC20 = sandbox.stub(preferencesController, '_handleWatchAssetERC20')
|
||||
@ -359,7 +359,7 @@ describe('preferences controller', function () {
|
||||
})
|
||||
|
||||
it('shouldn not do anything if method not corresponds', async function () {
|
||||
const asy = {next: () => {}, end: () => {}}
|
||||
const asy = { next: () => {}, end: () => {} }
|
||||
const stubNext = sandbox.stub(asy, 'next')
|
||||
const stubEnd = sandbox.stub(asy, 'end').returns(0)
|
||||
req.method = 'metamask'
|
||||
@ -368,7 +368,7 @@ describe('preferences controller', function () {
|
||||
sandbox.assert.called(stubNext)
|
||||
})
|
||||
it('should do something if method is supported', async function () {
|
||||
const asy = {next: () => {}, end: () => {}}
|
||||
const asy = { next: () => {}, end: () => {} }
|
||||
const stubNext = sandbox.stub(asy, 'next')
|
||||
const stubEnd = sandbox.stub(asy, 'end').returns(0)
|
||||
req.method = 'metamask_watchAsset'
|
||||
@ -392,7 +392,7 @@ describe('preferences controller', function () {
|
||||
assert.deepEqual(res, {})
|
||||
})
|
||||
it('should trigger handle add asset if type supported', async function () {
|
||||
const asy = {next: () => {}, end: () => {}}
|
||||
const asy = { next: () => {}, end: () => {} }
|
||||
req.method = 'metamask_watchAsset'
|
||||
req.params.type = 'ERC20'
|
||||
await preferencesController.requestWatchAsset(req, res, asy.next, asy.end)
|
||||
@ -405,7 +405,7 @@ describe('preferences controller', function () {
|
||||
|
||||
const sandbox = sinon.createSandbox()
|
||||
beforeEach(() => {
|
||||
req = {params: {type: 'ERC20'}}
|
||||
req = { params: { type: 'ERC20' } }
|
||||
})
|
||||
after(() => {
|
||||
sandbox.restore()
|
||||
@ -457,42 +457,42 @@ describe('preferences controller', function () {
|
||||
it('should validate ERC20 asset correctly', async function () {
|
||||
const validateSpy = sandbox.spy(preferencesController._validateERC20AssetParams)
|
||||
try {
|
||||
validateSpy({rawAddress: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', symbol: 'ABC', decimals: 0})
|
||||
validateSpy({ rawAddress: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', symbol: 'ABC', decimals: 0 })
|
||||
} catch (e) {}
|
||||
assert.equal(validateSpy.threw(), false, 'correct options object')
|
||||
const validateSpyAddress = sandbox.spy(preferencesController._validateERC20AssetParams)
|
||||
try {
|
||||
validateSpyAddress({symbol: 'ABC', decimals: 0})
|
||||
validateSpyAddress({ symbol: 'ABC', decimals: 0 })
|
||||
} catch (e) {}
|
||||
assert.equal(validateSpyAddress.threw(), true, 'options object with no address')
|
||||
const validateSpySymbol = sandbox.spy(preferencesController._validateERC20AssetParams)
|
||||
try {
|
||||
validateSpySymbol({rawAddress: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', decimals: 0})
|
||||
validateSpySymbol({ rawAddress: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', decimals: 0 })
|
||||
} catch (e) {}
|
||||
assert.equal(validateSpySymbol.threw(), true, 'options object with no symbol')
|
||||
const validateSpyDecimals = sandbox.spy(preferencesController._validateERC20AssetParams)
|
||||
try {
|
||||
validateSpyDecimals({rawAddress: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', symbol: 'ABC'})
|
||||
validateSpyDecimals({ rawAddress: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', symbol: 'ABC' })
|
||||
} catch (e) {}
|
||||
assert.equal(validateSpyDecimals.threw(), true, 'options object with no decimals')
|
||||
const validateSpyInvalidSymbol = sandbox.spy(preferencesController._validateERC20AssetParams)
|
||||
try {
|
||||
validateSpyInvalidSymbol({rawAddress: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', symbol: 'ABCDEFGHI', decimals: 0})
|
||||
validateSpyInvalidSymbol({ rawAddress: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', symbol: 'ABCDEFGHI', decimals: 0 })
|
||||
} catch (e) {}
|
||||
assert.equal(validateSpyInvalidSymbol.threw(), true, 'options object with invalid symbol')
|
||||
const validateSpyInvalidDecimals1 = sandbox.spy(preferencesController._validateERC20AssetParams)
|
||||
try {
|
||||
validateSpyInvalidDecimals1({rawAddress: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', symbol: 'ABCDEFGHI', decimals: -1})
|
||||
validateSpyInvalidDecimals1({ rawAddress: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', symbol: 'ABCDEFGHI', decimals: -1 })
|
||||
} catch (e) {}
|
||||
assert.equal(validateSpyInvalidDecimals1.threw(), true, 'options object with decimals less than zero')
|
||||
const validateSpyInvalidDecimals2 = sandbox.spy(preferencesController._validateERC20AssetParams)
|
||||
try {
|
||||
validateSpyInvalidDecimals2({rawAddress: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', symbol: 'ABCDEFGHI', decimals: 38})
|
||||
validateSpyInvalidDecimals2({ rawAddress: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', symbol: 'ABCDEFGHI', decimals: 38 })
|
||||
} catch (e) {}
|
||||
assert.equal(validateSpyInvalidDecimals2.threw(), true, 'options object with decimals more than 36')
|
||||
const validateSpyInvalidAddress = sandbox.spy(preferencesController._validateERC20AssetParams)
|
||||
try {
|
||||
validateSpyInvalidAddress({rawAddress: '0x123', symbol: 'ABC', decimals: 0})
|
||||
validateSpyInvalidAddress({ rawAddress: '0x123', symbol: 'ABC', decimals: 0 })
|
||||
} catch (e) {}
|
||||
assert.equal(validateSpyInvalidAddress.threw(), true, 'options object with address invalid')
|
||||
})
|
||||
@ -515,7 +515,7 @@ describe('preferences controller', function () {
|
||||
|
||||
describe('#updateRpc', function () {
|
||||
it('should update the rpcDetails properly', () => {
|
||||
preferencesController.store.updateState({frequentRpcListDetail: [{}, { rpcUrl: 'test' }, {}]})
|
||||
preferencesController.store.updateState({ frequentRpcListDetail: [{}, { rpcUrl: 'test' }, {}] })
|
||||
preferencesController.updateRpc({ rpcUrl: 'test', chainId: 1 })
|
||||
preferencesController.updateRpc({ rpcUrl: 'test/1', chainId: 1 })
|
||||
preferencesController.updateRpc({ rpcUrl: 'test/2', chainId: 1 })
|
||||
|
@ -27,7 +27,7 @@ describe('PendingTransactionTracker', function () {
|
||||
id: 2,
|
||||
history: [{}],
|
||||
status: 'submitted',
|
||||
txParams: { from: '0x1678a085c290ebd122dc42cba69373b5953b831d'},
|
||||
txParams: { from: '0x1678a085c290ebd122dc42cba69373b5953b831d' },
|
||||
}
|
||||
|
||||
providerResultStub = {}
|
||||
@ -51,7 +51,7 @@ describe('PendingTransactionTracker', function () {
|
||||
})
|
||||
|
||||
pendingTxTracker._getBlock = (blockNumber) => {
|
||||
return {number: blockNumber, transactions: []}
|
||||
return { number: blockNumber, transactions: [] }
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -96,15 +96,15 @@ describe('Transaction Controller', function () {
|
||||
'to': '0xc684832530fcbddae4b4230a47e991ddcec2831d',
|
||||
}
|
||||
txController.txStateManager._saveTxList([
|
||||
{id: 0, status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{id: 1, status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{id: 2, status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{id: 3, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{id: 4, status: 'rejected', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{id: 5, status: 'approved', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{id: 6, status: 'signed', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{id: 7, status: 'submitted', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{id: 8, status: 'failed', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{ id: 0, status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{ id: 1, status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{ id: 2, status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{ id: 3, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{ id: 4, status: 'rejected', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{ id: 5, status: 'approved', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{ id: 6, status: 'signed', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{ id: 7, status: 'submitted', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
{ id: 8, status: 'failed', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
])
|
||||
})
|
||||
|
||||
@ -226,7 +226,7 @@ describe('Transaction Controller', function () {
|
||||
})
|
||||
|
||||
it('should fail if the from address isn\'t the selected address', function (done) {
|
||||
txController.addUnapprovedTransaction({from: '0x0d1d4e623D10F9FBA5Db95830F7d3839406C6AF2'})
|
||||
txController.addUnapprovedTransaction({ from: '0x0d1d4e623D10F9FBA5Db95830F7d3839406C6AF2' })
|
||||
.then(function () {
|
||||
assert.fail('transaction should not have been added')
|
||||
done()
|
||||
@ -448,7 +448,7 @@ describe('Transaction Controller', function () {
|
||||
{ id: 1, status: 'submitted', metamaskNetworkId: currentNetworkId, txParams, history: [{}] },
|
||||
])
|
||||
|
||||
expectedTxParams = Object.assign({}, txParams, { gasPrice: '0xb'})
|
||||
expectedTxParams = Object.assign({}, txParams, { gasPrice: '0xb' })
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
|
@ -354,13 +354,13 @@ describe('TransactionStateManager', function () {
|
||||
|
||||
describe('#_removeTx', function () {
|
||||
it('should remove the transaction from the storage', () => {
|
||||
txStateManager._saveTxList([ {id: 1} ])
|
||||
txStateManager._saveTxList([ { id: 1 } ])
|
||||
txStateManager._removeTx(1)
|
||||
assert(!txStateManager.getFullTxList().length, 'txList should be empty')
|
||||
})
|
||||
|
||||
it('should only remove the transaction with ID 1 from the storage', () => {
|
||||
txStateManager._saveTxList([ {id: 1}, {id: 2} ])
|
||||
txStateManager._saveTxList([ { id: 1 }, { id: 2 } ])
|
||||
txStateManager._removeTx(1)
|
||||
assert.equal(txStateManager.getFullTxList()[0].id, 2, 'txList should have a id of 2')
|
||||
})
|
||||
|
@ -28,19 +28,19 @@ describe('Typed Message Manager', () => {
|
||||
data: JSON.stringify({
|
||||
'types': {
|
||||
'EIP712Domain': [
|
||||
{'name': 'name', 'type': 'string' },
|
||||
{'name': 'version', 'type': 'string' },
|
||||
{'name': 'chainId', 'type': 'uint256' },
|
||||
{'name': 'verifyingContract', 'type': 'address' },
|
||||
{ 'name': 'name', 'type': 'string' },
|
||||
{ 'name': 'version', 'type': 'string' },
|
||||
{ 'name': 'chainId', 'type': 'uint256' },
|
||||
{ 'name': 'verifyingContract', 'type': 'address' },
|
||||
],
|
||||
'Person': [
|
||||
{'name': 'name', 'type': 'string' },
|
||||
{'name': 'wallet', 'type': 'address' },
|
||||
{ 'name': 'name', 'type': 'string' },
|
||||
{ 'name': 'wallet', 'type': 'address' },
|
||||
],
|
||||
'Mail': [
|
||||
{'name': 'from', 'type': 'Person' },
|
||||
{'name': 'to', 'type': 'Person' },
|
||||
{'name': 'contents', 'type': 'string' },
|
||||
{ 'name': 'from', 'type': 'Person' },
|
||||
{ 'name': 'to', 'type': 'Person' },
|
||||
{ 'name': 'contents', 'type': 'string' },
|
||||
],
|
||||
},
|
||||
'primaryType': 'Mail',
|
||||
|
@ -8,7 +8,7 @@ const storage = {
|
||||
'transactions': [
|
||||
{ 'status': 'submitted' },
|
||||
{ 'status': 'submitted', 'submittedTime': properTime },
|
||||
{'status': 'confirmed'},
|
||||
{ 'status': 'confirmed' },
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -40,17 +40,17 @@ while (transactions.length <= 100) {
|
||||
if (!deletableTxStates.find((s) => s === status)) {
|
||||
nonDeletableCount++
|
||||
}
|
||||
transactions.push({status})
|
||||
transactions.push({ status })
|
||||
}
|
||||
|
||||
while (transactions40.length < 40) {
|
||||
status = txStates[Math.floor(Math.random() * Math.floor(txStates.length - 1))]
|
||||
transactions40.push({status})
|
||||
transactions40.push({ status })
|
||||
}
|
||||
|
||||
while (transactions20.length < 20) {
|
||||
status = txStates[Math.floor(Math.random() * Math.floor(txStates.length - 1))]
|
||||
transactions20.push({status})
|
||||
transactions20.push({ status })
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
const assert = require('assert')
|
||||
const migration26 = require('../../../app/scripts/migrations/026')
|
||||
const oldStorage = {
|
||||
'meta': {'version': 25},
|
||||
'meta': { 'version': 25 },
|
||||
'data': {
|
||||
'PreferencesController': {},
|
||||
'KeyringController': {
|
||||
@ -19,8 +19,8 @@ describe('migration #26', () => {
|
||||
.then((newStorage) => {
|
||||
const identities = newStorage.data.PreferencesController.identities
|
||||
assert.deepEqual(identities, {
|
||||
'0x1e77e2': {name: 'Test Account 1', address: '0x1e77e2'},
|
||||
'0x7e57e2': {name: 'Test Account 2', address: '0x7e57e2'},
|
||||
'0x1e77e2': { name: 'Test Account 1', address: '0x1e77e2' },
|
||||
'0x7e57e2': { name: 'Test Account 2', address: '0x7e57e2' },
|
||||
})
|
||||
assert.strictEqual(newStorage.data.KeyringController.walletNicknames, undefined)
|
||||
done()
|
||||
|
@ -15,9 +15,9 @@ const transactions = []
|
||||
|
||||
|
||||
while (transactions.length < 9) {
|
||||
transactions.push({status: 'rejected'})
|
||||
transactions.push({status: 'unapproved'})
|
||||
transactions.push({status: 'approved'})
|
||||
transactions.push({ status: 'rejected' })
|
||||
transactions.push({ status: 'unapproved' })
|
||||
transactions.push({ status: 'approved' })
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@ const oldStorage = {
|
||||
'meta': {},
|
||||
'data': {
|
||||
'PreferencesController': {
|
||||
'tokens': [{address: '0xa', symbol: 'A', decimals: 4}, {address: '0xb', symbol: 'B', decimals: 4}],
|
||||
'tokens': [{ address: '0xa', symbol: 'A', decimals: 4 }, { address: '0xb', symbol: 'B', decimals: 4 }],
|
||||
'identities': {
|
||||
'0x6d14': {},
|
||||
'0x3695': {},
|
||||
@ -21,7 +21,7 @@ describe('migration #28', () => {
|
||||
const newTokens = newStorage.data.PreferencesController.tokens
|
||||
const newAccountTokens = newStorage.data.PreferencesController.accountTokens
|
||||
|
||||
const testTokens = [{address: '0xa', symbol: 'A', decimals: 4}, {address: '0xb', symbol: 'B', decimals: 4}]
|
||||
const testTokens = [{ address: '0xa', symbol: 'A', decimals: 4 }, { address: '0xb', symbol: 'B', decimals: 4 }]
|
||||
assert.equal(newTokens.length, 0, 'tokens is expected to have the length of 0')
|
||||
assert.equal(newAccountTokens['0x6d14']['mainnet'].length, 2, 'tokens for address is expected to have the length of 2')
|
||||
assert.equal(newAccountTokens['0x3695']['mainnet'].length, 2, 'tokens for address is expected to have the length of 2')
|
||||
|
@ -15,8 +15,8 @@ const storage = {
|
||||
},
|
||||
PreferencesController: {
|
||||
frequentRpcListDetail: [
|
||||
{chainId: 'fail', nickname: '', rpcUrl: 'http://127.0.0.1:8545', ticker: ''},
|
||||
{chainId: '1', nickname: '', rpcUrl: 'https://api.myetherwallet.com/eth', ticker: 'ETH'},
|
||||
{ chainId: 'fail', nickname: '', rpcUrl: 'http://127.0.0.1:8545', ticker: '' },
|
||||
{ chainId: '1', nickname: '', rpcUrl: 'https://api.myetherwallet.com/eth', ticker: 'ETH' },
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -7,7 +7,7 @@ describe('migration #31', () => {
|
||||
'meta': {},
|
||||
'data': {
|
||||
'PreferencesController': {
|
||||
'tokens': [{address: '0xa', symbol: 'A', decimals: 4}, {address: '0xb', symbol: 'B', decimals: 4}],
|
||||
'tokens': [{ address: '0xa', symbol: 'A', decimals: 4 }, { address: '0xb', symbol: 'B', decimals: 4 }],
|
||||
'identities': {
|
||||
'0x6d14': {},
|
||||
'0x3695': {},
|
||||
@ -36,7 +36,7 @@ describe('migration #31', () => {
|
||||
'meta': {},
|
||||
'data': {
|
||||
'PreferencesController': {
|
||||
'tokens': [{address: '0xa', symbol: 'A', decimals: 4}, {address: '0xb', symbol: 'B', decimals: 4}],
|
||||
'tokens': [{ address: '0xa', symbol: 'A', decimals: 4 }, { address: '0xb', symbol: 'B', decimals: 4 }],
|
||||
'identities': {
|
||||
'0x6d14': {},
|
||||
'0x3695': {},
|
||||
|
@ -29,7 +29,7 @@ const stubMigrations = [
|
||||
},
|
||||
},
|
||||
]
|
||||
const versionedData = {meta: {version: 0}, data: {hello: 'world'}}
|
||||
const versionedData = { meta: { version: 0 }, data: { hello: 'world' } }
|
||||
|
||||
const firstTimeState = {
|
||||
meta: { version: 0 },
|
||||
@ -62,7 +62,7 @@ describe('Migrator', () => {
|
||||
throw new Error('test')
|
||||
} } ] })
|
||||
migrator.on('error', () => done())
|
||||
migrator.migrateData({ meta: {version: 0} })
|
||||
migrator.migrateData({ meta: { version: 0 } })
|
||||
.then(() => {
|
||||
}).catch(done)
|
||||
})
|
||||
|
@ -32,7 +32,7 @@ describe('App State', () => {
|
||||
|
||||
it('sets networkd dropdown to false', () => {
|
||||
const dropdown = { networkDropdowopen: true }
|
||||
const state = {...metamaskState, ...dropdown}
|
||||
const state = { ...metamaskState, ...dropdown }
|
||||
const newState = reduceApp(state, {
|
||||
type: actions.NETWORK_DROPDOWN_CLOSE,
|
||||
})
|
||||
@ -55,8 +55,8 @@ describe('App State', () => {
|
||||
})
|
||||
|
||||
it('closes sidebar', () => {
|
||||
const openSidebar = { sidebar: { isOpen: true }}
|
||||
const state = {...metamaskState, ...openSidebar}
|
||||
const openSidebar = { sidebar: { isOpen: true } }
|
||||
const state = { ...metamaskState, ...openSidebar }
|
||||
|
||||
const newState = reduceApp(state, {
|
||||
type: actions.SIDEBAR_CLOSE,
|
||||
@ -77,7 +77,7 @@ describe('App State', () => {
|
||||
|
||||
it('closes alert', () => {
|
||||
const alert = { alertOpen: true, alertMessage: 'test message' }
|
||||
const state = {...metamaskState, ...alert}
|
||||
const state = { ...metamaskState, ...alert }
|
||||
const newState = reduceApp(state, {
|
||||
type: actions.ALERT_CLOSE,
|
||||
})
|
||||
@ -451,7 +451,7 @@ describe('App State', () => {
|
||||
},
|
||||
}
|
||||
const oldState = {
|
||||
metamask: {...metamaskState.metamask, ...txs},
|
||||
metamask: { ...metamaskState.metamask, ...txs },
|
||||
}
|
||||
const state = reduceApp(oldState, {
|
||||
type: actions.SHOW_CONF_TX_PAGE,
|
||||
@ -480,7 +480,7 @@ describe('App State', () => {
|
||||
}
|
||||
|
||||
const oldState = {
|
||||
metamask: {...metamaskState, ...msgs},
|
||||
metamask: { ...metamaskState, ...msgs },
|
||||
}
|
||||
|
||||
const state = reduceApp(oldState, {
|
||||
@ -508,7 +508,7 @@ describe('App State', () => {
|
||||
}
|
||||
|
||||
const oldState = {
|
||||
metamask: {...metamaskState, ...txs},
|
||||
metamask: { ...metamaskState, ...txs },
|
||||
}
|
||||
|
||||
const state = reduceApp(oldState, {
|
||||
@ -538,8 +538,8 @@ describe('App State', () => {
|
||||
it('proceeds to change current view context in confTx', () => {
|
||||
|
||||
const oldState = {
|
||||
metamask: {metamaskState},
|
||||
appState: {currentView: {context: 0}},
|
||||
metamask: { metamaskState },
|
||||
appState: { currentView: { context: 0 } },
|
||||
}
|
||||
|
||||
const state = reduceApp(oldState, {
|
||||
@ -565,7 +565,7 @@ describe('App State', () => {
|
||||
|
||||
|
||||
const oldState = {
|
||||
metamask: {...metamaskState, ...txs},
|
||||
metamask: { ...metamaskState, ...txs },
|
||||
}
|
||||
|
||||
const state = reduceApp(oldState, {
|
||||
@ -592,7 +592,7 @@ describe('App State', () => {
|
||||
|
||||
|
||||
const oldState = {
|
||||
metamask: {...metamaskState, ...txs},
|
||||
metamask: { ...metamaskState, ...txs },
|
||||
}
|
||||
|
||||
const state = reduceApp(oldState, {
|
||||
@ -633,7 +633,7 @@ describe('App State', () => {
|
||||
|
||||
it('sets warning to empty string when unlock succeeds', () => {
|
||||
const errorState = { warning: 'errors' }
|
||||
const oldState = {...metamaskState, ...errorState}
|
||||
const oldState = { ...metamaskState, ...errorState }
|
||||
const state = reduceApp(oldState, {
|
||||
type: actions.UNLOCK_SUCCEEDED,
|
||||
})
|
||||
@ -668,8 +668,8 @@ describe('App State', () => {
|
||||
})
|
||||
|
||||
it('hides loading message', () => {
|
||||
const loadingState = { isLoading: true}
|
||||
const oldState = {...metamaskState, ...loadingState}
|
||||
const loadingState = { isLoading: true }
|
||||
const oldState = { ...metamaskState, ...loadingState }
|
||||
|
||||
const state = reduceApp(oldState, {
|
||||
type: actions.HIDE_LOADING,
|
||||
@ -687,7 +687,7 @@ describe('App State', () => {
|
||||
})
|
||||
|
||||
it('hides sub loading indicator', () => {
|
||||
const oldState = {...metamaskState, isSubLoading: true }
|
||||
const oldState = { ...metamaskState, isSubLoading: true }
|
||||
const state = reduceApp(oldState, {
|
||||
type: actions.HIDE_SUB_LOADING_INDICATION,
|
||||
})
|
||||
@ -706,8 +706,8 @@ describe('App State', () => {
|
||||
})
|
||||
|
||||
it('hides warning', () => {
|
||||
const displayWarningState = { warning: 'warning'}
|
||||
const oldState = {...metamaskState, ...displayWarningState}
|
||||
const displayWarningState = { warning: 'warning' }
|
||||
const oldState = { ...metamaskState, ...displayWarningState }
|
||||
const state = reduceApp(oldState, {
|
||||
type: actions.HIDE_WARNING,
|
||||
})
|
||||
@ -732,7 +732,7 @@ describe('App State', () => {
|
||||
accountExport: 'progress',
|
||||
},
|
||||
}
|
||||
const oldState = {...metamaskState, ...requestAccountExportState}
|
||||
const oldState = { ...metamaskState, ...requestAccountExportState }
|
||||
const state = reduceApp(oldState, {
|
||||
type: actions.EXPORT_ACCOUNT,
|
||||
})
|
||||
@ -789,7 +789,7 @@ describe('App State', () => {
|
||||
},
|
||||
},
|
||||
}
|
||||
const oldState = {...metamaskState, ...appState}
|
||||
const oldState = { ...metamaskState, ...appState }
|
||||
const state = reduceApp(oldState, {
|
||||
type: actions.COINBASE_SUBVIEW,
|
||||
})
|
||||
@ -830,7 +830,7 @@ describe('App State', () => {
|
||||
},
|
||||
}
|
||||
|
||||
const oldState = {...metamaskState, ...appState}
|
||||
const oldState = { ...metamaskState, ...appState }
|
||||
|
||||
const state = reduceApp(oldState, {
|
||||
type: actions.SHAPESHIFT_SUBVIEW,
|
||||
@ -881,7 +881,7 @@ describe('App State', () => {
|
||||
maxLimit: 0.76617432,
|
||||
}
|
||||
|
||||
const oldState = {...metamaskState, ...appState}
|
||||
const oldState = { ...metamaskState, ...appState }
|
||||
|
||||
const state = reduceApp(oldState, {
|
||||
type: actions.PAIR_UPDATE,
|
||||
@ -922,7 +922,7 @@ describe('App State', () => {
|
||||
},
|
||||
}
|
||||
|
||||
const oldState = {...metamaskState, ...appState}
|
||||
const oldState = { ...metamaskState, ...appState }
|
||||
const state = reduceApp(oldState, {
|
||||
type: actions.SHOW_QR_VIEW,
|
||||
value: {
|
||||
@ -957,7 +957,7 @@ describe('App State', () => {
|
||||
|
||||
it('unsets gas loading', () => {
|
||||
const gasLoadingState = { gasIsLoading: true }
|
||||
const oldState = {...metamaskState, ...gasLoadingState}
|
||||
const oldState = { ...metamaskState, ...gasLoadingState }
|
||||
const state = reduceApp(oldState, {
|
||||
type: actions.GAS_LOADING_FINISHED,
|
||||
})
|
||||
|
@ -5,7 +5,7 @@ import * as actions from '../../../../../ui/app/store/actions'
|
||||
describe('MetaMask Reducers', () => {
|
||||
|
||||
it('init state', () => {
|
||||
const initState = reduceMetamask({metamask: {}}, {})
|
||||
const initState = reduceMetamask({ metamask: {} }, {})
|
||||
assert(initState)
|
||||
})
|
||||
|
||||
|
@ -4,7 +4,7 @@ const mockState = require('../../../data/mock-state.json')
|
||||
const Eth = require('ethjs')
|
||||
|
||||
const { createTestProviderTools } = require('../../../stub/provider')
|
||||
const provider = createTestProviderTools({ scaffold: {}}).provider
|
||||
const provider = createTestProviderTools({ scaffold: {} }).provider
|
||||
|
||||
describe('Selectors', function () {
|
||||
|
||||
|
@ -30,7 +30,7 @@ const params = {
|
||||
value: '0x9184e72a',
|
||||
data: '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675',
|
||||
},
|
||||
filterGetLogs: [{'blockHash': '0x7c5a35e9cb3e8ae0e221ab470abae9d446c3a5626ce6689fc777dcffcab52c70', 'topics': ['0x241ea03ca20251805084d27d4440371c34a0b85ff108f6bb5611248f73818b80']}],
|
||||
filterGetLogs: [{ 'blockHash': '0x7c5a35e9cb3e8ae0e221ab470abae9d446c3a5626ce6689fc777dcffcab52c70', 'topics': ['0x241ea03ca20251805084d27d4440371c34a0b85ff108f6bb5611248f73818b80'] }],
|
||||
block: {
|
||||
__required: [],
|
||||
number: 'Q',
|
||||
|
@ -1,5 +1,5 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import React, {PureComponent} from 'react'
|
||||
import React, { PureComponent } from 'react'
|
||||
|
||||
export default class AddTokenButton extends PureComponent {
|
||||
static contextTypes = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, {Component} from 'react'
|
||||
import React, { Component } from 'react'
|
||||
const inherits = require('util').inherits
|
||||
const InputNumber = require('../input-number.js')
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import React, {Component} from 'react'
|
||||
import React, { Component } from 'react'
|
||||
const inherits = require('util').inherits
|
||||
const connect = require('react-redux').connect
|
||||
const { withRouter } = require('react-router-dom')
|
||||
|
@ -13,7 +13,7 @@ describe('Dropdown', () => {
|
||||
wrapper = shallow(
|
||||
<DropdownMenuItem
|
||||
onClick={onClickSpy}
|
||||
style={{test: 'style'}}
|
||||
style={{ test: 'style' }}
|
||||
closeMenu={closeMenuSpy}
|
||||
>
|
||||
</DropdownMenuItem>
|
||||
|
@ -23,7 +23,7 @@ const mapDispatchToProps = dispatch => {
|
||||
}
|
||||
|
||||
const mergeProps = (stateProps, dispatchProps, ownProps) => {
|
||||
const {customGasPrice, customGasLimit, updateCustomGasPrice, updateCustomGasLimit} = ownProps
|
||||
const { customGasPrice, customGasLimit, updateCustomGasPrice, updateCustomGasLimit } = ownProps
|
||||
return {
|
||||
...ownProps,
|
||||
...stateProps,
|
||||
|
@ -249,7 +249,7 @@ describe('gas-modal-page-container container', () => {
|
||||
]
|
||||
|
||||
let result
|
||||
tests.forEach(({ mockState, mockOwnProps, expectedResult}) => {
|
||||
tests.forEach(({ mockState, mockOwnProps, expectedResult }) => {
|
||||
result = mapStateToProps(mockState, mockOwnProps)
|
||||
assert.deepEqual(result, expectedResult)
|
||||
})
|
||||
|
@ -190,7 +190,7 @@ export function generateChart (gasPrices, estimatedTimes, gasPricesMax, estimate
|
||||
transition: {
|
||||
duration: 0,
|
||||
},
|
||||
padding: {left: 20, right: 15, top: 6, bottom: 10},
|
||||
padding: { left: 20, right: 15, top: 6, bottom: 10 },
|
||||
data: {
|
||||
x: 'x',
|
||||
columns: [
|
||||
@ -218,14 +218,14 @@ export function generateChart (gasPrices, estimatedTimes, gasPricesMax, estimate
|
||||
return val + ' GWEI'
|
||||
},
|
||||
},
|
||||
padding: {left: gasPricesMax / 50, right: gasPricesMax / 50},
|
||||
padding: { left: gasPricesMax / 50, right: gasPricesMax / 50 },
|
||||
label: {
|
||||
text: 'Gas Price ($)',
|
||||
position: 'outer-center',
|
||||
},
|
||||
},
|
||||
y: {
|
||||
padding: {top: 7, bottom: 7},
|
||||
padding: { top: 7, bottom: 7 },
|
||||
tick: {
|
||||
values: [Math.floor(estimatedTimesMax * 0.05), Math.ceil(estimatedTimesMax * 0.97)],
|
||||
outer: false,
|
||||
|
@ -97,7 +97,7 @@ describe('GasPriceChart Component', function () {
|
||||
assert(GasPriceChart.prototype.renderChart.callCount, 1)
|
||||
wrapper.instance().componentDidMount()
|
||||
assert(GasPriceChart.prototype.renderChart.callCount, 2)
|
||||
assert.deepEqual(GasPriceChart.prototype.renderChart.getCall(1).args, [{...testProps}])
|
||||
assert.deepEqual(GasPriceChart.prototype.renderChart.getCall(1).args, [{ ...testProps }])
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { PureComponent } from 'react'
|
||||
import classnames from 'classnames'
|
||||
import {Tooltip as ReactTippy} from 'react-tippy'
|
||||
import { Tooltip as ReactTippy } from 'react-tippy'
|
||||
import PropTypes from 'prop-types'
|
||||
import Button from '../../ui/button'
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { Component} from 'react'
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import AccountModalContainer from '../account-modal-container'
|
||||
import genAccountLink from '../../../../../lib/account-link.js'
|
||||
|
@ -14,7 +14,7 @@ describe('CancelTransaction Component', () => {
|
||||
<CancelTransaction
|
||||
newGasFee="0x1319718a5000"
|
||||
/>,
|
||||
{ context: { t }}
|
||||
{ context: { t } }
|
||||
)
|
||||
|
||||
assert.ok(wrapper)
|
||||
@ -36,7 +36,7 @@ describe('CancelTransaction Component', () => {
|
||||
hideModal={hideModalSpy}
|
||||
showTransactionConfirmedModal={() => {}}
|
||||
/>,
|
||||
{ context: { t }}
|
||||
{ context: { t } }
|
||||
)
|
||||
|
||||
assert.equal(wrapper.find(Modal).length, 1)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import React, {Component} from 'react'
|
||||
import {getNetworkDisplayName} from '../../../../../../app/scripts/controllers/network/util'
|
||||
import React, { Component } from 'react'
|
||||
import { getNetworkDisplayName } from '../../../../../../app/scripts/controllers/network/util'
|
||||
import Button from '../../../ui/button'
|
||||
|
||||
export default class DepositEtherModal extends Component {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import React, {Component} from 'react'
|
||||
import {connect} from 'react-redux'
|
||||
import React, { Component } from 'react'
|
||||
import { connect } from 'react-redux'
|
||||
import { hideModal } from '../../../store/actions'
|
||||
|
||||
class NotificationModal extends Component {
|
||||
|
@ -81,12 +81,12 @@ export default class QrScanner extends Component {
|
||||
this.props.qrCodeDetected(result)
|
||||
this.stopAndClose()
|
||||
} else {
|
||||
this.setState({msg: this.context.t('unknownQrCode')})
|
||||
this.setState({ msg: this.context.t('unknownQrCode') })
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
if (err && err.name === 'NotAllowedError') {
|
||||
this.setState({msg: this.context.t('youNeedToAllowCameraAccess')})
|
||||
this.setState({ msg: this.context.t('youNeedToAllowCameraAccess') })
|
||||
clearTimeout(this.permissionChecker)
|
||||
this.needsToReinit = true
|
||||
this.checkPermisisions()
|
||||
@ -110,16 +110,16 @@ export default class QrScanner extends Component {
|
||||
if (content.split('ethereum:').length > 1) {
|
||||
|
||||
type = 'address'
|
||||
values = {'address': content.split('ethereum:')[1] }
|
||||
values = { 'address': content.split('ethereum:')[1] }
|
||||
|
||||
// Regular ethereum addresses - fox ex. 0x.....1111
|
||||
} else if (content.substring(0, 2).toLowerCase() === '0x') {
|
||||
|
||||
type = 'address'
|
||||
values = {'address': content }
|
||||
values = { 'address': content }
|
||||
|
||||
}
|
||||
return {type, values}
|
||||
return { type, values }
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import React, {Component} from 'react'
|
||||
import React, { Component } from 'react'
|
||||
|
||||
const classnames = require('classnames')
|
||||
const inherits = require('util').inherits
|
||||
|
@ -1,3 +1,3 @@
|
||||
export {default} from './permission-page-container.container'
|
||||
export {default as PermissionPageContainerContent} from './permission-page-container-content'
|
||||
export {default as PermissionPageContainerHeader} from './permission-page-container-header'
|
||||
export { default } from './permission-page-container.container'
|
||||
export { default as PermissionPageContainerContent } from './permission-page-container-content'
|
||||
export { default as PermissionPageContainerHeader } from './permission-page-container-header'
|
||||
|
@ -1 +1 @@
|
||||
export {default} from './permission-page-container-content.component'
|
||||
export { default } from './permission-page-container-content.component'
|
||||
|
@ -1 +1 @@
|
||||
export {default} from './permission-page-container-header.component'
|
||||
export { default } from './permission-page-container-header.component'
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, {PureComponent} from 'react'
|
||||
import React, { PureComponent } from 'react'
|
||||
import NetworkDisplay from '../../network-display'
|
||||
|
||||
export default class PermissionPageContainerHeader extends PureComponent {
|
||||
|
@ -10,7 +10,7 @@ describe('SelectedAccount Component', () => {
|
||||
selectedAddress="0x1b82543566f41a7db9a9a75fc933c340ffb55c9d"
|
||||
selectedIdentity={{ name: 'testName' }}
|
||||
/>
|
||||
), { context: { t: () => {}}})
|
||||
), { context: { t: () => {} } })
|
||||
// Checksummed version of address is displayed
|
||||
assert.equal(wrapper.find('.selected-account__address').text(), '0x1B82...5C9D')
|
||||
assert.equal(wrapper.find('.selected-account__name').text(), 'testName')
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {connect} from 'react-redux'
|
||||
import { connect } from 'react-redux'
|
||||
import ShiftListItem from './shift-list-item.component'
|
||||
|
||||
function mapStateToProps (state) {
|
||||
|
@ -51,7 +51,7 @@ export default class SignatureRequest extends PureComponent {
|
||||
render () {
|
||||
const {
|
||||
selectedAccount,
|
||||
txData: { msgParams: { data, origin, from: senderWallet }},
|
||||
txData: { msgParams: { data, origin, from: senderWallet } },
|
||||
cancel,
|
||||
sign,
|
||||
} = this.props
|
||||
|
@ -41,7 +41,7 @@ describe('TransactionAction Component', () => {
|
||||
transaction={transaction}
|
||||
className="transaction-action"
|
||||
/>
|
||||
), { context: { t }})
|
||||
), { context: { t } })
|
||||
|
||||
assert.equal(wrapper.find('.transaction-action').length, 1)
|
||||
wrapper.setState({ transactionAction: 'sentEther' })
|
||||
@ -108,7 +108,7 @@ describe('TransactionAction Component', () => {
|
||||
transaction={transaction}
|
||||
className="test-class"
|
||||
/>,
|
||||
{ context: { t }}
|
||||
{ context: { t } }
|
||||
)
|
||||
|
||||
assert.ok(wrapper)
|
||||
|
@ -55,7 +55,7 @@ export function getActivities (transaction, isFirstTransaction = false) {
|
||||
id,
|
||||
hash,
|
||||
history = [],
|
||||
txParams: { gas: paramsGasLimit, gasPrice: paramsGasPrice},
|
||||
txParams: { gas: paramsGasLimit, gasPrice: paramsGasPrice },
|
||||
xReceipt: { status } = {},
|
||||
type,
|
||||
} = transaction
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { connect } from 'react-redux'
|
||||
import TransactionBreakdown from './transaction-breakdown.component'
|
||||
import {getIsMainnet, getNativeCurrency, preferencesSelector} from '../../../selectors/selectors'
|
||||
import { getIsMainnet, getNativeCurrency, preferencesSelector } from '../../../selectors/selectors'
|
||||
import { getHexGasTotal } from '../../../helpers/utils/confirm-tx.util'
|
||||
import { sumHexes } from '../../../helpers/utils/transactions.util'
|
||||
|
||||
|
@ -71,7 +71,7 @@ export default class TransactionListItemDetails extends PureComponent {
|
||||
}
|
||||
|
||||
handleCopyTxId = () => {
|
||||
const { transactionGroup} = this.props
|
||||
const { transactionGroup } = this.props
|
||||
const { primaryTransaction: transaction } = transactionGroup
|
||||
const { hash } = transaction
|
||||
|
||||
|
@ -2,7 +2,7 @@ import { connect } from 'react-redux'
|
||||
import { withRouter } from 'react-router-dom'
|
||||
import { compose } from 'recompose'
|
||||
import WalletView from './wallet-view.component'
|
||||
import {showSendPage, hideSidebar, setSelectedToken, showAddTokenPage} from '../../../store/actions'
|
||||
import { showSendPage, hideSidebar, setSelectedToken, showAddTokenPage } from '../../../store/actions'
|
||||
import { getMetaMaskAccounts, getSelectedAddress, getSelectedAccount } from '../../../selectors/selectors'
|
||||
|
||||
function mapStateToProps (state) {
|
||||
|
@ -32,7 +32,7 @@ class Alert extends Component {
|
||||
})
|
||||
|
||||
setTimeout(_ => {
|
||||
this.setState({visible: false})
|
||||
this.setState({ visible: false })
|
||||
}, 500)
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ export default class Breadcrumbs extends PureComponent {
|
||||
<div
|
||||
key={i}
|
||||
className="breadcrumb"
|
||||
style={{backgroundColor: i === currentIndex ? '#D8D8D8' : '#FFFFFF'}}
|
||||
style={{ backgroundColor: i === currentIndex ? '#D8D8D8' : '#FFFFFF' }}
|
||||
/>
|
||||
))
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ export default class CurrencyInput extends PureComponent {
|
||||
|
||||
swap = () => {
|
||||
const { isSwapped, decimalValue } = this.state
|
||||
this.setState({isSwapped: !isSwapped}, () => {
|
||||
this.setState({ isSwapped: !isSwapped }, () => {
|
||||
this.handleChange(decimalValue)
|
||||
})
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { connect } from 'react-redux'
|
||||
import CurrencyInput from './currency-input.component'
|
||||
import { ETH } from '../../../helpers/constants/common'
|
||||
import { getMaxModeOn } from '../../../pages/send/send-content/send-amount-row/amount-max-button/amount-max-button.selectors'
|
||||
import {getIsMainnet, preferencesSelector} from '../../../selectors/selectors'
|
||||
import { getIsMainnet, preferencesSelector } from '../../../selectors/selectors'
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const { metamask: { nativeCurrency, currentCurrency, conversionRate } } = state
|
||||
|
@ -11,7 +11,7 @@ describe('ErrorMessage Component', () => {
|
||||
<ErrorMessage
|
||||
errorMessage="This is an error."
|
||||
/>,
|
||||
{ context: { t }}
|
||||
{ context: { t } }
|
||||
)
|
||||
|
||||
assert.ok(wrapper)
|
||||
@ -25,7 +25,7 @@ describe('ErrorMessage Component', () => {
|
||||
<ErrorMessage
|
||||
errorKey="testKey"
|
||||
/>,
|
||||
{ context: { t }}
|
||||
{ context: { t } }
|
||||
)
|
||||
|
||||
assert.ok(wrapper)
|
||||
|
@ -1,5 +1,5 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import React, {Component} from 'react'
|
||||
import React, { Component } from 'react'
|
||||
|
||||
const {
|
||||
formatBalance,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, {Component} from 'react'
|
||||
import React, { Component } from 'react'
|
||||
const PropTypes = require('prop-types')
|
||||
const Spinner = require('../spinner')
|
||||
|
||||
|
@ -12,7 +12,7 @@ export default function LockIcon (props) {
|
||||
width="401.998px"
|
||||
height="401.998px"
|
||||
viewBox="0 0 401.998 401.998"
|
||||
style={{enableBackground: 'new 0 0 401.998 401.998'}}
|
||||
style={{ enableBackground: 'new 0 0 401.998 401.998' }}
|
||||
xmlSpace="preserve"
|
||||
{...props}
|
||||
>
|
||||
|
@ -6,7 +6,7 @@ const debounce = require('debounce')
|
||||
module.exports = Mascot
|
||||
|
||||
inherits(Mascot, Component)
|
||||
function Mascot ({width = '200', height = '200'}) {
|
||||
function Mascot ({ width = '200', height = '200' }) {
|
||||
Component.call(this)
|
||||
this.logo = metamaskLogo({
|
||||
followMouse: true,
|
||||
|
@ -8,7 +8,7 @@ describe('Page Container Header', () => {
|
||||
let wrapper, style, onBackButtonClick, onClose
|
||||
|
||||
beforeEach(() => {
|
||||
style = {test: 'style'}
|
||||
style = { test: 'style' }
|
||||
onBackButtonClick = sinon.spy()
|
||||
onClose = sinon.spy()
|
||||
|
||||
|
@ -4,7 +4,7 @@ import PropTypes from 'prop-types'
|
||||
const Spinner = ({ className = '', color = '#000000' }) => {
|
||||
return (
|
||||
<div className={`spinner ${className}`}>
|
||||
<svg className="lds-spinner" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" style={{background: 'none'}}>
|
||||
<svg className="lds-spinner" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" style={{ background: 'none' }}>
|
||||
<g transform="rotate(0 50 50)">
|
||||
<rect x={45} y={0} rx={0} ry={0} width={10} height={30} fill={color}>
|
||||
<animate attributeName="opacity" values="1;0" dur="1s" begin="-0.9166666666666666s" repeatCount="indefinite" />
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { connect } from 'react-redux'
|
||||
import TokenInput from './token-input.component'
|
||||
import {getIsMainnet, getSelectedToken, getSelectedTokenExchangeRate, preferencesSelector} from '../../../selectors/selectors'
|
||||
import { getIsMainnet, getSelectedToken, getSelectedTokenExchangeRate, preferencesSelector } from '../../../selectors/selectors'
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const { metamask: { currentCurrency } } = state
|
||||
|
@ -1,6 +1,6 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import React, {PureComponent} from 'react'
|
||||
import {Tooltip as ReactTippy} from 'react-tippy'
|
||||
import React, { PureComponent } from 'react'
|
||||
import { Tooltip as ReactTippy } from 'react-tippy'
|
||||
|
||||
export default class Tooltip extends PureComponent {
|
||||
static defaultProps = {
|
||||
@ -39,7 +39,7 @@ export default class Tooltip extends PureComponent {
|
||||
}
|
||||
|
||||
render () {
|
||||
const {arrow, children, containerClassName, disabled, position, html, size, title, trigger, onHidden, wrapperClassName, style } = this.props
|
||||
const { arrow, children, containerClassName, disabled, position, html, size, title, trigger, onHidden, wrapperClassName, style } = this.props
|
||||
|
||||
if (!title && !html) {
|
||||
return (
|
||||
|
@ -150,7 +150,7 @@ export default function reduceApp (state, action) {
|
||||
state.appState.modal,
|
||||
{ open: false },
|
||||
{ modalState: { name: null, props: {} } },
|
||||
{ previousModalState: appState.modal.modalState},
|
||||
{ previousModalState: appState.modal.modalState },
|
||||
),
|
||||
})
|
||||
|
||||
@ -536,7 +536,7 @@ export default function reduceApp (state, action) {
|
||||
|
||||
case actions.SET_HARDWARE_WALLET_DEFAULT_HD_PATH:
|
||||
const { device, path } = action.value
|
||||
const newDefaults = {...appState.defaultHdPaths}
|
||||
const newDefaults = { ...appState.defaultHdPaths }
|
||||
newDefaults[device] = path
|
||||
|
||||
return extend(appState, {
|
||||
|
@ -161,7 +161,7 @@ describe('Gas Duck', () => {
|
||||
GasReducer(mockState, {
|
||||
type: BASIC_GAS_ESTIMATE_LOADING_STARTED,
|
||||
}),
|
||||
Object.assign({basicEstimateIsLoading: true}, mockState.gas)
|
||||
Object.assign({ basicEstimateIsLoading: true }, mockState.gas)
|
||||
)
|
||||
})
|
||||
|
||||
@ -170,7 +170,7 @@ describe('Gas Duck', () => {
|
||||
GasReducer(mockState, {
|
||||
type: BASIC_GAS_ESTIMATE_LOADING_FINISHED,
|
||||
}),
|
||||
Object.assign({basicEstimateIsLoading: false}, mockState.gas)
|
||||
Object.assign({ basicEstimateIsLoading: false }, mockState.gas)
|
||||
)
|
||||
})
|
||||
|
||||
@ -179,7 +179,7 @@ describe('Gas Duck', () => {
|
||||
GasReducer(mockState, {
|
||||
type: GAS_ESTIMATE_LOADING_STARTED,
|
||||
}),
|
||||
Object.assign({gasEstimatesLoading: true}, mockState.gas)
|
||||
Object.assign({ gasEstimatesLoading: true }, mockState.gas)
|
||||
)
|
||||
})
|
||||
|
||||
@ -188,7 +188,7 @@ describe('Gas Duck', () => {
|
||||
GasReducer(mockState, {
|
||||
type: GAS_ESTIMATE_LOADING_FINISHED,
|
||||
}),
|
||||
Object.assign({gasEstimatesLoading: false}, mockState.gas)
|
||||
Object.assign({ gasEstimatesLoading: false }, mockState.gas)
|
||||
)
|
||||
})
|
||||
|
||||
@ -203,7 +203,7 @@ describe('Gas Duck', () => {
|
||||
type: SET_BASIC_GAS_ESTIMATE_DATA,
|
||||
value: { someProp: 'someData123' },
|
||||
}),
|
||||
Object.assign({basicEstimates: {someProp: 'someData123'} }, mockState.gas)
|
||||
Object.assign({ basicEstimates: { someProp: 'someData123' } }, mockState.gas)
|
||||
)
|
||||
})
|
||||
|
||||
@ -213,7 +213,7 @@ describe('Gas Duck', () => {
|
||||
type: SET_PRICE_AND_TIME_ESTIMATES,
|
||||
value: { someProp: 'someData123' },
|
||||
}),
|
||||
Object.assign({priceAndTimeEstimates: {someProp: 'someData123'} }, mockState.gas)
|
||||
Object.assign({ priceAndTimeEstimates: { someProp: 'someData123' } }, mockState.gas)
|
||||
)
|
||||
})
|
||||
|
||||
@ -223,7 +223,7 @@ describe('Gas Duck', () => {
|
||||
type: SET_CUSTOM_GAS_PRICE,
|
||||
value: 4321,
|
||||
}),
|
||||
Object.assign({customData: {price: 4321} }, mockState.gas)
|
||||
Object.assign({ customData: { price: 4321 } }, mockState.gas)
|
||||
)
|
||||
})
|
||||
|
||||
@ -233,7 +233,7 @@ describe('Gas Duck', () => {
|
||||
type: SET_CUSTOM_GAS_LIMIT,
|
||||
value: 9876,
|
||||
}),
|
||||
Object.assign({customData: {limit: 9876} }, mockState.gas)
|
||||
Object.assign({ customData: { limit: 9876 } }, mockState.gas)
|
||||
)
|
||||
})
|
||||
|
||||
@ -243,7 +243,7 @@ describe('Gas Duck', () => {
|
||||
type: SET_CUSTOM_GAS_TOTAL,
|
||||
value: 10000,
|
||||
}),
|
||||
Object.assign({customData: {total: 10000} }, mockState.gas)
|
||||
Object.assign({ customData: { total: 10000 } }, mockState.gas)
|
||||
)
|
||||
})
|
||||
|
||||
@ -273,7 +273,7 @@ describe('Gas Duck', () => {
|
||||
type: SET_CUSTOM_GAS_ERRORS,
|
||||
value: { someError: 'error_error' },
|
||||
}),
|
||||
Object.assign({errors: {someError: 'error_error'} }, mockState.gas)
|
||||
Object.assign({ errors: { someError: 'error_error' } }, mockState.gas)
|
||||
)
|
||||
})
|
||||
|
||||
@ -316,7 +316,7 @@ describe('Gas Duck', () => {
|
||||
) }))
|
||||
assert.deepEqual(
|
||||
mockDistpatch.getCall(0).args,
|
||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED} ]
|
||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
|
||||
)
|
||||
assert.deepEqual(
|
||||
global.fetch.getCall(0).args,
|
||||
@ -379,7 +379,7 @@ describe('Gas Duck', () => {
|
||||
) }))
|
||||
assert.deepEqual(
|
||||
mockDistpatch.getCall(0).args,
|
||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED} ]
|
||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
|
||||
)
|
||||
assert.ok(global.fetch.notCalled)
|
||||
assert.deepEqual(
|
||||
@ -415,7 +415,7 @@ describe('Gas Duck', () => {
|
||||
) }))
|
||||
assert.deepEqual(
|
||||
mockDistpatch.getCall(0).args,
|
||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED} ]
|
||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
|
||||
)
|
||||
assert.deepEqual(
|
||||
global.fetch.getCall(0).args,
|
||||
@ -469,7 +469,7 @@ describe('Gas Duck', () => {
|
||||
}))
|
||||
assert.deepEqual(
|
||||
mockDistpatch.getCall(0).args,
|
||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED} ]
|
||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
|
||||
)
|
||||
assert.deepEqual(
|
||||
global.fetch.getCall(0).args,
|
||||
@ -546,7 +546,7 @@ describe('Gas Duck', () => {
|
||||
}))
|
||||
assert.deepEqual(
|
||||
mockDistpatch.getCall(0).args,
|
||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED} ]
|
||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
|
||||
)
|
||||
assert.ok(global.fetch.notCalled)
|
||||
|
||||
@ -590,7 +590,7 @@ describe('Gas Duck', () => {
|
||||
}))
|
||||
assert.deepEqual(
|
||||
mockDistpatch.getCall(0).args,
|
||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED} ]
|
||||
[{ type: BASIC_GAS_ESTIMATE_LOADING_STARTED } ]
|
||||
)
|
||||
assert.deepEqual(
|
||||
global.fetch.getCall(0).args,
|
||||
@ -651,7 +651,7 @@ describe('Gas Duck', () => {
|
||||
}))
|
||||
assert.deepEqual(
|
||||
mockDistpatch.getCall(0).args,
|
||||
[{ type: GAS_ESTIMATE_LOADING_STARTED} ]
|
||||
[{ type: GAS_ESTIMATE_LOADING_STARTED } ]
|
||||
)
|
||||
assert.deepEqual(
|
||||
global.fetch.getCall(0).args,
|
||||
@ -705,7 +705,7 @@ describe('Gas Duck', () => {
|
||||
}))
|
||||
assert.deepEqual(
|
||||
mockDistpatch.getCall(0).args,
|
||||
[{ type: GAS_ESTIMATE_LOADING_STARTED} ]
|
||||
[{ type: GAS_ESTIMATE_LOADING_STARTED } ]
|
||||
)
|
||||
assert.equal(global.fetch.callCount, 0)
|
||||
|
||||
|
@ -386,7 +386,7 @@ export function fetchGasEstimates (blockTime) {
|
||||
'referrerPolicy': 'no-referrer-when-downgrade',
|
||||
'body': null,
|
||||
'method': 'GET',
|
||||
'mode': 'cors'}
|
||||
'mode': 'cors' }
|
||||
)
|
||||
.then(r => r.json())
|
||||
.then(r => {
|
||||
|
@ -52,7 +52,7 @@ describe('Send Duck', () => {
|
||||
SendReducer(mockState, {
|
||||
type: OPEN_FROM_DROPDOWN,
|
||||
}),
|
||||
Object.assign({fromDropdownOpen: true}, mockState.send)
|
||||
Object.assign({ fromDropdownOpen: true }, mockState.send)
|
||||
)
|
||||
})
|
||||
|
||||
@ -66,7 +66,7 @@ describe('Send Duck', () => {
|
||||
SendReducer(mockState, {
|
||||
type: CLOSE_FROM_DROPDOWN,
|
||||
}),
|
||||
Object.assign({fromDropdownOpen: false}, mockState.send)
|
||||
Object.assign({ fromDropdownOpen: false }, mockState.send)
|
||||
)
|
||||
})
|
||||
|
||||
@ -75,7 +75,7 @@ describe('Send Duck', () => {
|
||||
SendReducer(mockState, {
|
||||
type: OPEN_TO_DROPDOWN,
|
||||
}),
|
||||
Object.assign({toDropdownOpen: true}, mockState.send)
|
||||
Object.assign({ toDropdownOpen: true }, mockState.send)
|
||||
)
|
||||
})
|
||||
|
||||
@ -84,7 +84,7 @@ describe('Send Duck', () => {
|
||||
SendReducer(mockState, {
|
||||
type: CLOSE_TO_DROPDOWN,
|
||||
}),
|
||||
Object.assign({toDropdownOpen: false}, mockState.send)
|
||||
Object.assign({ toDropdownOpen: false }, mockState.send)
|
||||
)
|
||||
})
|
||||
|
||||
@ -93,7 +93,7 @@ describe('Send Duck', () => {
|
||||
SendReducer(Object.assign({}, mockState, { gasButtonGroupShown: false }), {
|
||||
type: SHOW_GAS_BUTTON_GROUP,
|
||||
}),
|
||||
Object.assign({gasButtonGroupShown: true}, mockState.send)
|
||||
Object.assign({ gasButtonGroupShown: true }, mockState.send)
|
||||
)
|
||||
})
|
||||
|
||||
@ -102,7 +102,7 @@ describe('Send Duck', () => {
|
||||
SendReducer(mockState, {
|
||||
type: HIDE_GAS_BUTTON_GROUP,
|
||||
}),
|
||||
Object.assign({gasButtonGroupShown: false}, mockState.send)
|
||||
Object.assign({ gasButtonGroupShown: false }, mockState.send)
|
||||
)
|
||||
})
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import assert from 'assert'
|
||||
import {addCurrencies} from './conversion-util'
|
||||
import { addCurrencies } from './conversion-util'
|
||||
|
||||
|
||||
describe('conversion utils', () => {
|
||||
|
@ -304,7 +304,7 @@ function getContractAtAddress (tokenAddress) {
|
||||
|
||||
function exportAsFile (filename, data, type = 'text/csv') {
|
||||
// source: https://stackoverflow.com/a/33542499 by Ludovic Feltz
|
||||
const blob = new Blob([data], {type})
|
||||
const blob = new Blob([data], { type })
|
||||
if (window.navigator.msSaveOrOpenBlob) {
|
||||
window.navigator.msSaveBlob(blob, filename)
|
||||
} else {
|
||||
|
@ -18,7 +18,7 @@ const mapStateToProps = ({ metamask }) => {
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
addToken: ({address, symbol, decimals, image}) => dispatch(addToken(address, symbol, Number(decimals), image)),
|
||||
addToken: ({ address, symbol, decimals, image }) => dispatch(addToken(address, symbol, Number(decimals), image)),
|
||||
removeSuggestedTokens: () => dispatch(removeSuggestedTokens()),
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, {Component} from 'react'
|
||||
import React, { Component } from 'react'
|
||||
const inherits = require('util').inherits
|
||||
const connect = require('react-redux').connect
|
||||
const { withRouter } = require('react-router-dom')
|
||||
|
@ -30,7 +30,7 @@ class ConnectScreen extends Component {
|
||||
className={classnames('hw-connect__btn', {
|
||||
'selected': this.state.selectedDevice === 'trezor',
|
||||
})}
|
||||
onClick={_ => this.setState({selectedDevice: 'trezor'})}
|
||||
onClick={_ => this.setState({ selectedDevice: 'trezor' })}
|
||||
>
|
||||
<img
|
||||
className="hw-connect__btn__img"
|
||||
@ -47,7 +47,7 @@ class ConnectScreen extends Component {
|
||||
className={classnames('hw-connect__btn', {
|
||||
'selected': this.state.selectedDevice === 'ledger',
|
||||
})}
|
||||
onClick={_ => this.setState({selectedDevice: 'ledger'})}
|
||||
onClick={_ => this.setState({ selectedDevice: 'ledger' })}
|
||||
>
|
||||
<img
|
||||
className="hw-connect__btn__img"
|
||||
@ -119,7 +119,7 @@ class ConnectScreen extends Component {
|
||||
return (
|
||||
<div
|
||||
className="hw-connect__get-hw__msg"
|
||||
dangerouslySetInnerHTML={{__html: response }}
|
||||
dangerouslySetInnerHTML={{ __html: response }}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@ -136,7 +136,7 @@ class ConnectScreen extends Component {
|
||||
|
||||
scrollToTutorial = () => {
|
||||
if (this.referenceNode) {
|
||||
this.referenceNode.scrollIntoView({behavior: 'smooth'})
|
||||
this.referenceNode.scrollIntoView({ behavior: 'smooth' })
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,19 +153,19 @@ class ConnectScreen extends Component {
|
||||
const steps = [
|
||||
{
|
||||
asset: 'hardware-wallet-step-1',
|
||||
dimensions: {width: '225px', height: '75px'},
|
||||
dimensions: { width: '225px', height: '75px' },
|
||||
title: this.context.t('step1HardwareWallet'),
|
||||
message: this.context.t('step1HardwareWalletMsg'),
|
||||
},
|
||||
{
|
||||
asset: 'hardware-wallet-step-2',
|
||||
dimensions: {width: '300px', height: '100px'},
|
||||
dimensions: { width: '300px', height: '100px' },
|
||||
title: this.context.t('step2HardwareWallet'),
|
||||
message: this.context.t('step2HardwareWalletMsg'),
|
||||
},
|
||||
{
|
||||
asset: 'hardware-wallet-step-3',
|
||||
dimensions: {width: '120px', height: '90px'},
|
||||
dimensions: { width: '120px', height: '90px' },
|
||||
title: this.context.t('step3HardwareWallet'),
|
||||
message: this.context.t('step3HardwareWalletMsg'),
|
||||
},
|
||||
|
@ -29,7 +29,7 @@ class ConnectHardwareForm extends Component {
|
||||
a.balance = balanceValue ? formatBalance(balanceValue, 6) : '...'
|
||||
return a
|
||||
})
|
||||
this.setState({accounts: newAccounts})
|
||||
this.setState({ accounts: newAccounts })
|
||||
}
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ class ConnectHardwareForm extends Component {
|
||||
['trezor', 'ledger'].forEach(async device => {
|
||||
const unlocked = await this.props.checkHardwareStatus(device, this.props.defaultHdPaths[device])
|
||||
if (unlocked) {
|
||||
this.setState({unlocked: true})
|
||||
this.setState({ unlocked: true })
|
||||
this.getPage(device, 0, this.props.defaultHdPaths[device])
|
||||
}
|
||||
})
|
||||
@ -57,16 +57,16 @@ class ConnectHardwareForm extends Component {
|
||||
}
|
||||
|
||||
onPathChange = (path) => {
|
||||
this.props.setHardwareWalletDefaultHdPath({device: this.state.device, path})
|
||||
this.props.setHardwareWalletDefaultHdPath({ device: this.state.device, path })
|
||||
this.getPage(this.state.device, 0, path)
|
||||
}
|
||||
|
||||
onAccountChange = (account) => {
|
||||
this.setState({selectedAccount: account.toString(), error: null})
|
||||
this.setState({ selectedAccount: account.toString(), error: null })
|
||||
}
|
||||
|
||||
onAccountRestriction = () => {
|
||||
this.setState({error: this.context.t('ledgerAccountRestriction') })
|
||||
this.setState({ error: this.context.t('ledgerAccountRestriction') })
|
||||
}
|
||||
|
||||
showTemporaryAlert () {
|
||||
@ -117,7 +117,7 @@ class ConnectHardwareForm extends Component {
|
||||
.catch(e => {
|
||||
const errorMessage = e.message
|
||||
if (errorMessage === 'Window blocked') {
|
||||
this.setState({ browserSupported: false, error: null})
|
||||
this.setState({ browserSupported: false, error: null })
|
||||
} else if (errorMessage !== 'Window closed' && errorMessage !== 'Popup closed') {
|
||||
this.setState({ error: errorMessage })
|
||||
}
|
||||
@ -266,8 +266,8 @@ const mapStateToProps = state => {
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
setHardwareWalletDefaultHdPath: ({device, path}) => {
|
||||
return dispatch(actions.setHardwareWalletDefaultHdPath({device, path}))
|
||||
setHardwareWalletDefaultHdPath: ({ device, path }) => {
|
||||
return dispatch(actions.setHardwareWalletDefaultHdPath({ device, path }))
|
||||
},
|
||||
connectHardware: (deviceName, page, hdPath) => {
|
||||
return dispatch(actions.connectHardware(deviceName, page, hdPath))
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
|
||||
export default class CreateAccountPage extends Component {
|
||||
renderTabs () {
|
||||
const { history, location: { pathname }} = this.props
|
||||
const { history, location: { pathname } } = this.props
|
||||
const getClassNames = path => classnames('new-account__tabs__tab', {
|
||||
'new-account__tabs__selected': matchPath(pathname, {
|
||||
path,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {validateMnemonic} from 'bip39'
|
||||
import { validateMnemonic } from 'bip39'
|
||||
import React, { PureComponent } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import TextField from '../../../../components/ui/text-field'
|
||||
@ -175,7 +175,7 @@ export default class ImportWithSeedPhrase extends PureComponent {
|
||||
return !passwordError && !confirmPasswordError && !seedPhraseError
|
||||
}
|
||||
|
||||
onTermsKeyPress = ({key}) => {
|
||||
onTermsKeyPress = ({ key }) => {
|
||||
if (key === ' ' || key === 'Enter') {
|
||||
this.toggleTermsCheck()
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ describe('ImportWithSeedPhrase Component', () => {
|
||||
onSubmit: sinon.spy(),
|
||||
})
|
||||
|
||||
const {parseSeedPhrase} = root.instance()
|
||||
const { parseSeedPhrase } = root.instance()
|
||||
|
||||
assert.deepEqual(parseSeedPhrase('foo bar baz'), 'foo bar baz')
|
||||
})
|
||||
@ -39,7 +39,7 @@ describe('ImportWithSeedPhrase Component', () => {
|
||||
onSubmit: sinon.spy(),
|
||||
})
|
||||
|
||||
const {parseSeedPhrase} = root.instance()
|
||||
const { parseSeedPhrase } = root.instance()
|
||||
|
||||
assert.deepEqual(parseSeedPhrase(' foo bar baz '), 'foo bar baz')
|
||||
})
|
||||
@ -49,7 +49,7 @@ describe('ImportWithSeedPhrase Component', () => {
|
||||
onSubmit: sinon.spy(),
|
||||
})
|
||||
|
||||
const {parseSeedPhrase} = root.instance()
|
||||
const { parseSeedPhrase } = root.instance()
|
||||
|
||||
assert.deepEqual(parseSeedPhrase(' '), '')
|
||||
})
|
||||
@ -59,7 +59,7 @@ describe('ImportWithSeedPhrase Component', () => {
|
||||
onSubmit: sinon.spy(),
|
||||
})
|
||||
|
||||
const {parseSeedPhrase} = root.instance()
|
||||
const { parseSeedPhrase } = root.instance()
|
||||
|
||||
assert.deepEqual(parseSeedPhrase('$'), '')
|
||||
})
|
||||
@ -69,7 +69,7 @@ describe('ImportWithSeedPhrase Component', () => {
|
||||
onSubmit: sinon.spy(),
|
||||
})
|
||||
|
||||
const {parseSeedPhrase} = root.instance()
|
||||
const { parseSeedPhrase } = root.instance()
|
||||
|
||||
assert.deepEqual(parseSeedPhrase(undefined), '')
|
||||
assert.deepEqual(parseSeedPhrase(null), '')
|
||||
|
@ -128,7 +128,7 @@ export default class NewAccount extends PureComponent {
|
||||
}))
|
||||
}
|
||||
|
||||
onTermsKeyPress = ({key}) => {
|
||||
onTermsKeyPress = ({ key }) => {
|
||||
if (key === ' ' || key === 'Enter') {
|
||||
this.toggleTermsCheck()
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
DEFAULT_ROUTE,
|
||||
} from '../../../helpers/constants/routes'
|
||||
import HTML5Backend from 'react-dnd-html5-backend'
|
||||
import {DragDropContextProvider} from 'react-dnd'
|
||||
import { DragDropContextProvider } from 'react-dnd'
|
||||
import MetaFoxLogo from '../../../components/ui/metafox-logo'
|
||||
|
||||
export default class SeedPhrase extends PureComponent {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import {connect} from 'react-redux'
|
||||
import { connect } from 'react-redux'
|
||||
import {
|
||||
createNewVaultAndRestore,
|
||||
unMarkPasswordForgotten,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user