diff --git a/README.md b/README.md
index 4861d7ac5..fc5cd9762 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,12 @@
# [Parity](https://ethcore.io/parity.html)
### Fast, light, and robust Ethereum implementation
-[![Join the chat at https://gitter.im/ethcore/parity.js](https://badges.gitter.im/ethcore/parity.js.svg)](https://gitter.im/ethcore/parity.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[![Build Status][travis-image]][travis-url] [![build status](https://gitlab.ethcore.io/Mirrors/ethcore-parity/badges/master/build.svg)](https://gitlab.ethcore.io/Mirrors/ethcore-parity/commits/master) [![Coverage Status][coveralls-image]][coveralls-url] [![GPLv3][license-image]][license-url]
-[![Build Status][travis-image]][travis-url] [![build status](https://gitlab.ethcore.io/Mirrors/ethcore-parity/badges/master/build.svg)](https://gitlab.ethcore.io/Mirrors/ethcore-parity/commits/master) [![Coverage Status][coveralls-image]][coveralls-url] [![Join the chat at https://gitter.im/ethcore/parity][gitter-image]][gitter-url] [![GPLv3][license-image]][license-url]
+### Join the chat!
+
+Parity [![Join the chat at https://gitter.im/ethcore/parity][gitter-image]][gitter-url] and
+parity.js [![Join the chat at https://gitter.im/ethcore/parity.js](https://badges.gitter.im/ethcore/parity.js.svg)](https://gitter.im/ethcore/parity.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[Internal Documentation][doc-url]
@@ -21,7 +24,7 @@ Be sure to check out [our wiki][wiki-url] for more information.
[doc-url]: https://ethcore.github.io/parity/ethcore/index.html
[wiki-url]: https://github.com/ethcore/parity/wiki
-**Requires Rust version 1.12.0 to build**
+**Parity requires Rust version 1.12.0 to build**
----
@@ -31,12 +34,15 @@ Be sure to check out [our wiki][wiki-url] for more information.
Parity's goal is to be the fastest, lightest, and most secure Ethereum client. We are developing Parity using the sophisticated and
cutting-edge Rust programming language. Parity is licensed under the GPLv3, and can be used for all your Ethereum needs.
-By default, Parity will run a JSONRPC server on `127.0.0.1:8545`. This is fully configurable and supports a number
-of RPC APIs.
+Parity comes with a built-in wallet. To access [Parity Wallet](http://127.0.0.1:8080/) this simply go to http://127.0.0.1:8080/. It
+includes various functionality allowing you to:
+- create and manage your Ethereum accounts;
+- manage your Ether and any Ethereum tokens;
+- create and register your own tokens;
+- and much more.
-Parity also runs a server for running decentralized apps, or "Dapps", on `http://127.0.0.1:8080`.
-This includes a few useful Dapps, including Ethereum Wallet, Maker OTC, and a node status page.
-In a near-future release, it will be easy to install Dapps and use them through this web interface.
+By default, Parity will also run a JSONRPC server on `127.0.0.1:8545`. This is fully configurable and supports a number
+of RPC APIs.
If you run into an issue while using parity, feel free to file one in this repository
or hop on our [gitter chat room][gitter-url] to ask a question. We are glad to help!
diff --git a/js/src/api/README.md b/js/src/api/README.md
index 691a24cca..e28c6c2a1 100644
--- a/js/src/api/README.md
+++ b/js/src/api/README.md
@@ -135,10 +135,11 @@ APIs implement the calls as exposed in the [Ethcore JSON Ethereum RPC](https://g
- [ethapi.db](https://github.com/ethcore/ethereum-rpc-json/blob/master/interfaces.md#db)
- [ethapi.eth](https://github.com/ethcore/ethereum-rpc-json/blob/master/interfaces.md#eth)
-- [ethapi.ethcore](https://github.com/ethcore/ethereum-rpc-json/blob/master/interfaces.md#ethcore)
+- [ethapi.parity](https://github.com/ethcore/ethereum-rpc-json/blob/master/interfaces.md#parity)
- [ethapi.net](https://github.com/ethcore/ethereum-rpc-json/blob/master/interfaces.md#net)
- [ethapi.personal](https://github.com/ethcore/ethereum-rpc-json/blob/master/interfaces.md#personal)
- [ethapi.shh](https://github.com/ethcore/ethereum-rpc-json/blob/master/interfaces.md#shh)
+- [ethapi.signer](https://github.com/ethcore/ethereum-rpc-json/blob/master/interfaces.md#signer)
- [ethapi.trace](https://github.com/ethcore/ethereum-rpc-json/blob/master/interfaces.md#trace)
- [ethapi.web3](https://github.com/ethcore/ethereum-rpc-json/blob/master/interfaces.md#web3)
diff --git a/js/src/api/api.js b/js/src/api/api.js
index 9768b9acb..75d4392d0 100644
--- a/js/src/api/api.js
+++ b/js/src/api/api.js
@@ -17,7 +17,7 @@
import { Http, Ws } from './transport';
import Contract from './contract';
-import { Db, Eth, Ethcore, Net, Personal, Shh, Trace, Web3 } from './rpc';
+import { Db, Eth, Parity, Net, Personal, Shh, Signer, Trace, Web3 } from './rpc';
import Subscriptions from './subscriptions';
import util from './util';
import { isFunction } from './util/types';
@@ -32,10 +32,11 @@ export default class Api {
this._db = new Db(transport);
this._eth = new Eth(transport);
- this._ethcore = new Ethcore(transport);
this._net = new Net(transport);
+ this._parity = new Parity(transport);
this._personal = new Personal(transport);
this._shh = new Shh(transport);
+ this._signer = new Signer(transport);
this._trace = new Trace(transport);
this._web3 = new Web3(transport);
@@ -50,8 +51,8 @@ export default class Api {
return this._eth;
}
- get ethcore () {
- return this._ethcore;
+ get parity () {
+ return this._parity;
}
get net () {
@@ -66,6 +67,10 @@ export default class Api {
return this._shh;
}
+ get signer () {
+ return this._signer;
+ }
+
get trace () {
return this._trace;
}
diff --git a/js/src/api/contract/contract.js b/js/src/api/contract/contract.js
index cef75eda7..bb6c15d8d 100644
--- a/js/src/api/contract/contract.js
+++ b/js/src/api/contract/contract.js
@@ -102,7 +102,7 @@ export default class Contract {
options.gas = gas.toFixed(0);
setState({ state: 'postTransaction', gas });
- return this._api.eth.postTransaction(this._encodeOptions(this.constructors[0], options, values));
+ return this._api.parity.postTransaction(this._encodeOptions(this.constructors[0], options, values));
})
.then((requestId) => {
setState({ state: 'checkRequest', requestId });
@@ -166,7 +166,7 @@ export default class Contract {
}
_pollCheckRequest = (requestId) => {
- return this._api.pollMethod('eth_checkRequest', requestId);
+ return this._api.pollMethod('parity_checkRequest', requestId);
}
_pollTransactionReceipt = (txhash, gas) => {
@@ -208,7 +208,7 @@ export default class Contract {
if (!func.constant) {
func.postTransaction = (options, values = []) => {
- return this._api.eth
+ return this._api.parity
.postTransaction(this._encodeOptions(func, this._addOptionsTo(options), values));
};
diff --git a/js/src/api/contract/contract.spec.js b/js/src/api/contract/contract.spec.js
index 0d6169e26..9065b4fad 100644
--- a/js/src/api/contract/contract.spec.js
+++ b/js/src/api/contract/contract.spec.js
@@ -249,9 +249,9 @@ describe('api/contract/Contract', () => {
before(() => {
scope = mockHttp([
{ method: 'eth_estimateGas', reply: { result: 1000 } },
- { method: 'eth_postTransaction', reply: { result: '0x678' } },
- { method: 'eth_checkRequest', reply: { result: null } },
- { method: 'eth_checkRequest', reply: { result: '0x890' } },
+ { method: 'parity_postTransaction', reply: { result: '0x678' } },
+ { method: 'parity_checkRequest', reply: { result: null } },
+ { method: 'parity_checkRequest', reply: { result: '0x890' } },
{ method: 'eth_getTransactionReceipt', reply: { result: null } },
{ method: 'eth_getTransactionReceipt', reply: { result: RECEIPT_PEND } },
{ method: 'eth_getTransactionReceipt', reply: { result: RECEIPT_DONE } },
@@ -266,7 +266,7 @@ describe('api/contract/Contract', () => {
});
it('passes the options through to postTransaction (incl. gas calculation)', () => {
- expect(scope.body.eth_postTransaction.params).to.deep.equal([
+ expect(scope.body.parity_postTransaction.params).to.deep.equal([
{ data: '0x123', gas: '0x4b0' }
]);
});
@@ -280,8 +280,8 @@ describe('api/contract/Contract', () => {
it('fails when gasUsed == gas', () => {
mockHttp([
{ method: 'eth_estimateGas', reply: { result: 1000 } },
- { method: 'eth_postTransaction', reply: { result: '0x678' } },
- { method: 'eth_checkRequest', reply: { result: '0x789' } },
+ { method: 'parity_postTransaction', reply: { result: '0x678' } },
+ { method: 'parity_checkRequest', reply: { result: '0x789' } },
{ method: 'eth_getTransactionReceipt', reply: { result: RECEIPT_EXCP } }
]);
@@ -295,8 +295,8 @@ describe('api/contract/Contract', () => {
it('fails when no code was deployed', () => {
mockHttp([
{ method: 'eth_estimateGas', reply: { result: 1000 } },
- { method: 'eth_postTransaction', reply: { result: '0x678' } },
- { method: 'eth_checkRequest', reply: { result: '0x789' } },
+ { method: 'parity_postTransaction', reply: { result: '0x678' } },
+ { method: 'parity_checkRequest', reply: { result: '0x789' } },
{ method: 'eth_getTransactionReceipt', reply: { result: RECEIPT_DONE } },
{ method: 'eth_getCode', reply: { result: '0x' } }
]);
@@ -360,15 +360,15 @@ describe('api/contract/Contract', () => {
describe('postTransaction', () => {
beforeEach(() => {
- scope = mockHttp([{ method: 'eth_postTransaction', reply: { result: ['hashId'] } }]);
+ scope = mockHttp([{ method: 'parity_postTransaction', reply: { result: ['hashId'] } }]);
});
- it('encodes options and mades an eth_postTransaction call', () => {
+ it('encodes options and mades an parity_postTransaction call', () => {
return func
.postTransaction({ someExtras: 'foo' }, VALUES)
.then(() => {
expect(scope.isDone()).to.be.true;
- expect(scope.body.eth_postTransaction.params[0]).to.deep.equal({
+ expect(scope.body.parity_postTransaction.params[0]).to.deep.equal({
someExtras: 'foo',
to: ADDR,
data: ENCODED
diff --git a/js/src/api/rpc/eth/eth.js b/js/src/api/rpc/eth/eth.js
index 703f3ed11..43f8025e1 100644
--- a/js/src/api/rpc/eth/eth.js
+++ b/js/src/api/rpc/eth/eth.js
@@ -39,11 +39,6 @@ export default class Eth {
.execute('eth_call', inOptions(options), inBlockNumber(blockNumber));
}
- checkRequest (requestId) {
- return this._transport
- .execute('eth_checkRequest', inNumber16(requestId));
- }
-
coinbase () {
return this._transport
.execute('eth_coinbase')
@@ -267,11 +262,6 @@ export default class Eth {
.execute('eth_pendingTransactions');
}
- postTransaction (options) {
- return this._transport
- .execute('eth_postTransaction', inOptions(options));
- }
-
protocolVersion () {
return this._transport
.execute('eth_protocolVersion');
diff --git a/js/src/api/rpc/ethcore/ethcore.js b/js/src/api/rpc/ethcore/ethcore.js
deleted file mode 100644
index e21c83193..000000000
--- a/js/src/api/rpc/ethcore/ethcore.js
+++ /dev/null
@@ -1,201 +0,0 @@
-// 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 .
-
-import { inAddress, inData, inNumber16 } from '../../format/input';
-import { outAddress, outHistogram, outNumber, outPeers } from '../../format/output';
-
-export default class Ethcore {
- constructor (transport) {
- this._transport = transport;
- }
-
- acceptNonReservedPeers () {
- return this._transport
- .execute('ethcore_acceptNonReservedPeers');
- }
-
- addReservedPeer (encode) {
- return this._transport
- .execute('ethcore_addReservedPeer', encode);
- }
-
- dappsPort () {
- return this._transport
- .execute('ethcore_dappsPort')
- .then(outNumber);
- }
-
- defaultExtraData () {
- return this._transport
- .execute('ethcore_defaultExtraData');
- }
-
- devLogs () {
- return this._transport
- .execute('ethcore_devLogs');
- }
-
- devLogsLevels () {
- return this._transport
- .execute('ethcore_devLogsLevels');
- }
-
- dropNonReservedPeers () {
- return this._transport
- .execute('ethcore_dropNonReservedPeers');
- }
-
- enode () {
- return this._transport
- .execute('ethcore_enode');
- }
-
- extraData () {
- return this._transport
- .execute('ethcore_extraData');
- }
-
- gasFloorTarget () {
- return this._transport
- .execute('ethcore_gasFloorTarget')
- .then(outNumber);
- }
-
- gasPriceHistogram () {
- return this._transport
- .execute('ethcore_gasPriceHistogram')
- .then(outHistogram);
- }
-
- generateSecretPhrase () {
- return this._transport
- .execute('ethcore_generateSecretPhrase');
- }
-
- hashContent (url) {
- return this._transport
- .execute('ethcore_hashContent', url);
- }
-
- minGasPrice () {
- return this._transport
- .execute('ethcore_minGasPrice')
- .then(outNumber);
- }
-
- mode () {
- return this._transport
- .execute('ethcore_mode');
- }
-
- netChain () {
- return this._transport
- .execute('ethcore_netChain');
- }
-
- netPeers () {
- return this._transport
- .execute('ethcore_netPeers')
- .then(outPeers);
- }
-
- netMaxPeers () {
- return this._transport
- .execute('ethcore_netMaxPeers')
- .then(outNumber);
- }
-
- netPort () {
- return this._transport
- .execute('ethcore_netPort')
- .then(outNumber);
- }
-
- nodeName () {
- return this._transport
- .execute('ethcore_nodeName');
- }
-
- phraseToAddress (phrase) {
- return this._transport
- .execute('ethcore_phraseToAddress', phrase)
- .then(outAddress);
- }
-
- registryAddress () {
- return this._transport
- .execute('ethcore_registryAddress')
- .then(outAddress);
- }
-
- removeReservedPeer (encode) {
- return this._transport
- .execute('ethcore_removeReservedPeer', encode);
- }
-
- rpcSettings () {
- return this._transport
- .execute('ethcore_rpcSettings');
- }
-
- setAuthor (address) {
- return this._transport
- .execute('ethcore_setAuthor', inAddress(address));
- }
-
- setExtraData (data) {
- return this._transport
- .execute('ethcore_setExtraData', inData(data));
- }
-
- setGasFloorTarget (quantity) {
- return this._transport
- .execute('ethcore_setGasFloorTarget', inNumber16(quantity));
- }
-
- setMinGasPrice (quantity) {
- return this._transport
- .execute('ethcore_setMinGasPrice', inNumber16(quantity));
- }
-
- setMode (mode) {
- return this._transport
- .execute('ethcore_setMode', mode);
- }
-
- setTransactionsLimit (quantity) {
- return this._transport
- .execute('ethcore_setTransactionsLimit', inNumber16(quantity));
- }
-
- signerPort () {
- return this._transport
- .execute('ethcore_signerPort')
- .then(outNumber);
- }
-
- transactionsLimit () {
- return this._transport
- .execute('ethcore_transactionsLimit')
- .then(outNumber);
- }
-
- unsignedTransactionsCount () {
- return this._transport
- .execute('ethcore_unsignedTransactionsCount')
- .then(outNumber);
- }
-}
diff --git a/js/src/api/rpc/index.js b/js/src/api/rpc/index.js
index e7e94b9ed..7961da81c 100644
--- a/js/src/api/rpc/index.js
+++ b/js/src/api/rpc/index.js
@@ -16,9 +16,10 @@
export Db from './db';
export Eth from './eth';
-export Ethcore from './ethcore';
+export Parity from './parity';
export Net from './net';
export Personal from './personal';
export Shh from './shh';
+export Signer from './signer';
export Trace from './trace';
export Web3 from './web3';
diff --git a/js/src/api/rpc/ethcore/index.js b/js/src/api/rpc/parity/index.js
similarity index 95%
rename from js/src/api/rpc/ethcore/index.js
rename to js/src/api/rpc/parity/index.js
index 2372a2171..38f08f725 100644
--- a/js/src/api/rpc/ethcore/index.js
+++ b/js/src/api/rpc/parity/index.js
@@ -14,4 +14,4 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see .
-export default from './ethcore';
+export default from './parity';
diff --git a/js/src/api/rpc/ethcore/ethcore.e2e.js b/js/src/api/rpc/parity/parity.e2e.js
similarity index 82%
rename from js/src/api/rpc/ethcore/ethcore.e2e.js
rename to js/src/api/rpc/parity/parity.e2e.js
index aae7108e7..91e01ab6a 100644
--- a/js/src/api/rpc/ethcore/ethcore.e2e.js
+++ b/js/src/api/rpc/parity/parity.e2e.js
@@ -16,12 +16,12 @@
import { createHttpApi } from '../../../../test/e2e/ethapi';
-describe('ethapi.ethcore', () => {
+describe('ethapi.parity', () => {
const ethapi = createHttpApi();
describe('gasFloorTarget', () => {
it('returns and translates the target', () => {
- return ethapi.ethcore.gasFloorTarget().then((value) => {
+ return ethapi.parity.gasFloorTarget().then((value) => {
expect(value.gt(0)).to.be.true;
});
});
@@ -29,7 +29,7 @@ describe('ethapi.ethcore', () => {
describe('gasPriceHistogram', () => {
it('returns and translates the target', () => {
- return ethapi.ethcore.gasPriceHistogram().then((result) => {
+ return ethapi.parity.gasPriceHistogram().then((result) => {
expect(Object.keys(result)).to.deep.equal(['bucketBounds', 'counts']);
expect(result.bucketBounds.length > 0).to.be.true;
expect(result.counts.length > 0).to.be.true;
@@ -39,7 +39,7 @@ describe('ethapi.ethcore', () => {
describe('netChain', () => {
it('returns and the chain', () => {
- return ethapi.ethcore.netChain().then((value) => {
+ return ethapi.parity.netChain().then((value) => {
expect(value).to.equal('morden');
});
});
@@ -47,7 +47,7 @@ describe('ethapi.ethcore', () => {
describe('netPort', () => {
it('returns and translates the port', () => {
- return ethapi.ethcore.netPort().then((value) => {
+ return ethapi.parity.netPort().then((value) => {
expect(value.gt(0)).to.be.true;
});
});
@@ -55,7 +55,7 @@ describe('ethapi.ethcore', () => {
describe('transactionsLimit', () => {
it('returns and translates the limit', () => {
- return ethapi.ethcore.transactionsLimit().then((value) => {
+ return ethapi.parity.transactionsLimit().then((value) => {
expect(value.gt(0)).to.be.true;
});
});
@@ -63,7 +63,7 @@ describe('ethapi.ethcore', () => {
describe('rpcSettings', () => {
it('returns and translates the settings', () => {
- return ethapi.ethcore.rpcSettings().then((value) => {
+ return ethapi.parity.rpcSettings().then((value) => {
expect(value).to.be.ok;
});
});
diff --git a/js/src/api/rpc/parity/parity.js b/js/src/api/rpc/parity/parity.js
new file mode 100644
index 000000000..f1739f848
--- /dev/null
+++ b/js/src/api/rpc/parity/parity.js
@@ -0,0 +1,273 @@
+// 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 .
+
+import { inAddress, inData, inHex, inNumber16, inOptions } from '../../format/input';
+import { outAccountInfo, outAddress, outHistogram, outNumber, outPeers } from '../../format/output';
+
+export default class Parity {
+ constructor (transport) {
+ this._transport = transport;
+ }
+
+ acceptNonReservedPeers () {
+ return this._transport
+ .execute('parity_acceptNonReservedPeers');
+ }
+
+ accounts () {
+ return this._transport
+ .execute('parity_accounts')
+ .then(outAccountInfo);
+ }
+
+ accountsInfo () {
+ return this._transport
+ .execute('parity_accountsInfo')
+ .then(outAccountInfo);
+ }
+
+ addReservedPeer (encode) {
+ return this._transport
+ .execute('parity_addReservedPeer', encode);
+ }
+
+ changePassword (account, password, newPassword) {
+ return this._transport
+ .execute('parity_changePassword', inAddress(account), password, newPassword);
+ }
+
+ checkRequest (requestId) {
+ return this._transport
+ .execute('parity_checkRequest', inNumber16(requestId));
+ }
+
+ dappsPort () {
+ return this._transport
+ .execute('parity_dappsPort')
+ .then(outNumber);
+ }
+
+ defaultExtraData () {
+ return this._transport
+ .execute('parity_defaultExtraData');
+ }
+
+ devLogs () {
+ return this._transport
+ .execute('parity_devLogs');
+ }
+
+ devLogsLevels () {
+ return this._transport
+ .execute('parity_devLogsLevels');
+ }
+
+ dropNonReservedPeers () {
+ return this._transport
+ .execute('parity_dropNonReservedPeers');
+ }
+
+ enode () {
+ return this._transport
+ .execute('parity_enode');
+ }
+
+ extraData () {
+ return this._transport
+ .execute('parity_extraData');
+ }
+
+ gasFloorTarget () {
+ return this._transport
+ .execute('parity_gasFloorTarget')
+ .then(outNumber);
+ }
+
+ gasPriceHistogram () {
+ return this._transport
+ .execute('parity_gasPriceHistogram')
+ .then(outHistogram);
+ }
+
+ generateSecretPhrase () {
+ return this._transport
+ .execute('parity_generateSecretPhrase');
+ }
+
+ hashContent (url) {
+ return this._transport
+ .execute('parity_hashContent', url);
+ }
+
+ listGethAccounts () {
+ return this._transport
+ .execute('parity_listGethAccounts')
+ .then((accounts) => (accounts || []).map(outAddress));
+ }
+
+ importGethAccounts (accounts) {
+ return this._transport
+ .execute('parity_importGethAccounts', (accounts || []).map(inAddress))
+ .then((accounts) => (accounts || []).map(outAddress));
+ }
+
+ minGasPrice () {
+ return this._transport
+ .execute('parity_minGasPrice')
+ .then(outNumber);
+ }
+
+ mode () {
+ return this._transport
+ .execute('parity_mode');
+ }
+
+ netChain () {
+ return this._transport
+ .execute('parity_netChain');
+ }
+
+ netPeers () {
+ return this._transport
+ .execute('parity_netPeers')
+ .then(outPeers);
+ }
+
+ netMaxPeers () {
+ return this._transport
+ .execute('parity_netMaxPeers')
+ .then(outNumber);
+ }
+
+ netPort () {
+ return this._transport
+ .execute('parity_netPort')
+ .then(outNumber);
+ }
+
+ newAccountFromPhrase (phrase, password) {
+ return this._transport
+ .execute('parity_newAccountFromPhrase', phrase, password)
+ .then(outAddress);
+ }
+
+ newAccountFromSecret (secret, password) {
+ return this._transport
+ .execute('parity_newAccountFromSecret', inHex(secret), password)
+ .then(outAddress);
+ }
+
+ newAccountFromWallet (json, password) {
+ return this._transport
+ .execute('parity_newAccountFromWallet', json, password)
+ .then(outAddress);
+ }
+
+ nodeName () {
+ return this._transport
+ .execute('parity_nodeName');
+ }
+
+ phraseToAddress (phrase) {
+ return this._transport
+ .execute('parity_phraseToAddress', phrase)
+ .then(outAddress);
+ }
+
+ postTransaction (options) {
+ return this._transport
+ .execute('parity_postTransaction', inOptions(options));
+ }
+
+ registryAddress () {
+ return this._transport
+ .execute('parity_registryAddress')
+ .then(outAddress);
+ }
+
+ removeReservedPeer (encode) {
+ return this._transport
+ .execute('parity_removeReservedPeer', encode);
+ }
+
+ rpcSettings () {
+ return this._transport
+ .execute('parity_rpcSettings');
+ }
+
+ setAccountName (address, name) {
+ return this._transport
+ .execute('parity_setAccountName', inAddress(address), name);
+ }
+
+ setAccountMeta (address, meta) {
+ return this._transport
+ .execute('parity_setAccountMeta', inAddress(address), JSON.stringify(meta));
+ }
+
+ setAuthor (address) {
+ return this._transport
+ .execute('parity_setAuthor', inAddress(address));
+ }
+
+ setExtraData (data) {
+ return this._transport
+ .execute('parity_setExtraData', inData(data));
+ }
+
+ setGasFloorTarget (quantity) {
+ return this._transport
+ .execute('parity_setGasFloorTarget', inNumber16(quantity));
+ }
+
+ setMinGasPrice (quantity) {
+ return this._transport
+ .execute('parity_setMinGasPrice', inNumber16(quantity));
+ }
+
+ setMode (mode) {
+ return this._transport
+ .execute('parity_setMode', mode);
+ }
+
+ setTransactionsLimit (quantity) {
+ return this._transport
+ .execute('parity_setTransactionsLimit', inNumber16(quantity));
+ }
+
+ signerPort () {
+ return this._transport
+ .execute('parity_signerPort')
+ .then(outNumber);
+ }
+
+ testPassword (account, password) {
+ return this._transport
+ .execute('parity_testPassword', inAddress(account), password);
+ }
+
+ transactionsLimit () {
+ return this._transport
+ .execute('parity_transactionsLimit')
+ .then(outNumber);
+ }
+
+ unsignedTransactionsCount () {
+ return this._transport
+ .execute('parity_unsignedTransactionsCount')
+ .then(outNumber);
+ }
+}
diff --git a/js/src/api/rpc/ethcore/ethcore.spec.js b/js/src/api/rpc/parity/parity.spec.js
similarity index 66%
rename from js/src/api/rpc/ethcore/ethcore.spec.js
rename to js/src/api/rpc/parity/parity.spec.js
index fd34550a7..ea0dd8d8c 100644
--- a/js/src/api/rpc/ethcore/ethcore.spec.js
+++ b/js/src/api/rpc/parity/parity.spec.js
@@ -18,14 +18,36 @@ import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc';
import { isBigNumber } from '../../../../test/types';
import Http from '../../transport/http';
-import Ethcore from './ethcore';
+import Parity from './parity';
-const instance = new Ethcore(new Http(TEST_HTTP_URL));
+const instance = new Parity(new Http(TEST_HTTP_URL));
+
+describe('api/rpc/parity', () => {
+ describe('accountsInfo', () => {
+ it('retrieves the available account info', () => {
+ mockHttp([{ method: 'parity_accountsInfo', reply: {
+ result: {
+ '0x63cf90d3f0410092fc0fca41846f596223979195': {
+ name: 'name', uuid: 'uuid', meta: '{"data":"data"}'
+ }
+ }
+ } }]);
+
+ return instance.accountsInfo().then((result) => {
+ expect(result).to.deep.equal({
+ '0x63Cf90D3f0410092FC0fca41846f596223979195': {
+ name: 'name', uuid: 'uuid', meta: {
+ data: 'data'
+ }
+ }
+ });
+ });
+ });
+ });
-describe('api/rpc/Ethcore', () => {
describe('gasFloorTarget', () => {
it('returns the gasfloor, formatted', () => {
- mockHttp([{ method: 'ethcore_gasFloorTarget', reply: { result: '0x123456' } }]);
+ mockHttp([{ method: 'parity_gasFloorTarget', reply: { result: '0x123456' } }]);
return instance.gasFloorTarget().then((count) => {
expect(isBigNumber(count)).to.be.true;
@@ -36,7 +58,7 @@ describe('api/rpc/Ethcore', () => {
describe('minGasPrice', () => {
it('returns the min gasprice, formatted', () => {
- mockHttp([{ method: 'ethcore_minGasPrice', reply: { result: '0x123456' } }]);
+ mockHttp([{ method: 'parity_minGasPrice', reply: { result: '0x123456' } }]);
return instance.minGasPrice().then((count) => {
expect(isBigNumber(count)).to.be.true;
@@ -47,7 +69,7 @@ describe('api/rpc/Ethcore', () => {
describe('netMaxPeers', () => {
it('returns the max peers, formatted', () => {
- mockHttp([{ method: 'ethcore_netMaxPeers', reply: { result: 25 } }]);
+ mockHttp([{ method: 'parity_netMaxPeers', reply: { result: 25 } }]);
return instance.netMaxPeers().then((count) => {
expect(isBigNumber(count)).to.be.true;
@@ -58,7 +80,7 @@ describe('api/rpc/Ethcore', () => {
describe('newPeers', () => {
it('returns the peer structure, formatted', () => {
- mockHttp([{ method: 'ethcore_netPeers', reply: { result: { active: 123, connected: 456, max: 789 } } }]);
+ mockHttp([{ method: 'parity_netPeers', reply: { result: { active: 123, connected: 456, max: 789 } } }]);
return instance.netPeers().then((peers) => {
expect(peers.active.eq(123)).to.be.true;
@@ -70,7 +92,7 @@ describe('api/rpc/Ethcore', () => {
describe('netPort', () => {
it('returns the connected port, formatted', () => {
- mockHttp([{ method: 'ethcore_netPort', reply: { result: 33030 } }]);
+ mockHttp([{ method: 'parity_netPort', reply: { result: 33030 } }]);
return instance.netPort().then((count) => {
expect(isBigNumber(count)).to.be.true;
@@ -81,7 +103,7 @@ describe('api/rpc/Ethcore', () => {
describe('transactionsLimit', () => {
it('returns the tx limit, formatted', () => {
- mockHttp([{ method: 'ethcore_transactionsLimit', reply: { result: 1024 } }]);
+ mockHttp([{ method: 'parity_transactionsLimit', reply: { result: 1024 } }]);
return instance.transactionsLimit().then((count) => {
expect(isBigNumber(count)).to.be.true;
diff --git a/js/src/api/rpc/personal/personal.js b/js/src/api/rpc/personal/personal.js
index ca7dbce9b..db9a71d23 100644
--- a/js/src/api/rpc/personal/personal.js
+++ b/js/src/api/rpc/personal/personal.js
@@ -14,113 +14,31 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see .
-import { inAddress, inHex, inNumber10, inNumber16, inOptions } from '../../format/input';
-import { outAccountInfo, outAddress, outSignerRequest } from '../../format/output';
+import { inAddress, inNumber10, inOptions } from '../../format/input';
+import { outAddress } from '../../format/output';
export default class Personal {
constructor (transport) {
this._transport = transport;
}
- accountsInfo () {
- return this._transport
- .execute('personal_accountsInfo')
- .then(outAccountInfo);
- }
-
- confirmRequest (requestId, options, password) {
- return this._transport
- .execute('personal_confirmRequest', inNumber16(requestId), options, password);
- }
-
- changePassword (account, password, newPassword) {
- return this._transport
- .execute('personal_changePassword', inAddress(account), password, newPassword);
- }
-
- generateAuthorizationToken () {
- return this._transport
- .execute('personal_generateAuthorizationToken');
- }
-
listAccounts () {
return this._transport
.execute('personal_listAccounts')
.then((accounts) => (accounts || []).map(outAddress));
}
- listGethAccounts () {
- return this._transport
- .execute('personal_listGethAccounts')
- .then((accounts) => (accounts || []).map(outAddress));
- }
-
- importGethAccounts (accounts) {
- return this._transport
- .execute('personal_importGethAccounts', (accounts || []).map(inAddress))
- .then((accounts) => (accounts || []).map(outAddress));
- }
-
newAccount (password) {
return this._transport
.execute('personal_newAccount', password)
.then(outAddress);
}
- newAccountFromPhrase (phrase, password) {
- return this._transport
- .execute('personal_newAccountFromPhrase', phrase, password)
- .then(outAddress);
- }
-
- newAccountFromSecret (secret, password) {
- return this._transport
- .execute('personal_newAccountFromSecret', inHex(secret), password)
- .then(outAddress);
- }
-
- newAccountFromWallet (json, password) {
- return this._transport
- .execute('personal_newAccountFromWallet', json, password)
- .then(outAddress);
- }
-
- rejectRequest (requestId) {
- return this._transport
- .execute('personal_rejectRequest', inNumber16(requestId));
- }
-
- requestsToConfirm () {
- return this._transport
- .execute('personal_requestsToConfirm')
- .then((requests) => (requests || []).map(outSignerRequest));
- }
-
- setAccountName (address, name) {
- return this._transport
- .execute('personal_setAccountName', inAddress(address), name);
- }
-
- setAccountMeta (address, meta) {
- return this._transport
- .execute('personal_setAccountMeta', inAddress(address), JSON.stringify(meta));
- }
-
signAndSendTransaction (options, password) {
return this._transport
.execute('personal_signAndSendTransaction', inOptions(options), password);
}
- signerEnabled () {
- return this._transport
- .execute('personal_signerEnabled');
- }
-
- testPassword (account, password) {
- return this._transport
- .execute('personal_testPassword', inAddress(account), password);
- }
-
unlockAccount (account, password, duration = 1) {
return this._transport
.execute('personal_unlockAccount', inAddress(account), password, inNumber10(duration));
diff --git a/js/src/api/rpc/personal/personal.spec.js b/js/src/api/rpc/personal/personal.spec.js
index 70734c7ee..a9bf4f644 100644
--- a/js/src/api/rpc/personal/personal.spec.js
+++ b/js/src/api/rpc/personal/personal.spec.js
@@ -26,28 +26,6 @@ describe('rpc/Personal', () => {
const checksum = '0x63Cf90D3f0410092FC0fca41846f596223979195';
let scope;
- describe('accountsInfo', () => {
- it('retrieves the available account info', () => {
- scope = mockHttp([{ method: 'personal_accountsInfo', reply: {
- result: {
- '0x63cf90d3f0410092fc0fca41846f596223979195': {
- name: 'name', uuid: 'uuid', meta: '{"data":"data"}'
- }
- }
- } }]);
-
- return instance.accountsInfo().then((result) => {
- expect(result).to.deep.equal({
- '0x63Cf90D3f0410092FC0fca41846f596223979195': {
- name: 'name', uuid: 'uuid', meta: {
- data: 'data'
- }
- }
- });
- });
- });
- });
-
describe('listAccounts', () => {
it('retrieves a list of available accounts', () => {
scope = mockHttp([{ method: 'personal_listAccounts', reply: { result: [account] } }]);
diff --git a/js/src/api/rpc/signer/index.js b/js/src/api/rpc/signer/index.js
new file mode 100644
index 000000000..6426bdc06
--- /dev/null
+++ b/js/src/api/rpc/signer/index.js
@@ -0,0 +1,17 @@
+// 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 .
+
+export default from './signer';
diff --git a/js/src/api/rpc/signer/signer.js b/js/src/api/rpc/signer/signer.js
new file mode 100644
index 000000000..7f905cf50
--- /dev/null
+++ b/js/src/api/rpc/signer/signer.js
@@ -0,0 +1,50 @@
+// 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 .
+
+import { inNumber16 } from '../../format/input';
+import { outSignerRequest } from '../../format/output';
+
+export default class Signer {
+ constructor (transport) {
+ this._transport = transport;
+ }
+
+ confirmRequest (requestId, options, password) {
+ return this._transport
+ .execute('signer_confirmRequest', inNumber16(requestId), options, password);
+ }
+
+ generateAuthorizationToken () {
+ return this._transport
+ .execute('signer_generateAuthorizationToken');
+ }
+
+ rejectRequest (requestId) {
+ return this._transport
+ .execute('signer_rejectRequest', inNumber16(requestId));
+ }
+
+ requestsToConfirm () {
+ return this._transport
+ .execute('signer_requestsToConfirm')
+ .then((requests) => (requests || []).map(outSignerRequest));
+ }
+
+ signerEnabled () {
+ return this._transport
+ .execute('signer_signerEnabled');
+ }
+}
diff --git a/js/src/api/subscriptions/manager.js b/js/src/api/subscriptions/manager.js
index 61e06499e..08f1a9e53 100644
--- a/js/src/api/subscriptions/manager.js
+++ b/js/src/api/subscriptions/manager.js
@@ -24,9 +24,9 @@ import Signer from './signer';
const events = {
'logging': { module: 'logging' },
'eth_blockNumber': { module: 'eth' },
- 'personal_accountsInfo': { module: 'personal' },
- 'personal_listAccounts': { module: 'personal' },
- 'personal_requestsToConfirm': { module: 'signer' }
+ 'parity_accountsInfo': { module: 'personal' },
+ 'eth_accounts': { module: 'personal' },
+ 'signer_requestsToConfirm': { module: 'signer' }
};
export default class Manager {
diff --git a/js/src/api/subscriptions/personal.js b/js/src/api/subscriptions/personal.js
index d65419962..58428895b 100644
--- a/js/src/api/subscriptions/personal.js
+++ b/js/src/api/subscriptions/personal.js
@@ -37,18 +37,18 @@ export default class Personal {
}
_listAccounts = () => {
- return this._api.personal
- .listAccounts()
+ return this._api.eth
+ .accounts()
.then((accounts) => {
- this._updateSubscriptions('personal_listAccounts', null, accounts);
+ this._updateSubscriptions('eth_accounts', null, accounts);
});
}
_accountsInfo = () => {
- return this._api.personal
+ return this._api.parity
.accountsInfo()
.then((info) => {
- this._updateSubscriptions('personal_accountsInfo', null, info);
+ this._updateSubscriptions('parity_accountsInfo', null, info);
});
}
@@ -59,16 +59,16 @@ export default class Personal {
}
switch (data.method) {
- case 'personal_importGethAccounts':
+ case 'parity_importGethAccounts':
case 'personal_newAccount':
- case 'personal_newAccountFromPhrase':
- case 'personal_newAccountFromWallet':
+ case 'parity_newAccountFromPhrase':
+ case 'parity_newAccountFromWallet':
this._listAccounts();
this._accountsInfo();
return;
- case 'personal_setAccountName':
- case 'personal_setAccountMeta':
+ case 'parity_setAccountName':
+ case 'parity_setAccountMeta':
this._accountsInfo();
return;
}
diff --git a/js/src/api/subscriptions/personal.spec.js b/js/src/api/subscriptions/personal.spec.js
index 1a77b5f61..d6fd2b203 100644
--- a/js/src/api/subscriptions/personal.spec.js
+++ b/js/src/api/subscriptions/personal.spec.js
@@ -34,14 +34,15 @@ function stubApi (accounts, info) {
return {
_calls,
- personal: {
+ parity: {
accountsInfo: () => {
const stub = sinon.stub().resolves(info || TEST_INFO)();
_calls.accountsInfo.push(stub);
return stub;
- },
-
- listAccounts: () => {
+ }
+ },
+ eth: {
+ accounts: () => {
const stub = sinon.stub().resolves(accounts || TEST_LIST)();
_calls.listAccounts.push(stub);
return stub;
@@ -85,17 +86,17 @@ describe('api/subscriptions/personal', () => {
expect(personal.isStarted).to.be.true;
});
- it('calls personal_accountsInfo', () => {
+ it('calls parity_accountsInfo', () => {
expect(api._calls.accountsInfo.length).to.be.ok;
});
- it('calls personal_listAccounts', () => {
+ it('calls eth_accounts', () => {
expect(api._calls.listAccounts.length).to.be.ok;
});
it('updates subscribers', () => {
- expect(cb.firstCall).to.have.been.calledWith('personal_listAccounts', null, TEST_LIST);
- expect(cb.secondCall).to.have.been.calledWith('personal_accountsInfo', null, TEST_INFO);
+ expect(cb.firstCall).to.have.been.calledWith('eth_accounts', null, TEST_LIST);
+ expect(cb.secondCall).to.have.been.calledWith('parity_accountsInfo', null, TEST_INFO);
});
});
diff --git a/js/src/api/subscriptions/signer.js b/js/src/api/subscriptions/signer.js
index af745261b..4413fe432 100644
--- a/js/src/api/subscriptions/signer.js
+++ b/js/src/api/subscriptions/signer.js
@@ -49,10 +49,10 @@ export default class Signer {
return;
}
- return this._api.personal
+ return this._api.signer
.requestsToConfirm()
.then((requests) => {
- this._updateSubscriptions('personal_requestsToConfirm', null, requests);
+ this._updateSubscriptions('signer_requestsToConfirm', null, requests);
nextTimeout();
})
.catch(nextTimeout);
@@ -65,7 +65,7 @@ export default class Signer {
}
switch (data.method) {
- case 'eth_postTransaction':
+ case 'parity_postTransaction':
case 'eth_sendTranasction':
case 'eth_sendRawTransaction':
this._listRequests(false);
diff --git a/js/src/api/transport/http/http.js b/js/src/api/transport/http/http.js
index 65ba089cc..08d9422f8 100644
--- a/js/src/api/transport/http/http.js
+++ b/js/src/api/transport/http/http.js
@@ -56,6 +56,8 @@ export default class Http extends JsonRpcBase {
if (response.status !== 200) {
this._connected = false;
this.error(JSON.stringify({ status: response.status, statusText: response.statusText }));
+ console.error(`${method}(${JSON.stringify(params)}): ${response.status}: ${response.statusText}`);
+
throw new Error(`${response.status}: ${response.statusText}`);
}
@@ -66,7 +68,9 @@ export default class Http extends JsonRpcBase {
if (response.error) {
this.error(JSON.stringify(response));
- throw new Error(`${response.error.code}: ${response.error.message}`);
+ console.error(`${method}(${JSON.stringify(params)}): ${response.error.code}: ${response.error.message}`);
+
+ throw new Error(`${method}: ${response.error.code}: ${response.error.message}`);
}
this.log(JSON.stringify(response));
diff --git a/js/src/api/transport/ws/ws.js b/js/src/api/transport/ws/ws.js
index 119f4ba76..d608426b0 100644
--- a/js/src/api/transport/ws/ws.js
+++ b/js/src/api/transport/ws/ws.js
@@ -107,7 +107,9 @@ export default class Ws extends JsonRpcBase {
if (result.error) {
this.error(event.data);
- reject(new Error(`${result.error.code}: ${result.error.message}`));
+ console.error(`${method}(${JSON.stringify(params)}): ${result.error.code}: ${result.error.message}`);
+
+ reject(new Error(`${method}: ${result.error.code}: ${result.error.message}`));
delete this._messages[result.id];
return;
}
diff --git a/js/src/contracts/registry.js b/js/src/contracts/registry.js
index 85b9d6bb5..9853c0df9 100644
--- a/js/src/contracts/registry.js
+++ b/js/src/contracts/registry.js
@@ -32,7 +32,7 @@ export default class Registry {
return;
}
- this._api.ethcore
+ this._api.parity
.registryAddress()
.then((address) => {
this._instance = this._api.newContract(abis.registry, address).instance;
diff --git a/js/src/dapps/basiccoin/Application/application.js b/js/src/dapps/basiccoin/Application/application.js
index 4ab97ab6c..abe0c90c5 100644
--- a/js/src/dapps/basiccoin/Application/application.js
+++ b/js/src/dapps/basiccoin/Application/application.js
@@ -83,7 +83,7 @@ export default class Application extends Component {
Promise
.all([
attachInstances(),
- api.personal.accountsInfo()
+ api.parity.accounts()
])
.then(([{ managerInstance, registryInstance, tokenregInstance }, accountsInfo]) => {
accountsInfo = accountsInfo || {};
diff --git a/js/src/dapps/basiccoin/Deploy/Deployment/deployment.js b/js/src/dapps/basiccoin/Deploy/Deployment/deployment.js
index f9232789b..0fa7dc863 100644
--- a/js/src/dapps/basiccoin/Deploy/Deployment/deployment.js
+++ b/js/src/dapps/basiccoin/Deploy/Deployment/deployment.js
@@ -296,7 +296,7 @@ export default class Deployment extends Component {
.then((signerRequestId) => {
this.setState({ signerRequestId, deployState: 'Transaction posted, Waiting for transaction authorization' });
- return api.pollMethod('eth_checkRequest', signerRequestId);
+ return api.pollMethod('parity_checkRequest', signerRequestId);
})
.then((txHash) => {
this.setState({ txHash, deployState: 'Transaction authorized, Waiting for network confirmations' });
diff --git a/js/src/dapps/basiccoin/Transfer/Send/send.js b/js/src/dapps/basiccoin/Transfer/Send/send.js
index aee860fe2..a9c05a228 100644
--- a/js/src/dapps/basiccoin/Transfer/Send/send.js
+++ b/js/src/dapps/basiccoin/Transfer/Send/send.js
@@ -279,7 +279,7 @@ export default class Send extends Component {
.then((signerRequestId) => {
this.setState({ signerRequestId, sendState: 'Transaction posted, Waiting for transaction authorization' });
- return api.pollMethod('eth_checkRequest', signerRequestId);
+ return api.pollMethod('parity_checkRequest', signerRequestId);
})
.then((txHash) => {
this.setState({ txHash, sendState: 'Transaction authorized, Waiting for network confirmations' });
diff --git a/js/src/dapps/basiccoin/services.js b/js/src/dapps/basiccoin/services.js
index 28cc662a7..4aed4199f 100644
--- a/js/src/dapps/basiccoin/services.js
+++ b/js/src/dapps/basiccoin/services.js
@@ -100,8 +100,8 @@ export function attachInstances () {
return Promise
.all([
- api.ethcore.registryAddress(),
- api.ethcore.netChain()
+ api.parity.registryAddress(),
+ api.parity.netChain()
])
.then(([registryAddress, netChain]) => {
const registry = api.newContract(abis.registry, registryAddress).instance;
diff --git a/js/src/dapps/githubhint.html b/js/src/dapps/githubhint.html
index 631182fcb..746c7f466 100644
--- a/js/src/dapps/githubhint.html
+++ b/js/src/dapps/githubhint.html
@@ -11,7 +11,6 @@
-