diff options
-rw-r--r-- | app/scripts/controllers/transactions/tx-state-manager.js | 1 | ||||
-rw-r--r-- | app/scripts/metamask-controller.js | 10 | ||||
-rw-r--r-- | package-lock.json | 8 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | ui/app/actions.js | 10 | ||||
-rw-r--r-- | ui/app/components/selected-account/selected-account.component.js | 2 | ||||
-rw-r--r-- | ui/app/components/tooltip-v2.js | 87 | ||||
-rw-r--r-- | ui/app/components/transaction-list-item/transaction-list-item.component.js | 5 | ||||
-rw-r--r-- | ui/app/components/transaction-status/transaction-status.component.js | 12 | ||||
-rw-r--r-- | ui/app/components/wallet-view.js | 2 |
10 files changed, 98 insertions, 41 deletions
diff --git a/app/scripts/controllers/transactions/tx-state-manager.js b/app/scripts/controllers/transactions/tx-state-manager.js index 28a18ca2e..daa6cc388 100644 --- a/app/scripts/controllers/transactions/tx-state-manager.js +++ b/app/scripts/controllers/transactions/tx-state-manager.js @@ -353,6 +353,7 @@ class TransactionStateManager extends EventEmitter { const txMeta = this.getTx(txId) txMeta.err = { message: err.toString(), + rpc: err.value, stack: err.stack, } this.updateTx(txMeta) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 9b373de9b..3ab256314 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -177,7 +177,7 @@ module.exports = class MetamaskController extends EventEmitter { blockTracker: this.blockTracker, getGasPrice: this.getGasPrice.bind(this), }) - this.txController.on('newUnapprovedTx', opts.showUnapprovedTx.bind(opts)) + this.txController.on('newUnapprovedTx', () => opts.showUnapprovedTx()) this.txController.on(`tx:status-update`, (txId, status) => { if (status === 'confirmed' || status === 'failed') { @@ -1243,8 +1243,10 @@ module.exports = class MetamaskController extends EventEmitter { ) dnode.on('remote', (remote) => { // push updates to popup - const sendUpdate = remote.sendUpdate.bind(remote) + const sendUpdate = (update) => remote.sendUpdate(update) this.on('update', sendUpdate) + // remove update listener once the connection ends + dnode.on('end', () => this.removeListener('update', sendUpdate)) }) } @@ -1294,10 +1296,12 @@ module.exports = class MetamaskController extends EventEmitter { * @param {*} outStream - The stream to provide public config over. */ setupPublicConfig (outStream) { + const configStream = asStream(this.publicConfigStore) pump( - asStream(this.publicConfigStore), + configStream, outStream, (err) => { + configStream.destroy() if (err) log.error(err) } ) diff --git a/package-lock.json b/package-lock.json index 016e25647..7b4de5e8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21822,9 +21822,9 @@ } }, "obs-store": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/obs-store/-/obs-store-3.0.0.tgz", - "integrity": "sha512-ZHK0fwDZEecEvdiqQGnxrEshbqibVgsq4aIIe/5PIT8fGGprTTuGw1RXLMy5G1VN/KtnmEP6+n+aLH7BYuYCVA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/obs-store/-/obs-store-3.0.2.tgz", + "integrity": "sha512-GzBr7KM2TYWoJSlF3sVo1cMIOeyxgXpEdegXLZyYONRpunFHsBdKwOba0ki17kN2stLaEwTNolJChGHafqM7Fw==", "requires": { "babel-preset-es2015": "^6.22.0", "babelify": "^7.3.0", @@ -21835,7 +21835,7 @@ "dependencies": { "babelify": { "version": "7.3.0", - "resolved": "https://registry.npmjs.org/babelify/-/babelify-7.3.0.tgz", + "resolved": "http://registry.npmjs.org/babelify/-/babelify-7.3.0.tgz", "integrity": "sha1-qlau3nBn/XvVSWZu4W3ChQh+iOU=", "requires": { "babel-core": "^6.0.14", diff --git a/package.json b/package.json index 0ef2ab6a9..13349bf6f 100644 --- a/package.json +++ b/package.json @@ -169,7 +169,7 @@ "multiplex": "^6.7.0", "number-to-bn": "^1.7.0", "obj-multiplex": "^1.0.0", - "obs-store": "^3.0.0", + "obs-store": "^3.0.2", "percentile": "^1.2.0", "pify": "^3.0.0", "ping-pong-stream": "^1.0.0", diff --git a/ui/app/actions.js b/ui/app/actions.js index ae7d3b761..462d75d13 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -415,12 +415,18 @@ function createNewVaultAndRestore (password, seed) { log.debug(`background.createNewVaultAndRestore`) return new Promise((resolve, reject) => { - background.createNewVaultAndRestore(password, seed, err => { + background.clearSeedWordCache((err) => { if (err) { return reject(err) } - resolve() + background.createNewVaultAndRestore(password, seed, (err) => { + if (err) { + return reject(err) + } + + resolve() + }) }) }) .then(() => dispatch(actions.unMarkPasswordForgotten())) diff --git a/ui/app/components/selected-account/selected-account.component.js b/ui/app/components/selected-account/selected-account.component.js index 6c202141e..55b935ee0 100644 --- a/ui/app/components/selected-account/selected-account.component.js +++ b/ui/app/components/selected-account/selected-account.component.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types' import copyToClipboard from 'copy-to-clipboard' import { addressSlicer } from '../../util' -const Tooltip = require('../tooltip-v2.js') +const Tooltip = require('../tooltip-v2.js').default class SelectedAccount extends Component { state = { diff --git a/ui/app/components/tooltip-v2.js b/ui/app/components/tooltip-v2.js index 05a5efc80..054782203 100644 --- a/ui/app/components/tooltip-v2.js +++ b/ui/app/components/tooltip-v2.js @@ -1,33 +1,66 @@ -const Component = require('react').Component -const h = require('react-hyperscript') -const inherits = require('util').inherits -const ReactTippy = require('react-tippy').Tooltip +import PropTypes from 'prop-types' +import React, {PureComponent} from 'react' +import {Tooltip as ReactTippy} from 'react-tippy' -module.exports = Tooltip +export default class Tooltip extends PureComponent { + static defaultProps = { + arrow: true, + children: null, + containerClassName: '', + hideOnClick: false, + onHidden: null, + position: 'left', + size: 'small', + title: null, + trigger: 'mouseenter', + wrapperClassName: '', + } -inherits(Tooltip, Component) -function Tooltip () { - Component.call(this) -} - -Tooltip.prototype.render = function () { - const props = this.props - const { position, title, children, wrapperClassName, containerClassName, onHidden } = props + static propTypes = { + arrow: PropTypes.bool, + children: PropTypes.node, + containerClassName: PropTypes.string, + onHidden: PropTypes.func, + position: PropTypes.oneOf([ + 'top', + 'right', + 'bottom', + 'left', + ]), + size: PropTypes.oneOf([ + 'small', 'regular', 'big', + ]), + title: PropTypes.string, + trigger: PropTypes.any, + wrapperClassName: PropTypes.string, + } - return h('div', { - className: wrapperClassName, - }, [ + render () { + const {arrow, children, containerClassName, position, size, title, trigger, onHidden, wrapperClassName } = this.props - h(ReactTippy, { - title, - position: position || 'left', - trigger: 'mouseenter', - hideOnClick: false, - size: 'small', - arrow: true, - className: containerClassName, - onHidden, - }, children), + if (!title) { + return ( + <div className={wrapperClassName}> + {children} + </div> + ) + } - ]) + return ( + <div className={wrapperClassName}> + <ReactTippy + className={containerClassName} + title={title} + position={position} + trigger={trigger} + hideOnClick={false} + size={size} + arrow={arrow} + onHidden={onHidden} + > + {children} + </ReactTippy> + </div> + ) + } } diff --git a/ui/app/components/transaction-list-item/transaction-list-item.component.js b/ui/app/components/transaction-list-item/transaction-list-item.component.js index 4fddd45ef..75b41a477 100644 --- a/ui/app/components/transaction-list-item/transaction-list-item.component.js +++ b/ui/app/components/transaction-list-item/transaction-list-item.component.js @@ -131,6 +131,11 @@ export default class TransactionListItem extends PureComponent { <TransactionStatus className="transaction-list-item__status" statusKey={transaction.status} + title={( + (transaction.err && transaction.err.rpc) + ? transaction.err.rpc.message + : transaction.err && transaction.err.message + )} /> { this.renderPrimaryCurrency() } { this.renderSecondaryCurrency() } diff --git a/ui/app/components/transaction-status/transaction-status.component.js b/ui/app/components/transaction-status/transaction-status.component.js index a4c827ae8..c22baf18a 100644 --- a/ui/app/components/transaction-status/transaction-status.component.js +++ b/ui/app/components/transaction-status/transaction-status.component.js @@ -1,6 +1,7 @@ import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' +import Tooltip from '../tooltip-v2' import { UNAPPROVED_STATUS, REJECTED_STATUS, @@ -29,6 +30,10 @@ const statusToTextHash = { } export default class TransactionStatus extends PureComponent { + static defaultProps = { + title: null, + } + static contextTypes = { t: PropTypes.func, } @@ -36,15 +41,18 @@ export default class TransactionStatus extends PureComponent { static propTypes = { statusKey: PropTypes.string, className: PropTypes.string, + title: PropTypes.string, } render () { - const { className, statusKey } = this.props + const { className, statusKey, title } = this.props const statusText = this.context.t(statusToTextHash[statusKey] || statusKey) return ( <div className={classnames('transaction-status', className, statusToClassNameHash[statusKey])}> - { statusText } + <Tooltip position="top" title={title}> + { statusText } + </Tooltip> </div> ) } diff --git a/ui/app/components/wallet-view.js b/ui/app/components/wallet-view.js index 6de265110..77c7f3a4b 100644 --- a/ui/app/components/wallet-view.js +++ b/ui/app/components/wallet-view.js @@ -9,7 +9,7 @@ const classnames = require('classnames') const { checksumAddress } = require('../util') const Identicon = require('./identicon') // const AccountDropdowns = require('./dropdowns/index.js').AccountDropdowns -const Tooltip = require('./tooltip-v2.js') +const Tooltip = require('./tooltip-v2.js').default const copyToClipboard = require('copy-to-clipboard') const actions = require('../actions') const BalanceComponent = require('./balance-component') |