diff --git a/app/components/account-list.js b/app/components/account-list.js
deleted file mode 100644
index 3aba166..0000000
--- a/app/components/account-list.js
+++ /dev/null
@@ -1,53 +0,0 @@
-class AccountList extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- error: false,
- errorMessage: "",
- accounts: []
- };
-
- this.handleClick = this.handleClick.bind(this);
- }
-
- async handleClick(e){
- e.preventDefault();
-
- try {
- let accounts = await web3.eth.getAccounts();
- window.accounts = accounts;
-
- console.log("%cawait web3.eth.getAccounts()", 'font-weight: bold');
- console.log(accounts);
-
- this.setState({accounts: accounts});
-
- this.props.accountUpdate(accounts);
- } catch(err) {
- this.setState({
- error: true,
- errorMessage: e.name + ': ' + e.message
- })
- }
-
- }
-
- render(){
- return
-
Get Accounts
-
-
- await web3.eth.getAccounts();
-
- {
- this.state.accounts.length > 0 ?
-
accounts variable is available in the console
- : ""
- }
- {this.state.error ? '
' + this.state.errorMessage + '
' : ''}
-
-
;
- }
-}
-
-export default AccountList;
diff --git a/app/components/contract-ui.js b/app/components/contract-ui.js
deleted file mode 100644
index 6d6726b..0000000
--- a/app/components/contract-ui.js
+++ /dev/null
@@ -1,67 +0,0 @@
-import Tab from './tab';
-import AccountList from './account-list';
-import SourceArea from './source-area';
-import InstanceSelector from './instance-selector';
-import FunctionArea from './function-area';
-
-class ContractUI extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- accounts: [],
- instances: [],
- selectedInstance: null
- };
-
- if(props.contract.options.address != null){
- this.state.instances = [props.contract.options.address];
- this.state.selectedInstance = props.contract.options.address;
- }
-
- this.handleAccountUpdate = this.handleAccountUpdate.bind(this);
- this.handleInstanceSelection = this.handleInstanceSelection.bind(this);
- }
-
- handleAccountUpdate(_accounts){
- this.setState({
- accounts: _accounts
- });
- }
-
- handleInstanceSelection(_instance){
- this.props.contract.options.address = _instance;
- this.setState({
- selectedInstance: _instance
- })
- }
-
- render() {
- return
-
{this.props.name} contract
-
Open your browser's console: Tools > Developer Tools
-
Remix: http://remix.ethereum.org
-
-
-
-
- Deploy
-
-
-
-
-
-
-
-
-
-
-
-
;
- }
-}
-
-export default ContractUI;
\ No newline at end of file
diff --git a/app/components/function-area.js b/app/components/function-area.js
deleted file mode 100644
index d038c9d..0000000
--- a/app/components/function-area.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import FunctionForm from './function-form';
-
-class FunctionArea extends React.Component {
- constructor(props) {
- super(props);
- this.state = { };
- }
-
- render(){
- const type = this.props.type;
- const contract = this.props.contract;
- const contractName = this.props.contractName;
- const accounts = this.props.accounts;
-
- return
- {
- this.props.contract.options.jsonInterface
- .filter(item => item.type == type)
- .map((item, i) => )
- }
-
;
- }
-}
-
-export default FunctionArea;
\ No newline at end of file
diff --git a/app/components/function-form.js b/app/components/function-form.js
deleted file mode 100644
index 6806fe1..0000000
--- a/app/components/function-form.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import Function from './function';
-
-class FunctionForm extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- fields: {}
- };
- }
-
-
-
- _getFunctionParamFields(elem){
- if(this.props.abi.type == 'fallback') return '';
-
- return '(' + this.props.abi.inputs
- .map((input, i) => )
- .join(', ') + ')';
- }
-
- _getMethodType(elem){
- return (this.props.abi.constant == true || this.props.abi.stateMutability == 'view' || this.props.abi.stateMutability == 'pure') ? 'call' : 'send';
- }
-
- render(){
- const functionName = this.props.abi.name;
- const isDuplicated = this.props.contract.options.jsonInterface.filter(x => x.name == functionName).length > 1;
-
- return
-
{this.props.abi.type == 'function' ? this.props.abi.name : (this.props.abi.type == 'fallback' ? '(fallback)' : this.props.abi.name)}
-
-
;
- }
-}
-
-export default FunctionForm;
\ No newline at end of file
diff --git a/app/components/function.js b/app/components/function.js
deleted file mode 100644
index 4b2cfc9..0000000
--- a/app/components/function.js
+++ /dev/null
@@ -1,116 +0,0 @@
-class Function extends React.Component {
-
- constructor(props) {
- super(props);
- this.state = {
- fields: {},
- methodFields: {
- from: '',
- to: '',
- value: 0,
- data: '',
- gasLimit: '700000'
- }
- };
-
- this.handleParameterChange = this.handleParameterChange.bind(this);
- this.handleMethodFieldChange = this.handleMethodFieldChange.bind(this);
- }
-
- handleParameterChange(e){
- let newState = this.state;
- newState.fields[e.target.getAttribute('data-name')] = e.target.value;
- this.setState(newState);
- }
-
- handleMethodFieldChange(e){
- let newState = this.state;
- newState.methodFields[e.target.getAttribute('data-param')] = e.target.value;
- this.setState(newState);
- }
-
- _getFunctionLabel(){
- if(this.props.abi.type == 'function')
- if(!this.props.duplicated)
- return `${this.props.contract}.methods.${this.props.abi.name}`;
- else {
- return `${this.props.contract}.methods['${this.props.abi.name + '(' + (this.props.abi.inputs != null ? this.props.abi.inputs.map(input => input.type).join(',') : '') + ')'}']`;
- }
- else if(this.props.abi.type == 'fallback'){
- return `web3.eth.sendTransaction`;
- }
- else
- return `${this.props.contract}.deploy`;
- }
-
- _getMethodType(){
- return (this.props.abi.constant == true || this.props.abi.stateMutability == 'view' || this.props.abi.stateMutability == 'pure') ? 'call' : 'send';
- }
-
- _getMethodFields(){
- let methodParams;
- return
- from:
- {
- this.props.abi.payable ?
- , value:
-
-
- : ''
- }
- {
- this._getMethodType() == 'send' ?
- , gasLimit:
-
-
- : ''
- }
- {
- this._getMethodType() == 'send' && this.props.abi.type == 'fallback' ?
- , data:
-
-
- : ''
- }
- ;
- }
-
-
- _getFunctionParamFields(){
- return
- {
- this.props.abi.inputs
- .map((input, i) => )
- .reduce((accu, elem) => {
- return accu === null ? [elem] : [...accu, ', ', elem]
- }, null)
- }
- ;
- }
-
- render(){
- return
- await {this._getFunctionLabel()}
- { this.props.abi.type != 'fallback' ? '(' : '' }
- { this.props.abi.type != 'fallback' ? this._getFunctionParamFields() : '' }
- { this.props.abi.type != 'fallback' ? ')' : '' }
- { this.props.abi.type != 'fallback' ? '.' + this._getMethodType() : '' }
- ({ this._getMethodFields() })
-
-
- ;
- }
-
-}
-
-export default Function;
\ No newline at end of file
diff --git a/app/components/instance-selector.js b/app/components/instance-selector.js
deleted file mode 100644
index 19582be..0000000
--- a/app/components/instance-selector.js
+++ /dev/null
@@ -1,100 +0,0 @@
-class InstanceSelector extends React.Component {
-
- constructor(props) {
- super(props);
- this.state = {
- showInstances: false,
- showCustomAddressField: false,
- selectedInstance: props.selectedInstance,
- customInstance: "",
- error: false,
- errorMessage: ""
- };
-
- this.handleShowInstances = this.handleShowInstances.bind(this);
- this.handleChange = this.handleChange.bind(this);
- this.handleClick = this.handleClick.bind(this);
- this.handleTextChange = this.handleTextChange.bind(this);
- }
-
- handleTextChange(e){
- this.setState({customInstance: e.target.value});
- }
-
- handleShowInstances(e){
- e.preventDefault();
- this.setState({
- showInstances: !this.state.showInstances
- });
- }
-
- handleClick(e){
- e.preventDefault();
-
- let instance;
- if(this.state.selectedInstance == "custom"){
- instance = this.state.customInstance;
- } else {
- instance = this.state.selectedInstance;
- }
-
- if(!/^0x[0-9a-f]{40}$/i.test(instance)){
- this.setState({error: true, errorMessage: 'Not a valid Ethereum address.'});
- console.log(this.state.errorMessage);
- return;
- } else {
- this.setState({error: false});
- }
-
- this.props.instanceUpdate(instance);
-
- this.setState({
- showInstances: false,
- showCustomAddressField: false,
- selectedInstance: instance,
- customInstance: this.state.selectedInstance == "custom" ? this.state.customInstance : ""
- })
- }
-
- handleChange(e){
- this.setState({
- showCustomAddressField: e.target.value == "custom",
- selectedInstance: e.target.value
- });
- }
-
- render(){
-
- return
-
- Instance Selected: {this.props.selectedInstance != null ? this.props.selectedInstance : 'none'}
- {!this.state.showInstances ? Change : Cancel }
-
- {this.state.showInstances ?
-
-
- {
- this.state.showCustomAddressField ?
-
- : ''
- }
-
- {
- this.state.error ?
-
{this.state.errorMessage}
- : ""
- }
-
: "" }
-
;
- }
-
-}
-
-export default InstanceSelector;
\ No newline at end of file
diff --git a/app/components/source-area.js b/app/components/source-area.js
deleted file mode 100644
index ece36b7..0000000
--- a/app/components/source-area.js
+++ /dev/null
@@ -1,27 +0,0 @@
-class SourceArea extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- sourceCode: ""
- };
- }
-
- componentDidMount(){
- fetch(this.props.sourceURL)
- .then(response => response.text())
- .then(text => {
- let colorCodedText = hljs.highlight('javascript', text, true).value;
- this.setState({sourceCode: colorCodedText});
- });
- }
-
- render(){
- return
-
{this.props.sourceURL.split('\\').pop().split('/').pop()}
-
{this.props.sourceURL}
-
-
;
- }
-}
-
-export default SourceArea;
\ No newline at end of file
diff --git a/app/components/tab.js b/app/components/tab.js
deleted file mode 100644
index 80006f0..0000000
--- a/app/components/tab.js
+++ /dev/null
@@ -1,10 +0,0 @@
-class Tab extends React.Component {
- render(){
- return
-
{this.props.name}
- { this.props.children }
- ;
- }
-}
-
-export default Tab;
\ No newline at end of file
diff --git a/app/react-dapp.js b/app/react-dapp.js
deleted file mode 100644
index ba6326d..0000000
--- a/app/react-dapp.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import 'bootstrap';
-import 'bootstrap/dist/css/bootstrap.min.css';
-import './dapp.css';
-
-import EmbarkJS from 'Embark/EmbarkJS';
-import IdentityFactory from 'Embark/contracts/IdentityFactory';
-
-import ContractUI from './components/contract-ui';
-
-
-__embarkContext.execWhenReady(function(){
-
- // Each contract should be awailable on window
- window["IdentityFactory"] = IdentityFactory;
- ReactDOM.render(
- ,
- document.getElementById('root')
- );
-
-
-});
diff --git a/app/react-version.html b/app/react-version.html
deleted file mode 100644
index 04cf4cb..0000000
--- a/app/react-version.html
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
- Contract UI
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/embark.json b/embark.json
index 2ee7064..9a18ff8 100644
--- a/embark.json
+++ b/embark.json
@@ -2,9 +2,9 @@
"contracts": ["contracts/**"],
"app": {
"js/dapp.js": ["app/dapp.js"],
- "js/react-dapp.js": ["app/react-dapp.js"],
+ "contracts-section.js": ["app/react/contracts-section.js"],
"index.html": "app/index.html",
- "react-version.html": "app/react-version.html",
+ "contracts-section.html": "app/react/contracts-section.html",
"images/": ["app/images/**"]
},
"buildDir": "dist/",