Lint fixes

This commit is contained in:
Dan 2017-08-29 12:20:48 -02:30 committed by Chi Kei Chan
parent 3ea841e276
commit e7b3ef0708
34 changed files with 212 additions and 265 deletions

View File

@ -30,7 +30,7 @@ AccountAndTransactionDetails.prototype.render = function () {
// transaction // transaction
h(TxView, { h(TxView, {
style: { style: {
} },
}, [ }, [
]), ]),
]) ])

View File

@ -5,15 +5,10 @@ const h = require('react-hyperscript')
const connect = require('react-redux').connect const connect = require('react-redux').connect
const actions = require('./actions') const actions = require('./actions')
const valuesFor = require('./util').valuesFor const valuesFor = require('./util').valuesFor
const Identicon = require('./components/identicon')
const EthBalance = require('./components/eth-balance')
const TransactionList = require('./components/transaction-list') const TransactionList = require('./components/transaction-list')
const ExportAccountView = require('./components/account-export') const ExportAccountView = require('./components/account-export')
const ethUtil = require('ethereumjs-util')
const EditableLabel = require('./components/editable-label')
const TabBar = require('./components/tab-bar') const TabBar = require('./components/tab-bar')
const TokenList = require('./components/token-list') const TokenList = require('./components/token-list')
const AccountDropdowns = require('./components/account-dropdowns').AccountDropdowns
module.exports = connect(mapStateToProps)(AccountDetailScreen) module.exports = connect(mapStateToProps)(AccountDetailScreen)

View File

