mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge branch 'master' into rinkeby
This commit is contained in:
commit
d1a1069180
@ -1,4 +1,4 @@
|
|||||||
FROM node:6
|
FROM node:7
|
||||||
MAINTAINER kumavis
|
MAINTAINER kumavis
|
||||||
|
|
||||||
# setup app dir
|
# setup app dir
|
||||||
|
@ -43,8 +43,8 @@ asyncQ.waterfall([
|
|||||||
|
|
||||||
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
|
||||||
//
|
//
|
||||||
@ -86,7 +85,7 @@ function setupController (initState) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
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()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -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) => {
|
||||||
|
if (err) {
|
||||||
console.warn('MetaMask - Failed to query currency conversion.')
|
console.warn('MetaMask - Failed to query currency conversion.')
|
||||||
this.setConversionRate(0)
|
this.setConversionRate(0)
|
||||||
this.setConversionDate('N/A')
|
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
|
||||||
|
@ -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)
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -3,16 +3,16 @@ 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))
|
||||||
|
@ -75,8 +75,8 @@ 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)
|
||||||
|
@ -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
|
||||||
@ -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) => {
|
||||||
@ -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) => {
|
||||||
|
@ -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
|
||||||
|
@ -20,10 +20,10 @@ module.exports = {
|
|||||||
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) {
|
||||||
|
@ -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)
|
||||||
@ -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.',
|
||||||
}
|
}
|
||||||
|
@ -296,8 +296,6 @@ function bundleTask(opts) {
|
|||||||
return (
|
return (
|
||||||
|
|
||||||
bundler.bundle()
|
bundler.bundle()
|
||||||
// log errors if they happen
|
|
||||||
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
|
|
||||||
// convert bundle stream to gulp vinyl stream
|
// convert bundle stream to gulp vinyl stream
|
||||||
.pipe(source(opts.filename))
|
.pipe(source(opts.filename))
|
||||||
// inject variables into bundle
|
// inject variables into bundle
|
||||||
|
@ -561,5 +561,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 () {
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user