class ContractUI extends React.Component { constructor(props) { super(props); this.updateInstances = this.updateInstances.bind(this); this.updateAccounts = this.updateAccounts.bind(this); this.handleInstanceSelection = this.handleInstanceSelection.bind(this); this.handleMenuClick = this.handleMenuClick.bind(this); this.state = { accounts: [], instances: [], selectedInstance: null, updateAccounts: this.updateAccounts, updateInstances: this.updateInstances, selectedTab: 'deploy' }; if(props.contract.options.address != null){ this.state.instances = [props.contract.options.address]; this.state.selectedInstance = props.contract.options.address; } } componentDidMount(){ this.updateAccounts(); } handleMenuClick(e){ console.log(e.target); e.preventDefault(); this.setState({ selectedTab: e.target.getAttribute('data-target') }); } async updateAccounts(){ 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}); } updateInstances(_instance){ this.state.instances.push(_instance); this.setState({ instances: this.state.instances }); } handleInstanceSelection(_instance){ this.props.contract.options.address = _instance; this.setState({ selectedInstance: _instance }) } render() { return (

{this.props.name}

Deployment Utils

Deploy

Functions

Source Code

,
) } }