diff --git a/js/src/api/api.js b/js/src/api/api.js index 1d7deea3a..5131d1a1a 100644 --- a/js/src/api/api.js +++ b/js/src/api/api.js @@ -17,8 +17,8 @@ import EventEmitter from 'eventemitter3'; import Contract from './contract'; -import { PromiseWrapper, Http as HttpProvider, Ws as WsProvider } from './provider'; -import { Http as HttpTransport, Ws as WsTransport } from './transport'; +import { PromiseProvider, Http as HttpProvider, PostMessage as PostMessageProvider, WsSecure as WsSecureProvider } from './provider'; +import { Http as HttpTransport, WsSecure as WsSecureTransport } from './transport'; import { Db, Eth, Parity, Net, Personal, Shh, Signer, Trace, Web3 } from './rpc'; import Subscriptions from './subscriptions'; @@ -38,7 +38,7 @@ export default class Api extends EventEmitter { console.warn(new Error('deprecated: Api needs provider with send() function, old-style Transport found instead')); } - this._provider = new PromiseWrapper(provider); + this._provider = new PromiseProvider(provider); this._db = new Db(this._provider); this._eth = new Eth(this._provider); @@ -171,12 +171,13 @@ export default class Api extends EventEmitter { static Provider = { Http: HttpProvider, - Ws: WsProvider + PostMessage: PostMessageProvider, + WsSecure: WsSecureProvider } // NOTE: kept for backwards compatibility static Transport = { Http: HttpTransport, - Ws: WsTransport + WsSecure: WsSecureTransport } } diff --git a/js/src/api/provider/index.js b/js/src/api/provider/index.js index 923a549c8..acad6b14f 100644 --- a/js/src/api/provider/index.js +++ b/js/src/api/provider/index.js @@ -14,7 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -export PromiseWrapper from './promiseWrapper'; +export PromiseProvider from './promise'; export Http from './http'; -export Ws from './ws'; +export PostMessage from './postMessage'; +export WsSecure from './wsSecure'; diff --git a/js/src/api/provider/postMessage.js b/js/src/api/provider/postMessage.js new file mode 100644 index 000000000..b96d730b9 --- /dev/null +++ b/js/src/api/provider/postMessage.js @@ -0,0 +1,52 @@ +// 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 . + +export default class PostMessage { + id = 0; + _callbacks = {}; + + constructor (token, destination) { + this._token = token; + this._destination = destination; + + window.addEventListener('message', this.receiveMessage, false); + } + + addMiddleware () { + } + + send = (method, params, callback) => { + const id = ++this.id; + + this._callbacks[id] = callback; + this._destination.postMessage({ + id, + from: this._token, + method, + params, + token: this._token + }, '*'); + } + + receiveMessage = ({ data: { id, error, from, token, result }, origin, source }) => { + if (from !== 'shell' || token !== this._token) { + return; + } + + this._callbacks[id](error, result); + this._callbacks[id] = null; + } +} diff --git a/js/src/api/provider/promiseWrapper.js b/js/src/api/provider/promise.js similarity index 96% rename from js/src/api/provider/promiseWrapper.js rename to js/src/api/provider/promise.js index 3241c7b59..35da3d8c6 100644 --- a/js/src/api/provider/promiseWrapper.js +++ b/js/src/api/provider/promise.js @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -export default class PromiseWrapper { +export default class PromiseProvider { constructor (provider) { this.provider = provider; } diff --git a/js/src/api/provider/ws.js b/js/src/api/provider/wsSecure.js similarity index 89% rename from js/src/api/provider/ws.js rename to js/src/api/provider/wsSecure.js index 2a399d309..91b9e932f 100644 --- a/js/src/api/provider/ws.js +++ b/js/src/api/provider/wsSecure.js @@ -14,9 +14,9 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import { Ws as Transport } from '../transport'; +import { WsSecure as Transport } from '../transport'; -export default class Ws extends Transport { +export default class WsSecure extends Transport { send = (method, params, callback) => { this ._execute(method, params) diff --git a/js/src/api/rpc/db/db.spec.js b/js/src/api/rpc/db/db.spec.js index 86105127b..160827d57 100644 --- a/js/src/api/rpc/db/db.spec.js +++ b/js/src/api/rpc/db/db.spec.js @@ -16,10 +16,10 @@ import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc'; -import { Http, PromiseWrapper } from '../../provider'; +import { Http, PromiseProvider } from '../../provider'; import Db from './db'; -const instance = new Db(new PromiseWrapper(new Http(TEST_HTTP_URL, -1))); +const instance = new Db(new PromiseProvider(new Http(TEST_HTTP_URL, -1))); describe('api/rpc/Db', () => { let scope; diff --git a/js/src/api/rpc/eth/eth.spec.js b/js/src/api/rpc/eth/eth.spec.js index b88ac390f..ac295e836 100644 --- a/js/src/api/rpc/eth/eth.spec.js +++ b/js/src/api/rpc/eth/eth.spec.js @@ -17,10 +17,10 @@ import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc'; import { isBigNumber } from '../../../../test/types'; -import { Http, PromiseWrapper } from '../../provider'; +import { Http, PromiseProvider } from '../../provider'; import Eth from './eth'; -const instance = new Eth(new PromiseWrapper(new Http(TEST_HTTP_URL, -1))); +const instance = new Eth(new PromiseProvider(new Http(TEST_HTTP_URL, -1))); describe('rpc/Eth', () => { const address = '0x63Cf90D3f0410092FC0fca41846f596223979195'; diff --git a/js/src/api/rpc/net/net.spec.js b/js/src/api/rpc/net/net.spec.js index 1aeae2f79..ec7900eec 100644 --- a/js/src/api/rpc/net/net.spec.js +++ b/js/src/api/rpc/net/net.spec.js @@ -17,10 +17,10 @@ import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc'; import { isBigNumber } from '../../../../test/types'; -import { Http, PromiseWrapper } from '../../provider'; +import { Http, PromiseProvider } from '../../provider'; import Net from './net'; -const instance = new Net(new PromiseWrapper(new Http(TEST_HTTP_URL, -1))); +const instance = new Net(new PromiseProvider(new Http(TEST_HTTP_URL, -1))); describe('api/rpc/Net', () => { describe('peerCount', () => { diff --git a/js/src/api/rpc/parity/parity.spec.js b/js/src/api/rpc/parity/parity.spec.js index f835318ce..412276bd3 100644 --- a/js/src/api/rpc/parity/parity.spec.js +++ b/js/src/api/rpc/parity/parity.spec.js @@ -18,10 +18,10 @@ import BigNumber from 'bignumber.js'; import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc'; import { isBigNumber } from '../../../../test/types'; -import { Http, PromiseWrapper } from '../../provider'; +import { Http, PromiseProvider } from '../../provider'; import Parity from './parity'; -const instance = new Parity(new PromiseWrapper(new Http(TEST_HTTP_URL, -1))); +const instance = new Parity(new PromiseProvider(new Http(TEST_HTTP_URL, -1))); describe('api/rpc/parity', () => { describe('accountsInfo', () => { diff --git a/js/src/api/rpc/personal/personal.spec.js b/js/src/api/rpc/personal/personal.spec.js index 359e35929..59288886c 100644 --- a/js/src/api/rpc/personal/personal.spec.js +++ b/js/src/api/rpc/personal/personal.spec.js @@ -16,10 +16,10 @@ import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc'; -import { Http, PromiseWrapper } from '../../provider'; +import { Http, PromiseProvider } from '../../provider'; import Personal from './personal'; -const instance = new Personal(new PromiseWrapper(new Http(TEST_HTTP_URL, -1))); +const instance = new Personal(new PromiseProvider(new Http(TEST_HTTP_URL, -1))); describe('rpc/Personal', () => { const account = '0x63cf90d3f0410092fc0fca41846f596223979195'; diff --git a/js/src/api/rpc/trace/trace.spec.js b/js/src/api/rpc/trace/trace.spec.js index fff6d76c7..db14e3ae4 100644 --- a/js/src/api/rpc/trace/trace.spec.js +++ b/js/src/api/rpc/trace/trace.spec.js @@ -16,10 +16,10 @@ import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc'; -import { Http, PromiseWrapper } from '../../provider'; +import { Http, PromiseProvider } from '../../provider'; import Trace from './trace'; -const instance = new Trace(new PromiseWrapper(new Http(TEST_HTTP_URL, -1))); +const instance = new Trace(new PromiseProvider(new Http(TEST_HTTP_URL, -1))); describe('api/rpc/Trace', () => { let scope; diff --git a/js/src/api/rpc/web3/web3.spec.js b/js/src/api/rpc/web3/web3.spec.js index ba5c263d0..65f774f38 100644 --- a/js/src/api/rpc/web3/web3.spec.js +++ b/js/src/api/rpc/web3/web3.spec.js @@ -16,10 +16,10 @@ import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc'; -import { Http, PromiseWrapper } from '../../provider'; +import { Http, PromiseProvider } from '../../provider'; import Web3 from './web3'; -const instance = new Web3(new PromiseWrapper(new Http(TEST_HTTP_URL, -1))); +const instance = new Web3(new PromiseProvider(new Http(TEST_HTTP_URL, -1))); describe('api/rpc/Web3', () => { let scope; diff --git a/js/src/api/transport/index.js b/js/src/api/transport/index.js index fdd3861a8..d9a91ab77 100644 --- a/js/src/api/transport/index.js +++ b/js/src/api/transport/index.js @@ -15,6 +15,6 @@ // along with Parity. If not, see . export Http from './http'; -export Ws from './ws'; +export WsSecure from './wsSecure'; export TransportError from './error'; export Middleware from './middleware'; diff --git a/js/src/api/transport/ws/index.js b/js/src/api/transport/wsSecure/index.js similarity index 95% rename from js/src/api/transport/ws/index.js rename to js/src/api/transport/wsSecure/index.js index 7ab0be131..427c76dc8 100644 --- a/js/src/api/transport/ws/index.js +++ b/js/src/api/transport/wsSecure/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 './ws'; +export default from './wsSecure'; diff --git a/js/src/api/transport/ws/ws.e2e.js b/js/src/api/transport/wsSecure/wsSecure.e2e.js similarity index 88% rename from js/src/api/transport/ws/ws.e2e.js rename to js/src/api/transport/wsSecure/wsSecure.e2e.js index 42e47451c..537afa5f9 100644 --- a/js/src/api/transport/ws/ws.e2e.js +++ b/js/src/api/transport/wsSecure/wsSecure.e2e.js @@ -14,11 +14,11 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import Ws from './ws'; +import WsSecure from './wsSecure'; -const ws = new Ws('ws://localhost:8546/'); +const ws = new WsSecure('ws://localhost:8546/'); -describe('transport/Ws', () => { +describe('transport/WsSecure', () => { it('connects and makes a call to web3_clientVersion', () => { return ws.execute('web3_clientVersion').then((version) => { const [client] = version.split('/'); diff --git a/js/src/api/transport/ws/ws.js b/js/src/api/transport/wsSecure/wsSecure.js similarity index 99% rename from js/src/api/transport/ws/ws.js rename to js/src/api/transport/wsSecure/wsSecure.js index 63cfcc5ec..c957129d6 100644 --- a/js/src/api/transport/ws/ws.js +++ b/js/src/api/transport/wsSecure/wsSecure.js @@ -21,7 +21,7 @@ import JsonRpcBase from '../jsonRpcBase'; import TransportError from '../error'; /* global WebSocket */ -export default class Ws extends JsonRpcBase { +export default class WsSecure extends JsonRpcBase { constructor (url, token, autoconnect = true) { super(); diff --git a/js/src/api/transport/ws/ws.spec.js b/js/src/api/transport/wsSecure/wsSecure.spec.js similarity index 92% rename from js/src/api/transport/ws/ws.spec.js rename to js/src/api/transport/wsSecure/wsSecure.spec.js index 6f939c584..40a2212fa 100644 --- a/js/src/api/transport/ws/ws.spec.js +++ b/js/src/api/transport/wsSecure/wsSecure.spec.js @@ -15,16 +15,16 @@ // along with Parity. If not, see . import { TEST_WS_URL, mockWs } from '../../../../test/mockRpc'; -import Ws from './ws'; +import WsSecure from './wsSecure'; -describe('api/transport/Ws', () => { +describe('api/transport/WsSecure', () => { let transport; let scope; describe('transport emitter', () => { const connect = () => { const scope = mockWs(); - const transport = new Ws(TEST_WS_URL); + const transport = new WsSecure(TEST_WS_URL); return { transport, scope }; }; @@ -57,7 +57,7 @@ describe('api/transport/Ws', () => { beforeEach(() => { scope = mockWs([{ method: 'test_anyCall', reply: 'TestResult' }]); - transport = new Ws(TEST_WS_URL); + transport = new WsSecure(TEST_WS_URL); return transport .execute('test_anyCall', [1, 2, 3]) @@ -98,7 +98,7 @@ describe('api/transport/Ws', () => { describe('errors', () => { beforeEach(() => { scope = mockWs([{ method: 'test_anyCall', reply: { error: { code: 1, message: 'TestError' } } }]); - transport = new Ws(TEST_WS_URL); + transport = new WsSecure(TEST_WS_URL); }); afterEach(() => { diff --git a/js/src/parity.js b/js/src/parity.js index 55d04d2f5..507c121b8 100644 --- a/js/src/parity.js +++ b/js/src/parity.js @@ -23,9 +23,11 @@ import Api from './api'; import './dev.parity.html'; -const api = new Api(new Api.Provider.Http('/rpc/')); +const web3Provider = new Api.Provider.Http('/rpc/'); +const api = new Api(web3Provider); window.parity = { Api, - api + api, + web3Provider }; diff --git a/js/src/secureApi.js b/js/src/secureApi.js index b16217779..976d5e5fd 100644 --- a/js/src/secureApi.js +++ b/js/src/secureApi.js @@ -35,7 +35,7 @@ export default class SecureApi extends Api { static getTransport (url, sysuiToken, protocol) { const transportUrl = SecureApi.transportUrl(url, protocol); - return new Api.Provider.Ws(transportUrl, sysuiToken, false); + return new Api.Provider.WsSecure(transportUrl, sysuiToken, false); } static transportUrl (url, protocol) { diff --git a/js/src/shell/DappFilter/dappFilter.js b/js/src/shell/DappFilter/dappFilter.js new file mode 100644 index 000000000..41fbd1404 --- /dev/null +++ b/js/src/shell/DappFilter/dappFilter.js @@ -0,0 +1,65 @@ +// 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 . + +export default class DappFilter { + constructor (provider, permissions) { + this.permissions = permissions; + this.provider = provider; + + window.addEventListener('message', this.receiveMessage, false); + } + + receiveMessage = ({ data: { id, from, method, params, token }, origin, source }) => { + if (from === 'shell' || from !== token) { + return; + } + + if (this.permissions.filtered.includes(method) && !this.permissions.tokens[token][method]) { + source.postMessage({ + id, + from: 'shell', + error: new Error(`Method ${method} is not available to application`), + result: null, + token + }, '*'); + return; + } + + this.provider.send(method, params, (error, result) => { + source.postMessage({ + error, + id, + from: 'shell', + result, + token + }, '*'); + }); + } + + setPermissions (permissions) { + this.permissions = permissions; + } + + static instance = null; + + static create (provider, permissions) { + DappFilter.instance = new DappFilter(provider, permissions); + } + + static get () { + return DappFilter.instance; + } +} diff --git a/js/src/views/Account/parity.js b/js/src/shell/DappFilter/index.js similarity index 92% rename from js/src/views/Account/parity.js rename to js/src/shell/DappFilter/index.js index 7118ce087..66f9c6a51 100644 --- a/js/src/views/Account/parity.js +++ b/js/src/shell/DappFilter/index.js @@ -14,8 +14,4 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -const api = window.parent.secureApi; - -export { - api -}; +export default from './dappFilter'; diff --git a/js/src/shell/index.js b/js/src/shell/index.js index c040e42ea..7405c920b 100644 --- a/js/src/shell/index.js +++ b/js/src/shell/index.js @@ -26,6 +26,7 @@ import injectTapEventPlugin from 'react-tap-event-plugin'; import { IndexRoute, Redirect, Route, Router, hashHistory } from 'react-router'; import qs from 'querystring'; +import Api from '@parity/api'; import builtinDapps from '@parity/shared/config/dappsBuiltin.json'; import viewsDapps from '@parity/shared/config/dappsViews.json'; import ContractInstances from '@parity/shared/contracts'; @@ -40,6 +41,7 @@ import SecureApi from '~/secureApi'; import Application from './Application'; import Dapp from './Dapp'; +import DappFilter from './DappFilter'; import Dapps from './Dapps'; injectTapEventPlugin(); @@ -65,17 +67,23 @@ const api = new SecureApi(uiUrl, token); patchApi(api); ContractInstances.get(api); -const store = initStore(api, hashHistory); +DappFilter.create(api.provider, { + filtered: [], + tokens: { + } +}); -window.secureApi = api; +const store = initStore(api, hashHistory); const dapps = [].concat(viewsDapps, builtinDapps); const dappsHistory = HistoryStore.get('dapps'); -function onEnterDapp ({ params }) { - if (!dapps[params.id] || !dapps[params.id].skipHistory) { - dappsHistory.add(params.id); +function onEnterDapp ({ params: { id } }) { + window.web3Provider = new Api.Provider.PostMessage(id, window); + + if (!dapps[id] || !dapps[id].skipHistory) { + dappsHistory.add(id); } } diff --git a/js/src/views/Addresses/parity.js b/js/src/views/Account/api.js similarity index 79% rename from js/src/views/Addresses/parity.js rename to js/src/views/Account/api.js index 7118ce087..48d84ad98 100644 --- a/js/src/views/Addresses/parity.js +++ b/js/src/views/Account/api.js @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -const api = window.parent.secureApi; +import Api from '@parity/api'; -export { - api -}; +const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider); + +export default new Api(web3Provider); diff --git a/js/src/views/Account/index.js b/js/src/views/Account/index.js index 1ea5776dd..3ed2668ee 100644 --- a/js/src/views/Account/index.js +++ b/js/src/views/Account/index.js @@ -25,7 +25,7 @@ import ContractInstances from '@parity/shared/contracts'; import { initStore } from '@parity/shared/redux'; import ContextProvider from '@parity/ui/ContextProvider'; -import { api } from './parity'; +import api from './api'; import Account from './account'; diff --git a/js/src/views/Accounts/parity.js b/js/src/views/Accounts/api.js similarity index 79% rename from js/src/views/Accounts/parity.js rename to js/src/views/Accounts/api.js index 7118ce087..48d84ad98 100644 --- a/js/src/views/Accounts/parity.js +++ b/js/src/views/Accounts/api.js @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -const api = window.parent.secureApi; +import Api from '@parity/api'; -export { - api -}; +const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider); + +export default new Api(web3Provider); diff --git a/js/src/views/Accounts/index.js b/js/src/views/Accounts/index.js index 7b369de65..50966a1e6 100644 --- a/js/src/views/Accounts/index.js +++ b/js/src/views/Accounts/index.js @@ -25,7 +25,7 @@ import ContractInstances from '@parity/shared/contracts'; import { initStore } from '@parity/shared/redux'; import ContextProvider from '@parity/ui/ContextProvider'; -import { api } from './parity'; +import api from './api'; import Accounts from './accounts'; diff --git a/js/src/views/Address/api.js b/js/src/views/Address/api.js new file mode 100644 index 000000000..48d84ad98 --- /dev/null +++ b/js/src/views/Address/api.js @@ -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 . + +import Api from '@parity/api'; + +const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider); + +export default new Api(web3Provider); diff --git a/js/src/views/Address/index.js b/js/src/views/Address/index.js index 538c38da2..9c4f80074 100644 --- a/js/src/views/Address/index.js +++ b/js/src/views/Address/index.js @@ -25,7 +25,7 @@ import ContractInstances from '@parity/shared/contracts'; import { initStore } from '@parity/shared/redux'; import ContextProvider from '@parity/ui/ContextProvider'; -import { api } from './parity'; +import api from './api'; import Address from './address'; ContractInstances.get(api); diff --git a/js/src/views/Addresses/api.js b/js/src/views/Addresses/api.js new file mode 100644 index 000000000..48d84ad98 --- /dev/null +++ b/js/src/views/Addresses/api.js @@ -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 . + +import Api from '@parity/api'; + +const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider); + +export default new Api(web3Provider); diff --git a/js/src/views/Addresses/index.js b/js/src/views/Addresses/index.js index 1324444c3..225c36c80 100644 --- a/js/src/views/Addresses/index.js +++ b/js/src/views/Addresses/index.js @@ -25,7 +25,7 @@ import ContractInstances from '@parity/shared/contracts'; import { initStore } from '@parity/shared/redux'; import ContextProvider from '@parity/ui/ContextProvider'; -import { api } from './parity'; +import api from './api'; import Addresses from './addresses'; ContractInstances.get(api); diff --git a/js/src/views/Contract/api.js b/js/src/views/Contract/api.js new file mode 100644 index 000000000..48d84ad98 --- /dev/null +++ b/js/src/views/Contract/api.js @@ -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 . + +import Api from '@parity/api'; + +const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider); + +export default new Api(web3Provider); diff --git a/js/src/views/Contract/index.js b/js/src/views/Contract/index.js index 19ed74cb6..657f86b6a 100644 --- a/js/src/views/Contract/index.js +++ b/js/src/views/Contract/index.js @@ -25,7 +25,7 @@ import ContractInstances from '@parity/shared/contracts'; import { initStore } from '@parity/shared/redux'; import ContextProvider from '@parity/ui/ContextProvider'; -import { api } from './parity'; +import api from './api'; import Contract from './contract'; ContractInstances.get(api); diff --git a/js/src/views/Contract/parity.js b/js/src/views/Contract/parity.js deleted file mode 100644 index 7118ce087..000000000 --- a/js/src/views/Contract/parity.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -const api = window.parent.secureApi; - -export { - api -}; diff --git a/js/src/views/ContractDevelop/api.js b/js/src/views/ContractDevelop/api.js new file mode 100644 index 000000000..48d84ad98 --- /dev/null +++ b/js/src/views/ContractDevelop/api.js @@ -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 . + +import Api from '@parity/api'; + +const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider); + +export default new Api(web3Provider); diff --git a/js/src/views/ContractDevelop/index.js b/js/src/views/ContractDevelop/index.js index 42fd9d315..83b5710e5 100644 --- a/js/src/views/ContractDevelop/index.js +++ b/js/src/views/ContractDevelop/index.js @@ -24,7 +24,7 @@ injectTapEventPlugin(); import { initStore } from '@parity/shared/redux'; import ContextProvider from '@parity/ui/ContextProvider'; -import { api } from './parity'; +import api from './api'; import ContractDevelop from './contractDevelop'; diff --git a/js/src/views/ContractDevelop/parity.js b/js/src/views/ContractDevelop/parity.js deleted file mode 100644 index 7118ce087..000000000 --- a/js/src/views/ContractDevelop/parity.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -const api = window.parent.secureApi; - -export { - api -}; diff --git a/js/src/views/Contracts/api.js b/js/src/views/Contracts/api.js new file mode 100644 index 000000000..48d84ad98 --- /dev/null +++ b/js/src/views/Contracts/api.js @@ -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 . + +import Api from '@parity/api'; + +const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider); + +export default new Api(web3Provider); diff --git a/js/src/views/Contracts/index.js b/js/src/views/Contracts/index.js index 59277a406..632ec9162 100644 --- a/js/src/views/Contracts/index.js +++ b/js/src/views/Contracts/index.js @@ -25,7 +25,7 @@ import ContractInstances from '@parity/shared/contracts'; import { initStore } from '@parity/shared/redux'; import ContextProvider from '@parity/ui/ContextProvider'; -import { api } from './parity'; +import api from './api'; import Contracts from './contracts'; ContractInstances.get(api); diff --git a/js/src/views/Contracts/parity.js b/js/src/views/Contracts/parity.js deleted file mode 100644 index 7118ce087..000000000 --- a/js/src/views/Contracts/parity.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -const api = window.parent.secureApi; - -export { - api -}; diff --git a/js/src/views/Home/api.js b/js/src/views/Home/api.js new file mode 100644 index 000000000..48d84ad98 --- /dev/null +++ b/js/src/views/Home/api.js @@ -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 . + +import Api from '@parity/api'; + +const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider); + +export default new Api(web3Provider); diff --git a/js/src/views/Home/index.js b/js/src/views/Home/index.js index 0433f3d5d..d431eb41f 100644 --- a/js/src/views/Home/index.js +++ b/js/src/views/Home/index.js @@ -24,7 +24,7 @@ injectTapEventPlugin(); import { initStore } from '@parity/shared/redux'; import ContextProvider from '@parity/ui/ContextProvider'; -import { api } from './parity'; +import api from './api'; import Home from './home'; const store = initStore(api, hashHistory); diff --git a/js/src/views/Home/parity.js b/js/src/views/Home/parity.js deleted file mode 100644 index 7118ce087..000000000 --- a/js/src/views/Home/parity.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -const api = window.parent.secureApi; - -export { - api -}; diff --git a/js/src/views/Playground/api.js b/js/src/views/Playground/api.js new file mode 100644 index 000000000..48d84ad98 --- /dev/null +++ b/js/src/views/Playground/api.js @@ -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 . + +import Api from '@parity/api'; + +const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider); + +export default new Api(web3Provider); diff --git a/js/src/views/Playground/index.js b/js/src/views/Playground/index.js index 7b3d11712..ed0a868d7 100644 --- a/js/src/views/Playground/index.js +++ b/js/src/views/Playground/index.js @@ -24,7 +24,7 @@ injectTapEventPlugin(); import { initStore } from '@parity/shared/redux'; import ContextProvider from '@parity/ui/ContextProvider'; -import { api } from './parity'; +import api from './api'; import Playground from './playground'; const store = initStore(api, hashHistory); diff --git a/js/src/views/Playground/parity.js b/js/src/views/Playground/parity.js deleted file mode 100644 index 7118ce087..000000000 --- a/js/src/views/Playground/parity.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -const api = window.parent.secureApi; - -export { - api -}; diff --git a/js/src/views/Settings/api.js b/js/src/views/Settings/api.js new file mode 100644 index 000000000..48d84ad98 --- /dev/null +++ b/js/src/views/Settings/api.js @@ -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 . + +import Api from '@parity/api'; + +const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider); + +export default new Api(web3Provider); diff --git a/js/src/views/Settings/index.js b/js/src/views/Settings/index.js index 4a614b926..e18963142 100644 --- a/js/src/views/Settings/index.js +++ b/js/src/views/Settings/index.js @@ -24,7 +24,7 @@ injectTapEventPlugin(); import { initStore } from '@parity/shared/redux'; import ContextProvider from '@parity/ui/ContextProvider'; -import { api } from './parity'; +import api from './api'; import SettingsBackground from './Background'; import SettingsParity from './Node'; diff --git a/js/src/views/Settings/parity.js b/js/src/views/Settings/parity.js deleted file mode 100644 index 7118ce087..000000000 --- a/js/src/views/Settings/parity.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -const api = window.parent.secureApi; - -export { - api -}; diff --git a/js/src/views/Signer/api.js b/js/src/views/Signer/api.js new file mode 100644 index 000000000..48d84ad98 --- /dev/null +++ b/js/src/views/Signer/api.js @@ -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 . + +import Api from '@parity/api'; + +const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider); + +export default new Api(web3Provider); diff --git a/js/src/views/Signer/index.js b/js/src/views/Signer/index.js index 80f69174f..519d790a0 100644 --- a/js/src/views/Signer/index.js +++ b/js/src/views/Signer/index.js @@ -25,7 +25,7 @@ import ContractInstances from '@parity/shared/contracts'; import { initStore } from '@parity/shared/redux'; import ContextProvider from '@parity/ui/ContextProvider'; -import { api } from './parity'; +import api from './api'; import Signer from './signer'; diff --git a/js/src/views/Signer/parity.js b/js/src/views/Signer/parity.js deleted file mode 100644 index 7118ce087..000000000 --- a/js/src/views/Signer/parity.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -const api = window.parent.secureApi; - -export { - api -}; diff --git a/js/src/views/Status/api.js b/js/src/views/Status/api.js new file mode 100644 index 000000000..48d84ad98 --- /dev/null +++ b/js/src/views/Status/api.js @@ -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 . + +import Api from '@parity/api'; + +const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider); + +export default new Api(web3Provider); diff --git a/js/src/views/Status/index.js b/js/src/views/Status/index.js index 9bc9696d3..f1792fcde 100644 --- a/js/src/views/Status/index.js +++ b/js/src/views/Status/index.js @@ -25,7 +25,7 @@ import ContractInstances from '@parity/shared/contracts'; import { initStore } from '@parity/shared/redux'; import ContextProvider from '@parity/ui/ContextProvider'; -import { api } from './parity'; +import api from './api'; import Status from './status'; ContractInstances.get(api); diff --git a/js/src/views/Status/parity.js b/js/src/views/Status/parity.js deleted file mode 100644 index 7118ce087..000000000 --- a/js/src/views/Status/parity.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -const api = window.parent.secureApi; - -export { - api -}; diff --git a/js/src/views/Vaults/api.js b/js/src/views/Vaults/api.js new file mode 100644 index 000000000..48d84ad98 --- /dev/null +++ b/js/src/views/Vaults/api.js @@ -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 . + +import Api from '@parity/api'; + +const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider); + +export default new Api(web3Provider); diff --git a/js/src/views/Vaults/index.js b/js/src/views/Vaults/index.js index 7b3d0dd8a..1c0d67b90 100644 --- a/js/src/views/Vaults/index.js +++ b/js/src/views/Vaults/index.js @@ -25,7 +25,7 @@ import ContractInstances from '@parity/shared/contracts'; import { initStore } from '@parity/shared/redux'; import ContextProvider from '@parity/ui/ContextProvider'; -import { api } from './parity'; +import api from './api'; import Vaults from './vaults'; diff --git a/js/src/views/Vaults/parity.js b/js/src/views/Vaults/parity.js deleted file mode 100644 index 7118ce087..000000000 --- a/js/src/views/Vaults/parity.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -const api = window.parent.secureApi; - -export { - api -}; diff --git a/js/src/views/Wallet/api.js b/js/src/views/Wallet/api.js new file mode 100644 index 000000000..48d84ad98 --- /dev/null +++ b/js/src/views/Wallet/api.js @@ -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 . + +import Api from '@parity/api'; + +const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider); + +export default new Api(web3Provider); diff --git a/js/src/views/Wallet/index.js b/js/src/views/Wallet/index.js index 1e6c73e6c..cdb631e9e 100644 --- a/js/src/views/Wallet/index.js +++ b/js/src/views/Wallet/index.js @@ -25,7 +25,7 @@ import ContractInstances from '@parity/shared/contracts'; import { initStore } from '@parity/shared/redux'; import ContextProvider from '@parity/ui/ContextProvider'; -import { api } from './parity'; +import api from './api'; import Wallet from './wallet'; ContractInstances.get(api); diff --git a/js/src/views/Wallet/parity.js b/js/src/views/Wallet/parity.js deleted file mode 100644 index 7118ce087..000000000 --- a/js/src/views/Wallet/parity.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -const api = window.parent.secureApi; - -export { - api -}; diff --git a/js/src/views/Address/parity.js b/js/src/views/Web/api.js similarity index 79% rename from js/src/views/Address/parity.js rename to js/src/views/Web/api.js index 7118ce087..db7446fb9 100644 --- a/js/src/views/Address/parity.js +++ b/js/src/views/Web/api.js @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -const api = window.parent.secureApi; +import Api from '@parity/api'; + +const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider); +const api = new Api(web3Provider); export { api diff --git a/js/src/views/Web/index.js b/js/src/views/Web/index.js index 048e99b41..aa42f0220 100644 --- a/js/src/views/Web/index.js +++ b/js/src/views/Web/index.js @@ -24,7 +24,7 @@ injectTapEventPlugin(); import { initStore } from '@parity/shared/redux'; import ContextProvider from '@parity/ui/ContextProvider'; -import { api } from './parity'; +import api from './api'; import Web from './web'; const store = initStore(api, hashHistory); diff --git a/js/src/views/Web/parity.js b/js/src/views/Web/parity.js deleted file mode 100644 index 7118ce087..000000000 --- a/js/src/views/Web/parity.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -const api = window.parent.secureApi; - -export { - api -}; diff --git a/js/test/e2e/ethapi.js b/js/test/e2e/ethapi.js index e8ed540a9..2673af321 100644 --- a/js/test/e2e/ethapi.js +++ b/js/test/e2e/ethapi.js @@ -29,5 +29,5 @@ export function createHttpApi () { } export function createWsApi () { - return createApi(new Api.Provider.Ws('ws://localhost:8546')); + return createApi(new Api.Provider.WsSecure('ws://localhost:8546')); }