diff --git a/apps/governance-e2e/src/integration/view/pubkey-view.cy.ts b/apps/governance-e2e/src/integration/view/pubkey-view.cy.ts index bc1b4537f..4e83e2dd7 100644 --- a/apps/governance-e2e/src/integration/view/pubkey-view.cy.ts +++ b/apps/governance-e2e/src/integration/view/pubkey-view.cy.ts @@ -34,12 +34,6 @@ context('View functionality with public key', { tags: '@smoke' }, function () { cy.connectPublicKey(vegaWalletPubKey); }); - it('Able to connect public key using url', function () { - cy.getByTestId('exit-view').click(); - cy.visit(`/?address=${vegaWalletPubKey}`); - verifyConnectedToPubKey(); - }); - it.skip('Able to connect public key via wallet and view assets in wallet', function () { verifyConnectedToPubKey(); cy.getByTestId('currency-title', { timeout: 10000 }) diff --git a/apps/governance/src/app-loader.tsx b/apps/governance/src/app-loader.tsx index ac004f31e..7f4196a96 100644 --- a/apps/governance/src/app-loader.tsx +++ b/apps/governance/src/app-loader.tsx @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/react'; import { toBigNum } from '@vegaprotocol/utils'; import { Splash } from '@vegaprotocol/ui-toolkit'; -import { useVegaWallet, useEagerConnect } from '@vegaprotocol/wallet'; +import { useVegaWallet, useEagerConnect } from '@vegaprotocol/wallet-react'; import { useFeatureFlags, useEnvironment } from '@vegaprotocol/environment'; import { useWeb3React } from '@web3-react/core'; import React, { Suspense } from 'react'; @@ -15,20 +15,6 @@ import { } from './contexts/app-state/app-state-context'; import { useContracts } from './contexts/contracts/contracts-context'; import { useRefreshAssociatedBalances } from './hooks/use-refresh-associated-balances'; -import { useConnectors } from './lib/vega-connectors'; -import { useSearchParams } from 'react-router-dom'; - -const useVegaWalletEagerConnect = () => { - const connectors = useConnectors(); - const vegaConnecting = useEagerConnect(connectors); - const { pubKey, connect } = useVegaWallet(); - const [searchParams] = useSearchParams(); - const [query] = React.useState(searchParams.get('address')); - if (query && !pubKey) { - connect(connectors.view); - } - return vegaConnecting; -}; export const AppLoader = ({ children }: { children: React.ReactElement }) => { const featureFlags = useFeatureFlags((state) => state.flags); @@ -40,7 +26,7 @@ export const AppLoader = ({ children }: { children: React.ReactElement }) => { const { token, staking, vesting } = useContracts(); const setAssociatedBalances = useRefreshAssociatedBalances(); const [balancesLoaded, setBalancesLoaded] = React.useState(false); - const vegaConnecting = useVegaWalletEagerConnect(); + const vegaConnecting = useEagerConnect(); const loaded = balancesLoaded && !vegaConnecting; diff --git a/apps/governance/src/app.tsx b/apps/governance/src/app.tsx index f81db9e1f..bd032dad0 100644 --- a/apps/governance/src/app.tsx +++ b/apps/governance/src/app.tsx @@ -1,7 +1,6 @@ import './i18n'; import React, { useEffect } from 'react'; -import * as Sentry from '@sentry/react'; import { BrowserRouter as Router, useLocation } from 'react-router-dom'; import { AppLoader } from './app-loader'; import { NetworkInfo } from '@vegaprotocol/network-info'; @@ -26,7 +25,7 @@ import { } from '@vegaprotocol/web3'; import { Web3Provider } from '@vegaprotocol/web3'; import { VegaWalletDialogs } from './components/vega-wallet-dialogs'; -import { VegaWalletProvider, useChainId } from '@vegaprotocol/wallet'; +import { WalletProvider } from '@vegaprotocol/wallet-react'; import { useVegaTransactionManager, useVegaTransactionUpdater, @@ -36,26 +35,21 @@ import { useEthereumConfig } from '@vegaprotocol/web3'; import { useEnvironment, NetworkLoader, - useInitializeEnv, NodeGuard, NodeSwitcherDialog, useNodeSwitcherStore, - DocsLinks, NodeFailure, AppLoader as Loader, + useInitializeEnv, } from '@vegaprotocol/environment'; -import { ENV } from './config'; import type { InMemoryCacheConfig } from '@apollo/client'; import { CreateWithdrawalDialog } from '@vegaprotocol/withdraws'; import { SplashLoader } from './components/splash-loader'; import { ToastsManager } from './toasts-manager'; -import { - TelemetryDialog, - TELEMETRY_ON, -} from './components/telemetry-dialog/telemetry-dialog'; -import { useLocalStorage } from '@vegaprotocol/react-helpers'; +import { TelemetryDialog } from './components/telemetry-dialog/telemetry-dialog'; import { useTranslation } from 'react-i18next'; -import { isPartyNotFoundError } from './lib/party'; +import { useSentryInit } from './hooks/use-sentry-init'; +import { useVegaWalletConfig } from './hooks/use-vega-wallet-config'; const cache: InMemoryCacheConfig = { typePolicies: { @@ -104,32 +98,12 @@ const Web3Container = ({ /** Ethereum provider url */ providerUrl: string; }) => { - const InitializeHandlers = () => { - useVegaTransactionManager(); - useVegaTransactionUpdater(); - useEthTransactionManager(); - useEthTransactionUpdater(); - useEthWithdrawApprovalsManager(); - return null; - }; - const [connectors, initializeConnectors] = useWeb3ConnectStore((store) => [ store.connectors, store.initialize, ]); - const { - ETHEREUM_PROVIDER_URL, - ETH_LOCAL_PROVIDER_URL, - ETH_WALLET_MNEMONIC, - VEGA_ENV, - VEGA_URL, - VEGA_EXPLORER_URL, - CHROME_EXTENSION_URL, - MOZILLA_EXTENSION_URL, - VEGA_WALLET_URL, - } = useEnvironment(); - - const vegaChainId = useChainId(VEGA_URL); + const { ETHEREUM_PROVIDER_URL, ETH_LOCAL_PROVIDER_URL, ETH_WALLET_MNEMONIC } = + useEnvironment(); useEffect(() => { if (chainId) { @@ -150,50 +124,31 @@ const Web3Container = ({ ETH_LOCAL_PROVIDER_URL, ETH_WALLET_MNEMONIC, ]); - const sideBar = React.useMemo(() => { - return [, ]; - }, []); - if (connectors.length === 0) { + const vegaWalletConfig = useVegaWalletConfig(); + + if (!vegaWalletConfig || connectors.length === 0) { // Prevent loading when the connectors are not initialized return ; } - if ( - !VEGA_URL || - !VEGA_WALLET_URL || - !VEGA_EXPLORER_URL || - !DocsLinks || - !CHROME_EXTENSION_URL || - !MOZILLA_EXTENSION_URL || - !vegaChainId - ) { - return null; - } - return ( - + <> - + + + + + } + >