Merge pull request #10 from status-im/merge-bootstrap

merge bootstrap
This commit is contained in:
Ricardo Guilherme Schmidt 2019-03-28 20:17:53 -03:00 committed by GitHub
commit 60a91c6130
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 196 additions and 196 deletions

View File

@ -1,3 +0,0 @@
{
"presets": ["@babel/preset-env"]
}

View File

@ -1,9 +0,0 @@
{
"extends": "airbnb",
"plugins": [
"react"
],
"rules": {
"react/prop-types": 0
}
}

8
.gitignore vendored
View File

@ -4,13 +4,17 @@ __pycache__/
*$py.class *$py.class
# embark # embark
.embark/ .embark
chains.json chains.json
.password .password
flattenedContracts
embarkArtifacts
config/livenet/password config/livenet/password
config/production/password config/production/password
dist
embarkArtifacts embarkArtifacts
# egg-related # egg-related
viper.egg-info/ viper.egg-info/
build/ build/
@ -43,4 +47,4 @@ package-lock.json
# other # other
.vs/ .vs/
bin/ bin/
.trash .trash/

View File

@ -1,18 +1,8 @@
.navbar {
}
.accounts { div {
float: right; margin: 15px;
margin-right: 17px;
font-family: monospace;
} }
.identicon {
border-radius: 50%;
}
.logs { .logs {
background-color: black; background-color: black;
font-size: 14px; font-size: 14px;
@ -59,5 +49,9 @@
} }
input.form-control { input.form-control {
margin: 5px; margin-right: 5px;
} }
.alert-result {
margin-left: 0;
}

View File

@ -1,42 +1,81 @@
import React from 'react'; 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 EmbarkJS from 'Embark/EmbarkJS';
import TestStatusNetworkUI from './components/TestStatusNetwork'; import TestStatusNetworkUI from './components/TestStatusNetwork';
import './dapp.css'; import './dapp.css';
class DApp extends React.Component { class App extends React.Component {
constructor(props) { constructor(props) {
super(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) { _renderStatus(title, available) {
let className = available ? 'pull-right status-online' : 'pull-right status-offline'; let className = available ? 'pull-right status-online' : 'pull-right status-offline';
return <React.Fragment> return <React.Fragment>
{title} {title}
<span className={className}></span> <span className={className}></span>
</React.Fragment>; </React.Fragment>;
} }
render(){ handleSelect(key) {
return ( this.setState({ activeKey: key });
<div> }
<Tabs defaultActiveKey={1} id="uncontrolled-tab-example"> render() {
<Tab eventKey={1} title="TestStatusNetwork"> const ensEnabled = EmbarkJS.Names.currentNameSystems && EmbarkJS.Names.isAvailable();
<TestStatusNetworkUI /> if (this.state.error) {
</Tab> return (<div>
</Tabs> <div>Something went wrong connecting to ethereum. Please make sure you have a node running or are using metamask to connect to the ethereum network:</div>
<div>{this.state.error}</div>
</div>); </div>);
}
return (<div>
<h3>Status Network - Test </h3>
<Tabs onSelect={this.handleSelect} activeKey={this.state.activeKey} id="uncontrolled-tab-example">
<Tab eventKey={1} title={this._renderStatus('StatusNetwork', this.state.blockchainEnabled)}>
<TestStatusNetworkUI />
</Tab>
</Tabs>
</div>);
} }
} }
export default DApp; ReactDOM.render(<App></App>, document.getElementById('app'));

0
app/images/.gitkeep Normal file
View File

View File

@ -1,12 +1,12 @@
<html> <html>
<head> <head>
<title>Status.im - Contracts</title> <title>Status Network - Test Demo</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head> </head>
<body class="container"> <body class="container">
<div id="app"> <div id="app">
</div> </div>
<script src="js/index.js" type="text/javascript"></script> <script src="js/dapp.js"></script>
</body> </body>
</html> </html>

View File

@ -1,9 +0,0 @@
import React from 'react';
import { render } from 'react-dom';
import DApp from './dapp';
import './dapp.css';
render(
<DApp />,
document.getElementById('app')
);

View File

@ -1,61 +1,59 @@
module.exports = { module.exports = {
development: { default: {
enabled: true, enabled: true,
networkType: "custom", // Can be: testnet, rinkeby, livenet or custom, in which case, it will use the specified networkId rpcHost: "localhost",
networkId: "1337", // Network id used when networkType is custom rpcPort: 8545,
isDev: true, // Uses and ephemeral proof-of-authority network with a pre-funded developer account, mining enabled rpcCorsDomain: {
genesisBlock: "config/development/genesis.json", // Genesis block to initiate on first creation of a development node auto: true,
datadir: ".embark/development/datadir", // Data directory for the databases and keystore additionalCors: []
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) wsRPC: true,
maxpeers: 0, // Maximum number of network peers (network disabled if set to 0) (default: 25) wsOrigins: {
rpcHost: "localhost", // HTTP-RPC server listening interface (default: "localhost") auto: true,
rpcPort: 8545, // HTTP-RPC server listening port (default: 8545) additionalCors: []
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 wsHost: "localhost",
proxy: true, // Proxy is used to present meaningful information about transactions wsPort: 8546
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.
}, },
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: { testnet: {
enabled: true,
networkType: "testnet", networkType: "testnet",
syncMode: "light", syncMode: "light",
rpcHost: "localhost",
rpcPort: 8545,
rpcCorsDomain: "http://localhost:8000",
accounts: [ accounts: [
{ {
nodeAccounts: true, nodeAccounts: true,
password: "config/testnet/.password" password: "config/testnet/.password"
} }
], ]
}, },
livenet: { livenet: {
enabled: false,
networkType: "livenet", networkType: "livenet",
syncMode: "light", syncMode: "light",
rpcHost: "localhost",
rpcPort: 8545,
rpcCorsDomain: "http://localhost:8000", rpcCorsDomain: "http://localhost:8000",
wsOrigins: "http://localhost:8000",
accounts: [ accounts: [
{ {
nodeAccounts: true, nodeAccounts: true,
password: "config/livenet/.password" password: "config/livenet/.password"
} }
], ]
}, },
rinkeby: { rinkeby: {
enabled: true, enabled: true,
networkType: "rinkeby", networkType: "rinkeby",
@ -70,4 +68,5 @@ module.exports = {
} }
], ],
} }
}; };

