fix array display and setting
This commit is contained in:
parent
a1c33a23a2
commit
551d1e209b
|
@ -5,6 +5,9 @@ import React, { Component, Fragment } from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { FormGroup, ControlLabel, FormControl, Checkbox, Button, Alert, InputGroup } from 'react-bootstrap';
|
import { FormGroup, ControlLabel, FormControl, Checkbox, Button, Alert, InputGroup } from 'react-bootstrap';
|
||||||
|
|
||||||
|
function isSuccess(status) {
|
||||||
|
return status === "0x1" || status === true;
|
||||||
|
}
|
||||||
|
|
||||||
{{#each functions}}
|
{{#each functions}}
|
||||||
class {{capitalize name}}Form{{@index}} extends Component {
|
class {{capitalize name}}Form{{@index}} extends Component {
|
||||||
|
@ -50,7 +53,7 @@ class {{capitalize name}}Form{{@index}} extends Component {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
{{#ifview stateMutability}}
|
{{#ifview stateMutability}}
|
||||||
const result = await {{../contractName}}.methods{{methodname ../functions name inputs}}({{#each inputs}}input.{{#ifeq name ''}}field{{else}}{{trim name}}{{/ifeq}}{{#unless @last}}, {{/unless}}{{/each}}).call()
|
const result = await {{../contractName}}.methods{{methodname ../functions name inputs}}({{#each inputs}}input.{{#ifeq name ''}}field{{else}}{{trim name}}{{/ifeq}}{{#unless @last}}, {{/unless}}{{/each}}).call();
|
||||||
{{#iflengthgt outputs 1}}
|
{{#iflengthgt outputs 1}}
|
||||||
this.setState({output: {
|
this.setState({output: {
|
||||||
{{#each outputs}}
|
{{#each outputs}}
|
||||||
|
@ -141,7 +144,7 @@ class {{capitalize name}}Form{{@index}} extends Component {
|
||||||
{{#iflengthgt outputs 1}}
|
{{#iflengthgt outputs 1}}
|
||||||
<ul>
|
<ul>
|
||||||
{{#each outputs}}
|
{{#each outputs}}
|
||||||
<li>{{emptyname name @index}}: { output.{{emptyname name @index}} }</li>
|
<li>{{emptyname name @index}}: { JSON.stringify(output.{{emptyname name @index}}) }</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
@ -154,7 +157,7 @@ class {{capitalize name}}Form{{@index}} extends Component {
|
||||||
{
|
{
|
||||||
receipt &&
|
receipt &&
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<Alert bsStyle={receipt.status === "0x1" ? 'success' : 'danger'}>{receipt.status === "0x1" ? 'Success' : 'Failure / Revert'} - Transaction Hash: {receipt.transactionHash}</Alert>
|
<Alert bsStyle={isSuccess(receipt.status) ? 'success' : 'danger'}>{isSuccess(receipt.status) ? 'Success' : 'Failure / Revert'} - Transaction Hash: {receipt.transactionHash}</Alert>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue