From 34e4d562e38834b1320cb9c0f29fde44c3dacd05 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Wed, 3 Oct 2018 09:36:13 -0400 Subject: [PATCH] Adding React --- app/index.html | 5 ++--- app/js/index.js | 19 ++++++++++++++++--- package.json | 19 +++++++++++++++++-- server/main.js | 2 +- 4 files changed, 36 insertions(+), 9 deletions(-) diff --git a/app/index.html b/app/index.html index 8068e7c..884ce96 100644 --- a/app/index.html +++ b/app/index.html @@ -2,10 +2,9 @@ Embark - -

Welcome to Embark!

-

See the Embark's documentation to see what you can do with Embark!

+
+ diff --git a/app/js/index.js b/app/js/index.js index 5b0f64d..f7e353a 100644 --- a/app/js/index.js +++ b/app/js/index.js @@ -1,6 +1,19 @@ +import React, { Fragment } from 'react'; +import ReactDOM from 'react-dom'; import EmbarkJS from 'Embark/EmbarkJS'; - -// import your contracts -// e.g if you have a contract named SimpleStorage: +import web3 from 'Embark/web3' //import SimpleStorage from 'Embark/contracts/SimpleStorage'; +class App extends React.Component { + constructor(props) { + super(props); + } + + render(){ + return

Hello World

+ + } + } + + +ReactDOM.render(, document.getElementById('app')); diff --git a/package.json b/package.json index da1a10e..6cd3ef1 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,17 @@ "license": "ISC", "homepage": "", "devDependencies": { - "nodemon": "^1.18.4" + "nodemon": "^1.18.4", + "@babel/plugin-proposal-class-properties": "^7.0.0", + "@babel/plugin-proposal-decorators": "^7.0.0", + "@babel/plugin-proposal-export-namespace-from": "^7.0.0", + "@babel/plugin-proposal-function-sent": "^7.0.0", + "@babel/plugin-proposal-json-strings": "^7.0.0", + "@babel/plugin-proposal-numeric-separator": "^7.0.0", + "@babel/plugin-proposal-object-rest-spread": "^7.0.0", + "@babel/plugin-proposal-throw-expressions": "^7.0.0", + "@babel/plugin-syntax-dynamic-import": "^7.0.0", + "@babel/plugin-syntax-import-meta": "^7.0.0" }, "dependencies": { "crypto": "^1.0.1", @@ -19,6 +29,11 @@ "ipfs-api": "^24.0.2", "merkle-tree-solidity": "^1.0.8", "orbit-db": "^0.19.9", - "web3": "^1.0.0-beta.34" + "web3": "^1.0.0-beta.34", + "@material-ui/core": "^3.0.0", + "@material-ui/icons": "^3.0.0", + "@material-ui/lab": "^1.0.0-alpha.12", + "react": "^16.4.2", + "react-dom": "^16.4.2" } } diff --git a/server/main.js b/server/main.js index b681202..30d4a79 100644 --- a/server/main.js +++ b/server/main.js @@ -5,7 +5,7 @@ const EventEmitter = require('events'); const contractAddress = "0xA49e638dD086E38Dac737C9346909f62DDf7d387"; const connectionURL = `ws://localhost:8546`; -const abiDefinition = [{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"codeUsed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x39c6fe16"},{"constant":false,"inputs":[{"name":"_newController","type":"address"}],"name":"changeController","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x3cebb823"},{"constant":false,"inputs":[{"name":"_proof","type":"bytes32[]"},{"name":"code","type":"bytes32"},{"name":"_leaf","type":"bytes32"},{"name":"_dest","type":"address"}],"name":"send","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x6c1101c9"},{"constant":true,"inputs":[],"name":"sntAmount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x7f58fa14"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"sentToAddress","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x81e8706d"},{"constant":false,"inputs":[],"name":"boom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xa169ce09"},{"constant":false,"inputs":[{"name":"_ethAmount","type":"uint256"},{"name":"_sntAmount","type":"uint256"},{"name":"_root","type":"bytes32"}],"name":"updateSettings","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xa4438334"},{"constant":true,"inputs":[],"name":"SNT","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xc55a02a0"},{"constant":true,"inputs":[],"name":"ethAmount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xc98166c0"},{"constant":true,"inputs":[],"name":"root","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xebf0c717"},{"constant":true,"inputs":[],"name":"controller","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xf77c4791"},{"inputs":[{"name":"_tokenAddress","type":"address"},{"name":"_ethAmount","type":"uint256"},{"name":"_sntAmount","type":"uint256"},{"name":"_root","type":"bytes32"}],"payable":true,"stateMutability":"payable","type":"constructor","signature":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"dest","type":"address"},{"indexed":false,"name":"leaf","type":"bytes32"},{"indexed":false,"name":"ethAmount","type":"uint256"},{"indexed":false,"name":"sntAmount","type":"uint256"}],"name":"AddressFunded","type":"event","signature":"0xd692fa6f47b47bb192b78e1ec163f648fc83f1f87f1caf3dd4640106e052a3f2"}]; +const abiDefinition = [ { "constant": false, "inputs": [ { "name": "_newController", "type": "address" } ], "name": "changeController", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x3cebb823" }, { "constant": true, "inputs": [ { "name": "", "type": "bytes5" } ], "name": "codeUsed", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x723de5cd" }, { "constant": false, "inputs": [ { "name": "_proof", "type": "bytes32[]" }, { "name": "_code", "type": "bytes5" }, { "name": "_dest", "type": "address" } ], "name": "processRequest", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x72d209f5" }, { "constant": true, "inputs": [], "name": "sntAmount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x7f58fa14" }, { "constant": true, "inputs": [ { "name": "", "type": "address" } ], "name": "sentToAddress", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x81e8706d" }, { "constant": false, "inputs": [], "name": "boom", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0xa169ce09" }, { "constant": false, "inputs": [ { "name": "_ethAmount", "type": "uint256" }, { "name": "_sntAmount", "type": "uint256" }, { "name": "_root", "type": "bytes32" } ], "name": "updateSettings", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0xa4438334" }, { "constant": true, "inputs": [ { "name": "_proof", "type": "bytes32[]" }, { "name": "_code", "type": "bytes5" }, { "name": "_dest", "type": "address" } ], "name": "validRequest", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xadb187bb" }, { "constant": true, "inputs": [], "name": "SNT", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xc55a02a0" }, { "constant": true, "inputs": [], "name": "ethAmount", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xc98166c0" }, { "constant": true, "inputs": [], "name": "root", "outputs": [ { "name": "", "type": "bytes32" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xebf0c717" }, { "constant": true, "inputs": [], "name": "controller", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0xf77c4791" }, { "inputs": [ { "name": "_sntAddress", "type": "address" }, { "name": "_ethAmount", "type": "uint256" }, { "name": "_sntAmount", "type": "uint256" }, { "name": "_root", "type": "bytes32" } ], "payable": false, "stateMutability": "nonpayable", "type": "constructor", "signature": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "dest", "type": "address" }, { "indexed": false, "name": "code", "type": "bytes5" }, { "indexed": false, "name": "ethAmount", "type": "uint256" }, { "indexed": false, "name": "sntAmount", "type": "uint256" } ], "name": "AddressFunded", "type": "event", "signature": "0x0aa7ecfdc9fd3f39ab380a0b6413557f94ed0dfd05ed31c925521736fa750eac" } ] ; const events = new EventEmitter(); const ipfs = new IPFS({