merge master into jr-use-badge-reg

This commit is contained in:
Jannis R
2016-12-12 12:13:49 +01:00
1541 changed files with 10425 additions and 4628 deletions

View File

@@ -13,10 +13,20 @@
"retainLines": true,
"env": {
"production": {
"plugins": ["transform-react-remove-prop-types"]
"plugins": [
"transform-react-remove-prop-types"
]
},
"development": {
"plugins": ["react-hot-loader/babel"]
"plugins": [
"react-hot-loader/babel",
["react-intl", { "messagesDir": "./.build/i18n/" }]
]
},
"test": {
"plugins": [
["babel-plugin-webpack-alias", { "config": "webpack/test.js" }]
]
}
}
}

View File

@@ -3,7 +3,7 @@ description = "Parity built-in dapps."
name = "parity-ui-precompiled"
version = "1.4.0"
license = "GPL-3.0"
authors = ["Ethcore <admin@ethcore.io>"]
authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"
[features]

View File

@@ -3,7 +3,7 @@ description = "Parity built-in dapps."
name = "parity-ui-dev"
version = "1.4.0"
license = "GPL-3.0"
authors = ["Ethcore <admin@ethcore.io>"]
authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"
[features]

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -0,0 +1,34 @@
# @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/ethcore/parity/tree/master/js/src/3rdparty/etherscan](https://github.com/ethcore/parity/tree/master/js/src/3rdparty/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