View File

@ -1,12 +1,22 @@
module.exports = { module.exports = {
default: { default: {
enabled: true, enabled: true,
provider: "whisper", // Communication provider. Currently, Embark only supports whisper provider: "whisper",
available_providers: ["whisper"], // Array of available providers available_providers: ["whisper"],
},
development: {
connection: { connection: {
host: "localhost", // Host of the blockchain node host: "localhost",
port: 8546, // Port of the blockchain node port: 8546,
type: "ws" // Type of connection (ws or rpc) type: "ws"
} }
},
testnet: {
},
livenet: {
},
rinkeby: {
} }
}; };

View File

@ -1,33 +1,30 @@
module.exports = { module.exports = {
// default applies to all environments
default: { default: {
// Blockchain node to deploy the contracts
deployment: { deployment: {
host: "localhost", // Host of the blockchain node host: "localhost",
port: 8545, // Port of the blockchain node port: 8546,
type: "rpc" // Type of connection (ws or rpc), type: "ws"
}, },
// order of connections the dapp should connect to
dappConnection: [ dappConnection: [
"$WEB3", // uses pre existing web3 object if available (e.g in Mist) "$WEB3",
"ws://localhost:8546", "ws://localhost:8546",
"http://localhost:8545" "http://localhost:8545"
], ],
gas: "auto", gas: "auto",
strategy: "explicit", strategy: "explicit",
contracts: { contracts: {
"MiniMeTokenFactory": { MiniMeTokenFactory: {
"deploy": true deploy: true
}, },
"MiniMeToken": { MiniMeToken: {
"deploy": true, deploy: true,
"args":["$MiniMeTokenFactory", "0x0", "0x0", "Status Test Token", 18, "STT", true], args:["$MiniMeTokenFactory", "0x0", "0x0", "Status Test Token", 18, "STT", true],
}, },
"StatusRoot": { StatusRoot: {
"instanceOf": "TestStatusNetwork", instanceOf: "TestStatusNetwork",
"deploy": true, deploy: true,
"args": ["0x0", "$MiniMeToken"], args: ["0x0", "$MiniMeToken"],
"onDeploy": [ onDeploy: [
"await MiniMeToken.methods.changeController(StatusRoot.address).send()", "await MiniMeToken.methods.changeController(StatusRoot.address).send()",
"await StatusRoot.methods.setOpen(true).send()", "await StatusRoot.methods.setOpen(true).send()",
] ]
@ -51,35 +48,35 @@ module.exports = {
testnet: { testnet: {
contracts: { contracts: {
"MiniMeTokenFactory": { MiniMeTokenFactory: {
"deploy": false, deploy: false,
"address": "0x6bFa86A71A7DBc68566d5C741F416e3009804279" address: "0x6bFa86A71A7DBc68566d5C741F416e3009804279"
}, },
"MiniMeToken": { MiniMeToken: {
"deploy": false, deploy: false,
"address": "0xc55cF4B03948D7EBc8b9E8BAD92643703811d162" address: "0xc55cF4B03948D7EBc8b9E8BAD92643703811d162"
}, },
"StatusRoot": { StatusRoot: {
"instanceOf": "TestStatusNetwork", instanceOf: "TestStatusNetwork",
"deploy": false, deploy: false,
"address": "0x34358C45FbA99ef9b78cB501584E8cBFa6f85Cef" address: "0x34358C45FbA99ef9b78cB501584E8cBFa6f85Cef"
} }
} }
}, },
rinkeby: { rinkeby: {
contracts: { contracts: {
"MiniMeTokenFactory": { MiniMeTokenFactory: {
"deploy": false, deploy: false,
"address": "0x5bA5C786845CaacD45f5952E1135F4bFB8855469" address: "0x5bA5C786845CaacD45f5952E1135F4bFB8855469"
}, },
"MiniMeToken": { MiniMeToken: {
"deploy": false, deploy: false,
"address": "0x43d5adC3B49130A575ae6e4b00dFa4BC55C71621" address: "0x43d5adC3B49130A575ae6e4b00dFa4BC55C71621"
}, },
"StatusRoot": { StatusRoot: {
"instanceOf": "TestStatusNetwork", instanceOf: "TestStatusNetwork",
"deploy": false, deploy: false,
"address": "0xEdEB948dE35C6ac414359f97329fc0b4be70d3f1" address: "0xEdEB948dE35C6ac414359f97329fc0b4be70d3f1"
} }
} }
} }

View File

@ -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"
}

View File

@ -1,6 +1,23 @@
module.exports = { module.exports = {
default: { default: {
enabled: true,
available_providers: ["ens"], available_providers: ["ens"],
provider: "ens" provider: "ens"
},
development: {
register: {
rootDomain: "eth",
subdomains: {
'embark': '0x1a2f3b98e434c02363f3dac3174af93c1d690914'
}
}
},
testnet: {
},
livenet: {
},
rinkeby: {
} }
}; };

4
config/pipeline.js Normal file
View File

@ -0,0 +1,4 @@
module.exports = {
typescript: false,
enabled: true
};

View File

@ -1,5 +1,4 @@
module.exports = { module.exports = {
// default applies to all environments
default: { default: {
enabled: true, enabled: true,
ipfs_bin: "ipfs", ipfs_bin: "ipfs",
@ -17,16 +16,7 @@ module.exports = {
getUrl: "http://localhost:8080/ipfs/" 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: { development: {
enabled: true, enabled: true,
upload: { 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: { testnet: {
}, },
// merges with the settings in default
// used with "embark run livenet"
livenet: { livenet: {
}, },
// you can name an environment with specific settings and then specify with rinkeby: {
// "embark run custom_name" }
//custom_name: { };
//}
};

View File

@ -1,5 +1,6 @@
module.exports = { module.exports = {
enabled: true, enabled: true,
host: "localhost", host: "localhost",
openBrowser: true,
port: 8000 port: 8000
}; };

View File

@ -2,19 +2,24 @@
"contracts": ["contracts/**"], "contracts": ["contracts/**"],
"app": { "app": {
"js/dapp.js": ["app/dapp.js"], "js/dapp.js": ["app/dapp.js"],
"js/index.js": ["app/index.js"],
"index.html": "app/index.html", "index.html": "app/index.html",
"images/": ["app/images/**"] "images/": ["app/images/**"]
}, },
"buildDir": "dist/", "buildDir": "dist/",
"config": "config/", "config": "config/",
"versions": { "versions": {
"web3": "1.0.0-beta", "web3": "1.0.0-beta",
"solc": "0.5.4", "solc": "0.5.4",
"ipfs-api": "17.2.4", "ipfs-api": "17.2.4"
"p-iteration": "1.1.7"
}, },
"plugins": { "plugins": {
"embarkjs-connector-web3": {} "embarkjs-connector-web3": {}
} },
"options": {
"solc": {
"optimize": true,
"optimize-runs": 200
}
},
"generationDir": "embarkArtifacts"
} }

View File

@ -3,9 +3,7 @@
"version": "0.0.1", "version": "0.0.1",
"description": "Liquid democracy for permissionless governance through trust networks of delegates.", "description": "Liquid democracy for permissionless governance through trust networks of delegates.",
"scripts": { "scripts": {
"solidity-coverage": "./node_modules/.bin/solidity-coverage", "test": "embark test"
"test": "embark test",
"lint": "eslint"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -18,17 +16,9 @@
}, },
"homepage": "https://github.com/status-im/topic-democracy#readme", "homepage": "https://github.com/status-im/topic-democracy#readme",
"devDependencies": { "devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.2.3"
},
"dependencies": {
"elliptic-curve": "^0.1.0",
"embarkjs-connector-web3": "^4.0.0", "embarkjs-connector-web3": "^4.0.0",
"ethereumjs-util": "^5.1.5", "react": "16.7.0",
"react": "^16.3.2", "react-bootstrap": "0.32.4",
"react-blockies": "^1.4.0", "react-dom": "16.7.0"
"react-bootstrap": "0.32.1",
"react-dom": "^16.3.2",
"web3": "^1.0.0-beta.34"
} }
} }