@ -6,8 +6,6 @@ const actions = require('./actions')
// init // init
const InitializeMenuScreen = require('./first-time/init-menu') const InitializeMenuScreen = require('./first-time/init-menu')
const NewKeyChainScreen = require('./new-keychain') const NewKeyChainScreen = require('./new-keychain')
// unlock
const UnlockScreen = require('./unlock')
// accounts // accounts
const MainContainer = require('./main-container') const MainContainer = require('./main-container')
const SendTransactionScreen = require('./send') const SendTransactionScreen = require('./send')
@ -25,7 +23,6 @@ const AddTokenScreen = require('./add-token')
const Import = require('./accounts/import') const Import = require('./accounts/import')
const InfoScreen = require('./info') const InfoScreen = require('./info')
const Loading = require('./components/loading') const Loading = require('./components/loading')
const SandwichExpando = require('sandwich-expando')
const NetworkIndicator = require('./components/network') const NetworkIndicator = require('./components/network')
const BuyView = require('./components/buy-button-subview') const BuyView = require('./components/buy-button-subview')
const QrView = require('./components/qr-code') const QrView = require('./components/qr-code')
@ -82,15 +79,15 @@ function mapStateToProps (state) {
function mapDispatchToProps (dispatch, ownProps) { function mapDispatchToProps (dispatch, ownProps) {
return { return {
hideSidebar: () => {dispatch(actions.hideSidebar())}, hideSidebar: () => { dispatch(actions.hideSidebar()) },
showNetworkDropdown: () => {dispatch(actions.showNetworkDropdown())}, showNetworkDropdown: () => { dispatch(actions.showNetworkDropdown()) },
hideNetworkDropdown: () => {dispatch(actions.hideNetworkDropdown())}, hideNetworkDropdown: () => { dispatch(actions.hideNetworkDropdown()) },
} }
} }
App.prototype.render = function () { App.prototype.render = function () {
var props = this.props var props = this.props
const { isLoading, loadingMessage, transForward, network, sidebarOpen } = props const { isLoading, loadingMessage, network } = props
const isLoadingNetwork = network === 'loading' && props.currentView.name !== 'config' const isLoadingNetwork = network === 'loading' && props.currentView.name !== 'config'
const loadMessage = loadingMessage || isLoadingNetwork ? const loadMessage = loadingMessage || isLoadingNetwork ?
`Connecting to ${this.getNetworkName()}` : null `Connecting to ${this.getNetworkName()}` : null
@ -132,15 +129,15 @@ App.prototype.render = function () {
) )
} }
App.prototype.renderGlobalModal = function() { App.prototype.renderGlobalModal = function () {
return h(Modal, { return h(Modal, {
ref: "modalRef", ref: 'modalRef',
}, [ }, [
h(BuyOptions, {}, []), // h(BuyOptions, {}, []),
]) ])
} }
App.prototype.renderSidebar = function() { App.prototype.renderSidebar = function () {
return h('div', { return h('div', {
}, [ }, [
@ -192,14 +189,10 @@ App.prototype.renderAppBar = function () {
return null return null
} }
const props = this.props
const state = this.state || {}
const isNetworkMenuOpen = state.isNetworkMenuOpen || false
return ( return (
h('.full-width', { h('.full-width', {
style: {} style: {},
}, [ }, [
h('.app-header.flex-row.flex-space-between', { h('.app-header.flex-row.flex-space-between', {

View File

@ -12,6 +12,7 @@ module.exports = AccountOptionsDropdown
// TODO: specify default props and proptypes // TODO: specify default props and proptypes
// TODO: hook up to state, connect to redux to clean up API // TODO: hook up to state, connect to redux to clean up API
// TODO: selectedAddress is not defined... should we use selected?
AccountOptionsDropdown.prototype.render = function () { AccountOptionsDropdown.prototype.render = function () {
const { selected, network, identities, style, dropdownWrapperStyle, menuItemStyles } = this.props const { selected, network, identities, style, dropdownWrapperStyle, menuItemStyles } = this.props
@ -21,8 +22,8 @@ AccountOptionsDropdown.prototype.render = function () {
selected: selectedAddress, selected: selectedAddress,
network, network,
identities, identities,
style: !!style ? style : {}, style: style || {},
dropdownWrapperStyle: !!dropdownWrapperStyle ? dropdownWrapperStyle : {}, dropdownWrapperStyle: dropdownWrapperStyle || {},
menuItemStyles: !!menuItemStyles ? menuItemStyles : {}, menuItemStyles: menuItemStyles || {},
}, []) }, [])
} }

View File

@ -12,6 +12,7 @@ module.exports = AccountSelectionDropdown
// TODO: specify default props and proptypes // TODO: specify default props and proptypes
// TODO: hook up to state, connect to redux to clean up API // TODO: hook up to state, connect to redux to clean up API
// TODO: selectedAddress is not defined... should we use selected?
AccountSelectionDropdown.prototype.render = function () { AccountSelectionDropdown.prototype.render = function () {
const { selected, network, identities, style, dropdownWrapperStyle, menuItemStyles } = this.props const { selected, network, identities, style, dropdownWrapperStyle, menuItemStyles } = this.props
@ -21,8 +22,8 @@ AccountSelectionDropdown.prototype.render = function () {
selected: selectedAddress, selected: selectedAddress,
network, network,
identities, identities,
style: !!style ? style : {}, style: style || {},
dropdownWrapperStyle: !!dropdownWrapperStyle ? dropdownWrapperStyle : {}, dropdownWrapperStyle: dropdownWrapperStyle || {},
menuItemStyles: !!menuItemStyles ? menuItemStyles : {}, menuItemStyles: menuItemStyles || {},
}, []) }, [])
} }

View File

@ -25,7 +25,7 @@ class AccountDropdowns extends Component {
} }
renderAccounts () { renderAccounts () {
const { identities, accounts, selected, menuItemStyles, dropdownWrapperStyle, actions } = this.props const { identities, accounts, selected, menuItemStyles, actions } = this.props
return Object.keys(identities).map((key, index) => { return Object.keys(identities).map((key, index) => {
const identity = identities[key] const identity = identities[key]
@ -57,13 +57,13 @@ class AccountDropdowns extends Component {
flex: '1 1 0', flex: '1 1 0',
minWidth: '20px', minWidth: '20px',
minHeight: '30px', minHeight: '30px',
} },
}, [ }, [
h('span', { h('span', {
style: { style: {
flex: '1 1 auto', flex: '1 1 auto',
fontSize: '14px', fontSize: '14px',
} },
}, isSelected ? h('i.fa.fa-check') : null), }, isSelected ? h('i.fa.fa-check') : null),
]), ]),
@ -86,7 +86,7 @@ class AccountDropdowns extends Component {
alignItems: 'flex-start', alignItems: 'flex-start',
justifyContent: 'center', justifyContent: 'center',
marginLeft: '10px', marginLeft: '10px',
} },
}, [ }, [
h('span.account-dropdown-name', { h('span.account-dropdown-name', {
style: { style: {
@ -102,7 +102,7 @@ class AccountDropdowns extends Component {
style: { style: {
fontSize: '14px', fontSize: '14px',
}, },
}, formattedBalance) }, formattedBalance),
]), ]),
h('span', { h('span', {
@ -119,17 +119,17 @@ class AccountDropdowns extends Component {
}, },
}, [ }, [
'Edit', 'Edit',
]) ]),
]), ]),
]) ]),
] ]
) )
}) })
} }
renderAccountSelector () { renderAccountSelector () {
const { actions, dropdownWrapperStyle, useCssTransition, innerStyle } = this.props const { actions, useCssTransition, innerStyle } = this.props
const { accountSelectorActive, menuItemStyles } = this.state const { accountSelectorActive, menuItemStyles } = this.state
return h( return h(
@ -323,7 +323,7 @@ class AccountDropdowns extends Component {
} }
render () { render () {
const { style, enableAccountsSelector, enableAccountOptions, dropdownWrapperStyle } = this.props const { style, enableAccountsSelector, enableAccountOptions } = this.props
const { optionsMenuActive, accountSelectorActive } = this.state const { optionsMenuActive, accountSelectorActive } = this.state
return h( return h(

View File

@ -1,7 +1,6 @@
// Reusable Dropdown Components // Reusable Dropdown Components
//TODO: Refactor into separate components // TODO: Refactor into separate components
const Dropdown = require('./components/dropdown').Dropdown const Dropdown = require('./components/dropdown').Dropdown
const DropdownMenuItem = require('./components/dropdown').DropdownMenuItem
const AccountDropdowns = require('./components/account-dropdowns') const AccountDropdowns = require('./components/account-dropdowns')
// App-Specific Instances // App-Specific Instances
@ -15,4 +14,4 @@ module.exports = {
NetworkDropdown, NetworkDropdown,
Dropdown, Dropdown,
AccountDropdowns, AccountDropdowns,
} }

View File

@ -23,6 +23,7 @@ function mapDispatchToProps (dispatch) {
dispatch(actions.setProviderType(type)) dispatch(actions.setProviderType(type))
}, },
setDefaultRpcTarget: () => { setDefaultRpcTarget: () => {
// TODO: type is not defined. Is it needed?
dispatch(actions.setDefaultRpcTarget(type)) dispatch(actions.setDefaultRpcTarget(type))
}, },
setRpcTarget: (target) => { setRpcTarget: (target) => {
@ -31,8 +32,8 @@ function mapDispatchToProps (dispatch) {
showConfigPage: () => { showConfigPage: () => {
dispatch(actions.showConfigPage()) dispatch(actions.showConfigPage())
}, },
showNetworkDropdown: () => {dispatch(actions.showNetworkDropdown())}, showNetworkDropdown: () => { dispatch(actions.showNetworkDropdown()) },
hideNetworkDropdown: () => {dispatch(actions.hideNetworkDropdown())}, hideNetworkDropdown: () => { dispatch(actions.hideNetworkDropdown()) },
} }
} }
@ -49,7 +50,6 @@ NetworkDropdown.prototype.render = function () {
const props = this.props const props = this.props
const { provider: { type: providerType, rpcTarget: activeNetwork } } = props const { provider: { type: providerType, rpcTarget: activeNetwork } } = props
const rpcList = props.frequentRpcList const rpcList = props.frequentRpcList
const state = this.state || {}
const isOpen = this.props.networkDropdownOpen const isOpen = this.props.networkDropdownOpen
return h(Dropdown, { return h(Dropdown, {
@ -135,7 +135,7 @@ NetworkDropdown.prototype.render = function () {
{ {
key: 'rinkeby', key: 'rinkeby',
closeMenu: () => this.props.hideNetworkDropdown(), closeMenu: () => this.props.hideNetworkDropdown(),
onClick: () => propssetProviderType('rinkeby'), onClick: () => props.setProviderType('rinkeby'),
style: { style: {
fontSize: '18px', fontSize: '18px',
}, },

View File

@ -3,7 +3,7 @@ const h = require('react-hyperscript')
const { inherits } = require('util') const { inherits } = require('util')
const { const {
formatBalance, formatBalance,
generateBalanceObject generateBalanceObject,
} = require('../util') } = require('../util')
const Tooltip = require('./tooltip.js') const Tooltip = require('./tooltip.js')
const FiatValue = require('./fiat-value.js') const FiatValue = require('./fiat-value.js')
@ -58,7 +58,7 @@ EthBalanceComponent.prototype.renderBalance = function (value) {
const containerProps = hideTooltip ? {} : { const containerProps = hideTooltip ? {} : {
position: 'bottom', position: 'bottom',
title: `${ethNumber} ${ethSuffix}`, title: `${ethNumber} ${ethSuffix}`,
}; }
return ( return (
h(hideTooltip ? 'div' : Tooltip, h(hideTooltip ? 'div' : Tooltip,

View File

@ -1,7 +1,6 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const findDOMNode = require('react-dom').findDOMNode
module.exports = InputNumber module.exports = InputNumber
@ -13,13 +12,13 @@ function InputNumber () {
value: 0, value: 0,
} }
this.setValue = this.setValue.bind(this); this.setValue = this.setValue.bind(this)
} }
InputNumber.prototype.componentWillMount = function () { InputNumber.prototype.componentWillMount = function () {
const { initValue = 0 } = this.props const { initValue = 0 } = this.props
this.setState({ value: initValue }); this.setState({ value: initValue })
} }
InputNumber.prototype.setValue = function (newValue) { InputNumber.prototype.setValue = function (newValue) {
@ -34,23 +33,23 @@ InputNumber.prototype.setValue = function (newValue) {
} }
InputNumber.prototype.render = function () { InputNumber.prototype.render = function () {
const { unitLabel, step = 1, min, placeholder } = this.props const { unitLabel, step = 1, placeholder } = this.props
const { value } = this.state const { value } = this.state
return h('div.customize-gas-input-wrapper', {}, [ return h('div.customize-gas-input-wrapper', {}, [
h('input.customize-gas-input', { h('input.customize-gas-input', {
placeholder, placeholder,
type: 'number', type: 'number',
value, value,
onChange: (e) => this.setValue(Number(e.target.value)) onChange: (e) => this.setValue(Number(e.target.value)),
}), }),
h('span.gas-tooltip-input-detail', {}, [unitLabel]), h('span.gas-tooltip-input-detail', {}, [unitLabel]),
h('div.gas-tooltip-input-arrows', {}, [ h('div.gas-tooltip-input-arrows', {}, [
h('i.fa.fa-angle-up', { h('i.fa.fa-angle-up', {
onClick: () => this.setValue(value + step) onClick: () => this.setValue(value + step),
}), }),
h('i.fa.fa-angle-down', { h('i.fa.fa-angle-down', {
onClick: () => this.setValue(value - step) onClick: () => this.setValue(value - step),
}), }),
]), ]),
]) ])

View File

@ -19,7 +19,7 @@ MenuDroppoComponent.prototype.render = function () {
this.manageListeners() this.manageListeners()
let style = this.props.style || {} const style = this.props.style || {}
if (!('position' in style)) { if (!('position' in style)) {
style.position = 'fixed' style.position = 'fixed'
} }

View File

@ -37,7 +37,7 @@ module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountDetailsModa
// fonts of qr-header and close button // fonts of qr-header and close button
AccountDetailsModal.prototype.render = function () { AccountDetailsModal.prototype.render = function () {
const { selectedIdentity, selectedAddress, network } = this.props const { selectedIdentity, network } = this.props
return h('div', {}, [ return h('div', {}, [
h('div.account-details-modal-wrapper', { h('div.account-details-modal-wrapper', {
@ -63,12 +63,12 @@ AccountDetailsModal.prototype.render = function () {
Qr: { Qr: {
message: this.props.selectedIdentity.name, message: this.props.selectedIdentity.name,
data: this.props.selectedIdentity.address, data: this.props.selectedIdentity.address,
} },
}, []), }, []),
// divider // divider
h('div.account-details-modal-divider', { h('div.account-details-modal-divider', {
style: {} style: {},
}, []), }, []),
h('button.btn-clear', { h('button.btn-clear', {
@ -85,6 +85,6 @@ AccountDetailsModal.prototype.render = function () {
'Export private key', 'Export private key',
]), ]),
]) ]),
]) ])
} }

View File

@ -18,7 +18,7 @@ function mapDispatchToProps (dispatch) {
}, },
hideModal: () => { hideModal: () => {
dispatch(actions.hideModal()) dispatch(actions.hideModal())
} },
} }
} }
@ -71,7 +71,7 @@ BuyOptions.prototype.render = function () {
background: 'white', background: 'white',
}, },
onClick: () => { this.props.hideModal() }, onClick: () => { this.props.hideModal() },
}, h('div.buy-modal-content-footer#buy-modal-content-footer-text',{}, 'Cancel')), }, h('div.buy-modal-content-footer#buy-modal-content-footer-text', {}, 'Cancel')),
]) ]),
]) ])
} }

