eslint+prettier configuration

This commit is contained in:
Victor Baranov 2018-10-15 17:52:03 +03:00
parent 5225243055
commit 0e0743ad2e
20 changed files with 1333 additions and 529 deletions

8
.babelrc Normal file
View File

@ -0,0 +1,8 @@
{
"presets": [
"es2015",
"stage-1",
"react"
],
"plugins": ["transform-decorators-legacy"]
}

8
.editorconfig Normal file
View File

@ -0,0 +1,8 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2

16
.eslintrc Normal file
View File

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

653
package-lock.json generated
View File

@ -452,9 +452,9 @@
} }
}, },
"babel-core": { "babel-core": {
"version": "6.26.0", "version": "6.26.3",
"resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz", "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz",
"integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=", "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==",
"requires": { "requires": {
"babel-code-frame": "^6.26.0", "babel-code-frame": "^6.26.0",
"babel-generator": "^6.26.0", "babel-generator": "^6.26.0",
@ -466,17 +466,36 @@
"babel-traverse": "^6.26.0", "babel-traverse": "^6.26.0",
"babel-types": "^6.26.0", "babel-types": "^6.26.0",
"babylon": "^6.18.0", "babylon": "^6.18.0",
"convert-source-map": "^1.5.0", "convert-source-map": "^1.5.1",
"debug": "^2.6.8", "debug": "^2.6.9",
"json5": "^0.5.1", "json5": "^0.5.1",
"lodash": "^4.17.4", "lodash": "^4.17.4",
"minimatch": "^3.0.4", "minimatch": "^3.0.4",
"path-is-absolute": "^1.0.1", "path-is-absolute": "^1.0.1",
"private": "^0.1.7", "private": "^0.1.8",
"slash": "^1.0.0", "slash": "^1.0.0",
"source-map": "^0.5.6" "source-map": "^0.5.7"
}, },
"dependencies": { "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": { "source-map": {
"version": "0.5.7", "version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
@ -510,6 +529,25 @@
"trim-right": "^1.0.1" "trim-right": "^1.0.1"
}, },
"dependencies": { "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": { "source-map": {
"version": "0.5.7", "version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "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": { "babel-helper-builder-binary-assignment-operator-visitor": {
"version": "6.24.1", "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", "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-runtime": "^6.26.0",
"babel-types": "^6.26.0", "babel-types": "^6.26.0",
"esutils": "^2.0.2" "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": { "babel-helper-call-delegate": {
@ -557,6 +626,27 @@
"babel-runtime": "^6.26.0", "babel-runtime": "^6.26.0",
"babel-types": "^6.26.0", "babel-types": "^6.26.0",
"lodash": "^4.17.4" "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": { "babel-helper-explode-assignable-expression": {
@ -569,6 +659,17 @@
"babel-types": "^6.24.1" "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": { "babel-helper-function-name": {
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", "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-runtime": "^6.26.0",
"babel-types": "^6.26.0", "babel-types": "^6.26.0",
"lodash": "^4.17.4" "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": { "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", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz",
"integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=" "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": { "babel-plugin-syntax-class-properties": {
"version": "6.13.0", "version": "6.13.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz",
"integrity": "sha1-1+sjt5oxf4VDlixQW4J8fWysJ94=" "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": { "babel-plugin-syntax-dynamic-import": {
"version": "6.18.0", "version": "6.18.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", "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", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz",
"integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=" "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": { "babel-plugin-syntax-flow": {
"version": "6.18.0", "version": "6.18.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz", "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", "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=" "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": { "babel-plugin-transform-async-to-generator": {
"version": "6.24.1", "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", "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-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": { "babel-plugin-transform-class-properties": {
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz", "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-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": { "babel-plugin-transform-es2015-arrow-functions": {
"version": "6.22.0", "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", "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-traverse": "^6.26.0",
"babel-types": "^6.26.0", "babel-types": "^6.26.0",
"lodash": "^4.17.4" "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": { "babel-plugin-transform-es2015-classes": {
@ -900,6 +1105,27 @@
"babel-runtime": "^6.26.0", "babel-runtime": "^6.26.0",
"babel-template": "^6.26.0", "babel-template": "^6.26.0",
"babel-types": "^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": { "babel-plugin-transform-es2015-modules-systemjs": {
@ -1007,6 +1233,15 @@
"babel-runtime": "^6.22.0" "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": { "babel-plugin-transform-flow-strip-types": {
"version": "6.22.0", "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", "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": { "requires": {
"babel-plugin-syntax-object-rest-spread": "^6.8.0", "babel-plugin-syntax-object-rest-spread": "^6.8.0",
"babel-runtime": "^6.26.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": { "babel-plugin-transform-react-constant-elements": {
@ -1094,6 +1350,39 @@
"babel-types": "^6.24.1" "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": { "babel-preset-env": {
"version": "1.6.1", "version": "1.6.1",
"resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz",
@ -1131,6 +1420,37 @@
"semver": "^5.3.0" "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": { "babel-preset-flow": {
"version": "6.23.0", "version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-preset-flow/-/babel-preset-flow-6.23.0.tgz", "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-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": { "babel-register": {
"version": "6.26.0", "version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz",
@ -1194,26 +1547,40 @@
"source-map-support": "^0.4.15" "source-map-support": "^0.4.15"
}, },
"dependencies": { "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": { "core-js": {
"version": "2.5.7", "version": "2.5.7",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz",
"integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" "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": { "babel-runtime": {
"version": "6.26.0", "version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.23.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "integrity": "sha1-CpSJ8UTecO+zzkMArM2zKeL8VDs=",
"requires": { "requires": {
"core-js": "^2.4.0", "core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0" "regenerator-runtime": "^0.10.0"
}, },
"dependencies": { "dependencies": {
"core-js": { "core-js": {
"version": "2.5.1", "version": "2.5.7",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz",
"integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=" "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw=="
} }
} }
}, },
@ -1227,6 +1594,27 @@
"babel-types": "^6.26.0", "babel-types": "^6.26.0",
"babylon": "^6.18.0", "babylon": "^6.18.0",
"lodash": "^4.17.4" "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": { "babel-traverse": {
@ -1243,6 +1631,27 @@
"globals": "^9.18.0", "globals": "^9.18.0",
"invariant": "^2.2.2", "invariant": "^2.2.2",
"lodash": "^4.17.4" "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": { "babel-types": {
@ -1254,6 +1663,27 @@
"esutils": "^2.0.2", "esutils": "^2.0.2",
"lodash": "^4.17.4", "lodash": "^4.17.4",
"to-fast-properties": "^1.0.3" "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": { "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": { "eslint-config-react-app": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-2.1.0.tgz", "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": { "eslint-plugin-flowtype": {
"version": "2.39.1", "version": "2.39.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.39.1.tgz", "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" "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": { "eslint-plugin-react": {
"version": "7.4.0", "version": "7.4.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.4.0.tgz", "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", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" "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": { "fast-json-stable-stringify": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
@ -4248,13 +4723,11 @@
}, },
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -4271,8 +4744,7 @@
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
@ -4401,7 +4873,6 @@
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
@ -9528,6 +9999,11 @@
"resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz",
"integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=" "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": { "pretty-bytes": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz",
@ -9770,6 +10246,27 @@
"dom-align": "1.x", "dom-align": "1.x",
"prop-types": "^15.5.8", "prop-types": "^15.5.8",
"rc-util": "^4.0.4" "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": { "rc-animate": {
@ -9926,6 +10423,46 @@
"whatwg-fetch": "2.0.3" "whatwg-fetch": "2.0.3"
}, },
"dependencies": { "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": { "fs-extra": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-3.0.1.tgz", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-3.0.1.tgz",
@ -9951,6 +10488,16 @@
"requires": { "requires": {
"asap": "~2.0.3" "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==" "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg=="
}, },
"regenerator-runtime": { "regenerator-runtime": {
"version": "0.11.1", "version": "0.10.5",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz",
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg="
}, },
"regenerator-transform": { "regenerator-transform": {
"version": "0.10.1", "version": "0.10.1",
@ -12020,6 +12567,14 @@
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" "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": { "ua-parser-js": {
"version": "0.7.17", "version": "0.7.17",
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.17.tgz", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.17.tgz",
@ -12738,13 +13293,11 @@
}, },
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -12757,18 +13310,15 @@
}, },
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -12871,8 +13421,7 @@
}, },
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true, "bundled": true
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -12882,7 +13431,6 @@
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -12895,7 +13443,6 @@
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
@ -12995,8 +13542,7 @@
}, },
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -13111,7 +13657,6 @@
"string-width": { "string-width": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",
@ -13576,19 +14121,8 @@
"integrity": "sha1-fecPG4Py3jZHZ3IVa+z+9uNRbrM=", "integrity": "sha1-fecPG4Py3jZHZ3IVa+z+9uNRbrM=",
"requires": { "requires": {
"underscore": "1.8.3", "underscore": "1.8.3",
"web3-core-helpers": "1.0.0-beta.34" "web3-core-helpers": "1.0.0-beta.34",
}, "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2"
"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-shh": { "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": { "websocket-driver": {
"version": "0.7.0", "version": "0.7.0",
"resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.0.tgz", "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", "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",
"integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=" "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": { "yallist": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",

View File

@ -5,7 +5,25 @@
"homepage": "https://poanetwork.github.io/", "homepage": "https://poanetwork.github.io/",
"dependencies": { "dependencies": {
"ajv": "^6.5.2", "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", "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", "file-saver": "^1.3.3",
"gh-pages": "^1.2.0", "gh-pages": "^1.2.0",
"jszip": "^3.1.5", "jszip": "^3.1.5",
@ -14,6 +32,7 @@
"node-sass-chokidar": "1.3.0", "node-sass-chokidar": "1.3.0",
"npm-run-all": "^4.1.2", "npm-run-all": "^4.1.2",
"password-generator": "^2.2.0", "password-generator": "^2.2.0",
"prettier": "^1.13.7",
"rc-tooltip": "^3.7.0", "rc-tooltip": "^3.7.0",
"react": "^16.2.0", "react": "^16.2.0",
"react-dom": "^16.2.0", "react-dom": "^16.2.0",
@ -31,6 +50,7 @@
"build-js": "react-scripts build", "build-js": "react-scripts build",
"build": "npm-run-all build-css build-js", "build": "npm-run-all build-css build-js",
"test": "react-scripts test --env=jsdom", "test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject" "eject": "react-scripts eject",
"lint": "./node_modules/.bin/eslint src"
} }
} }

View File

@ -1,19 +1,19 @@
import React, { Component } from 'react'; import React, { Component } from "react";
import getWeb3 from './getWeb3' import getWeb3 from "./getWeb3";
import KeysManager from './keysManager'; import KeysManager from "./keysManager";
import Keys from './Keys'; import Keys from "./Keys";
import swal from 'sweetalert'; import swal from "sweetalert";
import './index/index.css'; import "./index/index.css";
import addressGenerator from './addressGenerator' import addressGenerator from "./addressGenerator";
import JSzip from 'jszip'; import JSzip from "jszip";
import FileSaver from 'file-saver'; import FileSaver from "file-saver";
import { constants } from './constants'; import { constants } from "./constants";
import networkAddresses from './addresses'; import networkAddresses from "./addresses";
import Header from './Header'; import Header from "./Header";
import Footer from './Footer'; import Footer from "./Footer";
import Loading from './Loading'; import Loading from "./Loading";
function generateElement(msg){ function generateElement(msg) {
let errorNode = document.createElement("div"); let errorNode = document.createElement("div");
errorNode.innerHTML = `<div style="line-height: 1.6;"> errorNode.innerHTML = `<div style="line-height: 1.6;">
${msg} ${msg}
@ -22,51 +22,59 @@ function generateElement(msg){
} }
class App extends Component { class App extends Component {
constructor(props){ constructor(props) {
super(props); super(props);
this.onClick = this.onClick.bind(this); this.onClick = this.onClick.bind(this);
this.saveFile = (blob) => { this.saveFile = blob => {
FileSaver.saveAs(blob, `poa_network_validator_keys.zip`); FileSaver.saveAs(blob, `poa_network_validator_keys.zip`);
}; };
this.state = { this.state = {
web3Config: {}, web3Config: {},
mining: null, mining: null,
isDisabledBtn: props.generateKeysIsDisabled isDisabledBtn: props.generateKeysIsDisabled
} };
this.keysManager = null; this.keysManager = null;
getWeb3().then(async (web3Config) => { getWeb3()
return networkAddresses(web3Config) .then(async web3Config => {
}).then(async (config) => { return networkAddresses(web3Config);
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) => { .then(async config => {
if(error.msg){ const { web3Config, addresses } = config;
this.setState({isDisabledBtn: true}); this.keysManager = new KeysManager();
swal({ await this.keysManager.init({
icon: 'warning', web3: web3Config.web3Instance,
title: 'Warning', netId: web3Config.netId,
content: error.node addresses
}); });
} this.setState({
}) isDisabledBtn: false,
web3Config
});
})
.catch(error => {
if (error.msg) {
this.setState({ isDisabledBtn: true });
swal({
icon: "warning",
title: "Warning",
content: error.node
});
}
});
} }
componentDidMount(){ componentDidMount() {
if(window.location.hash.indexOf('just-generate-keys') !== -1) { if (window.location.hash.indexOf("just-generate-keys") !== -1) {
this.setState({loading:true}); this.setState({ loading: true });
setTimeout(async () => { setTimeout(async () => {
const {mining, voting, payout} = await this.generateKeys(); const { mining, voting, payout } = await this.generateKeys();
this.setState({loading:false}); this.setState({ loading: false });
await this.generateZip({mining, voting, payout, netIdName: "manualCreation"}); await this.generateZip({
}, 150) mining,
voting,
payout,
netIdName: "manualCreation"
});
}, 150);
} }
} }
async generateKeys(cb) { async generateKeys(cb) {
@ -78,128 +86,170 @@ class App extends Component {
voting, voting,
payout, payout,
keysGenerated: true keysGenerated: true
}) });
return { return {
mining, voting, payout mining,
} voting,
payout
};
} }
async generateZip({mining, voting, payout, netIdName}){ async generateZip({ mining, voting, payout, netIdName }) {
const zip = new JSzip(); const zip = new JSzip();
zip.file(`${netIdName}_keys/mining_key_${mining.jsonStore.address}.json`, JSON.stringify(mining.jsonStore)); zip.file(
zip.file(`${netIdName}_keys/mining_password_${mining.jsonStore.address}.txt`, mining.password); `${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(
zip.file(`${netIdName}_keys/voting_password_${voting.jsonStore.address}.txt`, voting.password); `${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(
zip.file(`${netIdName}_keys/payout_password_${payout.jsonStore.address}.txt`, payout.password); `${netIdName}_keys/payout_key_${payout.jsonStore.address}.json`,
zip.generateAsync({type:"blob"}).then((blob) => { 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`); FileSaver.saveAs(blob, `poa_network_validator_keys.zip`);
}); });
} }
async onClick() { async onClick() {
this.setState({loading:true}); this.setState({ loading: true });
const initialKey = window.web3.eth.defaultAccount; const initialKey = window.web3.eth.defaultAccount;
let isValid let isValid;
try { try {
isValid = await this.keysManager.isInitialKeyValid(initialKey); isValid = await this.keysManager.isInitialKeyValid(initialKey);
} catch(e) { } catch (e) {
isValid = false; isValid = false;
} }
console.log(isValid); console.log(isValid);
if(Number(isValid) !== 1){ if (Number(isValid) !== 1) {
this.setState({loading:false}); this.setState({ loading: false });
const invalidKeyMsg = `The key is an invalid Initial key<br/> const invalidKeyMsg = `The key is an invalid Initial key<br/>
or you're connected to the incorrect chain!<br/> or you're connected to the incorrect chain!<br/>
Please make sure you have loaded correct Initial key in MetaMask.<br/><br/> Please make sure you have loaded correct Initial key in MetaMask.<br/><br/>
<b>Your current selected key is</b> <i>${initialKey}</i><br/> <b>Your current selected key is</b> <i>${initialKey}</i><br/>
<b>Current Network ID</b> is <i>${this.state.web3Config.netId}</i>` <b>Current Network ID</b> is <i>${this.state.web3Config.netId}</i>`;
swal({ swal({
icon: 'error', icon: "error",
title: 'Error', title: "Error",
content: generateElement(invalidKeyMsg) content: generateElement(invalidKeyMsg)
}) });
return; return;
} }
if(Number(isValid) === 1){ if (Number(isValid) === 1) {
const {mining, voting, payout} = await this.generateKeys() const { mining, voting, payout } = await this.generateKeys();
// add loading screen // add loading screen
await this.keysManager.createKeys({ await this.keysManager
mining: mining.jsonStore.address, .createKeys({
voting: voting.jsonStore.address, mining: mining.jsonStore.address,
payout: payout.jsonStore.address, voting: voting.jsonStore.address,
sender: initialKey payout: payout.jsonStore.address,
}).then(async (receipt) => { sender: initialKey
console.log(receipt); })
if (receipt.status === true || receipt.status === "0x1") { .then(async receipt => {
this.setState({loading: false}) console.log(receipt);
swal("Congratulations!", "Your keys are generated!", "success"); if (receipt.status === true || receipt.status === "0x1") {
await this.generateZip({mining, voting, payout, netIdName: this.state.web3Config.netIdName}); this.setState({ loading: false });
} else { swal("Congratulations!", "Your keys are generated!", "success");
this.setState({loading: false, keysGenerated: false}) await this.generateZip({
let content = document.createElement("div"); mining,
let msg = `Transaction failed`; voting,
content.innerHTML = `<div> payout,
netIdName: this.state.web3Config.netIdName
});
} else {
this.setState({ loading: false, keysGenerated: false });
let content = document.createElement("div");
let msg = `Transaction failed`;
content.innerHTML = `<div>
Something went wrong!<br/><br/> Something went wrong!<br/><br/>
Please contact Master Of Ceremony<br/><br/> Please contact Master Of Ceremony<br/><br/>
${msg} ${msg}
</div>`; </div>`;
swal({ swal({
icon: 'error', icon: "error",
title: 'Error', title: "Error",
content: content content: content
}); });
} }
}).catch((error) => { })
console.error(error.message); .catch(error => {
this.setState({loading: false, keysGenerated: false}) console.error(error.message);
let content = document.createElement("div"); this.setState({ loading: false, keysGenerated: false });
let msg; let content = document.createElement("div");
if (error.message.includes(constants.userDeniedTransactionPattern)) let msg;
msg = `Error: ${constants.userDeniedTransactionPattern}` if (error.message.includes(constants.userDeniedTransactionPattern))
else msg = `Error: ${constants.userDeniedTransactionPattern}`;
msg = error.message else msg = error.message;
content.innerHTML = `<div> content.innerHTML = `<div>
Something went wrong!<br/><br/> Something went wrong!<br/><br/>
Please contact Master Of Ceremony<br/><br/> Please contact Master Of Ceremony<br/><br/>
${msg} ${msg}
</div>`; </div>`;
swal({ swal({
icon: 'error', icon: "error",
title: 'Error', title: "Error",
content: content content: content
});
}); });
})
} }
} }
render() { render() {
let loader = this.state.loading ? <Loading netId={this.state.web3Config.netId}/> : ''; let loader = this.state.loading ? (
let createKeyBtn = (<div className="create-keys"> <Loading netId={this.state.web3Config.netId} />
<h1>Create keys from initial key</h1> ) : (
<h2> ""
In this application, you will create mining, payout and voting keys. );
The app will make your initial key unusable after the process. let createKeyBtn = (
Please proceed with care, don't lose your keys and follow instructions. <div className="create-keys">
</h2> <h1>Create keys from initial key</h1>
<div className="create-keys-button-container"> <h2>
<button className="create-keys-button" onClick={this.onClick} disabled={this.state.isDisabledBtn}>Generate keys</button> In this application, you will create mining, payout and voting keys.
The app will make your initial key unusable after the process. Please
</div> proceed with care, don't lose your keys and follow instructions.
</div>) </h2>
<div className="create-keys-button-container">
<button
className="create-keys-button"
onClick={this.onClick}
disabled={this.state.isDisabledBtn}
>
Generate keys
</button>
</div>
</div>
);
let content; let content;
if(this.state.keysGenerated){ if (this.state.keysGenerated) {
content = <Keys mining={this.state.mining} voting={this.state.voting} payout={this.state.payout}/> content = (
<Keys
mining={this.state.mining}
voting={this.state.voting}
payout={this.state.payout}
/>
);
} else { } else {
content = createKeyBtn content = createKeyBtn;
} }
return ( return (
<div className="App"> <div className="App">
<Header netId={this.state.web3Config.netId}/> <Header netId={this.state.web3Config.netId} />
{loader} {loader}
<section className="content"> <section className="content">{content}</section>
{content} <Footer netId={this.state.web3Config.netId} />
</section>
<Footer netId={this.state.web3Config.netId}/>
</div> </div>
); );
} }

View File

@ -1,8 +1,8 @@
import React from 'react'; import React from "react";
import ReactDOM from 'react-dom'; import ReactDOM from "react-dom";
import App from './App'; import App from "./App";
it('renders without crashing', () => { it("renders without crashing", () => {
const div = document.createElement('div'); const div = document.createElement("div");
ReactDOM.render(<App />, div); ReactDOM.render(<App />, div);
}); });

View File

@ -2,22 +2,41 @@ import React from "react";
import moment from "moment"; import moment from "moment";
import helpers from "./helpers"; import helpers from "./helpers";
const Footer = ({netId}) => { const Footer = ({ netId }) => {
const footerClassName = helpers.isTestnet(netId) ? "sokol" : ""; const footerClassName = helpers.isTestnet(netId) ? "sokol" : "";
return ( return (
<footer className={`footer ${footerClassName}`}> <footer className={`footer ${footerClassName}`}>
<div className="container"> <div className="container">
<p className="footer-rights">{moment().format('YYYY')} POA Network. All rights reserved.</p> <p className="footer-rights">
<a href="/poa-dapps-keys-generation" className="footer-logo"></a> {moment().format("YYYY")} POA Network. All rights reserved.
<div className="socials"> </p>
<a href="https://twitter.com/poanetwork" className="socials-i socials-i_twitter">Twitter</a> <a href="/poa-dapps-keys-generation" className="footer-logo" />
<a href="https://poa.network" className="socials-i socials-i_oracles">POA Network</a> <div className="socials">
<a href="https://t.me/oraclesnetwork" className="socials-i socials-i_telegram">Telegram</a> <a
<a href="https://github.com/poanetwork/" className="socials-i socials-i_github">GitHub</a> href="https://twitter.com/poanetwork"
className="socials-i socials-i_twitter"
>
Twitter
</a>
<a href="https://poa.network" className="socials-i socials-i_oracles">
POA Network
</a>
<a
href="https://t.me/oraclesnetwork"
className="socials-i socials-i_telegram"
>
Telegram
</a>
<a
href="https://github.com/poanetwork/"
className="socials-i socials-i_github"
>
GitHub
</a>
</div>
</div> </div>
</div> </footer>
</footer> );
) };
}
export default Footer; export default Footer;

View File

@ -1,17 +1,17 @@
import React from 'react'; import React from "react";
import helpers from "./helpers"; import helpers from "./helpers";
let Header = ({netId}) => { let Header = ({ netId }) => {
const thisIsTestnet = helpers.isTestnet(netId); const thisIsTestnet = helpers.isTestnet(netId);
const headerClassName = thisIsTestnet ? "sokol" : ""; const headerClassName = thisIsTestnet ? "sokol" : "";
const logoClassName = thisIsTestnet ? "header-logo-sokol" : "header-logo"; const logoClassName = thisIsTestnet ? "header-logo-sokol" : "header-logo";
return ( return (
<header className={`header ${headerClassName}`}> <header className={`header ${headerClassName}`}>
<div className="container"> <div className="container">
<a href="/poa-dapps-keys-generation" className={logoClassName}></a> <a href="/poa-dapps-keys-generation" className={logoClassName} />
</div> </div>
</header> </header>
) );
} };
export default Header; export default Header;

View File

@ -1,49 +1,49 @@
import React, { Component } from 'react'; import React, { Component } from "react";
import Tooltip from 'rc-tooltip'; import Tooltip from "rc-tooltip";
import 'rc-tooltip/assets/bootstrap.css'; import "rc-tooltip/assets/bootstrap.css";
const encodeJson = (json) => { const encodeJson = json => {
const encoded = window.encodeURIComponent(JSON.stringify(json)); const encoded = window.encodeURIComponent(JSON.stringify(json));
return `data:application/json;charset=utf-8,${encoded}`; return `data:application/json;charset=utf-8,${encoded}`;
} };
export default class Keys extends Component{ export default class Keys extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.onVisibleChange = this.onVisibleChange.bind(this) this.onVisibleChange = this.onVisibleChange.bind(this);
this.onCopyBtnClick = this.onCopyBtnClick.bind(this) this.onCopyBtnClick = this.onCopyBtnClick.bind(this);
this.state = { this.state = {
copyBtns: { copyBtns: {
copyMiningPass: { copyMiningPass: {
visible: false, visible: false,
text: 'Copy' text: "Copy"
}, },
copyVotingPass: { copyVotingPass: {
visible: false, visible: false,
text: 'Copy' text: "Copy"
}, },
copyPayoutPass: { copyPayoutPass: {
visible: false, visible: false,
text: 'Copy' text: "Copy"
}, },
copyMiningKey: { copyMiningKey: {
visible: false, visible: false,
text: 'Copy' text: "Copy"
}, },
copyVotingKey: { copyVotingKey: {
visible: false, visible: false,
text: 'Copy' text: "Copy"
}, },
copyPayoutKey: { copyPayoutKey: {
visible: false, visible: false,
text: 'Copy' text: "Copy"
}, }
} }
} };
} }
componentWillUpdate(nextProps, nextState) { componentWillUpdate(nextProps, nextState) {
if (this.refs.miningKeyAddress) { if (this.refs.miningKeyAddress) {
const Clipboard = require('clipboard'); const Clipboard = require("clipboard");
// this.clipboard = new Clipboard(this.refs.copyBtn); // this.clipboard = new Clipboard(this.refs.copyBtn);
new Clipboard(this.refs.miningKeyAddress); new Clipboard(this.refs.miningKeyAddress);
new Clipboard(this.refs.miningKeyPass); new Clipboard(this.refs.miningKeyPass);
@ -56,147 +56,251 @@ export default class Keys extends Component{
onVisibleChange(id) { onVisibleChange(id) {
console.log(id); console.log(id);
let copyBtns = this.state.copyBtns; let copyBtns = this.state.copyBtns;
copyBtns[id].visible = !copyBtns[id].visible copyBtns[id].visible = !copyBtns[id].visible;
copyBtns[id].text = 'Copy' copyBtns[id].text = "Copy";
this.setState({ this.setState({
copyBtns copyBtns
}) });
// const id = e.target.id; // const id = e.target.id;
} }
onCopyBtnClick(e){ onCopyBtnClick(e) {
const id = e.target.id; const id = e.target.id;
let copyBtns = this.state.copyBtns; let copyBtns = this.state.copyBtns;
copyBtns[id].text = 'Copied!' copyBtns[id].text = "Copied!";
this.setState({ this.setState({
copyBtns copyBtns
}) });
} }
render(){ render() {
return ( <div className="container"> return (
<div className="keys"> <div className="container">
<div className="keys-i"> <div className="keys">
<p className="keys-title">Mining key</p> <div className="keys-i">
<div className="keys-hash-container"> <p className="keys-title">Mining key</p>
<p className="keys-hash" id="miningKey">0x{this.props.mining.jsonStore.address}</p> <div className="keys-hash-container">
<Tooltip <p className="keys-hash" id="miningKey">
visible={this.state.copyBtns.copyMiningKey.visible} 0x
animation="zoom" {this.props.mining.jsonStore.address}
trigger="hover" </p>
onVisibleChange={() => { this.onVisibleChange('copyMiningKey')}} <Tooltip
placement="right" visible={this.state.copyBtns.copyMiningKey.visible}
overlay={this.state.copyBtns.copyMiningKey.text} animation="zoom"
> trigger="hover"
<span id="copyMiningKey" onClick={this.onCopyBtnClick} className="copy" ref="miningKeyAddress" data-clipboard-text={"0x"+this.props.mining.jsonStore.address} ></span> onVisibleChange={() => {
</Tooltip> this.onVisibleChange("copyMiningKey");
}}
placement="right"
overlay={this.state.copyBtns.copyMiningKey.text}
>
<span
id="copyMiningKey"
onClick={this.onCopyBtnClick}
className="copy"
ref="miningKeyAddress"
data-clipboard-text={
"0x" + this.props.mining.jsonStore.address
}
/>
</Tooltip>
</div>
<p className="keys-hash">
<label className="password-label">Password:</label>
<input
disabled={true}
defaultValue={this.props.mining.password}
type="password"
id="miningKeyPass"
className="pass"
/>
<Tooltip
visible={this.state.copyBtns.copyMiningPass.visible}
animation="zoom"
trigger="hover"
onVisibleChange={() => {
this.onVisibleChange("copyMiningPass");
}}
placement="right"
overlay={this.state.copyBtns.copyMiningPass.text}
>
<span
id="copyMiningPass"
onClick={this.onCopyBtnClick}
className="copy"
ref="miningKeyPass"
data-clipboard-text={this.props.mining.password}
/>
</Tooltip>
</p>
<p className="keys-description">
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.
</p>
<div className="keys-footer">
<a
className="keys-download"
id="miningKeyDownload"
href={encodeJson(this.props.mining.jsonStore)}
download={`mining_${this.props.mining.jsonStore.address}.json`}
>
Download Mining Key
</a>
</div>
</div>
<div className="keys-i">
<p className="keys-title">Payout key</p>
<div className="keys-hash-container">
<p className="keys-hash" id="payoutKey">
0x
{this.props.payout.jsonStore.address}
</p>
<Tooltip
visible={this.state.copyBtns.copyPayoutKey.visible}
animation="zoom"
trigger="hover"
onVisibleChange={() => {
this.onVisibleChange("copyPayoutKey");
}}
placement="right"
overlay={this.state.copyBtns.copyPayoutKey.text}
>
<span
id="copyPayoutKey"
onClick={this.onCopyBtnClick}
className="copy"
ref="payoutKeyAddress"
data-clipboard-text={
"0x" + this.props.payout.jsonStore.address
}
/>
</Tooltip>
</div>
<p className="keys-hash">
<label className="password-label">Password:</label>
<input
type="password"
disabled={true}
id="payoutKeyPass"
className="pass"
defaultValue={this.props.payout.password}
/>
<Tooltip
visible={this.state.copyBtns.copyPayoutPass.visible}
animation="zoom"
trigger="hover"
onVisibleChange={() => {
this.onVisibleChange("copyPayoutPass");
}}
placement="right"
overlay={this.state.copyBtns.copyPayoutPass.text}
>
<span
id="copyPayoutPass"
onClick={this.onCopyBtnClick}
className="copy"
ref="payoutKeyPass"
data-clipboard-text={this.props.payout.password}
/>
</Tooltip>
</p>
<p className="keys-description">
Download this key and use it on your client node/wallet to spend
earned coins.
</p>
<div className="keys-footer">
<a
className="keys-download"
id="payoutKeyDownload"
href={encodeJson(this.props.payout.jsonStore)}
download={`payout_${this.props.payout.jsonStore.address}.json`}
>
Download Payout Key
</a>
</div>
</div>
<div className="keys-i">
<p className="keys-title">Voting key</p>
<div className="keys-hash-container">
<p className="keys-hash" id="votingKey">
0x
{this.props.voting.jsonStore.address}
</p>
<Tooltip
visible={this.state.copyBtns.copyVotingKey.visible}
animation="zoom"
trigger="hover"
onVisibleChange={() => {
this.onVisibleChange("copyVotingKey");
}}
placement="right"
overlay={this.state.copyBtns.copyVotingKey.text}
>
<span
id="copyVotingKey"
onClick={this.onCopyBtnClick}
className="copy"
ref="votingKeyAddress"
data-clipboard-text={
"0x" + this.props.voting.jsonStore.address
}
/>
</Tooltip>
</div>
<p className="keys-hash">
<label className="password-label">Password:</label>
<input
type="password"
disabled={true}
id="votingKeyPass"
className="pass"
defaultValue={this.props.voting.password}
/>
<Tooltip
visible={this.state.copyBtns.copyVotingPass.visible}
animation="zoom"
trigger="hover"
onVisibleChange={() => {
this.onVisibleChange("copyVotingPass");
}}
placement="right"
overlay={this.state.copyBtns.copyVotingPass.text}
>
<span
id="copyVotingPass"
onClick={this.onCopyBtnClick}
className="copy"
ref="votingKeyPass"
data-clipboard-text={this.props.voting.password}
/>
</Tooltip>
</p>
<p className="keys-description">
Download this key and use it on your client node to vote for
necessary ballots, such as adding or removing miners from the
network.
</p>
<div className="keys-footer">
<a
className="keys-download"
id="votingKeyDownload"
href={encodeJson(this.props.voting.jsonStore)}
download={`voting_${this.props.voting.jsonStore.address}.json`}
>
Download Voting Key
</a>
</div>
</div>
</div> </div>
<p className="keys-hash"> <div className="keys-note">
<label className="password-label">Password:</label> <p className="keys-note-title">Important</p>
<input disabled={true} defaultValue={this.props.mining.password} type="password" id="miningKeyPass" className="pass"/> <p className="keys-note-description">
<Tooltip Do not close this tab until you download all keys and save
visible={this.state.copyBtns.copyMiningPass.visible} passwords. Keep keys secure and protected. If you lose your keys,
animation="zoom" you will need to get a new initial key using Voting DAPP.
trigger="hover" </p>
onVisibleChange={() => { this.onVisibleChange('copyMiningPass')}}
placement="right"
overlay={this.state.copyBtns.copyMiningPass.text}
>
<span id="copyMiningPass" onClick={this.onCopyBtnClick} className="copy" ref="miningKeyPass" data-clipboard-text={this.props.mining.password} ></span>
</Tooltip>
</p>
<p className="keys-description">
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.
</p>
<div className="keys-footer">
<a className="keys-download" id="miningKeyDownload" href={encodeJson(this.props.mining.jsonStore)} download={`mining_${this.props.mining.jsonStore.address}.json`}>Download Mining Key</a>
</div> </div>
</div> </div>
<div className="keys-i"> );
<p className="keys-title">Payout key</p>
<div className="keys-hash-container">
<p className="keys-hash" id="payoutKey">0x{this.props.payout.jsonStore.address}</p>
<Tooltip
visible={this.state.copyBtns.copyPayoutKey.visible}
animation="zoom"
trigger="hover"
onVisibleChange={() => { this.onVisibleChange('copyPayoutKey')}}
placement="right"
overlay={this.state.copyBtns.copyPayoutKey.text}
>
<span id="copyPayoutKey" onClick={this.onCopyBtnClick} className="copy" ref="payoutKeyAddress" data-clipboard-text={"0x"+this.props.payout.jsonStore.address} ></span>
</Tooltip>
</div>
<p className="keys-hash">
<label className="password-label">Password:</label>
<input type="password" disabled={true} id="payoutKeyPass" className="pass" defaultValue={this.props.payout.password}/>
<Tooltip
visible={this.state.copyBtns.copyPayoutPass.visible}
animation="zoom"
trigger="hover"
onVisibleChange={() => { this.onVisibleChange('copyPayoutPass')}}
placement="right"
overlay={this.state.copyBtns.copyPayoutPass.text}
>
<span id="copyPayoutPass" onClick={this.onCopyBtnClick} className="copy" ref="payoutKeyPass" data-clipboard-text={this.props.payout.password} ></span>
</Tooltip>
</p>
<p className="keys-description">
Download this key and use it on your client
node/wallet to spend earned coins.
</p>
<div className="keys-footer">
<a className="keys-download" id="payoutKeyDownload" href={encodeJson(this.props.payout.jsonStore)} download={`payout_${this.props.payout.jsonStore.address}.json`}>Download Payout Key</a>
</div>
</div>
<div className="keys-i">
<p className="keys-title">Voting key</p>
<div className="keys-hash-container">
<p className="keys-hash" id="votingKey">0x{this.props.voting.jsonStore.address}</p>
<Tooltip
visible={this.state.copyBtns.copyVotingKey.visible}
animation="zoom"
trigger="hover"
onVisibleChange={() => { this.onVisibleChange('copyVotingKey')}}
placement="right"
overlay={this.state.copyBtns.copyVotingKey.text}
>
<span id="copyVotingKey" onClick={this.onCopyBtnClick} className="copy" ref="votingKeyAddress" data-clipboard-text={"0x"+this.props.voting.jsonStore.address} ></span>
</Tooltip>
</div>
<p className="keys-hash">
<label className="password-label">Password:</label>
<input type="password" disabled={true} id="votingKeyPass" className="pass" defaultValue={this.props.voting.password}/>
<Tooltip
visible={this.state.copyBtns.copyVotingPass.visible}
animation="zoom"
trigger="hover"
onVisibleChange={() => { this.onVisibleChange('copyVotingPass')}}
placement="right"
overlay={this.state.copyBtns.copyVotingPass.text}
>
<span id="copyVotingPass" onClick={this.onCopyBtnClick} className="copy" ref="votingKeyPass" data-clipboard-text={this.props.voting.password} ></span>
</Tooltip>
</p>
<p className="keys-description">
Download this key and use it on your client node to
vote for necessary ballots, such as adding or
removing miners from the network.
</p>
<div className="keys-footer">
<a className="keys-download" id="votingKeyDownload" href={encodeJson(this.props.voting.jsonStore)} download={`voting_${this.props.voting.jsonStore.address}.json`}>Download Voting Key</a>
</div>
</div>
</div>
<div className="keys-note">
<p className="keys-note-title">Important</p>
<p className="keys-note-description">
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.
</p>
</div>
</div>
)
} }
} }

View File

@ -1,14 +1,14 @@
import React from 'react'; import React from "react";
import { constants } from "./constants"; import { constants } from "./constants";
const styles = (netId) => { const styles = netId => {
const core = { const core = {
backgroundColor: 'rgba(35, 29, 115, 0.8)' backgroundColor: "rgba(35, 29, 115, 0.8)"
}; };
const sokol = { const sokol = {
backgroundColor: 'rgba(47, 109, 99, 0.8)' backgroundColor: "rgba(47, 109, 99, 0.8)"
} };
switch(netId) { switch (netId) {
case constants.NETID_SOKOL: case constants.NETID_SOKOL:
case constants.NETID_DAI_TEST: case constants.NETID_DAI_TEST:
return sokol; return sokol;
@ -18,17 +18,17 @@ const styles = (netId) => {
default: default:
return {}; return {};
} }
} };
const Loading = ({netId}) => ( const Loading = ({ netId }) => (
<div className="loading-container" style={styles(netId)}> <div className="loading-container" style={styles(netId)}>
<div className="loading"> <div className="loading">
<div className="loading-i"></div> <div className="loading-i" />
<div className="loading-i"></div> <div className="loading-i" />
<div className="loading-i"></div> <div className="loading-i" />
<div className="loading-i"></div> <div className="loading-i" />
<div className="loading-i"></div> <div className="loading-i" />
<div className="loading-i"></div> <div className="loading-i" />
</div> </div>
</div> </div>
) );
export default Loading; export default Loading;

View File

@ -1,16 +1,23 @@
import keythereum from 'keythereum'; import keythereum from "keythereum";
import passwordGenerator from 'password-generator'; import passwordGenerator from "password-generator";
export default function generateAddress(cb) { export default function generateAddress(cb) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
var params = { keyBytes: 32, ivBytes: 16 }; var params = { keyBytes: 32, ivBytes: 16 };
keythereum.create(params, function (dk) { keythereum.create(params, function(dk) {
var options = {}; var options = {};
var password = passwordGenerator(20, false); var password = passwordGenerator(20, false);
keythereum.dump(password, dk.privateKey, dk.salt, dk.iv, options, function (jsonStore) { keythereum.dump(
resolve({jsonStore, password}); password,
}); dk.privateKey,
dk.salt,
dk.iv,
options,
function(jsonStore) {
resolve({ jsonStore, password });
}
);
}); });
}) });
} }

View File

@ -1,36 +1,38 @@
import { constants } from "./constants"; import { constants } from "./constants";
import helpers from "./helpers"; import helpers from "./helpers";
//const local = { //const local = {
// "KEYS_MANAGER_ADDRESS": "0x3ef32bb244016ad9af8c8f45398511e7e551b581" // "KEYS_MANAGER_ADDRESS": "0x3ef32bb244016ad9af8c8f45398511e7e551b581"
//} //}
export default (web3Config) => { export default web3Config => {
let branch; let branch;
switch (web3Config.netId) { switch (web3Config.netId) {
case constants.NETID_DAI_TEST: case constants.NETID_DAI_TEST:
branch = "dai-test"; branch = "dai-test";
break; break;
case constants.NETID_SOKOL: case constants.NETID_SOKOL:
branch = "sokol"; branch = "sokol";
break; break;
case constants.NETID_DAI: case constants.NETID_DAI:
branch = "dai"; branch = "dai";
break; break;
case constants.NETID_CORE: case constants.NETID_CORE:
default: default:
branch = "core"; branch = "core";
break; break;
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fetch(helpers.addressesURL(branch)).then((response) => { fetch(helpers.addressesURL(branch))
response.json().then((json) => { .then(response => {
resolve({addresses: json, web3Config}); response.json().then(json => {
}) resolve({ addresses: json, web3Config });
}).catch(function(err) {
let addr = helpers.addressesURL(branch);
helpers.wrongRepoAlert(addr);
reject(err);
}); });
}) })
} .catch(function(err) {
let addr = helpers.addressesURL(branch);
helpers.wrongRepoAlert(addr);
reject(err);
});
});
};

View File

@ -1,11 +1,11 @@
let constants = {}; let constants = {};
constants.organization = 'poanetwork'; constants.organization = "poanetwork";
constants.repoName = 'poa-chain-spec'; constants.repoName = "poa-chain-spec";
constants.addressesSourceFile = 'contracts.json'; constants.addressesSourceFile = "contracts.json";
constants.ABIsSources = { 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_SOKOL = "77";
constants.NETID_CORE = "99"; constants.NETID_CORE = "99";
@ -14,4 +14,4 @@ constants.NETID_DAI = "100";
module.exports = { module.exports = {
constants constants
} };

View File

@ -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. Please choose your initial key in MetaMask and reload the page.
Check POA Network <a href='https://github.com/poanetwork/wiki' target='blank'>wiki</a> for more info.`; Check POA Network <a href='https://github.com/poanetwork/wiki' target='blank'>wiki</a> for more info.`;
function generateElement(msg){ function generateElement(msg) {
let errorNode = document.createElement("div"); let errorNode = document.createElement("div");
errorNode.innerHTML = `<div style="line-height: 1.6;"> errorNode.innerHTML = `<div style="line-height: 1.6;">
${msg} ${msg}
@ -12,36 +12,36 @@ function generateElement(msg){
return errorNode; return errorNode;
} }
let getWeb3 = () => { 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. // Wait for loading completion to avoid race conditions with web3 injection timing.
window.addEventListener('load', function () { window.addEventListener("load", function() {
var results var results;
var web3 = window.web3 var web3 = window.web3;
// Checking if Web3 has been injected by the browser (Mist/MetaMask) // Checking if Web3 has been injected by the browser (Mist/MetaMask)
if (typeof web3 !== 'undefined') { if (typeof web3 !== "undefined") {
// Use Mist/MetaMask's provider. // Use Mist/MetaMask's provider.
var errorMsg = null; var errorMsg = null;
web3 = new window.Web3(web3.currentProvider) web3 = new window.Web3(web3.currentProvider);
web3.version.getNetwork((err, netId) => { web3.version.getNetwork((err, netId) => {
let netIdName; let netIdName;
switch (netId) { switch (netId) {
case constants.NETID_SOKOL: case constants.NETID_SOKOL:
netIdName = "Sokol"; netIdName = "Sokol";
console.log("This is sokol"); console.log("This is sokol");
break break;
case constants.NETID_DAI_TEST: case constants.NETID_DAI_TEST:
netIdName = "Dai-Test"; netIdName = "Dai-Test";
console.log("This is Dai-Test"); console.log("This is Dai-Test");
break break;
case constants.NETID_CORE: case constants.NETID_CORE:
netIdName = "Core"; netIdName = "Core";
console.log("This is Core"); console.log("This is Core");
break break;
case constants.NETID_DAI: case constants.NETID_DAI:
netIdName = "Dai"; netIdName = "Dai";
console.log("This is Dai"); console.log("This is Dai");
break break;
default: default:
netIdName = "Unknown"; netIdName = "Unknown";
errorMsg = `You aren't connected to POA Network. errorMsg = `You aren't connected to POA Network.
@ -56,26 +56,31 @@ let getWeb3 = () => {
netIdName, netIdName,
netId, netId,
injectedWeb3: true injectedWeb3: true
} };
document.title = `${netIdName} - Dapp Keys Generation` document.title = `${netIdName} - Dapp Keys Generation`;
var defaultAccount = web3.eth.defaultAccount || null; var defaultAccount = web3.eth.defaultAccount || null;
if(defaultAccount === null){ if (defaultAccount === null) {
reject({msg: errorMsgNoMetamaskAccount, node: generateElement(errorMsgNoMetamaskAccount)}) reject({
msg: errorMsgNoMetamaskAccount,
node: generateElement(errorMsgNoMetamaskAccount)
});
} }
if(errorMsg !== null){ if (errorMsg !== null) {
reject({msg: errorMsg, node: generateElement(errorMsg)}) reject({ msg: errorMsg, node: generateElement(errorMsg) });
} }
resolve(results) resolve(results);
}) });
console.log('Injected web3 detected.');
console.log("Injected web3 detected.");
} else { } else {
reject({msg: errorMsgNoMetamaskAccount, node: generateElement(errorMsgNoMetamaskAccount)}) reject({
console.error('Metamask not found'); msg: errorMsgNoMetamaskAccount,
node: generateElement(errorMsgNoMetamaskAccount)
});
console.error("Metamask not found");
} }
}) });
}) });
} };
export default getWeb3 export default getWeb3;

View File

@ -1,68 +1,72 @@
import { constants } from "./constants"; import { constants } from "./constants";
import { messages } from "./messages"; import { messages } from "./messages";
import swal from 'sweetalert'; import swal from "sweetalert";
var toAscii = function(hex) { var toAscii = function(hex) {
var str = '', var str = "",
i = 0, i = 0,
l = hex.length; l = hex.length;
if (hex.substring(0, 2) === '0x') { if (hex.substring(0, 2) === "0x") {
i = 2; i = 2;
} }
for (; i < l; i+=2) { for (; i < l; i += 2) {
var code = parseInt(hex.substr(i, 2), 16); var code = parseInt(hex.substr(i, 2), 16);
if (code === 0) continue; // this is added if (code === 0) continue; // this is added
str += String.fromCharCode(code); str += String.fromCharCode(code);
} }
return str; return str;
}; };
function addressesURL(branch) { function addressesURL(branch) {
const URL = `https://raw.githubusercontent.com/${constants.organization}/${constants.repoName}/${branch}/${constants.addressesSourceFile}`; const URL = `https://raw.githubusercontent.com/${constants.organization}/${
return URL; constants.repoName
}/${branch}/${constants.addressesSourceFile}`;
return URL;
} }
function ABIURL(branch, contract) { function ABIURL(branch, contract) {
const URL = `https://raw.githubusercontent.com/${constants.organization}/${constants.repoName}/${branch}/abis/${constants.ABIsSources[contract]}`; const URL = `https://raw.githubusercontent.com/${constants.organization}/${
return URL; constants.repoName
}/${branch}/abis/${constants.ABIsSources[contract]}`;
return URL;
} }
function getABI(branch, contract) { function getABI(branch, contract) {
let addr = ABIURL(branch, contract); let addr = ABIURL(branch, contract);
return fetch(addr).then(function(response) { return fetch(addr).then(function(response) {
return response.json(); return response.json();
}) });
} }
function wrongRepoAlert(addr) { function wrongRepoAlert(addr) {
var content = document.createElement("div"); var content = document.createElement("div");
content.innerHTML = `<div> content.innerHTML = `<div>
Something went wrong!<br/><br/> Something went wrong!<br/><br/>
${messages.wrongRepo(addr)} ${messages.wrongRepo(addr)}
</div>`; </div>`;
swal({ swal({
icon: 'error', icon: "error",
title: 'Error', title: "Error",
content: content content: content
}); });
} }
function getBranch(netId) { function getBranch(netId) {
switch (netId) { switch (netId) {
case constants.NETID_DAI_TEST: case constants.NETID_DAI_TEST:
return "dai-test"; return "dai-test";
case constants.NETID_SOKOL: case constants.NETID_SOKOL:
return "sokol"; return "sokol";
case constants.NETID_DAI: case constants.NETID_DAI:
return "dai"; return "dai";
case constants.NETID_CORE: case constants.NETID_CORE:
default: default:
return "core"; return "core";
} }
} }
function isTestnet(netId) { 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 = { let helpers = {
@ -73,6 +77,6 @@ let helpers = {
wrongRepoAlert, wrongRepoAlert,
getBranch, getBranch,
isTestnet isTestnet
} };
export default helpers export default helpers;

View File

@ -1,9 +1,12 @@
import React from 'react'; import React from "react";
import ReactDOM from 'react-dom'; import ReactDOM from "react-dom";
import App from './App'; import App from "./App";
import registerServiceWorker from './registerServiceWorker'; import registerServiceWorker from "./registerServiceWorker";
window.addEventListener("beforeunload", function (event) { window.addEventListener("beforeunload", function(event) {
event.returnValue = "Are you sure?"; event.returnValue = "Are you sure?";
}); });
ReactDOM.render(<App generateKeysIsDisabled={true} />, document.getElementById('root')); ReactDOM.render(
registerServiceWorker(); <App generateKeysIsDisabled={true} />,
document.getElementById("root")
);
registerServiceWorker();

View File

@ -1,50 +1,59 @@
import Web3 from 'web3'; import Web3 from "web3";
import addressGenerator from './addressGenerator'; import addressGenerator from "./addressGenerator";
import helpers from "./helpers"; import helpers from "./helpers";
import { constants } from "./constants"; import { constants } from "./constants";
export default class KeysManager { export default class KeysManager {
async init({web3, netId, addresses}){ async init({ web3, netId, addresses }) {
this.web3_10 = new Web3(web3.currentProvider); this.web3_10 = new Web3(web3.currentProvider);
const {KEYS_MANAGER_ADDRESS} = addresses; const { KEYS_MANAGER_ADDRESS } = addresses;
console.log('Keys Manager ', KEYS_MANAGER_ADDRESS); console.log("Keys Manager ", KEYS_MANAGER_ADDRESS);
const branch = helpers.getBranch(netId); 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; this.netId = netId;
} }
async isInitialKeyValid(initialKey) { async isInitialKeyValid(initialKey) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const methods = this.keysInstance.methods const methods = this.keysInstance.methods;
let getInitialKeyStatus let getInitialKeyStatus;
if (methods.getInitialKeyStatus) { if (methods.getInitialKeyStatus) {
getInitialKeyStatus = methods.getInitialKeyStatus getInitialKeyStatus = methods.getInitialKeyStatus;
} else { } else {
getInitialKeyStatus = methods.initialKeys getInitialKeyStatus = methods.initialKeys;
} }
getInitialKeyStatus(initialKey).call().then(function(result){ getInitialKeyStatus(initialKey)
resolve(result); .call()
}).catch(function(e) { .then(function(result) {
reject(false); resolve(result);
}); })
}) .catch(function(e) {
reject(false);
});
});
} }
async generateKeys() { async generateKeys() {
return await addressGenerator(); return await addressGenerator();
} }
createKeys({mining, voting, payout, sender}){ createKeys({ mining, voting, payout, sender }) {
let gasPrice = '2'; let gasPrice = "2";
if (this.netId === constants.NETID_DAI_TEST || this.netId === constants.NETID_DAI) { if (
gasPrice = '0'; this.netId === constants.NETID_DAI_TEST ||
this.netId === constants.NETID_DAI
) {
gasPrice = "0";
} }
return this.keysInstance.methods.createKeys(mining, voting, payout).send({ return this.keysInstance.methods.createKeys(mining, voting, payout).send({
from: sender, from: sender,
gasPrice: this.web3_10.utils.toWei(gasPrice, 'gwei') gasPrice: this.web3_10.utils.toWei(gasPrice, "gwei")
}); });
} }
} }

View File

@ -1,7 +1,7 @@
let messages = {}; let messages = {};
messages.wrongRepo = function(repo) { 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 = { module.exports = {
messages messages
}; };

View File

@ -9,9 +9,9 @@
// This link also includes instructions on opting out of this behavior. // This link also includes instructions on opting out of this behavior.
const isLocalhost = Boolean( const isLocalhost = Boolean(
window.location.hostname === 'localhost' || window.location.hostname === "localhost" ||
// [::1] is the IPv6 localhost address. // [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' || window.location.hostname === "[::1]" ||
// 127.0.0.1/8 is considered localhost for IPv4. // 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match( window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ /^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() { 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. // The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL, window.location); const publicUrl = new URL(process.env.PUBLIC_URL, window.location);
if (publicUrl.origin !== window.location.origin) { if (publicUrl.origin !== window.location.origin) {
@ -29,7 +29,7 @@ export default function register() {
return; return;
} }
window.addEventListener('load', () => { window.addEventListener("load", () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
if (isLocalhost) { if (isLocalhost) {
@ -50,25 +50,25 @@ function registerValidSW(swUrl) {
registration.onupdatefound = () => { registration.onupdatefound = () => {
const installingWorker = registration.installing; const installingWorker = registration.installing;
installingWorker.onstatechange = () => { installingWorker.onstatechange = () => {
if (installingWorker.state === 'installed') { if (installingWorker.state === "installed") {
if (navigator.serviceWorker.controller) { if (navigator.serviceWorker.controller) {
// At this point, the old content will have been purged and // At this point, the old content will have been purged and
// the fresh content will have been added to the cache. // the fresh content will have been added to the cache.
// It's the perfect time to display a "New content is // It's the perfect time to display a "New content is
// available; please refresh." message in your web app. // 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 { } else {
// At this point, everything has been precached. // At this point, everything has been precached.
// It's the perfect time to display a // It's the perfect time to display a
// "Content is cached for offline use." message. // "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 => { .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. // Ensure service worker exists, and that we really are getting a JS file.
if ( if (
response.status === 404 || 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. // No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => { navigator.serviceWorker.ready.then(registration => {
@ -94,13 +94,13 @@ function checkValidServiceWorker(swUrl) {
}) })
.catch(() => { .catch(() => {
console.log( 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() { export function unregister() {
if ('serviceWorker' in navigator) { if ("serviceWorker" in navigator) {
navigator.serviceWorker.ready.then(registration => { navigator.serviceWorker.ready.then(registration => {
registration.unregister(); registration.unregister();
}); });