diff options
author | Dan <danjm.com@gmail.com> | 2017-08-29 22:50:48 +0800 |
---|---|---|
committer | Chi Kei Chan <chikeichan@gmail.com> | 2017-08-31 19:16:07 +0800 |
commit | e7b3ef0708290a81dad5c469adaa6fab3f1c45b5 (patch) | |
tree | 29f471ff840cf3eb97af77de45eb136a703e7aa6 /ui | |
parent | 3ea841e27621a8e9972677e46dbd8e3f0c002632 (diff) | |
download | tangerine-wallet-browser-e7b3ef0708290a81dad5c469adaa6fab3f1c45b5.tar tangerine-wallet-browser-e7b3ef0708290a81dad5c469adaa6fab3f1c45b5.tar.gz tangerine-wallet-browser-e7b3ef0708290a81dad5c469adaa6fab3f1c45b5.tar.bz2 tangerine-wallet-browser-e7b3ef0708290a81dad5c469adaa6fab3f1c45b5.tar.lz tangerine-wallet-browser-e7b3ef0708290a81dad5c469adaa6fab3f1c45b5.tar.xz tangerine-wallet-browser-e7b3ef0708290a81dad5c469adaa6fab3f1c45b5.tar.zst tangerine-wallet-browser-e7b3ef0708290a81dad5c469adaa6fab3f1c45b5.zip |
Lint fixes
Diffstat (limited to 'ui')
34 files changed, 212 insertions, 265 deletions
diff --git a/ui/app/account-and-transaction-details.js b/ui/app/account-and-transaction-details.js index 03f2d9db5..60293de77 100644 --- a/ui/app/account-and-transaction-details.js +++ b/ui/app/account-and-transaction-details.js @@ -30,7 +30,7 @@ AccountAndTransactionDetails.prototype.render = function () { // transaction h(TxView, { style: { - } + }, }, [ ]), ]) diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index 2be5d5c3a..d5b9419a7 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -5,15 +5,10 @@ const h = require('react-hyperscript') const connect = require('react-redux').connect const actions = require('./actions') const valuesFor = require('./util').valuesFor -const Identicon = require('./components/identicon') -const EthBalance = require('./components/eth-balance') const TransactionList = require('./components/transaction-list') const ExportAccountView = require('./components/account-export') -const ethUtil = require('ethereumjs-util') -const EditableLabel = require('./components/editable-label') const TabBar = require('./components/tab-bar') const TokenList = require('./components/token-list') -const AccountDropdowns = require('./components/account-dropdowns').AccountDropdowns module.exports = connect(mapStateToProps)(AccountDetailScreen) diff --git a/ui/app/app.js b/ui/app/app.js index 064595ba3..87477d773 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -6,8 +6,6 @@ const actions = require('./actions') // init const InitializeMenuScreen = require('./first-time/init-menu') const NewKeyChainScreen = require('./new-keychain') -// unlock -const UnlockScreen = require('./unlock') // accounts const MainContainer = require('./main-container') const SendTransactionScreen = require('./send') @@ -25,7 +23,6 @@ const AddTokenScreen = require('./add-token') const Import = require('./accounts/import') const InfoScreen = require('./info') const Loading = require('./components/loading') -const SandwichExpando = require('sandwich-expando') const NetworkIndicator = require('./components/network') const BuyView = require('./components/buy-button-subview') const QrView = require('./components/qr-code') @@ -82,15 +79,15 @@ function mapStateToProps (state) { function mapDispatchToProps (dispatch, ownProps) { return { - hideSidebar: () => {dispatch(actions.hideSidebar())}, - showNetworkDropdown: () => {dispatch(actions.showNetworkDropdown())}, - hideNetworkDropdown: () => {dispatch(actions.hideNetworkDropdown())}, + hideSidebar: () => { dispatch(actions.hideSidebar()) }, + showNetworkDropdown: () => { dispatch(actions.showNetworkDropdown()) }, + hideNetworkDropdown: () => { dispatch(actions.hideNetworkDropdown()) }, } } App.prototype.render = function () { 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 loadMessage = loadingMessage || isLoadingNetwork ? `Connecting to ${this.getNetworkName()}` : null @@ -132,15 +129,15 @@ App.prototype.render = function () { ) } -App.prototype.renderGlobalModal = function() { +App.prototype.renderGlobalModal = function () { return h(Modal, { - ref: "modalRef", + ref: 'modalRef', }, [ - h(BuyOptions, {}, []), + // h(BuyOptions, {}, []), ]) } -App.prototype.renderSidebar = function() { +App.prototype.renderSidebar = function () { return h('div', { }, [ @@ -192,14 +189,10 @@ App.prototype.renderAppBar = function () { return null } - const props = this.props - const state = this.state || {} - const isNetworkMenuOpen = state.isNetworkMenuOpen || false - return ( h('.full-width', { - style: {} + style: {}, }, [ h('.app-header.flex-row.flex-space-between', { diff --git a/ui/app/components/dropdowns/account-options-dropdown.js b/ui/app/components/dropdowns/account-options-dropdown.js index 7d7188ec4..50e793d87 100644 --- a/ui/app/components/dropdowns/account-options-dropdown.js +++ b/ui/app/components/dropdowns/account-options-dropdown.js @@ -12,6 +12,7 @@ module.exports = AccountOptionsDropdown // TODO: specify default props and proptypes // 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 () { const { selected, network, identities, style, dropdownWrapperStyle, menuItemStyles } = this.props @@ -21,8 +22,8 @@ AccountOptionsDropdown.prototype.render = function () { selected: selectedAddress, network, identities, - style: !!style ? style : {}, - dropdownWrapperStyle: !!dropdownWrapperStyle ? dropdownWrapperStyle : {}, - menuItemStyles: !!menuItemStyles ? menuItemStyles : {}, + style: style || {}, + dropdownWrapperStyle: dropdownWrapperStyle || {}, + menuItemStyles: menuItemStyles || {}, }, []) } diff --git a/ui/app/components/dropdowns/account-selection-dropdown.js b/ui/app/components/dropdowns/account-selection-dropdown.js index ccb73bde7..7a8502d18 100644 --- a/ui/app/components/dropdowns/account-selection-dropdown.js +++ b/ui/app/components/dropdowns/account-selection-dropdown.js @@ -12,6 +12,7 @@ module.exports = AccountSelectionDropdown // TODO: specify default props and proptypes // 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 () { const { selected, network, identities, style, dropdownWrapperStyle, menuItemStyles } = this.props @@ -21,8 +22,8 @@ AccountSelectionDropdown.prototype.render = function () { selected: selectedAddress, network, identities, - style: !!style ? style : {}, - dropdownWrapperStyle: !!dropdownWrapperStyle ? dropdownWrapperStyle : {}, - menuItemStyles: !!menuItemStyles ? menuItemStyles : {}, + style: style || {}, + dropdownWrapperStyle: dropdownWrapperStyle || {}, + menuItemStyles: menuItemStyles || {}, }, []) } diff --git a/ui/app/components/dropdowns/components/account-dropdowns.js b/ui/app/components/dropdowns/components/account-dropdowns.js index c340fdaed..1e869251a 100644 --- a/ui/app/components/dropdowns/components/account-dropdowns.js +++ b/ui/app/components/dropdowns/components/account-dropdowns.js @@ -25,7 +25,7 @@ class AccountDropdowns extends Component { } 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) => { const identity = identities[key] @@ -57,13 +57,13 @@ class AccountDropdowns extends Component { flex: '1 1 0', minWidth: '20px', minHeight: '30px', - } + }, }, [ h('span', { style: { flex: '1 1 auto', fontSize: '14px', - } + }, }, isSelected ? h('i.fa.fa-check') : null), ]), @@ -86,7 +86,7 @@ class AccountDropdowns extends Component { alignItems: 'flex-start', justifyContent: 'center', marginLeft: '10px', - } + }, }, [ h('span.account-dropdown-name', { style: { @@ -102,7 +102,7 @@ class AccountDropdowns extends Component { style: { fontSize: '14px', }, - }, formattedBalance) + }, formattedBalance), ]), h('span', { @@ -119,17 +119,17 @@ class AccountDropdowns extends Component { }, }, [ 'Edit', - ]) + ]), ]), - ]) + ]), ] ) }) } renderAccountSelector () { - const { actions, dropdownWrapperStyle, useCssTransition, innerStyle } = this.props + const { actions, useCssTransition, innerStyle } = this.props const { accountSelectorActive, menuItemStyles } = this.state return h( @@ -323,7 +323,7 @@ class AccountDropdowns extends Component { } render () { - const { style, enableAccountsSelector, enableAccountOptions, dropdownWrapperStyle } = this.props + const { style, enableAccountsSelector, enableAccountOptions } = this.props const { optionsMenuActive, accountSelectorActive } = this.state return h( diff --git a/ui/app/components/dropdowns/index.js b/ui/app/components/dropdowns/index.js index d21c795f5..fa66f5000 100644 --- a/ui/app/components/dropdowns/index.js +++ b/ui/app/components/dropdowns/index.js @@ -1,7 +1,6 @@ // Reusable Dropdown Components -//TODO: Refactor into separate components +// TODO: Refactor into separate components const Dropdown = require('./components/dropdown').Dropdown -const DropdownMenuItem = require('./components/dropdown').DropdownMenuItem const AccountDropdowns = require('./components/account-dropdowns') // App-Specific Instances @@ -15,4 +14,4 @@ module.exports = { NetworkDropdown, Dropdown, AccountDropdowns, -}
\ No newline at end of file +} diff --git a/ui/app/components/dropdowns/network-dropdown.js b/ui/app/components/dropdowns/network-dropdown.js index 6228513c9..0c002b2f0 100644 --- a/ui/app/components/dropdowns/network-dropdown.js +++ b/ui/app/components/dropdowns/network-dropdown.js @@ -23,6 +23,7 @@ function mapDispatchToProps (dispatch) { dispatch(actions.setProviderType(type)) }, setDefaultRpcTarget: () => { + // TODO: type is not defined. Is it needed? dispatch(actions.setDefaultRpcTarget(type)) }, setRpcTarget: (target) => { @@ -31,8 +32,8 @@ function mapDispatchToProps (dispatch) { showConfigPage: () => { dispatch(actions.showConfigPage()) }, - showNetworkDropdown: () => {dispatch(actions.showNetworkDropdown())}, - hideNetworkDropdown: () => {dispatch(actions.hideNetworkDropdown())}, + showNetworkDropdown: () => { dispatch(actions.showNetworkDropdown()) }, + hideNetworkDropdown: () => { dispatch(actions.hideNetworkDropdown()) }, } } @@ -49,7 +50,6 @@ NetworkDropdown.prototype.render = function () { const props = this.props const { provider: { type: providerType, rpcTarget: activeNetwork } } = props const rpcList = props.frequentRpcList - const state = this.state || {} const isOpen = this.props.networkDropdownOpen return h(Dropdown, { @@ -135,7 +135,7 @@ NetworkDropdown.prototype.render = function () { { key: 'rinkeby', closeMenu: () => this.props.hideNetworkDropdown(), - onClick: () => propssetProviderType('rinkeby'), + onClick: () => props.setProviderType('rinkeby'), style: { fontSize: '18px', }, diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js index 84b719315..1be8c9731 100644 --- a/ui/app/components/eth-balance.js +++ b/ui/app/components/eth-balance.js @@ -3,7 +3,7 @@ const h = require('react-hyperscript') const { inherits } = require('util') const { formatBalance, - generateBalanceObject + generateBalanceObject, } = require('../util') const Tooltip = require('./tooltip.js') const FiatValue = require('./fiat-value.js') @@ -58,7 +58,7 @@ EthBalanceComponent.prototype.renderBalance = function (value) { const containerProps = hideTooltip ? {} : { position: 'bottom', title: `${ethNumber} ${ethSuffix}`, - }; + } return ( h(hideTooltip ? 'div' : Tooltip, diff --git a/ui/app/components/input-number.js b/ui/app/components/input-number.js index c8bdd5ec5..e3bbaf380 100644 --- a/ui/app/components/input-number.js +++ b/ui/app/components/input-number.js @@ -1,7 +1,6 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits -const findDOMNode = require('react-dom').findDOMNode module.exports = InputNumber @@ -13,13 +12,13 @@ function InputNumber () { value: 0, } - this.setValue = this.setValue.bind(this); + this.setValue = this.setValue.bind(this) } InputNumber.prototype.componentWillMount = function () { const { initValue = 0 } = this.props - - this.setState({ value: initValue }); + + this.setState({ value: initValue }) } InputNumber.prototype.setValue = function (newValue) { @@ -34,23 +33,23 @@ InputNumber.prototype.setValue = function (newValue) { } InputNumber.prototype.render = function () { - const { unitLabel, step = 1, min, placeholder } = this.props + const { unitLabel, step = 1, placeholder } = this.props const { value } = this.state - + return h('div.customize-gas-input-wrapper', {}, [ h('input.customize-gas-input', { placeholder, type: 'number', 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('div.gas-tooltip-input-arrows', {}, [ h('i.fa.fa-angle-up', { - onClick: () => this.setValue(value + step) + onClick: () => this.setValue(value + step), }), h('i.fa.fa-angle-down', { - onClick: () => this.setValue(value - step) + onClick: () => this.setValue(value - step), }), ]), ]) diff --git a/ui/app/components/menu-droppo.js b/ui/app/components/menu-droppo.js index 66ab18954..2f173544e 100644 --- a/ui/app/components/menu-droppo.js +++ b/ui/app/components/menu-droppo.js @@ -19,7 +19,7 @@ MenuDroppoComponent.prototype.render = function () { this.manageListeners() - let style = this.props.style || {} + const style = this.props.style || {} if (!('position' in style)) { style.position = 'fixed' } diff --git a/ui/app/components/modals/account-details-modal.js b/ui/app/components/modals/account-details-modal.js index 3ed702192..fb0e70397 100644 --- a/ui/app/components/modals/account-details-modal.js +++ b/ui/app/components/modals/account-details-modal.js @@ -37,7 +37,7 @@ module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountDetailsModa // fonts of qr-header and close button AccountDetailsModal.prototype.render = function () { - const { selectedIdentity, selectedAddress, network } = this.props + const { selectedIdentity, network } = this.props return h('div', {}, [ h('div.account-details-modal-wrapper', { @@ -63,12 +63,12 @@ AccountDetailsModal.prototype.render = function () { Qr: { message: this.props.selectedIdentity.name, data: this.props.selectedIdentity.address, - } + }, }, []), // divider h('div.account-details-modal-divider', { - style: {} + style: {}, }, []), h('button.btn-clear', { @@ -85,6 +85,6 @@ AccountDetailsModal.prototype.render = function () { 'Export private key', ]), - ]) + ]), ]) } diff --git a/ui/app/components/modals/buy-options-modal.js b/ui/app/components/modals/buy-options-modal.js index 6e0831768..79bbc798b 100644 --- a/ui/app/components/modals/buy-options-modal.js +++ b/ui/app/components/modals/buy-options-modal.js @@ -18,7 +18,7 @@ function mapDispatchToProps (dispatch) { }, hideModal: () => { dispatch(actions.hideModal()) - } + }, } } @@ -71,7 +71,7 @@ BuyOptions.prototype.render = function () { background: 'white', }, 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')), + ]), ]) } diff --git a/ui/app/components/modals/edit-account-name-modal.js b/ui/app/components/modals/edit-account-name-modal.js index ae5ca23d4..5c25ac245 100644 --- a/ui/app/components/modals/edit-account-name-modal.js +++ b/ui/app/components/modals/edit-account-name-modal.js @@ -71,6 +71,6 @@ EditAccountNameModal.prototype.render = function () { 'SAVE', ]), - ]) + ]), ]) } diff --git a/ui/app/components/modals/index.js b/ui/app/components/modals/index.js index e2e367af0..1db1d33d4 100644 --- a/ui/app/components/modals/index.js +++ b/ui/app/components/modals/index.js @@ -2,4 +2,4 @@ const Modal = require('./modal') module.exports = { Modal, -}
\ No newline at end of file +} diff --git a/ui/app/components/modals/modal.js b/ui/app/components/modals/modal.js index fdff4c99e..d266fe790 100644 --- a/ui/app/components/modals/modal.js +++ b/ui/app/components/modals/modal.js @@ -80,7 +80,7 @@ const MODALS = { contents: [], mobileModalStyle: {}, laptopModalStyle: {}, - } + }, } const BACKDROPSTYLE = { @@ -120,7 +120,7 @@ Modal.prototype.render = function () { { className: 'modal', keyboard: false, - onHide: () => {this.onHide()}, + onHide: () => { this.onHide() }, ref: (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) { this.show() } 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) { this.props.onHideCallback() } this.props.hideModal() } -Modal.prototype.hide = function() { +Modal.prototype.hide = function () { this.modalRef.hide() } -Modal.prototype.show = function() { +Modal.prototype.show = function () { this.modalRef.show() } diff --git a/ui/app/components/modals/new-account-modal.js b/ui/app/components/modals/new-account-modal.js index c44b79a2e..3caa515cd 100644 --- a/ui/app/components/modals/new-account-modal.js +++ b/ui/app/components/modals/new-account-modal.js @@ -38,14 +38,14 @@ NewAccountModal.prototype.render = function () { ]), h('div.modal-close-x', {}), - + h('div.new-account-modal-content', {}, [ 'Account Name', ]), h('div.new-account-input-wrapper', {}, [ 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', ]), ]), - ]) + ]), ]) } diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index 1c47440f2..5e5110d6c 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -8,17 +8,10 @@ const ethUtil = require('ethereumjs-util') const BN = ethUtil.BN const hexToBn = require('../../../app/scripts/lib/hex-to-bn') 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 GWEI_FACTOR = new BN(1e9) const MIN_GAS_PRICE_BN = MIN_GAS_PRICE_GWEI_BN.mul(GWEI_FACTOR) -const MIN_GAS_LIMIT_BN = new BN(21000) // Faked, for Icon @@ -34,8 +27,8 @@ const ARAGON = '960b236A07cf122663c4303350609A66A7B288C0' // actionButtons const sectionDivider = h('div', { style: { - height:'1px', - background:'#E7E7E7', + height: '1px', + background: '#E7E7E7', }, }) @@ -43,8 +36,8 @@ const contentDivider = h('div', { style: { marginLeft: '16px', marginRight: '16px', - height:'1px', - background:'#E7E7E7', + height: '1px', + background: '#E7E7E7', }, }) @@ -61,15 +54,13 @@ function PendingTx () { PendingTx.prototype.render = function () { const props = this.props - const { currentCurrency, blockGasLimit } = props + const { blockGasLimit } = props - const conversionRate = props.conversionRate const txMeta = this.gatherTxMeta() const txParams = txMeta.txParams || {} // Account Details const address = txParams.from || props.selectedAddress - const identity = props.identities[address] || { address: address } const account = props.accounts[address] const balance = account ? account.balance : '0x0' @@ -79,8 +70,6 @@ PendingTx.prototype.render = function () { // Gas const gas = txParams.gas const gasBn = hexToBn(gas) - const gasLimit = new BN(parseInt(blockGasLimit)) - const safeGasLimit = this.bnMultiplyByFraction(gasLimit, 19, 20).toString(10) // Gas Price const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16) @@ -90,8 +79,6 @@ PendingTx.prototype.render = function () { const valueBn = hexToBn(txParams.value) const maxCost = txFeeBn.add(valueBn) - const dataLength = txParams.data ? (txParams.data.length - 2) / 2 : 0 - const balanceBn = hexToBn(balance) const insufficientBalance = balanceBn.lt(maxCost) @@ -112,13 +99,13 @@ PendingTx.prototype.render = function () { marginRight: '3.5%', background: '#FFFFFF', // $background-white boxShadow: '0 2px 4px 0 rgba(0,0,0,0.08)', - } + }, }, [ h('section.flex-center.flex-row', { style: { zIndex: 15, // $token-icon-z-index marginTop: '-35px', - } + }, }, [ h(Identicon, { address: ARAGON, @@ -178,23 +165,23 @@ PendingTx.prototype.render = function () { h('div', { style: { width: '50%', - } + }, }, [ h('span', { style: { textAlign: 'left', fontSize: '12px', - } + }, }, [ - 'From' - ]) + 'From', + ]), ]), h('div', { style: { width: '50%', - } - },[ + }, + }, [ h('div', { style: { textAlign: 'left', @@ -208,8 +195,8 @@ PendingTx.prototype.render = function () { textAlign: 'left', fontSize: '8px', }, - }, 'Your Balance 2.34 ANT') - ]) + }, 'Your Balance 2.34 ANT'), + ]), ]), contentDivider, @@ -219,23 +206,23 @@ PendingTx.prototype.render = function () { h('div', { style: { width: '50%', - } + }, }, [ h('span', { style: { textAlign: 'left', fontSize: '12px', - } + }, }, [ - 'To' - ]) + 'To', + ]), ]), h('div', { style: { width: '50%', - } - },[ + }, + }, [ h('div', { style: { textAlign: 'left', @@ -249,8 +236,8 @@ PendingTx.prototype.render = function () { textAlign: 'left', fontSize: '8px', }, - }, '...5924') - ]) + }, '...5924'), + ]), ]), contentDivider, @@ -260,23 +247,23 @@ PendingTx.prototype.render = function () { h('div', { style: { width: '50%', - } + }, }, [ h('span', { style: { textAlign: 'left', fontSize: '12px', - } + }, }, [ - 'Gas Fee' - ]) + 'Gas Fee', + ]), ]), h('div', { style: { width: '50%', - } - },[ + }, + }, [ h('div', { style: { textAlign: 'left', @@ -290,8 +277,8 @@ PendingTx.prototype.render = function () { textAlign: 'left', fontSize: '8px', }, - }, '0.001575 ETH') - ]) + }, '0.001575 ETH'), + ]), ]), contentDivider, @@ -305,39 +292,39 @@ PendingTx.prototype.render = function () { paddingLeft: '6px', paddingRight: '6px', marginBottom: '10px', - } + }, }, [ h('div', { style: { width: '50%', - } + }, }, [ h('div', { style: { textAlign: 'left', fontSize: '12px', marginBottom: '-10px', - } + }, }, [ - 'Total Tokens' + 'Total Tokens', ]), h('div', { style: { textAlign: 'left', fontSize: '8px', - } + }, }, [ - 'Total Gas' - ]) + 'Total Gas', + ]), ]), h('div', { style: { width: '50%', - } - },[ + }, + }, [ h('div', { style: { textAlign: 'left', @@ -351,8 +338,8 @@ PendingTx.prototype.render = function () { textAlign: 'left', fontSize: '8px', }, - }, '0.249 ETH') - ]) + }, '0.249 ETH'), + ]), ]), ]), // end of container diff --git a/ui/app/components/qr-code.js b/ui/app/components/qr-code.js index 6559fcb7a..8d6b43b6c 100644 --- a/ui/app/components/qr-code.js +++ b/ui/app/components/qr-code.js @@ -4,7 +4,6 @@ const qrCode = require('qrcode-npm').qrcode const inherits = require('util').inherits const connect = require('react-redux').connect const isHexPrefixed = require('ethereumjs-util').isHexPrefixed -const CopyButton = require('./copyButton') module.exports = connect(mapStateToProps)(QrCodeView) diff --git a/ui/app/components/send/currency-toggle.js b/ui/app/components/send/currency-toggle.js index 37c026542..d3c2222a4 100644 --- a/ui/app/components/send/currency-toggle.js +++ b/ui/app/components/send/currency-toggle.js @@ -14,13 +14,13 @@ CurrencyToggle.prototype.render = function () { return h('span', {}, [ h('span', { className: currentCurrency === 'ETH' ? 'selected-currency' : 'unselected-currency', - onClick: () => onClick('ETH') + onClick: () => onClick('ETH'), }, ['ETH']), '<>', h('span', { className: currentCurrency === 'USD' ? 'selected-currency' : 'unselected-currency', - onClick: () => onClick('USD'), + onClick: () => onClick('USD'), }, ['USD']), - ]) //holding on icon from design + ]) // holding on icon from design } diff --git a/ui/app/components/send/gas-tooltip.js b/ui/app/components/send/gas-tooltip.js index 472a8e287..bef419e48 100644 --- a/ui/app/components/send/gas-tooltip.js +++ b/ui/app/components/send/gas-tooltip.js @@ -2,7 +2,6 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits const InputNumber = require('../input-number.js') -const findDOMNode = require('react-dom').findDOMNode module.exports = GasTooltip @@ -14,14 +13,14 @@ function GasTooltip () { gasPrice: 0, } - this.updateGasPrice = this.updateGasPrice.bind(this); - this.updateGasLimit = this.updateGasLimit.bind(this); - this.onClose = this.onClose.bind(this); + this.updateGasPrice = this.updateGasPrice.bind(this) + this.updateGasLimit = this.updateGasLimit.bind(this) + this.onClose = this.onClose.bind(this) } GasTooltip.prototype.componentWillMount = function () { const { gasPrice = 0, gasLimit = 0} = this.props - + this.setState({ gasPrice: parseInt(gasPrice, 16) / 1000000000, gasLimit: parseInt(gasLimit, 16), @@ -35,7 +34,7 @@ GasTooltip.prototype.updateGasPrice = function (newPrice) { this.setState({ gasPrice: newPrice }) onFeeChange({ 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 }) onFeeChange({ gasLimit: newLimit.toString(16), - gasPrice: (gasPrice * 1000000000).toString(16) + gasPrice: (gasPrice * 1000000000).toString(16), }) } GasTooltip.prototype.onClose = function (e) { - e.stopPropagation(); - this.props.onClose(); + e.stopPropagation() + this.props.onClose() } GasTooltip.prototype.render = function () { - const { position, title, children, className } = this.props const { gasPrice, gasLimit } = this.state return h('div.gas-tooltip', {}, [ h('div.gas-tooltip-close-area', { - onClick: this.onClose + onClick: this.onClose, }), h('div.customize-gas-tooltip-container', {}, [ h('div.customize-gas-tooltip', {}, [ h('div.gas-tooltip-header.gas-tooltip-label', {}, ['Customize Gas']), h('div.gas-tooltip-input-label', {}, [ h('span.gas-tooltip-label', {}, ['Gas Price']), - h('i.fa.fa-info-circle') + h('i.fa.fa-info-circle'), ]), h(InputNumber, { unitLabel: 'GWEI', @@ -76,7 +74,7 @@ GasTooltip.prototype.render = function () { min: 0, placeholder: '0', initValue: gasPrice, - onChange: (newPrice) => this.updateGasPrice(newPrice), + onChange: (newPrice) => this.updateGasPrice(newPrice), }), h('div.gas-tooltip-input-label', { style: { @@ -84,7 +82,7 @@ GasTooltip.prototype.render = function () { }, }, [ h('span.gas-tooltip-label', {}, ['Gas Limit']), - h('i.fa.fa-info-circle') + h('i.fa.fa-info-circle'), ]), h(InputNumber, { unitLabel: 'UNITS', @@ -92,11 +90,11 @@ GasTooltip.prototype.render = function () { min: 0, placeholder: '0', initValue: gasLimit, - onChange: (newLimit) => this.updateGasLimit(newLimit), + onChange: (newLimit) => this.updateGasLimit(newLimit), }), ]), h('div.gas-tooltip-arrow', {}), - ]) + ]), ]) } diff --git a/ui/app/components/shapeshift-form.js b/ui/app/components/shapeshift-form.js index 901a4a956..96a86d3b1 100644 --- a/ui/app/components/shapeshift-form.js +++ b/ui/app/components/shapeshift-form.js @@ -131,8 +131,8 @@ ShapeshiftForm.prototype.renderMain = function () { }, }, [ this.props.warning - ? this.props.warning - && h('span.error.flex-center', { + ? this.props.warning && + h('span.error.flex-center', { style: { textAlign: 'center', width: '229px', diff --git a/ui/app/components/tooltip.js b/ui/app/components/tooltip.js index 74cf1ae43..edbc074bb 100644 --- a/ui/app/components/tooltip.js +++ b/ui/app/components/tooltip.js @@ -12,7 +12,7 @@ function Tooltip () { Tooltip.prototype.render = function () { const props = this.props - const { position, title, children, show = true } = props + const { position, title, children } = props return h(ReactTooltip, { position: position || 'left', diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js index 9018bab06..eca2a7100 100644 --- a/ui/app/components/transaction-list-item.js +++ b/ui/app/components/transaction-list-item.js @@ -156,7 +156,7 @@ function failIfFailed (transaction) { } if (transaction.err || transaction.warning) { const { err, warning = {} } = transaction - const errFirst = !!(( err && warning ) || err) + const errFirst = !!((err && warning) || err) const message = errFirst ? err.message : warning.message errFirst ? err.message : warning.message diff --git a/ui/app/components/tx-list.js b/ui/app/components/tx-list.js index fb8d5c69b..92a9b6f46 100644 --- a/ui/app/components/tx-list.js +++ b/ui/app/components/tx-list.js @@ -6,8 +6,6 @@ const selectors = require('../selectors') const Identicon = require('./identicon') const { formatBalance, formatDate } = require('../util') -const valuesFor = require('../util').valuesFor - module.exports = connect(mapStateToProps)(TxList) function mapStateToProps (state) { @@ -28,7 +26,7 @@ const contentDivider = h('div.tx-list-content-divider', { TxList.prototype.render = function () { - const { txsToRender, conversionRate } = this.props + const { txsToRender } = this.props console.log('transactions to render', txsToRender) @@ -42,7 +40,7 @@ TxList.prototype.render = function () { }, [ h('div', { - style: {} + style: {}, }, 'TRANSACTIONS'), ]), @@ -69,41 +67,41 @@ TxList.prototype.renderTransactionListItem = function (transaction) { const { address, transactionStatus, transactionAmount, dateString } = props return h('div.flex-column.tx-list-item-wrapper', { - style: {} + style: {}, }, [ h('div.tx-list-date-wrapper', { - style: {} + style: {}, }, [ h('span.tx-list-date', {}, [ dateString, - ]) + ]), ]), h('div.flex-row.tx-list-content-wrapper', { - style: {} + style: {}, }, [ h('div.tx-list-identicon-wrapper', { - style: {} + style: {}, }, [ h(Identicon, { address, diameter: 24, - }) + }), ]), h('div.tx-list-account-and-status-wrapper', {}, [ h('div.tx-list-account-wrapper', { - style: {} + style: {}, }, [ 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', { - style: {} + style: {}, }, [ h('span.tx-list-status', {}, [ transactionStatus, @@ -112,7 +110,7 @@ TxList.prototype.renderTransactionListItem = function (transaction) { ]), h('div.flex-column.tx-list-details-wrapper', { - style: {} + style: {}, }, [ h('span.tx-list-value', {}, [ @@ -124,7 +122,7 @@ TxList.prototype.renderTransactionListItem = function (transaction) { ]), ]), - ]) + ]), ]) } diff --git a/ui/app/components/tx-view.js b/ui/app/components/tx-view.js index 5ed103421..9f75f7b31 100644 --- a/ui/app/components/tx-view.js +++ b/ui/app/components/tx-view.js @@ -5,7 +5,6 @@ const ethUtil = require('ethereumjs-util') const inherits = require('util').inherits const actions = require('../actions') -const WalletView = require('./wallet-view') const BalanceComponent = require('./balance-component') const TxList = require('./tx-list') const Identicon = require('./identicon') diff --git a/ui/app/components/wallet-content-display.js b/ui/app/components/wallet-content-display.js index 9c5db82d2..bfa061be4 100644 --- a/ui/app/components/wallet-content-display.js +++ b/ui/app/components/wallet-content-display.js @@ -18,7 +18,7 @@ WalletContentDisplay.prototype.render = function () { marginLeft: '1.3em', alignItems: 'flex-start', ...style, - } + }, }, [ h('span', { @@ -47,9 +47,9 @@ WalletContentDisplay.prototype.render = function () { height: '6em', width: '0.3em', background: '#D8D8D8', // $alto - } + }, }, [ - ]) + ]), ]) } diff --git a/ui/app/components/wallet-view.js b/ui/app/components/wallet-view.js index 59859a8e0..6f9269389 100644 --- a/ui/app/components/wallet-view.js +++ b/ui/app/components/wallet-view.js @@ -4,7 +4,6 @@ const h = require('react-hyperscript') const inherits = require('util').inherits const Identicon = require('./identicon') const AccountDropdowns = require('./dropdowns/index.js').AccountDropdowns -const Content = require('./wallet-content-display') const actions = require('../actions') const BalanceComponent = require('./balance-component') const selectors = require('../selectors') @@ -26,8 +25,8 @@ function mapStateToProps (state) { function mapDispatchToProps (dispatch) { return { - showSendPage: () => {dispatch(actions.showSendPage())}, - hideSidebar: () => {dispatch(actions.hideSidebar())}, + showSendPage: () => { dispatch(actions.showSendPage()) }, + hideSidebar: () => { dispatch(actions.hideSidebar()) }, } } @@ -36,12 +35,10 @@ function WalletView () { Component.call(this) } -const noop = () => {} - 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 - console.log("walletview, selectedAccount:", selectedAccount) + console.log('walletview, selectedAccount:', selectedAccount) return h('div.wallet-view.flex-column' + (responsiveDisplayClassname || ''), { style: {}, @@ -49,7 +46,7 @@ WalletView.prototype.render = function () { // TODO: Separate component: wallet account details h('div.flex-column.wallet-view-account-details', { - style: {} + style: {}, }, [ h('div.flex-row.account-options-menu', { @@ -68,12 +65,12 @@ WalletView.prototype.render = function () { padding: '1px 15px', marginLeft: '-25px', 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: { padding: '0px 0px', margin: '22px 0px', - } + }, }, []), ]), @@ -83,7 +80,7 @@ WalletView.prototype.render = function () { h('div', { style: { position: 'relative', - } + }, }, [ h(AccountDropdowns, { accounts, @@ -109,23 +106,23 @@ WalletView.prototype.render = function () { }), h('span.account-name', { - style: {} + style: {}, }, [ - selectedIdentity.name + selectedIdentity.name, ]), ]), ]), - //'Wallet' - Title + // 'Wallet' - Title // Not visible on mobile h('div.flex-column.wallet-view-title-wrapper', {}, [ h('span.wallet-view-title', {}, [ 'Wallet', - ]) + ]), ]), - //Wallet Balances + // Wallet Balances h('div.flex-column.wallet-balance-wrapper.wallet-balance-wrapper-active', {}, [ h('div.wallet-balance', {}, [ diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index 4a8c616e2..eaaf99b80 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -3,9 +3,7 @@ const Component = require('react').Component const h = require('react-hyperscript') const connect = require('react-redux').connect const actions = require('./actions') -const NetworkIndicator = require('./components/network') const txHelper = require('../lib/tx-helper') -const isPopupOrNotification = require('../../app/scripts/lib/is-popup-or-notification') const PendingTx = require('./components/pending-tx') const PendingMsg = require('./components/pending-msg') @@ -39,15 +37,13 @@ function ConfirmTxScreen () { ConfirmTxScreen.prototype.render = function () { const props = this.props - const { network, provider, unapprovedTxs, currentCurrency, - unapprovedMsgs, unapprovedPersonalMsgs, conversionRate, blockGasLimit } = props + const { network, unapprovedTxs, currentCurrency, unapprovedMsgs, + unapprovedPersonalMsgs, conversionRate, blockGasLimit } = props var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, network) var txData = unconfTxList[props.index] || {} var txParams = txData.params || {} - var isNotification = isPopupOrNotification() === 'notification' - log.info(`rendering a combined ${unconfTxList.length} unconf msg & txs`) if (unconfTxList.length === 0) return h(Loading, { isLoading: true }) @@ -149,14 +145,14 @@ ConfirmTxScreen.prototype.goHome = function (event) { this.props.dispatch(actions.goHome()) } -function warningIfExists (warning) { - if (warning && - // Do not display user rejections on this screen: - warning.indexOf('User denied transaction signature') === -1) { - return h('.error', { - style: { - margin: 'auto', - }, - }, warning) - } -} +// function warningIfExists (warning) { +// if (warning && +// // Do not display user rejections on this screen: +// warning.indexOf('User denied transaction signature') === -1) { +// return h('.error', { +// style: { +// margin: 'auto', +// }, +// }, warning) +// } +// } diff --git a/ui/app/main-container.js b/ui/app/main-container.js index 31583f3e5..eaaff8517 100644 --- a/ui/app/main-container.js +++ b/ui/app/main-container.js @@ -1,8 +1,6 @@ const Component = require('react').Component const h = require('react-hyperscript') 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 HDRestoreVaultScreen = require('./keychains/hd/restore-vault') const ConfigScreen = require('./config') @@ -24,7 +22,7 @@ MainContainer.prototype.render = function () { // - router in separate func let contents = { component: AccountAndTransactionDetails, - key: 'account-detail', + key: 'account-detail', style: {}, } @@ -36,12 +34,14 @@ MainContainer.prototype.render = function () { component: HDRestoreVaultScreen, key: 'HDRestoreVaultScreen', } + break case 'config': log.debug('rendering config screen from unlock screen.') contents = { component: ConfigScreen, key: 'config', } + break default: log.debug('rendering locked screen') contents = { @@ -65,7 +65,7 @@ MainContainer.prototype.render = function () { }, [ h(contents.component, { key: contents.key, - }, []) + }, []), ]) } diff --git a/ui/app/selectors.js b/ui/app/selectors.js index fd203dbb4..4ff3e33f2 100644 --- a/ui/app/selectors.js +++ b/ui/app/selectors.js @@ -10,31 +10,32 @@ const 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] return selectedAddress } -function getSelectedIdentity(state) { +function getSelectedIdentity (state) { const selectedAddress = getSelectedAddress(state) const identities = state.metamask.identities return identities[selectedAddress] } -function getSelectedAccount(state) { +function getSelectedAccount (state) { const accounts = state.metamask.accounts const selectedAddress = getSelectedAddress(state) return accounts[selectedAddress] } -function conversionRateSelector(state) { +function conversionRateSelector (state) { return state.metamask.conversionRate } -function transactionsSelector(state) { +function transactionsSelector (state) { const { network } = state.metamask const unapprovedMsgs = valuesFor(state.metamask.unapprovedMsgs) 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) return txsToRender.sort((a, b) => b.time - a.time) -}
\ No newline at end of file +} diff --git a/ui/app/send.js b/ui/app/send.js index 3f6cd72c9..55c880427 100644 --- a/ui/app/send.js +++ b/ui/app/send.js @@ -3,7 +3,6 @@ const PersistentForm = require('../lib/persistent-form') const h = require('react-hyperscript') const connect = require('react-redux').connect const Identicon = require('./components/identicon') -const hexToBn = require('../../app/scripts/lib/hex-to-bn') const EnsInput = require('./components/ens-input') const GasTooltip = require('./components/send/gas-tooltip') const CurrencyToggle = require('./components/send/currency-toggle') @@ -19,13 +18,8 @@ const { addToAddressBook, signTx, } = require('./actions') -const { stripHexPrefix, addHexPrefix, BN } = require('ethereumjs-util') -const { - addressSummary, - bnMultiplyByFraction, - isHex, - numericBalance, -} = require('./util') +const { stripHexPrefix, addHexPrefix } = require('ethereumjs-util') +const { isHex, numericBalance } = require('./util') const ARAGON = '960b236A07cf122663c4303350609A66A7B288C0' @@ -98,9 +92,6 @@ SendTransactionScreen.prototype.render = function () { const props = this.props const { selectedIdentity, - address, - account, - identity, network, identities, addressBook, @@ -111,7 +102,7 @@ SendTransactionScreen.prototype.render = function () { const { gas, gasPrice } = newTx console.log({ selectedIdentity, identities }) - console.log("SendTransactionScreen state:", this.state) + console.log('SendTransactionScreen state:', this.state) return ( @@ -121,7 +112,7 @@ SendTransactionScreen.prototype.render = function () { // Main Send token Card h('div.send-screen-card', { - style: {} + style: {}, }, [ h('img.send-eth-icon', { @@ -130,7 +121,7 @@ SendTransactionScreen.prototype.render = function () { }), h('div', {}, [ - 'Send' + 'Send', ]), h('div', { @@ -138,13 +129,13 @@ SendTransactionScreen.prototype.render = function () { 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', {}, [ - 'From:' + 'From:', ]), h('input.large-input.send-screen-input', { @@ -152,7 +143,7 @@ SendTransactionScreen.prototype.render = function () { placeholder: 'Account', value: this.state.from, onChange: (event) => { - console.log("event", event.target.value) + console.log('event', event.target.value) this.setState({ newTx: Object.assign( this.state.newTx, @@ -181,14 +172,14 @@ SendTransactionScreen.prototype.render = function () { h('div.send-screen-input-wrapper', {}, [ h('div', {}, [ - 'To:' + 'To:', ]), h(EnsInput, { name: 'address', placeholder: 'Recipient Address', onChange: () => { - console.log("event", event.target.value) + console.log('event', event.target.value) this.setState({ newTx: Object.assign( this.state.newTx, @@ -211,8 +202,8 @@ SendTransactionScreen.prototype.render = function () { h('span', {}, ['Amount']), h(CurrencyToggle, { currentCurrency, - onClick: (newCurrency) => this.setCurrentCurrency(newCurrency) - }), //holding on icon from design + onClick: (newCurrency) => this.setCurrentCurrency(newCurrency), + }), // holding on icon from design ]), 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', { onClick: this.toggleTooltip, }, [ - 'Customize' + 'Customize', ]), ]), - + ]), h('div.send-screen-input-wrapper', {}, [ @@ -333,7 +324,7 @@ SendTransactionScreen.prototype.render = function () { style: { marginTop: '8px', width: '8em', - background: '#FFFFFF' + background: '#FFFFFF', }, }, 'Next'), @@ -358,14 +349,9 @@ SendTransactionScreen.prototype.renderSendToken = function () { const props = this.props const { - address, - account, - identity, network, identities, addressBook, - conversionRate, - currentCurrency, } = props return ( @@ -383,13 +369,13 @@ SendTransactionScreen.prototype.renderSendToken = function () { marginRight: '3.5%', background: '#FFFFFF', // $background-white boxShadow: '0 2px 4px 0 rgba(0,0,0,0.08)', - } + }, }, [ h('section.flex-center.flex-row', { style: { zIndex: 15, // $token-icon-z-index marginTop: '-35px', - } + }, }, [ h(Identicon, { address: ARAGON, @@ -471,8 +457,8 @@ SendTransactionScreen.prototype.renderSendToken = function () { fontSize: '12px', width: '100%', justifyContent: 'space-between', - } - },[ + }, + }, [ h('span', { style: {} }, ['Amount']), h('span', { style: {} }, ['Token <> USD']), ]), @@ -498,8 +484,8 @@ SendTransactionScreen.prototype.renderSendToken = function () { fontSize: '12px', width: '100%', justifyContent: 'space-between', - } - },[ + }, + }, [ h('span', { style: {} }, ['Gas Fee:']), h('span', { style: { fontSize: '8px' } }, ['What\'s this?']), ]), @@ -529,8 +515,8 @@ SendTransactionScreen.prototype.renderSendToken = function () { fontSize: '12px', width: '100%', justifyContent: 'flex-start', - } - },[ + }, + }, [ h('span', { style: {} }, ['Transaction Memo (optional)']), ]), @@ -553,7 +539,7 @@ SendTransactionScreen.prototype.renderSendToken = function () { style: { marginTop: '8px', width: '8em', - background: '#FFFFFF' + background: '#FFFFFF', }, }, 'Next'), @@ -615,11 +601,10 @@ SendTransactionScreen.prototype.onSubmit = function () { // 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" - const txData = false; + const txData = false // Must replace with memo data. // const txData = document.querySelector('input[name="txData"]').value - const balance = this.props.balance let message // if (value.gt(balance)) { @@ -659,7 +644,7 @@ SendTransactionScreen.prototype.onSubmit = function () { // } // Hardcoded - var txParams = { + var txParams = { from: '0x82df11beb942beeed58d466fcb0f0791365c7684', to: '0xa43126b621db5b4fd98f959d9e5499f655913d34', value: '0x0', diff --git a/ui/app/util.js b/ui/app/util.js index a624726e2..bea781466 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -2,6 +2,10 @@ const ethUtil = require('ethereumjs-util') const hexToBn = require('../../app/scripts/lib/hex-to-bn') 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 function formatDate (date) { 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) { - // Gas Limit 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 txFeeBn = gasBn.mul(gasPriceBn) - return txFeeBn.toString(16); + return txFeeBn.toString(16) } diff --git a/ui/lib/is-mobile-view.js b/ui/lib/is-mobile-view.js index 8a8591c1a..78fd6cb54 100644 --- a/ui/lib/is-mobile-view.js +++ b/ui/lib/is-mobile-view.js @@ -1,5 +1,5 @@ // Checks if viewport at invoke time fits mobile dimensions // 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
\ No newline at end of file +module.exports = isMobileView |