Ui 2 provider for dapps (#5799)

* Import web3Provider

* Import api

* {Transport,Provider}/Ws -> WsSecure

* PostMessage provider with filters

* PromiseWrapper -> PromiseProvider
This commit is contained in:
Jaco Greeff 2017-06-08 17:14:02 +02:00 committed by GitHub
parent c1599a3d85
commit 7f4a7abf49
64 changed files with 453 additions and 304 deletions

View File

@ -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
}
}

View File

@ -14,7 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
export PromiseWrapper from './promiseWrapper';
export PromiseProvider from './promise';
export Http from './http';
export Ws from './ws';
export PostMessage from './postMessage';
export WsSecure from './wsSecure';

View File

@ -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 <http://www.gnu.org/licenses/>.
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;
}
}

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
export default class PromiseWrapper {
export default class PromiseProvider {
constructor (provider) {
this.provider = provider;
}

View File

@ -14,9 +14,9 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
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)

View File

@ -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;

View File

@ -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';

View File

@ -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', () => {

View File

@ -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', () => {

View File

@ -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';

View File

@ -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;

View File

@ -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;

View File

@ -15,6 +15,6 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
export Http from './http';
export Ws from './ws';
export WsSecure from './wsSecure';
export TransportError from './error';
export Middleware from './middleware';

View File

@ -14,4 +14,4 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
export default from './ws';
export default from './wsSecure';

View File

@ -14,11 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import 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('/');

View File

@ -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();

View File

@ -15,16 +15,16 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
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(() => {

View File

@ -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
};

View File

@ -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) {

View File

@ -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 <http://www.gnu.org/licenses/>.
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;
}
}

View File

@ -14,8 +14,4 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
const api = window.parent.secureApi;
export {
api
};
export default from './dappFilter';

View File

@ -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);
}
}

View File

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
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);

View File

@ -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';

View File

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
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);

View File

@ -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';

View File

@ -0,0 +1,21 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Api from '@parity/api';
const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider);
export default new Api(web3Provider);

View File

@ -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);

View File

@ -0,0 +1,21 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Api from '@parity/api';
const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider);
export default new Api(web3Provider);

View File

@ -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);

View File

@ -0,0 +1,21 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Api from '@parity/api';
const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider);
export default new Api(web3Provider);

View File

@ -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);

View File

@ -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 <http://www.gnu.org/licenses/>.
const api = window.parent.secureApi;
export {
api
};

View File

@ -0,0 +1,21 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Api from '@parity/api';
const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider);
export default new Api(web3Provider);

View File

@ -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';

View File

@ -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 <http://www.gnu.org/licenses/>.
const api = window.parent.secureApi;
export {
api
};

View File

@ -0,0 +1,21 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Api from '@parity/api';
const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider);
export default new Api(web3Provider);

View File

@ -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);

View File

@ -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 <http://www.gnu.org/licenses/>.
const api = window.parent.secureApi;
export {
api
};

21
js/src/views/Home/api.js Normal file
View File

@ -0,0 +1,21 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Api from '@parity/api';
const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider);
export default new Api(web3Provider);

View File

@ -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);

View File

@ -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 <http://www.gnu.org/licenses/>.
const api = window.parent.secureApi;
export {
api
};

View File

@ -0,0 +1,21 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Api from '@parity/api';
const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider);
export default new Api(web3Provider);

View File

@ -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);

View File

@ -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 <http://www.gnu.org/licenses/>.
const api = window.parent.secureApi;
export {
api
};

View File

@ -0,0 +1,21 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Api from '@parity/api';
const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider);
export default new Api(web3Provider);

View File

@ -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';

View File

@ -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 <http://www.gnu.org/licenses/>.
const api = window.parent.secureApi;
export {
api
};

View File

@ -0,0 +1,21 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Api from '@parity/api';
const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider);
export default new Api(web3Provider);

View File

@ -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';

View File

@ -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 <http://www.gnu.org/licenses/>.
const api = window.parent.secureApi;
export {
api
};

View File

@ -0,0 +1,21 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Api from '@parity/api';
const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider);
export default new Api(web3Provider);

View File

@ -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);

View File

@ -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 <http://www.gnu.org/licenses/>.
const api = window.parent.secureApi;
export {
api
};

View File

@ -0,0 +1,21 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Api from '@parity/api';
const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider);
export default new Api(web3Provider);

View File

@ -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';

View File

@ -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 <http://www.gnu.org/licenses/>.
const api = window.parent.secureApi;
export {
api
};

View File

@ -0,0 +1,21 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Api from '@parity/api';
const web3Provider = (window.parity && window.parity.web3Provider) || (window.parent && window.parent.web3Provider);
export default new Api(web3Provider);

View File

@ -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);

View File

@ -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 <http://www.gnu.org/licenses/>.
const api = window.parent.secureApi;
export {
api
};

View File

@ -14,7 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
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

View File

@ -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);

View File

@ -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 <http://www.gnu.org/licenses/>.
const api = window.parent.secureApi;
export {
api
};

View File

@ -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'));
}