diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1ecf266 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,21 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +charset = utf-8 + +# 4 space indentation +[*.py] +indent_style = space +indent_size = 4 + +# Tab indentation (no size specified) +[*.{js,jsx}] +indent_style = space +indent_size = 4 diff --git a/src/client/ethclient.js b/src/client/ethclient.js index 5ec4542..3eaea8e 100644 --- a/src/client/ethclient.js +++ b/src/client/ethclient.js @@ -11,11 +11,11 @@ var listeners = []; class EthClient { constructor() { try { - let url = null; - if (window.localStorage && window.localStorage.getItem('rpc_url')) { - url = window.localStorage.getItem('rpc_url'); - } - this.setJsonRPCUrl(url || 'http://localhost:8080'); + let url = null; + if (window.localStorage && window.localStorage.getItem('rpc_url')) { + url = window.localStorage.getItem('rpc_url'); + } + this.setJsonRPCUrl(url || 'http://localhost:8080'); var m = web3.eth.getStorageAt(ContractAddress, "0x1"); let WorkerDispatcher = web3.eth.contract(ContractStructure.WorkerDispatcher); @@ -24,7 +24,7 @@ class EthClient { this.isWorker = isWorker(); } catch(e) { - console.log("Could not contact " + this.getJsonRPCUrl()); + console.log("Could not contact " + this.getJsonRPCUrl()); } } getCoinbase(success) { @@ -99,8 +99,8 @@ class EthClient { } unregisterAll() { - this.unregisterPending(); - this.unregisterChain(); + this.unregisterPending(); + this.unregisterChain(); } registerWorker(maxLength, price, name) { @@ -164,7 +164,7 @@ class EthClient { } registerListener(callback) { - listeners.push(callback); + listeners.push(callback); } getJsonRPCUrl() { @@ -172,17 +172,17 @@ class EthClient { } setJsonRPCUrl(url) { - if (!url.startsWith('http')) { - url = 'http://' + url; - } - this._jsonRpcUrl = url; - if (window.localStorage) { - window.localStorage.setItem('rpc_url', this._jsonRpcUrl); - } - listeners.forEach((func) => { - func(this._jsonRpcUrl); - }); - web3.setProvider(new web3.providers.HttpProvider(this._jsonRpcUrl)); + if (!url.startsWith('http')) { + url = 'http://' + url; + } + this._jsonRpcUrl = url; + if (window.localStorage) { + window.localStorage.setItem('rpc_url', this._jsonRpcUrl); + } + listeners.forEach((func) => { + func(this._jsonRpcUrl); + }); + web3.setProvider(new web3.providers.HttpProvider(this._jsonRpcUrl)); } sendMsg(to, data) { diff --git a/src/components/JsonRPC.jsx b/src/components/JsonRPC.jsx index 1ffdd93..062690f 100644 --- a/src/components/JsonRPC.jsx +++ b/src/components/JsonRPC.jsx @@ -4,9 +4,9 @@ import EthClient from "../client/ethclient.js"; let JsonRPC = React.createClass({ getInitialState() { - return { - json_rpc_url: 'http://localhost:8080' - }; + return { + json_rpc_url: 'http://localhost:8080' + }; }, handleJsonRpcSubmit(e) { e.preventDefault(); @@ -14,10 +14,10 @@ let JsonRPC = React.createClass({ EthClient.setJsonRPCUrl(newUrl); }, componentDidMount() { - EthClient.registerListener(this.updateJsonRPCUrl); + EthClient.registerListener(this.updateJsonRPCUrl); }, updateJsonRPCUrl(newUrl) { - this.setState({json_rpc_url: newUrl}); + this.setState({json_rpc_url: newUrl}); }, render() { return ( @@ -29,7 +29,7 @@ let JsonRPC = React.createClass({
- +
diff --git a/src/components/NavBar.jsx b/src/components/NavBar.jsx index 59c22e1..e3f5e15 100644 --- a/src/components/NavBar.jsx +++ b/src/components/NavBar.jsx @@ -6,50 +6,50 @@ import NavTab from "./NavTab.jsx"; let Link = Router.Link; let NavBar = React.createClass({ - getInitialState() { - return { - coinbase: "Waiting for AZ", - json_rpc_url: EthClient.getJsonRPCUrl() + getInitialState() { + return { + coinbase: "Waiting for AZ", + json_rpc_url: EthClient.getJsonRPCUrl() + } + }, + componentDidMount() { + EthClient.getCoinbase(function(ok) { + this.setState({coinbase: ok}) + }.bind(this)); + EthClient.registerListener(this.updateJsonRPCUrl); + }, + updateJsonRPCUrl(newUrl) { + this.setState({json_rpc_url: newUrl}); + }, + render() { + return ( + + ); } - }, - componentDidMount() { - EthClient.getCoinbase(function(ok) { - this.setState({coinbase: ok}) - }.bind(this)); - EthClient.registerListener(this.updateJsonRPCUrl); - }, - updateJsonRPCUrl(newUrl) { - this.setState({json_rpc_url: newUrl}); - }, - render() { - return ( - - ); - } }); export default NavBar;