View File

@ -71,6 +71,6 @@ EditAccountNameModal.prototype.render = function () {
'SAVE', 'SAVE',
]), ]),
]) ]),
]) ])
} }

View File

@ -2,4 +2,4 @@ const Modal = require('./modal')
module.exports = { module.exports = {
Modal, Modal,
} }

View File

@ -80,7 +80,7 @@ const MODALS = {
contents: [], contents: [],
mobileModalStyle: {}, mobileModalStyle: {},
laptopModalStyle: {}, laptopModalStyle: {},
} },
} }
const BACKDROPSTYLE = { const BACKDROPSTYLE = {
@ -120,7 +120,7 @@ Modal.prototype.render = function () {
{ {
className: 'modal', className: 'modal',
keyboard: false, keyboard: false,
onHide: () => {this.onHide()}, onHide: () => { this.onHide() },
ref: (ref) => { ref: (ref) => {
this.modalRef = ref this.modalRef = ref
}, },
@ -131,7 +131,7 @@ Modal.prototype.render = function () {
) )
} }
Modal.prototype.componentWillReceiveProps = function(nextProps) { Modal.prototype.componentWillReceiveProps = function (nextProps) {
if (nextProps.active) { if (nextProps.active) {
this.show() this.show()
} else if (this.props.active) { } else if (this.props.active) {
@ -139,17 +139,17 @@ Modal.prototype.componentWillReceiveProps = function(nextProps) {
} }
} }
Modal.prototype.onHide = function() { Modal.prototype.onHide = function () {
if (this.props.onHideCallback) { if (this.props.onHideCallback) {
this.props.onHideCallback() this.props.onHideCallback()
} }
this.props.hideModal() this.props.hideModal()
} }
Modal.prototype.hide = function() { Modal.prototype.hide = function () {
this.modalRef.hide() this.modalRef.hide()
} }
Modal.prototype.show = function() { Modal.prototype.show = function () {
this.modalRef.show() this.modalRef.show()
} }

View File

@ -38,14 +38,14 @@ NewAccountModal.prototype.render = function () {
]), ]),
h('div.modal-close-x', {}), h('div.modal-close-x', {}),
h('div.new-account-modal-content', {}, [ h('div.new-account-modal-content', {}, [
'Account Name', 'Account Name',
]), ]),
h('div.new-account-input-wrapper', {}, [ h('div.new-account-input-wrapper', {}, [
h('input.new-account-input', { h('input.new-account-input', {
placeholder: 'E.g. My new account' placeholder: 'E.g. My new account',
}, []), }, []),
]), ]),
@ -62,6 +62,6 @@ NewAccountModal.prototype.render = function () {
'SAVE', 'SAVE',
]), ]),
]), ]),
]) ]),
]) ])
} }

View File

