From 46a063bab53bf2026d0f05385e56886361f15974 Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Mon, 21 May 2018 14:29:57 -0400 Subject: [PATCH] small cleanup --- app/components/erc20token.js | 27 ++++++++++++--------------- app/dapp.js | 7 ++----- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/app/components/erc20token.js b/app/components/erc20token.js index 6695adf..a81fb47 100644 --- a/app/components/erc20token.js +++ b/app/components/erc20token.js @@ -2,20 +2,19 @@ import EmbarkJS from 'Embark/EmbarkJS'; import ERC20Token from 'Embark/contracts/ERC20Token'; import React from 'react'; import { Form, FormGroup, FormControl, HelpBlock, Button } from 'react-bootstrap'; - + class ERC20TokenUI extends React.Component { constructor(props) { super(props); this.state = { - balanceOf: 0, transferTo: "", transferAmount: 0, logs: [] - } - } - + } + } + contractAddress(e){ e.preventDefault(); var tokenAddress = e.target.value; @@ -50,23 +49,23 @@ class ERC20TokenUI extends React.Component { if (EmbarkJS.isNewWeb3()) { ERC20Token.methods.balanceOf(who).call() .then(_value => this.setState({balanceOf: _value})) - + } else { ERC20Token.balanceOf(who) .then(_value => this.x({balanceOf: _value})); } this._addToLog(ERC20Token.options.address+".balanceOf(" + who + ")"); } - + _addToLog(txt){ this.state.logs.push(txt); this.setState({logs: this.state.logs}); } - + render(){ - return ( - + return ( +

Set token contract address

@@ -75,8 +74,6 @@ class ERC20TokenUI extends React.Component { onChange={(e) => this.contractAddress(e)} />
- -

Read account token balance

@@ -90,7 +87,7 @@ class ERC20TokenUI extends React.Component { - +
@@ -115,7 +112,7 @@ class ERC20TokenUI extends React.Component { - +

Contract Calls

Javascript calls being made:

@@ -128,4 +125,4 @@ class ERC20TokenUI extends React.Component { } } - export default ERC20TokenUI; \ No newline at end of file + export default ERC20TokenUI; diff --git a/app/dapp.js b/app/dapp.js index a0744b3..12a1ff0 100644 --- a/app/dapp.js +++ b/app/dapp.js @@ -13,13 +13,10 @@ class App extends React.Component { constructor(props) { super(props); - - } - componentDidMount(){ + componentDidMount(){ __embarkContext.execWhenReady(() => { - }); } @@ -27,7 +24,7 @@ class App extends React.Component { _renderStatus(title, available) { let className = available ? 'pull-right status-online' : 'pull-right status-offline'; return - {title} + {title} ; }