import React from 'react'; import ReactDOM from 'react-dom'; import EmbarkJS from 'Embark/EmbarkJS'; import MultiSigWallet from 'Embark/contracts/MultiSigWallet'; import MultiSigWalletUI from './components/multisigwallet'; import MultiSigLoader from './components/multisigloader'; import { Alert, FormGroup, ControlLabel, FormControl } from 'react-bootstrap'; import { HashRouter, Route, Redirect } from "react-router-dom"; import './dapp.css'; class App extends React.Component { constructor(props) { super(props); this.state = { error: null, activeKey: 1, blockchainEnabled: false , mswInstance: null, account: null, isOwner: false, }; this.onMultiSigReady = this.onMultiSigReady.bind(this); } componentDidMount() { EmbarkJS.onReady((err) => { this.setState({blockchainEnabled: true}); if (err) { // If err is not null then it means something went wrong connecting to ethereum // you can use this to ask the user to enable metamask for e.g return this.setState({error: err.message || err}); } }); } onMultiSigReady(instance, account, isOwner) { this.setState({isOwner:isOwner, account: account, mswInstance: instance}); } render() { if (!this.state.blockchainEnabled) { return (
Waiting for blockchain.
) } if (this.state.error) { return (
Something went wrong connecting to ethereum. Please make sure you have a node running or are using metamask to connect to the ethereum network:
{this.state.error}
); } if(!this.state.mswInstance){ return ( ( )} /> ( )} /> ); } else { return( ( )} /> ( props.match.params.address != this.state.mswInstance._address && )} /> ); } } } ReactDOM.render(, document.getElementById('app'));