Merge branch 'jg-split-abi-api' into ui-2

This commit is contained in:
Jaco Greeff 2017-04-21 11:21:54 +02:00
commit b3dfc0b6db
17 changed files with 176 additions and 32 deletions

View File

@ -148,6 +148,7 @@
"stylelint": "7.9.0", "stylelint": "7.9.0",
"stylelint-config-standard": "16.0.0", "stylelint-config-standard": "16.0.0",
"to-source": "2.0.3", "to-source": "2.0.3",
"uglify-js": "2.8.16",
"url-loader": "0.5.7", "url-loader": "0.5.7",
"webpack": "2.2.1", "webpack": "2.2.1",
"webpack-bundle-size-analyzer": "2.5.0", "webpack-bundle-size-analyzer": "2.5.0",
@ -158,11 +159,13 @@
"yargs": "6.6.0" "yargs": "6.6.0"
}, },
"dependencies": { "dependencies": {
"@parity/abi": "file:src/abi",
"@parity/api": "file:src/api",
"@parity/jsonrpc": "file:src/jsonrpc",
"@parity/ui": "file:src/ui", "@parity/ui": "file:src/ui",
"@parity/wordlist": "1.0.1", "@parity/wordlist": "1.0.1",
"base32.js": "0.1.0", "base32.js": "0.1.0",
"bignumber.js": "3.0.1", "bignumber.js": "3.0.1",
"blockies": "0.0.2",
"bytes": "2.4.0", "bytes": "2.4.0",
"debounce": "1.0.0", "debounce": "1.0.0",
"es6-error": "4.0.0", "es6-error": "4.0.0",
@ -174,8 +177,6 @@
"format-number": "2.0.1", "format-number": "2.0.1",
"isomorphic-fetch": "2.2.1", "isomorphic-fetch": "2.2.1",
"js-sha3": "0.5.5", "js-sha3": "0.5.5",
"keycode": "2.1.8",
"keythereum": "0.4.6",
"lodash": "4.17.2", "lodash": "4.17.2",
"loglevel": "1.4.1", "loglevel": "1.4.1",
"marked": "0.3.6", "marked": "0.3.6",
@ -204,13 +205,11 @@
"redux-thunk": "2.1.0", "redux-thunk": "2.1.0",
"rlp": "2.0.0", "rlp": "2.0.0",
"scryptsy": "2.0.0", "scryptsy": "2.0.0",
"secp256k1": "3.2.5",
"solc": "ngotchac/solc-js", "solc": "ngotchac/solc-js",
"store": "1.3.20", "store": "1.3.20",
"sw-toolbox": "^3.6.0", "sw-toolbox": "^3.6.0",
"u2f-api": "0.0.9", "u2f-api": "0.0.9",
"u2f-api-polyfill": "0.4.3", "u2f-api-polyfill": "0.4.3",
"uglify-js": "2.8.16",
"useragent.js": "0.5.6", "useragent.js": "0.5.6",
"utf8": "2.1.2", "utf8": "2.1.2",
"valid-url": "1.0.9", "valid-url": "1.0.9",

30
js/src/abi/package.json Normal file
View File

@ -0,0 +1,30 @@
{
"name": "@parity/abi",
"description": "The Parity ABI library",
"version": "0.0.0",
"main": "index.js",
"author": "Parity Team <admin@parity.io>",
"maintainers": [
"Jaco Greeff",
"Nicolas Gotchac"
],
"contributors": [],
"license": "GPL-3.0",
"repository": {
"type": "git",
"url": "git+https://github.com/paritytech/parity.git"
},
"keywords": [
"Ethereum",
"ABI",
"Parity"
],
"scripts": {
},
"devDependencies": {
},
"dependencies": {
"bignumber.js": "3.0.1",
"js-sha3": "0.5.5"
}
}

View File

@ -14,13 +14,13 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
import ethereumRpc from '@parity/jsonrpc';
import { TEST_HTTP_URL, endpointTest } from '../../test/mockRpc'; import { TEST_HTTP_URL, endpointTest } from '../../test/mockRpc';
import util from './util'; import util from './util';
import Api from './api'; import Api from './api';
import ethereumRpc from '../jsonrpc/';
describe('api/Api', () => { describe('api/Api', () => {
describe('constructor', () => { describe('constructor', () => {
it('requires defined/non-null transport object', () => { it('requires defined/non-null transport object', () => {

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Abi from '~/abi'; import Abi from '@parity/abi';
let nextSubscriptionId = 0; let nextSubscriptionId = 0;

View File

@ -17,9 +17,10 @@
import BigNumber from 'bignumber.js'; import BigNumber from 'bignumber.js';
import sinon from 'sinon'; import sinon from 'sinon';
import Abi from '@parity/abi';
import { TEST_HTTP_URL, mockHttp } from '../../../test/mockRpc'; import { TEST_HTTP_URL, mockHttp } from '../../../test/mockRpc';
import Abi from '../../abi';
import { sha3 } from '../util/sha3'; import { sha3 } from '../util/sha3';
import Api from '../api'; import Api from '../api';

View File

@ -16,7 +16,8 @@
import BigNumber from 'bignumber.js'; import BigNumber from 'bignumber.js';
import { toChecksumAddress } from '../../abi/util/address'; import { toChecksumAddress } from '@parity/abi/util/address';
import { isString } from '../util/types'; import { isString } from '../util/types';
export function outAccountInfo (infos) { export function outAccountInfo (infos) {

40
js/src/api/package.json Normal file
View File

@ -0,0 +1,40 @@
{
"name": "@parity/api",
"description": "The Parity Promise-based API library for interfacing with Ethereum over RPC",
"version": "0.0.0",
"main": "index.js",
"author": "Parity Team <admin@parity.io>",
"maintainers": [
"Jaco Greeff",
"Nicolas Gotchac"
],
"contributors": [],
"license": "GPL-3.0",
"repository": {
"type": "git",
"url": "git+https://github.com/paritytech/parity.git"
},
"keywords": [
"Ethereum",
"API",
"RPC",
"Parity",
"Promise"
],
"scripts": {
},
"devDependencies": {
},
"dependencies": {
"@parity/abi": "file:../abi",
"@parity/jsonrpc": "file:../jsonrpc",
"bignumber.js": "3.0.1",
"blockies": "0.0.2",
"ethereumjs-tx": "1.2.5",
"eventemitter3": "2.0.2",
"js-sha3": "0.5.5",
"keythereum": "0.4.6",
"node-fetch": "1.6.3",
"secp256k1": "3.2.5"
}
}

View File

@ -16,8 +16,8 @@
import { isHex } from './types'; import { isHex } from './types';
import Func from '../../abi/spec/function'; import Func from '@parity/abi/spec/function';
import { fromParamType, toParamType } from '../../abi/spec/paramType/format'; import { fromParamType, toParamType } from '@parity/abi/spec/paramType/format';
export function decodeCallData (data) { export function decodeCallData (data) {
if (!isHex(data)) { if (!isHex(data)) {

View File

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Abi from '~/abi'; import Abi from '@parity/abi';
import Func from '~/abi/spec/function'; import Func from '@parity/abi/spec/function';
import { abiDecode } from './decode'; import { abiDecode } from './decode';
import { cleanupValue } from './format'; import { cleanupValue } from './format';

View File

@ -14,7 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { isAddress as isAddressValid, toChecksumAddress } from '../../abi/util/address'; import { isAddress as isAddressValid, toChecksumAddress } from '@parity/abi/util/address';
import { abiDecode, decodeCallData, decodeMethodInput, methodToAbi } from './decode'; import { abiDecode, decodeCallData, decodeMethodInput, methodToAbi } from './decode';
import { abiEncode, abiUnencode, abiSignature, encodeMethodCallAbi } from './encode'; import { abiEncode, abiUnencode, abiSignature, encodeMethodCallAbi } from './encode';
import { bytesToHex, hexToAscii, asciiToHex, cleanupValue } from './format'; import { bytesToHex, hexToAscii, asciiToHex, cleanupValue } from './format';

View File

@ -0,0 +1,28 @@
{
"name": "@parity/jsonrpc",
"description": "JSON and JS interface defintions for RPC",
"version": "0.0.0",
"main": "index.js",
"author": "Parity Team <admin@parity.io>",
"maintainers": [
"Jaco Greeff",
"Maciej Hirsz"
],
"contributors": [],
"license": "GPL-3.0",
"repository": {
"type": "git",
"url": "git+https://github.com/paritytech/parity.git"
},
"keywords": [
"Ethereum",
"RPC",
"Parity"
],
"scripts": {
},
"devDependencies": {
},
"dependencies": {
}
}

View File

@ -14,4 +14,6 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
require('babel-register')(); require('babel-register')({
ignore: /node_modules\/(?!@parity\/(abi|api|jsonrpc))/
});

View File

@ -25,6 +25,8 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ServiceWorkerWebpackPlugin = require('serviceworker-webpack-plugin'); const ServiceWorkerWebpackPlugin = require('serviceworker-webpack-plugin');
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin'); const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
const rulesEs6 = require('./rules/es6');
const rulesParity = require('./rules/parity');
const Shared = require('./shared'); const Shared = require('./shared');
const DAPPS = require('../src/views/Dapps/builtin.json'); const DAPPS = require('../src/views/Dapps/builtin.json');
@ -60,16 +62,13 @@ module.exports = {
module: { module: {
rules: [ rules: [
rulesParity,
rulesEs6,
{ {
test: /\.js$/, test: /\.js$/,
exclude: /(node_modules)/, exclude: /(node_modules)/,
use: [ 'happypack/loader?id=babel-js' ] use: [ 'happypack/loader?id=babel-js' ]
}, },
{
test: /\.js$/,
include: /node_modules\/(material-chip-input|ethereumjs-tx|@parity\/wordlist)/,
use: 'babel-loader'
},
{ {
test: /\.json$/, test: /\.json$/,
use: [ 'json-loader' ] use: [ 'json-loader' ]

View File

@ -18,6 +18,8 @@
const path = require('path'); const path = require('path');
const rulesEs6 = require('./rules/es6');
const rulesParity = require('./rules/parity');
const Shared = require('./shared'); const Shared = require('./shared');
const DEST = process.env.BUILD_DEST || '.build'; const DEST = process.env.BUILD_DEST || '.build';
@ -49,6 +51,8 @@ module.exports = {
module: { module: {
rules: [ rules: [
rulesParity,
rulesEs6,
{ {
test: /\.js$/, test: /\.js$/,
exclude: /node_modules/, exclude: /node_modules/,
@ -58,11 +62,6 @@ module.exports = {
'babel-loader?cacheDirectory=true' 'babel-loader?cacheDirectory=true'
] ]
}, },
{
test: /\.js$/,
include: /node_modules\/(ethereumjs-tx|@parity\/wordlist)/,
use: 'babel-loader'
},
{ {
test: /\.json$/, test: /\.json$/,
use: [ 'json-loader' ] use: [ 'json-loader' ]

View File

@ -18,6 +18,8 @@ const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin');
const packageJson = require('../package.json'); const packageJson = require('../package.json');
const rulesEs6 = require('./rules/es6');
const rulesParity = require('./rules/parity');
const Shared = require('./shared'); const Shared = require('./shared');
const ENV = process.env.NODE_ENV || 'development'; const ENV = process.env.NODE_ENV || 'development';
@ -26,6 +28,7 @@ const isProd = ENV === 'production';
const LIBRARY = process.env.LIBRARY; const LIBRARY = process.env.LIBRARY;
if (!LIBRARY) { if (!LIBRARY) {
console.error('$LIBRARY environment variable not defined');
process.exit(-1); process.exit(-1);
} }
@ -57,6 +60,8 @@ module.exports = {
/babel-polyfill/ /babel-polyfill/
], ],
rules: [ rules: [
rulesParity,
rulesEs6,
{ {
test: /(\.jsx|\.js)$/, test: /(\.jsx|\.js)$/,
// use: [ 'happypack/loader?id=js' ], // use: [ 'happypack/loader?id=js' ],
@ -65,18 +70,15 @@ module.exports = {
'babel-loader?cacheDirectory=true' 'babel-loader?cacheDirectory=true'
], ],
exclude: /node_modules/ exclude: /node_modules/
},
{
test: /\.js$/,
include: /node_modules\/(ethereumjs-tx|@parity\/wordlist)/,
use: 'babel-loader'
} }
] ]
}, },
resolve: { resolve: {
alias: { alias: {
'~': path.resolve(__dirname, '../src') '~': path.resolve(__dirname, '../src'),
'secp256k1': path.resolve(__dirname, '../node_modules/secp256k1/js'),
'keythereum': path.resolve(__dirname, '../node_modules/keythereum/dist/keythereum')
}, },
modules: [ modules: [
path.resolve('./src'), path.resolve('./src'),

21
js/webpack/rules/es6.js Normal file
View File

@ -0,0 +1,21 @@
// 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/>.
module.exports = {
test: /\.js$/,
include: /node_modules\/(material-chip-input|ethereumjs-tx)/,
use: 'babel-loader'
};

View File

@ -0,0 +1,21 @@
// 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/>.
module.exports = {
test: /\.js$/,
include: /node_modules\/@parity\/(abi|api|jsonrpc|wordlist)/,
use: 'babel-loader'
};