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){ 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
{ this.props.definition.code == "" ?

Interface or set to not deploy

: "" }

Functions

{ this.props.definition.code != "" ? : "" }

Source Code

,
) } }