diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..4566ce9 --- /dev/null +++ b/.babelrc @@ -0,0 +1,8 @@ +{ + "presets": [ + "es2015", + "stage-1", + "react" + ], + "plugins": ["transform-decorators-legacy"] +} \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..a4b824b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..0e153ad --- /dev/null +++ b/.eslintrc @@ -0,0 +1,16 @@ +{ + "extends": [ + "react-app", + "plugin:prettier/recommended" + ], + "plugins": [ + "dependencies" + ], + "rules": { + "no-control-regex": 0, + "dependencies/no-cycles": "error", + "dependencies/no-unresolved": ["error", { + "ignore": ["web3"] + }] + } +} diff --git a/package-lock.json b/package-lock.json index 6102210..19f9dad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -452,9 +452,9 @@ } }, "babel-core": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz", - "integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=", + "version": "6.26.3", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz", + "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==", "requires": { "babel-code-frame": "^6.26.0", "babel-generator": "^6.26.0", @@ -466,17 +466,36 @@ "babel-traverse": "^6.26.0", "babel-types": "^6.26.0", "babylon": "^6.18.0", - "convert-source-map": "^1.5.0", - "debug": "^2.6.8", + "convert-source-map": "^1.5.1", + "debug": "^2.6.9", "json5": "^0.5.1", "lodash": "^4.17.4", "minimatch": "^3.0.4", "path-is-absolute": "^1.0.1", - "private": "^0.1.7", + "private": "^0.1.8", "slash": "^1.0.0", - "source-map": "^0.5.6" + "source-map": "^0.5.7" }, "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -510,6 +529,25 @@ "trim-right": "^1.0.1" }, "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -517,6 +555,16 @@ } } }, + "babel-helper-bindify-decorators": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-bindify-decorators/-/babel-helper-bindify-decorators-6.24.1.tgz", + "integrity": "sha1-FMGeXxQte0fxmlJDHlKxzLxAozA=", + "requires": { + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, "babel-helper-builder-binary-assignment-operator-visitor": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", @@ -535,6 +583,27 @@ "babel-runtime": "^6.26.0", "babel-types": "^6.26.0", "esutils": "^2.0.2" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + } } }, "babel-helper-call-delegate": { @@ -557,6 +626,27 @@ "babel-runtime": "^6.26.0", "babel-types": "^6.26.0", "lodash": "^4.17.4" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + } } }, "babel-helper-explode-assignable-expression": { @@ -569,6 +659,17 @@ "babel-types": "^6.24.1" } }, + "babel-helper-explode-class": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-explode-class/-/babel-helper-explode-class-6.24.1.tgz", + "integrity": "sha1-fcKjkQ3uAHBW4eMdZAztPVTqqes=", + "requires": { + "babel-helper-bindify-decorators": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, "babel-helper-function-name": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", @@ -616,6 +717,27 @@ "babel-runtime": "^6.26.0", "babel-types": "^6.26.0", "lodash": "^4.17.4" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + } } }, "babel-helper-remap-async-to-generator": { @@ -729,11 +851,26 @@ "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=" }, + "babel-plugin-syntax-async-generators": { + "version": "6.13.0", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz", + "integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=" + }, + "babel-plugin-syntax-class-constructor-call": { + "version": "6.18.0", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-class-constructor-call/-/babel-plugin-syntax-class-constructor-call-6.18.0.tgz", + "integrity": "sha1-nLnTn+Q8hgC+yBRkVt3L1OGnZBY=" + }, "babel-plugin-syntax-class-properties": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz", "integrity": "sha1-1+sjt5oxf4VDlixQW4J8fWysJ94=" }, + "babel-plugin-syntax-decorators": { + "version": "6.13.0", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz", + "integrity": "sha1-MSVjtNvePMgGzuPkFszurd0RrAs=" + }, "babel-plugin-syntax-dynamic-import": { "version": "6.18.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", @@ -744,6 +881,11 @@ "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=" }, + "babel-plugin-syntax-export-extensions": { + "version": "6.13.0", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-export-extensions/-/babel-plugin-syntax-export-extensions-6.13.0.tgz", + "integrity": "sha1-cKFITw+QiaToStRLrDU8lbmxJyE=" + }, "babel-plugin-syntax-flow": { "version": "6.18.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz", @@ -764,6 +906,16 @@ "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=" }, + "babel-plugin-transform-async-generator-functions": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.24.1.tgz", + "integrity": "sha1-8FiQAUX9PpkHpt3yjaWfIVJYpds=", + "requires": { + "babel-helper-remap-async-to-generator": "^6.24.1", + "babel-plugin-syntax-async-generators": "^6.5.0", + "babel-runtime": "^6.22.0" + } + }, "babel-plugin-transform-async-to-generator": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", @@ -774,6 +926,16 @@ "babel-runtime": "^6.22.0" } }, + "babel-plugin-transform-class-constructor-call": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-constructor-call/-/babel-plugin-transform-class-constructor-call-6.24.1.tgz", + "integrity": "sha1-gNwoVQWsBn3LjWxl4vbxGrd2Xvk=", + "requires": { + "babel-plugin-syntax-class-constructor-call": "^6.18.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, "babel-plugin-transform-class-properties": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz", @@ -785,6 +947,28 @@ "babel-template": "^6.24.1" } }, + "babel-plugin-transform-decorators": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.24.1.tgz", + "integrity": "sha1-eIAT2PjGtSIr33s0Q5Df13Vp4k0=", + "requires": { + "babel-helper-explode-class": "^6.24.1", + "babel-plugin-syntax-decorators": "^6.13.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-decorators-legacy": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-decorators-legacy/-/babel-plugin-transform-decorators-legacy-1.3.5.tgz", + "integrity": "sha512-jYHwjzRXRelYQ1uGm353zNzf3QmtdCfvJbuYTZ4gKveK7M9H1fs3a5AKdY1JUDl0z97E30ukORW1dzhWvsabtA==", + "requires": { + "babel-plugin-syntax-decorators": "^6.1.18", + "babel-runtime": "^6.2.0", + "babel-template": "^6.3.0" + } + }, "babel-plugin-transform-es2015-arrow-functions": { "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", @@ -811,6 +995,27 @@ "babel-traverse": "^6.26.0", "babel-types": "^6.26.0", "lodash": "^4.17.4" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + } } }, "babel-plugin-transform-es2015-classes": { @@ -900,6 +1105,27 @@ "babel-runtime": "^6.26.0", "babel-template": "^6.26.0", "babel-types": "^6.26.0" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + } } }, "babel-plugin-transform-es2015-modules-systemjs": { @@ -1007,6 +1233,15 @@ "babel-runtime": "^6.22.0" } }, + "babel-plugin-transform-export-extensions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-export-extensions/-/babel-plugin-transform-export-extensions-6.22.0.tgz", + "integrity": "sha1-U3OLR+deghhYnuqUbLvTkQm75lM=", + "requires": { + "babel-plugin-syntax-export-extensions": "^6.8.0", + "babel-runtime": "^6.22.0" + } + }, "babel-plugin-transform-flow-strip-types": { "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz", @@ -1023,6 +1258,27 @@ "requires": { "babel-plugin-syntax-object-rest-spread": "^6.8.0", "babel-runtime": "^6.26.0" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + } } }, "babel-plugin-transform-react-constant-elements": { @@ -1094,6 +1350,39 @@ "babel-types": "^6.24.1" } }, + "babel-polyfill": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz", + "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", + "requires": { + "babel-runtime": "^6.26.0", + "core-js": "^2.5.0", + "regenerator-runtime": "^0.10.5" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + } + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + } + } + }, "babel-preset-env": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", @@ -1131,6 +1420,37 @@ "semver": "^5.3.0" } }, + "babel-preset-es2015": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz", + "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=", + "requires": { + "babel-plugin-check-es2015-constants": "^6.22.0", + "babel-plugin-transform-es2015-arrow-functions": "^6.22.0", + "babel-plugin-transform-es2015-block-scoped-functions": "^6.22.0", + "babel-plugin-transform-es2015-block-scoping": "^6.24.1", + "babel-plugin-transform-es2015-classes": "^6.24.1", + "babel-plugin-transform-es2015-computed-properties": "^6.24.1", + "babel-plugin-transform-es2015-destructuring": "^6.22.0", + "babel-plugin-transform-es2015-duplicate-keys": "^6.24.1", + "babel-plugin-transform-es2015-for-of": "^6.22.0", + "babel-plugin-transform-es2015-function-name": "^6.24.1", + "babel-plugin-transform-es2015-literals": "^6.22.0", + "babel-plugin-transform-es2015-modules-amd": "^6.24.1", + "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", + "babel-plugin-transform-es2015-modules-systemjs": "^6.24.1", + "babel-plugin-transform-es2015-modules-umd": "^6.24.1", + "babel-plugin-transform-es2015-object-super": "^6.24.1", + "babel-plugin-transform-es2015-parameters": "^6.24.1", + "babel-plugin-transform-es2015-shorthand-properties": "^6.24.1", + "babel-plugin-transform-es2015-spread": "^6.22.0", + "babel-plugin-transform-es2015-sticky-regex": "^6.24.1", + "babel-plugin-transform-es2015-template-literals": "^6.22.0", + "babel-plugin-transform-es2015-typeof-symbol": "^6.22.0", + "babel-plugin-transform-es2015-unicode-regex": "^6.24.1", + "babel-plugin-transform-regenerator": "^6.24.1" + } + }, "babel-preset-flow": { "version": "6.23.0", "resolved": "https://registry.npmjs.org/babel-preset-flow/-/babel-preset-flow-6.23.0.tgz", @@ -1180,6 +1500,39 @@ "babel-preset-react": "6.24.1" } }, + "babel-preset-stage-1": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-stage-1/-/babel-preset-stage-1-6.24.1.tgz", + "integrity": "sha1-dpLNfc1oSZB+auSgqFWJz7niv7A=", + "requires": { + "babel-plugin-transform-class-constructor-call": "^6.24.1", + "babel-plugin-transform-export-extensions": "^6.22.0", + "babel-preset-stage-2": "^6.24.1" + } + }, + "babel-preset-stage-2": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz", + "integrity": "sha1-2eKWD7PXEYfw5k7sYrwHdnIZvcE=", + "requires": { + "babel-plugin-syntax-dynamic-import": "^6.18.0", + "babel-plugin-transform-class-properties": "^6.24.1", + "babel-plugin-transform-decorators": "^6.24.1", + "babel-preset-stage-3": "^6.24.1" + } + }, + "babel-preset-stage-3": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-stage-3/-/babel-preset-stage-3-6.24.1.tgz", + "integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=", + "requires": { + "babel-plugin-syntax-trailing-function-commas": "^6.22.0", + "babel-plugin-transform-async-generator-functions": "^6.24.1", + "babel-plugin-transform-async-to-generator": "^6.24.1", + "babel-plugin-transform-exponentiation-operator": "^6.24.1", + "babel-plugin-transform-object-rest-spread": "^6.22.0" + } + }, "babel-register": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", @@ -1194,26 +1547,40 @@ "source-map-support": "^0.4.15" }, "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, "core-js": { "version": "2.5.7", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" } } }, "babel-runtime": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", - "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.23.0.tgz", + "integrity": "sha1-CpSJ8UTecO+zzkMArM2zKeL8VDs=", "requires": { "core-js": "^2.4.0", - "regenerator-runtime": "^0.11.0" + "regenerator-runtime": "^0.10.0" }, "dependencies": { "core-js": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", - "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=" + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" } } }, @@ -1227,6 +1594,27 @@ "babel-types": "^6.26.0", "babylon": "^6.18.0", "lodash": "^4.17.4" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + } } }, "babel-traverse": { @@ -1243,6 +1631,27 @@ "globals": "^9.18.0", "invariant": "^2.2.2", "lodash": "^4.17.4" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + } } }, "babel-types": { @@ -1254,6 +1663,27 @@ "esutils": "^2.0.2", "lodash": "^4.17.4", "to-fast-properties": "^1.0.3" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + } } }, "babylon": { @@ -3407,6 +3837,21 @@ } } }, + "eslint-config-prettier": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-2.9.0.tgz", + "integrity": "sha512-ag8YEyBXsm3nmOv1Hz991VtNNDMRa+MNy8cY47Pl4bw6iuzqKbJajXdqUpiw13STdLLrznxgm1hj9NhxeOYq0A==", + "requires": { + "get-stdin": "^5.0.1" + }, + "dependencies": { + "get-stdin": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz", + "integrity": "sha1-Ei4WFZHiH/TFJTAwVpPyDmOTo5g=" + } + } + }, "eslint-config-react-app": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-2.1.0.tgz", @@ -3452,6 +3897,15 @@ } } }, + "eslint-plugin-dependencies": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-dependencies/-/eslint-plugin-dependencies-2.4.0.tgz", + "integrity": "sha512-IaW2phNpktrok2eDziZLYxmNaGysXjNj6NVji7LEv/qagHG2oshsmV+mUSxAGG5Jv9seuRBdX1YXEIaNlhkFJg==", + "requires": { + "commondir": "^1.0.1", + "resolve": "^1.1.6" + } + }, "eslint-plugin-flowtype": { "version": "2.39.1", "resolved": "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.39.1.tgz", @@ -3553,6 +4007,22 @@ "jsx-ast-utils": "^1.4.0" } }, + "eslint-plugin-prettier": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.0.tgz", + "integrity": "sha512-floiaI4F7hRkTrFe8V2ItOK97QYrX75DjmdzmVITZoAP6Cn06oEDPQRsO6MlHEP/u2SxI3xQ52Kpjw6j5WGfeQ==", + "requires": { + "fast-diff": "^1.1.1", + "jest-docblock": "^21.0.0" + }, + "dependencies": { + "jest-docblock": { + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz", + "integrity": "sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw==" + } + } + }, "eslint-plugin-react": { "version": "7.4.0", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.4.0.tgz", @@ -3883,6 +4353,11 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" }, + "fast-diff": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==" + }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", @@ -4248,13 +4723,11 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -4271,8 +4744,7 @@ }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", @@ -4401,7 +4873,6 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -9528,6 +9999,11 @@ "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=" }, + "prettier": { + "version": "1.14.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.14.3.tgz", + "integrity": "sha512-qZDVnCrnpsRJJq5nSsiHCE3BYMED2OtsI+cmzIzF1QIfqm5ALf8tEJcO27zV1gKNKRPdhjO0dNWnrzssDQ1tFg==" + }, "pretty-bytes": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz", @@ -9770,6 +10246,27 @@ "dom-align": "1.x", "prop-types": "^15.5.8", "rc-util": "^4.0.4" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + } } }, "rc-animate": { @@ -9926,6 +10423,46 @@ "whatwg-fetch": "2.0.3" }, "dependencies": { + "babel-core": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz", + "integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=", + "requires": { + "babel-code-frame": "^6.26.0", + "babel-generator": "^6.26.0", + "babel-helpers": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-register": "^6.26.0", + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "convert-source-map": "^1.5.0", + "debug": "^2.6.8", + "json5": "^0.5.1", + "lodash": "^4.17.4", + "minimatch": "^3.0.4", + "path-is-absolute": "^1.0.1", + "private": "^0.1.7", + "slash": "^1.0.0", + "source-map": "^0.5.6" + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, "fs-extra": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-3.0.1.tgz", @@ -9951,6 +10488,16 @@ "requires": { "asap": "~2.0.3" } + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" } } }, @@ -10063,9 +10610,9 @@ "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==" }, "regenerator-runtime": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", + "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=" }, "regenerator-transform": { "version": "0.10.1", @@ -12020,6 +12567,14 @@ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, "ua-parser-js": { "version": "0.7.17", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.17.tgz", @@ -12738,13 +13293,11 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -12757,18 +13310,15 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "core-util-is": { "version": "1.0.2", @@ -12871,8 +13421,7 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, - "optional": true + "bundled": true }, "ini": { "version": "1.3.5", @@ -12882,7 +13431,6 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -12895,7 +13443,6 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -12995,8 +13542,7 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", @@ -13111,7 +13657,6 @@ "string-width": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -13576,19 +14121,8 @@ "integrity": "sha1-fecPG4Py3jZHZ3IVa+z+9uNRbrM=", "requires": { "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.34" - }, - "dependencies": { - "websocket": { - "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", - "from": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", - "requires": { - "debug": "^2.2.0", - "nan": "^2.3.3", - "typedarray-to-buffer": "^3.1.2", - "yaeti": "^0.0.6" - } - } + "web3-core-helpers": "1.0.0-beta.34", + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" } }, "web3-shh": { @@ -13986,6 +14520,16 @@ } } }, + "websocket": { + "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "requires": { + "debug": "^2.2.0", + "nan": "^2.3.3", + "typedarray-to-buffer": "^3.1.2", + "yaeti": "^0.0.6" + } + }, "websocket-driver": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.0.tgz", @@ -14237,6 +14781,11 @@ "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=" }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" + }, "yallist": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", diff --git a/package.json b/package.json index 407517a..c581e86 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,25 @@ "homepage": "https://poanetwork.github.io/", "dependencies": { "ajv": "^6.5.2", + "babel-core": "^6.26.3", + "babel-eslint": "^7.2.3", + "babel-plugin-transform-decorators-legacy": "^1.3.5", + "babel-polyfill": "^6.26.0", + "babel-preset-es2015": "^6.24.1", + "babel-preset-react-app": "^3.0.1", + "babel-preset-stage-1": "^6.24.1", + "babel-preset-stage-2": "^6.24.1", + "babel-runtime": "6.23.0", "clipboard": "^1.7.1", + "eslint": "^4.1.1", + "eslint-config-prettier": "2.9.0", + "eslint-config-react-app": "^2.1.0", + "eslint-plugin-dependencies": "^2.4.0", + "eslint-plugin-flowtype": "^2.34.1", + "eslint-plugin-import": "^2.6.0", + "eslint-plugin-jsx-a11y": "^5.1.1", + "eslint-plugin-prettier": "2.6.0", + "eslint-plugin-react": "^7.1.0", "file-saver": "^1.3.3", "gh-pages": "^1.2.0", "jszip": "^3.1.5", @@ -14,6 +32,7 @@ "node-sass-chokidar": "1.3.0", "npm-run-all": "^4.1.2", "password-generator": "^2.2.0", + "prettier": "^1.13.7", "rc-tooltip": "^3.7.0", "react": "^16.2.0", "react-dom": "^16.2.0", @@ -31,6 +50,7 @@ "build-js": "react-scripts build", "build": "npm-run-all build-css build-js", "test": "react-scripts test --env=jsdom", - "eject": "react-scripts eject" + "eject": "react-scripts eject", + "lint": "./node_modules/.bin/eslint src" } } diff --git a/src/App.js b/src/App.js index 4209d5c..2d6a8c6 100644 --- a/src/App.js +++ b/src/App.js @@ -1,19 +1,19 @@ -import React, { Component } from 'react'; -import getWeb3 from './getWeb3' -import KeysManager from './keysManager'; -import Keys from './Keys'; -import swal from 'sweetalert'; -import './index/index.css'; -import addressGenerator from './addressGenerator' -import JSzip from 'jszip'; -import FileSaver from 'file-saver'; -import { constants } from './constants'; -import networkAddresses from './addresses'; -import Header from './Header'; -import Footer from './Footer'; -import Loading from './Loading'; +import React, { Component } from "react"; +import getWeb3 from "./getWeb3"; +import KeysManager from "./keysManager"; +import Keys from "./Keys"; +import swal from "sweetalert"; +import "./index/index.css"; +import addressGenerator from "./addressGenerator"; +import JSzip from "jszip"; +import FileSaver from "file-saver"; +import { constants } from "./constants"; +import networkAddresses from "./addresses"; +import Header from "./Header"; +import Footer from "./Footer"; +import Loading from "./Loading"; -function generateElement(msg){ +function generateElement(msg) { let errorNode = document.createElement("div"); errorNode.innerHTML = `
${msg} @@ -22,51 +22,59 @@ function generateElement(msg){ } class App extends Component { - constructor(props){ + constructor(props) { super(props); this.onClick = this.onClick.bind(this); - this.saveFile = (blob) => { + this.saveFile = blob => { FileSaver.saveAs(blob, `poa_network_validator_keys.zip`); }; this.state = { web3Config: {}, mining: null, isDisabledBtn: props.generateKeysIsDisabled - } + }; this.keysManager = null; - getWeb3().then(async (web3Config) => { - return networkAddresses(web3Config) - }).then(async (config) => { - const {web3Config, addresses} = config; - this.keysManager = new KeysManager(); - await this.keysManager.init({ - web3: web3Config.web3Instance, - netId: web3Config.netId, - addresses, - }); - this.setState({ - isDisabledBtn: false, - web3Config + getWeb3() + .then(async web3Config => { + return networkAddresses(web3Config); }) - }).catch((error) => { - if(error.msg){ - this.setState({isDisabledBtn: true}); - swal({ - icon: 'warning', - title: 'Warning', - content: error.node + .then(async config => { + const { web3Config, addresses } = config; + this.keysManager = new KeysManager(); + await this.keysManager.init({ + web3: web3Config.web3Instance, + netId: web3Config.netId, + addresses }); - } - }) + this.setState({ + isDisabledBtn: false, + web3Config + }); + }) + .catch(error => { + if (error.msg) { + this.setState({ isDisabledBtn: true }); + swal({ + icon: "warning", + title: "Warning", + content: error.node + }); + } + }); } - componentDidMount(){ - if(window.location.hash.indexOf('just-generate-keys') !== -1) { - this.setState({loading:true}); + componentDidMount() { + if (window.location.hash.indexOf("just-generate-keys") !== -1) { + this.setState({ loading: true }); setTimeout(async () => { - const {mining, voting, payout} = await this.generateKeys(); - this.setState({loading:false}); - await this.generateZip({mining, voting, payout, netIdName: "manualCreation"}); - }, 150) + const { mining, voting, payout } = await this.generateKeys(); + this.setState({ loading: false }); + await this.generateZip({ + mining, + voting, + payout, + netIdName: "manualCreation" + }); + }, 150); } } async generateKeys(cb) { @@ -78,128 +86,170 @@ class App extends Component { voting, payout, keysGenerated: true - }) + }); return { - mining, voting, payout - } + mining, + voting, + payout + }; } - async generateZip({mining, voting, payout, netIdName}){ + async generateZip({ mining, voting, payout, netIdName }) { const zip = new JSzip(); - zip.file(`${netIdName}_keys/mining_key_${mining.jsonStore.address}.json`, JSON.stringify(mining.jsonStore)); - zip.file(`${netIdName}_keys/mining_password_${mining.jsonStore.address}.txt`, mining.password); + zip.file( + `${netIdName}_keys/mining_key_${mining.jsonStore.address}.json`, + JSON.stringify(mining.jsonStore) + ); + zip.file( + `${netIdName}_keys/mining_password_${mining.jsonStore.address}.txt`, + mining.password + ); - zip.file(`${netIdName}_keys/voting_key_${voting.jsonStore.address}.json`, JSON.stringify(voting.jsonStore)); - zip.file(`${netIdName}_keys/voting_password_${voting.jsonStore.address}.txt`, voting.password); + zip.file( + `${netIdName}_keys/voting_key_${voting.jsonStore.address}.json`, + JSON.stringify(voting.jsonStore) + ); + zip.file( + `${netIdName}_keys/voting_password_${voting.jsonStore.address}.txt`, + voting.password + ); - zip.file(`${netIdName}_keys/payout_key_${payout.jsonStore.address}.json`, JSON.stringify(payout.jsonStore)); - zip.file(`${netIdName}_keys/payout_password_${payout.jsonStore.address}.txt`, payout.password); - zip.generateAsync({type:"blob"}).then((blob) => { + zip.file( + `${netIdName}_keys/payout_key_${payout.jsonStore.address}.json`, + JSON.stringify(payout.jsonStore) + ); + zip.file( + `${netIdName}_keys/payout_password_${payout.jsonStore.address}.txt`, + payout.password + ); + zip.generateAsync({ type: "blob" }).then(blob => { FileSaver.saveAs(blob, `poa_network_validator_keys.zip`); }); } async onClick() { - this.setState({loading:true}); + this.setState({ loading: true }); const initialKey = window.web3.eth.defaultAccount; - let isValid + let isValid; try { isValid = await this.keysManager.isInitialKeyValid(initialKey); - } catch(e) { + } catch (e) { isValid = false; } console.log(isValid); - if(Number(isValid) !== 1){ - this.setState({loading:false}); + if (Number(isValid) !== 1) { + this.setState({ loading: false }); const invalidKeyMsg = `The key is an invalid Initial key
or you're connected to the incorrect chain!
Please make sure you have loaded correct Initial key in MetaMask.

Your current selected key is ${initialKey}
- Current Network ID is ${this.state.web3Config.netId}` + Current Network ID is ${this.state.web3Config.netId}`; swal({ - icon: 'error', - title: 'Error', + icon: "error", + title: "Error", content: generateElement(invalidKeyMsg) - }) + }); return; } - if(Number(isValid) === 1){ - const {mining, voting, payout} = await this.generateKeys() + if (Number(isValid) === 1) { + const { mining, voting, payout } = await this.generateKeys(); // add loading screen - await this.keysManager.createKeys({ - mining: mining.jsonStore.address, - voting: voting.jsonStore.address, - payout: payout.jsonStore.address, - sender: initialKey - }).then(async (receipt) => { - console.log(receipt); - if (receipt.status === true || receipt.status === "0x1") { - this.setState({loading: false}) - swal("Congratulations!", "Your keys are generated!", "success"); - await this.generateZip({mining, voting, payout, netIdName: this.state.web3Config.netIdName}); - } else { - this.setState({loading: false, keysGenerated: false}) - let content = document.createElement("div"); - let msg = `Transaction failed`; - content.innerHTML = `
+ await this.keysManager + .createKeys({ + mining: mining.jsonStore.address, + voting: voting.jsonStore.address, + payout: payout.jsonStore.address, + sender: initialKey + }) + .then(async receipt => { + console.log(receipt); + if (receipt.status === true || receipt.status === "0x1") { + this.setState({ loading: false }); + swal("Congratulations!", "Your keys are generated!", "success"); + await this.generateZip({ + mining, + voting, + payout, + netIdName: this.state.web3Config.netIdName + }); + } else { + this.setState({ loading: false, keysGenerated: false }); + let content = document.createElement("div"); + let msg = `Transaction failed`; + content.innerHTML = `
Something went wrong!

Please contact Master Of Ceremony

${msg}
`; - swal({ - icon: 'error', - title: 'Error', - content: content - }); - } - }).catch((error) => { - console.error(error.message); - this.setState({loading: false, keysGenerated: false}) - let content = document.createElement("div"); - let msg; - if (error.message.includes(constants.userDeniedTransactionPattern)) - msg = `Error: ${constants.userDeniedTransactionPattern}` - else - msg = error.message - content.innerHTML = `
+ swal({ + icon: "error", + title: "Error", + content: content + }); + } + }) + .catch(error => { + console.error(error.message); + this.setState({ loading: false, keysGenerated: false }); + let content = document.createElement("div"); + let msg; + if (error.message.includes(constants.userDeniedTransactionPattern)) + msg = `Error: ${constants.userDeniedTransactionPattern}`; + else msg = error.message; + content.innerHTML = `
Something went wrong!

Please contact Master Of Ceremony

${msg}
`; - swal({ - icon: 'error', - title: 'Error', - content: content + swal({ + icon: "error", + title: "Error", + content: content + }); }); - }) } } - render() { - let loader = this.state.loading ? : ''; - let createKeyBtn = (
-

Create keys from initial key

-

- In this application, you will create mining, payout and voting keys. - The app will make your initial key unusable after the process. - Please proceed with care, don't lose your keys and follow instructions. -

-
- - -
-
) + render() { + let loader = this.state.loading ? ( + + ) : ( + "" + ); + let createKeyBtn = ( +
+

Create keys from initial key

+

+ In this application, you will create mining, payout and voting keys. + The app will make your initial key unusable after the process. Please + proceed with care, don't lose your keys and follow instructions. +

+
+ +
+
+ ); let content; - if(this.state.keysGenerated){ - content = + if (this.state.keysGenerated) { + content = ( + + ); } else { - content = createKeyBtn + content = createKeyBtn; } return (
-
+
{loader} -
- {content} -
-
+
{content}
+
); } diff --git a/src/App.test.js b/src/App.test.js index b84af98..c9ac3ef 100644 --- a/src/App.test.js +++ b/src/App.test.js @@ -1,8 +1,8 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import App from './App'; +import React from "react"; +import ReactDOM from "react-dom"; +import App from "./App"; -it('renders without crashing', () => { - const div = document.createElement('div'); +it("renders without crashing", () => { + const div = document.createElement("div"); ReactDOM.render(, div); }); diff --git a/src/Footer.js b/src/Footer.js index 7ba7fb1..ad41a3c 100644 --- a/src/Footer.js +++ b/src/Footer.js @@ -2,22 +2,41 @@ import React from "react"; import moment from "moment"; import helpers from "./helpers"; -const Footer = ({netId}) => { +const Footer = ({ netId }) => { const footerClassName = helpers.isTestnet(netId) ? "sokol" : ""; return ( - - ) -} + + ); +}; -export default Footer; \ No newline at end of file +export default Footer; diff --git a/src/Header.js b/src/Header.js index f1421ad..7420cc1 100644 --- a/src/Header.js +++ b/src/Header.js @@ -1,17 +1,17 @@ -import React from 'react'; +import React from "react"; import helpers from "./helpers"; -let Header = ({netId}) => { +let Header = ({ netId }) => { const thisIsTestnet = helpers.isTestnet(netId); const headerClassName = thisIsTestnet ? "sokol" : ""; const logoClassName = thisIsTestnet ? "header-logo-sokol" : "header-logo"; return ( -
-
- -
-
- ) -} +
+
+ +
+
+ ); +}; -export default Header; \ No newline at end of file +export default Header; diff --git a/src/Keys.js b/src/Keys.js index 886bd46..7f1a8b8 100644 --- a/src/Keys.js +++ b/src/Keys.js @@ -1,49 +1,49 @@ -import React, { Component } from 'react'; -import Tooltip from 'rc-tooltip'; -import 'rc-tooltip/assets/bootstrap.css'; +import React, { Component } from "react"; +import Tooltip from "rc-tooltip"; +import "rc-tooltip/assets/bootstrap.css"; -const encodeJson = (json) => { - const encoded = window.encodeURIComponent(JSON.stringify(json)); +const encodeJson = json => { + const encoded = window.encodeURIComponent(JSON.stringify(json)); return `data:application/json;charset=utf-8,${encoded}`; -} +}; -export default class Keys extends Component{ +export default class Keys extends Component { constructor(props) { super(props); - this.onVisibleChange = this.onVisibleChange.bind(this) - this.onCopyBtnClick = this.onCopyBtnClick.bind(this) + this.onVisibleChange = this.onVisibleChange.bind(this); + this.onCopyBtnClick = this.onCopyBtnClick.bind(this); this.state = { copyBtns: { copyMiningPass: { visible: false, - text: 'Copy' + text: "Copy" }, copyVotingPass: { visible: false, - text: 'Copy' + text: "Copy" }, copyPayoutPass: { visible: false, - text: 'Copy' + text: "Copy" }, copyMiningKey: { visible: false, - text: 'Copy' + text: "Copy" }, copyVotingKey: { visible: false, - text: 'Copy' + text: "Copy" }, copyPayoutKey: { visible: false, - text: 'Copy' - }, + text: "Copy" + } } - } + }; } componentWillUpdate(nextProps, nextState) { if (this.refs.miningKeyAddress) { - const Clipboard = require('clipboard'); + const Clipboard = require("clipboard"); // this.clipboard = new Clipboard(this.refs.copyBtn); new Clipboard(this.refs.miningKeyAddress); new Clipboard(this.refs.miningKeyPass); @@ -56,147 +56,251 @@ export default class Keys extends Component{ onVisibleChange(id) { console.log(id); let copyBtns = this.state.copyBtns; - copyBtns[id].visible = !copyBtns[id].visible - copyBtns[id].text = 'Copy' + copyBtns[id].visible = !copyBtns[id].visible; + copyBtns[id].text = "Copy"; this.setState({ copyBtns - }) - + }); + // const id = e.target.id; } - onCopyBtnClick(e){ + onCopyBtnClick(e) { const id = e.target.id; let copyBtns = this.state.copyBtns; - copyBtns[id].text = 'Copied!' + copyBtns[id].text = "Copied!"; this.setState({ copyBtns - }) + }); } - render(){ - return (
-
-
-

Mining key

-
-

0x{this.props.mining.jsonStore.address}

- { this.onVisibleChange('copyMiningKey')}} - placement="right" - overlay={this.state.copyBtns.copyMiningKey.text} - > - - + render() { + return ( +
+
+ + +
+

Voting key

+
+

+ 0x + {this.props.voting.jsonStore.address} +

+ { + this.onVisibleChange("copyVotingKey"); + }} + placement="right" + overlay={this.state.copyBtns.copyVotingKey.text} + > + + +
+

+ + + { + this.onVisibleChange("copyVotingPass"); + }} + placement="right" + overlay={this.state.copyBtns.copyVotingPass.text} + > + + +

+

+ Download this key and use it on your client node to vote for + necessary ballots, such as adding or removing miners from the + network. +

+ +
-

- - - { this.onVisibleChange('copyMiningPass')}} - placement="right" - overlay={this.state.copyBtns.copyMiningPass.text} - > - - -

-

- Download this key and use it in your mining node to - validate blocks in the network. Mined coins will be - deposited to your payout account. -

-
- Download Mining Key +
+

Important

+

+ Do not close this tab until you download all keys and save + passwords. Keep keys secure and protected. If you lose your keys, + you will need to get a new initial key using Voting DAPP. +

-
-

Payout key

-
-

0x{this.props.payout.jsonStore.address}

- { this.onVisibleChange('copyPayoutKey')}} - placement="right" - overlay={this.state.copyBtns.copyPayoutKey.text} - > - - -
-

- - - { this.onVisibleChange('copyPayoutPass')}} - placement="right" - overlay={this.state.copyBtns.copyPayoutPass.text} - > - - -

-

- Download this key and use it on your client - node/wallet to spend earned coins. -

- -
-
-

Voting key

-
-

0x{this.props.voting.jsonStore.address}

- { this.onVisibleChange('copyVotingKey')}} - placement="right" - overlay={this.state.copyBtns.copyVotingKey.text} - > - - -
-

- - - { this.onVisibleChange('copyVotingPass')}} - placement="right" - overlay={this.state.copyBtns.copyVotingPass.text} - > - - -

-

- Download this key and use it on your client node to - vote for necessary ballots, such as adding or - removing miners from the network. -

- -
-
-
-

Important

-

- Do not close this tab until you download all keys and save passwords. Keep keys secure and protected. If you lose your keys, you will need to get a new initial key using Voting DAPP. -

-
-
- ) + ); } } - \ No newline at end of file diff --git a/src/Loading.js b/src/Loading.js index 9baaf4e..5abc3ee 100644 --- a/src/Loading.js +++ b/src/Loading.js @@ -1,14 +1,14 @@ -import React from 'react'; +import React from "react"; import { constants } from "./constants"; -const styles = (netId) => { +const styles = netId => { const core = { - backgroundColor: 'rgba(35, 29, 115, 0.8)' + backgroundColor: "rgba(35, 29, 115, 0.8)" }; const sokol = { - backgroundColor: 'rgba(47, 109, 99, 0.8)' - } - switch(netId) { + backgroundColor: "rgba(47, 109, 99, 0.8)" + }; + switch (netId) { case constants.NETID_SOKOL: case constants.NETID_DAI_TEST: return sokol; @@ -18,17 +18,17 @@ const styles = (netId) => { default: return {}; } -} -const Loading = ({netId}) => ( +}; +const Loading = ({ netId }) => (
-
-
-
-
-
-
+
+
+
+
+
+
-) -export default Loading; \ No newline at end of file +); +export default Loading; diff --git a/src/addressGenerator.js b/src/addressGenerator.js index 40a6e35..0eead92 100644 --- a/src/addressGenerator.js +++ b/src/addressGenerator.js @@ -1,16 +1,23 @@ -import keythereum from 'keythereum'; -import passwordGenerator from 'password-generator'; +import keythereum from "keythereum"; +import passwordGenerator from "password-generator"; export default function generateAddress(cb) { return new Promise((resolve, reject) => { var params = { keyBytes: 32, ivBytes: 16 }; - - keythereum.create(params, function (dk) { + + keythereum.create(params, function(dk) { var options = {}; var password = passwordGenerator(20, false); - keythereum.dump(password, dk.privateKey, dk.salt, dk.iv, options, function (jsonStore) { - resolve({jsonStore, password}); - }); + keythereum.dump( + password, + dk.privateKey, + dk.salt, + dk.iv, + options, + function(jsonStore) { + resolve({ jsonStore, password }); + } + ); }); - }) -} \ No newline at end of file + }); +} diff --git a/src/addresses.js b/src/addresses.js index 4219a13..afa262c 100644 --- a/src/addresses.js +++ b/src/addresses.js @@ -1,36 +1,38 @@ import { constants } from "./constants"; import helpers from "./helpers"; //const local = { -// "KEYS_MANAGER_ADDRESS": "0x3ef32bb244016ad9af8c8f45398511e7e551b581" +// "KEYS_MANAGER_ADDRESS": "0x3ef32bb244016ad9af8c8f45398511e7e551b581" //} -export default (web3Config) => { - let branch; - - switch (web3Config.netId) { - case constants.NETID_DAI_TEST: - branch = "dai-test"; - break; - case constants.NETID_SOKOL: - branch = "sokol"; - break; - case constants.NETID_DAI: - branch = "dai"; - break; - case constants.NETID_CORE: - default: - branch = "core"; - break; - } - return new Promise((resolve, reject) => { - fetch(helpers.addressesURL(branch)).then((response) => { - response.json().then((json) => { - resolve({addresses: json, web3Config}); - }) - }).catch(function(err) { - let addr = helpers.addressesURL(branch); - helpers.wrongRepoAlert(addr); - reject(err); +export default web3Config => { + let branch; + + switch (web3Config.netId) { + case constants.NETID_DAI_TEST: + branch = "dai-test"; + break; + case constants.NETID_SOKOL: + branch = "sokol"; + break; + case constants.NETID_DAI: + branch = "dai"; + break; + case constants.NETID_CORE: + default: + branch = "core"; + break; + } + return new Promise((resolve, reject) => { + fetch(helpers.addressesURL(branch)) + .then(response => { + response.json().then(json => { + resolve({ addresses: json, web3Config }); }); - }) -} + }) + .catch(function(err) { + let addr = helpers.addressesURL(branch); + helpers.wrongRepoAlert(addr); + reject(err); + }); + }); +}; diff --git a/src/constants.js b/src/constants.js index 85f0019..0e17962 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,11 +1,11 @@ let constants = {}; -constants.organization = 'poanetwork'; -constants.repoName = 'poa-chain-spec'; -constants.addressesSourceFile = 'contracts.json'; +constants.organization = "poanetwork"; +constants.repoName = "poa-chain-spec"; +constants.addressesSourceFile = "contracts.json"; constants.ABIsSources = { - 'KeysManager': 'KeysManager.abi.json' + KeysManager: "KeysManager.abi.json" }; -constants.userDeniedTransactionPattern = 'User denied transaction'; +constants.userDeniedTransactionPattern = "User denied transaction"; constants.NETID_SOKOL = "77"; constants.NETID_CORE = "99"; @@ -14,4 +14,4 @@ constants.NETID_DAI = "100"; module.exports = { constants -} \ No newline at end of file +}; diff --git a/src/getWeb3.js b/src/getWeb3.js index e5595e3..9e1d0fb 100644 --- a/src/getWeb3.js +++ b/src/getWeb3.js @@ -4,7 +4,7 @@ let errorMsgNoMetamaskAccount = `You haven't chosen any account in MetaMask. Please choose your initial key in MetaMask and reload the page. Check POA Network wiki for more info.`; -function generateElement(msg){ +function generateElement(msg) { let errorNode = document.createElement("div"); errorNode.innerHTML = `
${msg} @@ -12,36 +12,36 @@ function generateElement(msg){ return errorNode; } let getWeb3 = () => { - return new Promise(function (resolve, reject) { + return new Promise(function(resolve, reject) { // Wait for loading completion to avoid race conditions with web3 injection timing. - window.addEventListener('load', function () { - var results - var web3 = window.web3 + window.addEventListener("load", function() { + var results; + var web3 = window.web3; // Checking if Web3 has been injected by the browser (Mist/MetaMask) - if (typeof web3 !== 'undefined') { + if (typeof web3 !== "undefined") { // Use Mist/MetaMask's provider. var errorMsg = null; - web3 = new window.Web3(web3.currentProvider) + web3 = new window.Web3(web3.currentProvider); web3.version.getNetwork((err, netId) => { let netIdName; switch (netId) { case constants.NETID_SOKOL: netIdName = "Sokol"; console.log("This is sokol"); - break + break; case constants.NETID_DAI_TEST: netIdName = "Dai-Test"; console.log("This is Dai-Test"); - break + break; case constants.NETID_CORE: netIdName = "Core"; console.log("This is Core"); - break + break; case constants.NETID_DAI: netIdName = "Dai"; console.log("This is Dai"); - break + break; default: netIdName = "Unknown"; errorMsg = `You aren't connected to POA Network. @@ -56,26 +56,31 @@ let getWeb3 = () => { netIdName, netId, injectedWeb3: true - } - document.title = `${netIdName} - Dapp Keys Generation` + }; + document.title = `${netIdName} - Dapp Keys Generation`; var defaultAccount = web3.eth.defaultAccount || null; - if(defaultAccount === null){ - reject({msg: errorMsgNoMetamaskAccount, node: generateElement(errorMsgNoMetamaskAccount)}) + if (defaultAccount === null) { + reject({ + msg: errorMsgNoMetamaskAccount, + node: generateElement(errorMsgNoMetamaskAccount) + }); } - if(errorMsg !== null){ - reject({msg: errorMsg, node: generateElement(errorMsg)}) + if (errorMsg !== null) { + reject({ msg: errorMsg, node: generateElement(errorMsg) }); } - resolve(results) - }) - - console.log('Injected web3 detected.'); + resolve(results); + }); + console.log("Injected web3 detected."); } else { - reject({msg: errorMsgNoMetamaskAccount, node: generateElement(errorMsgNoMetamaskAccount)}) - console.error('Metamask not found'); + reject({ + msg: errorMsgNoMetamaskAccount, + node: generateElement(errorMsgNoMetamaskAccount) + }); + console.error("Metamask not found"); } - }) - }) -} + }); + }); +}; -export default getWeb3 +export default getWeb3; diff --git a/src/helpers.js b/src/helpers.js index 070b669..b5612eb 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -1,68 +1,72 @@ import { constants } from "./constants"; import { messages } from "./messages"; -import swal from 'sweetalert'; +import swal from "sweetalert"; var toAscii = function(hex) { - var str = '', - i = 0, - l = hex.length; - if (hex.substring(0, 2) === '0x') { - i = 2; + var str = "", + i = 0, + l = hex.length; + if (hex.substring(0, 2) === "0x") { + i = 2; } - for (; i < l; i+=2) { - var code = parseInt(hex.substr(i, 2), 16); - if (code === 0) continue; // this is added - str += String.fromCharCode(code); + for (; i < l; i += 2) { + var code = parseInt(hex.substr(i, 2), 16); + if (code === 0) continue; // this is added + str += String.fromCharCode(code); } return str; }; function addressesURL(branch) { - const URL = `https://raw.githubusercontent.com/${constants.organization}/${constants.repoName}/${branch}/${constants.addressesSourceFile}`; - return URL; + const URL = `https://raw.githubusercontent.com/${constants.organization}/${ + constants.repoName + }/${branch}/${constants.addressesSourceFile}`; + return URL; } function ABIURL(branch, contract) { - const URL = `https://raw.githubusercontent.com/${constants.organization}/${constants.repoName}/${branch}/abis/${constants.ABIsSources[contract]}`; - return URL; + const URL = `https://raw.githubusercontent.com/${constants.organization}/${ + constants.repoName + }/${branch}/abis/${constants.ABIsSources[contract]}`; + return URL; } function getABI(branch, contract) { - let addr = ABIURL(branch, contract); - return fetch(addr).then(function(response) { - return response.json(); - }) + let addr = ABIURL(branch, contract); + return fetch(addr).then(function(response) { + return response.json(); + }); } function wrongRepoAlert(addr) { - var content = document.createElement("div"); - content.innerHTML = `
+ var content = document.createElement("div"); + content.innerHTML = `
Something went wrong!

${messages.wrongRepo(addr)}
`; - swal({ - icon: 'error', - title: 'Error', - content: content - }); + swal({ + icon: "error", + title: "Error", + content: content + }); } function getBranch(netId) { - switch (netId) { - case constants.NETID_DAI_TEST: - return "dai-test"; - case constants.NETID_SOKOL: - return "sokol"; - case constants.NETID_DAI: - return "dai"; - case constants.NETID_CORE: - default: - return "core"; - } + switch (netId) { + case constants.NETID_DAI_TEST: + return "dai-test"; + case constants.NETID_SOKOL: + return "sokol"; + case constants.NETID_DAI: + return "dai"; + case constants.NETID_CORE: + default: + return "core"; + } } function isTestnet(netId) { - return netId === constants.NETID_SOKOL || netId === constants.NETID_DAI_TEST; + return netId === constants.NETID_SOKOL || netId === constants.NETID_DAI_TEST; } let helpers = { @@ -73,6 +77,6 @@ let helpers = { wrongRepoAlert, getBranch, isTestnet -} +}; -export default helpers +export default helpers; diff --git a/src/index.js b/src/index.js index 0b161a3..da2a5e3 100644 --- a/src/index.js +++ b/src/index.js @@ -1,9 +1,12 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import App from './App'; -import registerServiceWorker from './registerServiceWorker'; -window.addEventListener("beforeunload", function (event) { +import React from "react"; +import ReactDOM from "react-dom"; +import App from "./App"; +import registerServiceWorker from "./registerServiceWorker"; +window.addEventListener("beforeunload", function(event) { event.returnValue = "Are you sure?"; }); -ReactDOM.render(, document.getElementById('root')); -registerServiceWorker(); \ No newline at end of file +ReactDOM.render( + , + document.getElementById("root") +); +registerServiceWorker(); diff --git a/src/keysManager.js b/src/keysManager.js index d6c64cc..1c33471 100644 --- a/src/keysManager.js +++ b/src/keysManager.js @@ -1,50 +1,59 @@ -import Web3 from 'web3'; -import addressGenerator from './addressGenerator'; +import Web3 from "web3"; +import addressGenerator from "./addressGenerator"; import helpers from "./helpers"; import { constants } from "./constants"; export default class KeysManager { - async init({web3, netId, addresses}){ + async init({ web3, netId, addresses }) { this.web3_10 = new Web3(web3.currentProvider); - const {KEYS_MANAGER_ADDRESS} = addresses; - console.log('Keys Manager ', KEYS_MANAGER_ADDRESS); + const { KEYS_MANAGER_ADDRESS } = addresses; + console.log("Keys Manager ", KEYS_MANAGER_ADDRESS); const branch = helpers.getBranch(netId); - const KeysManagerAbi = await helpers.getABI(branch, 'KeysManager') + const KeysManagerAbi = await helpers.getABI(branch, "KeysManager"); - this.keysInstance = new this.web3_10.eth.Contract(KeysManagerAbi, KEYS_MANAGER_ADDRESS); + this.keysInstance = new this.web3_10.eth.Contract( + KeysManagerAbi, + KEYS_MANAGER_ADDRESS + ); this.netId = netId; } async isInitialKeyValid(initialKey) { return new Promise((resolve, reject) => { - const methods = this.keysInstance.methods - let getInitialKeyStatus + const methods = this.keysInstance.methods; + let getInitialKeyStatus; if (methods.getInitialKeyStatus) { - getInitialKeyStatus = methods.getInitialKeyStatus + getInitialKeyStatus = methods.getInitialKeyStatus; } else { - getInitialKeyStatus = methods.initialKeys + getInitialKeyStatus = methods.initialKeys; } - getInitialKeyStatus(initialKey).call().then(function(result){ - resolve(result); - }).catch(function(e) { - reject(false); - }); - }) + getInitialKeyStatus(initialKey) + .call() + .then(function(result) { + resolve(result); + }) + .catch(function(e) { + reject(false); + }); + }); } async generateKeys() { return await addressGenerator(); } - createKeys({mining, voting, payout, sender}){ - let gasPrice = '2'; - if (this.netId === constants.NETID_DAI_TEST || this.netId === constants.NETID_DAI) { - gasPrice = '0'; + createKeys({ mining, voting, payout, sender }) { + let gasPrice = "2"; + if ( + this.netId === constants.NETID_DAI_TEST || + this.netId === constants.NETID_DAI + ) { + gasPrice = "0"; } return this.keysInstance.methods.createKeys(mining, voting, payout).send({ from: sender, - gasPrice: this.web3_10.utils.toWei(gasPrice, 'gwei') + gasPrice: this.web3_10.utils.toWei(gasPrice, "gwei") }); } -} \ No newline at end of file +} diff --git a/src/messages.js b/src/messages.js index 3db9a2e..b375721 100644 --- a/src/messages.js +++ b/src/messages.js @@ -1,7 +1,7 @@ let messages = {}; messages.wrongRepo = function(repo) { - return `There is no contracts.json in configured repo ${repo}`; + return `There is no contracts.json in configured repo ${repo}`; }; module.exports = { messages -}; \ No newline at end of file +}; diff --git a/src/registerServiceWorker.js b/src/registerServiceWorker.js index 12542ba..f78c2f1 100644 --- a/src/registerServiceWorker.js +++ b/src/registerServiceWorker.js @@ -9,9 +9,9 @@ // This link also includes instructions on opting out of this behavior. const isLocalhost = Boolean( - window.location.hostname === 'localhost' || + window.location.hostname === "localhost" || // [::1] is the IPv6 localhost address. - window.location.hostname === '[::1]' || + window.location.hostname === "[::1]" || // 127.0.0.1/8 is considered localhost for IPv4. window.location.hostname.match( /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ @@ -19,7 +19,7 @@ const isLocalhost = Boolean( ); export default function register() { - if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { + if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) { // The URL constructor is available in all browsers that support SW. const publicUrl = new URL(process.env.PUBLIC_URL, window.location); if (publicUrl.origin !== window.location.origin) { @@ -29,7 +29,7 @@ export default function register() { return; } - window.addEventListener('load', () => { + window.addEventListener("load", () => { const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; if (isLocalhost) { @@ -50,25 +50,25 @@ function registerValidSW(swUrl) { registration.onupdatefound = () => { const installingWorker = registration.installing; installingWorker.onstatechange = () => { - if (installingWorker.state === 'installed') { + if (installingWorker.state === "installed") { if (navigator.serviceWorker.controller) { // At this point, the old content will have been purged and // the fresh content will have been added to the cache. // It's the perfect time to display a "New content is // available; please refresh." message in your web app. - console.log('New content is available; please refresh.'); + console.log("New content is available; please refresh."); } else { // At this point, everything has been precached. // It's the perfect time to display a // "Content is cached for offline use." message. - console.log('Content is cached for offline use.'); + console.log("Content is cached for offline use."); } } }; }; }) .catch(error => { - console.error('Error during service worker registration:', error); + console.error("Error during service worker registration:", error); }); } @@ -79,7 +79,7 @@ function checkValidServiceWorker(swUrl) { // Ensure service worker exists, and that we really are getting a JS file. if ( response.status === 404 || - response.headers.get('content-type').indexOf('javascript') === -1 + response.headers.get("content-type").indexOf("javascript") === -1 ) { // No service worker found. Probably a different app. Reload the page. navigator.serviceWorker.ready.then(registration => { @@ -94,13 +94,13 @@ function checkValidServiceWorker(swUrl) { }) .catch(() => { console.log( - 'No internet connection found. App is running in offline mode.' + "No internet connection found. App is running in offline mode." ); }); } export function unregister() { - if ('serviceWorker' in navigator) { + if ("serviceWorker" in navigator) { navigator.serviceWorker.ready.then(registration => { registration.unregister(); });