diff --git a/Cargo.lock b/Cargo.lock index 0d98ecd10..f531f7d6e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1263,7 +1263,7 @@ dependencies = [ [[package]] name = "parity-ui-precompiled" version = "1.4.0" -source = "git+https://github.com/ethcore/js-precompiled.git#7cb42b0c636f76eb478c9270a1e507ac3c3ba434" +source = "git+https://github.com/ethcore/js-precompiled.git#cb6836dddf8c9951e056283dcd9e105e97923d07" dependencies = [ "parity-dapps-glue 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/js/.babelrc b/js/.babelrc index 27c697885..2298d98c0 100644 --- a/js/.babelrc +++ b/js/.babelrc @@ -1,5 +1,8 @@ { - "presets": ["es2017", "es2016", "es2015", "stage-0", "react"], + "presets": [ + "es2017", "es2016", "es2015", + "stage-0", "react" + ], "plugins": [ "transform-runtime", "transform-decorators-legacy", @@ -10,6 +13,9 @@ "env": { "production": { "plugins": ["transform-react-remove-prop-types"] + }, + "development": { + "plugins": ["react-hot-loader/babel"] } } } diff --git a/js/.eslintrc.json b/js/.eslintrc.json index b649a1bea..198750580 100644 --- a/js/.eslintrc.json +++ b/js/.eslintrc.json @@ -15,6 +15,7 @@ "no-debugger": "error", "no-alert": "error", "jsx-quotes": ["error", "prefer-single"], - "react/jsx-curly-spacing": ["error", "always"] + "react/jsx-curly-spacing": ["error", "always"], + "object-property-newline": 0 } } diff --git a/js/.npmrc b/js/.npmrc new file mode 100644 index 000000000..3f7b4cf25 --- /dev/null +++ b/js/.npmrc @@ -0,0 +1 @@ +save-prefix='~' diff --git a/js/package.json b/js/package.json index 12b0cd9c6..a6f705ec6 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "parity.js", - "version": "0.2.74", + "version": "0.2.78", "main": "release/index.js", "jsnext:main": "src/index.js", "author": "Parity Team ", @@ -26,16 +26,16 @@ ], "scripts": { "build": "npm run build:lib && npm run build:dll && npm run build:app", - "build:app": "webpack --progress", - "build:lib": "webpack --config webpack.libraries --progress", - "build:dll": "webpack --config webpack.vendor --progress", + "build:app": "webpack --config webpack/app --progress", + "build:lib": "webpack --config webpack/libraries --progress", + "build:dll": "webpack --config webpack/vendor --progress", "ci:build": "npm run ci:build:lib && npm run ci:build:dll && npm run ci:build:app", - "ci:build:app": "NODE_ENV=production webpack", - "ci:build:lib": "NODE_ENV=production webpack --config webpack.libraries", - "ci:build:dll": "NODE_ENV=production webpack --config webpack.vendor", - "ci:build:npm": "NODE_ENV=production webpack --config webpack.npm", + "ci:build:app": "NODE_ENV=production webpack --config webpack/app", + "ci:build:lib": "NODE_ENV=production webpack --config webpack/libraries", + "ci:build:dll": "NODE_ENV=production webpack --config webpack/vendor", + "ci:build:npm": "NODE_ENV=production webpack --config webpack/npm", "start": "npm install && npm run build:lib && npm run build:dll && npm run start:app", - "start:app": "webpack-dev-server -d --history-api-fallback --open --hot --inline --progress --colors --port 3000", + "start:app": "node webpack/dev.server", "clean": "rm -rf ./build ./coverage", "coveralls": "npm run testCoverage && coveralls < coverage/lcov.info", "lint": "eslint --ignore-path .gitignore ./src/", @@ -47,127 +47,132 @@ "prepush": "npm run lint:cached" }, "devDependencies": { - "babel-cli": "^6.10.1", - "babel-core": "^6.10.4", - "babel-eslint": "^7.1.0", - "babel-loader": "^6.2.3", - "babel-plugin-lodash": "^3.2.2", - "babel-plugin-transform-class-properties": "^6.11.5", - "babel-plugin-transform-decorators-legacy": "^1.3.4", - "babel-plugin-transform-react-remove-prop-types": "^0.2.9", - "babel-plugin-transform-runtime": "^6.9.0", - "babel-polyfill": "^6.13.0", - "babel-preset-es2015": "^6.9.0", - "babel-preset-es2015-rollup": "^1.1.1", - "babel-preset-es2016": "^6.11.3", - "babel-preset-es2017": "^6.14.0", - "babel-preset-react": "^6.5.0", - "babel-preset-stage-0": "^6.5.0", - "babel-register": "6.9.0", - "babel-runtime": "^6.9.2", - "chai": "^3.5.0", + "babel-cli": "~6.18.0", + "babel-core": "~6.18.2", + "babel-eslint": "~7.1.0", + "babel-loader": "~6.2.3", + "babel-plugin-lodash": "~3.2.2", + "babel-plugin-transform-class-properties": "~6.19.0", + "babel-plugin-transform-decorators-legacy": "~1.3.4", + "babel-plugin-transform-react-remove-prop-types": "~0.2.9", + "babel-plugin-transform-runtime": "~6.15.0", + "babel-polyfill": "~6.16.0", + "babel-preset-es2015": "~6.18.0", + "babel-preset-es2015-rollup": "~1.2.0", + "babel-preset-es2016": "~6.16.0", + "babel-preset-es2017": "~6.16.0", + "babel-preset-react": "~6.16.0", + "babel-preset-stage-0": "~6.16.0", + "babel-register": "6.18.0", + "babel-runtime": "~6.18.0", + "chai": "~3.5.0", "chai-enzyme": "0.4.2", "cheerio": "0.20.0", - "copy-webpack-plugin": "^4.0.0", - "core-js": "^2.4.1", - "coveralls": "^2.11.11", - "css-loader": "^0.23.1", + "copy-webpack-plugin": "~4.0.0", + "core-js": "~2.4.1", + "coveralls": "~2.11.11", + "css-loader": "~0.26.0", "enzyme": "2.3.0", - "eslint": "^3.1.0", - "eslint-config-semistandard": "^6.0.2", - "eslint-config-standard": "^5.3.5", - "eslint-config-standard-react": "^3.0.0", - "eslint-plugin-promise": "^2.0.0", - "eslint-plugin-react": "^5.1.1", - "eslint-plugin-standard": "^2.0.0", - "extract-loader": "0.0.2", - "extract-text-webpack-plugin": "^1.0.1", - "file-loader": "^0.8.5", - "fs-extra": "^0.30.0", - "happypack": "^2.2.1", - "history": "^2.0.0", - "html-loader": "^0.4.4", - "husky": "^0.11.9", + "eslint": "~3.10.2", + "eslint-config-semistandard": "~7.0.0", + "eslint-config-standard": "~6.2.1", + "eslint-config-standard-react": "~4.2.0", + "eslint-plugin-promise": "~3.4.0", + "eslint-plugin-react": "~6.7.1", + "eslint-plugin-standard": "~2.0.0", + "express": "~4.14.0", + "extract-loader": "0.1.0", + "extract-text-webpack-plugin": "~2.0.0-beta.4", + "file-loader": "~0.9.0", + "fs-extra": "~0.30.0", + "happypack": "~3.0.0", + "history": "~2.0.0", + "html-loader": "~0.4.4", + "html-webpack-plugin": "~2.24.1", + "http-proxy-middleware": "~0.17.2", + "husky": "~0.11.9", "ignore-styles": "2.0.0", - "image-webpack-loader": "^1.8.0", - "istanbul": "^1.0.0-alpha.2", + "image-webpack-loader": "~3.0.0", + "istanbul": "~1.0.0-alpha.2", "jsdom": "9.2.1", - "json-loader": "^0.5.4", - "mocha": "^3.0.0-1", + "json-loader": "~0.5.4", + "mocha": "~3.0.0-1", "mock-local-storage": "1.0.2", - "mock-socket": "^3.0.1", - "nock": "^8.0.0", - "postcss-import": "^8.1.2", - "postcss-loader": "^0.8.1", - "postcss-nested": "^1.0.0", - "postcss-simple-vars": "^3.0.0", - "raw-loader": "^0.5.1", + "mock-socket": "~3.0.1", + "nock": "~8.0.0", + "postcss-import": "8.1.0", + "postcss-loader": "~1.1.1", + "postcss-nested": "~1.0.0", + "postcss-simple-vars": "~3.0.0", + "progress": "~1.1.8", + "raw-loader": "~0.5.1", "react-addons-perf": "~15.3.2", "react-addons-test-utils": "~15.3.2", - "react-copy-to-clipboard": "^4.2.3", "react-dom": "~15.3.2", - "react-hot-loader": "~1.3.0", - "rucksack-css": "^0.8.6", - "sinon": "^1.17.4", - "sinon-as-promised": "^4.0.2", - "sinon-chai": "^2.8.0", - "style-loader": "^0.13.0", - "url-loader": "^0.5.7", - "webpack": "^1.13.2", - "webpack-dev-server": "^1.15.2", + "react-hot-loader": "~3.0.0-beta.6", + "rucksack-css": "~0.8.6", + "sinon": "~1.17.4", + "sinon-as-promised": "~4.0.2", + "sinon-chai": "~2.8.0", + "style-loader": "~0.13.0", + "url-loader": "~0.5.7", + "webpack": "~2.1.0-beta.27", + "webpack-dev-middleware": "~1.8.4", "webpack-error-notification": "0.1.6", "webpack-hot-middleware": "~2.13.2", - "websocket": "^1.0.23" + "websocket": "~1.0.23" }, "dependencies": { - "bignumber.js": "^2.3.0", + "bignumber.js": "~2.3.0", "blockies": "0.0.2", - "brace": "^0.9.0", - "bytes": "^2.4.0", - "chart.js": "^2.3.0", - "es6-error": "^4.0.0", - "es6-promise": "^3.2.1", - "ethereumjs-tx": "^1.1.2", - "file-saver": "^1.3.3", - "format-json": "^1.0.3", - "format-number": "^2.0.1", - "geopattern": "^1.2.3", - "isomorphic-fetch": "^2.2.1", - "js-sha3": "^0.5.2", - "lodash": "^4.11.1", - "marked": "^0.3.6", + "brace": "~0.9.0", + "bytes": "~2.4.0", + "chart.js": "~2.3.0", + "es6-error": "~4.0.0", + "es6-promise": "~3.2.1", + "ethereumjs-tx": "~1.1.2", + "eventemitter3": "~2.0.2", + "file-saver": "~1.3.3", + "format-json": "~1.0.3", + "format-number": "~2.0.1", + "geopattern": "~1.2.3", + "isomorphic-fetch": "~2.2.1", + "js-sha3": "~0.5.2", + "lodash": "~4.11.1", + "marked": "~0.3.6", "material-ui": "0.16.1", - "material-ui-chip-input": "^0.8.0", - "mobx": "^2.6.1", - "mobx-react": "^3.5.8", - "mobx-react-devtools": "^4.2.9", - "moment": "^2.14.1", - "phoneformat.js": "^1.0.3", - "qs": "^6.3.0", + "material-ui-chip-input": "~0.8.0", + "mobx": "~2.6.1", + "mobx-react": "~3.5.8", + "mobx-react-devtools": "~4.2.9", + "moment": "~2.14.1", + "phoneformat.js": "~1.0.3", + "qs": "~6.3.0", "react": "~15.3.2", - "react-ace": "^4.0.0", + "react-ace": "~4.0.0", "react-addons-css-transition-group": "~15.3.2", - "react-chartjs-2": "^1.5.0", + "react-chartjs-2": "~1.5.0", + "react-copy-to-clipboard": "~4.2.3", "react-dom": "~15.3.2", - "react-dropzone": "^3.7.3", - "react-redux": "^4.4.5", - "react-router": "^2.6.1", - "react-router-redux": "^4.0.5", + "react-dropzone": "~3.7.3", + "react-redux": "~4.4.5", + "react-router": "~2.6.1", + "react-router-redux": "~4.0.5", "react-tap-event-plugin": "~1.0.0", - "react-tooltip": "^2.0.3", - "recharts": "^0.15.2", - "redux": "^3.5.2", - "redux-actions": "^0.10.1", - "redux-thunk": "^2.1.0", - "rlp": "^2.0.0", - "scryptsy": "^2.0.0", + "react-tooltip": "~2.0.3", + "recharts": "~0.15.2", + "redux": "~3.5.2", + "redux-actions": "~0.10.1", + "redux-thunk": "~2.1.0", + "rlp": "~2.0.0", + "scryptsy": "~2.0.0", "solc": "ngotchac/solc-js", - "store": "^1.3.20", - "utf8": "^2.1.1", - "valid-url": "^1.0.9", - "validator": "^5.7.0", - "web3": "^0.17.0-beta", - "whatwg-fetch": "^1.0.0", - "worker-loader": "^0.7.1" + "store": "~1.3.20", + "utf8": "~2.1.1", + "valid-url": "~1.0.9", + "validator": "~5.7.0", + "web3": "~0.17.0-beta", + "whatwg-fetch": "~1.0.0", + "worker-loader": "~0.7.1" } } diff --git a/js/src/3rdparty/sms-verification/index.js b/js/src/3rdparty/sms-verification/index.js index 9b113f364..c50b2331a 100644 --- a/js/src/3rdparty/sms-verification/index.js +++ b/js/src/3rdparty/sms-verification/index.js @@ -27,9 +27,10 @@ export const termsOfService = ( ); -export const postToServer = (query) => { +export const postToServer = (query, isTestnet = false) => { + const port = isTestnet ? 8443 : 443; query = stringify(query); - return fetch('https://sms-verification.parity.io/?' + query, { + return fetch(`https://sms-verification.parity.io:${port}/?` + query, { method: 'POST', mode: 'cors', cache: 'no-store' }) .then((res) => { diff --git a/js/src/api/contract/contract.js b/js/src/api/contract/contract.js index 6fe497551..c1ba8498d 100644 --- a/js/src/api/contract/contract.js +++ b/js/src/api/contract/contract.js @@ -15,16 +15,16 @@ // along with Parity. If not, see . import Abi from '../../abi'; -import Api from '../api'; -import { isInstanceOf } from '../util/types'; let nextSubscriptionId = 0; export default class Contract { constructor (api, abi) { - if (!isInstanceOf(api, Api)) { + if (!api) { throw new Error('API instance needs to be provided to Contract'); - } else if (!abi) { + } + + if (!abi) { throw new Error('ABI needs to be provided to Contract instance'); } diff --git a/js/src/api/format/input.js b/js/src/api/format/input.js index 80f3bc0eb..6d261c674 100644 --- a/js/src/api/format/input.js +++ b/js/src/api/format/input.js @@ -17,7 +17,7 @@ import BigNumber from 'bignumber.js'; import { isArray, isHex, isInstanceOf, isString } from '../util/types'; -import { padLeft } from '../util/format'; +import { padLeft, toHex } from '../util/format'; export function inAddress (address) { // TODO: address validation if we have upper-lower addresses @@ -100,15 +100,7 @@ export function inFilter (options) { } export function inHex (str) { - if (str && str.toString) { - str = str.toString(16); - } - - if (str && str.substr(0, 2) === '0x') { - return str.toLowerCase(); - } - - return `0x${(str || '').toLowerCase()}`; + return toHex(str); } export function inNumber10 (number) { diff --git a/js/src/api/util/format.js b/js/src/api/util/format.js index f1909748d..7f60357cd 100644 --- a/js/src/api/util/format.js +++ b/js/src/api/util/format.js @@ -15,7 +15,6 @@ // along with Parity. If not, see . import { range } from 'lodash'; -import { inHex } from '../format/input'; export function bytesToHex (bytes) { return '0x' + bytes.map((b) => ('0' + b.toString(16)).slice(-2)).join(''); @@ -38,11 +37,23 @@ export function asciiToHex (string) { } export function padRight (input, length) { - const value = inHex(input).substr(2, length * 2); + const value = toHex(input).substr(2, length * 2); return '0x' + value + range(length * 2 - value.length).map(() => '0').join(''); } export function padLeft (input, length) { - const value = inHex(input).substr(2, length * 2); + const value = toHex(input).substr(2, length * 2); return '0x' + range(length * 2 - value.length).map(() => '0').join('') + value; } + +export function toHex (str) { + if (str && str.toString) { + str = str.toString(16); + } + + if (str && str.substr(0, 2) === '0x') { + return str.toLowerCase(); + } + + return `0x${(str || '').toLowerCase()}`; +} diff --git a/js/src/contracts/abi/sms-verification.json b/js/src/contracts/abi/sms-verification.json index 400d22b44..d6852b182 100644 --- a/js/src/contracts/abi/sms-verification.json +++ b/js/src/contracts/abi/sms-verification.json @@ -1 +1 @@ -[{"constant":false,"inputs":[{"name":"_new","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_who","type":"address"}],"name":"certify","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"request","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_who","type":"address"},{"name":"_puzzle","type":"bytes32"}],"name":"puzzle","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_field","type":"string"}],"name":"getAddress","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_new","type":"uint256"}],"name":"setFee","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_who","type":"address"}],"name":"revoke","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_code","type":"bytes32"}],"name":"confirm","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"drain","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"delegate","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_field","type":"string"}],"name":"getUint","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_new","type":"address"}],"name":"setDelegate","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"}],"name":"certified","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"fee","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_field","type":"string"}],"name":"get","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"}],"name":"Requested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"},{"indexed":false,"name":"puzzle","type":"bytes32"}],"name":"Puzzled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"}],"name":"Confirmed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"}],"name":"Revoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"old","type":"address"},{"indexed":true,"name":"current","type":"address"}],"name":"NewOwner","type":"event"}] +[{"constant":false,"inputs":[{"name":"_new","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_who","type":"address"}],"name":"certify","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"request","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_who","type":"address"},{"name":"_puzzle","type":"bytes32"}],"name":"puzzle","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_field","type":"string"}],"name":"getAddress","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_new","type":"uint256"}],"name":"setFee","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_who","type":"address"}],"name":"revoke","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_code","type":"bytes32"}],"name":"confirm","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"drain","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"delegate","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_field","type":"string"}],"name":"getUint","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_new","type":"address"}],"name":"setDelegate","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"}],"name":"certified","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"fee","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_field","type":"string"}],"name":"get","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"}],"name":"Requested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"},{"indexed":false,"name":"puzzle","type":"bytes32"}],"name":"Puzzled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"}],"name":"Confirmed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"}],"name":"Revoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"old","type":"address"},{"indexed":true,"name":"current","type":"address"}],"name":"NewOwner","type":"event"}] diff --git a/js/src/contracts/contracts.js b/js/src/contracts/contracts.js index 9d745762c..cefece7de 100644 --- a/js/src/contracts/contracts.js +++ b/js/src/contracts/contracts.js @@ -19,7 +19,7 @@ import Registry from './registry'; import SignatureReg from './signaturereg'; import TokenReg from './tokenreg'; import GithubHint from './githubhint'; -import smsVerification from './sms-verification'; +import * as smsVerification from './sms-verification'; let instance = null; diff --git a/js/src/contracts/sms-verification.js b/js/src/contracts/sms-verification.js index 2d32556ea..34a6bad76 100644 --- a/js/src/contracts/sms-verification.js +++ b/js/src/contracts/sms-verification.js @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . +import subscribeToEvent from '../util/subscribe-to-event'; + export const checkIfVerified = (contract, account) => { return contract.instance.certified.call({}, [account]); }; @@ -50,3 +52,36 @@ export const checkIfRequested = (contract, account) => { }); }); }; + +const blockNumber = (api) => { + return new Promise((resolve, reject) => { + api.subscribe('eth_blockNumber', (err, block) => { + if (err) { + return reject(err); + } + resolve(block); + }) + .then((subscription) => { + api.unsubscribe(subscription); + }) + .catch(reject); + }); +}; + +export const awaitPuzzle = (api, contract, account) => { + return blockNumber(api) + .then((block) => { + return new Promise((resolve, reject) => { + const subscription = subscribeToEvent(contract, 'Puzzled', { + from: block.toNumber(), + filter: (log) => log.params.who.value === account + }); + subscription.once('error', reject); + subscription.once('log', subscription.unsubscribe); + subscription.once('log', resolve); + subscription.once('timeout', () => { + reject(new Error('Timed out waiting for the puzzle.')); + }); + }); + }); +}; diff --git a/js/src/dapps/basiccoin.html b/js/src/dapps/basiccoin.html deleted file mode 100644 index 52bc8bc57..000000000 --- a/js/src/dapps/basiccoin.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - Basic Token Deployment - - -
- - - - - - diff --git a/js/src/dapps/basiccoin.js b/js/src/dapps/basiccoin.js index e02990d14..a64afa0b9 100644 --- a/js/src/dapps/basiccoin.js +++ b/js/src/dapps/basiccoin.js @@ -32,7 +32,6 @@ const routerHistory = useRouterHistory(createHashHistory)({}); import '../../assets/fonts/Roboto/font.css'; import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; -import './basiccoin.html'; ReactDOM.render( diff --git a/js/src/dapps/dappreg.html b/js/src/dapps/dappreg.html deleted file mode 100644 index 89c95c472..000000000 --- a/js/src/dapps/dappreg.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - Dapp Registry - - -
- - - - - - diff --git a/js/src/dapps/dappreg.js b/js/src/dapps/dappreg.js index 243576a34..8ed9724bc 100644 --- a/js/src/dapps/dappreg.js +++ b/js/src/dapps/dappreg.js @@ -27,7 +27,6 @@ import Application from './dappreg/Application'; import '../../assets/fonts/Roboto/font.css'; import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; -import './dappreg.html'; ReactDOM.render( , diff --git a/js/src/dapps/githubhint.html b/js/src/dapps/githubhint.html deleted file mode 100644 index 746c7f466..000000000 --- a/js/src/dapps/githubhint.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - GitHub Hint - - -
- - - - - diff --git a/js/src/dapps/githubhint.js b/js/src/dapps/githubhint.js index b73702990..ab807a44b 100644 --- a/js/src/dapps/githubhint.js +++ b/js/src/dapps/githubhint.js @@ -25,7 +25,6 @@ import Application from './githubhint/Application'; import '../../assets/fonts/Roboto/font.css'; import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; -import './githubhint.html'; ReactDOM.render( , diff --git a/js/src/dapps/index.ejs b/js/src/dapps/index.ejs new file mode 100644 index 000000000..250194529 --- /dev/null +++ b/js/src/dapps/index.ejs @@ -0,0 +1,42 @@ + + + + + + + <%= htmlWebpackPlugin.options.title %> + + + +
+
+ Loading... +
+
+ + <% if (!htmlWebpackPlugin.options.secure) { %> + + <% } %> + + diff --git a/js/src/dapps/index.js b/js/src/dapps/index.js new file mode 100644 index 000000000..9cba69701 --- /dev/null +++ b/js/src/dapps/index.js @@ -0,0 +1,25 @@ +// Copyright 2015, 2016 Ethcore (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +module.exports = [ + { name: 'basiccoin', entry: 'basiccoin.js', title: 'Basic Token Deployment' }, + { name: 'dappreg', entry: 'dappreg.js', title: 'Dapp Registry' }, + { name: 'githubhint', entry: 'githubhint.js', title: 'GitHub Hint', secure: true }, + { name: 'localtx', entry: 'localtx.js', title: 'Local transactions Viewer', secure: true }, + { name: 'registry', entry: 'registry.js', title: 'Registry' }, + { name: 'signaturereg', entry: 'signaturereg.js', title: 'Method Signature Registry' }, + { name: 'tokenreg', entry: 'tokenreg.js', title: 'Token Registry' } +]; diff --git a/js/src/dapps/localtx.html b/js/src/dapps/localtx.html deleted file mode 100644 index d1e6fed05..000000000 --- a/js/src/dapps/localtx.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - Local transactions Viewer - - -
- - - - - - diff --git a/js/src/dapps/localtx.js b/js/src/dapps/localtx.js index 98561f33f..3e848ede9 100644 --- a/js/src/dapps/localtx.js +++ b/js/src/dapps/localtx.js @@ -25,7 +25,6 @@ import Application from './localtx/Application'; import '../../assets/fonts/Roboto/font.css'; import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; -import './localtx.html'; ReactDOM.render( , diff --git a/js/src/dapps/localtx/Application/application.js b/js/src/dapps/localtx/Application/application.js index 7d220611f..da435b57d 100644 --- a/js/src/dapps/localtx/Application/application.js +++ b/js/src/dapps/localtx/Application/application.js @@ -158,18 +158,18 @@ export default class Application extends Component { { Transaction.renderHeader() } - { - transactions.map((tx, idx) => ( - - )) - } + { + transactions.map((tx, idx) => ( + + )) + } ); diff --git a/js/src/dapps/localtx/Transaction/transaction.js b/js/src/dapps/localtx/Transaction/transaction.js index 90981304b..17a45ecd6 100644 --- a/js/src/dapps/localtx/Transaction/transaction.js +++ b/js/src/dapps/localtx/Transaction/transaction.js @@ -83,7 +83,7 @@ class BaseTransaction extends Component { return ( - { noOfPropagations } ({ noOfPeers } peers) + { noOfPropagations } ({ noOfPeers } peers) ); } @@ -110,7 +110,7 @@ export class Transaction extends BaseTransaction { static renderHeader () { return ( - + Transaction @@ -129,8 +129,7 @@ export class Transaction extends BaseTransaction { # Propagated - - + ); } @@ -201,7 +200,7 @@ export class LocalTransaction extends BaseTransaction { static renderHeader () { return ( - + Transaction diff --git a/js/src/dapps/registry.html b/js/src/dapps/registry.html deleted file mode 100644 index ab399d1e3..000000000 --- a/js/src/dapps/registry.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - Token Registry - - -
- - - - - - diff --git a/js/src/dapps/registry.js b/js/src/dapps/registry.js index ebcff155a..d132da3d8 100644 --- a/js/src/dapps/registry.js +++ b/js/src/dapps/registry.js @@ -27,7 +27,6 @@ import Container from './registry/Container'; import '../../assets/fonts/Roboto/font.css'; import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; -import './registry.html'; ReactDOM.render( diff --git a/js/src/dapps/signaturereg.html b/js/src/dapps/signaturereg.html deleted file mode 100644 index d050fe803..000000000 --- a/js/src/dapps/signaturereg.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - Method Signature Registry - - -
- - - - - - diff --git a/js/src/dapps/signaturereg.js b/js/src/dapps/signaturereg.js index 72ddd0ca7..d0d0cd423 100644 --- a/js/src/dapps/signaturereg.js +++ b/js/src/dapps/signaturereg.js @@ -25,7 +25,6 @@ import Application from './signaturereg/Application'; import '../../assets/fonts/Roboto/font.css'; import '../../assets/fonts/RobotoMono/font.css'; import './style.css'; -import './signaturereg.html'; ReactDOM.render( , diff --git a/js/src/dapps/signaturereg/Import/import.js b/js/src/dapps/signaturereg/Import/import.js index 90edf9415..55f7d9334 100644 --- a/js/src/dapps/signaturereg/Import/import.js +++ b/js/src/dapps/signaturereg/Import/import.js @@ -73,7 +73,7 @@ export default class Import extends Component { Provide the ABI (Contract Interface) in the space provided below. Only non-constant functions (names & types) will be imported, while constant functions and existing signatures will be ignored.
- +