mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix linting warnings
This commit is contained in:
parent
afbe6f5e5f
commit
6bdb4c8728
@ -4,7 +4,7 @@ const ethUtil = require('ethereumjs-util')
|
|||||||
|
|
||||||
const accountImporter = {
|
const accountImporter = {
|
||||||
|
|
||||||
importAccount(strategy, args) {
|
importAccount (strategy, args) {
|
||||||
try {
|
try {
|
||||||
const importer = this.strategies[strategy]
|
const importer = this.strategies[strategy]
|
||||||
const privateKeyHex = importer.apply(null, args)
|
const privateKeyHex = importer.apply(null, args)
|
||||||
|
@ -41,10 +41,10 @@ asyncQ.waterfall([
|
|||||||
// State and Persistence
|
// State and Persistence
|
||||||
//
|
//
|
||||||
|
|
||||||
function loadStateFromPersistence() {
|
function loadStateFromPersistence () {
|
||||||
// migrations
|
// migrations
|
||||||
let migrator = new Migrator({ migrations })
|
const migrator = new Migrator({ migrations })
|
||||||
let initialState = migrator.generateInitialState(firstTimeState)
|
const initialState = migrator.generateInitialState(firstTimeState)
|
||||||
return asyncQ.waterfall([
|
return asyncQ.waterfall([
|
||||||
// read from disk
|
// read from disk
|
||||||
() => Promise.resolve(diskStore.getState() || initialState),
|
() => Promise.resolve(diskStore.getState() || initialState),
|
||||||
@ -61,7 +61,6 @@ function loadStateFromPersistence() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setupController (initState) {
|
function setupController (initState) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// MetaMask Controller
|
// MetaMask Controller
|
||||||
//
|
//
|
||||||
@ -85,8 +84,8 @@ function setupController (initState) {
|
|||||||
diskStore
|
diskStore
|
||||||
)
|
)
|
||||||
|
|
||||||
function versionifyData(state) {
|
function versionifyData (state) {
|
||||||
let versionedData = diskStore.getState()
|
const versionedData = diskStore.getState()
|
||||||
versionedData.data = state
|
versionedData.data = state
|
||||||
return versionedData
|
return versionedData
|
||||||
}
|
}
|
||||||
@ -138,7 +137,6 @@ function setupController (initState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -77,7 +77,7 @@ function doctypeCheck () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function suffixCheck() {
|
function suffixCheck () {
|
||||||
var prohibitedTypes = ['xml', 'pdf']
|
var prohibitedTypes = ['xml', 'pdf']
|
||||||
var currentUrl = window.location.href
|
var currentUrl = window.location.href
|
||||||
var currentRegex
|
var currentRegex
|
||||||
|
@ -39,11 +39,11 @@ class AddressBookController {
|
|||||||
// pushed object is an object of two fields. Current behavior does not set an
|
// pushed object is an object of two fields. Current behavior does not set an
|
||||||
// upper limit to the number of addresses.
|
// upper limit to the number of addresses.
|
||||||
_addToAddressBook (address, name) {
|
_addToAddressBook (address, name) {
|
||||||
let addressBook = this._getAddressBook()
|
const addressBook = this._getAddressBook()
|
||||||
let identities = this._getIdentities()
|
const identities = this._getIdentities()
|
||||||
|
|
||||||
let addressBookIndex = addressBook.findIndex((element) => { return element.address.toLowerCase() === address.toLowerCase() || element.name === name })
|
const addressBookIndex = addressBook.findIndex((element) => { return element.address.toLowerCase() === address.toLowerCase() || element.name === name })
|
||||||
let identitiesIndex = Object.keys(identities).findIndex((element) => { return element.toLowerCase() === address.toLowerCase() })
|
const identitiesIndex = Object.keys(identities).findIndex((element) => { return element.toLowerCase() === address.toLowerCase() })
|
||||||
// trigger this condition if we own this address--no need to overwrite.
|
// trigger this condition if we own this address--no need to overwrite.
|
||||||
if (identitiesIndex !== -1) {
|
if (identitiesIndex !== -1) {
|
||||||
return Promise.resolve(addressBook)
|
return Promise.resolve(addressBook)
|
||||||
|
@ -51,9 +51,11 @@ class CurrencyController {
|
|||||||
this.setConversionRate(Number(parsedResponse.ticker.price))
|
this.setConversionRate(Number(parsedResponse.ticker.price))
|
||||||
this.setConversionDate(Number(parsedResponse.timestamp))
|
this.setConversionDate(Number(parsedResponse.timestamp))
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.warn('MetaMask - Failed to query currency conversion.')
|
if (err) {
|
||||||
this.setConversionRate(0)
|
console.warn('MetaMask - Failed to query currency conversion.')
|
||||||
this.setConversionDate('N/A')
|
this.setConversionRate(0)
|
||||||
|
this.setConversionDate('N/A')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ class PreferencesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addToFrequentRpcList (_url) {
|
addToFrequentRpcList (_url) {
|
||||||
let rpcList = this.getFrequentRpcList()
|
const rpcList = this.getFrequentRpcList()
|
||||||
let index = rpcList.findIndex((element) => { return element === _url })
|
const index = rpcList.findIndex((element) => { return element === _url })
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
rpcList.splice(index, 1)
|
rpcList.splice(index, 1)
|
||||||
}
|
}
|
||||||
@ -53,13 +53,9 @@ class PreferencesController {
|
|||||||
getFrequentRpcList () {
|
getFrequentRpcList () {
|
||||||
return this.store.getState().frequentRpcList
|
return this.store.getState().frequentRpcList
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// PRIVATE METHODS
|
// PRIVATE METHODS
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = PreferencesController
|
module.exports = PreferencesController
|
||||||
|
@ -8,4 +8,4 @@ module.exports = {
|
|||||||
type: 'testnet',
|
type: 'testnet',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ class KeyringController extends EventEmitter {
|
|||||||
.then((accounts) => {
|
.then((accounts) => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'Simple Key Pair':
|
case 'Simple Key Pair':
|
||||||
let isNotIncluded = !accounts.find((key) => key === newAccount[0] || key === ethUtil.stripHexPrefix(newAccount[0]))
|
const isNotIncluded = !accounts.find((key) => key === newAccount[0] || key === ethUtil.stripHexPrefix(newAccount[0]))
|
||||||
return (isNotIncluded) ? Promise.resolve(newAccount) : Promise.reject(new Error('The account you\'re are trying to import is a duplicate'))
|
return (isNotIncluded) ? Promise.resolve(newAccount) : Promise.reject(new Error('The account you\'re are trying to import is a duplicate'))
|
||||||
default:
|
default:
|
||||||
return Promise.resolve(newAccount)
|
return Promise.resolve(newAccount)
|
||||||
@ -582,7 +582,7 @@ class KeyringController extends EventEmitter {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateMemStoreKeyrings() {
|
_updateMemStoreKeyrings () {
|
||||||
Promise.all(this.keyrings.map(this.displayForKeyring))
|
Promise.all(this.keyrings.map(this.displayForKeyring))
|
||||||
.then((keyrings) => {
|
.then((keyrings) => {
|
||||||
this.memStore.updateState({ keyrings })
|
this.memStore.updateState({ keyrings })
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module.exports = getBuyEthUrl
|
module.exports = getBuyEthUrl
|
||||||
|
|
||||||
function getBuyEthUrl({ network, amount, address }){
|
function getBuyEthUrl ({ network, amount, address }) {
|
||||||
let url
|
let url
|
||||||
switch (network) {
|
switch (network) {
|
||||||
case '1':
|
case '1':
|
||||||
@ -16,4 +16,4 @@ function getBuyEthUrl({ network, amount, address }){
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
const async = require('async')
|
const async = require('async')
|
||||||
const EthQuery = require('eth-query')
|
const EthQuery = require('eth-query')
|
||||||
const ObservableStore = require('obs-store')
|
const ObservableStore = require('obs-store')
|
||||||
function noop() {}
|
function noop () {}
|
||||||
|
|
||||||
|
|
||||||
class EthereumStore extends ObservableStore {
|
class EthereumStore extends ObservableStore {
|
||||||
|
@ -85,7 +85,7 @@ MetamaskInpageProvider.prototype.send = function (payload) {
|
|||||||
break
|
break
|
||||||
|
|
||||||
case 'net_version':
|
case 'net_version':
|
||||||
let networkVersion = self.publicConfigStore.getState().networkVersion
|
const networkVersion = self.publicConfigStore.getState().networkVersion
|
||||||
result = networkVersion
|
result = networkVersion
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ function eachJsonMessage (payload, transformFn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function logStreamDisconnectWarning(remoteLabel, err){
|
function logStreamDisconnectWarning (remoteLabel, err) {
|
||||||
let warningMsg = `MetamaskInpageProvider - lost connection to ${remoteLabel}`
|
let warningMsg = `MetamaskInpageProvider - lost connection to ${remoteLabel}`
|
||||||
if (err) warningMsg += '\n' + err.stack
|
if (err) warningMsg += '\n' + err.stack
|
||||||
console.warn(warningMsg)
|
console.warn(warningMsg)
|
||||||
|
@ -4,7 +4,7 @@ const ethUtil = require('ethereumjs-util')
|
|||||||
const createId = require('./random-id')
|
const createId = require('./random-id')
|
||||||
|
|
||||||
|
|
||||||
module.exports = class MessageManager extends EventEmitter{
|
module.exports = class MessageManager extends EventEmitter {
|
||||||
constructor (opts) {
|
constructor (opts) {
|
||||||
super()
|
super()
|
||||||
this.memStore = new ObservableStore({
|
this.memStore = new ObservableStore({
|
||||||
@ -108,7 +108,7 @@ module.exports = class MessageManager extends EventEmitter{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeMsgData(data) {
|
function normalizeMsgData (data) {
|
||||||
if (data.slice(0, 2) === '0x') {
|
if (data.slice(0, 2) === '0x') {
|
||||||
// data is already hex
|
// data is already hex
|
||||||
return data
|
return data
|
||||||
|
@ -3,17 +3,17 @@ const asyncQ = require('async-q')
|
|||||||
class Migrator {
|
class Migrator {
|
||||||
|
|
||||||
constructor (opts = {}) {
|
constructor (opts = {}) {
|
||||||
let migrations = opts.migrations || []
|
const migrations = opts.migrations || []
|
||||||
this.migrations = migrations.sort((a, b) => a.version - b.version)
|
this.migrations = migrations.sort((a, b) => a.version - b.version)
|
||||||
let lastMigration = this.migrations.slice(-1)[0]
|
const lastMigration = this.migrations.slice(-1)[0]
|
||||||
// use specified defaultVersion or highest migration version
|
// use specified defaultVersion or highest migration version
|
||||||
this.defaultVersion = opts.defaultVersion || (lastMigration && lastMigration.version) || 0
|
this.defaultVersion = opts.defaultVersion || (lastMigration && lastMigration.version) || 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// run all pending migrations on meta in place
|
// run all pending migrations on meta in place
|
||||||
migrateData (versionedData = this.generateInitialState()) {
|
migrateData (versionedData = this.generateInitialState()) {
|
||||||
let remaining = this.migrations.filter(migrationIsPending)
|
const remaining = this.migrations.filter(migrationIsPending)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
asyncQ.eachSeries(remaining, (migration) => this.runMigration(versionedData, migration))
|
asyncQ.eachSeries(remaining, (migration) => this.runMigration(versionedData, migration))
|
||||||
.then(() => versionedData)
|
.then(() => versionedData)
|
||||||
@ -21,12 +21,12 @@ class Migrator {
|
|||||||
|
|
||||||
// migration is "pending" if hit has a higher
|
// migration is "pending" if hit has a higher
|
||||||
// version number than currentVersion
|
// version number than currentVersion
|
||||||
function migrationIsPending(migration) {
|
function migrationIsPending (migration) {
|
||||||
return migration.version > versionedData.meta.version
|
return migration.version > versionedData.meta.version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
runMigration(versionedData, migration) {
|
runMigration (versionedData, migration) {
|
||||||
return (
|
return (
|
||||||
migration.migrate(versionedData)
|
migration.migrate(versionedData)
|
||||||
.then((versionedData) => {
|
.then((versionedData) => {
|
||||||
|
@ -71,4 +71,4 @@ class NotificationManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = NotificationManager
|
module.exports = NotificationManager
|
||||||
|
@ -5,7 +5,7 @@ const createId = require('./random-id')
|
|||||||
const hexRe = /^[0-9A-Fa-f]+$/g
|
const hexRe = /^[0-9A-Fa-f]+$/g
|
||||||
|
|
||||||
|
|
||||||
module.exports = class PersonalMessageManager extends EventEmitter{
|
module.exports = class PersonalMessageManager extends EventEmitter {
|
||||||
constructor (opts) {
|
constructor (opts) {
|
||||||
super()
|
super()
|
||||||
this.memStore = new ObservableStore({
|
this.memStore = new ObservableStore({
|
||||||
@ -108,7 +108,7 @@ module.exports = class PersonalMessageManager extends EventEmitter{
|
|||||||
this.emit('updateBadge')
|
this.emit('updateBadge')
|
||||||
}
|
}
|
||||||
|
|
||||||
normalizeMsgData(data) {
|
normalizeMsgData (data) {
|
||||||
try {
|
try {
|
||||||
const stripped = ethUtil.stripHexPrefix(data)
|
const stripped = ethUtil.stripHexPrefix(data)
|
||||||
if (stripped.match(hexRe)) {
|
if (stripped.match(hexRe)) {
|
||||||
|
@ -75,14 +75,14 @@ module.exports = class txProviderUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fillInTxParams (txParams, cb) {
|
fillInTxParams (txParams, cb) {
|
||||||
let fromAddress = txParams.from
|
const fromAddress = txParams.from
|
||||||
let reqs = {}
|
const reqs = {}
|
||||||
|
|
||||||
if (isUndef(txParams.gas)) reqs.gas = (cb) => this.query.estimateGas(txParams, cb)
|
if (isUndef(txParams.gas)) reqs.gas = (cb) => this.query.estimateGas(txParams, cb)
|
||||||
if (isUndef(txParams.gasPrice)) reqs.gasPrice = (cb) => this.query.gasPrice(cb)
|
if (isUndef(txParams.gasPrice)) reqs.gasPrice = (cb) => this.query.gasPrice(cb)
|
||||||
if (isUndef(txParams.nonce)) reqs.nonce = (cb) => this.query.getTransactionCount(fromAddress, 'pending', cb)
|
if (isUndef(txParams.nonce)) reqs.nonce = (cb) => this.query.getTransactionCount(fromAddress, 'pending', cb)
|
||||||
|
|
||||||
async.parallel(reqs, function(err, result) {
|
async.parallel(reqs, function (err, result) {
|
||||||
if (err) return cb(err)
|
if (err) return cb(err)
|
||||||
// write results to txParams obj
|
// write results to txParams obj
|
||||||
Object.assign(txParams, result)
|
Object.assign(txParams, result)
|
||||||
@ -123,14 +123,14 @@ module.exports = class txProviderUtils {
|
|||||||
|
|
||||||
// util
|
// util
|
||||||
|
|
||||||
function isUndef(value) {
|
function isUndef (value) {
|
||||||
return value === undefined
|
return value === undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
function bnToHex(inputBn) {
|
function bnToHex (inputBn) {
|
||||||
return ethUtil.addHexPrefix(inputBn.toString(16))
|
return ethUtil.addHexPrefix(inputBn.toString(16))
|
||||||
}
|
}
|
||||||
|
|
||||||
function hexToBn(inputHex) {
|
function hexToBn (inputHex) {
|
||||||
return new BN(ethUtil.stripHexPrefix(inputHex), 16)
|
return new BN(ethUtil.stripHexPrefix(inputHex), 16)
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
constructor (opts) {
|
constructor (opts) {
|
||||||
super()
|
super()
|
||||||
this.opts = opts
|
this.opts = opts
|
||||||
let initState = opts.initState || {}
|
const initState = opts.initState || {}
|
||||||
|
|
||||||
// platform-specific api
|
// platform-specific api
|
||||||
this.platform = opts.platform
|
this.platform = opts.platform
|
||||||
@ -161,8 +161,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
//
|
//
|
||||||
|
|
||||||
initializeProvider () {
|
initializeProvider () {
|
||||||
|
const provider = MetaMaskProvider({
|
||||||
let provider = MetaMaskProvider({
|
|
||||||
static: {
|
static: {
|
||||||
eth_syncing: false,
|
eth_syncing: false,
|
||||||
web3_clientVersion: `MetaMask/v${version}`,
|
web3_clientVersion: `MetaMask/v${version}`,
|
||||||
@ -170,8 +169,8 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
rpcUrl: this.configManager.getCurrentRpcAddress(),
|
rpcUrl: this.configManager.getCurrentRpcAddress(),
|
||||||
// account mgmt
|
// account mgmt
|
||||||
getAccounts: (cb) => {
|
getAccounts: (cb) => {
|
||||||
let selectedAddress = this.preferencesController.getSelectedAddress()
|
const selectedAddress = this.preferencesController.getSelectedAddress()
|
||||||
let result = selectedAddress ? [selectedAddress] : []
|
const result = selectedAddress ? [selectedAddress] : []
|
||||||
cb(null, result)
|
cb(null, result)
|
||||||
},
|
},
|
||||||
// tx signing
|
// tx signing
|
||||||
@ -196,7 +195,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
publicConfigStore
|
publicConfigStore
|
||||||
)
|
)
|
||||||
|
|
||||||
function selectPublicState(state) {
|
function selectPublicState (state) {
|
||||||
const result = { selectedAddress: undefined }
|
const result = { selectedAddress: undefined }
|
||||||
try {
|
try {
|
||||||
result.selectedAddress = state.PreferencesController.selectedAddress
|
result.selectedAddress = state.PreferencesController.selectedAddress
|
||||||
@ -253,56 +252,56 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
// etc
|
// etc
|
||||||
getState: (cb) => cb(null, this.getState()),
|
getState: (cb) => cb(null, this.getState()),
|
||||||
setProviderType: this.setProviderType.bind(this),
|
setProviderType: this.setProviderType.bind(this),
|
||||||
useEtherscanProvider: this.useEtherscanProvider.bind(this),
|
useEtherscanProvider: this.useEtherscanProvider.bind(this),
|
||||||
setCurrentCurrency: this.setCurrentCurrency.bind(this),
|
setCurrentCurrency: this.setCurrentCurrency.bind(this),
|
||||||
markAccountsFound: this.markAccountsFound.bind(this),
|
markAccountsFound: this.markAccountsFound.bind(this),
|
||||||
// coinbase
|
// coinbase
|
||||||
buyEth: this.buyEth.bind(this),
|
buyEth: this.buyEth.bind(this),
|
||||||
// shapeshift
|
// shapeshift
|
||||||
createShapeShiftTx: this.createShapeShiftTx.bind(this),
|
createShapeShiftTx: this.createShapeShiftTx.bind(this),
|
||||||
|
|
||||||
// primary HD keyring management
|
// primary HD keyring management
|
||||||
addNewAccount: this.addNewAccount.bind(this),
|
addNewAccount: this.addNewAccount.bind(this),
|
||||||
placeSeedWords: this.placeSeedWords.bind(this),
|
placeSeedWords: this.placeSeedWords.bind(this),
|
||||||
clearSeedWordCache: this.clearSeedWordCache.bind(this),
|
clearSeedWordCache: this.clearSeedWordCache.bind(this),
|
||||||
importAccountWithStrategy: this.importAccountWithStrategy.bind(this),
|
importAccountWithStrategy: this.importAccountWithStrategy.bind(this),
|
||||||
|
|
||||||
// vault management
|
// vault management
|
||||||
submitPassword: this.submitPassword.bind(this),
|
submitPassword: this.submitPassword.bind(this),
|
||||||
|
|
||||||
// PreferencesController
|
// PreferencesController
|
||||||
setSelectedAddress: nodeify(preferencesController.setSelectedAddress).bind(preferencesController),
|
setSelectedAddress: nodeify(preferencesController.setSelectedAddress).bind(preferencesController),
|
||||||
setDefaultRpc: nodeify(this.setDefaultRpc).bind(this),
|
setDefaultRpc: nodeify(this.setDefaultRpc).bind(this),
|
||||||
setCustomRpc: nodeify(this.setCustomRpc).bind(this),
|
setCustomRpc: nodeify(this.setCustomRpc).bind(this),
|
||||||
|
|
||||||
// AddressController
|
// AddressController
|
||||||
setAddressBook: nodeify(addressBookController.setAddressBook).bind(addressBookController),
|
setAddressBook: nodeify(addressBookController.setAddressBook).bind(addressBookController),
|
||||||
|
|
||||||
// KeyringController
|
// KeyringController
|
||||||
setLocked: nodeify(keyringController.setLocked).bind(keyringController),
|
setLocked: nodeify(keyringController.setLocked).bind(keyringController),
|
||||||
createNewVaultAndKeychain: nodeify(keyringController.createNewVaultAndKeychain).bind(keyringController),
|
createNewVaultAndKeychain: nodeify(keyringController.createNewVaultAndKeychain).bind(keyringController),
|
||||||
createNewVaultAndRestore: nodeify(keyringController.createNewVaultAndRestore).bind(keyringController),
|
createNewVaultAndRestore: nodeify(keyringController.createNewVaultAndRestore).bind(keyringController),
|
||||||
addNewKeyring: nodeify(keyringController.addNewKeyring).bind(keyringController),
|
addNewKeyring: nodeify(keyringController.addNewKeyring).bind(keyringController),
|
||||||
saveAccountLabel: nodeify(keyringController.saveAccountLabel).bind(keyringController),
|
saveAccountLabel: nodeify(keyringController.saveAccountLabel).bind(keyringController),
|
||||||
exportAccount: nodeify(keyringController.exportAccount).bind(keyringController),
|
exportAccount: nodeify(keyringController.exportAccount).bind(keyringController),
|
||||||
|
|
||||||
// txManager
|
// txManager
|
||||||
approveTransaction: txManager.approveTransaction.bind(txManager),
|
approveTransaction: txManager.approveTransaction.bind(txManager),
|
||||||
cancelTransaction: txManager.cancelTransaction.bind(txManager),
|
cancelTransaction: txManager.cancelTransaction.bind(txManager),
|
||||||
updateAndApproveTransaction: this.updateAndApproveTx.bind(this),
|
updateAndApproveTransaction: this.updateAndApproveTx.bind(this),
|
||||||
|
|
||||||
// messageManager
|
// messageManager
|
||||||
signMessage: nodeify(this.signMessage).bind(this),
|
signMessage: nodeify(this.signMessage).bind(this),
|
||||||
cancelMessage: this.cancelMessage.bind(this),
|
cancelMessage: this.cancelMessage.bind(this),
|
||||||
|
|
||||||
// personalMessageManager
|
// personalMessageManager
|
||||||
signPersonalMessage: nodeify(this.signPersonalMessage).bind(this),
|
signPersonalMessage: nodeify(this.signPersonalMessage).bind(this),
|
||||||
cancelPersonalMessage: this.cancelPersonalMessage.bind(this),
|
cancelPersonalMessage: this.cancelPersonalMessage.bind(this),
|
||||||
|
|
||||||
// notices
|
// notices
|
||||||
checkNotices: noticeController.updateNoticesList.bind(noticeController),
|
checkNotices: noticeController.updateNoticesList.bind(noticeController),
|
||||||
markNoticeRead: noticeController.markNoticeRead.bind(noticeController),
|
markNoticeRead: noticeController.markNoticeRead.bind(noticeController),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -441,7 +440,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newUnsignedMessage (msgParams, cb) {
|
newUnsignedMessage (msgParams, cb) {
|
||||||
let msgId = this.messageManager.addUnapprovedMessage(msgParams)
|
const msgId = this.messageManager.addUnapprovedMessage(msgParams)
|
||||||
this.sendUpdate()
|
this.sendUpdate()
|
||||||
this.opts.showUnconfirmedMessage()
|
this.opts.showUnconfirmedMessage()
|
||||||
this.messageManager.once(`${msgId}:finished`, (data) => {
|
this.messageManager.once(`${msgId}:finished`, (data) => {
|
||||||
@ -461,7 +460,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
return cb(new Error('MetaMask Message Signature: from field is required.'))
|
return cb(new Error('MetaMask Message Signature: from field is required.'))
|
||||||
}
|
}
|
||||||
|
|
||||||
let msgId = this.personalMessageManager.addUnapprovedMessage(msgParams)
|
const msgId = this.personalMessageManager.addUnapprovedMessage(msgParams)
|
||||||
this.sendUpdate()
|
this.sendUpdate()
|
||||||
this.opts.showUnconfirmedMessage()
|
this.opts.showUnconfirmedMessage()
|
||||||
this.personalMessageManager.once(`${msgId}:finished`, (data) => {
|
this.personalMessageManager.once(`${msgId}:finished`, (data) => {
|
||||||
@ -476,7 +475,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAndApproveTx(txMeta, cb) {
|
updateAndApproveTx (txMeta, cb) {
|
||||||
log.debug(`MetaMaskController - updateAndApproveTx: ${JSON.stringify(txMeta)}`)
|
log.debug(`MetaMaskController - updateAndApproveTx: ${JSON.stringify(txMeta)}`)
|
||||||
const txManager = this.txManager
|
const txManager = this.txManager
|
||||||
txManager.updateTx(txMeta)
|
txManager.updateTx(txMeta)
|
||||||
@ -502,7 +501,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelMessage(msgId, cb) {
|
cancelMessage (msgId, cb) {
|
||||||
const messageManager = this.messageManager
|
const messageManager = this.messageManager
|
||||||
messageManager.rejectMsg(msgId)
|
messageManager.rejectMsg(msgId)
|
||||||
if (cb && typeof cb === 'function') {
|
if (cb && typeof cb === 'function') {
|
||||||
@ -512,7 +511,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
|
|
||||||
// Prefixed Style Message Signing Methods:
|
// Prefixed Style Message Signing Methods:
|
||||||
approvePersonalMessage (msgParams, cb) {
|
approvePersonalMessage (msgParams, cb) {
|
||||||
let msgId = this.personalMessageManager.addUnapprovedMessage(msgParams)
|
const msgId = this.personalMessageManager.addUnapprovedMessage(msgParams)
|
||||||
this.sendUpdate()
|
this.sendUpdate()
|
||||||
this.opts.showUnconfirmedMessage()
|
this.opts.showUnconfirmedMessage()
|
||||||
this.personalMessageManager.once(`${msgId}:finished`, (data) => {
|
this.personalMessageManager.once(`${msgId}:finished`, (data) => {
|
||||||
@ -545,7 +544,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelPersonalMessage(msgId, cb) {
|
cancelPersonalMessage (msgId, cb) {
|
||||||
const messageManager = this.personalMessageManager
|
const messageManager = this.personalMessageManager
|
||||||
messageManager.rejectMsg(msgId)
|
messageManager.rejectMsg(msgId)
|
||||||
if (cb && typeof cb === 'function') {
|
if (cb && typeof cb === 'function') {
|
||||||
@ -559,13 +558,13 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
cb(null, this.getState())
|
cb(null, this.getState())
|
||||||
}
|
}
|
||||||
|
|
||||||
restoreOldVaultAccounts(migratorOutput) {
|
restoreOldVaultAccounts (migratorOutput) {
|
||||||
const { serialized } = migratorOutput
|
const { serialized } = migratorOutput
|
||||||
return this.keyringController.restoreKeyring(serialized)
|
return this.keyringController.restoreKeyring(serialized)
|
||||||
.then(() => migratorOutput)
|
.then(() => migratorOutput)
|
||||||
}
|
}
|
||||||
|
|
||||||
restoreOldLostAccounts(migratorOutput) {
|
restoreOldLostAccounts (migratorOutput) {
|
||||||
const { lostAccounts } = migratorOutput
|
const { lostAccounts } = migratorOutput
|
||||||
if (lostAccounts) {
|
if (lostAccounts) {
|
||||||
this.configManager.setLostAccounts(lostAccounts.map(acct => acct.address))
|
this.configManager.setLostAccounts(lostAccounts.map(acct => acct.address))
|
||||||
|
@ -7,7 +7,7 @@ module.exports = {
|
|||||||
version,
|
version,
|
||||||
|
|
||||||
migrate: function (originalVersionedData) {
|
migrate: function (originalVersionedData) {
|
||||||
let versionedData = clone(originalVersionedData)
|
const versionedData = clone(originalVersionedData)
|
||||||
versionedData.meta.version = version
|
versionedData.meta.version = version
|
||||||
try {
|
try {
|
||||||
if (versionedData.data.config.provider.type === 'etherscan') {
|
if (versionedData.data.config.provider.type === 'etherscan') {
|
||||||
|
@ -8,7 +8,7 @@ module.exports = {
|
|||||||
version,
|
version,
|
||||||
|
|
||||||
migrate: function (originalVersionedData) {
|
migrate: function (originalVersionedData) {
|
||||||
let versionedData = clone(originalVersionedData)
|
const versionedData = clone(originalVersionedData)
|
||||||
versionedData.meta.version = version
|
versionedData.meta.version = version
|
||||||
try {
|
try {
|
||||||
if (versionedData.data.config.provider.rpcTarget === oldTestRpc) {
|
if (versionedData.data.config.provider.rpcTarget === oldTestRpc) {
|
||||||
|
@ -6,7 +6,7 @@ module.exports = {
|
|||||||
version,
|
version,
|
||||||
|
|
||||||
migrate: function (versionedData) {
|
migrate: function (versionedData) {
|
||||||
let safeVersionedData = clone(versionedData)
|
const safeVersionedData = clone(versionedData)
|
||||||
safeVersionedData.meta.version = version
|
safeVersionedData.meta.version = version
|
||||||
try {
|
try {
|
||||||
if (safeVersionedData.data.config.provider.type !== 'rpc') return Promise.resolve(safeVersionedData)
|
if (safeVersionedData.data.config.provider.type !== 'rpc') return Promise.resolve(safeVersionedData)
|
||||||
|
@ -14,7 +14,7 @@ module.exports = {
|
|||||||
version,
|
version,
|
||||||
|
|
||||||
migrate: function (originalVersionedData) {
|
migrate: function (originalVersionedData) {
|
||||||
let versionedData = clone(originalVersionedData)
|
const versionedData = clone(originalVersionedData)
|
||||||
versionedData.meta.version = version
|
versionedData.meta.version = version
|
||||||
try {
|
try {
|
||||||
const state = versionedData.data
|
const state = versionedData.data
|
||||||
|
@ -13,7 +13,7 @@ module.exports = {
|
|||||||
version,
|
version,
|
||||||
|
|
||||||
migrate: function (originalVersionedData) {
|
migrate: function (originalVersionedData) {
|
||||||
let versionedData = clone(originalVersionedData)
|
const versionedData = clone(originalVersionedData)
|
||||||
versionedData.meta.version = version
|
versionedData.meta.version = version
|
||||||
try {
|
try {
|
||||||
const state = versionedData.data
|
const state = versionedData.data
|
||||||
|
@ -13,7 +13,7 @@ module.exports = {
|
|||||||
version,
|
version,
|
||||||
|
|
||||||
migrate: function (originalVersionedData) {
|
migrate: function (originalVersionedData) {
|
||||||
let versionedData = clone(originalVersionedData)
|
const versionedData = clone(originalVersionedData)
|
||||||
versionedData.meta.version = version
|
versionedData.meta.version = version
|
||||||
try {
|
try {
|
||||||
const state = versionedData.data
|
const state = versionedData.data
|
||||||
|
@ -13,7 +13,7 @@ module.exports = {
|
|||||||
version,
|
version,
|
||||||
|
|
||||||
migrate: function (originalVersionedData) {
|
migrate: function (originalVersionedData) {
|
||||||
let versionedData = clone(originalVersionedData)
|
const versionedData = clone(originalVersionedData)
|
||||||
versionedData.meta.version = version
|
versionedData.meta.version = version
|
||||||
try {
|
try {
|
||||||
const state = versionedData.data
|
const state = versionedData.data
|
||||||
|
@ -13,7 +13,7 @@ module.exports = {
|
|||||||
version,
|
version,
|
||||||
|
|
||||||
migrate: function (originalVersionedData) {
|
migrate: function (originalVersionedData) {
|
||||||
let versionedData = clone(originalVersionedData)
|
const versionedData = clone(originalVersionedData)
|
||||||
versionedData.meta.version = version
|
versionedData.meta.version = version
|
||||||
try {
|
try {
|
||||||
const state = versionedData.data
|
const state = versionedData.data
|
||||||
|
@ -13,7 +13,7 @@ module.exports = {
|
|||||||
version,
|
version,
|
||||||
|
|
||||||
migrate: function (originalVersionedData) {
|
migrate: function (originalVersionedData) {
|
||||||
let versionedData = clone(originalVersionedData)
|
const versionedData = clone(originalVersionedData)
|
||||||
versionedData.meta.version = version
|
versionedData.meta.version = version
|
||||||
try {
|
try {
|
||||||
const state = versionedData.data
|
const state = versionedData.data
|
||||||
|
@ -12,7 +12,7 @@ module.exports = {
|
|||||||
version,
|
version,
|
||||||
|
|
||||||
migrate: function (originalVersionedData) {
|
migrate: function (originalVersionedData) {
|
||||||
let versionedData = clone(originalVersionedData)
|
const versionedData = clone(originalVersionedData)
|
||||||
versionedData.meta.version = version
|
versionedData.meta.version = version
|
||||||
try {
|
try {
|
||||||
const state = versionedData.data
|
const state = versionedData.data
|
||||||
|
@ -12,7 +12,7 @@ module.exports = {
|
|||||||
version,
|
version,
|
||||||
|
|
||||||
migrate: function (originalVersionedData) {
|
migrate: function (originalVersionedData) {
|
||||||
let versionedData = clone(originalVersionedData)
|
const versionedData = clone(originalVersionedData)
|
||||||
versionedData.meta.version = version
|
versionedData.meta.version = version
|
||||||
try {
|
try {
|
||||||
const state = versionedData.data
|
const state = versionedData.data
|
||||||
|
@ -15,15 +15,15 @@ const KeyringController = require('../../app/scripts/lib/keyring-controller')
|
|||||||
const password = 'obviously not correct'
|
const password = 'obviously not correct'
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
version,
|
version,
|
||||||
|
|
||||||
migrate: function (versionedData) {
|
migrate: function (versionedData) {
|
||||||
versionedData.meta.version = version
|
versionedData.meta.version = version
|
||||||
|
|
||||||
let store = new ObservableStore(versionedData.data)
|
const store = new ObservableStore(versionedData.data)
|
||||||
let configManager = new ConfigManager({ store })
|
const configManager = new ConfigManager({ store })
|
||||||
let idStoreMigrator = new IdentityStoreMigrator({ configManager })
|
const idStoreMigrator = new IdentityStoreMigrator({ configManager })
|
||||||
let keyringController = new KeyringController({
|
const keyringController = new KeyringController({
|
||||||
configManager: configManager,
|
configManager: configManager,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -46,6 +46,5 @@ module.exports = {
|
|||||||
return Promise.resolve(versionedData)
|
return Promise.resolve(versionedData)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ function initializePopup ({ container, connectionStream }, cb) {
|
|||||||
(cb) => connectToAccountManager(connectionStream, cb),
|
(cb) => connectToAccountManager(connectionStream, cb),
|
||||||
(accountManager, cb) => launchMetamaskUi({ container, accountManager }, cb),
|
(accountManager, cb) => launchMetamaskUi({ container, accountManager }, cb),
|
||||||
], cb)
|
], cb)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectToAccountManager (connectionStream, cb) {
|
function connectToAccountManager (connectionStream, cb) {
|
||||||
|
@ -41,7 +41,7 @@ function closePopupIfOpen (windowType) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayCriticalError(err) {
|
function displayCriticalError (err) {
|
||||||
container.innerHTML = '<div class="critical-error">The MetaMask app failed to load: please open and close MetaMask again to restart.</div>'
|
container.innerHTML = '<div class="critical-error">The MetaMask app failed to load: please open and close MetaMask again to restart.</div>'
|
||||||
container.style.height = '80px'
|
container.style.height = '80px'
|
||||||
log.error(err.stack)
|
log.error(err.stack)
|
||||||
|
@ -28,9 +28,9 @@ module.exports = class TransactionManager extends EventEmitter {
|
|||||||
|
|
||||||
// memstore is computed from a few different stores
|
// memstore is computed from a few different stores
|
||||||
this._updateMemstore()
|
this._updateMemstore()
|
||||||
this.store.subscribe(() => this._updateMemstore() )
|
this.store.subscribe(() => this._updateMemstore())
|
||||||
this.networkStore.subscribe(() => this._updateMemstore() )
|
this.networkStore.subscribe(() => this._updateMemstore())
|
||||||
this.preferencesStore.subscribe(() => this._updateMemstore() )
|
this.preferencesStore.subscribe(() => this._updateMemstore())
|
||||||
}
|
}
|
||||||
|
|
||||||
getState () {
|
getState () {
|
||||||
@ -47,8 +47,8 @@ module.exports = class TransactionManager extends EventEmitter {
|
|||||||
|
|
||||||
// Returns the tx list
|
// Returns the tx list
|
||||||
getTxList () {
|
getTxList () {
|
||||||
let network = this.getNetwork()
|
const network = this.getNetwork()
|
||||||
let fullTxList = this.getFullTxList()
|
const fullTxList = this.getFullTxList()
|
||||||
return fullTxList.filter(txMeta => txMeta.metamaskNetworkId === network)
|
return fullTxList.filter(txMeta => txMeta.metamaskNetworkId === network)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,10 +64,10 @@ module.exports = class TransactionManager extends EventEmitter {
|
|||||||
|
|
||||||
// Adds a tx to the txlist
|
// Adds a tx to the txlist
|
||||||
addTx (txMeta) {
|
addTx (txMeta) {
|
||||||
let txCount = this.getTxCount()
|
const txCount = this.getTxCount()
|
||||||
let network = this.getNetwork()
|
const network = this.getNetwork()
|
||||||
let fullTxList = this.getFullTxList()
|
const fullTxList = this.getFullTxList()
|
||||||
let txHistoryLimit = this.txHistoryLimit
|
const txHistoryLimit = this.txHistoryLimit
|
||||||
|
|
||||||
// checks if the length of the tx history is
|
// checks if the length of the tx history is
|
||||||
// longer then desired persistence limit
|
// longer then desired persistence limit
|
||||||
@ -197,7 +197,7 @@ module.exports = class TransactionManager extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fillInTxParams (txId, cb) {
|
fillInTxParams (txId, cb) {
|
||||||
let txMeta = this.getTx(txId)
|
const txMeta = this.getTx(txId)
|
||||||
this.txProviderUtils.fillInTxParams(txMeta.txParams, (err) => {
|
this.txProviderUtils.fillInTxParams(txMeta.txParams, (err) => {
|
||||||
if (err) return cb(err)
|
if (err) return cb(err)
|
||||||
this.updateTx(txMeta)
|
this.updateTx(txMeta)
|
||||||
@ -205,7 +205,7 @@ module.exports = class TransactionManager extends EventEmitter {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
getChainId() {
|
getChainId () {
|
||||||
const networkState = this.networkStore.getState()
|
const networkState = this.networkStore.getState()
|
||||||
const getChainId = parseInt(networkState.network)
|
const getChainId = parseInt(networkState.network)
|
||||||
if (Number.isNaN(getChainId)) {
|
if (Number.isNaN(getChainId)) {
|
||||||
@ -242,7 +242,7 @@ module.exports = class TransactionManager extends EventEmitter {
|
|||||||
// receives a txHash records the tx as signed
|
// receives a txHash records the tx as signed
|
||||||
setTxHash (txId, txHash) {
|
setTxHash (txId, txHash) {
|
||||||
// Add the tx hash to the persisted meta-tx object
|
// Add the tx hash to the persisted meta-tx object
|
||||||
let txMeta = this.getTx(txId)
|
const txMeta = this.getTx(txId)
|
||||||
txMeta.hash = txHash
|
txMeta.hash = txHash
|
||||||
this.updateTx(txMeta)
|
this.updateTx(txMeta)
|
||||||
}
|
}
|
||||||
@ -315,7 +315,7 @@ module.exports = class TransactionManager extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setTxStatusFailed (txId, reason) {
|
setTxStatusFailed (txId, reason) {
|
||||||
let txMeta = this.getTx(txId)
|
const txMeta = this.getTx(txId)
|
||||||
txMeta.err = reason
|
txMeta.err = reason
|
||||||
this.updateTx(txMeta)
|
this.updateTx(txMeta)
|
||||||
this._setTxStatus(txId, 'failed')
|
this._setTxStatus(txId, 'failed')
|
||||||
@ -338,7 +338,7 @@ module.exports = class TransactionManager extends EventEmitter {
|
|||||||
var txHash = txMeta.hash
|
var txHash = txMeta.hash
|
||||||
var txId = txMeta.id
|
var txId = txMeta.id
|
||||||
if (!txHash) {
|
if (!txHash) {
|
||||||
let errReason = {
|
const errReason = {
|
||||||
errCode: 'No hash was provided',
|
errCode: 'No hash was provided',
|
||||||
message: 'We had an error while submitting this transaction, please try again.',
|
message: 'We had an error while submitting this transaction, please try again.',
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ AccountImportSubview.prototype.render = function () {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
AccountImportSubview.prototype.renderImportView = function() {
|
AccountImportSubview.prototype.renderImportView = function () {
|
||||||
const props = this.props
|
const props = this.props
|
||||||
const state = this.state || {}
|
const state = this.state || {}
|
||||||
const { type } = state
|
const { type } = state
|
||||||
|
@ -314,7 +314,7 @@ function importNewAccount (strategy, args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function navigateToNewAccountScreen() {
|
function navigateToNewAccountScreen () {
|
||||||
return {
|
return {
|
||||||
type: this.NEW_ACCOUNT_SCREEN,
|
type: this.NEW_ACCOUNT_SCREEN,
|
||||||
}
|
}
|
||||||
@ -665,7 +665,7 @@ function clearNotices () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function markAccountsFound() {
|
function markAccountsFound () {
|
||||||
log.debug(`background.markAccountsFound`)
|
log.debug(`background.markAccountsFound`)
|
||||||
return callBackgroundThenUpdate(background.markAccountsFound)
|
return callBackgroundThenUpdate(background.markAccountsFound)
|
||||||
}
|
}
|
||||||
@ -978,7 +978,7 @@ function callBackgroundThenUpdate (method, ...args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function forceUpdateMetamaskState(dispatch){
|
function forceUpdateMetamaskState (dispatch) {
|
||||||
log.debug(`background.getState`)
|
log.debug(`background.getState`)
|
||||||
background.getState((err, newState) => {
|
background.getState((err, newState) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -552,5 +552,4 @@ App.prototype.renderCommonRpc = function (rpcList, provider) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ EnsInput.prototype.render = function () {
|
|||||||
list: 'addresses',
|
list: 'addresses',
|
||||||
onChange: () => {
|
onChange: () => {
|
||||||
const network = this.props.network
|
const network = this.props.network
|
||||||
let resolverAddress = networkResolvers[network]
|
const resolverAddress = networkResolvers[network]
|
||||||
if (!resolverAddress) return
|
if (!resolverAddress) return
|
||||||
|
|
||||||
const recipient = document.querySelector('input[name="address"]').value
|
const recipient = document.querySelector('input[name="address"]').value
|
||||||
@ -52,7 +52,7 @@ EnsInput.prototype.render = function () {
|
|||||||
[
|
[
|
||||||
// Corresponds to the addresses owned.
|
// Corresponds to the addresses owned.
|
||||||
Object.keys(props.identities).map((key) => {
|
Object.keys(props.identities).map((key) => {
|
||||||
let identity = props.identities[key]
|
const identity = props.identities[key]
|
||||||
return h('option', {
|
return h('option', {
|
||||||
value: identity.address,
|
value: identity.address,
|
||||||
label: identity.name,
|
label: identity.name,
|
||||||
@ -72,7 +72,7 @@ EnsInput.prototype.render = function () {
|
|||||||
|
|
||||||
EnsInput.prototype.componentDidMount = function () {
|
EnsInput.prototype.componentDidMount = function () {
|
||||||
const network = this.props.network
|
const network = this.props.network
|
||||||
let resolverAddress = networkResolvers[network]
|
const resolverAddress = networkResolvers[network]
|
||||||
|
|
||||||
if (resolverAddress) {
|
if (resolverAddress) {
|
||||||
const provider = web3.currentProvider
|
const provider = web3.currentProvider
|
||||||
|
@ -115,8 +115,9 @@ Notice.prototype.render = function () {
|
|||||||
Notice.prototype.componentDidMount = function () {
|
Notice.prototype.componentDidMount = function () {
|
||||||
var node = findDOMNode(this)
|
var node = findDOMNode(this)
|
||||||
linker.setupListener(node)
|
linker.setupListener(node)
|
||||||
if (document.getElementsByClassName('notice-box')[0].clientHeight < 310) { this.setState({disclaimerDisabled: false}) }
|
if (document.getElementsByClassName('notice-box')[0].clientHeight < 310) {
|
||||||
|
this.setState({disclaimerDisabled: false})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Notice.prototype.componentWillUnmount = function () {
|
Notice.prototype.componentWillUnmount = function () {
|
||||||
|
@ -15,7 +15,7 @@ TransactionIcon.prototype.render = function () {
|
|||||||
const { transaction, txParams, isMsg } = this.props
|
const { transaction, txParams, isMsg } = this.props
|
||||||
switch (transaction.status) {
|
switch (transaction.status) {
|
||||||
case 'unapproved':
|
case 'unapproved':
|
||||||
return h( !isMsg ? '.unapproved-tx-icon' : 'i.fa.fa-certificate.fa-lg')
|
return h(!isMsg ? '.unapproved-tx-icon' : 'i.fa.fa-certificate.fa-lg')
|
||||||
|
|
||||||
case 'rejected':
|
case 'rejected':
|
||||||
return h('i.fa.fa-exclamation-triangle.fa-lg.warning', {
|
return h('i.fa.fa-exclamation-triangle.fa-lg.warning', {
|
||||||
|
@ -134,7 +134,6 @@ function failIfFailed (transaction) {
|
|||||||
return h('span.error', ' (Rejected)')
|
return h('span.error', ' (Rejected)')
|
||||||
}
|
}
|
||||||
if (transaction.err) {
|
if (transaction.err) {
|
||||||
|
|
||||||
return h(Tooltip, {
|
return h(Tooltip, {
|
||||||
title: transaction.err.message,
|
title: transaction.err.message,
|
||||||
position: 'bottom',
|
position: 'bottom',
|
||||||
@ -142,5 +141,4 @@ function failIfFailed (transaction) {
|
|||||||
h('span.error', ' (Failed)'),
|
h('span.error', ' (Failed)'),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -125,14 +125,12 @@ function currentTxView (opts) {
|
|||||||
if (txParams) {
|
if (txParams) {
|
||||||
log.debug('txParams detected, rendering pending tx')
|
log.debug('txParams detected, rendering pending tx')
|
||||||
return h(PendingTx, opts)
|
return h(PendingTx, opts)
|
||||||
|
|
||||||
} else if (msgParams) {
|
} else if (msgParams) {
|
||||||
log.debug('msgParams detected, rendering pending msg')
|
log.debug('msgParams detected, rendering pending msg')
|
||||||
|
|
||||||
if (type === 'eth_sign') {
|
if (type === 'eth_sign') {
|
||||||
log.debug('rendering eth_sign message')
|
log.debug('rendering eth_sign message')
|
||||||
return h(PendingMsg, opts)
|
return h(PendingMsg, opts)
|
||||||
|
|
||||||
} else if (type === 'personal_sign') {
|
} else if (type === 'personal_sign') {
|
||||||
log.debug('rendering personal_sign message')
|
log.debug('rendering personal_sign message')
|
||||||
return h(PendingPersonalMsg, opts)
|
return h(PendingPersonalMsg, opts)
|
||||||
|
@ -315,7 +315,7 @@ function reduceApp (state, action) {
|
|||||||
case actions.COMPLETED_TX:
|
case actions.COMPLETED_TX:
|
||||||
log.debug('reducing COMPLETED_TX for tx ' + action.value)
|
log.debug('reducing COMPLETED_TX for tx ' + action.value)
|
||||||
const otherUnconfActions = getUnconfActionList(state)
|
const otherUnconfActions = getUnconfActionList(state)
|
||||||
.filter(tx => tx.id !== action.value )
|
.filter(tx => tx.id !== action.value)
|
||||||
const hasOtherUnconfActions = otherUnconfActions.length > 0
|
const hasOtherUnconfActions = otherUnconfActions.length > 0
|
||||||
|
|
||||||
if (hasOtherUnconfActions) {
|
if (hasOtherUnconfActions) {
|
||||||
|
Loading…
Reference in New Issue
Block a user