aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/customize-gas-modal/index.js7
-rw-r--r--ui/app/components/dropdowns/token-menu-dropdown.js6
-rw-r--r--ui/app/components/pages/create-account/import-account/json.js3
-rw-r--r--ui/app/components/pages/create-account/import-account/private-key.js3
-rw-r--r--ui/app/components/pages/create-account/index.js2
-rw-r--r--ui/app/components/send/currency-display.js9
-rw-r--r--ui/app/components/send_/account-list-item/account-list-item.container.js4
-rw-r--r--ui/app/components/send_/account-list-item/index.js2
-rw-r--r--ui/app/components/send_/account-list-item/tests/account-list-item-container.test.js2
-rw-r--r--ui/app/components/send_/index.js2
-rw-r--r--ui/app/components/send_/send-content/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-amount-row/amount-max-button/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-amount-row/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-amount-row/send-amount-row.component.js1
-rw-r--r--ui/app/components/send_/send-content/send-amount-row/send-amount-row.container.js4
-rw-r--r--ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-container.test.js2
-rw-r--r--ui/app/components/send_/send-content/send-dropdown-list/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-from-row/from-dropdown/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-from-row/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js2
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js2
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/send-gas-row.container.js4
-rw-r--r--ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-container.test.js2
-rw-r--r--ui/app/components/send_/send-content/send-row-wrapper/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/index.js2
-rw-r--r--ui/app/components/send_/send-content/send-to-row/index.js2
-rw-r--r--ui/app/components/send_/send-footer/index.js2
-rw-r--r--ui/app/components/send_/send-header/index.js2
-rw-r--r--ui/app/components/send_/send.constants.js2
-rw-r--r--ui/app/components/send_/send.selectors.js5
-rw-r--r--ui/app/components/send_/send.utils.js8
-rw-r--r--ui/app/components/send_/send.utils.test.js30
-rw-r--r--ui/app/components/send_/tests/send-selectors.test.js10
-rw-r--r--ui/app/components/send_/tests/send-utils.test.js6
-rw-r--r--ui/app/components/shapeshift-form.js2
-rw-r--r--ui/app/components/signature-request.js3
-rw-r--r--ui/app/conversion-util.js2
-rw-r--r--ui/app/conversion-util.test.js22
-rw-r--r--ui/app/css/itcss/components/currency-display.scss9
-rw-r--r--ui/app/css/itcss/components/modal.scss31
-rw-r--r--ui/app/reducers/app.js2
-rw-r--r--ui/app/selectors.js10
-rw-r--r--ui/app/token-util.js2
44 files changed, 151 insertions, 74 deletions
diff --git a/ui/app/components/customize-gas-modal/index.js b/ui/app/components/customize-gas-modal/index.js
index cd8f76ed5..cefa428b9 100644
--- a/ui/app/components/customize-gas-modal/index.js
+++ b/ui/app/components/customize-gas-modal/index.js
@@ -31,8 +31,6 @@ const {
} = require('../../conversion-util')
const {
- getGasPrice,
- getGasLimit,
getGasIsLoading,
getForceGasMin,
conversionRateSelector,
@@ -44,6 +42,11 @@ const {
getSendMaxModeState,
} = require('../../selectors')
+const {
+ getGasPrice,
+ getGasLimit,
+} = require('../send_/send.selectors')
+
function mapStateToProps (state) {
const selectedToken = getSelectedToken(state)
const currentAccount = getSendFrom(state) || getCurrentAccountWithSendEtherInfo(state)
diff --git a/ui/app/components/dropdowns/token-menu-dropdown.js b/ui/app/components/dropdowns/token-menu-dropdown.js
index fac7c451b..5a794c7c1 100644
--- a/ui/app/components/dropdowns/token-menu-dropdown.js
+++ b/ui/app/components/dropdowns/token-menu-dropdown.js
@@ -54,7 +54,7 @@ TokenMenuDropdown.prototype.render = function () {
showHideTokenConfirmationModal(this.props.token)
this.props.onClose()
},
- text: this.context.t('hideToken'),
+ text: this.context.t('hideToken'),
}),
h(Item, {
onClick: (e) => {
@@ -62,7 +62,7 @@ TokenMenuDropdown.prototype.render = function () {
copyToClipboard(this.props.token.address)
this.props.onClose()
},
- text: this.context.t('copyContractAddress'),
+ text: this.context.t('copyContractAddress'),
}),
h(Item, {
onClick: (e) => {
@@ -71,7 +71,7 @@ TokenMenuDropdown.prototype.render = function () {
global.platform.openWindow({ url })
this.props.onClose()
},
- text: this.context.t('viewOnEtherscan'),
+ text: this.context.t('viewOnEtherscan'),
}),
])
}
diff --git a/ui/app/components/pages/create-account/import-account/json.js b/ui/app/components/pages/create-account/import-account/json.js
index 1dc2ba534..dd57256a3 100644
--- a/ui/app/components/pages/create-account/import-account/json.js
+++ b/ui/app/components/pages/create-account/import-account/json.js
@@ -109,12 +109,13 @@ class JsonImportSubview extends Component {
.then(({ selectedAddress }) => {
if (selectedAddress) {
history.push(DEFAULT_ROUTE)
+ displayWarning(null)
} else {
displayWarning('Error importing account.')
setSelectedAddress(firstAddress)
}
})
- .catch(err => displayWarning(err))
+ .catch(err => err && displayWarning(err.message || err))
}
}
diff --git a/ui/app/components/pages/create-account/import-account/private-key.js b/ui/app/components/pages/create-account/import-account/private-key.js
index 5df3777da..1db999f2f 100644
--- a/ui/app/components/pages/create-account/import-account/private-key.js
+++ b/ui/app/components/pages/create-account/import-account/private-key.js
@@ -99,10 +99,11 @@ PrivateKeyImportView.prototype.createNewKeychain = function () {
.then(({ selectedAddress }) => {
if (selectedAddress) {
history.push(DEFAULT_ROUTE)
+ displayWarning(null)
} else {
displayWarning('Error importing account.')
setSelectedAddress(firstAddress)
}
})
- .catch(err => displayWarning(err))
+ .catch(err => err && displayWarning(err.message || err))
}
diff --git a/ui/app/components/pages/create-account/index.js b/ui/app/components/pages/create-account/index.js
index 6e3b93742..5681e43a9 100644
--- a/ui/app/components/pages/create-account/index.js
+++ b/ui/app/components/pages/create-account/index.js
@@ -42,7 +42,7 @@ class CreateAccountPage extends Component {
render () {
return h('div.new-account', {}, [
h('div.new-account__header', [
- h('div.new-account__title', this.context.t('newAccount') ),
+ h('div.new-account__title', this.context.t('newAccount')),
this.renderTabs(),
]),
h('div.new-account__form', [
diff --git a/ui/app/components/send/currency-display.js b/ui/app/components/send/currency-display.js
index 9c8ce0044..1cf55ce1a 100644
--- a/ui/app/components/send/currency-display.js
+++ b/ui/app/components/send/currency-display.js
@@ -2,6 +2,7 @@ const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
const { conversionUtil, multiplyCurrencies } = require('../../conversion-util')
+const { removeLeadingZeroes } = require('../send_/send.utils')
const currencyFormatter = require('currency-formatter')
const currencies = require('currency-formatter/currencies')
const ethUtil = require('ethereumjs-util')
@@ -92,10 +93,6 @@ CurrencyDisplay.prototype.getConvertedValueToRender = function (nonFormattedValu
: convertedValue
}
-function removeLeadingZeroes (str) {
- return str.replace(/^0*(?=\d)/, '')
-}
-
CurrencyDisplay.prototype.handleChange = function (newVal) {
this.setState({ valueToRender: removeLeadingZeroes(newVal) })
this.props.onChange(this.getAmount(newVal))
@@ -118,6 +115,7 @@ CurrencyDisplay.prototype.render = function () {
readOnly = false,
inError = false,
onBlur,
+ step,
} = this.props
const { valueToRender } = this.state
@@ -149,9 +147,10 @@ CurrencyDisplay.prototype.render = function () {
} : {}),
ref: input => { this.currencyInput = input },
style: {
- minWidth: this.getInputWidth(valueToRender, readOnly),
+ width: this.getInputWidth(valueToRender, readOnly),
},
min: 0,
+ step,
}),
h('span.currency-display__currency-symbol', primaryCurrency),
diff --git a/ui/app/components/send_/account-list-item/account-list-item.container.js b/ui/app/components/send_/account-list-item/account-list-item.container.js
index 3151b1f1d..4b4519288 100644
--- a/ui/app/components/send_/account-list-item/account-list-item.container.js
+++ b/ui/app/components/send_/account-list-item/account-list-item.container.js
@@ -1,7 +1,7 @@
import { connect } from 'react-redux'
import {
getConversionRate,
- getConvertedCurrency,
+ getCurrentCurrency,
} from '../send.selectors.js'
import AccountListItem from './account-list-item.component'
@@ -10,6 +10,6 @@ export default connect(mapStateToProps)(AccountListItem)
function mapStateToProps (state) {
return {
conversionRate: getConversionRate(state),
- currentCurrency: getConvertedCurrency(state),
+ currentCurrency: getCurrentCurrency(state),
}
}
diff --git a/ui/app/components/send_/account-list-item/index.js b/ui/app/components/send_/account-list-item/index.js
index 1fca540be..907485cf7 100644
--- a/ui/app/components/send_/account-list-item/index.js
+++ b/ui/app/components/send_/account-list-item/index.js
@@ -1 +1 @@
-export { default } from './account-list-item.container' \ No newline at end of file
+export { default } from './account-list-item.container'
diff --git a/ui/app/components/send_/account-list-item/tests/account-list-item-container.test.js b/ui/app/components/send_/account-list-item/tests/account-list-item-container.test.js
index 49da920e6..af0859117 100644
--- a/ui/app/components/send_/account-list-item/tests/account-list-item-container.test.js
+++ b/ui/app/components/send_/account-list-item/tests/account-list-item-container.test.js
@@ -12,7 +12,7 @@ proxyquire('../account-list-item.container.js', {
},
'../send.selectors.js': {
getConversionRate: (s) => `mockConversionRate:${s}`,
- getConvertedCurrency: (s) => `mockCurrentCurrency:${s}`,
+ getCurrentCurrency: (s) => `mockCurrentCurrency:${s}`,
},
})
diff --git a/ui/app/components/send_/index.js b/ui/app/components/send_/index.js
index 9a4dd5727..b5114babc 100644
--- a/ui/app/components/send_/index.js
+++ b/ui/app/components/send_/index.js
@@ -1 +1 @@
-export { default } from './send.container' \ No newline at end of file
+export { default } from './send.container'
diff --git a/ui/app/components/send_/send-content/index.js b/ui/app/components/send_/send-content/index.js
index 10b3c850e..891c17e6a 100644
--- a/ui/app/components/send_/send-content/index.js
+++ b/ui/app/components/send_/send-content/index.js
@@ -1 +1 @@
-export { default } from './send-content.component' \ No newline at end of file
+export { default } from './send-content.component'
diff --git a/ui/app/components/send_/send-content/send-amount-row/amount-max-button/index.js b/ui/app/components/send_/send-content/send-amount-row/amount-max-button/index.js
index 548b51f33..ee8271494 100644
--- a/ui/app/components/send_/send-content/send-amount-row/amount-max-button/index.js
+++ b/ui/app/components/send_/send-content/send-amount-row/amount-max-button/index.js
@@ -1 +1 @@
-export { default } from './amount-max-button.container' \ No newline at end of file
+export { default } from './amount-max-button.container'
diff --git a/ui/app/components/send_/send-content/send-amount-row/index.js b/ui/app/components/send_/send-content/send-amount-row/index.js
index 94a7da56f..abc6852fe 100644
--- a/ui/app/components/send_/send-content/send-amount-row/index.js
+++ b/ui/app/components/send_/send-content/send-amount-row/index.js
@@ -1 +1 @@
-export { default } from './send-amount-row.container' \ No newline at end of file
+export { default } from './send-amount-row.container'
diff --git a/ui/app/components/send_/send-content/send-amount-row/send-amount-row.component.js b/ui/app/components/send_/send-content/send-amount-row/send-amount-row.component.js
index 8da36d3b7..196538c11 100644
--- a/ui/app/components/send_/send-content/send-amount-row/send-amount-row.component.js
+++ b/ui/app/components/send_/send-content/send-amount-row/send-amount-row.component.js
@@ -95,6 +95,7 @@ export default class SendAmountRow extends Component {
primaryCurrency={primaryCurrency || 'ETH'}
selectedToken={selectedToken}
value={amount}
+ step="any"
/>
</SendRowWrapper>
)
diff --git a/ui/app/components/send_/send-content/send-amount-row/send-amount-row.container.js b/ui/app/components/send_/send-content/send-amount-row/send-amount-row.container.js
index bbbf56971..b816d948f 100644
--- a/ui/app/components/send_/send-content/send-amount-row/send-amount-row.container.js
+++ b/ui/app/components/send_/send-content/send-amount-row/send-amount-row.container.js
@@ -2,7 +2,7 @@ import { connect } from 'react-redux'
import {
getAmountConversionRate,
getConversionRate,
- getConvertedCurrency,
+ getCurrentCurrency,
getGasTotal,
getPrimaryCurrency,
getSelectedToken,
@@ -31,7 +31,7 @@ function mapStateToProps (state) {
amountConversionRate: getAmountConversionRate(state),
balance: getSendFromBalance(state),
conversionRate: getConversionRate(state),
- convertedCurrency: getConvertedCurrency(state),
+ convertedCurrency: getCurrentCurrency(state),
gasTotal: getGasTotal(state),
inError: sendAmountIsInError(state),
primaryCurrency: getPrimaryCurrency(state),
diff --git a/ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-container.test.js b/ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-container.test.js
index e4c913c69..94d9918a7 100644
--- a/ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-container.test.js
+++ b/ui/app/components/send_/send-content/send-amount-row/tests/send-amount-row-container.test.js
@@ -24,7 +24,7 @@ proxyquire('../send-amount-row.container.js', {
'../../send.selectors': {
getAmountConversionRate: (s) => `mockAmountConversionRate:${s}`,
getConversionRate: (s) => `mockConversionRate:${s}`,
- getConvertedCurrency: (s) => `mockConvertedCurrency:${s}`,
+ getCurrentCurrency: (s) => `mockConvertedCurrency:${s}`,
getGasTotal: (s) => `mockGasTotal:${s}`,
getPrimaryCurrency: (s) => `mockPrimaryCurrency:${s}`,
getSelectedToken: (s) => `mockSelectedToken:${s}`,
diff --git a/ui/app/components/send_/send-content/send-dropdown-list/index.js b/ui/app/components/send_/send-content/send-dropdown-list/index.js
index ee7736376..04af6536c 100644
--- a/ui/app/components/send_/send-content/send-dropdown-list/index.js
+++ b/ui/app/components/send_/send-content/send-dropdown-list/index.js
@@ -1 +1 @@
-export { default } from './send-dropdown-list.component' \ No newline at end of file
+export { default } from './send-dropdown-list.component'
diff --git a/ui/app/components/send_/send-content/send-from-row/from-dropdown/index.js b/ui/app/components/send_/send-content/send-from-row/from-dropdown/index.js
index 6ab9a157a..2314ef4e3 100644
--- a/ui/app/components/send_/send-content/send-from-row/from-dropdown/index.js
+++ b/ui/app/components/send_/send-content/send-from-row/from-dropdown/index.js
@@ -1 +1 @@
-export { default } from './from-dropdown.component' \ No newline at end of file
+export { default } from './from-dropdown.component'
diff --git a/ui/app/components/send_/send-content/send-from-row/index.js b/ui/app/components/send_/send-content/send-from-row/index.js
index 4a0916dba..0a79726b2 100644
--- a/ui/app/components/send_/send-content/send-from-row/index.js
+++ b/ui/app/components/send_/send-content/send-from-row/index.js
@@ -1 +1 @@
-export { default } from './send-from-row.container' \ No newline at end of file
+export { default } from './send-from-row.container'
diff --git a/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js b/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js
index b1fd67412..c8d619be5 100644
--- a/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js
+++ b/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/gas-fee-display.component.js
@@ -14,7 +14,7 @@ export default class GasFeeDisplay extends Component {
onClick: PropTypes.func,
};
- render() {
+ render () {
const {
conversionRate,
gasTotal,
diff --git a/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js b/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js
index 66f3a94df..7cbe8d0df 100644
--- a/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js
+++ b/ui/app/components/send_/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js
@@ -10,7 +10,7 @@ const propsMethodSpies = {
showCustomizeGasModal: sinon.spy(),
}
-describe('SendGasRow Component', function() {
+describe('SendGasRow Component', function () {
let wrapper
beforeEach(() => {
diff --git a/ui/app/components/send_/send-content/send-gas-row/index.js b/ui/app/components/send_/send-content/send-gas-row/index.js
index 060ed7fd3..3c7ff1d5f 100644
--- a/ui/app/components/send_/send-content/send-gas-row/index.js
+++ b/ui/app/components/send_/send-content/send-gas-row/index.js
@@ -1 +1 @@
-export { default } from './send-gas-row.container' \ No newline at end of file
+export { default } from './send-gas-row.container'
diff --git a/ui/app/components/send_/send-content/send-gas-row/send-gas-row.container.js b/ui/app/components/send_/send-content/send-gas-row/send-gas-row.container.js
index 20d3daa59..6e6fbc8a8 100644
--- a/ui/app/components/send_/send-content/send-gas-row/send-gas-row.container.js
+++ b/ui/app/components/send_/send-content/send-gas-row/send-gas-row.container.js
@@ -1,7 +1,7 @@
import { connect } from 'react-redux'
import {
getConversionRate,
- getConvertedCurrency,
+ getCurrentCurrency,
getGasTotal,
} from '../../send.selectors.js'
import { sendGasIsInError } from './send-gas-row.selectors.js'
@@ -13,7 +13,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(SendGasRow)
function mapStateToProps (state) {
return {
conversionRate: getConversionRate(state),
- convertedCurrency: getConvertedCurrency(state),
+ convertedCurrency: getCurrentCurrency(state),
gasTotal: getGasTotal(state),
gasLoadingError: sendGasIsInError(state),
}
diff --git a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-container.test.js b/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-container.test.js
index 9135524d1..e928c8aba 100644
--- a/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-container.test.js
+++ b/ui/app/components/send_/send-content/send-gas-row/tests/send-gas-row-container.test.js
@@ -19,7 +19,7 @@ proxyquire('../send-gas-row.container.js', {
},
'../../send.selectors.js': {
getConversionRate: (s) => `mockConversionRate:${s}`,
- getConvertedCurrency: (s) => `mockConvertedCurrency:${s}`,
+ getCurrentCurrency: (s) => `mockConvertedCurrency:${s}`,
getGasTotal: (s) => `mockGasTotal:${s}`,
},
'./send-gas-row.selectors.js': { sendGasIsInError: (s) => `mockGasLoadingError:${s}` },
diff --git a/ui/app/components/send_/send-content/send-row-wrapper/index.js b/ui/app/components/send_/send-content/send-row-wrapper/index.js
index 5715f55c6..d17545dcc 100644
--- a/ui/app/components/send_/send-content/send-row-wrapper/index.js
+++ b/ui/app/components/send_/send-content/send-row-wrapper/index.js
@@ -1 +1 @@
-export { default } from './send-row-wrapper.component' \ No newline at end of file
+export { default } from './send-row-wrapper.component'
diff --git a/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/index.js b/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/index.js
index bf49c55bd..c00617f83 100644
--- a/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/index.js
+++ b/ui/app/components/send_/send-content/send-row-wrapper/send-row-error-message/index.js
@@ -1 +1 @@
-export { default } from './send-row-error-message.container' \ No newline at end of file
+export { default } from './send-row-error-message.container'
diff --git a/ui/app/components/send_/send-content/send-to-row/index.js b/ui/app/components/send_/send-content/send-to-row/index.js
index 4e7aa9747..121f15148 100644
--- a/ui/app/components/send_/send-content/send-to-row/index.js
+++ b/ui/app/components/send_/send-content/send-to-row/index.js
@@ -1 +1 @@
-export { default } from './send-to-row.container' \ No newline at end of file
+export { default } from './send-to-row.container'
diff --git a/ui/app/components/send_/send-footer/index.js b/ui/app/components/send_/send-footer/index.js
index cd1727330..58e91d622 100644
--- a/ui/app/components/send_/send-footer/index.js
+++ b/ui/app/components/send_/send-footer/index.js
@@ -1 +1 @@
-export { default } from './send-footer.container' \ No newline at end of file
+export { default } from './send-footer.container'
diff --git a/ui/app/components/send_/send-header/index.js b/ui/app/components/send_/send-header/index.js
index b808eabbf..0b17f0b7d 100644
--- a/ui/app/components/send_/send-header/index.js
+++ b/ui/app/components/send_/send-header/index.js
@@ -1 +1 @@
-export { default } from './send-header.container' \ No newline at end of file
+export { default } from './send-header.container'
diff --git a/ui/app/components/send_/send.constants.js b/ui/app/components/send_/send.constants.js
index df5dee371..8acdf0641 100644
--- a/ui/app/components/send_/send.constants.js
+++ b/ui/app/components/send_/send.constants.js
@@ -36,6 +36,7 @@ const ONE_GWEI_IN_WEI_HEX = ethUtil.addHexPrefix(conversionUtil('0x1', {
}))
const SIMPLE_GAS_COST = '0x5208' // Hex for 21000, cost of a simple send.
+const BASE_TOKEN_GAS_COST = '0x186a0' // Hex for 100000, a base estimate for token transfers.
module.exports = {
INSUFFICIENT_FUNDS_ERROR,
@@ -52,4 +53,5 @@ module.exports = {
REQUIRED_ERROR,
SIMPLE_GAS_COST,
TOKEN_TRANSFER_FUNCTION_SIGNATURE,
+ BASE_TOKEN_GAS_COST,
}
diff --git a/ui/app/components/send_/send.selectors.js b/ui/app/components/send_/send.selectors.js
index 7e7cfe2e9..f910f7caf 100644
--- a/ui/app/components/send_/send.selectors.js
+++ b/ui/app/components/send_/send.selectors.js
@@ -14,7 +14,6 @@ const selectors = {
getAmountConversionRate,
getBlockGasLimit,
getConversionRate,
- getConvertedCurrency,
getCurrentAccountWithSendEtherInfo,
getCurrentCurrency,
getCurrentNetwork,
@@ -98,10 +97,6 @@ function getConversionRate (state) {
return state.metamask.conversionRate
}
-function getConvertedCurrency (state) {
- return state.metamask.currentCurrency
-}
-
function getCurrentAccountWithSendEtherInfo (state) {
const currentAddress = getSelectedAddress(state)
const accounts = accountsWithSendEtherInfoSelector(state)
diff --git a/ui/app/components/send_/send.utils.js b/ui/app/components/send_/send.utils.js
index dfd459731..34275248f 100644
--- a/ui/app/components/send_/send.utils.js
+++ b/ui/app/components/send_/send.utils.js
@@ -10,6 +10,7 @@ const {
calcTokenAmount,
} = require('../../token-util')
const {
+ BASE_TOKEN_GAS_COST,
INSUFFICIENT_FUNDS_ERROR,
INSUFFICIENT_TOKENS_ERROR,
NEGATIVE_ETH_ERROR,
@@ -32,6 +33,7 @@ module.exports = {
getToAddressForGasUpdate,
isBalanceSufficient,
isTokenBalanceSufficient,
+ removeLeadingZeroes,
}
function calcGasTotal (gasLimit, gasPrice) {
@@ -183,6 +185,8 @@ async function estimateGas ({ selectedAddress, selectedToken, blockGasLimit, to,
if (!code || code === '0x') {
return SIMPLE_GAS_COST
}
+ } else if (selectedToken && !to) {
+ return BASE_TOKEN_GAS_COST
}
paramsForGasEstimate.to = selectedToken ? selectedToken.address : to
@@ -273,3 +277,7 @@ function estimateGasPriceFromRecentBlocks (recentBlocks) {
function getToAddressForGasUpdate (...addresses) {
return [...addresses, ''].find(str => str !== undefined && str !== null).toLowerCase()
}
+
+function removeLeadingZeroes (str) {
+ return str.replace(/^0*(?=\d)/, '')
+}
diff --git a/ui/app/components/send_/send.utils.test.js b/ui/app/components/send_/send.utils.test.js
new file mode 100644
index 000000000..36f3a5c10
--- /dev/null
+++ b/ui/app/components/send_/send.utils.test.js
@@ -0,0 +1,30 @@
+import assert from 'assert'
+import { removeLeadingZeroes } from './send.utils'
+
+
+describe('send utils', () => {
+ describe('removeLeadingZeroes()', () => {
+ it('should remove leading zeroes from int when user types', () => {
+ assert.equal(removeLeadingZeroes('0'), '0')
+ assert.equal(removeLeadingZeroes('1'), '1')
+ assert.equal(removeLeadingZeroes('00'), '0')
+ assert.equal(removeLeadingZeroes('01'), '1')
+ })
+
+ it('should remove leading zeroes from int when user copy/paste', () => {
+ assert.equal(removeLeadingZeroes('001'), '1')
+ })
+
+ it('should remove leading zeroes from float when user types', () => {
+ assert.equal(removeLeadingZeroes('0.'), '0.')
+ assert.equal(removeLeadingZeroes('0.0'), '0.0')
+ assert.equal(removeLeadingZeroes('0.00'), '0.00')
+ assert.equal(removeLeadingZeroes('0.001'), '0.001')
+ assert.equal(removeLeadingZeroes('0.10'), '0.10')
+ })
+
+ it('should remove leading zeroes from float when user copy/paste', () => {
+ assert.equal(removeLeadingZeroes('00.1'), '0.1')
+ })
+ })
+})
diff --git a/ui/app/components/send_/tests/send-selectors.test.js b/ui/app/components/send_/tests/send-selectors.test.js
index 152af8059..218da656b 100644
--- a/ui/app/components/send_/tests/send-selectors.test.js
+++ b/ui/app/components/send_/tests/send-selectors.test.js
@@ -8,7 +8,6 @@ const {
getBlockGasLimit,
getAmountConversionRate,
getConversionRate,
- getConvertedCurrency,
getCurrentAccountWithSendEtherInfo,
getCurrentCurrency,
getCurrentNetwork,
@@ -154,15 +153,6 @@ describe('send selectors', () => {
})
})
- describe('getConvertedCurrency()', () => {
- it('should return the currently selected currency', () => {
- assert.equal(
- getConvertedCurrency(mockState),
- 'USD'
- )
- })
- })
-
describe('getCurrentAccountWithSendEtherInfo()', () => {
it('should return the currently selected account with identity info', () => {
assert.deepEqual(
diff --git a/ui/app/components/send_/tests/send-utils.test.js b/ui/app/components/send_/tests/send-utils.test.js
index f3d5674b7..a518a64e9 100644
--- a/ui/app/components/send_/tests/send-utils.test.js
+++ b/ui/app/components/send_/tests/send-utils.test.js
@@ -2,6 +2,7 @@ import assert from 'assert'
import sinon from 'sinon'
import proxyquire from 'proxyquire'
import {
+ BASE_TOKEN_GAS_COST,
ONE_GWEI_IN_WEI_HEX,
SIMPLE_GAS_COST,
} from '../send.constants'
@@ -336,6 +337,11 @@ describe('send utils', () => {
assert.notEqual(result, SIMPLE_GAS_COST)
})
+ it(`should return ${BASE_TOKEN_GAS_COST} if passed a selectedToken but no to address`, async () => {
+ const result = await estimateGas(Object.assign({}, baseMockParams, { to: null, selectedToken: { address: '' } }))
+ assert.equal(result, BASE_TOKEN_GAS_COST)
+ })
+
it(`should return the adjusted blockGasLimit if it fails with a 'Transaction execution error.'`, async () => {
const result = await estimateGas(Object.assign({}, baseMockParams, {
to: 'isContract willFailBecauseOf:Transaction execution error.',
diff --git a/ui/app/components/shapeshift-form.js b/ui/app/components/shapeshift-form.js
index 93d2023b5..2c4ba40bf 100644
--- a/ui/app/components/shapeshift-form.js
+++ b/ui/app/components/shapeshift-form.js
@@ -181,7 +181,7 @@ ShapeshiftForm.prototype.render = function () {
return h('div.shapeshift-form-wrapper', [
showQrCode
? this.renderQrCode()
- : h('div.shapeshift-form', [
+ : h('div.modal-shapeshift-form', [
h('div.shapeshift-form__selectors', [
h('div.shapeshift-form__selector', [
diff --git a/ui/app/components/signature-request.js b/ui/app/components/signature-request.js
index 2a3e929fe..bbb340fcf 100644
--- a/ui/app/components/signature-request.js
+++ b/ui/app/components/signature-request.js
@@ -204,6 +204,9 @@ SignatureRequest.prototype.renderBody = function () {
h('div.request-signature__rows', [
...rows.map(({ name, value }) => {
+ if (typeof value === 'boolean') {
+ value = value.toString()
+ }
return h('div.request-signature__row', [
h('div.request-signature__row-title', [`${name}:`]),
h('div.request-signature__row-value', value),
diff --git a/ui/app/conversion-util.js b/ui/app/conversion-util.js
index 337763067..a7a226cc5 100644
--- a/ui/app/conversion-util.js
+++ b/ui/app/conversion-util.js
@@ -140,7 +140,7 @@ const addCurrencies = (a, b, options = {}) => {
bBase,
...conversionOptions
} = options
- const value = (new BigNumber(a, aBase)).add(b, bBase)
+ const value = (new BigNumber(a.toString(), aBase)).add(b.toString(), bBase)
return converter({
value,
diff --git a/ui/app/conversion-util.test.js b/ui/app/conversion-util.test.js
new file mode 100644
index 000000000..368ce3bba
--- /dev/null
+++ b/ui/app/conversion-util.test.js
@@ -0,0 +1,22 @@
+import assert from 'assert'
+import {addCurrencies} from './conversion-util'
+
+
+describe('conversion utils', () => {
+ describe('addCurrencies()', () => {
+ it('add whole numbers', () => {
+ const result = addCurrencies(3, 9)
+ assert.equal(result.toNumber(), 12)
+ })
+
+ it('add decimals', () => {
+ const result = addCurrencies(1.3, 1.9)
+ assert.equal(result.toNumber(), 3.2)
+ })
+
+ it('add repeating decimals', () => {
+ const result = addCurrencies(1 / 3, 1 / 9)
+ assert.equal(result.toNumber(), 0.4444444444444444)
+ })
+ })
+})
diff --git a/ui/app/css/itcss/components/currency-display.scss b/ui/app/css/itcss/components/currency-display.scss
index 3614aa868..b1a74dce2 100644
--- a/ui/app/css/itcss/components/currency-display.scss
+++ b/ui/app/css/itcss/components/currency-display.scss
@@ -48,15 +48,20 @@
display: flex;
flex: 1;
max-width: 100%;
- overflow-x: scroll;
+
+ input[type="number"] {
+ -moz-appearance: textfield;
+ }
input[type="number"]::-webkit-inner-spin-button {
-webkit-appearance: none;
+ -moz-appearance: none;
display: none;
}
input[type="number"]:hover::-webkit-inner-spin-button {
-webkit-appearance: none;
+ -moz-appearance: none;
display: none;
}
}
@@ -69,11 +74,13 @@
.react-numeric-input {
input[type="number"]::-webkit-inner-spin-button {
-webkit-appearance: none;
+ -moz-appearance: none;
display: none;
}
input[type="number"]:hover::-webkit-inner-spin-button {
-webkit-appearance: none;
+ -moz-appearance: none;
display: none;
}
}
diff --git a/ui/app/css/itcss/components/modal.scss b/ui/app/css/itcss/components/modal.scss
index 74658f656..42ef7ae0a 100644
--- a/ui/app/css/itcss/components/modal.scss
+++ b/ui/app/css/itcss/components/modal.scss
@@ -642,10 +642,31 @@
display: flex;
flex-flow: column nowrap;
flex: 1;
+ align-items: center;
@media screen and (max-width: 575px) {
height: 0;
}
+
+ .shapeshift-form-wrapper {
+ display: flex;
+ flex-flow: column;
+ justify-content: center;
+ align-items: center;
+ flex: 1 0 auto;
+
+ .shapeshift-form, .modal-shapeshift-form {
+ border-radius: 8px;
+ background-color: rgba(0, 0, 0, .05);
+ padding: 17px 15px;
+ margin-bottom: 10px;
+
+ &__caret {
+ width: auto;
+ flex: 1;
+ }
+ }
+ }
}
&__logo {
@@ -773,17 +794,15 @@
margin-top: 28px;
flex: 1 0 auto;
- .shapeshift-form {
- width: auto;
+ .shapeshift-form, .modal-shapeshift-form {
+ border-radius: 8px;
+ background-color: rgba(0, 0, 0, .05);
+ padding: 17px 15px;
&__caret {
width: auto;
flex: 1;
}
-
- @media screen and (max-width: 575px) {
- width: auto;
- }
}
}
diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js
index 9cacf5fe7..f453812b9 100644
--- a/ui/app/reducers/app.js
+++ b/ui/app/reducers/app.js
@@ -684,7 +684,7 @@ function reduceApp (state, action) {
case actions.GAS_LOADING_FINISHED:
return extend(appState, {
gasIsLoading: false,
- })
+ })
default:
return appState
diff --git a/ui/app/selectors.js b/ui/app/selectors.js
index cf0affe9c..3e2253550 100644
--- a/ui/app/selectors.js
+++ b/ui/app/selectors.js
@@ -17,8 +17,6 @@ const selectors = {
accountsWithSendEtherInfoSelector,
getCurrentAccountWithSendEtherInfo,
getGasIsLoading,
- getGasPrice,
- getGasLimit,
getForceGasMin,
getAddressBook,
getSendFrom,
@@ -122,14 +120,6 @@ function getGasIsLoading (state) {
return state.appState.gasIsLoading
}
-function getGasPrice (state) {
- return state.metamask.send.gasPrice
-}
-
-function getGasLimit (state) {
- return state.metamask.send.gasLimit
-}
-
function getForceGasMin (state) {
return state.metamask.send.forceGasMin
}
diff --git a/ui/app/token-util.js b/ui/app/token-util.js
index 8c5b37d7b..cd6a47dbc 100644
--- a/ui/app/token-util.js
+++ b/ui/app/token-util.js
@@ -20,7 +20,7 @@ async function getSymbolAndDecimals (tokenAddress, existingTokens = []) {
if (existingToken) {
return existingToken
}
-
+
let result = []
try {
const token = util.getContractAtAddress(tokenAddress)