diff --git a/app/components/SetDelegate.js b/app/components/SetDelegate.js deleted file mode 100644 index a3efa9c..0000000 --- a/app/components/SetDelegate.js +++ /dev/null @@ -1,63 +0,0 @@ -import DelegationModel from '../models/DelegationModel'; -import React from 'react'; -import { Form, FormGroup, FormControl, HelpBlock, Button } from 'react-bootstrap'; - - -class SetDelegateUI extends React.Component { - - constructor(props) { - super(props); - this.state = { - delegatedTo: "", - delegation: [], - error: null - } - this.model = new DelegationModel(props.address); - } - - handleDelegateChange(e){ - this.setState({delegatedTo: e.target.value}); - } - componentDidMount() { - this.model.delegationOf(web3.eth.defaultAccount).then(console.log); - this.model.delegatedTo(web3.eth.defaultAccount).then((ret)=> { - this.setState({delegatedTo: ret}) - }); - - } - delegate(e){ - e.preventDefault(); - this.model.delegate(web3.eth.defaultAccount, this.state.delegatedTo) - .once('transactionHash', function(hash){ console.log("once txhash", hash) }) - .once('receipt', function(receipt){ console.log("once receipt", receipt) }) - .on('confirmation', function(confNumber, receipt){ console.log("on confirmation", confNumber,receipt) }) - .on('error', function(error){ console.log("on error", error) }) - .then(function(receipt){ - console.log("then receipt", receipt) - }); - - } - - render(){ - let error = this.state.error; - return ( - { error != null && {error} } -

Delegation

-
- - this.handleDelegateChange(e)} /> - - - -
- - -
- ); - } - } - -export default SetDelegateUI; diff --git a/app/components/TestStatusNetwork.js b/app/components/TestStatusNetwork.js deleted file mode 100644 index e974e51..0000000 --- a/app/components/TestStatusNetwork.js +++ /dev/null @@ -1,50 +0,0 @@ -import EmbarkJS from 'Embark/EmbarkJS'; -import StatusRoot from 'Embark/contracts/StatusRoot'; -import MiniMeToken from 'Embark/contracts/MiniMeToken'; -import React from 'react'; -import { Form, FormGroup, FormControl, HelpBlock, Button } from 'react-bootstrap'; -import ERC20TokenUI from './erc20token'; - -class TestTokenUI extends React.Component { - - constructor(props) { - super(props); - this.state = { - amountToMint: 100, - } - } - - handleMintAmountChange(e){ - this.setState({amountToMint: e.target.value}); - } - - async mint(e){ - e.preventDefault(); - await EmbarkJS.enableEthereum(); - var value = parseInt(this.state.amountToMint, 10); - StatusRoot.methods.mint(value).send({ gas: 1000000 }) - - console.log(StatusRoot.options.address +".mint("+value+").send({from: " + web3.eth.defaultAccount + "})"); - } - - render(){ - return ( -

Test Status Network

-
- - this.handleMintAmountChange(e)} /> - - -
- - - -
- ); - } - } - -export default TestTokenUI; diff --git a/app/components/accountList.js b/app/components/accountList.js deleted file mode 100644 index adcd873..0000000 --- a/app/components/accountList.js +++ /dev/null @@ -1,66 +0,0 @@ -import web3 from 'Embark/web3' -import React from 'react'; -import { connect } from 'react-redux'; -import { Nav, MenuItem, NavDropdown } from 'react-bootstrap'; -import Blockies from 'react-blockies'; -import { string, bool, func, arrayOf, shape } from 'prop-types'; -import { getAccounts, getDefaultAccount, accountsIsLoading, actions as accountActions } from '../reducers/accounts'; -import './accountlist.css'; - -const AccList = ({ - accounts, defaultAccount, changeAccount, isLoading, classNameNavDropdown, -}) => ( - - {!isLoading ? -
-
- -
-
- -
-
- :
Loading...
} -
-); - -AccList.propTypes = { - accounts: arrayOf(shape({ address: string, balance: string })).isRequired, - defaultAccount: string, - changeAccount: func.isRequired, - isLoading: bool.isRequired, - classNameNavDropdown: string -} - -const mapStateToProps = state => ({ - accounts: getAccounts(state), - defaultAccount: getDefaultAccount(state), - isLoading: accountsIsLoading(state), -}); - -const mapDispatchToProps = dispatch => ({ - changeAccount(address) { - web3.eth.defaultAccount = address; - dispatch(accountActions.updateDefaultAccount(address)); - }, -}); - -export default connect(mapStateToProps, mapDispatchToProps)(AccList); diff --git a/app/components/erc20token.js b/app/components/erc20token.js deleted file mode 100644 index 7b8ffdf..0000000 --- a/app/components/erc20token.js +++ /dev/null @@ -1,114 +0,0 @@ -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); - ERC20Token.options.address = props.address; - this.state = { - balanceOf: 0, - transferTo: "", - transferAmount: 0, - accountBalance: 0, - accountB: web3.eth.defaultAccount, - } - } - - update_transferTo(e){ - this.setState({transferTo: e.target.value}); - } - - update_transferAmount(e){ - this.setState({transferAmount: e.target.value}); - } - - transfer(e){ - var to = this.state.transferTo; - var amount = this.state.transferAmount; - this._addToLog(ERC20Token.options.address+".methods.transfer(" + to + ", "+amount+").send({from: " + web3.eth.defaultAccount + "})"); - var tx = ERC20Token.methods.transfer(to, amount); - tx.estimateGas().then((r) => { - tx.send({gas: r, from: web3.eth.defaultAccount}); - }); - - } - - approve(e){ - var to = this.state.transferTo; - var amount = this.state.transferAmount; - this._addToLog(ERC20Token.options.address+".methods.approve(" + to + ", "+amount+").send({from: " + web3.eth.defaultAccount + "})"); - var tx = ERC20Token.methods.approve(to, amount).send({from: web3.eth.defaultAccount}); - - } - - balanceOf(e){ - e.preventDefault(); - var who = e.target.value; - this._addToLog(ERC20Token.options.address+".methods.balanceOf(" + who + ").call()"); - ERC20Token.methods.balanceOf(who).call() - .then(_value => this.setState({balanceOf: _value})) - } - - getDefaultAccountBalance(){ - this._addToLog(ERC20Token.options.address + ".methods.balanceOf(" + web3.eth.defaultAccount + ").call()"); - ERC20Token.methods.balanceOf(web3.eth.defaultAccount).call() - .then(_value => this.setState({accountBalance: _value})) - } - - _addToLog(txt){ - console.log(txt); - } - - render() { - - return ( - -

Read account token balance

-
- - - - - -
- -

Transfer/Approve token balance

-
- - - - - - -
- -
- ); - } -} - - -export default ERC20TokenUI;