vega-frontend-monorepo/apps/trading/lib/vega-connectors.ts
2023-01-19 11:16:21 +00:00

23 lines
477 B
TypeScript

import {
RestConnector,
JsonRpcConnector,
ViewConnector,
} from '@vegaprotocol/wallet';
export const rest = new RestConnector();
export const jsonRpc = new JsonRpcConnector();
let view: ViewConnector;
if (typeof window !== 'undefined') {
const urlParams = new URLSearchParams(window.location.hash.split('?')[1]);
view = new ViewConnector(urlParams.get('address'));
} else {
view = new ViewConnector();
}
export const Connectors = {
rest,
jsonRpc,
view,
};