@ -8,17 +8,10 @@ const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN const BN = ethUtil.BN
const hexToBn = require('../../../app/scripts/lib/hex-to-bn') const hexToBn = require('../../../app/scripts/lib/hex-to-bn')
const util = require('../util') const util = require('../util')
const MiniAccountPanel = require('./mini-account-panel')
const Copyable = require('./copyable')
const EthBalance = require('./eth-balance')
const addressSummary = util.addressSummary
const nameForAddress = require('../../lib/contract-namer')
const BNInput = require('./bn-as-decimal-input')
const MIN_GAS_PRICE_GWEI_BN = new BN(1) const MIN_GAS_PRICE_GWEI_BN = new BN(1)
const GWEI_FACTOR = new BN(1e9) const GWEI_FACTOR = new BN(1e9)
const MIN_GAS_PRICE_BN = MIN_GAS_PRICE_GWEI_BN.mul(GWEI_FACTOR) const MIN_GAS_PRICE_BN = MIN_GAS_PRICE_GWEI_BN.mul(GWEI_FACTOR)
const MIN_GAS_LIMIT_BN = new BN(21000)
// Faked, for Icon // Faked, for Icon
@ -34,8 +27,8 @@ const ARAGON = '960b236A07cf122663c4303350609A66A7B288C0'
// actionButtons // actionButtons
const sectionDivider = h('div', { const sectionDivider = h('div', {
style: { style: {
height:'1px', height: '1px',
background:'#E7E7E7', background: '#E7E7E7',
}, },
}) })
@ -43,8 +36,8 @@ const contentDivider = h('div', {
style: { style: {
marginLeft: '16px', marginLeft: '16px',
marginRight: '16px', marginRight: '16px',
height:'1px', height: '1px',
background:'#E7E7E7', background: '#E7E7E7',
}, },
}) })
@ -61,15 +54,13 @@ function PendingTx () {
PendingTx.prototype.render = function () { PendingTx.prototype.render = function () {
const props = this.props const props = this.props
const { currentCurrency, blockGasLimit } = props const { blockGasLimit } = props
const conversionRate = props.conversionRate
const txMeta = this.gatherTxMeta() const txMeta = this.gatherTxMeta()
const txParams = txMeta.txParams || {} const txParams = txMeta.txParams || {}
// Account Details // Account Details
const address = txParams.from || props.selectedAddress const address = txParams.from || props.selectedAddress
const identity = props.identities[address] || { address: address }
const account = props.accounts[address] const account = props.accounts[address]
const balance = account ? account.balance : '0x0' const balance = account ? account.balance : '0x0'
@ -79,8 +70,6 @@ PendingTx.prototype.render = function () {
// Gas // Gas
const gas = txParams.gas const gas = txParams.gas
const gasBn = hexToBn(gas) const gasBn = hexToBn(gas)
const gasLimit = new BN(parseInt(blockGasLimit))
const safeGasLimit = this.bnMultiplyByFraction(gasLimit, 19, 20).toString(10)
// Gas Price // Gas Price
const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16) const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16)
@ -90,8 +79,6 @@ PendingTx.prototype.render = function () {
const valueBn = hexToBn(txParams.value) const valueBn = hexToBn(txParams.value)
const maxCost = txFeeBn.add(valueBn) const maxCost = txFeeBn.add(valueBn)
const dataLength = txParams.data ? (txParams.data.length - 2) / 2 : 0
const balanceBn = hexToBn(balance) const balanceBn = hexToBn(balance)
const insufficientBalance = balanceBn.lt(maxCost) const insufficientBalance = balanceBn.lt(maxCost)
@ -112,13 +99,13 @@ PendingTx.prototype.render = function () {
marginRight: '3.5%', marginRight: '3.5%',
background: '#FFFFFF', // $background-white background: '#FFFFFF', // $background-white
boxShadow: '0 2px 4px 0 rgba(0,0,0,0.08)', boxShadow: '0 2px 4px 0 rgba(0,0,0,0.08)',
} },
}, [ }, [
h('section.flex-center.flex-row', { h('section.flex-center.flex-row', {
style: { style: {
zIndex: 15, // $token-icon-z-index zIndex: 15, // $token-icon-z-index
marginTop: '-35px', marginTop: '-35px',
} },
}, [ }, [
h(Identicon, { h(Identicon, {
address: ARAGON, address: ARAGON,
@ -178,23 +165,23 @@ PendingTx.prototype.render = function () {
h('div', { h('div', {
style: { style: {
width: '50%', width: '50%',
} },
}, [ }, [
h('span', { h('span', {
style: { style: {
textAlign: 'left', textAlign: 'left',
fontSize: '12px', fontSize: '12px',
} },
}, [ }, [
'From' 'From',
]) ]),
]), ]),
h('div', { h('div', {
style: { style: {
width: '50%', width: '50%',
} },
},[ }, [
h('div', { h('div', {
style: { style: {
textAlign: 'left', textAlign: 'left',
@ -208,8 +195,8 @@ PendingTx.prototype.render = function () {
textAlign: 'left', textAlign: 'left',
fontSize: '8px', fontSize: '8px',
}, },
}, 'Your Balance 2.34 ANT') }, 'Your Balance 2.34 ANT'),
]) ]),
]), ]),
contentDivider, contentDivider,
@ -219,23 +206,23 @@ PendingTx.prototype.render = function () {
h('div', { h('div', {
style: { style: {
width: '50%', width: '50%',
} },
}, [ }, [
h('span', { h('span', {
style: { style: {
textAlign: 'left', textAlign: 'left',
fontSize: '12px', fontSize: '12px',
} },
}, [ }, [
'To' 'To',
]) ]),
]), ]),
h('div', { h('div', {
style: { style: {
width: '50%', width: '50%',
} },
},[ }, [
h('div', { h('div', {
style: { style: {
textAlign: 'left', textAlign: 'left',
@ -249,8 +236,8 @@ PendingTx.prototype.render = function () {
textAlign: 'left', textAlign: 'left',
fontSize: '8px', fontSize: '8px',
}, },
}, '...5924') }, '...5924'),
]) ]),
]), ]),
contentDivider, contentDivider,
@ -260,23 +247,23 @@ PendingTx.prototype.render = function () {
h('div', { h('div', {
style: { style: {
width: '50%', width: '50%',
} },
}, [ }, [
h('span', { h('span', {
style: { style: {
textAlign: 'left', textAlign: 'left',
fontSize: '12px', fontSize: '12px',
} },
}, [ }, [
'Gas Fee' 'Gas Fee',
]) ]),
]), ]),
h('div', { h('div', {
style: { style: {
width: '50%', width: '50%',
} },
},[ }, [
h('div', { h('div', {
style: { style: {
textAlign: 'left', textAlign: 'left',
@ -290,8 +277,8 @@ PendingTx.prototype.render = function () {
textAlign: 'left', textAlign: 'left',
fontSize: '8px', fontSize: '8px',
}, },
}, '0.001575 ETH') }, '0.001575 ETH'),
]) ]),
]), ]),
contentDivider, contentDivider,
@ -305,39 +292,39 @@ PendingTx.prototype.render = function () {
paddingLeft: '6px', paddingLeft: '6px',
paddingRight: '6px', paddingRight: '6px',
marginBottom: '10px', marginBottom: '10px',
} },
}, [ }, [
h('div', { h('div', {
style: { style: {
width: '50%', width: '50%',
} },
}, [ }, [
h('div', { h('div', {
style: { style: {
textAlign: 'left', textAlign: 'left',
fontSize: '12px', fontSize: '12px',
marginBottom: '-10px', marginBottom: '-10px',
} },
}, [ }, [
'Total Tokens' 'Total Tokens',
]), ]),
h('div', { h('div', {
style: { style: {
textAlign: 'left', textAlign: 'left',
fontSize: '8px', fontSize: '8px',
} },
}, [ }, [
'Total Gas' 'Total Gas',
]) ]),
]), ]),
h('div', { h('div', {
style: { style: {
width: '50%', width: '50%',
} },
},[ }, [
h('div', { h('div', {
style: { style: {
textAlign: 'left', textAlign: 'left',
@ -351,8 +338,8 @@ PendingTx.prototype.render = function () {
textAlign: 'left', textAlign: 'left',
fontSize: '8px', fontSize: '8px',
}, },
}, '0.249 ETH') }, '0.249 ETH'),
]) ]),
]), ]),
]), // end of container ]), // end of container

View File

@ -4,7 +4,6 @@ const qrCode = require('qrcode-npm').qrcode
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('react-redux').connect
const isHexPrefixed = require('ethereumjs-util').isHexPrefixed const isHexPrefixed = require('ethereumjs-util').isHexPrefixed
const CopyButton = require('./copyButton')
module.exports = connect(mapStateToProps)(QrCodeView) module.exports = connect(mapStateToProps)(QrCodeView)

View File

