mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Enable arrow-parens ESLint rule
This commit is contained in:
parent
b63b848ed4
commit
a78cf0ef3a
@ -44,6 +44,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
|
'arrow-parens': 'error',
|
||||||
'import/default': 'error',
|
'import/default': 'error',
|
||||||
'import/export': 'error',
|
'import/export': 'error',
|
||||||
'import/named': 'error',
|
'import/named': 'error',
|
||||||
|
@ -389,7 +389,7 @@ function setupController (initState, initLangCode) {
|
|||||||
const url = new URL(remotePort.sender.url)
|
const url = new URL(remotePort.sender.url)
|
||||||
const origin = url.hostname
|
const origin = url.hostname
|
||||||
|
|
||||||
remotePort.onMessage.addListener(msg => {
|
remotePort.onMessage.addListener((msg) => {
|
||||||
if (msg.data && msg.data.method === 'eth_requestAccounts') {
|
if (msg.data && msg.data.method === 'eth_requestAccounts') {
|
||||||
requestAccountTabIds[origin] = tabId
|
requestAccountTabIds[origin] = tabId
|
||||||
}
|
}
|
||||||
@ -446,8 +446,8 @@ function setupController (initState, initLangCode) {
|
|||||||
* Opens the browser popup for user confirmation
|
* Opens the browser popup for user confirmation
|
||||||
*/
|
*/
|
||||||
function triggerUi () {
|
function triggerUi () {
|
||||||
extension.tabs.query({ active: true }, tabs => {
|
extension.tabs.query({ active: true }, (tabs) => {
|
||||||
const currentlyActiveMetamaskTab = Boolean(tabs.find(tab => openMetamaskTabsIDs[tab.id]))
|
const currentlyActiveMetamaskTab = Boolean(tabs.find((tab) => openMetamaskTabsIDs[tab.id]))
|
||||||
if (!popupIsOpen && !currentlyActiveMetamaskTab && !notificationIsOpen) {
|
if (!popupIsOpen && !currentlyActiveMetamaskTab && !notificationIsOpen) {
|
||||||
notificationManager.showPopup()
|
notificationManager.showPopup()
|
||||||
notificationIsOpen = true
|
notificationIsOpen = true
|
||||||
|
@ -231,5 +231,5 @@ async function domIsReady () {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// wait for load
|
// wait for load
|
||||||
return new Promise(resolve => window.addEventListener('DOMContentLoaded', resolve, { once: true }))
|
return new Promise((resolve) => window.addEventListener('DOMContentLoaded', resolve, { once: true }))
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ class AppStateController {
|
|||||||
}, initState))
|
}, initState))
|
||||||
this.timer = null
|
this.timer = null
|
||||||
|
|
||||||
preferencesStore.subscribe(state => {
|
preferencesStore.subscribe((state) => {
|
||||||
this._setInactiveTimeout(state.preferences.autoLockTimeLimit)
|
this._setInactiveTimeout(state.preferences.autoLockTimeLimit)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class CachedBalancesController {
|
|||||||
const { cachedBalances } = this.store.getState()
|
const { cachedBalances } = this.store.getState()
|
||||||
const currentNetworkBalancesToCache = { ...cachedBalances[currentNetwork] }
|
const currentNetworkBalancesToCache = { ...cachedBalances[currentNetwork] }
|
||||||
|
|
||||||
Object.keys(newAccounts).forEach(accountID => {
|
Object.keys(newAccounts).forEach((accountID) => {
|
||||||
const account = newAccounts[accountID]
|
const account = newAccounts[accountID]
|
||||||
|
|
||||||
if (account.balance) {
|
if (account.balance) {
|
||||||
|
@ -165,7 +165,7 @@ class IncomingTransactionsController {
|
|||||||
const newIncomingTransactions = {
|
const newIncomingTransactions = {
|
||||||
...currentIncomingTxs,
|
...currentIncomingTxs,
|
||||||
}
|
}
|
||||||
newTxs.forEach(tx => {
|
newTxs.forEach((tx) => {
|
||||||
newIncomingTransactions[tx.hash] = tx
|
newIncomingTransactions[tx.hash] = tx
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ class IncomingTransactionsController {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const incomingTxs = remoteTxs.filter(tx => tx.txParams.to && tx.txParams.to.toLowerCase() === address.toLowerCase())
|
const incomingTxs = remoteTxs.filter((tx) => tx.txParams.to && tx.txParams.to.toLowerCase() === address.toLowerCase())
|
||||||
incomingTxs.sort((a, b) => (a.time < b.time ? -1 : 1))
|
incomingTxs.sort((a, b) => (a.time < b.time ? -1 : 1))
|
||||||
|
|
||||||
let latestIncomingTxBlockNumber = null
|
let latestIncomingTxBlockNumber = null
|
||||||
|
@ -25,7 +25,7 @@ function createLocalhostClient () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function delay (time) {
|
function delay (time) {
|
||||||
return new Promise(resolve => setTimeout(resolve, time))
|
return new Promise((resolve) => setTimeout(resolve, time))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ const networkToNameMap = {
|
|||||||
[GOERLI_CODE]: GOERLI_DISPLAY_NAME,
|
[GOERLI_CODE]: GOERLI_DISPLAY_NAME,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getNetworkDisplayName = key => networkToNameMap[key]
|
export const getNetworkDisplayName = (key) => networkToNameMap[key]
|
||||||
|
|
||||||
export function formatTxMetaForRpcResult (txMeta) {
|
export function formatTxMetaForRpcResult (txMeta) {
|
||||||
return {
|
return {
|
||||||
|
@ -197,7 +197,7 @@ export class PermissionsController {
|
|||||||
let error
|
let error
|
||||||
try {
|
try {
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
this.permissions.grantNewPermissions(origin, permissions, {}, err => (err ? resolve() : reject(err)))
|
this.permissions.grantNewPermissions(origin, permissions, {}, (err) => (err ? resolve() : reject(err)))
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error = err
|
error = err
|
||||||
@ -263,7 +263,7 @@ export class PermissionsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// caveat names are unique, and we will only construct this caveat here
|
// caveat names are unique, and we will only construct this caveat here
|
||||||
ethAccounts.caveats = ethAccounts.caveats.filter(c => (
|
ethAccounts.caveats = ethAccounts.caveats.filter((c) => (
|
||||||
c.name !== CAVEAT_NAMES.exposedAccounts
|
c.name !== CAVEAT_NAMES.exposedAccounts
|
||||||
))
|
))
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ export class PermissionsController {
|
|||||||
|
|
||||||
// assert accounts exist
|
// assert accounts exist
|
||||||
const allAccounts = await this.getKeyringAccounts()
|
const allAccounts = await this.getKeyringAccounts()
|
||||||
accounts.forEach(acc => {
|
accounts.forEach((acc) => {
|
||||||
if (!allAccounts.includes(acc)) {
|
if (!allAccounts.includes(acc)) {
|
||||||
throw new Error(`Unknown account: ${acc}`)
|
throw new Error(`Unknown account: ${acc}`)
|
||||||
}
|
}
|
||||||
@ -331,7 +331,7 @@ export class PermissionsController {
|
|||||||
|
|
||||||
this.permissions.removePermissionsFor(
|
this.permissions.removePermissionsFor(
|
||||||
origin,
|
origin,
|
||||||
perms.map(methodName => {
|
perms.map((methodName) => {
|
||||||
|
|
||||||
if (methodName === 'eth_accounts') {
|
if (methodName === 'eth_accounts') {
|
||||||
this.notifyDomain(
|
this.notifyDomain(
|
||||||
@ -366,7 +366,7 @@ export class PermissionsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const newPermittedAccounts = [account].concat(
|
const newPermittedAccounts = [account].concat(
|
||||||
permittedAccounts.filter(_account => _account !== account)
|
permittedAccounts.filter((_account) => _account !== account)
|
||||||
)
|
)
|
||||||
|
|
||||||
// update permitted accounts to ensure that accounts are returned
|
// update permitted accounts to ensure that accounts are returned
|
||||||
|
@ -116,7 +116,7 @@ export default class PermissionsLogController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// call next with a return handler for capturing the response
|
// call next with a return handler for capturing the response
|
||||||
next(cb => {
|
next((cb) => {
|
||||||
|
|
||||||
const time = Date.now()
|
const time = Date.now()
|
||||||
this.logActivityResponse(requestId, res, time)
|
this.logActivityResponse(requestId, res, time)
|
||||||
@ -234,7 +234,7 @@ export default class PermissionsLogController {
|
|||||||
// accounts were last seen or approved by the origin.
|
// accounts were last seen or approved by the origin.
|
||||||
newEntries = result
|
newEntries = result
|
||||||
? result
|
? result
|
||||||
.map(perm => {
|
.map((perm) => {
|
||||||
|
|
||||||
if (perm.parentCapability === 'eth_accounts') {
|
if (perm.parentCapability === 'eth_accounts') {
|
||||||
accounts = this.getAccountsFromPermission(perm)
|
accounts = this.getAccountsFromPermission(perm)
|
||||||
|
@ -408,7 +408,7 @@ class PreferencesController {
|
|||||||
|
|
||||||
const { lastSelectedAddressByOrigin } = this.store.getState()
|
const { lastSelectedAddressByOrigin } = this.store.getState()
|
||||||
|
|
||||||
origins.forEach(origin => {
|
origins.forEach((origin) => {
|
||||||
delete lastSelectedAddressByOrigin[origin]
|
delete lastSelectedAddressByOrigin[origin]
|
||||||
})
|
})
|
||||||
this.store.updateState({ lastSelectedAddressByOrigin })
|
this.store.updateState({ lastSelectedAddressByOrigin })
|
||||||
@ -472,7 +472,7 @@ class PreferencesController {
|
|||||||
removeToken (rawAddress) {
|
removeToken (rawAddress) {
|
||||||
const tokens = this.store.getState().tokens
|
const tokens = this.store.getState().tokens
|
||||||
const assetImages = this.getAssetImages()
|
const assetImages = this.getAssetImages()
|
||||||
const updatedTokens = tokens.filter(token => token.address !== rawAddress)
|
const updatedTokens = tokens.filter((token) => token.address !== rawAddress)
|
||||||
delete assetImages[rawAddress]
|
delete assetImages[rawAddress]
|
||||||
this._updateAccountTokens(updatedTokens, assetImages)
|
this._updateAccountTokens(updatedTokens, assetImages)
|
||||||
return Promise.resolve(updatedTokens)
|
return Promise.resolve(updatedTokens)
|
||||||
@ -758,7 +758,7 @@ class PreferencesController {
|
|||||||
const tokenOpts = { rawAddress, decimals, symbol, image }
|
const tokenOpts = { rawAddress, decimals, symbol, image }
|
||||||
this.addSuggestedERC20Asset(tokenOpts)
|
this.addSuggestedERC20Asset(tokenOpts)
|
||||||
return this.openPopup().then(() => {
|
return this.openPopup().then(() => {
|
||||||
const tokenAddresses = this.getTokens().filter(token => token.address === normalizeAddress(rawAddress))
|
const tokenAddresses = this.getTokens().filter((token) => token.address === normalizeAddress(rawAddress))
|
||||||
return tokenAddresses.length > 0
|
return tokenAddresses.length > 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -33,13 +33,13 @@ class TokenRatesController {
|
|||||||
}
|
}
|
||||||
const contractExchangeRates = {}
|
const contractExchangeRates = {}
|
||||||
const nativeCurrency = this.currency ? this.currency.state.nativeCurrency.toLowerCase() : 'eth'
|
const nativeCurrency = this.currency ? this.currency.state.nativeCurrency.toLowerCase() : 'eth'
|
||||||
const pairs = this._tokens.map(token => token.address).join(',')
|
const pairs = this._tokens.map((token) => token.address).join(',')
|
||||||
const query = `contract_addresses=${pairs}&vs_currencies=${nativeCurrency}`
|
const query = `contract_addresses=${pairs}&vs_currencies=${nativeCurrency}`
|
||||||
if (this._tokens.length > 0) {
|
if (this._tokens.length > 0) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`https://api.coingecko.com/api/v3/simple/token_price/ethereum?${query}`)
|
const response = await fetch(`https://api.coingecko.com/api/v3/simple/token_price/ethereum?${query}`)
|
||||||
const prices = await response.json()
|
const prices = await response.json()
|
||||||
this._tokens.forEach(token => {
|
this._tokens.forEach((token) => {
|
||||||
const price = prices[token.address.toLowerCase()] || prices[ethUtil.toChecksumAddress(token.address)]
|
const price = prices[token.address.toLowerCase()] || prices[ethUtil.toChecksumAddress(token.address)]
|
||||||
contractExchangeRates[normalizeAddress(token.address)] = price ? price[nativeCurrency] : 0
|
contractExchangeRates[normalizeAddress(token.address)] = price ? price[nativeCurrency] : 0
|
||||||
})
|
})
|
||||||
|
@ -657,7 +657,7 @@ class TransactionController extends EventEmitter {
|
|||||||
TOKEN_METHOD_APPROVE,
|
TOKEN_METHOD_APPROVE,
|
||||||
TOKEN_METHOD_TRANSFER,
|
TOKEN_METHOD_TRANSFER,
|
||||||
TOKEN_METHOD_TRANSFER_FROM,
|
TOKEN_METHOD_TRANSFER_FROM,
|
||||||
].find(tokenMethodName => tokenMethodName === name && name.toLowerCase())
|
].find((tokenMethodName) => tokenMethodName === name && name.toLowerCase())
|
||||||
|
|
||||||
let result
|
let result
|
||||||
if (txParams.data && tokenMethodName) {
|
if (txParams.data && tokenMethodName) {
|
||||||
|
@ -5,11 +5,11 @@ import { addHexPrefix, isValidAddress } from 'ethereumjs-util'
|
|||||||
const normalizers = {
|
const normalizers = {
|
||||||
from: (from, LowerCase = true) => (LowerCase ? addHexPrefix(from).toLowerCase() : addHexPrefix(from)),
|
from: (from, LowerCase = true) => (LowerCase ? addHexPrefix(from).toLowerCase() : addHexPrefix(from)),
|
||||||
to: (to, LowerCase = true) => (LowerCase ? addHexPrefix(to).toLowerCase() : addHexPrefix(to)),
|
to: (to, LowerCase = true) => (LowerCase ? addHexPrefix(to).toLowerCase() : addHexPrefix(to)),
|
||||||
nonce: nonce => addHexPrefix(nonce),
|
nonce: (nonce) => addHexPrefix(nonce),
|
||||||
value: value => addHexPrefix(value),
|
value: (value) => addHexPrefix(value),
|
||||||
data: data => addHexPrefix(data),
|
data: (data) => addHexPrefix(data),
|
||||||
gas: gas => addHexPrefix(gas),
|
gas: (gas) => addHexPrefix(gas),
|
||||||
gasPrice: gasPrice => addHexPrefix(gasPrice),
|
gasPrice: (gasPrice) => addHexPrefix(gasPrice),
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -207,7 +207,7 @@ class TransactionStateManager extends EventEmitter {
|
|||||||
// commit txMeta to state
|
// commit txMeta to state
|
||||||
const txId = txMeta.id
|
const txId = txMeta.id
|
||||||
const txList = this.getFullTxList()
|
const txList = this.getFullTxList()
|
||||||
const index = txList.findIndex(txData => txData.id === txId)
|
const index = txList.findIndex((txData) => txData.id === txId)
|
||||||
txList[index] = txMeta
|
txList[index] = txMeta
|
||||||
this._saveTxList(txList)
|
this._saveTxList(txList)
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ class AccountTracker {
|
|||||||
this._blockTracker = opts.blockTracker
|
this._blockTracker = opts.blockTracker
|
||||||
// blockTracker.currentBlock may be null
|
// blockTracker.currentBlock may be null
|
||||||
this._currentBlockNumber = this._blockTracker.getCurrentBlock()
|
this._currentBlockNumber = this._blockTracker.getCurrentBlock()
|
||||||
this._blockTracker.once('latest', blockNumber => {
|
this._blockTracker.once('latest', (blockNumber) => {
|
||||||
this._currentBlockNumber = blockNumber
|
this._currentBlockNumber = blockNumber
|
||||||
})
|
})
|
||||||
// bind function for easier listener syntax
|
// bind function for easier listener syntax
|
||||||
@ -124,7 +124,7 @@ class AccountTracker {
|
|||||||
addAccounts (addresses) {
|
addAccounts (addresses) {
|
||||||
const accounts = this.store.getState().accounts
|
const accounts = this.store.getState().accounts
|
||||||
// add initial state for addresses
|
// add initial state for addresses
|
||||||
addresses.forEach(address => {
|
addresses.forEach((address) => {
|
||||||
accounts[address] = {}
|
accounts[address] = {}
|
||||||
})
|
})
|
||||||
// save accounts state
|
// save accounts state
|
||||||
@ -145,7 +145,7 @@ class AccountTracker {
|
|||||||
removeAccount (addresses) {
|
removeAccount (addresses) {
|
||||||
const accounts = this.store.getState().accounts
|
const accounts = this.store.getState().accounts
|
||||||
// remove each state object
|
// remove each state object
|
||||||
addresses.forEach(address => {
|
addresses.forEach((address) => {
|
||||||
delete accounts[address]
|
delete accounts[address]
|
||||||
})
|
})
|
||||||
// save accounts state
|
// save accounts state
|
||||||
|
@ -11,7 +11,7 @@ function createDnodeRemoteGetter (dnode) {
|
|||||||
if (remote) {
|
if (remote) {
|
||||||
return remote
|
return remote
|
||||||
}
|
}
|
||||||
return await new Promise(resolve => dnode.once('remote', resolve))
|
return await new Promise((resolve) => dnode.once('remote', resolve))
|
||||||
}
|
}
|
||||||
|
|
||||||
return getRemote
|
return getRemote
|
||||||
|
@ -9,7 +9,7 @@ export default setupEnsIpfsResolver
|
|||||||
function setupEnsIpfsResolver ({ provider, getCurrentNetwork, getIpfsGateway }) {
|
function setupEnsIpfsResolver ({ provider, getCurrentNetwork, getIpfsGateway }) {
|
||||||
|
|
||||||
// install listener
|
// install listener
|
||||||
const urlPatterns = supportedTopLevelDomains.map(tld => `*://*.${tld}/*`)
|
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 api object
|
||||||
|
@ -9,7 +9,7 @@ const getPreferredLocales = extension.i18n ? promisify(
|
|||||||
|
|
||||||
// mapping some browsers return hyphen instead underscore in locale codes (e.g. zh_TW -> zh-tw)
|
// mapping some browsers return hyphen instead underscore in locale codes (e.g. zh_TW -> zh-tw)
|
||||||
const existingLocaleCodes = {}
|
const existingLocaleCodes = {}
|
||||||
allLocales.forEach(locale => {
|
allLocales.forEach((locale) => {
|
||||||
if (locale && locale.code) {
|
if (locale && locale.code) {
|
||||||
existingLocaleCodes[locale.code.toLowerCase().replace('_', '-')] = locale.code
|
existingLocaleCodes[locale.code.toLowerCase().replace('_', '-')] = locale.code
|
||||||
}
|
}
|
||||||
@ -39,8 +39,8 @@ async function getFirstPreferredLangCode () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const firstPreferredLangCode = userPreferredLocaleCodes
|
const firstPreferredLangCode = userPreferredLocaleCodes
|
||||||
.map(code => code.toLowerCase().replace('_', '-'))
|
.map((code) => code.toLowerCase().replace('_', '-'))
|
||||||
.find(code => existingLocaleCodes.hasOwnProperty(code))
|
.find((code) => existingLocaleCodes.hasOwnProperty(code))
|
||||||
|
|
||||||
return existingLocaleCodes[firstPreferredLangCode] || 'en'
|
return existingLocaleCodes[firstPreferredLangCode] || 'en'
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ export default class MessageManager extends EventEmitter {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
getUnapprovedMsgs () {
|
getUnapprovedMsgs () {
|
||||||
return this.messages.filter(msg => msg.status === 'unapproved')
|
return this.messages.filter((msg) => msg.status === 'unapproved')
|
||||||
.reduce((result, msg) => {
|
.reduce((result, msg) => {
|
||||||
result[msg.id] = msg; return result
|
result[msg.id] = msg; return result
|
||||||
}, {})
|
}, {})
|
||||||
@ -145,7 +145,7 @@ export default class MessageManager extends EventEmitter {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
getMsg (msgId) {
|
getMsg (msgId) {
|
||||||
return this.messages.find(msg => msg.id === msgId)
|
return this.messages.find((msg) => msg.id === msgId)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,7 +65,7 @@ export default class PersonalMessageManager extends EventEmitter {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
getUnapprovedMsgs () {
|
getUnapprovedMsgs () {
|
||||||
return this.messages.filter(msg => msg.status === 'unapproved')
|
return this.messages.filter((msg) => msg.status === 'unapproved')
|
||||||
.reduce((result, msg) => {
|
.reduce((result, msg) => {
|
||||||
result[msg.id] = msg; return result
|
result[msg.id] = msg; return result
|
||||||
}, {})
|
}, {})
|
||||||
@ -155,7 +155,7 @@ export default class PersonalMessageManager extends EventEmitter {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
getMsg (msgId) {
|
getMsg (msgId) {
|
||||||
return this.messages.find(msg => msg.id === msgId)
|
return this.messages.find((msg) => msg.id === msgId)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +37,7 @@ function setupSentry (opts) {
|
|||||||
beforeSend: (report) => rewriteReport(report),
|
beforeSend: (report) => rewriteReport(report),
|
||||||
})
|
})
|
||||||
|
|
||||||
Sentry.configureScope(scope => {
|
Sentry.configureScope((scope) => {
|
||||||
scope.setExtra('isBrave', isBrave)
|
scope.setExtra('isBrave', isBrave)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ function rewriteErrorMessages (report, rewriteFn) {
|
|||||||
}
|
}
|
||||||
// rewrite each exception message
|
// rewrite each exception message
|
||||||
if (report.exception && report.exception.values) {
|
if (report.exception && report.exception.values) {
|
||||||
report.exception.values.forEach(item => {
|
report.exception.values.forEach((item) => {
|
||||||
if (typeof item.value === 'string') {
|
if (typeof item.value === 'string') {
|
||||||
item.value = rewriteFn(item.value)
|
item.value = rewriteFn(item.value)
|
||||||
}
|
}
|
||||||
@ -94,8 +94,8 @@ function rewriteReportUrls (report) {
|
|||||||
report.request.url = toMetamaskUrl(report.request.url)
|
report.request.url = toMetamaskUrl(report.request.url)
|
||||||
// update exception stack trace
|
// update exception stack trace
|
||||||
if (report.exception && report.exception.values) {
|
if (report.exception && report.exception.values) {
|
||||||
report.exception.values.forEach(item => {
|
report.exception.values.forEach((item) => {
|
||||||
item.stacktrace.frames.forEach(frame => {
|
item.stacktrace.frames.forEach((frame) => {
|
||||||
frame.filename = toMetamaskUrl(frame.filename)
|
frame.filename = toMetamaskUrl(frame.filename)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -57,7 +57,7 @@ export default class TypedMessageManager extends EventEmitter {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
getUnapprovedMsgs () {
|
getUnapprovedMsgs () {
|
||||||
return this.messages.filter(msg => msg.status === 'unapproved')
|
return this.messages.filter((msg) => msg.status === 'unapproved')
|
||||||
.reduce((result, msg) => {
|
.reduce((result, msg) => {
|
||||||
result[msg.id] = msg; return result
|
result[msg.id] = msg; return result
|
||||||
}, {})
|
}, {})
|
||||||
@ -189,7 +189,7 @@ export default class TypedMessageManager extends EventEmitter {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
getMsg (msgId) {
|
getMsg (msgId) {
|
||||||
return this.messages.find(msg => msg.id === msgId)
|
return this.messages.find((msg) => msg.id === msgId)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,7 @@ const getEnvironmentType = (url = window.location.href) => {
|
|||||||
* @returns {string} - the platform ENUM
|
* @returns {string} - the platform ENUM
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const getPlatform = _ => {
|
const getPlatform = (_) => {
|
||||||
const ua = navigator.userAgent
|
const ua = navigator.userAgent
|
||||||
if (ua.search('Firefox') !== -1) {
|
if (ua.search('Firefox') !== -1) {
|
||||||
return PLATFORM_FIREFOX
|
return PLATFORM_FIREFOX
|
||||||
@ -135,7 +135,7 @@ function getRandomArrayItem (array) {
|
|||||||
|
|
||||||
function mapObjectValues (object, cb) {
|
function mapObjectValues (object, cb) {
|
||||||
const mappedObject = {}
|
const mappedObject = {}
|
||||||
Object.keys(object).forEach(key => {
|
Object.keys(object).forEach((key) => {
|
||||||
mappedObject[key] = cb(key, object[key])
|
mappedObject[key] = cb(key, object[key])
|
||||||
})
|
})
|
||||||
return mappedObject
|
return mappedObject
|
||||||
|
@ -697,11 +697,11 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
|
|
||||||
// Filter ERC20 tokens
|
// Filter ERC20 tokens
|
||||||
const filteredAccountTokens = {}
|
const filteredAccountTokens = {}
|
||||||
Object.keys(accountTokens).forEach(address => {
|
Object.keys(accountTokens).forEach((address) => {
|
||||||
const checksummedAddress = ethUtil.toChecksumAddress(address)
|
const checksummedAddress = ethUtil.toChecksumAddress(address)
|
||||||
filteredAccountTokens[checksummedAddress] = {}
|
filteredAccountTokens[checksummedAddress] = {}
|
||||||
Object.keys(accountTokens[address]).forEach(
|
Object.keys(accountTokens[address]).forEach(
|
||||||
networkType => (filteredAccountTokens[checksummedAddress][networkType] = networkType !== 'mainnet' ?
|
(networkType) => (filteredAccountTokens[checksummedAddress][networkType] = networkType !== 'mainnet' ?
|
||||||
accountTokens[address][networkType] :
|
accountTokens[address][networkType] :
|
||||||
accountTokens[address][networkType].filter(({ address }) => {
|
accountTokens[address][networkType].filter(({ address }) => {
|
||||||
const tokenAddress = ethUtil.toChecksumAddress(address)
|
const tokenAddress = ethUtil.toChecksumAddress(address)
|
||||||
@ -724,7 +724,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
const hdKeyring = this.keyringController.getKeyringsByType('HD Key Tree')[0]
|
const hdKeyring = this.keyringController.getKeyringsByType('HD Key Tree')[0]
|
||||||
const hdAccounts = await hdKeyring.getAccounts()
|
const hdAccounts = await hdKeyring.getAccounts()
|
||||||
const accounts = {
|
const accounts = {
|
||||||
hd: hdAccounts.filter((item, pos) => (hdAccounts.indexOf(item) === pos)).map(address => ethUtil.toChecksumAddress(address)),
|
hd: hdAccounts.filter((item, pos) => (hdAccounts.indexOf(item) === pos)).map((address) => ethUtil.toChecksumAddress(address)),
|
||||||
simpleKeyPair: [],
|
simpleKeyPair: [],
|
||||||
ledger: [],
|
ledger: [],
|
||||||
trezor: [],
|
trezor: [],
|
||||||
@ -734,7 +734,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
|
|
||||||
let transactions = this.txController.store.getState().transactions
|
let transactions = this.txController.store.getState().transactions
|
||||||
// delete tx for other accounts that we're not importing
|
// delete tx for other accounts that we're not importing
|
||||||
transactions = transactions.filter(tx => {
|
transactions = transactions.filter((tx) => {
|
||||||
const checksummedTxFrom = ethUtil.toChecksumAddress(tx.txParams.from)
|
const checksummedTxFrom = ethUtil.toChecksumAddress(tx.txParams.from)
|
||||||
return (
|
return (
|
||||||
accounts.hd.includes(checksummedTxFrom)
|
accounts.hd.includes(checksummedTxFrom)
|
||||||
@ -762,7 +762,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
const accounts = await this.keyringController.getAccounts()
|
const accounts = await this.keyringController.getAccounts()
|
||||||
|
|
||||||
// verify keyrings
|
// verify keyrings
|
||||||
const nonSimpleKeyrings = this.keyringController.keyrings.filter(keyring => keyring.type !== 'Simple Key Pair')
|
const nonSimpleKeyrings = this.keyringController.keyrings.filter((keyring) => keyring.type !== 'Simple Key Pair')
|
||||||
if (nonSimpleKeyrings.length > 1 && this.diagnostics) {
|
if (nonSimpleKeyrings.length > 1 && this.diagnostics) {
|
||||||
await this.diagnostics.reportMultipleKeyrings(nonSimpleKeyrings)
|
await this.diagnostics.reportMultipleKeyrings(nonSimpleKeyrings)
|
||||||
}
|
}
|
||||||
@ -855,7 +855,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
// Merge with existing accounts
|
// Merge with existing accounts
|
||||||
// and make sure addresses are not repeated
|
// and make sure addresses are not repeated
|
||||||
const oldAccounts = await this.keyringController.getAccounts()
|
const oldAccounts = await this.keyringController.getAccounts()
|
||||||
const accountsToTrack = [...new Set(oldAccounts.concat(accounts.map(a => a.address.toLowerCase())))]
|
const accountsToTrack = [...new Set(oldAccounts.concat(accounts.map((a) => a.address.toLowerCase())))]
|
||||||
this.accountTracker.syncWithAddresses(accountsToTrack)
|
this.accountTracker.syncWithAddresses(accountsToTrack)
|
||||||
return accounts
|
return accounts
|
||||||
}
|
}
|
||||||
@ -895,7 +895,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
const keyState = await this.keyringController.addNewAccount(keyring)
|
const keyState = await this.keyringController.addNewAccount(keyring)
|
||||||
const newAccounts = await this.keyringController.getAccounts()
|
const newAccounts = await this.keyringController.getAccounts()
|
||||||
this.preferencesController.setAddresses(newAccounts)
|
this.preferencesController.setAddresses(newAccounts)
|
||||||
newAccounts.forEach(address => {
|
newAccounts.forEach((address) => {
|
||||||
if (!oldAccounts.includes(address)) {
|
if (!oldAccounts.includes(address)) {
|
||||||
// Set the account label to Trezor 1 / Ledger 1, etc
|
// Set the account label to Trezor 1 / Ledger 1, etc
|
||||||
this.preferencesController.setAccountLabel(address, `${deviceName[0].toUpperCase()}${deviceName.slice(1)} ${parseInt(index, 10) + 1}`)
|
this.preferencesController.setAccountLabel(address, `${deviceName[0].toUpperCase()}${deviceName.slice(1)} ${parseInt(index, 10) + 1}`)
|
||||||
@ -1580,7 +1580,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.values(connections).forEach(conn => {
|
Object.values(connections).forEach((conn) => {
|
||||||
conn.engine && conn.engine.emit('notification', payload)
|
conn.engine && conn.engine.emit('notification', payload)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1599,8 +1599,8 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.values(this.connections).forEach(origin => {
|
Object.values(this.connections).forEach((origin) => {
|
||||||
Object.values(origin).forEach(conn => {
|
Object.values(origin).forEach((conn) => {
|
||||||
conn.engine && conn.engine.emit('notification', payload)
|
conn.engine && conn.engine.emit('notification', payload)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -1671,13 +1671,13 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
return GWEI_BN
|
return GWEI_BN
|
||||||
}
|
}
|
||||||
return block.gasPrices
|
return block.gasPrices
|
||||||
.map(hexPrefix => hexPrefix.substr(2))
|
.map((hexPrefix) => hexPrefix.substr(2))
|
||||||
.map(hex => new BN(hex, 16))
|
.map((hex) => new BN(hex, 16))
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
return a.gt(b) ? 1 : -1
|
return a.gt(b) ? 1 : -1
|
||||||
})[0]
|
})[0]
|
||||||
})
|
})
|
||||||
.map(number => number.div(GWEI_BN).toNumber())
|
.map((number) => number.div(GWEI_BN).toNumber())
|
||||||
|
|
||||||
const percentileNum = percentile(65, lowestPrices)
|
const percentileNum = percentile(65, lowestPrices)
|
||||||
const percentileNumBn = new BN(percentileNum)
|
const percentileNumBn = new BN(percentileNum)
|
||||||
|
@ -45,13 +45,13 @@ function transformState (state) {
|
|||||||
function normalizeTxParams (txParams) {
|
function normalizeTxParams (txParams) {
|
||||||
// functions that handle normalizing of that key in txParams
|
// functions that handle normalizing of that key in txParams
|
||||||
const whiteList = {
|
const whiteList = {
|
||||||
from: from => ethUtil.addHexPrefix(from).toLowerCase(),
|
from: (from) => ethUtil.addHexPrefix(from).toLowerCase(),
|
||||||
to: () => ethUtil.addHexPrefix(txParams.to).toLowerCase(),
|
to: () => ethUtil.addHexPrefix(txParams.to).toLowerCase(),
|
||||||
nonce: nonce => ethUtil.addHexPrefix(nonce),
|
nonce: (nonce) => ethUtil.addHexPrefix(nonce),
|
||||||
value: value => ethUtil.addHexPrefix(value),
|
value: (value) => ethUtil.addHexPrefix(value),
|
||||||
data: data => ethUtil.addHexPrefix(data),
|
data: (data) => ethUtil.addHexPrefix(data),
|
||||||
gas: gas => ethUtil.addHexPrefix(gas),
|
gas: (gas) => ethUtil.addHexPrefix(gas),
|
||||||
gasPrice: gasPrice => ethUtil.addHexPrefix(gasPrice),
|
gasPrice: (gasPrice) => ethUtil.addHexPrefix(gasPrice),
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply only keys in the whiteList
|
// apply only keys in the whiteList
|
||||||
|
@ -67,7 +67,7 @@ class ExtensionPlatform {
|
|||||||
|
|
||||||
currentTab () {
|
currentTab () {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
extension.tabs.getCurrent(tab => {
|
extension.tabs.getCurrent((tab) => {
|
||||||
const err = checkForError()
|
const err = checkForError()
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(err)
|
reject(err)
|
||||||
|
@ -33,14 +33,14 @@ async function start () {
|
|||||||
|
|
||||||
// links to extension builds
|
// links to extension builds
|
||||||
const platforms = ['chrome', 'firefox', 'opera']
|
const platforms = ['chrome', 'firefox', 'opera']
|
||||||
const buildLinks = platforms.map(platform => {
|
const buildLinks = platforms.map((platform) => {
|
||||||
const url = `${BUILD_LINK_BASE}/builds/metamask-${platform}-${VERSION}.zip`
|
const url = `${BUILD_LINK_BASE}/builds/metamask-${platform}-${VERSION}.zip`
|
||||||
return `<a href="${url}">${platform}</a>`
|
return `<a href="${url}">${platform}</a>`
|
||||||
}).join(', ')
|
}).join(', ')
|
||||||
|
|
||||||
// links to bundle browser builds
|
// links to bundle browser builds
|
||||||
const bundles = ['background', 'ui', 'inpage', 'contentscript', 'ui-libs', 'bg-libs', 'phishing-detect']
|
const bundles = ['background', 'ui', 'inpage', 'contentscript', 'ui-libs', 'bg-libs', 'phishing-detect']
|
||||||
const bundleLinks = bundles.map(bundle => {
|
const bundleLinks = bundles.map((bundle) => {
|
||||||
const url = `${BUILD_LINK_BASE}/build-artifacts/source-map-explorer/${bundle}.html`
|
const url = `${BUILD_LINK_BASE}/build-artifacts/source-map-explorer/${bundle}.html`
|
||||||
return `<a href="${url}">${bundle}</a>`
|
return `<a href="${url}">${bundle}</a>`
|
||||||
}).join(', ')
|
}).join(', ')
|
||||||
@ -58,7 +58,7 @@ async function start () {
|
|||||||
`dep viz: ${depVizLink}`,
|
`dep viz: ${depVizLink}`,
|
||||||
`<a href="${allArtifactsUrl}">all artifacts</a>`,
|
`<a href="${allArtifactsUrl}">all artifacts</a>`,
|
||||||
]
|
]
|
||||||
const hiddenContent = `<ul>` + contentRows.map(row => `<li>${row}</li>`).join('\n') + `</ul>`
|
const hiddenContent = `<ul>` + contentRows.map((row) => `<li>${row}</li>`).join('\n') + `</ul>`
|
||||||
const exposedContent = `Builds ready [${SHORT_SHA1}]`
|
const exposedContent = `Builds ready [${SHORT_SHA1}]`
|
||||||
const artifactsBody = `<details><summary>${exposedContent}</summary>${hiddenContent}</details>`
|
const artifactsBody = `<details><summary>${exposedContent}</summary>${hiddenContent}</details>`
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ async function start () {
|
|||||||
for (const measure of allMeasures) {
|
for (const measure of allMeasures) {
|
||||||
benchmarkTableHeaders.push(`${capitalizeFirstLetter(measure)} (ms)`)
|
benchmarkTableHeaders.push(`${capitalizeFirstLetter(measure)} (ms)`)
|
||||||
}
|
}
|
||||||
const benchmarkTableHeader = `<thead><tr>${benchmarkTableHeaders.map(header => `<th>${header}</th>`).join('')}</tr></thead>`
|
const benchmarkTableHeader = `<thead><tr>${benchmarkTableHeaders.map((header) => `<th>${header}</th>`).join('')}</tr></thead>`
|
||||||
const benchmarkTableBody = `<tbody>${tableRows.join('')}</tbody>`
|
const benchmarkTableBody = `<tbody>${tableRows.join('')}</tbody>`
|
||||||
const benchmarkTable = `<table>${benchmarkTableHeader}${benchmarkTableBody}</table>`
|
const benchmarkTable = `<table>${benchmarkTableHeader}${benchmarkTableBody}</table>`
|
||||||
const benchmarkBody = `<details><summary>${benchmarkSummary}</summary>${benchmarkTable}</details>`
|
const benchmarkBody = `<details><summary>${benchmarkSummary}</summary>${benchmarkTable}</details>`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
function delay (time) {
|
function delay (time) {
|
||||||
return new Promise(resolve => setTimeout(resolve, time))
|
return new Promise((resolve) => setTimeout(resolve, time))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadFromMock3Box (key) {
|
async function loadFromMock3Box (key) {
|
||||||
@ -24,7 +24,7 @@ class Mock3Box {
|
|||||||
static openBox (address) {
|
static openBox (address) {
|
||||||
this.address = address
|
this.address = address
|
||||||
return Promise.resolve({
|
return Promise.resolve({
|
||||||
onSyncDone: cb => {
|
onSyncDone: (cb) => {
|
||||||
setTimeout(cb, 200)
|
setTimeout(cb, 200)
|
||||||
},
|
},
|
||||||
openSpace: async (spaceName, config) => {
|
openSpace: async (spaceName, config) => {
|
||||||
|
@ -14,7 +14,7 @@ readInstalled('./', { dev: true }, function (err, data) {
|
|||||||
const packageScripts = packageData.scripts || {}
|
const packageScripts = packageData.scripts || {}
|
||||||
const scriptKeys = Reflect.ownKeys(packageScripts)
|
const scriptKeys = Reflect.ownKeys(packageScripts)
|
||||||
|
|
||||||
const hasInstallScript = installScripts.some(installKey => scriptKeys.includes(installKey))
|
const hasInstallScript = installScripts.some((installKey) => scriptKeys.includes(installKey))
|
||||||
if (!hasInstallScript) {
|
if (!hasInstallScript) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ async function validateSourcemapForFile ({ buildName }) {
|
|||||||
const buildLines = rawBuild.split('\n')
|
const buildLines = rawBuild.split('\n')
|
||||||
const targetString = 'new Error'
|
const targetString = 'new Error'
|
||||||
// const targetString = 'null'
|
// const targetString = 'null'
|
||||||
const matchesPerLine = buildLines.map(line => indicesOf(targetString, line))
|
const matchesPerLine = buildLines.map((line) => indicesOf(targetString, line))
|
||||||
matchesPerLine.forEach((matchIndices, lineIndex) => {
|
matchesPerLine.forEach((matchIndices, lineIndex) => {
|
||||||
matchIndices.forEach((matchColumn) => {
|
matchIndices.forEach((matchColumn) => {
|
||||||
sampleCount++
|
sampleCount++
|
||||||
|
@ -47,7 +47,7 @@ for (const arg of process.argv.slice(2)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
main(specifiedLocale, fix)
|
main(specifiedLocale, fix)
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
log.error(error)
|
log.error(error)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
@ -55,7 +55,7 @@ main(specifiedLocale, fix)
|
|||||||
async function main (specifiedLocale, fix) {
|
async function main (specifiedLocale, fix) {
|
||||||
if (specifiedLocale) {
|
if (specifiedLocale) {
|
||||||
log.info(`Verifying selected locale "${specifiedLocale}":\n`)
|
log.info(`Verifying selected locale "${specifiedLocale}":\n`)
|
||||||
const locale = localeIndex.find(localeMeta => localeMeta.code === specifiedLocale)
|
const locale = localeIndex.find((localeMeta) => localeMeta.code === specifiedLocale)
|
||||||
const failed = locale.code === 'en' ?
|
const failed = locale.code === 'en' ?
|
||||||
await verifyEnglishLocale(fix) :
|
await verifyEnglishLocale(fix) :
|
||||||
await verifyLocale(locale, fix)
|
await verifyLocale(locale, fix)
|
||||||
@ -66,8 +66,8 @@ async function main (specifiedLocale, fix) {
|
|||||||
log.info('Verifying all locales:\n')
|
log.info('Verifying all locales:\n')
|
||||||
let failed = await verifyEnglishLocale(fix)
|
let failed = await verifyEnglishLocale(fix)
|
||||||
const localeCodes = localeIndex
|
const localeCodes = localeIndex
|
||||||
.filter(localeMeta => localeMeta.code !== 'en')
|
.filter((localeMeta) => localeMeta.code !== 'en')
|
||||||
.map(localeMeta => localeMeta.code)
|
.map((localeMeta) => localeMeta.code)
|
||||||
|
|
||||||
for (const code of localeCodes) {
|
for (const code of localeCodes) {
|
||||||
log.info() // Separate each locale report by a newline when not in '--quiet' mode
|
log.info() // Separate each locale report by a newline when not in '--quiet' mode
|
||||||
@ -179,7 +179,7 @@ async function verifyEnglishLocale (fix = false) {
|
|||||||
const templateMatches = fileContents.match(templateStringRegex)
|
const templateMatches = fileContents.match(templateStringRegex)
|
||||||
if (templateMatches) {
|
if (templateMatches) {
|
||||||
// concat doesn't work here for some reason
|
// concat doesn't work here for some reason
|
||||||
templateMatches.forEach(match => templateUsage.push(match))
|
templateMatches.forEach((match) => templateUsage.push(match))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ async function verifyEnglishLocale (fix = false) {
|
|||||||
|
|
||||||
const englishMessages = Object.keys(englishLocale)
|
const englishMessages = Object.keys(englishLocale)
|
||||||
const unusedMessages = englishMessages
|
const unusedMessages = englishMessages
|
||||||
.filter(message => !messageExceptions.includes(message) && !usedMessages.has(message))
|
.filter((message) => !messageExceptions.includes(message) && !usedMessages.has(message))
|
||||||
|
|
||||||
if (unusedMessages.length) {
|
if (unusedMessages.length) {
|
||||||
console.log(`**en**: ${unusedMessages.length} unused messages`)
|
console.log(`**en**: ${unusedMessages.length} unused messages`)
|
||||||
|
34
gulpfile.js
34
gulpfile.js
@ -33,7 +33,7 @@ sass.compiler = require('node-sass')
|
|||||||
|
|
||||||
const dependencies = Object.keys(packageJSON && packageJSON.dependencies || {})
|
const dependencies = Object.keys(packageJSON && packageJSON.dependencies || {})
|
||||||
const materialUIDependencies = ['@material-ui/core']
|
const materialUIDependencies = ['@material-ui/core']
|
||||||
const reactDepenendencies = dependencies.filter(dep => dep.match(/react/))
|
const reactDepenendencies = dependencies.filter((dep) => dep.match(/react/))
|
||||||
const d3Dependencies = ['c3', 'd3']
|
const d3Dependencies = ['c3', 'd3']
|
||||||
|
|
||||||
const externalDependenciesMap = {
|
const externalDependenciesMap = {
|
||||||
@ -77,38 +77,38 @@ const copyDevTaskNames = []
|
|||||||
|
|
||||||
createCopyTasks('locales', {
|
createCopyTasks('locales', {
|
||||||
source: './app/_locales/',
|
source: './app/_locales/',
|
||||||
destinations: commonPlatforms.map(platform => `./dist/${platform}/_locales`),
|
destinations: commonPlatforms.map((platform) => `./dist/${platform}/_locales`),
|
||||||
})
|
})
|
||||||
createCopyTasks('images', {
|
createCopyTasks('images', {
|
||||||
source: './app/images/',
|
source: './app/images/',
|
||||||
destinations: commonPlatforms.map(platform => `./dist/${platform}/images`),
|
destinations: commonPlatforms.map((platform) => `./dist/${platform}/images`),
|
||||||
})
|
})
|
||||||
createCopyTasks('contractImages', {
|
createCopyTasks('contractImages', {
|
||||||
source: './node_modules/eth-contract-metadata/images/',
|
source: './node_modules/eth-contract-metadata/images/',
|
||||||
destinations: commonPlatforms.map(platform => `./dist/${platform}/images/contract`),
|
destinations: commonPlatforms.map((platform) => `./dist/${platform}/images/contract`),
|
||||||
})
|
})
|
||||||
createCopyTasks('fonts', {
|
createCopyTasks('fonts', {
|
||||||
source: './app/fonts/',
|
source: './app/fonts/',
|
||||||
destinations: commonPlatforms.map(platform => `./dist/${platform}/fonts`),
|
destinations: commonPlatforms.map((platform) => `./dist/${platform}/fonts`),
|
||||||
})
|
})
|
||||||
createCopyTasks('vendor', {
|
createCopyTasks('vendor', {
|
||||||
source: './app/vendor/',
|
source: './app/vendor/',
|
||||||
destinations: commonPlatforms.map(platform => `./dist/${platform}/vendor`),
|
destinations: commonPlatforms.map((platform) => `./dist/${platform}/vendor`),
|
||||||
})
|
})
|
||||||
createCopyTasks('css', {
|
createCopyTasks('css', {
|
||||||
source: './ui/app/css/output/',
|
source: './ui/app/css/output/',
|
||||||
destinations: commonPlatforms.map(platform => `./dist/${platform}`),
|
destinations: commonPlatforms.map((platform) => `./dist/${platform}`),
|
||||||
})
|
})
|
||||||
createCopyTasks('reload', {
|
createCopyTasks('reload', {
|
||||||
devOnly: true,
|
devOnly: true,
|
||||||
source: './app/scripts/',
|
source: './app/scripts/',
|
||||||
pattern: '/chromereload.js',
|
pattern: '/chromereload.js',
|
||||||
destinations: commonPlatforms.map(platform => `./dist/${platform}`),
|
destinations: commonPlatforms.map((platform) => `./dist/${platform}`),
|
||||||
})
|
})
|
||||||
createCopyTasks('html', {
|
createCopyTasks('html', {
|
||||||
source: './app/',
|
source: './app/',
|
||||||
pattern: '/*.html',
|
pattern: '/*.html',
|
||||||
destinations: commonPlatforms.map(platform => `./dist/${platform}`),
|
destinations: commonPlatforms.map((platform) => `./dist/${platform}`),
|
||||||
})
|
})
|
||||||
|
|
||||||
// copy extension
|
// copy extension
|
||||||
@ -116,7 +116,7 @@ createCopyTasks('html', {
|
|||||||
createCopyTasks('manifest', {
|
createCopyTasks('manifest', {
|
||||||
source: './app/',
|
source: './app/',
|
||||||
pattern: '/*.json',
|
pattern: '/*.json',
|
||||||
destinations: browserPlatforms.map(platform => `./dist/${platform}`),
|
destinations: browserPlatforms.map((platform) => `./dist/${platform}`),
|
||||||
})
|
})
|
||||||
|
|
||||||
function createCopyTasks (label, opts) {
|
function createCopyTasks (label, opts) {
|
||||||
@ -235,7 +235,7 @@ gulp.task('manifest:testing-local', function () {
|
|||||||
.pipe(jsoneditor(function (json) {
|
.pipe(jsoneditor(function (json) {
|
||||||
json.background = {
|
json.background = {
|
||||||
...json.background,
|
...json.background,
|
||||||
scripts: json.background.scripts.filter(scriptName => !scriptsToExcludeFromBackgroundDevBuild[scriptName]),
|
scripts: json.background.scripts.filter((scriptName) => !scriptsToExcludeFromBackgroundDevBuild[scriptName]),
|
||||||
}
|
}
|
||||||
json.permissions = [...json.permissions, 'webRequestBlocking', 'http://localhost/*']
|
json.permissions = [...json.permissions, 'webRequestBlocking', 'http://localhost/*']
|
||||||
return json
|
return json
|
||||||
@ -254,7 +254,7 @@ gulp.task('manifest:dev', function () {
|
|||||||
.pipe(jsoneditor(function (json) {
|
.pipe(jsoneditor(function (json) {
|
||||||
json.background = {
|
json.background = {
|
||||||
...json.background,
|
...json.background,
|
||||||
scripts: json.background.scripts.filter(scriptName => !scriptsToExcludeFromBackgroundDevBuild[scriptName]),
|
scripts: json.background.scripts.filter((scriptName) => !scriptsToExcludeFromBackgroundDevBuild[scriptName]),
|
||||||
}
|
}
|
||||||
json.permissions = [...json.permissions, 'webRequestBlocking']
|
json.permissions = [...json.permissions, 'webRequestBlocking']
|
||||||
return json
|
return json
|
||||||
@ -378,7 +378,7 @@ createTasksForBuildJsExtension({ buildJsFiles, taskPrefix: 'build:extension:js'
|
|||||||
createTasksForBuildJsExtension({ buildJsFiles, taskPrefix: 'build:test:extension:js', testing: 'true' })
|
createTasksForBuildJsExtension({ buildJsFiles, taskPrefix: 'build:test:extension:js', testing: 'true' })
|
||||||
|
|
||||||
function createTasksForBuildJsDeps ({ key, filename }) {
|
function createTasksForBuildJsDeps ({ key, filename }) {
|
||||||
const destinations = browserPlatforms.map(platform => `./dist/${platform}`)
|
const destinations = browserPlatforms.map((platform) => `./dist/${platform}`)
|
||||||
|
|
||||||
const bundleTaskOpts = Object.assign({
|
const bundleTaskOpts = Object.assign({
|
||||||
buildSourceMaps: true,
|
buildSourceMaps: true,
|
||||||
@ -400,10 +400,10 @@ function createTasksForBuildJsDeps ({ key, filename }) {
|
|||||||
function createTasksForBuildJsExtension ({ buildJsFiles, taskPrefix, devMode, testing, bundleTaskOpts = {} }) {
|
function createTasksForBuildJsExtension ({ buildJsFiles, taskPrefix, devMode, testing, bundleTaskOpts = {} }) {
|
||||||
// inpage must be built before all other scripts:
|
// inpage must be built before all other scripts:
|
||||||
const rootDir = './app/scripts'
|
const rootDir = './app/scripts'
|
||||||
const nonInpageFiles = buildJsFiles.filter(file => file !== 'inpage')
|
const nonInpageFiles = buildJsFiles.filter((file) => file !== 'inpage')
|
||||||
const buildPhase1 = ['inpage']
|
const buildPhase1 = ['inpage']
|
||||||
const buildPhase2 = nonInpageFiles
|
const buildPhase2 = nonInpageFiles
|
||||||
const destinations = browserPlatforms.map(platform => `./dist/${platform}`)
|
const destinations = browserPlatforms.map((platform) => `./dist/${platform}`)
|
||||||
bundleTaskOpts = Object.assign({
|
bundleTaskOpts = Object.assign({
|
||||||
buildSourceMaps: true,
|
buildSourceMaps: true,
|
||||||
sourceMapDir: '../sourcemaps',
|
sourceMapDir: '../sourcemaps',
|
||||||
@ -430,9 +430,9 @@ function createTasksForBuildJs ({ rootDir, taskPrefix, bundleTaskOpts, destinati
|
|||||||
})
|
})
|
||||||
// compose into larger task
|
// compose into larger task
|
||||||
const subtasks = []
|
const subtasks = []
|
||||||
subtasks.push(gulp.parallel(buildPhase1.map(file => `${taskPrefix}:${file}`)))
|
subtasks.push(gulp.parallel(buildPhase1.map((file) => `${taskPrefix}:${file}`)))
|
||||||
if (buildPhase2.length) {
|
if (buildPhase2.length) {
|
||||||
subtasks.push(gulp.parallel(buildPhase2.map(file => `${taskPrefix}:${file}`)))
|
subtasks.push(gulp.parallel(buildPhase2.map((file) => `${taskPrefix}:${file}`)))
|
||||||
}
|
}
|
||||||
|
|
||||||
gulp.task(taskPrefix, gulp.series(subtasks))
|
gulp.task(taskPrefix, gulp.series(subtasks))
|
||||||
|
@ -37,7 +37,7 @@ describe('MetaMask', function () {
|
|||||||
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
||||||
const errors = await driver.checkBrowserForConsoleErrors()
|
const errors = await driver.checkBrowserForConsoleErrors()
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
const errorReports = errors.map(err => err.message)
|
const errorReports = errors.map((err) => err.message)
|
||||||
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
||||||
console.error(new Error(errorMessage))
|
console.error(new Error(errorMessage))
|
||||||
}
|
}
|
||||||
|
@ -37,10 +37,10 @@ const calculateSum = (array) => array.reduce((sum, val) => sum + val)
|
|||||||
const calculateAverage = (array) => calculateSum(array) / array.length
|
const calculateAverage = (array) => calculateSum(array) / array.length
|
||||||
const minResult = calculateResult((array) => Math.min(...array))
|
const minResult = calculateResult((array) => Math.min(...array))
|
||||||
const maxResult = calculateResult((array) => Math.max(...array))
|
const maxResult = calculateResult((array) => Math.max(...array))
|
||||||
const averageResult = calculateResult(array => calculateAverage(array))
|
const averageResult = calculateResult((array) => calculateAverage(array))
|
||||||
const standardDeviationResult = calculateResult((array) => {
|
const standardDeviationResult = calculateResult((array) => {
|
||||||
const average = calculateAverage(array)
|
const average = calculateAverage(array)
|
||||||
const squareDiffs = array.map(value => Math.pow(value - average, 2))
|
const squareDiffs = array.map((value) => Math.pow(value - average, 2))
|
||||||
return Math.sqrt(calculateAverage(squareDiffs))
|
return Math.sqrt(calculateAverage(squareDiffs))
|
||||||
})
|
})
|
||||||
// 95% margin of error calculated using Student's t-distrbution
|
// 95% margin of error calculated using Student's t-distrbution
|
||||||
@ -55,17 +55,17 @@ async function profilePageLoad (pages, numSamples) {
|
|||||||
runResults.push(await measurePage(pageName))
|
runResults.push(await measurePage(pageName))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runResults.some(result => result.navigation.lenth > 1)) {
|
if (runResults.some((result) => result.navigation.lenth > 1)) {
|
||||||
throw new Error(`Multiple navigations not supported`)
|
throw new Error(`Multiple navigations not supported`)
|
||||||
} else if (runResults.some(result => result.navigation[0].type !== 'navigate')) {
|
} else if (runResults.some((result) => result.navigation[0].type !== 'navigate')) {
|
||||||
throw new Error(`Navigation type ${runResults.find(result => result.navigation[0].type !== 'navigate').navigation[0].type} not supported`)
|
throw new Error(`Navigation type ${runResults.find((result) => result.navigation[0].type !== 'navigate').navigation[0].type} not supported`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = {
|
const result = {
|
||||||
firstPaint: runResults.map(result => result.paint['first-paint']),
|
firstPaint: runResults.map((result) => result.paint['first-paint']),
|
||||||
domContentLoaded: runResults.map(result => result.navigation[0] && result.navigation[0].domContentLoaded),
|
domContentLoaded: runResults.map((result) => result.navigation[0] && result.navigation[0].domContentLoaded),
|
||||||
load: runResults.map(result => result.navigation[0] && result.navigation[0].load),
|
load: runResults.map((result) => result.navigation[0] && result.navigation[0].load),
|
||||||
domInteractive: runResults.map(result => result.navigation[0] && result.navigation[0].domInteractive),
|
domInteractive: runResults.map((result) => result.navigation[0] && result.navigation[0].domInteractive),
|
||||||
}
|
}
|
||||||
|
|
||||||
results[pageName] = {
|
results[pageName] = {
|
||||||
@ -166,7 +166,7 @@ async function main () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
main()
|
main()
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
|
@ -36,7 +36,7 @@ describe('MetaMask', function () {
|
|||||||
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
||||||
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
const errorReports = errors.map(err => err.message)
|
const errorReports = errors.map((err) => err.message)
|
||||||
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
||||||
console.error(new Error(errorMessage))
|
console.error(new Error(errorMessage))
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ describe('MetaMask', function () {
|
|||||||
|
|
||||||
extension = windowHandles[0]
|
extension = windowHandles[0]
|
||||||
dapp = await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles)
|
dapp = await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles)
|
||||||
popup = windowHandles.find(handle => handle !== extension && handle !== dapp)
|
popup = windowHandles.find((handle) => handle !== extension && handle !== dapp)
|
||||||
|
|
||||||
await driver.switchToWindow(popup)
|
await driver.switchToWindow(popup)
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ describe('Using MetaMask with an existing account', function () {
|
|||||||
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
||||||
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
const errorReports = errors.map(err => err.message)
|
const errorReports = errors.map((err) => err.message)
|
||||||
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
||||||
console.error(new Error(errorMessage))
|
console.error(new Error(errorMessage))
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ describe('MetaMask', function () {
|
|||||||
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
||||||
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
const errorReports = errors.map(err => err.message)
|
const errorReports = errors.map((err) => err.message)
|
||||||
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
||||||
console.error(new Error(errorMessage))
|
console.error(new Error(errorMessage))
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ describe('MetaMask', function () {
|
|||||||
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
||||||
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
const errorReports = errors.map(err => err.message)
|
const errorReports = errors.map((err) => err.message)
|
||||||
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
||||||
console.error(new Error(errorMessage))
|
console.error(new Error(errorMessage))
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ describe('MetaMask', function () {
|
|||||||
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
||||||
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
const errorReports = errors.map(err => err.message)
|
const errorReports = errors.map((err) => err.message)
|
||||||
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
||||||
console.error(new Error(errorMessage))
|
console.error(new Error(errorMessage))
|
||||||
}
|
}
|
||||||
@ -407,7 +407,7 @@ describe('MetaMask', function () {
|
|||||||
|
|
||||||
extension = windowHandles[0]
|
extension = windowHandles[0]
|
||||||
dapp = await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles)
|
dapp = await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles)
|
||||||
popup = windowHandles.find(handle => handle !== extension && handle !== dapp)
|
popup = windowHandles.find((handle) => handle !== extension && handle !== dapp)
|
||||||
|
|
||||||
await driver.switchToWindow(popup)
|
await driver.switchToWindow(popup)
|
||||||
|
|
||||||
@ -1273,7 +1273,7 @@ describe('MetaMask', function () {
|
|||||||
'http://127.0.0.1:8545/4',
|
'http://127.0.0.1:8545/4',
|
||||||
]
|
]
|
||||||
|
|
||||||
customRpcUrls.forEach(customRpcUrl => {
|
customRpcUrls.forEach((customRpcUrl) => {
|
||||||
it(`creates custom RPC: ${customRpcUrl}`, async function () {
|
it(`creates custom RPC: ${customRpcUrl}`, async function () {
|
||||||
await driver.clickElement(By.css('.network-name'))
|
await driver.clickElement(By.css('.network-name'))
|
||||||
await driver.delay(regularDelayMs)
|
await driver.delay(regularDelayMs)
|
||||||
|
@ -9,7 +9,7 @@ const requestHandler = (request, response) => {
|
|||||||
response.setHeader('Content-Type', 'application/json')
|
response.setHeader('Content-Type', 'application/json')
|
||||||
if (request.method === 'POST') {
|
if (request.method === 'POST') {
|
||||||
let body = ''
|
let body = ''
|
||||||
request.on('data', chunk => {
|
request.on('data', (chunk) => {
|
||||||
body += chunk.toString() // convert Buffer to string
|
body += chunk.toString() // convert Buffer to string
|
||||||
})
|
})
|
||||||
request.on('end', () => {
|
request.on('end', () => {
|
||||||
|
@ -36,7 +36,7 @@ describe('MetaMask', function () {
|
|||||||
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
||||||
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
const errorReports = errors.map(err => err.message)
|
const errorReports = errors.map((err) => err.message)
|
||||||
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
||||||
console.error(new Error(errorMessage))
|
console.error(new Error(errorMessage))
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ describe('MetaMask', function () {
|
|||||||
|
|
||||||
extension = windowHandles[0]
|
extension = windowHandles[0]
|
||||||
dapp = await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles)
|
dapp = await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles)
|
||||||
popup = windowHandles.find(handle => handle !== extension && handle !== dapp)
|
popup = windowHandles.find((handle) => handle !== extension && handle !== dapp)
|
||||||
|
|
||||||
await driver.switchToWindow(popup)
|
await driver.switchToWindow(popup)
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ describe('Using MetaMask with an existing account', function () {
|
|||||||
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
||||||
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
const errorReports = errors.map(err => err.message)
|
const errorReports = errors.map((err) => err.message)
|
||||||
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
||||||
console.error(new Error(errorMessage))
|
console.error(new Error(errorMessage))
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ describe('MetaMask', function () {
|
|||||||
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
||||||
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
const errorReports = errors.map(err => err.message)
|
const errorReports = errors.map((err) => err.message)
|
||||||
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
||||||
console.error(new Error(errorMessage))
|
console.error(new Error(errorMessage))
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ describe('MetaMask', function () {
|
|||||||
|
|
||||||
extension = windowHandles[0]
|
extension = windowHandles[0]
|
||||||
dapp = await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles)
|
dapp = await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles)
|
||||||
popup = windowHandles.find(handle => handle !== extension && handle !== dapp)
|
popup = windowHandles.find((handle) => handle !== extension && handle !== dapp)
|
||||||
|
|
||||||
await driver.switchToWindow(popup)
|
await driver.switchToWindow(popup)
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ describe('MetaMask', function () {
|
|||||||
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
||||||
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
const errorReports = errors.map(err => err.message)
|
const errorReports = errors.map((err) => err.message)
|
||||||
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
||||||
console.error(new Error(errorMessage))
|
console.error(new Error(errorMessage))
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ describe('Using MetaMask with an existing account', function () {
|
|||||||
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
if (process.env.SELENIUM_BROWSER === 'chrome') {
|
||||||
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
const errors = await driver.checkBrowserForConsoleErrors(driver)
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
const errorReports = errors.map(err => err.message)
|
const errorReports = errors.map((err) => err.message)
|
||||||
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
|
||||||
console.error(new Error(errorMessage))
|
console.error(new Error(errorMessage))
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ describe('Using MetaMask with an existing account', function () {
|
|||||||
|
|
||||||
const extension = windowHandles[0]
|
const extension = windowHandles[0]
|
||||||
const popup = await driver.switchToWindowWithTitle('MetaMask Notification', windowHandles)
|
const popup = await driver.switchToWindowWithTitle('MetaMask Notification', windowHandles)
|
||||||
const dapp = windowHandles.find(handle => handle !== extension && handle !== popup)
|
const dapp = windowHandles.find((handle) => handle !== extension && handle !== popup)
|
||||||
|
|
||||||
await driver.delay(regularDelayMs)
|
await driver.delay(regularDelayMs)
|
||||||
await driver.clickElement(By.xpath(`//button[contains(text(), 'Connect')]`))
|
await driver.clickElement(By.xpath(`//button[contains(text(), 'Connect')]`))
|
||||||
|
@ -16,7 +16,7 @@ class Driver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async delay (time) {
|
async delay (time) {
|
||||||
await new Promise(resolve => setTimeout(resolve, time))
|
await new Promise((resolve) => setTimeout(resolve, time))
|
||||||
}
|
}
|
||||||
|
|
||||||
async wait (condition, timeout = this.timeout) {
|
async wait (condition, timeout = this.timeout) {
|
||||||
@ -180,9 +180,9 @@ class Driver {
|
|||||||
'favicon.ico - Failed to load resource: the server responded with a status of 404 (Not Found)',
|
'favicon.ico - Failed to load resource: the server responded with a status of 404 (Not Found)',
|
||||||
]
|
]
|
||||||
const browserLogs = await this.driver.manage().logs().get('browser')
|
const browserLogs = await this.driver.manage().logs().get('browser')
|
||||||
const errorEntries = browserLogs.filter(entry => !ignoredLogTypes.includes(entry.level.toString()))
|
const errorEntries = browserLogs.filter((entry) => !ignoredLogTypes.includes(entry.level.toString()))
|
||||||
const errorObjects = errorEntries.map(entry => entry.toJSON())
|
const errorObjects = errorEntries.map((entry) => entry.toJSON())
|
||||||
return errorObjects.filter(entry => !ignoredErrorMessages.some(message => entry.message.includes(message)))
|
return errorObjects.filter((entry) => !ignoredErrorMessages.some((message) => entry.message.includes(message)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@ export function mountWithRouter (component, store = {}, pathname = '/') {
|
|||||||
const createContext = () => ({
|
const createContext = () => ({
|
||||||
context: {
|
context: {
|
||||||
router,
|
router,
|
||||||
t: str => str,
|
t: (str) => str,
|
||||||
tOrKey: str => str,
|
tOrKey: (str) => str,
|
||||||
metricsEvent: () => {},
|
metricsEvent: () => {},
|
||||||
store,
|
store,
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
require('@babel/register')({
|
require('@babel/register')({
|
||||||
ignore: [name => name.includes('node_modules') && !name.includes('obs-store')],
|
ignore: [(name) => name.includes('node_modules') && !name.includes('obs-store')],
|
||||||
})
|
})
|
||||||
|
|
||||||
require('./helper')
|
require('./helper')
|
||||||
|
@ -903,7 +903,7 @@ describe('MetaMaskController', function () {
|
|||||||
|
|
||||||
function deferredPromise () {
|
function deferredPromise () {
|
||||||
let resolve
|
let resolve
|
||||||
const promise = new Promise(_resolve => {
|
const promise = new Promise((_resolve) => {
|
||||||
resolve = _resolve
|
resolve = _resolve
|
||||||
})
|
})
|
||||||
return { promise, resolve }
|
return { promise, resolve }
|
||||||
|
@ -226,7 +226,7 @@ describe('PendingTransactionTracker', function () {
|
|||||||
it('should emit \'tx:warning\' if it encountered a real error', function (done) {
|
it('should emit \'tx:warning\' if it encountered a real error', function (done) {
|
||||||
pendingTxTracker.once('tx:warning', (txMeta, err) => {
|
pendingTxTracker.once('tx:warning', (txMeta, err) => {
|
||||||
if (err.message === 'im some real error') {
|
if (err.message === 'im some real error') {
|
||||||
const matchingTx = txList.find(tx => tx.id === txMeta.id)
|
const matchingTx = txList.find((tx) => tx.id === txMeta.id)
|
||||||
matchingTx.resolve()
|
matchingTx.resolve()
|
||||||
} else {
|
} else {
|
||||||
done(err)
|
done(err)
|
||||||
|
@ -683,7 +683,7 @@ describe('Transaction Controller', function () {
|
|||||||
])
|
])
|
||||||
|
|
||||||
assert(txController.pendingTxTracker.getPendingTransactions().length, 2)
|
assert(txController.pendingTxTracker.getPendingTransactions().length, 2)
|
||||||
const states = txController.pendingTxTracker.getPendingTransactions().map(tx => tx.status)
|
const states = txController.pendingTxTracker.getPendingTransactions().map((tx) => tx.status)
|
||||||
assert(states.includes('approved'), 'includes approved')
|
assert(states.includes('approved'), 'includes approved')
|
||||||
assert(states.includes('submitted'), 'includes submitted')
|
assert(states.includes('submitted'), 'includes submitted')
|
||||||
})
|
})
|
||||||
|
@ -27,7 +27,7 @@ describe('fetchWithTimeout', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fetch('https://api.infura.io/moon').then(r => r.json())
|
await fetch('https://api.infura.io/moon').then((r) => r.json())
|
||||||
assert.fail('Request should throw')
|
assert.fail('Request should throw')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assert.ok(e)
|
assert.ok(e)
|
||||||
@ -45,7 +45,7 @@ describe('fetchWithTimeout', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fetch('https://api.infura.io/moon').then(r => r.json())
|
await fetch('https://api.infura.io/moon').then((r) => r.json())
|
||||||
assert.fail('Request should be aborted')
|
assert.fail('Request should be aborted')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assert.deepEqual(e.message, 'Aborted')
|
assert.deepEqual(e.message, 'Aborted')
|
||||||
|
@ -24,7 +24,7 @@ describe('migration #31', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
migration31.migrate(oldStorage)
|
migration31.migrate(oldStorage)
|
||||||
.then(newStorage => {
|
.then((newStorage) => {
|
||||||
assert.equal(newStorage.data.PreferencesController.completedOnboarding, true)
|
assert.equal(newStorage.data.PreferencesController.completedOnboarding, true)
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
@ -47,7 +47,7 @@ describe('migration #31', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
migration31.migrate(oldStorage)
|
migration31.migrate(oldStorage)
|
||||||
.then(newStorage => {
|
.then((newStorage) => {
|
||||||
assert.equal(newStorage.data.PreferencesController.completedOnboarding, false)
|
assert.equal(newStorage.data.PreferencesController.completedOnboarding, false)
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
@ -33,7 +33,7 @@ describe('Migration to delete notice controller', function () {
|
|||||||
|
|
||||||
it('removes notice controller from state', function () {
|
it('removes notice controller from state', function () {
|
||||||
migration33.migrate(oldStorage)
|
migration33.migrate(oldStorage)
|
||||||
.then(newStorage => {
|
.then((newStorage) => {
|
||||||
assert.equal(newStorage.data.NoticeController, undefined)
|
assert.equal(newStorage.data.NoticeController, undefined)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -44,7 +44,7 @@ const firstTimeState = {
|
|||||||
describe('migrations', function () {
|
describe('migrations', function () {
|
||||||
describe('liveMigrations require list', function () {
|
describe('liveMigrations require list', function () {
|
||||||
it('should include all the migrations', async function () {
|
it('should include all the migrations', async function () {
|
||||||
const fileNames = await pify(cb => fs.readdir('./app/scripts/migrations/', cb))()
|
const fileNames = await pify((cb) => fs.readdir('./app/scripts/migrations/', cb))()
|
||||||
const migrationNumbers = fileNames.reduce((agg, filename) => {
|
const migrationNumbers = fileNames.reduce((agg, filename) => {
|
||||||
const name = filename.split('.')[0]
|
const name = filename.split('.')[0]
|
||||||
if (/^\d+$/.test(name)) {
|
if (/^\d+$/.test(name)) {
|
||||||
|
@ -119,7 +119,7 @@ describe('Actions', function () {
|
|||||||
const unlockFailedError = [ { type: 'UNLOCK_FAILED', value: 'error' } ]
|
const unlockFailedError = [ { type: 'UNLOCK_FAILED', value: 'error' } ]
|
||||||
|
|
||||||
verifySeedPhraseSpy = sinon.stub(background, 'verifySeedPhrase')
|
verifySeedPhraseSpy = sinon.stub(background, 'verifySeedPhrase')
|
||||||
verifySeedPhraseSpy.callsFake(callback => {
|
verifySeedPhraseSpy.callsFake((callback) => {
|
||||||
callback(new Error('error'))
|
callback(new Error('error'))
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -128,8 +128,8 @@ describe('Actions', function () {
|
|||||||
assert.fail('Should have thrown error')
|
assert.fail('Should have thrown error')
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
const actions1 = store.getActions()
|
const actions1 = store.getActions()
|
||||||
const warning = actions1.filter(action => action.type === 'DISPLAY_WARNING')
|
const warning = actions1.filter((action) => action.type === 'DISPLAY_WARNING')
|
||||||
const unlockFailed = actions1.filter(action => action.type === 'UNLOCK_FAILED')
|
const unlockFailed = actions1.filter((action) => action.type === 'UNLOCK_FAILED')
|
||||||
assert.deepEqual(warning, displayWarningError)
|
assert.deepEqual(warning, displayWarningError)
|
||||||
assert.deepEqual(unlockFailed, unlockFailedError)
|
assert.deepEqual(unlockFailed, unlockFailedError)
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ describe('Actions', function () {
|
|||||||
assert(removeAccountSpy.calledOnce)
|
assert(removeAccountSpy.calledOnce)
|
||||||
const actionTypes = store
|
const actionTypes = store
|
||||||
.getActions()
|
.getActions()
|
||||||
.map(action => action.type)
|
.map((action) => action.type)
|
||||||
assert.deepEqual(actionTypes, expectedActions)
|
assert.deepEqual(actionTypes, expectedActions)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ describe('Actions', function () {
|
|||||||
} catch (_) {
|
} catch (_) {
|
||||||
const actionTypes = store
|
const actionTypes = store
|
||||||
.getActions()
|
.getActions()
|
||||||
.map(action => action.type)
|
.map((action) => action.type)
|
||||||
assert.deepEqual(actionTypes, expectedActions)
|
assert.deepEqual(actionTypes, expectedActions)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -995,7 +995,7 @@ describe('Actions', function () {
|
|||||||
{ type: 'LOCK_METAMASK' },
|
{ type: 'LOCK_METAMASK' },
|
||||||
]
|
]
|
||||||
backgroundSetLockedSpy = sinon.stub(background, 'setLocked')
|
backgroundSetLockedSpy = sinon.stub(background, 'setLocked')
|
||||||
backgroundSetLockedSpy.callsFake(callback => {
|
backgroundSetLockedSpy.callsFake((callback) => {
|
||||||
callback(new Error('error'))
|
callback(new Error('error'))
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1375,7 +1375,7 @@ describe('Actions', function () {
|
|||||||
describe('#setCompletedOnboarding', function () {
|
describe('#setCompletedOnboarding', function () {
|
||||||
it('completes onboarding', async function () {
|
it('completes onboarding', async function () {
|
||||||
const completeOnboardingSpy = sinon.stub(background, 'completeOnboarding')
|
const completeOnboardingSpy = sinon.stub(background, 'completeOnboarding')
|
||||||
completeOnboardingSpy.callsFake(cb => cb())
|
completeOnboardingSpy.callsFake((cb) => cb())
|
||||||
const store = mockStore()
|
const store = mockStore()
|
||||||
await store.dispatch(actions.setCompletedOnboarding())
|
await store.dispatch(actions.setCompletedOnboarding())
|
||||||
assert.equal(completeOnboardingSpy.callCount, 1)
|
assert.equal(completeOnboardingSpy.callCount, 1)
|
||||||
|
@ -4,12 +4,12 @@ const json = methods
|
|||||||
|
|
||||||
web3.currentProvider.enable().then(() => {
|
web3.currentProvider.enable().then(() => {
|
||||||
|
|
||||||
Object.keys(json).forEach(methodGroupKey => {
|
Object.keys(json).forEach((methodGroupKey) => {
|
||||||
|
|
||||||
console.log(methodGroupKey)
|
console.log(methodGroupKey)
|
||||||
const methodGroup = json[methodGroupKey]
|
const methodGroup = json[methodGroupKey]
|
||||||
console.log(methodGroup)
|
console.log(methodGroup)
|
||||||
Object.keys(methodGroup).forEach(methodKey => {
|
Object.keys(methodGroup).forEach((methodKey) => {
|
||||||
|
|
||||||
const methodButton = document.getElementById(methodKey)
|
const methodButton = document.getElementById(methodKey)
|
||||||
methodButton.addEventListener('click', () => {
|
methodButton.addEventListener('click', () => {
|
||||||
|
@ -103,7 +103,7 @@ export default class AccountMenu extends Component {
|
|||||||
placeholder={this.context.t('searchAccounts')}
|
placeholder={this.context.t('searchAccounts')}
|
||||||
type="text"
|
type="text"
|
||||||
value={this.state.searchQuery}
|
value={this.state.searchQuery}
|
||||||
onChange={e => this.setSearchQuery(e.target.value)}
|
onChange={(e) => this.setSearchQuery(e.target.value)}
|
||||||
startAdornment={inputAdornment}
|
startAdornment={inputAdornment}
|
||||||
fullWidth
|
fullWidth
|
||||||
theme="material-white-padded"
|
theme="material-white-padded"
|
||||||
@ -133,12 +133,12 @@ export default class AccountMenu extends Component {
|
|||||||
return <p className="account-menu__no-accounts">{this.context.t('noAccountsFound')}</p>
|
return <p className="account-menu__no-accounts">{this.context.t('noAccountsFound')}</p>
|
||||||
}
|
}
|
||||||
|
|
||||||
return filteredIdentities.map(identity => {
|
return filteredIdentities.map((identity) => {
|
||||||
const isSelected = identity.address === selectedAddress
|
const isSelected = identity.address === selectedAddress
|
||||||
|
|
||||||
const simpleAddress = identity.address.substring(2).toLowerCase()
|
const simpleAddress = identity.address.substring(2).toLowerCase()
|
||||||
|
|
||||||
const keyring = keyrings.find(kr => {
|
const keyring = keyrings.find((kr) => {
|
||||||
return kr.accounts.includes(simpleAddress) || kr.accounts.includes(identity.address)
|
return kr.accounts.includes(simpleAddress) || kr.accounts.includes(identity.address)
|
||||||
})
|
})
|
||||||
const addressDomains = addressConnectedDomainMap[identity.address] || {}
|
const addressDomains = addressConnectedDomainMap[identity.address] || {}
|
||||||
@ -210,7 +210,7 @@ export default class AccountMenu extends Component {
|
|||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
className="remove-account-icon"
|
className="remove-account-icon"
|
||||||
onClick={e => this.removeAccount(e, identity)}
|
onClick={(e) => this.removeAccount(e, identity)}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)
|
)
|
||||||
@ -275,7 +275,7 @@ export default class AccountMenu extends Component {
|
|||||||
|
|
||||||
onScroll = debounce(this.setShouldShowScrollButton, 25)
|
onScroll = debounce(this.setShouldShowScrollButton, 25)
|
||||||
|
|
||||||
handleScrollDown = e => {
|
handleScrollDown = (e) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
|
||||||
const { scrollHeight } = this.accountsRef
|
const { scrollHeight } = this.accountsRef
|
||||||
@ -336,7 +336,7 @@ export default class AccountMenu extends Component {
|
|||||||
<div
|
<div
|
||||||
className="account-menu__accounts"
|
className="account-menu__accounts"
|
||||||
onScroll={this.onScroll}
|
onScroll={this.onScroll}
|
||||||
ref={ref => {
|
ref={(ref) => {
|
||||||
this.accountsRef = ref
|
this.accountsRef = ref
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -53,7 +53,7 @@ function mapStateToProps (state) {
|
|||||||
function mapDispatchToProps (dispatch) {
|
function mapDispatchToProps (dispatch) {
|
||||||
return {
|
return {
|
||||||
toggleAccountMenu: () => dispatch(toggleAccountMenu()),
|
toggleAccountMenu: () => dispatch(toggleAccountMenu()),
|
||||||
showAccountDetail: address => {
|
showAccountDetail: (address) => {
|
||||||
dispatch(showAccountDetail(address))
|
dispatch(showAccountDetail(address))
|
||||||
dispatch(hideSidebar())
|
dispatch(hideSidebar())
|
||||||
dispatch(toggleAccountMenu())
|
dispatch(toggleAccountMenu())
|
||||||
@ -64,7 +64,7 @@ function mapDispatchToProps (dispatch) {
|
|||||||
dispatch(hideSidebar())
|
dispatch(hideSidebar())
|
||||||
dispatch(toggleAccountMenu())
|
dispatch(toggleAccountMenu())
|
||||||
},
|
},
|
||||||
showRemoveAccountConfirmationModal: identity => {
|
showRemoveAccountConfirmationModal: (identity) => {
|
||||||
return dispatch(showModal({ name: 'CONFIRM_REMOVE_ACCOUNT', identity }))
|
return dispatch(showModal({ name: 'CONFIRM_REMOVE_ACCOUNT', identity }))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ export default class AppHeader extends PureComponent {
|
|||||||
<NetworkIndicator
|
<NetworkIndicator
|
||||||
network={network}
|
network={network}
|
||||||
provider={provider}
|
provider={provider}
|
||||||
onClick={event => this.handleNetworkIndicatorClick(event)}
|
onClick={(event) => this.handleNetworkIndicatorClick(event)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,7 +5,7 @@ import { compose } from 'recompose'
|
|||||||
import AppHeader from './app-header.component'
|
import AppHeader from './app-header.component'
|
||||||
import * as actions from '../../../store/actions'
|
import * as actions from '../../../store/actions'
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = (state) => {
|
||||||
const { appState, metamask } = state
|
const { appState, metamask } = state
|
||||||
const { networkDropdownOpen } = appState
|
const { networkDropdownOpen } = appState
|
||||||
const {
|
const {
|
||||||
@ -26,7 +26,7 @@ const mapStateToProps = state => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
showNetworkDropdown: () => dispatch(actions.showNetworkDropdown()),
|
showNetworkDropdown: () => dispatch(actions.showNetworkDropdown()),
|
||||||
hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()),
|
hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()),
|
||||||
|
@ -29,7 +29,7 @@ describe('App Header', function () {
|
|||||||
wrapper = shallow(
|
wrapper = shallow(
|
||||||
<AppHeader.WrappedComponent {...props} />, {
|
<AppHeader.WrappedComponent {...props} />, {
|
||||||
context: {
|
context: {
|
||||||
t: str => str,
|
t: (str) => str,
|
||||||
metricsEvent: () => {},
|
metricsEvent: () => {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import classnames from 'classnames'
|
|||||||
import UserPreferencedCurrencyDisplay from '../../user-preferenced-currency-display'
|
import UserPreferencedCurrencyDisplay from '../../user-preferenced-currency-display'
|
||||||
import { PRIMARY, SECONDARY } from '../../../../helpers/constants/common'
|
import { PRIMARY, SECONDARY } from '../../../../helpers/constants/common'
|
||||||
|
|
||||||
const ConfirmDetailRow = props => {
|
const ConfirmDetailRow = (props) => {
|
||||||
const {
|
const {
|
||||||
label,
|
label,
|
||||||
primaryText,
|
primaryText,
|
||||||
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
|
|||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import Identicon from '../../../../ui/identicon'
|
import Identicon from '../../../../ui/identicon'
|
||||||
|
|
||||||
const ConfirmPageContainerSummary = props => {
|
const ConfirmPageContainerSummary = (props) => {
|
||||||
const {
|
const {
|
||||||
action,
|
action,
|
||||||
title,
|
title,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
const ConfirmPageContainerWarning = props => {
|
const ConfirmPageContainerWarning = (props) => {
|
||||||
return (
|
return (
|
||||||
<div className="confirm-page-container-warning">
|
<div className="confirm-page-container-warning">
|
||||||
<img
|
<img
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
const ConfirmPageContainerNavigation = props => {
|
const ConfirmPageContainerNavigation = (props) => {
|
||||||
const { onNextTx, totalTx, positionOfCurrentTx, nextTxId, prevTxId, showNavigation, firstTx, lastTx, ofText, requestsWaitingText } = props
|
const { onNextTx, totalTx, positionOfCurrentTx, nextTxId, prevTxId, showNavigation, firstTx, lastTx, ofText, requestsWaitingText } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -14,7 +14,7 @@ import {
|
|||||||
} from '../../../selectors/selectors'
|
} from '../../../selectors/selectors'
|
||||||
import { getOriginFromUrl } from '../../../helpers/utils/util'
|
import { getOriginFromUrl } from '../../../helpers/utils/util'
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = (state) => {
|
||||||
const addressConnectedToCurrentTab = getAddressConnectedToCurrentTab(state)
|
const addressConnectedToCurrentTab = getAddressConnectedToCurrentTab(state)
|
||||||
const { openMetaMaskTabs } = state.appState
|
const { openMetaMaskTabs } = state.appState
|
||||||
const { title, url, id } = state.activeTab
|
const { title, url, id } = state.activeTab
|
||||||
@ -36,7 +36,7 @@ const mapStateToProps = state => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
showDisconnectAccountModal: (domainKey, domain) => {
|
showDisconnectAccountModal: (domainKey, domain) => {
|
||||||
dispatch(showModal({ name: 'DISCONNECT_ACCOUNT', domainKey, domain }))
|
dispatch(showModal({ name: 'DISCONNECT_ACCOUNT', domainKey, domain }))
|
||||||
|
@ -39,7 +39,7 @@ function mapDispatchToProps (dispatch) {
|
|||||||
dispatch(actions.delRpcTarget(target))
|
dispatch(actions.delRpcTarget(target))
|
||||||
},
|
},
|
||||||
hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()),
|
hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()),
|
||||||
setNetworksTabAddMode: isInAddMode => dispatch(actions.setNetworksTabAddMode(isInAddMode)),
|
setNetworksTabAddMode: (isInAddMode) => dispatch(actions.setNetworksTabAddMode(isInAddMode)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ class NetworkDropdown extends Component {
|
|||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
onClickOutside={(event) => {
|
onClickOutside={(event) => {
|
||||||
const { classList } = event.target
|
const { classList } = event.target
|
||||||
const isInClassList = className => classList.contains(className)
|
const isInClassList = (className) => classList.contains(className)
|
||||||
const notToggleElementIndex = R.findIndex(isInClassList)(notToggleElementClassnames)
|
const notToggleElementIndex = R.findIndex(isInClassList)(notToggleElementClassnames)
|
||||||
|
|
||||||
if (notToggleElementIndex === -1) {
|
if (notToggleElementIndex === -1) {
|
||||||
|
@ -17,7 +17,7 @@ class SimpleDropdown extends Component {
|
|||||||
|
|
||||||
getDisplayValue () {
|
getDisplayValue () {
|
||||||
const { selectedOption, options } = this.props
|
const { selectedOption, options } = this.props
|
||||||
const matchesOption = option => option.value === selectedOption
|
const matchesOption = (option) => option.value === selectedOption
|
||||||
const matchingOption = R.find(matchesOption)(options)
|
const matchingOption = R.find(matchesOption)(options)
|
||||||
return matchingOption
|
return matchingOption
|
||||||
? matchingOption.displayValue || matchingOption.value
|
? matchingOption.displayValue || matchingOption.value
|
||||||
@ -41,7 +41,7 @@ class SimpleDropdown extends Component {
|
|||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
className="simple-dropdown__close-area"
|
className="simple-dropdown__close-area"
|
||||||
onClick={event => {
|
onClick={(event) => {
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
this.handleClose()
|
this.handleClose()
|
||||||
}}
|
}}
|
||||||
|
@ -15,7 +15,7 @@ function convertGasLimitForInputs (gasLimitInHexWEI) {
|
|||||||
return parseInt(gasLimitInHexWEI, 16) || 0
|
return parseInt(gasLimitInHexWEI, 16) || 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
showGasPriceInfoModal: () => dispatch(showModal({ name: 'GAS_PRICE_INFO_MODAL' })),
|
showGasPriceInfoModal: () => dispatch(showModal({ name: 'GAS_PRICE_INFO_MODAL' })),
|
||||||
showGasLimitInfoModal: () => dispatch(showModal({ name: 'GAS_LIMIT_INFO_MODAL' })),
|
showGasLimitInfoModal: () => dispatch(showModal({ name: 'GAS_LIMIT_INFO_MODAL' })),
|
||||||
|
@ -27,7 +27,7 @@ describe('Advanced Gas Inputs', function () {
|
|||||||
{...props}
|
{...props}
|
||||||
/>, {
|
/>, {
|
||||||
context: {
|
context: {
|
||||||
t: str => str,
|
t: (str) => str,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -32,7 +32,7 @@ const mockGasPriceButtonGroupProps = {
|
|||||||
gasEstimateType: GAS_ESTIMATE_TYPES.AVERAGE,
|
gasEstimateType: GAS_ESTIMATE_TYPES.AVERAGE,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
handleGasPriceSelection: newPrice => console.log('NewPrice: ', newPrice),
|
handleGasPriceSelection: (newPrice) => console.log('NewPrice: ', newPrice),
|
||||||
noButtonActiveByDefault: true,
|
noButtonActiveByDefault: true,
|
||||||
showCheck: true,
|
showCheck: true,
|
||||||
}
|
}
|
||||||
|
@ -49,10 +49,10 @@ export default class GasModalPageContainer extends Component {
|
|||||||
const promise = this.props.hideBasic
|
const promise = this.props.hideBasic
|
||||||
? Promise.resolve(this.props.blockTime)
|
? Promise.resolve(this.props.blockTime)
|
||||||
: this.props.fetchBasicGasAndTimeEstimates()
|
: this.props.fetchBasicGasAndTimeEstimates()
|
||||||
.then(basicEstimates => basicEstimates.blockTime)
|
.then((basicEstimates) => basicEstimates.blockTime)
|
||||||
|
|
||||||
promise
|
promise
|
||||||
.then(blockTime => {
|
.then((blockTime) => {
|
||||||
this.props.fetchGasEstimates(blockTime)
|
this.props.fetchGasEstimates(blockTime)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -165,8 +165,8 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
const updateCustomGasPrice = newPrice => dispatch(setCustomGasPrice(addHexPrefix(newPrice)))
|
const updateCustomGasPrice = (newPrice) => dispatch(setCustomGasPrice(addHexPrefix(newPrice)))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
cancelAndClose: () => {
|
cancelAndClose: () => {
|
||||||
@ -175,7 +175,7 @@ const mapDispatchToProps = dispatch => {
|
|||||||
},
|
},
|
||||||
hideModal: () => dispatch(hideModal()),
|
hideModal: () => dispatch(hideModal()),
|
||||||
updateCustomGasPrice,
|
updateCustomGasPrice,
|
||||||
updateCustomGasLimit: newLimit => dispatch(setCustomGasLimit(addHexPrefix(newLimit))),
|
updateCustomGasLimit: (newLimit) => dispatch(setCustomGasLimit(addHexPrefix(newLimit))),
|
||||||
setGasData: (newLimit, newPrice) => {
|
setGasData: (newLimit, newPrice) => {
|
||||||
dispatch(setGasLimit(newLimit))
|
dispatch(setGasLimit(newLimit))
|
||||||
dispatch(setGasPrice(newPrice))
|
dispatch(setGasPrice(newPrice))
|
||||||
|
@ -261,7 +261,7 @@ export function generateChart (gasPrices, estimatedTimes, gasPricesMax, estimate
|
|||||||
contents: function (d) {
|
contents: function (d) {
|
||||||
const titleFormat = this.config.tooltip_format_title
|
const titleFormat = this.config.tooltip_format_title
|
||||||
let text
|
let text
|
||||||
d.forEach(el => {
|
d.forEach((el) => {
|
||||||
if (el && (el.value || el.value === 0) && !text) {
|
if (el && (el.value || el.value === 0) && !text) {
|
||||||
text = "<table class='" + 'custom-tooltip' + "'>" + "<tr><th colspan='2'>" + titleFormat(el.x) + '</th></tr>'
|
text = "<table class='" + 'custom-tooltip' + "'>" + "<tr><th colspan='2'>" + titleFormat(el.x) + '</th></tr>'
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ export default class GasSlider extends Component {
|
|||||||
min={min}
|
min={min}
|
||||||
value={value}
|
value={value}
|
||||||
id="gasSlider"
|
id="gasSlider"
|
||||||
onChange={event => onChange(event.target.value)}
|
onChange={(event) => onChange(event.target.value)}
|
||||||
/>
|
/>
|
||||||
<div className="gas-slider__bar">
|
<div className="gas-slider__bar">
|
||||||
<div className="gas-slider__colored" />
|
<div className="gas-slider__colored" />
|
||||||
|
@ -3,7 +3,7 @@ import LoadingNetworkScreen from './loading-network-screen.component'
|
|||||||
import * as actions from '../../../store/actions'
|
import * as actions from '../../../store/actions'
|
||||||
import { getNetworkIdentifier } from '../../../selectors/selectors'
|
import { getNetworkIdentifier } from '../../../selectors/selectors'
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = (state) => {
|
||||||
const {
|
const {
|
||||||
loadingMessage,
|
loadingMessage,
|
||||||
} = state.appState
|
} = state.appState
|
||||||
@ -28,7 +28,7 @@ const mapStateToProps = state => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
setProviderType: (type) => {
|
setProviderType: (type) => {
|
||||||
dispatch(actions.setProviderType(type))
|
dispatch(actions.setProviderType(type))
|
||||||
|
@ -3,7 +3,7 @@ import { WALLET_VIEW_SIDEBAR } from '../sidebars/sidebar.constants'
|
|||||||
import MenuBar from './menu-bar.component'
|
import MenuBar from './menu-bar.component'
|
||||||
import { showSidebar, hideSidebar } from '../../../store/actions'
|
import { showSidebar, hideSidebar } from '../../../store/actions'
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = (state) => {
|
||||||
const { appState: { sidebar: { isOpen } } } = state
|
const { appState: { sidebar: { isOpen } } } = state
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -11,7 +11,7 @@ const mapStateToProps = state => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
showSidebar: () => {
|
showSidebar: () => {
|
||||||
dispatch(showSidebar({
|
dispatch(showSidebar({
|
||||||
|
@ -46,7 +46,7 @@ export default class AccountDetailsModal extends Component {
|
|||||||
<EditableLabel
|
<EditableLabel
|
||||||
className="account-modal__name"
|
className="account-modal__name"
|
||||||
defaultValue={name}
|
defaultValue={name}
|
||||||
onSubmit={label => setAccountLabel(address, label)}
|
onSubmit={(label) => setAccountLabel(address, label)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<QrView
|
<QrView
|
||||||
|
@ -24,13 +24,13 @@ export default class AddToAddressBookModal extends Component {
|
|||||||
hideModal()
|
hideModal()
|
||||||
}
|
}
|
||||||
|
|
||||||
onChange = e => {
|
onChange = (e) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
alias: e.target.value,
|
alias: e.target.value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyPress = e => {
|
onKeyPress = (e) => {
|
||||||
if (e.key === 'Enter' && this.state.alias) {
|
if (e.key === 'Enter' && this.state.alias) {
|
||||||
this.onSave()
|
this.onSave()
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
createCancelTransaction: (txId, customGasPrice) => {
|
createCancelTransaction: (txId, customGasPrice) => {
|
||||||
return dispatch(createCancelTransaction(txId, customGasPrice))
|
return dispatch(createCancelTransaction(txId, customGasPrice))
|
||||||
|
@ -7,7 +7,7 @@ import CancelTransactionGasFee from '../cancel-transaction-gas-fee'
|
|||||||
import Modal from '../../../modal'
|
import Modal from '../../../modal'
|
||||||
|
|
||||||
describe('CancelTransaction Component', function () {
|
describe('CancelTransaction Component', function () {
|
||||||
const t = key => key
|
const t = (key) => key
|
||||||
|
|
||||||
it('should render a CancelTransaction modal', function () {
|
it('should render a CancelTransaction modal', function () {
|
||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
|
@ -4,7 +4,7 @@ import withModalProps from '../../../../helpers/higher-order-components/with-mod
|
|||||||
import ConfirmDeleteNetwork from './confirm-delete-network.component'
|
import ConfirmDeleteNetwork from './confirm-delete-network.component'
|
||||||
import { delRpcTarget } from '../../../../store/actions'
|
import { delRpcTarget } from '../../../../store/actions'
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
delRpcTarget: (target) => dispatch(delRpcTarget(target)),
|
delRpcTarget: (target) => dispatch(delRpcTarget(target)),
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ describe('Confirm Delete Network', function () {
|
|||||||
wrapper = mount(
|
wrapper = mount(
|
||||||
<ConfirmDeleteNetwork.WrappedComponent {...props} />, {
|
<ConfirmDeleteNetwork.WrappedComponent {...props} />, {
|
||||||
context: {
|
context: {
|
||||||
t: str => str,
|
t: (str) => str,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -4,13 +4,13 @@ import ConfirmRemoveAccount from './confirm-remove-account.component'
|
|||||||
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props'
|
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props'
|
||||||
import { removeAccount } from '../../../../store/actions'
|
import { removeAccount } from '../../../../store/actions'
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = (state) => {
|
||||||
return {
|
return {
|
||||||
network: state.metamask.network,
|
network: state.metamask.network,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
removeAccount: (address) => dispatch(removeAccount(address)),
|
removeAccount: (address) => dispatch(removeAccount(address)),
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ describe('Confirm Remove Account', function () {
|
|||||||
<ConfirmRemoveAccount.WrappedComponent {...props} />
|
<ConfirmRemoveAccount.WrappedComponent {...props} />
|
||||||
</Provider>, {
|
</Provider>, {
|
||||||
context: {
|
context: {
|
||||||
t: str => str,
|
t: (str) => str,
|
||||||
store,
|
store,
|
||||||
},
|
},
|
||||||
childContextTypes: {
|
childContextTypes: {
|
||||||
|
@ -4,7 +4,7 @@ import withModalProps from '../../../../helpers/higher-order-components/with-mod
|
|||||||
import ConfirmResetAccount from './confirm-reset-account.component'
|
import ConfirmResetAccount from './confirm-reset-account.component'
|
||||||
import { resetAccount } from '../../../../store/actions'
|
import { resetAccount } from '../../../../store/actions'
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
resetAccount: () => dispatch(resetAccount()),
|
resetAccount: () => dispatch(resetAccount()),
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ describe('Confirm Reset Account', function () {
|
|||||||
wrapper = mount(
|
wrapper = mount(
|
||||||
<ConfirmResetAccount.WrappedComponent {...props} />, {
|
<ConfirmResetAccount.WrappedComponent {...props} />, {
|
||||||
context: {
|
context: {
|
||||||
t: str => str,
|
t: (str) => str,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -79,7 +79,7 @@ export default class DepositEtherModal extends Component {
|
|||||||
render () {
|
render () {
|
||||||
const { network, toWyre, toCoinSwitch, address, toFaucet } = this.props
|
const { network, toWyre, toCoinSwitch, address, toFaucet } = this.props
|
||||||
|
|
||||||
const isTestNetwork = ['3', '4', '5', '42'].find(n => n === network)
|
const isTestNetwork = ['3', '4', '5', '42'].find((n) => n === network)
|
||||||
const networkName = getNetworkDisplayName(network)
|
const networkName = getNetworkDisplayName(network)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -26,7 +26,7 @@ function mapDispatchToProps (dispatch) {
|
|||||||
showAccountDetailModal: () => {
|
showAccountDetailModal: () => {
|
||||||
dispatch(showModal({ name: 'ACCOUNT_DETAILS' }))
|
dispatch(showModal({ name: 'ACCOUNT_DETAILS' }))
|
||||||
},
|
},
|
||||||
toFaucet: network => dispatch(buyEth({ network })),
|
toFaucet: (network) => dispatch(buyEth({ network })),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,17 +5,17 @@ import DisconnectAccount from './disconnect-account.component'
|
|||||||
import { getCurrentAccountWithSendEtherInfo } from '../../../../selectors/selectors'
|
import { getCurrentAccountWithSendEtherInfo } from '../../../../selectors/selectors'
|
||||||
import { removePermissionsFor } from '../../../../store/actions'
|
import { removePermissionsFor } from '../../../../store/actions'
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = (state) => {
|
||||||
return {
|
return {
|
||||||
...(state.appState.modal.modalState.props || {}),
|
...(state.appState.modal.modalState.props || {}),
|
||||||
accountLabel: getCurrentAccountWithSendEtherInfo(state).name,
|
accountLabel: getCurrentAccountWithSendEtherInfo(state).name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
disconnectAccount: (domainKey, domain) => {
|
disconnectAccount: (domainKey, domain) => {
|
||||||
const permissionMethodNames = domain.permissions.map(perm => perm.parentCapability)
|
const permissionMethodNames = domain.permissions.map((perm) => perm.parentCapability)
|
||||||
dispatch(removePermissionsFor({ [domainKey]: permissionMethodNames }))
|
dispatch(removePermissionsFor({ [domainKey]: permissionMethodNames }))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import withModalProps from '../../../../helpers/higher-order-components/with-mod
|
|||||||
import DisconnectAll from './disconnect-all.component'
|
import DisconnectAll from './disconnect-all.component'
|
||||||
import { clearPermissions } from '../../../../store/actions'
|
import { clearPermissions } from '../../../../store/actions'
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
disconnectAll: () => {
|
disconnectAll: () => {
|
||||||
dispatch(clearPermissions())
|
dispatch(clearPermissions())
|
||||||
|
@ -38,7 +38,7 @@ export default class ExportPrivateKeyModal extends Component {
|
|||||||
const { exportAccount } = this.props
|
const { exportAccount } = this.props
|
||||||
|
|
||||||
exportAccount(password, address)
|
exportAccount(password, address)
|
||||||
.then(privateKey => this.setState({
|
.then((privateKey) => this.setState({
|
||||||
privateKey,
|
privateKey,
|
||||||
showWarning: false,
|
showWarning: false,
|
||||||
}))
|
}))
|
||||||
@ -65,7 +65,7 @@ export default class ExportPrivateKeyModal extends Component {
|
|||||||
<input
|
<input
|
||||||
type="password"
|
type="password"
|
||||||
className="private-key-password-input"
|
className="private-key-password-input"
|
||||||
onChange={event => this.setState({ password: event.target.value })}
|
onChange={(event) => this.setState({ password: event.target.value })}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import PropTypes from 'prop-types'
|
|||||||
let index = 0
|
let index = 0
|
||||||
let extraSheet
|
let extraSheet
|
||||||
|
|
||||||
const insertRule = css => {
|
const insertRule = (css) => {
|
||||||
|
|
||||||
if (!extraSheet) {
|
if (!extraSheet) {
|
||||||
// First time, create an extra stylesheet for adding rules
|
// First time, create an extra stylesheet for adding rules
|
||||||
@ -20,7 +20,7 @@ const insertRule = css => {
|
|||||||
return extraSheet
|
return extraSheet
|
||||||
}
|
}
|
||||||
|
|
||||||
const insertKeyframesRule = keyframes => {
|
const insertKeyframesRule = (keyframes) => {
|
||||||
// random name
|
// random name
|
||||||
const name = 'anim_' + (++index) + (+new Date())
|
const name = 'anim_' + (++index) + (+new Date())
|
||||||
let css = '@' + 'keyframes ' + name + ' {'
|
let css = '@' + 'keyframes ' + name + ' {'
|
||||||
@ -212,7 +212,7 @@ class FadeModal extends Component {
|
|||||||
<div className="modal" style={modalStyle}>
|
<div className="modal" style={modalStyle}>
|
||||||
<div
|
<div
|
||||||
className="content"
|
className="content"
|
||||||
ref={el => (this.content = el)}
|
ref={(el) => (this.content = el)}
|
||||||
tabIndex="-1"
|
tabIndex="-1"
|
||||||
style={contentStyle}
|
style={contentStyle}
|
||||||
>
|
>
|
||||||
|
@ -15,7 +15,7 @@ function mapStateToProps (state) {
|
|||||||
function mapDispatchToProps (dispatch) {
|
function mapDispatchToProps (dispatch) {
|
||||||
return {
|
return {
|
||||||
hideModal: () => dispatch(actions.hideModal()),
|
hideModal: () => dispatch(actions.hideModal()),
|
||||||
hideToken: address => {
|
hideToken: (address) => {
|
||||||
dispatch(actions.removeToken(address))
|
dispatch(actions.removeToken(address))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
dispatch(actions.hideModal())
|
dispatch(actions.hideModal())
|
||||||
|
@ -12,7 +12,7 @@ const mapStateToProps = (_, ownProps) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
setParticipateInMetaMetrics: (val) => dispatch(setParticipateInMetaMetrics(val)),
|
setParticipateInMetaMetrics: (val) => dispatch(setParticipateInMetaMetrics(val)),
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ export default class NewAccountModal extends Component {
|
|||||||
alias: '',
|
alias: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
onChange = e => {
|
onChange = (e) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
alias: e.target.value,
|
alias: e.target.value,
|
||||||
})
|
})
|
||||||
@ -29,7 +29,7 @@ export default class NewAccountModal extends Component {
|
|||||||
.then(this.props.hideModal)
|
.then(this.props.hideModal)
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyPress = e => {
|
onKeyPress = (e) => {
|
||||||
if (e.key === 'Enter' && this.state.alias) {
|
if (e.key === 'Enter' && this.state.alias) {
|
||||||
this.onSubmit()
|
this.onSubmit()
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,9 @@ function mapStateToProps (state) {
|
|||||||
function mapDispatchToProps (dispatch) {
|
function mapDispatchToProps (dispatch) {
|
||||||
return {
|
return {
|
||||||
hideModal: () => dispatch(actions.hideModal()),
|
hideModal: () => dispatch(actions.hideModal()),
|
||||||
createAccount: newAccountName => {
|
createAccount: (newAccountName) => {
|
||||||
return dispatch(actions.addNewAccount())
|
return dispatch(actions.addNewAccount())
|
||||||
.then(newAccountAddress => {
|
.then((newAccountAddress) => {
|
||||||
if (newAccountName) {
|
if (newAccountName) {
|
||||||
dispatch(actions.setAccountLabel(newAccountAddress, newAccountName))
|
dispatch(actions.setAccountLabel(newAccountAddress, newAccountName))
|
||||||
}
|
}
|
||||||
@ -36,7 +36,7 @@ function mergeProps (stateProps, dispatchProps) {
|
|||||||
...dispatchProps,
|
...dispatchProps,
|
||||||
onSave: (newAccountName) => {
|
onSave: (newAccountName) => {
|
||||||
return createAccount(newAccountName)
|
return createAccount(newAccountName)
|
||||||
.then(newAccountAddress => onCreateNewAccount(newAccountAddress))
|
.then((newAccountAddress) => onCreateNewAccount(newAccountAddress))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ NotificationModal.propTypes = {
|
|||||||
onConfirm: PropTypes.func,
|
onConfirm: PropTypes.func,
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
hideModal: () => {
|
hideModal: () => {
|
||||||
dispatch(hideModal())
|
dispatch(hideModal())
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user