diff --git a/.github/workflows/cypress-live-test.yml b/.github/workflows/cypress-live-test.yml deleted file mode 100644 index 4c39a6e28..000000000 --- a/.github/workflows/cypress-live-test.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Cypress Console tests -- live environment - -# This workflow runs using provided url - -on: - workflow_dispatch: - inputs: - url: - description: 'Url' - required: true - type: string - -jobs: - cypress-run: - name: Run Cypress Trading tests -- live environment - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Use Node.js 20 - id: Node - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - - - name: Run Cypress tests - uses: cypress-io/github-action@v4 - with: - browser: chrome - record: true - project: ./apps/trading-e2e - config: baseUrl=${{ github.event.inputs.url }} - env: grepTags=@live - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cypress-manual-trigger.yml b/.github/workflows/cypress-manual-trigger.yml index 090089c15..c1f46c011 100644 --- a/.github/workflows/cypress-manual-trigger.yml +++ b/.github/workflows/cypress-manual-trigger.yml @@ -12,7 +12,6 @@ on: options: - explorer-e2e - governance-e2e - - trading-e2e tags: description: 'Test tags to run' required: true diff --git a/.github/workflows/cypress-nightly.yml b/.github/workflows/cypress-nightly.yml index 16269f1b5..3ddbb0891 100644 --- a/.github/workflows/cypress-nightly.yml +++ b/.github/workflows/cypress-nightly.yml @@ -10,5 +10,5 @@ jobs: uses: ./.github/workflows/cypress-run.yml secrets: inherit with: - projects: '["explorer-e2e","governance-e2e","trading-e2e"]' + projects: '["explorer-e2e","governance-e2e"]' tags: '@smoke @regression @slow' diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml index 325641ca6..7d521f3e9 100644 --- a/.github/workflows/lint-pr.yml +++ b/.github/workflows/lint-pr.yml @@ -25,7 +25,7 @@ jobs: - name: Install dependencies run: | rm package.json - npm install --no-save @commitlint/cli @commitlint/config-conventional @commitlint/config-nx-scopes nx + npm install --no-save @commitlint/cli@16.3.0 @commitlint/config-conventional@18.6.1 @commitlint/config-nx-scopes@18.6.1 nx@17.1.2 - name: Check PR title - run: echo "${{ github.event.pull_request.title }}" | npx commitlint --config ./commitlint.config-ci.js + run: echo "${{ github.event.pull_request.title }}" | npx @commitlint/cli@16.3.0 --config ./commitlint.config-ci.js diff --git a/apps/governance-e2e/src/integration/flow/staking-flow.cy.ts b/apps/governance-e2e/src/integration/flow/staking-flow.cy.ts index 985844e09..07cfb79d6 100644 --- a/apps/governance-e2e/src/integration/flow/staking-flow.cy.ts +++ b/apps/governance-e2e/src/integration/flow/staking-flow.cy.ts @@ -7,6 +7,7 @@ import { navigateTo, navigation, turnTelemetryOff, + setRiskAccepted, } from '../../support/common.functions'; import { clickOnValidatorFromList, @@ -57,6 +58,7 @@ context( // 1002-STKE-002, 1002-STKE-032 before('visit staking tab and connect vega wallet', function () { cy.visit('/'); + setRiskAccepted(); ethereumWalletConnect(); cy.connectVegaWallet(); vegaWalletSetSpecifiedApprovalAmount('1000'); diff --git a/apps/governance-e2e/src/integration/flow/token-association-flow.cy.ts b/apps/governance-e2e/src/integration/flow/token-association-flow.cy.ts index af57804e5..212420c2c 100644 --- a/apps/governance-e2e/src/integration/flow/token-association-flow.cy.ts +++ b/apps/governance-e2e/src/integration/flow/token-association-flow.cy.ts @@ -5,6 +5,7 @@ import { navigateTo, navigation, turnTelemetryOff, + setRiskAccepted, } from '../../support/common.functions'; import { stakingPageAssociateTokens, @@ -57,6 +58,7 @@ context( function () { cy.clearLocalStorage(); turnTelemetryOff(); + setRiskAccepted(); cy.mockChainId(); cy.reload(); waitForSpinner(); diff --git a/apps/governance-e2e/src/integration/view/home.cy.ts b/apps/governance-e2e/src/integration/view/home.cy.ts index 0c77b8162..47ce0e4a6 100644 --- a/apps/governance-e2e/src/integration/view/home.cy.ts +++ b/apps/governance-e2e/src/integration/view/home.cy.ts @@ -82,20 +82,20 @@ context('Home Page - verify elements on page', { tags: '@smoke' }, function () { it('should have information on active nodes', function () { cy.getByTestId('node-information') .first() - .should('contain.text', '1') + .should('contain.text', '2') .and('contain.text', 'active nodes'); }); it('should have information on consensus nodes', function () { cy.getByTestId('node-information') .last() - .should('contain.text', '1') + .should('contain.text', '2') .and('contain.text', 'consensus nodes'); }); it('should contain link to specific validators', function () { cy.getByTestId('validators') - .should('have.length', '1') + .should('have.length', '2') .each(($validator) => { cy.wrap($validator).find('a').should('have.attr', 'href'); }); 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 0ce3c5a23..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,13 +34,7 @@ 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('Able to connect public key via wallet and view assets in wallet', function () { + it.skip('Able to connect public key via wallet and view assets in wallet', function () { verifyConnectedToPubKey(); cy.getByTestId('currency-title', { timeout: 10000 }) .should('have.length.at.least', 2) diff --git a/apps/governance-e2e/src/integration/view/validators.cy.ts b/apps/governance-e2e/src/integration/view/validators.cy.ts index 791bf01d4..149866a8c 100644 --- a/apps/governance-e2e/src/integration/view/validators.cy.ts +++ b/apps/governance-e2e/src/integration/view/validators.cy.ts @@ -3,6 +3,7 @@ import { aliasGQLQuery } from '@vegaprotocol/cypress'; import { navigation, + setRiskAccepted, verifyPageHeader, verifyTabHighlighted, } from '../../support/common.functions'; @@ -187,6 +188,7 @@ context('Validators Page - verify elements on page', function () { before('connect wallets and click on validator', function () { cy.mockChainId(); cy.visit('/validators'); + setRiskAccepted(); cy.connectVegaWallet(); clickOnValidatorFromList(0); }); diff --git a/apps/governance-e2e/src/integration/view/wallet-vega.cy.ts b/apps/governance-e2e/src/integration/view/wallet-vega.cy.ts index 58011cc60..14a7c5d72 100644 --- a/apps/governance-e2e/src/integration/view/wallet-vega.cy.ts +++ b/apps/governance-e2e/src/integration/view/wallet-vega.cy.ts @@ -1,5 +1,8 @@ import { truncateByChars } from '@vegaprotocol/utils'; -import { waitForSpinner } from '../../support/common.functions'; +import { + setRiskAccepted, + waitForSpinner, +} from '../../support/common.functions'; import { vegaWalletFaucetAssetsWithoutCheck, vegaWalletTeardown, @@ -11,7 +14,6 @@ const connectButton = 'connect-vega-wallet'; const getVegaLink = 'link'; const dialog = '[role="dialog"]:visible'; const dialogHeader = 'dialog-title'; -const walletDialogHeader = 'wallet-dialog-title'; const connectorsList = 'connectors-list'; const dialogCloseBtn = 'dialog-close'; const accountNo = 'vega-account-truncated'; @@ -34,6 +36,7 @@ context( () => { before('visit token home page', () => { cy.visit('/'); + setRiskAccepted(); cy.get(walletContainer, { timeout: 60000 }).should('be.visible'); }); @@ -63,17 +66,12 @@ context( it('should have Connect Vega header visible', () => { cy.get(dialog).within(() => { - cy.getByTestId(walletDialogHeader) + cy.getByTestId(connectorsList) .should('be.visible') - .and('have.text', 'Get a Vega wallet'); - }); - }); - - it('should have jsonRpc and hosted connection options visible on list', function () { - cy.getByTestId(connectorsList).within(() => { - cy.getByTestId('connector-jsonRpc') - .should('be.visible') - .and('have.text', 'Use the Desktop App/CLI'); + .and( + 'have.text', + 'Get the Vega WalletGet MetaMask>_Command Line WalletView as public key' + ); }); }); @@ -88,7 +86,6 @@ context( before('connect vega wallet', function () { cy.mockChainId(); cy.visit('/'); - cy.wait('@ChainId'); cy.connectVegaWallet(); vegaWalletTeardown(); }); diff --git a/apps/governance-e2e/src/support/common.functions.ts b/apps/governance-e2e/src/support/common.functions.ts index c440176de..4ac18831e 100644 --- a/apps/governance-e2e/src/support/common.functions.ts +++ b/apps/governance-e2e/src/support/common.functions.ts @@ -102,6 +102,12 @@ export function turnTelemetryOff() { ); } +export function setRiskAccepted() { + cy.window().then((win) => + win.localStorage.setItem('vega_wallet_risk_accepted', 'true') + ); +} + export function dissociateFromSecondWalletKey() { const secondWalletKey = Cypress.env('vegaWalletPublicKey2Short'); cy.getByTestId('vega-in-wallet') diff --git a/apps/governance/.env b/apps/governance/.env index 09bfaeca4..afe7e93db 100644 --- a/apps/governance/.env +++ b/apps/governance/.env @@ -14,7 +14,6 @@ NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/m NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet -NX_DELEGATIONS_PAGINATION=50 NX_TRANCHES_SERVICE_URL=https://tranches-stagnet1-k8s.ops.vega.xyz NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/main/announcements.json NX_WALLETCONNECT_PROJECT_ID=fe8091dc35738863e509fc4947525c72 @@ -24,7 +23,7 @@ NX_TENDERMINT_URL=https://tm.n01.stagnet1.vega.rocks NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n01.stagnet1.vega.xyz/websocket NX_CHROME_EXTENSION_URL=https://chrome.google.com/webstore/detail/vega-wallet-fairground/nmmjkiafpmphlikhefgjbblebfgclikn -NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/firefox/addon/vega-wallet-fairground +NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/en-GB/firefox/addon/vega-wallet-beta/ #Test configuration variables CYPRESS_FAIRGROUND=false diff --git a/apps/governance/.env.capsule b/apps/governance/.env.capsule index 6c710d788..c7ccc4943 100644 --- a/apps/governance/.env.capsule +++ b/apps/governance/.env.capsule @@ -15,12 +15,11 @@ NX_ETH_WALLET_MNEMONIC=ozone access unlock valid olympic save include omit suppl NX_LOCAL_PROVIDER_URL=http://localhost:8545/ NX_VEGA_WALLET_URL=http://localhost:1789 NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet -NX_DELEGATIONS_PAGINATION=50 NX_TRANCHES_SERVICE_URL=https://tranches-stagnet1-k8s.ops.vega.xyz NX_VEGA_REST_URL=http://localhost:3008/api/v2/ NX_CHROME_EXTENSION_URL=https://chrome.google.com/webstore/detail/vega-wallet-fairground/nmmjkiafpmphlikhefgjbblebfgclikn -NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/firefox/addon/vega-wallet-fairground +NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/en-GB/firefox/addon/vega-wallet-beta/ NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json diff --git a/apps/governance/.env.devnet b/apps/governance/.env.devnet index 5616a4821..74cd91b22 100644 --- a/apps/governance/.env.devnet +++ b/apps/governance/.env.devnet @@ -8,14 +8,13 @@ NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_VEGA_EXPLORER_URL=# NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet -NX_DELEGATIONS_PAGINATION=50 NX_TRANCHES_SERVICE_URL=https://tranches-devnet1-k8s.ops.vega.xyz NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json NX_VEGA_REST_URL=https://api.n00.devnet1.vega.xyz/api/v2/ NX_SENTRY_DSN=https://4b8c8a8ba07742648aa4dfe1b8d17e40@o286262.ingest.sentry.io/5882996 NX_CHROME_EXTENSION_URL=https://chrome.google.com/webstore/detail/vega-wallet-fairground/nmmjkiafpmphlikhefgjbblebfgclikn -NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/firefox/addon/vega-wallet-fairground +NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/en-GB/firefox/addon/vega-wallet-beta/ NX_TENDERMINT_URL=https://tm.be.devnet1.vega.xyz/ NX_TENDERMINT_WEBSOCKET_URL=wss://be.devnet1.vega.xyz/websocket diff --git a/apps/governance/.env.mainnet b/apps/governance/.env.mainnet index d3f5097a5..b4eaaa689 100644 --- a/apps/governance/.env.mainnet +++ b/apps/governance/.env.mainnet @@ -10,7 +10,6 @@ NX_SENTRY_DSN=https://4b8c8a8ba07742648aa4dfe1b8d17e40@o286262.ingest.sentry.io/ NX_VEGA_EXPLORER_URL=https://explorer.vega.xyz NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet NX_SENTRY_DSN=https://4b8c8a8ba07742648aa4dfe1b8d17e40:87edc2605e544f888305d7fc4a9141bd@o286262.ingest.sentry.io/5882996 -NX_DELEGATIONS_PAGINATION=50 NX_TRANCHES_SERVICE_URL=https://tranches-mainnet-k8s.ops.vega.xyz NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/mainnet/announcements.json NX_VEGA_REST_URL=https://api.vega.community/api/v2/ diff --git a/apps/governance/.env.mainnet-mirror b/apps/governance/.env.mainnet-mirror index 79d512d79..c0cf3b9a8 100644 --- a/apps/governance/.env.mainnet-mirror +++ b/apps/governance/.env.mainnet-mirror @@ -9,7 +9,6 @@ NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_SENTRY_DSN=https://4b8c8a8ba07742648aa4dfe1b8d17e40@o286262.ingest.sentry.io/5882996 NX_VEGA_EXPLORER_URL=https://explorer.mainnet-mirror.vega.rocks NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet -NX_DELEGATIONS_PAGINATION=50 NX_TRANCHES_SERVICE_URL=https://tranches-mainnet-mirror-k8s.ops.vega.xyz NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/mainnet/announcements.json NX_VEGA_REST_URL=https://api.mainnet-mirror.vega.rocks/api/v2/ diff --git a/apps/governance/.env.stagnet1 b/apps/governance/.env.stagnet1 index b91995447..665c88aba 100644 --- a/apps/governance/.env.stagnet1 +++ b/apps/governance/.env.stagnet1 @@ -5,7 +5,6 @@ NX_VEGA_NETWORKS='{"DEVNET":"https://dev.governance.vega.xyz","STAGNET1":"https: NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml NX_VEGA_EXPLORER_URL=https://explorer.stagnet1.vega.rocks NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet -NX_DELEGATIONS_PAGINATION=50 NX_TRANCHES_SERVICE_URL=https://tranches-stagnet1-k8s.ops.vega.xyz NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json NX_VEGA_REST_URL=https://api.n00.stagnet1.vega.xyz/api/v2/ @@ -13,7 +12,7 @@ NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/m NX_WALLETCONNECT_PROJECT_ID=fe8091dc35738863e509fc4947525c72 NX_CHROME_EXTENSION_URL=https://chrome.google.com/webstore/detail/vega-wallet-fairground/nmmjkiafpmphlikhefgjbblebfgclikn -NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/firefox/addon/vega-wallet-fairground +NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/en-GB/firefox/addon/vega-wallet-beta/ NX_TENDERMINT_URL=https://tm.n01.stagnet1.vega.rocks NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n01.stagnet1.vega.xyz/websocket diff --git a/apps/governance/.env.testnet b/apps/governance/.env.testnet index 305473b45..677037f8e 100644 --- a/apps/governance/.env.testnet +++ b/apps/governance/.env.testnet @@ -9,7 +9,6 @@ NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz -NX_DELEGATIONS_PAGINATION=50 NX_TRANCHES_SERVICE_URL=https://tranches-testnet-k8s.ops.vega.xyz NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json NX_VEGA_REST_URL=https://api.n07.testnet.vega.xyz/api/v2/ @@ -18,7 +17,7 @@ NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/m NX_WALLETCONNECT_PROJECT_ID=fe8091dc35738863e509fc4947525c72 NX_CHROME_EXTENSION_URL=https://chrome.google.com/webstore/detail/vega-wallet-fairground/nmmjkiafpmphlikhefgjbblebfgclikn -NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/firefox/addon/vega-wallet-fairground +NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/en-GB/firefox/addon/vega-wallet-beta/ NX_TENDERMINT_URL=https://tm.be.testnet.vega.xyz NX_TENDERMINT_WEBSOCKET_URL=wss://be.testnet.vega.xyz/websocket diff --git a/apps/governance/.env.validators-testnet b/apps/governance/.env.validators-testnet index a8f52c608..4cabe332e 100644 --- a/apps/governance/.env.validators-testnet +++ b/apps/governance/.env.validators-testnet @@ -14,7 +14,7 @@ NX_SENTRY_DSN=https://4b8c8a8ba07742648aa4dfe1b8d17e40@o286262.ingest.sentry.io/ NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json NX_CHROME_EXTENSION_URL=https://chrome.google.com/webstore/detail/vega-wallet-fairground/nmmjkiafpmphlikhefgjbblebfgclikn -NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/firefox/addon/vega-wallet-fairground +NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/en-GB/firefox/addon/vega-wallet-beta/ NX_TENDERMINT_URL=https://tm.be.validators-testnet.vega.rocks NX_TENDERMINT_WEBSOCKET_URL=wss://be.validators-testnet.vega. 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 ( - + <> - + + + + + } + >