From 4d5e67d40d0a048fbe24ce9bd20ab0945c97c65d Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt Date: Thu, 28 Mar 2019 20:16:54 -0300 Subject: [PATCH] merge bootstrap --- .babelrc | 3 -- .eslintrc.json | 9 ---- .gitignore | 8 +++- app/dapp.css | 22 ++++------ app/dapp.js | 69 ++++++++++++++++++++++++------- app/images/.gitkeep | 0 app/index.html | 4 +- app/index.js | 9 ---- config/blockchain.js | 73 ++++++++++++++++----------------- config/communication.js | 20 ++++++--- config/contracts.js | 71 +++++++++++++++----------------- config/development/genesis.json | 18 -------- config/namesystem.js | 19 ++++++++- config/pipeline.js | 4 ++ config/storage.js | 27 ++---------- config/webserver.js | 3 +- embark.json | 15 ++++--- package.json | 18 ++------ 18 files changed, 196 insertions(+), 196 deletions(-) delete mode 100644 .babelrc delete mode 100644 .eslintrc.json create mode 100644 app/images/.gitkeep delete mode 100644 app/index.js delete mode 100644 config/development/genesis.json create mode 100644 config/pipeline.js diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 1320b9a..0000000 --- a/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["@babel/preset-env"] -} diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index f8ab647..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "airbnb", - "plugins": [ - "react" - ], - "rules": { - "react/prop-types": 0 - } -} diff --git a/.gitignore b/.gitignore index 69edf80..64838b8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,13 +4,17 @@ __pycache__/ *$py.class # embark -.embark/ +.embark chains.json .password +flattenedContracts +embarkArtifacts config/livenet/password config/production/password +dist embarkArtifacts + # egg-related viper.egg-info/ build/ @@ -43,4 +47,4 @@ package-lock.json # other .vs/ bin/ -.trash \ No newline at end of file +.trash/ diff --git a/app/dapp.css b/app/dapp.css index 0fd02eb..401124e 100644 --- a/app/dapp.css +++ b/app/dapp.css @@ -1,18 +1,8 @@ -.navbar { - -} -.accounts { - float: right; - margin-right: 17px; - font-family: monospace; +div { + margin: 15px; } -.identicon { - border-radius: 50%; -} - - .logs { background-color: black; font-size: 14px; @@ -59,5 +49,9 @@ } input.form-control { - margin: 5px; -} \ No newline at end of file + margin-right: 5px; +} + +.alert-result { + margin-left: 0; +} diff --git a/app/dapp.js b/app/dapp.js index b2473b5..6ec99eb 100644 --- a/app/dapp.js +++ b/app/dapp.js @@ -1,42 +1,81 @@ import React from 'react'; -import { Tabs, Tab } from 'react-bootstrap'; +import ReactDOM from 'react-dom'; +import {Tabs, Tab} from 'react-bootstrap'; + import EmbarkJS from 'Embark/EmbarkJS'; import TestStatusNetworkUI from './components/TestStatusNetwork'; import './dapp.css'; -class DApp extends React.Component { +class App extends React.Component { constructor(props) { super(props); - + this.handleSelect = this.handleSelect.bind(this); + + this.state = { + error: null, + activeKey: 1, + whisperEnabled: false, + storageEnabled: false, + blockchainEnabled: false + }; } - componentDidMount(){ + 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}); + } + EmbarkJS.Messages.Providers.whisper.getWhisperVersion((err, _version) => { + if (err) { + return console.log(err); + } + this.setState({whisperEnabled: true}); + }); + + EmbarkJS.Storage.isAvailable().then((result) => { + this.setState({storageEnabled: result}); + }).catch(() => { + this.setState({storageEnabled: false}); + }); + }); } - _renderStatus(title, available) { let className = available ? 'pull-right status-online' : 'pull-right status-offline'; return - {title} + {title} ; } - render(){ - return ( -
+ handleSelect(key) { + this.setState({ activeKey: key }); + } - - - - - + render() { + const ensEnabled = EmbarkJS.Names.currentNameSystems && EmbarkJS.Names.isAvailable(); + 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}
); + } + return (
+

Status Network - Test

+ + + + + +
); } } -export default DApp; +ReactDOM.render(, document.getElementById('app')); diff --git a/app/images/.gitkeep b/app/images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/index.html b/app/index.html index 43438ee..6d8bb3b 100644 --- a/app/index.html +++ b/app/index.html @@ -1,12 +1,12 @@ - Status.im - Contracts + Status Network - Test Demo
- + diff --git a/app/index.js b/app/index.js deleted file mode 100644 index 7b8b2b4..0000000 --- a/app/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import React from 'react'; -import { render } from 'react-dom'; -import DApp from './dapp'; -import './dapp.css'; - -render( - , - document.getElementById('app') -); diff --git a/config/blockchain.js b/config/blockchain.js index a32183c..d5e3a87 100644 --- a/config/blockchain.js +++ b/config/blockchain.js @@ -1,61 +1,59 @@ module.exports = { - development: { + default: { enabled: true, - networkType: "custom", // Can be: testnet, rinkeby, livenet or custom, in which case, it will use the specified networkId - networkId: "1337", // Network id used when networkType is custom - isDev: true, // Uses and ephemeral proof-of-authority network with a pre-funded developer account, mining enabled - genesisBlock: "config/development/genesis.json", // Genesis block to initiate on first creation of a development node - datadir: ".embark/development/datadir", // Data directory for the databases and keystore - mineWhenNeeded: true, // Uses our custom script (if isDev is false) to mine only when needed - nodiscover: true, // Disables the peer discovery mechanism (manual peer addition) - maxpeers: 0, // Maximum number of network peers (network disabled if set to 0) (default: 25) - rpcHost: "localhost", // HTTP-RPC server listening interface (default: "localhost") - rpcPort: 8545, // HTTP-RPC server listening port (default: 8545) - rpcCorsDomain: "auto", // Comma separated list of domains from which to accept cross origin requests (browser enforced) - // When set to "auto", Embark will automatically set the cors to the address of the webserver - proxy: true, // Proxy is used to present meaningful information about transactions - accounts: [ - { - nodeAccounts: true, - password: "config/development/.password" - } - ], - targetGasLimit: 8000000, // Target gas limit sets the artificial target gas floor for the blocks to mine - wsRPC: true, // Enable the WS-RPC server - wsOrigins: "auto", // Origins from which to accept websockets requests - // When set to "auto", Embark will automatically set the cors to the address of the webserver - wsHost: "localhost", // WS-RPC server listening interface (default: "localhost") - wsPort: 8546, // WS-RPC server listening port (default: 8546) - simulatorBlocktime: 0 // Specify blockTime in seconds for automatic mining. Default is 0 and no auto-mining. + rpcHost: "localhost", + rpcPort: 8545, + rpcCorsDomain: { + auto: true, + additionalCors: [] + }, + wsRPC: true, + wsOrigins: { + auto: true, + additionalCors: [] + }, + wsHost: "localhost", + wsPort: 8546 }, + + development: { + ethereumClientName: "geth", + networkType: "custom", + networkId: 1337, + isDev: true, + datadir: ".embark/development/datadir", + mineWhenNeeded: true, + nodiscover: true, + maxpeers: 0, + proxy: true, + targetGasLimit: 8000000, + simulatorBlocktime: 0 + }, + testnet: { - enabled: true, networkType: "testnet", syncMode: "light", - rpcHost: "localhost", - rpcPort: 8545, - rpcCorsDomain: "http://localhost:8000", accounts: [ { nodeAccounts: true, password: "config/testnet/.password" } - ], + ] }, + livenet: { - enabled: false, networkType: "livenet", syncMode: "light", - rpcHost: "localhost", - rpcPort: 8545, rpcCorsDomain: "http://localhost:8000", + wsOrigins: "http://localhost:8000", accounts: [ { nodeAccounts: true, password: "config/livenet/.password" } - ], - }, + ] + }, + rinkeby: { enabled: true, networkType: "rinkeby", @@ -70,4 +68,5 @@ module.exports = { } ], } + }; diff --git a/config/communication.js b/config/communication.js index 8c4d1f9..28d7609 100644 --- a/config/communication.js +++ b/config/communication.js @@ -1,12 +1,22 @@ module.exports = { default: { enabled: true, - provider: "whisper", // Communication provider. Currently, Embark only supports whisper - available_providers: ["whisper"], // Array of available providers + provider: "whisper", + available_providers: ["whisper"], + }, + + development: { connection: { - host: "localhost", // Host of the blockchain node - port: 8546, // Port of the blockchain node - type: "ws" // Type of connection (ws or rpc) + host: "localhost", + port: 8546, + type: "ws" } + }, + testnet: { + }, + livenet: { + }, + rinkeby: { } + }; diff --git a/config/contracts.js b/config/contracts.js index f961f40..67e19d5 100644 --- a/config/contracts.js +++ b/config/contracts.js @@ -1,33 +1,30 @@ module.exports = { - // default applies to all environments default: { - // Blockchain node to deploy the contracts deployment: { - host: "localhost", // Host of the blockchain node - port: 8545, // Port of the blockchain node - type: "rpc" // Type of connection (ws or rpc), + host: "localhost", + port: 8546, + type: "ws" }, - // order of connections the dapp should connect to dappConnection: [ - "$WEB3", // uses pre existing web3 object if available (e.g in Mist) + "$WEB3", "ws://localhost:8546", "http://localhost:8545" ], gas: "auto", strategy: "explicit", contracts: { - "MiniMeTokenFactory": { - "deploy": true + MiniMeTokenFactory: { + deploy: true }, - "MiniMeToken": { - "deploy": true, - "args":["$MiniMeTokenFactory", "0x0", "0x0", "Status Test Token", 18, "STT", true], + MiniMeToken: { + deploy: true, + args:["$MiniMeTokenFactory", "0x0", "0x0", "Status Test Token", 18, "STT", true], }, - "StatusRoot": { - "instanceOf": "TestStatusNetwork", - "deploy": true, - "args": ["0x0", "$MiniMeToken"], - "onDeploy": [ + StatusRoot: { + instanceOf: "TestStatusNetwork", + deploy: true, + args: ["0x0", "$MiniMeToken"], + onDeploy: [ "await MiniMeToken.methods.changeController(StatusRoot.address).send()", "await StatusRoot.methods.setOpen(true).send()", ] @@ -51,35 +48,35 @@ module.exports = { testnet: { contracts: { - "MiniMeTokenFactory": { - "deploy": false, - "address": "0x6bFa86A71A7DBc68566d5C741F416e3009804279" + MiniMeTokenFactory: { + deploy: false, + address: "0x6bFa86A71A7DBc68566d5C741F416e3009804279" }, - "MiniMeToken": { - "deploy": false, - "address": "0xc55cF4B03948D7EBc8b9E8BAD92643703811d162" + MiniMeToken: { + deploy: false, + address: "0xc55cF4B03948D7EBc8b9E8BAD92643703811d162" }, - "StatusRoot": { - "instanceOf": "TestStatusNetwork", - "deploy": false, - "address": "0x34358C45FbA99ef9b78cB501584E8cBFa6f85Cef" + StatusRoot: { + instanceOf: "TestStatusNetwork", + deploy: false, + address: "0x34358C45FbA99ef9b78cB501584E8cBFa6f85Cef" } } }, rinkeby: { contracts: { - "MiniMeTokenFactory": { - "deploy": false, - "address": "0x5bA5C786845CaacD45f5952E1135F4bFB8855469" + MiniMeTokenFactory: { + deploy: false, + address: "0x5bA5C786845CaacD45f5952E1135F4bFB8855469" }, - "MiniMeToken": { - "deploy": false, - "address": "0x43d5adC3B49130A575ae6e4b00dFa4BC55C71621" + MiniMeToken: { + deploy: false, + address: "0x43d5adC3B49130A575ae6e4b00dFa4BC55C71621" }, - "StatusRoot": { - "instanceOf": "TestStatusNetwork", - "deploy": false, - "address": "0xEdEB948dE35C6ac414359f97329fc0b4be70d3f1" + StatusRoot: { + instanceOf: "TestStatusNetwork", + deploy: false, + address: "0xEdEB948dE35C6ac414359f97329fc0b4be70d3f1" } } } diff --git a/config/development/genesis.json b/config/development/genesis.json deleted file mode 100644 index 1a9501b..0000000 --- a/config/development/genesis.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "config": { - "homesteadBlock": 1, - "byzantiumBlock": 1, - "daoForkSupport": true - }, - "nonce": "0x0000000000000042", - "difficulty": "0x0", - "alloc": { - "0x3333333333333333333333333333333333333333": {"balance": "15000000000000000000"} - }, - "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "coinbase": "0x3333333333333333333333333333333333333333", - "timestamp": "0x00", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "extraData": "0x", - "gasLimit": "0x7a1200" -} diff --git a/config/namesystem.js b/config/namesystem.js index 10e20d6..ef9a00c 100644 --- a/config/namesystem.js +++ b/config/namesystem.js @@ -1,6 +1,23 @@ module.exports = { default: { + enabled: true, available_providers: ["ens"], provider: "ens" + }, + development: { + register: { + rootDomain: "eth", + subdomains: { + 'embark': '0x1a2f3b98e434c02363f3dac3174af93c1d690914' + } + } + }, + testnet: { + }, + + livenet: { + }, + + rinkeby: { } -}; +}; \ No newline at end of file diff --git a/config/pipeline.js b/config/pipeline.js new file mode 100644 index 0000000..9f33954 --- /dev/null +++ b/config/pipeline.js @@ -0,0 +1,4 @@ +module.exports = { + typescript: false, + enabled: true +}; \ No newline at end of file diff --git a/config/storage.js b/config/storage.js index 92e9192..1f43e20 100644 --- a/config/storage.js +++ b/config/storage.js @@ -1,5 +1,4 @@ module.exports = { - // default applies to all environments default: { enabled: true, ipfs_bin: "ipfs", @@ -17,16 +16,7 @@ module.exports = { getUrl: "http://localhost:8080/ipfs/" } ] - // Configuration to start Swarm in the same terminal as `embark run` - /*,account: { - address: "YOUR_ACCOUNT_ADDRESS", // Address of account accessing Swarm - password: "PATH/TO/PASSWORD/FILE" // File containing the password of the account - }, - swarmPath: "PATH/TO/SWARM/EXECUTABLE" // Path to swarm executable (default: swarm)*/ }, - - // default environment, merges with the settings in default - // assumed to be the intended environment by `embark run` development: { enabled: true, upload: { @@ -37,23 +27,12 @@ module.exports = { } }, - // merges with the settings in default - // used with "embark run privatenet" - privatenet: { - }, - - // merges with the settings in default - // used with "embark run testnet" testnet: { }, - // merges with the settings in default - // used with "embark run livenet" livenet: { }, - // you can name an environment with specific settings and then specify with - // "embark run custom_name" - //custom_name: { - //} -}; + rinkeby: { + } +}; \ No newline at end of file diff --git a/config/webserver.js b/config/webserver.js index 1814065..f721161 100644 --- a/config/webserver.js +++ b/config/webserver.js @@ -1,5 +1,6 @@ module.exports = { enabled: true, host: "localhost", + openBrowser: true, port: 8000 -}; +}; \ No newline at end of file diff --git a/embark.json b/embark.json index 24be4a0..9eb7dfa 100644 --- a/embark.json +++ b/embark.json @@ -2,19 +2,24 @@ "contracts": ["contracts/**"], "app": { "js/dapp.js": ["app/dapp.js"], - "js/index.js": ["app/index.js"], "index.html": "app/index.html", "images/": ["app/images/**"] -}, + }, "buildDir": "dist/", "config": "config/", "versions": { "web3": "1.0.0-beta", "solc": "0.5.4", - "ipfs-api": "17.2.4", - "p-iteration": "1.1.7" + "ipfs-api": "17.2.4" }, "plugins": { "embarkjs-connector-web3": {} - } + }, + "options": { + "solc": { + "optimize": true, + "optimize-runs": 200 + } + }, + "generationDir": "embarkArtifacts" } diff --git a/package.json b/package.json index 474222b..bf2c4bc 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,7 @@ "version": "0.0.1", "description": "Liquid democracy for permissionless governance through trust networks of delegates.", "scripts": { - "solidity-coverage": "./node_modules/.bin/solidity-coverage", - "test": "embark test", - "lint": "eslint" + "test": "embark test" }, "repository": { "type": "git", @@ -18,17 +16,9 @@ }, "homepage": "https://github.com/status-im/topic-democracy#readme", "devDependencies": { - "@babel/core": "^7.0.0", - "@babel/preset-env": "^7.2.3" - }, - "dependencies": { - "elliptic-curve": "^0.1.0", "embarkjs-connector-web3": "^4.0.0", - "ethereumjs-util": "^5.1.5", - "react": "^16.3.2", - "react-blockies": "^1.4.0", - "react-bootstrap": "0.32.1", - "react-dom": "^16.3.2", - "web3": "^1.0.0-beta.34" + "react": "16.7.0", + "react-bootstrap": "0.32.4", + "react-dom": "16.7.0" } }