diff --git a/js/package.json b/js/package.json
index 04c29ac7a93..54cce18d4ad 100644
--- a/js/package.json
+++ b/js/package.json
@@ -135,6 +135,7 @@
"store": "^1.3.20",
"utf8": "^2.1.1",
"validator": "^5.7.0",
+ "web3": "^0.17.0-beta",
"whatwg-fetch": "^1.0.0"
}
}
diff --git a/js/src/dev.parity.html b/js/src/dev.parity.html
new file mode 100644
index 00000000000..20b8e965fcd
--- /dev/null
+++ b/js/src/dev.parity.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ dev::Parity.js
+
+
+
+
+
diff --git a/js/src/dev.web3.html b/js/src/dev.web3.html
new file mode 100644
index 00000000000..97a47eb72d5
--- /dev/null
+++ b/js/src/dev.web3.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ dev::Web3
+
+
+
+
+
diff --git a/js/src/inject.js b/js/src/inject.js
new file mode 100644
index 00000000000..15dc4747cf0
--- /dev/null
+++ b/js/src/inject.js
@@ -0,0 +1,27 @@
+// 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 Web3 from 'web3';
+import web3extensions from './util/web3.extensions';
+
+import './dev.web3.html';
+
+const http = new Web3.providers.HttpProvider('/rpc/');
+const web3 = new Web3(http);
+
+web3extensions(web3).map((extension) => web3._extend(extension));
+
+global.web3 = web3;
diff --git a/js/src/parity.js b/js/src/parity.js
index 1fe788b5a23..4e6184c6a7e 100644
--- a/js/src/parity.js
+++ b/js/src/parity.js
@@ -22,6 +22,8 @@ es6Promise.polyfill();
import Api from './api';
+import './dev.parity.html';
+
const api = new Api(new Api.Transport.Http('/rpc/'));
window.parity = {
diff --git a/js/src/util/web3.extensions.js b/js/src/util/web3.extensions.js
new file mode 100644
index 00000000000..acae683bd14
--- /dev/null
+++ b/js/src/util/web3.extensions.js
@@ -0,0 +1,67 @@
+// 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 function web3extensions (web3) {
+ const { Method, formatters } = web3._extend;
+
+ return [{
+ property: 'personal',
+ methods: [
+ new Method({
+ name: 'signAndSendTransaction',
+ call: 'personal_signAndSendTransaction',
+ params: 2,
+ inputFormatter: [formatters.inputTransactionFormatter, null]
+ }),
+ new Method({
+ name: 'signerEnabled',
+ call: 'personal_signerEnabled',
+ params: 0,
+ inputFormatter: []
+ })
+ ],
+ properties: []
+ }, {
+ property: 'ethcore',
+ methods: [
+ new Method({
+ name: 'getNetPeers',
+ call: 'ethcore_netPeers',
+ params: 0,
+ outputFormatter: x => x
+ }),
+ new Method({
+ name: 'getNetChain',
+ call: 'ethcore_netChain',
+ params: 0,
+ outputFormatter: x => x
+ }),
+ new Method({
+ name: 'gasPriceStatistics',
+ call: 'ethcore_gasPriceStatistics',
+ params: 0,
+ outputFormatter: a => a.map(web3.toBigNumber)
+ }),
+ new Method({
+ name: 'unsignedTransactionsCount',
+ call: 'ethcore_unsignedTransactionsCount',
+ params: 0,
+ inputFormatter: []
+ })
+ ],
+ properties: []
+ }];
+}
diff --git a/js/webpack.config.js b/js/webpack.config.js
index 571ea543508..3471b5e7165 100644
--- a/js/webpack.config.js
+++ b/js/webpack.config.js
@@ -41,6 +41,7 @@ module.exports = {
'signaturereg': ['./dapps/signaturereg.js'],
'tokenreg': ['./dapps/tokenreg.js'],
// library
+ 'inject': ['./inject.js'],
'parity': ['./parity.js'],
// app
'index': ['./index.js']