Bytom Desktop Electron App
Revision | 5d94fd899e28d45ebd192dcd22f7275fc1bb00c3 (tree) |
---|---|
Time | 2018-04-21 13:48:15 |
Author | Yongfeng LI <wliyongfeng@gmai...> |
Commiter | Yongfeng LI |
disable submittion when estimate gas fail
@@ -129,6 +129,10 @@ class Form extends React.Component { | ||
129 | 129 | } |
130 | 130 | |
131 | 131 | disableSubmit(actions, normalTransaction) { |
132 | + if (!this.state.showAdvanceTx) { | |
133 | + return !this.state.estimateGas | |
134 | + } | |
135 | + | |
132 | 136 | if (this.state.showAdvanceTx) { |
133 | 137 | return actions.length == 0 && !this.state.showAdvanced |
134 | 138 | } |
@@ -217,6 +221,7 @@ class Form extends React.Component { | ||
217 | 221 | const body = {actions, ttl: 1} |
218 | 222 | this.connection.request('/build-transaction', body).then(resp => { |
219 | 223 | if (resp.status === 'fail') { |
224 | + this.setState({estimateGas: null}) | |
220 | 225 | this.props.showError(new Error(resp.msg)) |
221 | 226 | return |
222 | 227 | } |
@@ -225,6 +230,7 @@ class Form extends React.Component { | ||
225 | 230 | transactionTemplate: resp.data |
226 | 231 | }).then(resp => { |
227 | 232 | if (resp.status === 'fail') { |
233 | + this.setState({estimateGas: null}) | |
228 | 234 | this.props.showError(new Error(resp.msg)) |
229 | 235 | return |
230 | 236 | } |