Ui 2 parity build fixes (#6182)

* Update API reference

* Deprecation warning

* Add missing parity-reactive-ui

* Add dapps to packages/dapps

* Add parity.js dependency

* Update with js-ui with compiled bundle.js
This commit is contained in:
Jaco Greeff 2017-07-28 17:56:48 +02:00 committed by GitHub
parent 4000ec681f
commit abb62d5c2a
18 changed files with 50 additions and 554 deletions

52
js/package-lock.json generated
View File

@ -94,9 +94,26 @@
}
},
"@parity/etherscan": {
"version": "file:packages/etherscan",
"version": "github:paritytech/js-etherscan#efe859ac7d2a8a3cc05e01c689b7fa58f47f8b87",
"requires": {
"node-fetch": "1.6.3"
"@parity/api": "github:paritytech/js-api#1c7cc5561c4e8db0d0b58f22d8bc8baa243909a5",
"bignumber.js": "3.0.1",
"es6-promise": "4.1.1",
"node-fetch": "1.6.3",
"qs": "6.5.0",
"whatwg-fetch": "2.0.3"
},
"dependencies": {
"es6-promise": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.1.tgz",
"integrity": "sha512-OaU1hHjgJf+b0NzsxCg7NdIYERD6Hy/PEmFLTjw+b65scuisG3Kt4QoTvJ66BBkPZ581gr0kpoVzKnxniM8nng=="
},
"whatwg-fetch": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz",
"integrity": "sha1-nITsLc9oGH/wC8ZOEnS0QhduHIQ="
}
}
},
"@parity/jsonrpc": {
@ -144,26 +161,40 @@
}
},
"@parity/ui": {
"version": "github:paritytech/js-ui#315bec33a621184db1bd235f115f8f24e8c63192",
"version": "github:paritytech/js-ui#73b6241d727afe6b1bc04d7b093093a5d542c5c8",
"requires": {
"@parity/api": "github:paritytech/js-api#1c7cc5561c4e8db0d0b58f22d8bc8baa243909a5",
"@parity/etherscan": "github:paritytech/js-etherscan#efe859ac7d2a8a3cc05e01c689b7fa58f47f8b87",
"@parity/shared": "github:paritytech/js-shared#a83c71946d30d5b3bf976860a676add29c48ee24",
"bignumber.js": "3.0.1",
"brace": "0.9.0",
"date-difference": "1.0.0",
"eventemitter3": "2.0.3",
"file-saver": "1.3.3",
"geopattern": "1.2.3",
"js-sha3": "0.5.5",
"keycode": "2.1.9",
"lodash": "4.17.2",
"mobx": "2.6.4",
"mobx-react": "4.0.3",
"moment": "2.17.0",
"qrcode-generator": "1.2.0",
"react": "15.6.1",
"react-ace": "4.1.0",
"react-copy-to-clipboard": "4.2.3",
"react-datetime": "2.8.10",
"react-dom": "15.6.1",
"react-dropzone": "3.7.3",
"react-event-listener": "0.4.5",
"react-intl": "2.1.5",
"react-portal": "3.0.0",
"react-qr-reader": "1.1.3",
"react-router": "3.0.0",
"react-router-redux": "4.0.7",
"react-tap-event-plugin": "2.0.1",
"react-tooltip": "3.2.2",
"recharts": "0.15.2",
"redux": "3.6.0",
"semantic-ui-css": "2.2.11",
"semantic-ui-react": "0.71.2",
"zxcvbn": "4.4.1"
@ -10479,7 +10510,7 @@
"lodash": "4.17.2",
"mkdirp": "0.5.1",
"propagate": "0.4.0",
"qs": "6.3.2"
"qs": "6.5.0"
}
},
"node-abi": {
@ -12178,10 +12209,9 @@
"integrity": "sha1-8YZUY/F4ZUfrsJDnxDC/PK9DoBc="
},
"qs": {
"version": "6.3.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz",
"integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=",
"dev": true
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.0.tgz",
"integrity": "sha512-fjVFjW9yhqMhVGwRExCXLhJKrLlkYSaxNWdyc9rmHlrVZbk35YHH312dFd7191uQeXkI3mKLZTIbSvIeFwFemg=="
},
"query-string": {
"version": "4.3.4",
@ -13119,6 +13149,12 @@
"integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=",
"dev": true
},
"qs": {
"version": "6.3.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz",
"integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=",
"dev": true
},
"tunnel-agent": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz",

View File

