|
|
@ -93,7 +93,6 @@ function SendTransactionScreen () { |
|
|
|
this.getAmountToSend = this.getAmountToSend.bind(this) |
|
|
|
this.getAmountToSend = this.getAmountToSend.bind(this) |
|
|
|
this.setErrorsFor = this.setErrorsFor.bind(this) |
|
|
|
this.setErrorsFor = this.setErrorsFor.bind(this) |
|
|
|
this.clearErrorsFor = this.clearErrorsFor.bind(this) |
|
|
|
this.clearErrorsFor = this.clearErrorsFor.bind(this) |
|
|
|
this.estimateGasAndPrice = this.estimateGasAndPrice.bind(this) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.renderFromInput = this.renderFromInput.bind(this) |
|
|
|
this.renderFromInput = this.renderFromInput.bind(this) |
|
|
|
this.renderToInput = this.renderToInput.bind(this) |
|
|
|
this.renderToInput = this.renderToInput.bind(this) |
|
|
@ -103,6 +102,19 @@ function SendTransactionScreen () { |
|
|
|
this.renderErrorMessage = this.renderErrorMessage.bind(this) |
|
|
|
this.renderErrorMessage = this.renderErrorMessage.bind(this) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SendTransactionScreen.prototype.componentWillMount = function () { |
|
|
|
|
|
|
|
Promise.all([ |
|
|
|
|
|
|
|
this.props.dispatch(getGasPrice()), |
|
|
|
|
|
|
|
this.props.dispatch(estimateGas()), |
|
|
|
|
|
|
|
]) |
|
|
|
|
|
|
|
.then(([blockGasPrice, estimatedGas]) => { |
|
|
|
|
|
|
|
this.setState({ |
|
|
|
|
|
|
|
blockGasPrice, |
|
|
|
|
|
|
|
estimatedGas, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SendTransactionScreen.prototype.renderErrorMessage = function(errorType, warning) { |
|
|
|
SendTransactionScreen.prototype.renderErrorMessage = function(errorType, warning) { |
|
|
|
const { errors } = this.state |
|
|
|
const { errors } = this.state |
|
|
|
const errorMessage = errors[errorType]; |
|
|
|
const errorMessage = errors[errorType]; |
|
|
@ -171,7 +183,6 @@ SendTransactionScreen.prototype.renderToInput = function (to, identities, addres |
|
|
|
}, |
|
|
|
}, |
|
|
|
onBlur: () => { |
|
|
|
onBlur: () => { |
|
|
|
this.setErrorsFor('to') |
|
|
|
this.setErrorsFor('to') |
|
|
|
this.estimateGasAndPrice() |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
onFocus: event => { |
|
|
|
onFocus: event => { |
|
|
|
this.clearErrorsFor('to') |
|
|
|
this.clearErrorsFor('to') |
|
|
@ -230,7 +241,6 @@ SendTransactionScreen.prototype.renderAmountInput = function (activeCurrency) { |
|
|
|
}, |
|
|
|
}, |
|
|
|
onBlur: () => { |
|
|
|
onBlur: () => { |
|
|
|
this.setErrorsFor('amount') |
|
|
|
this.setErrorsFor('amount') |
|
|
|
this.estimateGasAndPrice() |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
onFocus: () => this.clearErrorsFor('amount'), |
|
|
|
onFocus: () => this.clearErrorsFor('amount'), |
|
|
|
}), |
|
|
|
}), |
|
|
@ -383,23 +393,6 @@ SendTransactionScreen.prototype.setActiveCurrency = function (newCurrency) { |
|
|
|
this.setState({ activeCurrency: newCurrency }) |
|
|
|
this.setState({ activeCurrency: newCurrency }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SendTransactionScreen.prototype.estimateGasAndPrice = function () { |
|
|
|
|
|
|
|
const { errors, sendAmount, newTx } = this.state |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!errors.to && !errors.amount && newTx.amount > 0) { |
|
|
|
|
|
|
|
Promise.all([ |
|
|
|
|
|
|
|
this.props.dispatch(getGasPrice()), |
|
|
|
|
|
|
|
this.props.dispatch(estimateGas({ to: newTx.to, amount: sendAmount })), |
|
|
|
|
|
|
|
]) |
|
|
|
|
|
|
|
.then(([blockGasPrice, estimatedGas]) => { |
|
|
|
|
|
|
|
this.setState({ |
|
|
|
|
|
|
|
blockGasPrice, |
|
|
|
|
|
|
|
estimatedGas, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SendTransactionScreen.prototype.back = function () { |
|
|
|
SendTransactionScreen.prototype.back = function () { |
|
|
|
var address = this.props.address |
|
|
|
var address = this.props.address |
|
|
|
this.props.dispatch(backToAccountDetail(address)) |
|
|
|
this.props.dispatch(backToAccountDetail(address)) |
|
|
|