@@ -0,0 +1,33 @@
{
"name": "@parity/etherscan",
"description": "The Parity Promise-based library for interfacing with Etherscan over HTTP",
"version": "0.0.0",
"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/ethcore/parity.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,7 +1,9 @@
# parity.js
# @parity/parity.js
Parity.js is a thin, fast, Promise-based wrapper around the Ethereum APIs.
[https://github.com/ethcore/parity/tree/master/js/src/api](https://github.com/ethcore/parity/tree/master/js/src/api)
## installation
Install the package with `npm install --save @parity/parity.js`

View File

@@ -1,6 +1,6 @@
{
"name": "@parity/parity.js",
"description": "The Parity Promise-base API & ABI library for interfacing with Ethereum over RPC",
"description": "The Parity Promise-based API & ABI library for interfacing with Ethereum over RPC",
"version": "0.0.0",
"main": "library.js",
"author": "Parity Team <admin@parity.io>",
@@ -26,8 +26,8 @@
"devDependencies": {
},
"dependencies": {
"bignumber.js": "^2.3.0",
"js-sha3": "^0.5.2",
"node-fetch": "^1.6.3"
"bignumber.js": "~2.3.0",
"js-sha3": "~0.5.2",
"node-fetch": "~1.6.3"
}
}

View File

@@ -0,0 +1,26 @@
// Copyright 2015, 2016 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 parity = require('../');
describe('load the Parity library', function () {
it('should no throw any error', () => {
expect(parity).to.be.ok;
expect(parity.Api).to.be.ok;
expect(parity.Abi).to.be.ok;
});
});

View File

@@ -0,0 +1,34 @@
# @parity/shapeshift
A thin ES6 promise wrapper around the shapeshift.io APIs as documented at https://shapeshift.io/api
[https://github.com/ethcore/parity/tree/master/js/src/3rdparty/shapeshift](https://github.com/ethcore/parity/tree/master/js/src/3rdparty/shapeshift)
## usage
installation -
```
npm install --save @parity/shapeshift
```
Usage -
```
const APIKEY = 'private affiliate key or undefined';
const shapeshift = require('@parity/shapeshift')(APIKEY);
// api calls goes here
```
## api
queries -
- `getCoins()` [https://shapeshift.io/api#api-104](https://shapeshift.io/api#api-104)
- `getMarketInfo(pair)` [https://shapeshift.io/api#api-103](https://shapeshift.io/api#api-103)
- `getStatus(depositAddress)` [https://shapeshift.io/api#api-5](https://shapeshift.io/api#api-5)
transactions -
- `shift(toAddress, returnAddress, pair)` [https://shapeshift.io/api#api-7](https://shapeshift.io/api#api-7)

View File

@@ -0,0 +1,31 @@
{
"name": "@parity/shapeshift",
"description": "The Parity Promise-based library for interfacing with ShapeShift over HTTP",
"version": "0.0.0",
"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/ethcore/parity.git"
},
"keywords": [
"Ethereum",
"ABI",
"API",
"RPC",
"Parity",
"Promise"
],
"scripts": {
},
"devDependencies": {
},
"dependencies": {
"node-fetch": "~1.6.3"
}
}

View File

@@ -0,0 +1,29 @@
// Copyright 2015, 2016 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 chai = require('chai');
// const chaiAsPromised from 'chai-as-promised';
// const chaiEnzyme from 'chai-enzyme';
// const sinonChai from 'sinon-chai';
// chai.use(chaiAsPromised);
// chai.use(chaiEnzyme());
// chai.use(sinonChai);
// expose expect to global so we won't have to manually import & define it in every test
global.expect = chai.expect;
module.exports = {};

1
js/npm/test/mocha.opts Normal file
View File

@@ -0,0 +1 @@
-r ./test/mocha.config

View File

@@ -1,6 +1,6 @@
{
"name": "parity.js",
"version": "0.2.103",
"version": "0.2.119",
"main": "release/index.js",
"jsnext:main": "src/index.js",
"author": "Parity Team <admin@parity.io>",
@@ -40,10 +40,10 @@
"coveralls": "npm run testCoverage && coveralls < coverage/lcov.info",
"lint": "eslint --ignore-path .gitignore ./src/",
"lint:cached": "eslint --cache --ignore-path .gitignore ./src/",
"test": "mocha 'src/**/*.spec.js'",
"test:coverage": "istanbul cover _mocha -- 'src/**/*.spec.js'",
"test:e2e": "mocha 'src/**/*.e2e.js'",
"test:npm": "(cd .npmjs && npm i) && node test/npmLibrary && (rm -rf .npmjs/node_modules)",
"test": "NODE_ENV=test mocha 'src/**/*.spec.js'",
"test:coverage": "NODE_ENV=test istanbul cover _mocha -- 'src/**/*.spec.js'",
"test:e2e": "NODE_ENV=test mocha 'src/**/*.e2e.js'",
"test:npm": "(cd .npmjs && npm i) && node test/npmParity && (rm -rf .npmjs/node_modules)",
"prepush": "npm run lint:cached"
},
"devDependencies": {
@@ -52,12 +52,15 @@
"babel-eslint": "7.1.1",
"babel-loader": "6.2.8",
"babel-plugin-lodash": "3.2.10",
"babel-plugin-react-intl": "2.2.0",
"babel-plugin-transform-class-properties": "6.18.0",
"babel-plugin-transform-decorators-legacy": "1.3.4",
"babel-plugin-transform-object-rest-spread": "6.20.2",
"babel-plugin-transform-react-remove-prop-types": "0.2.11",
"babel-plugin-transform-runtime": "6.15.0",
"babel-plugin-webpack-alias": "2.1.2",
"babel-polyfill": "6.20.0",
"babel-preset-env": "1.0.2",
"babel-preset-es2015": "6.18.0",
"babel-preset-es2016": "6.16.0",
"babel-preset-es2017": "6.16.0",
@@ -66,6 +69,7 @@
"babel-register": "6.18.0",
"babel-runtime": "6.20.0",
"chai": "3.5.0",
"chai-as-promised": "6.0.0",
"chai-enzyme": "0.6.1",
"circular-dependency-plugin": "2.0.0",
"copy-webpack-plugin": "4.0.1",
@@ -99,8 +103,8 @@
"mock-local-storage": "1.0.2",
"mock-socket": "6.0.3",
"nock": "9.0.2",
"postcss-import": "8.1.0",
"postcss-loader": "1.1.1",
"postcss-import": "9.0.0",
"postcss-loader": "1.2.0",
"postcss-nested": "1.0.0",
"postcss-simple-vars": "3.0.0",
"progress": "1.1.8",
@@ -108,6 +112,7 @@
"react-addons-perf": "15.4.1",
"react-addons-test-utils": "15.4.1",
"react-hot-loader": "3.0.0-beta.6",
"react-intl-aggregate-webpack-plugin": "0.0.1",
"rucksack-css": "0.9.1",
"sinon": "1.17.6",
"sinon-as-promised": "4.0.2",
@@ -130,6 +135,7 @@
"ethereumjs-tx": "1.1.4",
"eventemitter3": "2.0.2",
"file-saver": "1.3.3",
"flat": "2.0.1",
"format-json": "1.0.3",
"format-number": "2.0.1",
"geopattern": "1.2.3",
@@ -137,13 +143,14 @@
"js-sha3": "0.5.5",
"lodash": "4.17.2",
"marked": "0.3.6",
"material-ui": "0.16.4",
"material-ui": "0.16.5",
"material-ui-chip-input": "0.11.1",
"mobx": "2.6.4",
"mobx-react": "4.0.3",
"mobx-react-devtools": "4.2.10",
"moment": "2.17.0",
"phoneformat.js": "1.0.3",
"push.js": "0.0.11",
"qs": "6.3.0",
"react": "15.4.1",
"react-ace": "4.1.0",
@@ -151,6 +158,7 @@
"react-copy-to-clipboard": "4.2.3",
"react-dom": "15.4.1",
"react-dropzone": "3.7.3",
"react-intl": "2.1.5",
"react-redux": "4.4.6",
"react-router": "3.0.0",
"react-router-redux": "4.0.7",

33
js/scripts/dryrun-npm.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
set -e
# variables
PACKAGES=( "parity" "etherscan" "shapeshift" )
# change into the build directory
BASEDIR=`dirname $0`
cd $BASEDIR/..
# build all packages
echo "*** Building packages for npmjs"
echo "$NPM_TOKEN" >> ~/.npmrc
for PACKAGE in ${PACKAGES[@]}
do
echo "*** Building $PACKAGE"
LIBRARY=$PACKAGE npm run ci:build:npm
DIRECTORY=.npmjs/$PACKAGE
cd $DIRECTORY
echo "*** Executing $PACKAGE tests from $DIRECTORY"
npm test
echo "*** Publishing $PACKAGE from $DIRECTORY"
echo "npm publish --access public || true"
cd ../..
done
cd ..
# exit with exit code
exit 0

View File

@@ -3,7 +3,7 @@ set -e
# variables
UTCDATE=`date -u "+%Y%m%d-%H%M%S"`
PACKAGES=( "parity.js" )
PACKAGES=( "parity" "etherscan" "shapeshift" )
BRANCH=$CI_BUILD_REF_NAME
GIT_JS_PRECOMPILED="https://${GITHUB_JS_PRECOMPILED}:@github.com/ethcore/js-precompiled.git"
GIT_PARITY="https://${GITHUB_JS_PRECOMPILED}:@github.com/ethcore/parity.git"
@@ -59,19 +59,27 @@ git reset --hard origin/$BRANCH 2>$GITLOG
if [ "$BRANCH" == "master" ]; then
cd js
echo "*** Bumping package.json patch version"
npm --no-git-tag-version version
npm version patch
echo "*** Building packages for npmjs"
# echo -e "$NPM_USERNAME\n$NPM_PASSWORD\n$NPM_EMAIL" | npm login
echo "$NPM_TOKEN" >> ~/.npmrc
npm run ci:build:npm
echo "*** Publishing $PACKAGE to npmjs"
cd .npmjs
npm publish --access public || true
cd ../..
for PACKAGE in ${PACKAGES[@]}
do
echo "*** Building $PACKAGE"
LIBRARY=$PACKAGE npm run ci:build:npm
DIRECTORY=.npmjs/$PACKAGE
echo "*** Publishing $PACKAGE from $DIRECTORY"
cd $DIRECTORY
npm publish --access public || true
cd ../..
done
cd ..
fi
echo "*** Updating cargo parity-ui-precompiled#$PRECOMPILED_HASH"

View File

@@ -14,11 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import etherscan from './';
const etherscan = require('./');
const TESTADDR = '0xbf885e2b55c6bcc84556a3c5f07d3040833c8d00';
describe.skip('etherscan/account', () => {
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);

View File

@@ -14,9 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import etherscan from './';
const etherscan = require('./');
describe.skip('etherscan/stats', function () {
this.timeout(60 * 1000);
describe.skip('etherscan/stats', () => {
it('retrieves the latest price', () => {
return etherscan.stats
.price()

View File

@@ -14,22 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import chai from 'chai';
import nock from 'nock';
const nock = require('nock');
global.expect = chai.expect; // eslint-disable-line no-undef
import 'isomorphic-fetch';
import es6Promise from 'es6-promise';
es6Promise.polyfill();
import initShapeshift from './';
import initRpc from './rpc';
const ShapeShift = require('./');
const initShapeshift = (ShapeShift.default || ShapeShift);
const APIKEY = '0x123454321';
const shapeshift = initShapeshift(APIKEY);
const rpc = initRpc(APIKEY);
const rpc = shapeshift.getRpc();
function mockget (requests) {
let scope = nock(rpc.ENDPOINT);
@@ -62,7 +55,7 @@ function mockpost (requests) {
return scope;
}
export {
module.exports = {
APIKEY,
mockget,
mockpost,

View File

@@ -14,7 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { APIKEY, mockget, mockpost, rpc } from './helpers.spec.js';
const helpers = require('./helpers.spec.js');
const APIKEY = helpers.APIKEY;
const mockget = helpers.mockget;
const mockpost = helpers.mockpost;
const rpc = helpers.rpc;
describe('shapeshift/rpc', () => {
describe('GET', () => {

View File

@@ -26,6 +26,10 @@ export default function (rpc) {
return rpc.get(`marketinfo/${pair}`);
}
function getRpc () {
return rpc;
}
function getStatus (depositAddress) {
return rpc.get(`txStat/${depositAddress}`);
}
@@ -103,6 +107,7 @@ export default function (rpc) {
return {
getCoins,
getMarketInfo,
getRpc,
getStatus,
shift,
subscribe,

View File

@@ -14,7 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { mockget, mockpost, shapeshift } from './helpers.spec.js';
const helpers = require('./helpers.spec.js');
const mockget = helpers.mockget;
const mockpost = helpers.mockpost;
const shapeshift = helpers.shapeshift;
describe('shapeshift/calls', () => {
describe('getCoins', () => {

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
@@ -240,8 +240,8 @@ export default class Contract {
}
_bindEvent = (event) => {
event.subscribe = (options = {}, callback) => {
return this._subscribe(event, options, callback);
event.subscribe = (options = {}, callback, autoRemove) => {
return this._subscribe(event, options, callback, autoRemove);
};
event.unsubscribe = (subscriptionId) => {
@@ -306,16 +306,31 @@ export default class Contract {
return this._api.eth.newFilter(options);
}
subscribe (eventName = null, options = {}, callback) {
subscribe (eventName = null, options = {}, callback, autoRemove) {
try {
const event = this._findEvent(eventName);
return this._subscribe(event, options, callback);
return this._subscribe(event, options, callback, autoRemove);
} catch (e) {
return Promise.reject(e);
}
}
_subscribe (event = null, _options, callback) {
_sendData (subscriptionId, error, logs) {
const { autoRemove, callback } = this._subscriptions[subscriptionId];
let result = true;
try {
result = callback(error, logs);
} catch (error) {
console.warn('_sendData', subscriptionId, error);
}
if (autoRemove && result && typeof result === 'boolean') {
this.unsubscribe(subscriptionId);
}
}
_subscribe (event = null, _options, callback, autoRemove = false) {
const subscriptionId = nextSubscriptionId++;
const { skipInitFetch } = _options;
delete _options['skipInitFetch'];
@@ -325,6 +340,7 @@ export default class Contract {
.then((filterId) => {
this._subscriptions[subscriptionId] = {
options: _options,
autoRemove,
callback,
filterId
};
@@ -337,8 +353,7 @@ export default class Contract {
return this._api.eth
.getFilterLogs(filterId)
.then((logs) => {
callback(null, this.parseEventLogs(logs));
this._sendData(subscriptionId, null, this.parseEventLogs(logs));
this._subscribeToChanges();
return subscriptionId;
});
@@ -437,13 +452,13 @@ export default class Contract {
})
)
.then((logsArray) => {
logsArray.forEach((logs, idx) => {
logsArray.forEach((logs, subscriptionId) => {
if (!logs || !logs.length) {
return;
}
try {
subscriptions[idx].callback(null, this.parseEventLogs(logs));
this.sendData(subscriptionId, null, this.parseEventLogs(logs));
} catch (error) {
console.error('_sendSubscriptionChanges', error);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify

Some files were not shown because too many files have changed in this diff Show More