From 551d1e209b5da78b08f0e17e695e8db2b6bcd14a Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 18 Oct 2018 11:51:37 -0400 Subject: [PATCH] fix array display and setting --- lib/modules/scaffolding-react/templates/dapp.js.hbs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/modules/scaffolding-react/templates/dapp.js.hbs b/lib/modules/scaffolding-react/templates/dapp.js.hbs index 7a857ba1..fa2ea243 100644 --- a/lib/modules/scaffolding-react/templates/dapp.js.hbs +++ b/lib/modules/scaffolding-react/templates/dapp.js.hbs @@ -5,6 +5,9 @@ import React, { Component, Fragment } from 'react'; import ReactDOM from 'react-dom'; import { FormGroup, ControlLabel, FormControl, Checkbox, Button, Alert, InputGroup } from 'react-bootstrap'; +function isSuccess(status) { + return status === "0x1" || status === true; +} {{#each functions}} class {{capitalize name}}Form{{@index}} extends Component { @@ -50,7 +53,7 @@ class {{capitalize name}}Form{{@index}} extends Component { try { {{#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}} this.setState({output: { {{#each outputs}} @@ -141,7 +144,7 @@ class {{capitalize name}}Form{{@index}} extends Component { {{#iflengthgt outputs 1}} {{else}} @@ -154,7 +157,7 @@ class {{capitalize name}}Form{{@index}} extends Component { { receipt && - {receipt.status === "0x1" ? 'Success' : 'Failure / Revert'} - Transaction Hash: {receipt.transactionHash} + {isSuccess(receipt.status) ? 'Success' : 'Failure / Revert'} - Transaction Hash: {receipt.transactionHash} }