vega-frontend-monorepo/apps/trading/pages/maybe-connect-eagerly.tsx

16 lines
597 B
TypeScript
Raw Normal View History

import { useEnvironment } from '@vegaprotocol/environment';
import { useEagerConnect as useVegaEagerConnect } from '@vegaprotocol/wallet-react';
import { useEagerConnect as useEthereumEagerConnect } from '@vegaprotocol/web3';
import { useTelemetryApproval } from '../lib/hooks/use-telemetry-approval';
export const MaybeConnectEagerly = () => {
const { VEGA_ENV, SENTRY_DSN } = useEnvironment();
const [isTelemetryApproved] = useTelemetryApproval();
useEthereumEagerConnect(
isTelemetryApproved ? { dsn: SENTRY_DSN, env: VEGA_ENV } : {}
);
useVegaEagerConnect();
return null;
};