@ -162,11 +162,11 @@
"dependencies": {
"@parity/api": "paritytech/js-api#1c7cc5561c4e8db0d0b58f22d8bc8baa243909a5",
"@parity/dapps": "file:packages/dapps",
"@parity/etherscan": "file:packages/etherscan",
"@parity/etherscan": "paritytech/js-etherscan#efe859ac7d2a8a3cc05e01c689b7fa58f47f8b87",
"@parity/ledger": "file:packages/ledger",
"@parity/shapeshift": "file:packages/shapeshift",
"@parity/shared": "paritytech/js-shared#a83c71946d30d5b3bf976860a676add29c48ee24",
"@parity/ui": "paritytech/js-ui#315bec33a621184db1bd235f115f8f24e8c63192",
"@parity/ui": "paritytech/js-ui#73b6241d727afe6b1bc04d7b093093a5d542c5c8",
"@parity/wordlist": "1.0.1",
"es6-error": "4.0.0",
"es6-promise": "4.0.5",

View File

@ -1,34 +0,0 @@
# @parity/etherscan
A thin, lightweight promise wrapper for the api.etherscan.io/apis service, exposing a common endpoint for use in JavaScript applications.
[https://github.com/paritytech/parity/tree/master/js/packages/3rdpartyetherscan](https://github.com/paritytech/parity/tree/master/js/packages/etherscan)
## usage
installation -
```
npm install --save @parity/etherscan
```
Usage -
```
const etherscan = require('@parity/etherscan');
// api calls goes here
```
## api
account (exposed on etherscan.account) -
- `balance(address)`
- `balances(addresses)` (array or addresses)
- `transactions(address, page)` (page offset starts at 0, returns 25)
stats (exposed on etherscan.stats) -
- `price()`
- `supply()`

View File

@ -1,75 +0,0 @@
// Copyright 2015-2017 Parity Technologies (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 <http://www.gnu.org/licenses/>.
import BigNumber from 'bignumber.js';
const PAGE_SIZE = 25;
import util from '@parity/api/util';
import { call } from './call';
function _call (method, params, test, netVersion) {
return call('account', method, params, test, netVersion);
}
function balance (address, test, netVersion) {
return _call('balance', {
address: address,
tag: 'latest'
}, test, netVersion).then((balance) => {
// same format as balancemulti below
return {
account: address,
balance: balance
};
});
}
function balances (addresses, test, netVersion) {
return _call('balancemulti', {
address: addresses.join(','),
tag: 'latest'
}, test, netVersion);
}
function transactions (address, page, test, netVersion) {
// page offset from 0
return _call('txlist', {
address: address,
offset: PAGE_SIZE,
page: (page || 0) + 1,
sort: 'desc'
}, test, netVersion).then((transactions) => {
return transactions.map((tx) => {
return {
blockNumber: new BigNumber(tx.blockNumber || 0),
from: util.toChecksumAddress(tx.from),
hash: tx.hash,
timeStamp: tx.timeStamp,
to: util.toChecksumAddress(tx.to),
value: tx.value
};
});
});
}
const account = {
balance,
balances,
transactions
};
export { account };

View File

@ -1,71 +0,0 @@
// Copyright 2015-2017 Parity Technologies (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 <http://www.gnu.org/licenses/>.
const etherscan = require('./');
const TESTADDR = '0xbf885e2b55c6bcc84556a3c5f07d3040833c8d00';
describe.skip('etherscan/account', function () {
this.timeout(60 * 1000);
const checkBalance = function (balance, addr) {
expect(balance).to.be.ok;
expect(balance.account).to.equal(addr);
expect(balance.balance).to.be.ok;
};
it('retrieves an account balance', () => {
return etherscan.account
.balance(TESTADDR)
.then((balance) => {
checkBalance(balance, TESTADDR);
});
});
it('retrieves multi account balances', () => {
const addresses = ['0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae', TESTADDR];
return etherscan.account
.balances(addresses)
.then((balances) => {
expect(balances).to.be.ok;
expect(balances.length).to.equal(2);
balances.forEach((balance, idx) => {
checkBalance(balance, addresses[idx]);
});
});
});
describe('transactions', () => {
it('retrieves a list of transactions (default)', () => {
return etherscan.account
.transactions(TESTADDR)
.then((transactions) => {
expect(transactions).to.be.ok;
expect(transactions.length).to.equal(25);
});
});
it('retrieves a list of transactions (page 1)', () => {
return etherscan.account
.transactions(TESTADDR, 1)
.then((transactions) => {
expect(transactions).to.be.ok;
expect(transactions.length).to.equal(25);
});
});
});
});

View File

@ -1,47 +0,0 @@
// Copyright 2015-2017 Parity Technologies (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 <http://www.gnu.org/licenses/>.
import { stringify } from 'qs';
import { apiLink } from './links';
const options = {
method: 'GET',
headers: {
'Accept': 'application/json'
}
};
export function call (module, action, _params, test, netVersion) {
const query = stringify(Object.assign({
module, action
}, _params || {}));
return fetch(apiLink(query, test, netVersion), options)
.then((response) => {
if (!response.ok) {
throw { code: response.status, message: response.statusText }; // eslint-disable-line
}
return response.json();
})
.then((result) => {
if (result.message === 'NOTOK') {
throw { code: -1, message: result.result }; // eslint-disable-line
}
return result.result;
});
}

View File

@ -1,38 +0,0 @@
// Copyright 2015-2017 Parity Technologies (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 <http://www.gnu.org/licenses/>.
import nock from 'nock';
import { stringify } from 'qs';
import { url } from './links';
function mockget (requests, test, netVersion) {
let scope = nock(url(test, netVersion));
requests.forEach((request) => {
scope = scope
.get(`/api?${stringify(request.query)}`)
.reply(request.code || 200, () => {
return { result: request.reply };
});
});
return scope;
}
export {
mockget
};

View File

@ -1,28 +0,0 @@
// Copyright 2015-2017 Parity Technologies (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 <http://www.gnu.org/licenses/>.
import { account } from './account';
import { stats } from './stats';
import { txLink, addressLink } from './links';
const etherscan = {
account: account,
stats: stats,
txLink: txLink,
addressLink: addressLink
};
export default etherscan;

View File

@ -1,33 +0,0 @@
// Copyright 2015-2017 Parity Technologies (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 <http://www.gnu.org/licenses/>.
import es6Promise from 'es6-promise';
es6Promise.polyfill();
const isNode = typeof global !== 'undefined' && typeof global !== 'undefined';
const isBrowser = typeof self !== 'undefined' && typeof self.window !== 'undefined';
if (isBrowser) {
require('whatwg-fetch');
}
if (isNode) {
global.fetch = require('node-fetch');
}
import Etherscan from './';
export default Etherscan;

View File

@ -1,55 +0,0 @@
// Copyright 2015-2017 Parity Technologies (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 <http://www.gnu.org/licenses/>.
// NOTE: Keep 'isTestnet' for backwards library compatibility
const getUrlPrefix = (isTestnet = false, netVersion = '0', defaultPrefix = '') => {
if (isTestnet) {
return 'ropsten.';
}
switch (netVersion) {
case '1':
return defaultPrefix;
case '3':
return 'ropsten.';
case '4':
return 'rinkeby.';
case '42':
return 'kovan.';
default:
return 'testnet.';
}
};
export const url = (isTestnet = false, netVersion = '0', defaultPrefix = '') => {
return `https://${getUrlPrefix(isTestnet, netVersion, defaultPrefix)}etherscan.io`;
};
export const txLink = (hash, isTestnet = false, netVersion = '0') => {
return `${url(isTestnet, netVersion)}/tx/${hash}`;
};
export const addressLink = (address, isTestnet = false, netVersion = '0') => {
return `${url(isTestnet, netVersion)}/address/${address}`;
};
export const apiLink = (query, isTestnet = false, netVersion = '0') => {
return `${url(isTestnet, netVersion, 'api.')}/api?${query}`;
};

View File

@ -1,57 +0,0 @@
// Copyright 2015-2017 Parity Technologies (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 <http://www.gnu.org/licenses/>.
const { url, txLink, addressLink, apiLink } = require('./links');
describe('etherscan/links', function () {
it('builds link with a prefix', () => {
expect(url(false, '1', 'api.')).to.be.equal('https://api.etherscan.io');
});
it('builds link to main network', () => {
expect(url(false, '1')).to.be.equal('https://etherscan.io');
});
it('builds link to ropsten', () => {
expect(url(false, '3')).to.be.equal('https://ropsten.etherscan.io');
expect(url(true)).to.be.equal('https://ropsten.etherscan.io');
});
it('builds link to kovan', () => {
expect(url(false, '42')).to.be.equal('https://kovan.etherscan.io');
});
it('builds link to rinkeby', () => {
expect(url(false, '4')).to.be.equal('https://rinkeby.etherscan.io');
});
it('builds link to the testnet selector for unknown networks', () => {
expect(url(false, '10042')).to.be.equal('https://testnet.etherscan.io');
expect(url(false, '51224')).to.be.equal('https://testnet.etherscan.io');
});
it('builds transaction link', () => {
expect(txLink('aTxHash', false, '1')).to.be.equal('https://etherscan.io/tx/aTxHash');
});
it('builds address link', () => {
expect(addressLink('anAddress', false, '1')).to.be.equal('https://etherscan.io/address/anAddress');
});
it('builds api link', () => {
expect(apiLink('answer=42', false, '1')).to.be.equal('https://api.etherscan.io/api?answer=42');
});
});

View File

@ -1,33 +0,0 @@
{
"name": "@parity/etherscan",
"description": "The Parity Promise-based library for interfacing with Etherscan over HTTP",
"version": "1.99.99",
"main": "library.js",
"author": "Parity Team <admin@parity.io>",
"maintainers": [
"Jaco Greeff"
],
"contributors": [],
"license": "GPL-3.0",
"repository": {
"type": "git",
"url": "git+https://github.com/paritytech/js-etherscan.git"
},
"keywords": [
"Ethereum",
"ABI",
"API",
"RPC",
"Parity",
"Promise"
],
"scripts": {
},
"devDependencies": {
"chai": "3.5.0",
"mocha": "3.2.0"
},
"dependencies": {
"node-fetch": "~1.6.3"
}
}

View File

@ -1,36 +0,0 @@
// Copyright 2015-2017 Parity Technologies (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 <http://www.gnu.org/licenses/>.
import { call } from './call';
function _call (action, test) {
return call('stats', action, null, test);
}
function price (test = false) {
return _call('ethprice', test);
}
function supply (test = false) {
return _call('ethsupply', test);
}
const stats = {
price: price,
supply: supply
};
export { stats };

View File

@ -1,37 +0,0 @@
// Copyright 2015-2017 Parity Technologies (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 <http://www.gnu.org/licenses/>.
const etherscan = require('./');
describe.skip('etherscan/stats', function () {
this.timeout(60 * 1000);
it('retrieves the latest price', () => {
return etherscan.stats
.price()
.then((price) => {
expect(price).to.be.ok;
});
});
it('retrieves the ether total', () => {
return etherscan.stats
.supply()
.then((supply) => {
expect(supply).to.be.ok;
});
});
});

View File

@ -156,6 +156,7 @@ module.exports = {
'~': path.resolve(__dirname, '..'),
'@parity/abi': path.resolve(__dirname, '../node_modules/@parity/abi'),
'@parity/api': path.resolve(__dirname, '../node_modules/@parity/api'),
'@parity/etherscan': path.resolve(__dirname, '../node_modules/@parity/etherscan'),
'@parity/jsonrpc': path.resolve(__dirname, '../node_modules/@parity/jsonrpc'),
'@parity/parity.js': path.resolve(__dirname, '../node_modules/@parity/parity.js'),
'@parity/shared': path.resolve(__dirname, '../node_modules/@parity/shared'),

View File

@ -45,6 +45,7 @@ module.exports = {
'~': path.resolve(__dirname, '..'),
'@parity/abi': path.resolve(__dirname, '../node_modules/@parity/abi'),
'@parity/api': path.resolve(__dirname, '../node_modules/@parity/api'),
'@parity/etherscan': path.resolve(__dirname, '../node_modules/@parity/etherscan'),
'@parity/jsonrpc': path.resolve(__dirname, '../node_modules/@parity/jsonrpc'),
'@parity/shared': path.resolve(__dirname, '../node_modules/@parity/shared'),
'@parity/ui': path.resolve(__dirname, '../node_modules/@parity/ui'),

View File

@ -78,6 +78,7 @@ module.exports = {
'~': path.resolve(__dirname, '..'),
'@parity/abi': path.resolve(__dirname, '../node_modules/@parity/abi'),
'@parity/api': path.resolve(__dirname, '../node_modules/@parity/api'),
'@parity/etherscan': path.resolve(__dirname, '../node_modules/@parity/etherscan'),
'@parity/jsonrpc': path.resolve(__dirname, '../node_modules/@parity/jsonrpc'),
'@parity/shared': path.resolve(__dirname, '../node_modules/@parity/shared'),
'@parity/ui': path.resolve(__dirname, '../node_modules/@parity/ui'),

View File

@ -23,6 +23,7 @@ module.exports = {
'~': path.resolve(__dirname, '..'),
'@parity/abi': path.resolve(__dirname, '../node_modules/@parity/abi'),
'@parity/api': path.resolve(__dirname, '../node_modules/@parity/api'),
'@parity/etherscan': path.resolve(__dirname, '../node_modules/@parity/etherscan'),
'@parity/jsonrpc': path.resolve(__dirname, '../node_modules/@parity/jsonrpc'),
'@parity/shared': path.resolve(__dirname, '../node_modules/@parity/shared'),
'@parity/ui': path.resolve(__dirname, '../node_modules/@parity/ui'),