aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2017-10-19 03:23:35 +0800
committerChi Kei Chan <chikeichan@gmail.com>2017-10-20 03:34:34 +0800
commitc2880c4b8fe56f3b175d75b6ae8a84271dde3e28 (patch)
tree9054d389467d47a3ecaadd6662ab19a38bc027a3 /ui
parent7362fb8dfc5b8d9f3ae9a3399f9448ea5720cd43 (diff)
downloadtangerine-wallet-browser-c2880c4b8fe56f3b175d75b6ae8a84271dde3e28.tar
tangerine-wallet-browser-c2880c4b8fe56f3b175d75b6ae8a84271dde3e28.tar.gz
tangerine-wallet-browser-c2880c4b8fe56f3b175d75b6ae8a84271dde3e28.tar.bz2
tangerine-wallet-browser-c2880c4b8fe56f3b175d75b6ae8a84271dde3e28.tar.lz
tangerine-wallet-browser-c2880c4b8fe56f3b175d75b6ae8a84271dde3e28.tar.xz
tangerine-wallet-browser-c2880c4b8fe56f3b175d75b6ae8a84271dde3e28.tar.zst
tangerine-wallet-browser-c2880c4b8fe56f3b175d75b6ae8a84271dde3e28.zip
Min and default gas price, limit, total; comments out code for gas slider.
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/customize-gas-modal/gas-modal-card.js18
-rw-r--r--ui/app/components/customize-gas-modal/index.js17
-rw-r--r--ui/app/components/send/send-constants.js23
-rw-r--r--ui/app/send-v2.js7
4 files changed, 47 insertions, 18 deletions
diff --git a/ui/app/components/customize-gas-modal/gas-modal-card.js b/ui/app/components/customize-gas-modal/gas-modal-card.js
index 8e739ee40..de181dc67 100644
--- a/ui/app/components/customize-gas-modal/gas-modal-card.js
+++ b/ui/app/components/customize-gas-modal/gas-modal-card.js
@@ -19,7 +19,7 @@ GasModalCard.prototype.render = function () {
unitLabel,
value,
min,
- max,
+ // max,
step,
title,
copy
@@ -34,20 +34,20 @@ GasModalCard.prototype.render = function () {
h(InputNumber, {
unitLabel,
step,
- max,
+ // max,
min,
placeholder: '0',
value,
onChange,
}),
- h(GasSlider, {
- value,
- step,
- max,
- min,
- onChange,
- }),
+ // h(GasSlider, {
+ // value,
+ // step,
+ // max,
+ // min,
+ // onChange,
+ // }),
])
diff --git a/ui/app/components/customize-gas-modal/index.js b/ui/app/components/customize-gas-modal/index.js
index 0ba768893..744891c47 100644
--- a/ui/app/components/customize-gas-modal/index.js
+++ b/ui/app/components/customize-gas-modal/index.js
@@ -5,6 +5,11 @@ const connect = require('react-redux').connect
const actions = require('../../actions')
const GasModalCard = require('./gas-modal-card')
+const {
+ MIN_GAS_PRICE,
+ MIN_GAS_LIMIT,
+} = require('../send/send-constants')
+
const { conversionUtil, multiplyCurrencies } = require('../../conversion-util')
const {
@@ -35,8 +40,8 @@ function CustomizeGasModal (props) {
Component.call(this)
this.state = {
- gasPrice: props.gasPrice,
- gasLimit: props.gasLimit,
+ gasPrice: props.gasPrice || MIN_GAS_PRICE,
+ gasLimit: props.gasLimit || MIN_GAS_LIMIT,
}
}
@@ -115,8 +120,8 @@ CustomizeGasModal.prototype.render = function () {
h(GasModalCard, {
value: convertedGasPrice,
- min: 0,
- max: 1000,
+ min: MIN_GAS_PRICE,
+ // max: 1000,
step: 1,
onChange: value => this.convertAndSetGasPrice(value),
title: 'Gas Price',
@@ -125,8 +130,8 @@ CustomizeGasModal.prototype.render = function () {
h(GasModalCard, {
value: convertedGasLimit,
- min: 20000,
- max: 100000,
+ min: MIN_GAS_LIMIT,
+ // max: 100000,
step: 1,
onChange: value => this.convertAndSetGasLimit(value),
title: 'Gas Limit',
diff --git a/ui/app/components/send/send-constants.js b/ui/app/components/send/send-constants.js
new file mode 100644
index 000000000..a819a8c28
--- /dev/null
+++ b/ui/app/components/send/send-constants.js
@@ -0,0 +1,23 @@
+const Identicon = require('../identicon')
+const { multiplyCurrencies } = require('../../conversion-util')
+
+const MIN_GAS_PRICE_GWEI = '1'
+const GWEI_FACTOR = '1e9'
+const MIN_GAS_PRICE = multiplyCurrencies(GWEI_FACTOR, MIN_GAS_PRICE_GWEI, {
+ multiplicandBase: 16,
+ multiplierBase: 16,
+})
+const MIN_GAS_LIMIT = (21000).toString(16)
+const MIN_GAS_TOTAL = multiplyCurrencies(MIN_GAS_LIMIT, MIN_GAS_PRICE, {
+ toNumericBase: 'hex',
+ multiplicandBase: 16,
+ multiplierBase: 16,
+})
+
+module.exports = {
+ MIN_GAS_PRICE_GWEI,
+ GWEI_FACTOR,
+ MIN_GAS_PRICE,
+ MIN_GAS_LIMIT,
+ MIN_GAS_TOTAL,
+}
diff --git a/ui/app/send-v2.js b/ui/app/send-v2.js
index c0a03690a..8915350a3 100644
--- a/ui/app/send-v2.js
+++ b/ui/app/send-v2.js
@@ -10,6 +10,8 @@ const CurrencyDisplay = require('./components/send/currency-display')
const MemoTextArea = require('./components/send/memo-textarea')
const GasFeeDisplay = require('./components/send/gas-fee-display-v2')
+const { MIN_GAS_TOTAL } = require('./components/send/send-constants')
+
const { showModal } = require('./actions')
const {
@@ -135,9 +137,8 @@ SendTransactionScreen.prototype.renderHeader = function () {
SendTransactionScreen.prototype.renderErrorMessage = function(errorType) {
const { errors } = this.props
- console.log(`! errors`, errors);
const errorMessage = errors[errorType];
- console.log(`errorMessage`, errorMessage);
+
return errorMessage
? h('div.send-v2__error', [ errorMessage ] )
: null
@@ -309,7 +310,7 @@ SendTransactionScreen.prototype.renderGasRow = function () {
const {
conversionRate,
showCustomizeGasModal,
- gasTotal,
+ gasTotal = MIN_GAS_TOTAL,
} = this.props
return h('div.send-v2__form-row', [