mirror of
https://github.com/status-im/visual-identity.git
synced 2025-02-13 04:57:03 +00:00
small cleanup
This commit is contained in:
parent
ea0ea87ba1
commit
46a063bab5
@ -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 (<React.Fragment>
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<h2> Set token contract address</h2>
|
||||
<Form inline>
|
||||
<FormGroup>
|
||||
@ -75,8 +74,6 @@ class ERC20TokenUI extends React.Component {
|
||||
onChange={(e) => this.contractAddress(e)} />
|
||||
</FormGroup>
|
||||
</Form>
|
||||
|
||||
|
||||
<h3> Read account token balance</h3>
|
||||
<Form inline>
|
||||
<FormGroup>
|
||||
@ -90,7 +87,7 @@ class ERC20TokenUI extends React.Component {
|
||||
<label>
|
||||
<HelpBlock><span className="balanceOf">{this.state.balanceOf}</span></HelpBlock>
|
||||
</label>
|
||||
|
||||
|
||||
</FormGroup>
|
||||
</Form>
|
||||
|
||||
@ -115,7 +112,7 @@ class ERC20TokenUI extends React.Component {
|
||||
<Button bsStyle="primary" onClick={(e) => this.approve(e)}>Approve</Button>
|
||||
</FormGroup>
|
||||
</Form>
|
||||
|
||||
|
||||
<h3> Contract Calls </h3>
|
||||
<p>Javascript calls being made: </p>
|
||||
<div className="logs">
|
||||
@ -128,4 +125,4 @@ class ERC20TokenUI extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default ERC20TokenUI;
|
||||
export default ERC20TokenUI;
|
||||
|
@ -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 <React.Fragment>
|
||||
{title}
|
||||
{title}
|
||||
<span className={className}></span>
|
||||
</React.Fragment>;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user