• R/O
  • HTTP
  • SSH
  • HTTPS

bytom-electron: 提交

Bytom Desktop Electron App


Commit MetaInfo

修订版5d94fd899e28d45ebd192dcd22f7275fc1bb00c3 (tree)
时间2018-04-21 13:48:15
作者Yongfeng LI <wliyongfeng@gmai...>
CommiterYongfeng LI

Log Message

disable submittion when estimate gas fail

更改概述

差异

--- a/src/features/transactions/components/New/New.jsx
+++ b/src/features/transactions/components/New/New.jsx
@@ -129,6 +129,10 @@ class Form extends React.Component {
129129 }
130130
131131 disableSubmit(actions, normalTransaction) {
132+ if (!this.state.showAdvanceTx) {
133+ return !this.state.estimateGas
134+ }
135+
132136 if (this.state.showAdvanceTx) {
133137 return actions.length == 0 && !this.state.showAdvanced
134138 }
@@ -217,6 +221,7 @@ class Form extends React.Component {
217221 const body = {actions, ttl: 1}
218222 this.connection.request('/build-transaction', body).then(resp => {
219223 if (resp.status === 'fail') {
224+ this.setState({estimateGas: null})
220225 this.props.showError(new Error(resp.msg))
221226 return
222227 }
@@ -225,6 +230,7 @@ class Form extends React.Component {
225230 transactionTemplate: resp.data
226231 }).then(resp => {
227232 if (resp.status === 'fail') {
233+ this.setState({estimateGas: null})
228234 this.props.showError(new Error(resp.msg))
229235 return
230236 }
Show on old repository browser