@ -14,13 +14,13 @@ CurrencyToggle.prototype.render = function () {
return h('span', {}, [ return h('span', {}, [
h('span', { h('span', {
className: currentCurrency === 'ETH' ? 'selected-currency' : 'unselected-currency', className: currentCurrency === 'ETH' ? 'selected-currency' : 'unselected-currency',
onClick: () => onClick('ETH') onClick: () => onClick('ETH'),
}, ['ETH']), }, ['ETH']),
'<>', '<>',
h('span', { h('span', {
className: currentCurrency === 'USD' ? 'selected-currency' : 'unselected-currency', className: currentCurrency === 'USD' ? 'selected-currency' : 'unselected-currency',
onClick: () => onClick('USD'), onClick: () => onClick('USD'),
}, ['USD']), }, ['USD']),
]) //holding on icon from design ]) // holding on icon from design
} }

View File

@ -2,7 +2,6 @@ const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const InputNumber = require('../input-number.js') const InputNumber = require('../input-number.js')
const findDOMNode = require('react-dom').findDOMNode
module.exports = GasTooltip module.exports = GasTooltip
@ -14,14 +13,14 @@ function GasTooltip () {
gasPrice: 0, gasPrice: 0,
} }
this.updateGasPrice = this.updateGasPrice.bind(this); this.updateGasPrice = this.updateGasPrice.bind(this)
this.updateGasLimit = this.updateGasLimit.bind(this); this.updateGasLimit = this.updateGasLimit.bind(this)
this.onClose = this.onClose.bind(this); this.onClose = this.onClose.bind(this)
} }
GasTooltip.prototype.componentWillMount = function () { GasTooltip.prototype.componentWillMount = function () {
const { gasPrice = 0, gasLimit = 0} = this.props const { gasPrice = 0, gasLimit = 0} = this.props
this.setState({ this.setState({
gasPrice: parseInt(gasPrice, 16) / 1000000000, gasPrice: parseInt(gasPrice, 16) / 1000000000,
gasLimit: parseInt(gasLimit, 16), gasLimit: parseInt(gasLimit, 16),
@ -35,7 +34,7 @@ GasTooltip.prototype.updateGasPrice = function (newPrice) {
this.setState({ gasPrice: newPrice }) this.setState({ gasPrice: newPrice })
onFeeChange({ onFeeChange({
gasLimit: gasLimit.toString(16), gasLimit: gasLimit.toString(16),
gasPrice: (newPrice * 1000000000).toString(16) gasPrice: (newPrice * 1000000000).toString(16),
}) })
} }
@ -46,29 +45,28 @@ GasTooltip.prototype.updateGasLimit = function (newLimit) {
this.setState({ gasLimit: newLimit }) this.setState({ gasLimit: newLimit })
onFeeChange({ onFeeChange({
gasLimit: newLimit.toString(16), gasLimit: newLimit.toString(16),
gasPrice: (gasPrice * 1000000000).toString(16) gasPrice: (gasPrice * 1000000000).toString(16),
}) })
} }
GasTooltip.prototype.onClose = function (e) { GasTooltip.prototype.onClose = function (e) {
e.stopPropagation(); e.stopPropagation()
this.props.onClose(); this.props.onClose()
} }
GasTooltip.prototype.render = function () { GasTooltip.prototype.render = function () {
const { position, title, children, className } = this.props
const { gasPrice, gasLimit } = this.state const { gasPrice, gasLimit } = this.state
return h('div.gas-tooltip', {}, [ return h('div.gas-tooltip', {}, [
h('div.gas-tooltip-close-area', { h('div.gas-tooltip-close-area', {
onClick: this.onClose onClick: this.onClose,
}), }),
h('div.customize-gas-tooltip-container', {}, [ h('div.customize-gas-tooltip-container', {}, [
h('div.customize-gas-tooltip', {}, [ h('div.customize-gas-tooltip', {}, [
h('div.gas-tooltip-header.gas-tooltip-label', {}, ['Customize Gas']), h('div.gas-tooltip-header.gas-tooltip-label', {}, ['Customize Gas']),
h('div.gas-tooltip-input-label', {}, [ h('div.gas-tooltip-input-label', {}, [
h('span.gas-tooltip-label', {}, ['Gas Price']), h('span.gas-tooltip-label', {}, ['Gas Price']),
h('i.fa.fa-info-circle') h('i.fa.fa-info-circle'),
]), ]),
h(InputNumber, { h(InputNumber, {
unitLabel: 'GWEI', unitLabel: 'GWEI',
@ -76,7 +74,7 @@ GasTooltip.prototype.render = function () {
min: 0, min: 0,
placeholder: '0', placeholder: '0',
initValue: gasPrice, initValue: gasPrice,
onChange: (newPrice) => this.updateGasPrice(newPrice), onChange: (newPrice) => this.updateGasPrice(newPrice),
}), }),
h('div.gas-tooltip-input-label', { h('div.gas-tooltip-input-label', {
style: { style: {
@ -84,7 +82,7 @@ GasTooltip.prototype.render = function () {
}, },
}, [ }, [
h('span.gas-tooltip-label', {}, ['Gas Limit']), h('span.gas-tooltip-label', {}, ['Gas Limit']),
h('i.fa.fa-info-circle') h('i.fa.fa-info-circle'),
]), ]),
h(InputNumber, { h(InputNumber, {
unitLabel: 'UNITS', unitLabel: 'UNITS',
@ -92,11 +90,11 @@ GasTooltip.prototype.render = function () {
min: 0, min: 0,
placeholder: '0', placeholder: '0',
initValue: gasLimit, initValue: gasLimit,
onChange: (newLimit) => this.updateGasLimit(newLimit), onChange: (newLimit) => this.updateGasLimit(newLimit),
}), }),
]), ]),
h('div.gas-tooltip-arrow', {}), h('div.gas-tooltip-arrow', {}),
]) ]),
]) ])
} }

View File

@ -131,8 +131,8 @@ ShapeshiftForm.prototype.renderMain = function () {
}, },
}, [ }, [
this.props.warning this.props.warning
? this.props.warning ? this.props.warning &&
&& h('span.error.flex-center', { h('span.error.flex-center', {
style: { style: {
textAlign: 'center', textAlign: 'center',
width: '229px', width: '229px',

View File

@ -12,7 +12,7 @@ function Tooltip () {
Tooltip.prototype.render = function () { Tooltip.prototype.render = function () {
const props = this.props const props = this.props
const { position, title, children, show = true } = props const { position, title, children } = props
return h(ReactTooltip, { return h(ReactTooltip, {
position: position || 'left', position: position || 'left',

View File

@ -156,7 +156,7 @@ function failIfFailed (transaction) {
} }
if (transaction.err || transaction.warning) { if (transaction.err || transaction.warning) {
const { err, warning = {} } = transaction const { err, warning = {} } = transaction
const errFirst = !!(( err && warning ) || err) const errFirst = !!((err && warning) || err)
const message = errFirst ? err.message : warning.message const message = errFirst ? err.message : warning.message
errFirst ? err.message : warning.message errFirst ? err.message : warning.message

View File

@ -6,8 +6,6 @@ const selectors = require('../selectors')
const Identicon = require('./identicon') const Identicon = require('./identicon')
const { formatBalance, formatDate } = require('../util') const { formatBalance, formatDate } = require('../util')
const valuesFor = require('../util').valuesFor
module.exports = connect(mapStateToProps)(TxList) module.exports = connect(mapStateToProps)(TxList)
function mapStateToProps (state) { function mapStateToProps (state) {
@ -28,7 +26,7 @@ const contentDivider = h('div.tx-list-content-divider', {
TxList.prototype.render = function () { TxList.prototype.render = function () {
const { txsToRender, conversionRate } = this.props const { txsToRender } = this.props
console.log('transactions to render', txsToRender) console.log('transactions to render', txsToRender)
@ -42,7 +40,7 @@ TxList.prototype.render = function () {
}, [ }, [
h('div', { h('div', {
style: {} style: {},
}, 'TRANSACTIONS'), }, 'TRANSACTIONS'),
]), ]),
@ -69,41 +67,41 @@ TxList.prototype.renderTransactionListItem = function (transaction) {
const { address, transactionStatus, transactionAmount, dateString } = props const { address, transactionStatus, transactionAmount, dateString } = props
return h('div.flex-column.tx-list-item-wrapper', { return h('div.flex-column.tx-list-item-wrapper', {
style: {} style: {},
}, [ }, [
h('div.tx-list-date-wrapper', { h('div.tx-list-date-wrapper', {
style: {} style: {},
}, [ }, [
h('span.tx-list-date', {}, [ h('span.tx-list-date', {}, [
dateString, dateString,
]) ]),
]), ]),
h('div.flex-row.tx-list-content-wrapper', { h('div.flex-row.tx-list-content-wrapper', {
style: {} style: {},
}, [ }, [
h('div.tx-list-identicon-wrapper', { h('div.tx-list-identicon-wrapper', {
style: {} style: {},
}, [ }, [
h(Identicon, { h(Identicon, {
address, address,
diameter: 24, diameter: 24,
}) }),
]), ]),
h('div.tx-list-account-and-status-wrapper', {}, [ h('div.tx-list-account-and-status-wrapper', {}, [
h('div.tx-list-account-wrapper', { h('div.tx-list-account-wrapper', {
style: {} style: {},
}, [ }, [
h('span.tx-list-account', {}, [ h('span.tx-list-account', {}, [
`${address.slice(0, 10)}...${address.slice(-4)}` `${address.slice(0, 10)}...${address.slice(-4)}`,
]), ]),
]), ]),
h('div.tx-list-status-wrapper', { h('div.tx-list-status-wrapper', {
style: {} style: {},
}, [ }, [
h('span.tx-list-status', {}, [ h('span.tx-list-status', {}, [
transactionStatus, transactionStatus,
@ -112,7 +110,7 @@ TxList.prototype.renderTransactionListItem = function (transaction) {
]), ]),
h('div.flex-column.tx-list-details-wrapper', { h('div.flex-column.tx-list-details-wrapper', {
style: {} style: {},
}, [ }, [
h('span.tx-list-value', {}, [ h('span.tx-list-value', {}, [
@ -124,7 +122,7 @@ TxList.prototype.renderTransactionListItem = function (transaction) {
]), ]),
]), ]),
]) ]),
]) ])
} }

View File

@ -5,7 +5,6 @@ const ethUtil = require('ethereumjs-util')
const inherits = require('util').inherits const inherits = require('util').inherits
const actions = require('../actions') const actions = require('../actions')
const WalletView = require('./wallet-view')
const BalanceComponent = require('./balance-component') const BalanceComponent = require('./balance-component')
const TxList = require('./tx-list') const TxList = require('./tx-list')
const Identicon = require('./identicon') const Identicon = require('./identicon')

View File

@ -18,7 +18,7 @@ WalletContentDisplay.prototype.render = function () {
marginLeft: '1.3em', marginLeft: '1.3em',
alignItems: 'flex-start', alignItems: 'flex-start',
...style, ...style,
} },
}, [ }, [
h('span', { h('span', {
@ -47,9 +47,9 @@ WalletContentDisplay.prototype.render = function () {
height: '6em', height: '6em',
width: '0.3em', width: '0.3em',
background: '#D8D8D8', // $alto background: '#D8D8D8', // $alto
} },
}, [ }, [
]) ]),
]) ])
} }

View File

@ -4,7 +4,6 @@ const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const Identicon = require('./identicon') const Identicon = require('./identicon')
const AccountDropdowns = require('./dropdowns/index.js').AccountDropdowns const AccountDropdowns = require('./dropdowns/index.js').AccountDropdowns
const Content = require('./wallet-content-display')
const actions = require('../actions') const actions = require('../actions')
const BalanceComponent = require('./balance-component') const BalanceComponent = require('./balance-component')
const selectors = require('../selectors') const selectors = require('../selectors')
@ -26,8 +25,8 @@ function mapStateToProps (state) {
function mapDispatchToProps (dispatch) { function mapDispatchToProps (dispatch) {
return { return {
showSendPage: () => {dispatch(actions.showSendPage())}, showSendPage: () => { dispatch(actions.showSendPage()) },
hideSidebar: () => {dispatch(actions.hideSidebar())}, hideSidebar: () => { dispatch(actions.hideSidebar()) },
} }
} }
@ -36,12 +35,10 @@ function WalletView () {
Component.call(this) Component.call(this)
} }
const noop = () => {}
WalletView.prototype.render = function () { WalletView.prototype.render = function () {
const { network, responsiveDisplayClassname, style, identities, selectedAddress, selectedAccount, accounts, selectedIdentity } = this.props const { network, responsiveDisplayClassname, identities, selectedAddress, selectedAccount, accounts, selectedIdentity } = this.props
// temporary logs + fake extra wallets // temporary logs + fake extra wallets
console.log("walletview, selectedAccount:", selectedAccount) console.log('walletview, selectedAccount:', selectedAccount)
return h('div.wallet-view.flex-column' + (responsiveDisplayClassname || ''), { return h('div.wallet-view.flex-column' + (responsiveDisplayClassname || ''), {
style: {}, style: {},
@ -49,7 +46,7 @@ WalletView.prototype.render = function () {
// TODO: Separate component: wallet account details // TODO: Separate component: wallet account details
h('div.flex-column.wallet-view-account-details', { h('div.flex-column.wallet-view-account-details', {
style: {} style: {},
}, [ }, [
h('div.flex-row.account-options-menu', { h('div.flex-row.account-options-menu', {
@ -68,12 +65,12 @@ WalletView.prototype.render = function () {
padding: '1px 15px', padding: '1px 15px',
marginLeft: '-25px', marginLeft: '-25px',
position: 'absolute', position: 'absolute',
width: '122%', //TODO, refactor all of this component out into media queries width: '122%', // TODO, refactor all of this component out into media queries
}, },
menuItemStyles: { menuItemStyles: {
padding: '0px 0px', padding: '0px 0px',
margin: '22px 0px', margin: '22px 0px',
} },
}, []), }, []),
]), ]),
@ -83,7 +80,7 @@ WalletView.prototype.render = function () {
h('div', { h('div', {
style: { style: {
position: 'relative', position: 'relative',
} },
}, [ }, [
h(AccountDropdowns, { h(AccountDropdowns, {
accounts, accounts,
@ -109,23 +106,23 @@ WalletView.prototype.render = function () {
}), }),
h('span.account-name', { h('span.account-name', {
style: {} style: {},
}, [ }, [
selectedIdentity.name selectedIdentity.name,
]), ]),
]), ]),
]), ]),
//'Wallet' - Title // 'Wallet' - Title
// Not visible on mobile // Not visible on mobile
h('div.flex-column.wallet-view-title-wrapper', {}, [ h('div.flex-column.wallet-view-title-wrapper', {}, [
h('span.wallet-view-title', {}, [ h('span.wallet-view-title', {}, [
'Wallet', 'Wallet',
]) ]),
]), ]),
//Wallet Balances // Wallet Balances
h('div.flex-column.wallet-balance-wrapper.wallet-balance-wrapper-active', {}, [ h('div.flex-column.wallet-balance-wrapper.wallet-balance-wrapper-active', {}, [
h('div.wallet-balance', {}, [ h('div.wallet-balance', {}, [

View File

@ -3,9 +3,7 @@ const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('react-redux').connect const connect = require('react-redux').connect
const actions = require('./actions') const actions = require('./actions')
const NetworkIndicator = require('./components/network')
const txHelper = require('../lib/tx-helper') const txHelper = require('../lib/tx-helper')
const isPopupOrNotification = require('../../app/scripts/lib/is-popup-or-notification')
const PendingTx = require('./components/pending-tx') const PendingTx = require('./components/pending-tx')
const PendingMsg = require('./components/pending-msg') const PendingMsg = require('./components/pending-msg')
@ -39,15 +37,13 @@ function ConfirmTxScreen () {
ConfirmTxScreen.prototype.render = function () { ConfirmTxScreen.prototype.render = function () {
const props = this.props const props = this.props
const { network, provider, unapprovedTxs, currentCurrency, const { network, unapprovedTxs, currentCurrency, unapprovedMsgs,
unapprovedMsgs, unapprovedPersonalMsgs, conversionRate, blockGasLimit } = props unapprovedPersonalMsgs, conversionRate, blockGasLimit } = props
var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, network) var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, network)
var txData = unconfTxList[props.index] || {} var txData = unconfTxList[props.index] || {}
var txParams = txData.params || {} var txParams = txData.params || {}
var isNotification = isPopupOrNotification() === 'notification'
log.info(`rendering a combined ${unconfTxList.length} unconf msg & txs`) log.info(`rendering a combined ${unconfTxList.length} unconf msg & txs`)
if (unconfTxList.length === 0) return h(Loading, { isLoading: true }) if (unconfTxList.length === 0) return h(Loading, { isLoading: true })
@ -149,14 +145,14 @@ ConfirmTxScreen.prototype.goHome = function (event) {
this.props.dispatch(actions.goHome()) this.props.dispatch(actions.goHome())
} }
function warningIfExists (warning) { // function warningIfExists (warning) {
if (warning && // if (warning &&
// Do not display user rejections on this screen: // // Do not display user rejections on this screen:
warning.indexOf('User denied transaction signature') === -1) { // warning.indexOf('User denied transaction signature') === -1) {
return h('.error', { // return h('.error', {
style: { // style: {
margin: 'auto', // margin: 'auto',
}, // },
}, warning) // }, warning)
} // }
} // }

View File

@ -1,8 +1,6 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const TxView = require('./components/tx-view')
const WalletView = require('./components/wallet-view')
const AccountAndTransactionDetails = require('./account-and-transaction-details') const AccountAndTransactionDetails = require('./account-and-transaction-details')
const HDRestoreVaultScreen = require('./keychains/hd/restore-vault') const HDRestoreVaultScreen = require('./keychains/hd/restore-vault')
const ConfigScreen = require('./config') const ConfigScreen = require('./config')
@ -24,7 +22,7 @@ MainContainer.prototype.render = function () {
// - router in separate func // - router in separate func
let contents = { let contents = {
component: AccountAndTransactionDetails, component: AccountAndTransactionDetails,
key: 'account-detail', key: 'account-detail',
style: {}, style: {},
} }
@ -36,12 +34,14 @@ MainContainer.prototype.render = function () {
component: HDRestoreVaultScreen, component: HDRestoreVaultScreen,
key: 'HDRestoreVaultScreen', key: 'HDRestoreVaultScreen',
} }
break
case 'config': case 'config':
log.debug('rendering config screen from unlock screen.') log.debug('rendering config screen from unlock screen.')
contents = { contents = {
component: ConfigScreen, component: ConfigScreen,
key: 'config', key: 'config',
} }
break
default: default:
log.debug('rendering locked screen') log.debug('rendering locked screen')
contents = { contents = {
@ -65,7 +65,7 @@ MainContainer.prototype.render = function () {
}, [ }, [
h(contents.component, { h(contents.component, {
key: contents.key, key: contents.key,
}, []) }, []),
]) ])
} }

View File

@ -10,31 +10,32 @@ const selectors = {
module.exports = selectors module.exports = selectors
function getSelectedAddress(state) { function getSelectedAddress (state) {
// TODO: accounts is not defined. Is it needed?
const selectedAddress = state.metamask.selectedAddress || Object.keys(accounts)[0] const selectedAddress = state.metamask.selectedAddress || Object.keys(accounts)[0]
return selectedAddress return selectedAddress
} }
function getSelectedIdentity(state) { function getSelectedIdentity (state) {
const selectedAddress = getSelectedAddress(state) const selectedAddress = getSelectedAddress(state)
const identities = state.metamask.identities const identities = state.metamask.identities
return identities[selectedAddress] return identities[selectedAddress]
} }
function getSelectedAccount(state) { function getSelectedAccount (state) {
const accounts = state.metamask.accounts const accounts = state.metamask.accounts
const selectedAddress = getSelectedAddress(state) const selectedAddress = getSelectedAddress(state)
return accounts[selectedAddress] return accounts[selectedAddress]
} }
function conversionRateSelector(state) { function conversionRateSelector (state) {
return state.metamask.conversionRate return state.metamask.conversionRate
} }
function transactionsSelector(state) { function transactionsSelector (state) {
const { network } = state.metamask const { network } = state.metamask
const unapprovedMsgs = valuesFor(state.metamask.unapprovedMsgs) const unapprovedMsgs = valuesFor(state.metamask.unapprovedMsgs)
const shapeShiftTxList = (network === '1') ? state.metamask.shapeShiftTxList : undefined const shapeShiftTxList = (network === '1') ? state.metamask.shapeShiftTxList : undefined
@ -42,4 +43,4 @@ function transactionsSelector(state) {
const txsToRender = !shapeShiftTxList ? transactions.concat(unapprovedMsgs) : transactions.concat(unapprovedMsgs, shapeShiftTxList) const txsToRender = !shapeShiftTxList ? transactions.concat(unapprovedMsgs) : transactions.concat(unapprovedMsgs, shapeShiftTxList)
return txsToRender.sort((a, b) => b.time - a.time) return txsToRender.sort((a, b) => b.time - a.time)
} }

View File

@ -3,7 +3,6 @@ const PersistentForm = require('../lib/persistent-form')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('react-redux').connect const connect = require('react-redux').connect
const Identicon = require('./components/identicon') const Identicon = require('./components/identicon')
const hexToBn = require('../../app/scripts/lib/hex-to-bn')
const EnsInput = require('./components/ens-input') const EnsInput = require('./components/ens-input')
const GasTooltip = require('./components/send/gas-tooltip') const GasTooltip = require('./components/send/gas-tooltip')
const CurrencyToggle = require('./components/send/currency-toggle') const CurrencyToggle = require('./components/send/currency-toggle')
@ -19,13 +18,8 @@ const {
addToAddressBook, addToAddressBook,
signTx, signTx,
} = require('./actions') } = require('./actions')
const { stripHexPrefix, addHexPrefix, BN } = require('ethereumjs-util') const { stripHexPrefix, addHexPrefix } = require('ethereumjs-util')
const { const { isHex, numericBalance } = require('./util')
addressSummary,
bnMultiplyByFraction,
isHex,
numericBalance,
} = require('./util')
const ARAGON = '960b236A07cf122663c4303350609A66A7B288C0' const ARAGON = '960b236A07cf122663c4303350609A66A7B288C0'
@ -98,9 +92,6 @@ SendTransactionScreen.prototype.render = function () {
const props = this.props const props = this.props
const { const {
selectedIdentity, selectedIdentity,
address,
account,
identity,
network, network,
identities, identities,
addressBook, addressBook,
@ -111,7 +102,7 @@ SendTransactionScreen.prototype.render = function () {
const { gas, gasPrice } = newTx const { gas, gasPrice } = newTx
console.log({ selectedIdentity, identities }) console.log({ selectedIdentity, identities })
console.log("SendTransactionScreen state:", this.state) console.log('SendTransactionScreen state:', this.state)
return ( return (
@ -121,7 +112,7 @@ SendTransactionScreen.prototype.render = function () {
// Main Send token Card // Main Send token Card
h('div.send-screen-card', { h('div.send-screen-card', {
style: {} style: {},
}, [ }, [
h('img.send-eth-icon', { h('img.send-eth-icon', {
@ -130,7 +121,7 @@ SendTransactionScreen.prototype.render = function () {
}), }),
h('div', {}, [ h('div', {}, [
'Send' 'Send',
]), ]),
h('div', { h('div', {
@ -138,13 +129,13 @@ SendTransactionScreen.prototype.render = function () {
textAlign: 'center', textAlign: 'center',
}, },
}, [ }, [
'Send Ethereum to anyone with an Ethereum account' 'Send Ethereum to anyone with an Ethereum account',
]), ]),
h('div.send-screen-input-wrapper', {}, [ h('div.send-screen-input-wrapper', {}, [
h('div', {}, [ h('div', {}, [
'From:' 'From:',
]), ]),
h('input.large-input.send-screen-input', { h('input.large-input.send-screen-input', {
@ -152,7 +143,7 @@ SendTransactionScreen.prototype.render = function () {
placeholder: 'Account', placeholder: 'Account',
value: this.state.from, value: this.state.from,
onChange: (event) => { onChange: (event) => {
console.log("event", event.target.value) console.log('event', event.target.value)
this.setState({ this.setState({
newTx: Object.assign( newTx: Object.assign(
this.state.newTx, this.state.newTx,
@ -181,14 +172,14 @@ SendTransactionScreen.prototype.render = function () {
h('div.send-screen-input-wrapper', {}, [ h('div.send-screen-input-wrapper', {}, [
h('div', {}, [ h('div', {}, [
'To:' 'To:',
]), ]),
h(EnsInput, { h(EnsInput, {
name: 'address', name: 'address',
placeholder: 'Recipient Address', placeholder: 'Recipient Address',
onChange: () => { onChange: () => {
console.log("event", event.target.value) console.log('event', event.target.value)
this.setState({ this.setState({
newTx: Object.assign( newTx: Object.assign(
this.state.newTx, this.state.newTx,
@ -211,8 +202,8 @@ SendTransactionScreen.prototype.render = function () {
h('span', {}, ['Amount']), h('span', {}, ['Amount']),
h(CurrencyToggle, { h(CurrencyToggle, {
currentCurrency, currentCurrency,
onClick: (newCurrency) => this.setCurrentCurrency(newCurrency) onClick: (newCurrency) => this.setCurrentCurrency(newCurrency),
}), //holding on icon from design }), // holding on icon from design
]), ]),
h('input.large-input.send-screen-input', { h('input.large-input.send-screen-input', {
@ -227,7 +218,7 @@ SendTransactionScreen.prototype.render = function () {
} }
), ),
}) })
} },
}, []), }, []),
]), ]),
@ -277,10 +268,10 @@ SendTransactionScreen.prototype.render = function () {
h('div.send-screen-gas-input-customize', { h('div.send-screen-gas-input-customize', {
onClick: this.toggleTooltip, onClick: this.toggleTooltip,
}, [ }, [
'Customize' 'Customize',
]), ]),
]), ]),
]), ]),
h('div.send-screen-input-wrapper', {}, [ h('div.send-screen-input-wrapper', {}, [
@ -333,7 +324,7 @@ SendTransactionScreen.prototype.render = function () {
style: { style: {
marginTop: '8px', marginTop: '8px',
width: '8em', width: '8em',
background: '#FFFFFF' background: '#FFFFFF',
}, },
}, 'Next'), }, 'Next'),
@ -358,14 +349,9 @@ SendTransactionScreen.prototype.renderSendToken = function () {
const props = this.props const props = this.props
const { const {
address,
account,
identity,
network, network,
identities, identities,
addressBook, addressBook,
conversionRate,
currentCurrency,
} = props } = props
return ( return (
@ -383,13 +369,13 @@ SendTransactionScreen.prototype.renderSendToken = function () {
marginRight: '3.5%', marginRight: '3.5%',
background: '#FFFFFF', // $background-white background: '#FFFFFF', // $background-white
boxShadow: '0 2px 4px 0 rgba(0,0,0,0.08)', boxShadow: '0 2px 4px 0 rgba(0,0,0,0.08)',
} },
}, [ }, [
h('section.flex-center.flex-row', { h('section.flex-center.flex-row', {
style: { style: {
zIndex: 15, // $token-icon-z-index zIndex: 15, // $token-icon-z-index
marginTop: '-35px', marginTop: '-35px',
} },
}, [ }, [
h(Identicon, { h(Identicon, {
address: ARAGON, address: ARAGON,
@ -471,8 +457,8 @@ SendTransactionScreen.prototype.renderSendToken = function () {
fontSize: '12px', fontSize: '12px',
width: '100%', width: '100%',
justifyContent: 'space-between', justifyContent: 'space-between',
} },
},[ }, [
h('span', { style: {} }, ['Amount']), h('span', { style: {} }, ['Amount']),
h('span', { style: {} }, ['Token <> USD']), h('span', { style: {} }, ['Token <> USD']),
]), ]),
@ -498,8 +484,8 @@ SendTransactionScreen.prototype.renderSendToken = function () {
fontSize: '12px', fontSize: '12px',
width: '100%', width: '100%',
justifyContent: 'space-between', justifyContent: 'space-between',
} },
},[ }, [
h('span', { style: {} }, ['Gas Fee:']), h('span', { style: {} }, ['Gas Fee:']),
h('span', { style: { fontSize: '8px' } }, ['What\'s this?']), h('span', { style: { fontSize: '8px' } }, ['What\'s this?']),
]), ]),
@ -529,8 +515,8 @@ SendTransactionScreen.prototype.renderSendToken = function () {
fontSize: '12px', fontSize: '12px',
width: '100%', width: '100%',
justifyContent: 'flex-start', justifyContent: 'flex-start',
} },
},[ }, [
h('span', { style: {} }, ['Transaction Memo (optional)']), h('span', { style: {} }, ['Transaction Memo (optional)']),
]), ]),
@ -553,7 +539,7 @@ SendTransactionScreen.prototype.renderSendToken = function () {
style: { style: {
marginTop: '8px', marginTop: '8px',
width: '8em', width: '8em',
background: '#FFFFFF' background: '#FFFFFF',
}, },
}, 'Next'), }, 'Next'),
@ -615,11 +601,10 @@ SendTransactionScreen.prototype.onSubmit = function () {
// https://consensys.slack.com/archives/G1L7H42BT/p1503439134000169?thread_ts=1503438076.000411&cid=G1L7H42BT // https://consensys.slack.com/archives/G1L7H42BT/p1503439134000169?thread_ts=1503438076.000411&cid=G1L7H42BT
// From @kumavis: "not needed for MVP but we will end up adding it again so consider just adding it now" // From @kumavis: "not needed for MVP but we will end up adding it again so consider just adding it now"
const txData = false; const txData = false
// Must replace with memo data. // Must replace with memo data.
// const txData = document.querySelector('input[name="txData"]').value // const txData = document.querySelector('input[name="txData"]').value
const balance = this.props.balance
let message let message
// if (value.gt(balance)) { // if (value.gt(balance)) {
@ -659,7 +644,7 @@ SendTransactionScreen.prototype.onSubmit = function () {
// } // }
// Hardcoded // Hardcoded
var txParams = { var txParams = {
from: '0x82df11beb942beeed58d466fcb0f0791365c7684', from: '0x82df11beb942beeed58d466fcb0f0791365c7684',
to: '0xa43126b621db5b4fd98f959d9e5499f655913d34', to: '0xa43126b621db5b4fd98f959d9e5499f655913d34',
value: '0x0', value: '0x0',

View File

@ -2,6 +2,10 @@ const ethUtil = require('ethereumjs-util')
const hexToBn = require('../../app/scripts/lib/hex-to-bn') const hexToBn = require('../../app/scripts/lib/hex-to-bn')
const vreme = new (require('vreme'))() const vreme = new (require('vreme'))()
const MIN_GAS_PRICE_GWEI_BN = new ethUtil.BN(1)
const GWEI_FACTOR = new ethUtil.BN(1e9)
const MIN_GAS_PRICE_BN = MIN_GAS_PRICE_GWEI_BN.mul(GWEI_FACTOR)
// formatData :: ( date: <Unix Timestamp> ) -> String // formatData :: ( date: <Unix Timestamp> ) -> String
function formatDate (date) { function formatDate (date) {
return vreme.format(new Date(date), 'March 16 2014 14:30') return vreme.format(new Date(date), 'March 16 2014 14:30')
@ -233,14 +237,9 @@ function bnMultiplyByFraction (targetBN, numerator, denominator) {
} }
function getTxFeeBn (gas, gasPrice = MIN_GAS_PRICE_BN.toString(16), blockGasLimit) { function getTxFeeBn (gas, gasPrice = MIN_GAS_PRICE_BN.toString(16), blockGasLimit) {
// Gas Limit
const gasBn = hexToBn(gas) const gasBn = hexToBn(gas)
const gasLimit = new ethUtil.BN(parseInt(blockGasLimit))
const safeGasLimit = bnMultiplyByFraction(gasLimit, 19, 20).toString(10)
// Gas Price
const gasPriceBn = hexToBn(gasPrice) const gasPriceBn = hexToBn(gasPrice)
const txFeeBn = gasBn.mul(gasPriceBn) const txFeeBn = gasBn.mul(gasPriceBn)
return txFeeBn.toString(16); return txFeeBn.toString(16)
} }

View File

@ -1,5 +1,5 @@
// Checks if viewport at invoke time fits mobile dimensions // Checks if viewport at invoke time fits mobile dimensions
// isMobileView :: () => Bool // isMobileView :: () => Bool
const isMobileView = () => window.matchMedia("screen and (max-width: 575px)").matches const isMobileView = () => window.matchMedia('screen and (max-width: 575px)').matches
module.exports = isMobileView module.exports = isMobileView