From 45fc1d6ec356232e51fe4a9cc1f01929e35e8014 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 9 Aug 2017 17:40:01 -0700 Subject: Readd loose label onto accounts. --- ui/app/app.js | 3 +++ ui/app/components/account-dropdowns.js | 20 +++++++++++++++++++- ui/app/components/dropdown.js | 2 +- ui/app/css/lib.css | 5 +++-- 4 files changed, 26 insertions(+), 4 deletions(-) (limited to 'ui') diff --git a/ui/app/app.js b/ui/app/app.js index 4565bdd37..2186c85a2 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -42,6 +42,7 @@ function mapStateToProps (state) { identities, accounts, address, + keyrings, } = state.metamask const selected = address || Object.keys(accounts)[0] @@ -69,6 +70,7 @@ function mapStateToProps (state) { // state needed to get account dropdown temporarily rendering from app bar identities, selected, + keyrings, } } @@ -187,6 +189,7 @@ App.prototype.renderAppBar = function () { identities: this.props.identities, selected: this.props.selected, network: this.props.network, + keyrings: this.props.keyrings, }, []), // hamburger diff --git a/ui/app/components/account-dropdowns.js b/ui/app/components/account-dropdowns.js index b23600e9b..9a68b8f20 100644 --- a/ui/app/components/account-dropdowns.js +++ b/ui/app/components/account-dropdowns.js @@ -22,12 +22,19 @@ class AccountDropdowns extends Component { } renderAccounts () { - const { identities, selected } = this.props + const { identities, selected, keyrings } = this.props return Object.keys(identities).map((key, index) => { const identity = identities[key] const isSelected = identity.address === selected + const simpleAddress = identity.address.substring(2).toLowerCase() + + const keyring = keyrings.find((kr) => { + return kr.accounts.includes(simpleAddress) || + kr.accounts.includes(identity.address) + }) + return h( DropdownMenuItem, { @@ -51,6 +58,7 @@ class AccountDropdowns extends Component { }, }, ), + this.indicateIfLoose(keyring.type), h('span', { style: { marginLeft: '20px', fontSize: '24px' } }, identity.name || ''), h('span', { style: { marginLeft: '20px', fontSize: '24px' } }, isSelected ? h('.check', '✓') : null), ] @@ -58,6 +66,13 @@ class AccountDropdowns extends Component { }) } + indicateIfLoose (type) { + try { // Sometimes keyrings aren't loaded yet: + const isLoose = type !== 'HD Key Tree' + return isLoose ? h('.keyring-label', 'LOOSE') : null + } catch (e) { return } + } + renderAccountSelector () { const { actions } = this.props const { accountSelectorActive } = this.state @@ -136,6 +151,8 @@ class AccountDropdowns extends Component { ) } + + renderAccountOptions () { const { actions } = this.props const { optionsMenuActive } = this.state @@ -269,6 +286,7 @@ AccountDropdowns.defaultProps = { AccountDropdowns.propTypes = { identities: PropTypes.objectOf(PropTypes.object), selected: PropTypes.string, + keyrings: PropTypes.objectOf(PropTypes.object), } const mapDispatchToProps = (dispatch) => { diff --git a/ui/app/components/dropdown.js b/ui/app/components/dropdown.js index 34c7149ee..73710acc2 100644 --- a/ui/app/components/dropdown.js +++ b/ui/app/components/dropdown.js @@ -32,7 +32,7 @@ class Dropdown extends Component { 'style', ` li.dropdown-menu-item:hover { color:rgb(225, 225, 225); } - li.dropdown-menu-item { color: rgb(185, 185, 185); } + li.dropdown-menu-item { color: rgb(185, 185, 185); position: relative } ` ), ...children, diff --git a/ui/app/css/lib.css b/ui/app/css/lib.css index 81647d1c1..f3acbee76 100644 --- a/ui/app/css/lib.css +++ b/ui/app/css/lib.css @@ -215,12 +215,13 @@ hr.horizontal-line { z-index: 1; font-size: 11px; background: rgba(255,0,0,0.8); - bottom: -47px; color: white; + bottom: 0px; + left: -8px; border-radius: 10px; height: 20px; min-width: 20px; - position: relative; + position: absolute; display: flex; align-items: center; justify-content: center; -- cgit From 54ce267a9f804b1733d2627ac7568d5eb6fe6518 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 29 Aug 2017 11:42:44 -0700 Subject: Add version to state logs Fixes #1986 --- ui/app/reducers.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/app/reducers.js b/ui/app/reducers.js index 36045772f..6a2f44534 100644 --- a/ui/app/reducers.js +++ b/ui/app/reducers.js @@ -42,7 +42,10 @@ function rootReducer (state, action) { } window.logState = function () { - var stateString = JSON.stringify(window.METAMASK_CACHED_LOG_STATE, removeSeedWords, 2) + let state = window.METAMASK_CACHED_LOG_STATE + const version = global.platform.getVersion() + state.version = version + let stateString = JSON.stringify(state, removeSeedWords, 2) return stateString } -- cgit From 04011f9ea764cf2458637e41012c131d8b7a9aca Mon Sep 17 00:00:00 2001 From: Thomas Huang Date: Tue, 29 Aug 2017 17:54:01 -0700 Subject: Multiple tokens shows the amount when greater than 1 --- ui/app/components/token-list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/app/components/token-list.js b/ui/app/components/token-list.js index 2346568bc..998ec901d 100644 --- a/ui/app/components/token-list.js +++ b/ui/app/components/token-list.js @@ -95,7 +95,7 @@ TokenList.prototype.renderTokenStatusBar = function () { let msg if (tokens.length === 1) { msg = `You own 1 token` - } else if (tokens.length === 1) { + } else if (tokens.length > 1) { msg = `You own ${tokens.length} tokens` } else { msg = `No tokens found` -- cgit From ddd559718f5395190ad3903cdb9c42e2e6e50443 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Fri, 1 Sep 2017 11:01:53 -0700 Subject: Update support link --- ui/app/info.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/app/info.js b/ui/app/info.js index 899841c83..c69d83715 100644 --- a/ui/app/info.js +++ b/ui/app/info.js @@ -103,7 +103,7 @@ InfoScreen.prototype.render = function () { [ h('div.fa.fa-support', [ h('a.info', { - href: 'http://metamask.consensyssupport.happyfox.com', + href: 'https://support.metamask.com', target: '_blank', }, 'Visit our Support Center'), ]), -- cgit From 8498daee88f1002b6a2d980a66101a0d62a7918c Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Fri, 1 Sep 2017 11:03:49 -0700 Subject: Update etherscan links to https Fixes #2005 --- ui/lib/account-link.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'ui') diff --git a/ui/lib/account-link.js b/ui/lib/account-link.js index d061d0ad1..037d990fa 100644 --- a/ui/lib/account-link.js +++ b/ui/lib/account-link.js @@ -3,19 +3,19 @@ module.exports = function (address, network) { let link switch (net) { case 1: // main net - link = `http://etherscan.io/address/${address}` + link = `https://etherscan.io/address/${address}` break case 2: // morden test net - link = `http://morden.etherscan.io/address/${address}` + link = `https://morden.etherscan.io/address/${address}` break case 3: // ropsten test net - link = `http://ropsten.etherscan.io/address/${address}` + link = `https://ropsten.etherscan.io/address/${address}` break case 4: // rinkeby test net - link = `http://rinkeby.etherscan.io/address/${address}` + link = `https://rinkeby.etherscan.io/address/${address}` break case 42: // kovan test net - link = `http://kovan.etherscan.io/address/${address}` + link = `https://kovan.etherscan.io/address/${address}` break default: link = '' -- cgit From 90272e252fa265037ecdfb3f618aa1a8e16ee4fb Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 5 Sep 2017 11:44:26 -0700 Subject: Make eth_sign deprecation warning more useful Link to descriptive article that demonstrates the new preferred method. --- ui/app/components/pending-msg.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ui') diff --git a/ui/app/components/pending-msg.js b/ui/app/components/pending-msg.js index b7133cda8..834719c53 100644 --- a/ui/app/components/pending-msg.js +++ b/ui/app/components/pending-msg.js @@ -35,10 +35,21 @@ PendingMsg.prototype.render = function () { style: { margin: '10px', }, - }, `Signing this message can have + }, [ + `Signing this message can have dangerous side effects. Only sign messages from sites you fully trust with your entire account. - This dangerous method will be removed in a future version.`), + This dangerous method will be removed in a future version. `, + h('a', { + href: 'https://medium.com/metamask/the-new-secure-way-to-sign-data-in-your-browser-6af9dd2a1527', + style: { color: 'rgb(247, 134, 28)' }, + onClick: (event) => { + event.preventDefault() + const url = 'https://medium.com/metamask/the-new-secure-way-to-sign-data-in-your-browser-6af9dd2a1527' + global.platform.openWindow({ url }) + }, + }, 'Read more here.'), + ]), // message details h(PendingTxDetails, state), -- cgit From f0ab4ce52d4383a6b07646b829023ca5217e4e6c Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 7 Sep 2017 11:51:04 -0700 Subject: Change expected type to array. --- ui/app/components/account-dropdowns.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/app/components/account-dropdowns.js b/ui/app/components/account-dropdowns.js index c23f61c98..a53f3399d 100644 --- a/ui/app/components/account-dropdowns.js +++ b/ui/app/components/account-dropdowns.js @@ -295,7 +295,7 @@ AccountDropdowns.defaultProps = { AccountDropdowns.propTypes = { identities: PropTypes.objectOf(PropTypes.object), selected: PropTypes.string, - keyrings: PropTypes.objectOf(PropTypes.object), + keyrings: PropTypes.array, } const mapDispatchToProps = (dispatch) => { -- cgit From 69c7fe24b3f14a885bb2ff0bb936d1a35b521de3 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 7 Sep 2017 12:17:36 -0700 Subject: Place object property retrieval inside try-catch --- ui/app/components/account-dropdowns.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ui') diff --git a/ui/app/components/account-dropdowns.js b/ui/app/components/account-dropdowns.js index a53f3399d..b087a40d4 100644 --- a/ui/app/components/account-dropdowns.js +++ b/ui/app/components/account-dropdowns.js @@ -58,7 +58,7 @@ class AccountDropdowns extends Component { }, }, ), - this.indicateIfLoose(keyring.type), + this.indicateIfLoose(keyring), h('span', { style: { marginLeft: '20px', @@ -75,8 +75,9 @@ class AccountDropdowns extends Component { }) } - indicateIfLoose (type) { + indicateIfLoose (keyring) { try { // Sometimes keyrings aren't loaded yet: + const type = keyring.type const isLoose = type !== 'HD Key Tree' return isLoose ? h('.keyring-label', 'LOOSE') : null } catch (e) { return } -- cgit From 64717726c40e46dc7decffbaf3db6da0f4b0dc11 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 7 Sep 2017 15:27:30 -0700 Subject: Reword forgot password to restore seed phrase This always confuses people, I just finally did it. --- ui/app/unlock.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/app/unlock.js b/ui/app/unlock.js index 9bacd5124..4180791c4 100644 --- a/ui/app/unlock.js +++ b/ui/app/unlock.js @@ -80,7 +80,7 @@ UnlockScreen.prototype.render = function () { color: 'rgb(247, 134, 28)', textDecoration: 'underline', }, - }, 'I forgot my password.'), + }, 'Restore from seed phrase'), ]), ]) ) -- cgit From 6560a2c3af66940e9fbfcc9943655ca5c7282121 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 7 Sep 2017 17:55:34 -0700 Subject: Add front-end validation for own adddresses as a token contract address. Add information on token contract addresses. --- ui/app/add-token.js | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'ui') diff --git a/ui/app/add-token.js b/ui/app/add-token.js index 15ef7a852..81894247b 100644 --- a/ui/app/add-token.js +++ b/ui/app/add-token.js @@ -3,6 +3,8 @@ const Component = require('react').Component const h = require('react-hyperscript') const connect = require('react-redux').connect const actions = require('./actions') +const Tooltip = require('./components/tooltip.js') + const ethUtil = require('ethereumjs-util') const abi = require('human-standard-token-abi') @@ -15,6 +17,7 @@ module.exports = connect(mapStateToProps)(AddTokenScreen) function mapStateToProps (state) { return { + identities: state.metamask.identities, } } @@ -64,15 +67,24 @@ AddTokenScreen.prototype.render = function () { }, [ h('div', [ - h('span', { - style: { fontWeight: 'bold', paddingRight: '10px'}, - }, 'Token Address'), + h(Tooltip, { + position: 'top', + title: 'The contract of the actual token contract. Click for more info.', + }, [ + h('a', { + style: { fontWeight: 'bold', paddingRight: '10px'}, + href: 'https://consensyssupport.happyfox.com/staff/kb/article/24-what-is-a-token-contract-address', + }, [ + h('span', 'Token Contract Address '), + h('i.fa.fa-question-circle'), + ]), + ]), ]), h('section.flex-row.flex-center', [ h('input#token-address', { name: 'address', - placeholder: 'Token Address', + placeholder: 'Token Contract Address', onChange: this.tokenAddressDidChange.bind(this), style: { width: 'inherit', @@ -171,7 +183,9 @@ AddTokenScreen.prototype.tokenAddressDidChange = function (event) { AddTokenScreen.prototype.validateInputs = function () { let msg = '' const state = this.state + const identitiesList = Object.keys(this.props.identities) const { address, symbol, decimals } = state + const standardAddress = ethUtil.addHexPrefix(address).toLowerCase() const validAddress = ethUtil.isValidAddress(address) if (!validAddress) { @@ -189,7 +203,12 @@ AddTokenScreen.prototype.validateInputs = function () { msg += 'Symbol must be between 0 and 10 characters.' } - const isValid = validAddress && validDecimals + const ownAddress = identitiesList.includes(standardAddress) + if (ownAddress) { + msg = 'Personal address detected. Input the token contact address.' + } + + const isValid = validAddress && validDecimals && !ownAddress if (!isValid) { this.setState({ @@ -216,4 +235,3 @@ AddTokenScreen.prototype.attemptToAutoFillTokenParams = async function (address) this.setState({ symbol: symbol[0], decimals: decimals[0].toString() }) } } - -- cgit From 54a5a117d55db826ac20059f70d748cd90516270 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 7 Sep 2017 18:00:45 -0700 Subject: Fix link to open new tab. --- ui/app/add-token.js | 1 + 1 file changed, 1 insertion(+) (limited to 'ui') diff --git a/ui/app/add-token.js b/ui/app/add-token.js index 81894247b..177adc572 100644 --- a/ui/app/add-token.js +++ b/ui/app/add-token.js @@ -74,6 +74,7 @@ AddTokenScreen.prototype.render = function () { h('a', { style: { fontWeight: 'bold', paddingRight: '10px'}, href: 'https://consensyssupport.happyfox.com/staff/kb/article/24-what-is-a-token-contract-address', + target: '_blank', }, [ h('span', 'Token Contract Address '), h('i.fa.fa-question-circle'), -- cgit From 0e6c11a3b5e7677d8d37da4d41bf19b09f85cd88 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 7 Sep 2017 18:01:39 -0700 Subject: Fix typo. --- ui/app/add-token.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/app/add-token.js b/ui/app/add-token.js index 177adc572..18adc7eb5 100644 --- a/ui/app/add-token.js +++ b/ui/app/add-token.js @@ -206,7 +206,7 @@ AddTokenScreen.prototype.validateInputs = function () { const ownAddress = identitiesList.includes(standardAddress) if (ownAddress) { - msg = 'Personal address detected. Input the token contact address.' + msg = 'Personal address detected. Input the token contract address.' } const isValid = validAddress && validDecimals && !ownAddress -- cgit