vega-frontend-monorepo/apps/trading/lib/vega-connectors.ts

26 lines
559 B
TypeScript

import {
RestConnector,
JsonRpcConnector,
ViewConnector,
InjectedConnector,
} from '@vegaprotocol/wallet';
export const rest = new RestConnector();
export const jsonRpc = new JsonRpcConnector();
export const injected = new InjectedConnector();
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 = {
injected,
rest,
jsonRpc,
view,
};