reactor.jsx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //TODO: Add control panel. Starts mining & unlocks + result view (instead of JS console)
  2. //TODO: config.json doesn't feel 100% the best route to take... Potentially refactor into one, and allow rewriting of it (when addresses are created)
  3. //TODO: Templating should be derived from the .sol eventually.
  4. var Reactor = React.createClass({
  5. render: function() {
  6. return (
  7. <div>
  8. {Object.keys(this.props.compiled).map(function(result) { //iterate through multiple contracts based on keys
  9. //console.log(this.props.compiled[result]);
  10. //var abi = this.props.compiled[result].info.abiDefinition;
  11. var contract = web3.eth.contract(this.props.compiled[result].info.abiDefinition);
  12. var instance = contract.at(this.props.addresses[result]);
  13. <hr/>
  14. var contract_template = {};
  15. var new_compiled = this.props.compiled;
  16. var abi = this.props.compiled[result].info.abiDefinition;
  17. if(this.props.options[result]["template_overlay"] == false) {
  18. //remove parts of the ABI.
  19. $.each(abi, function(i, obj) {
  20. if(obj.name != undefined) {
  21. //console.log(this.props.templates[result]);
  22. if(this.props.templates[result].hasOwnProperty(obj.name) == false) {
  23. console.log("deleting part of abi");
  24. console.log(abi[i]);
  25. delete abi[i];
  26. }
  27. }
  28. }.bind(this));
  29. console.log("false");
  30. }
  31. if(this.props.templates.hasOwnProperty(result)) {
  32. contract_template = this.props.templates[result]; //if a contract has a template.
  33. }
  34. return (
  35. <div key={result}>
  36. <ContractWrapper key={result} name={result} contract_template={contract_template} compiled={this.props.compiled[result]} instance={instance} />
  37. </div>
  38. )
  39. }, this)}
  40. </div>
  41. );
  42. }
  43. });