Feat/6 Network Switcher (#502)
* feat: add network-switcher lib * feat: add env variables for some deployed app urls * feat: add network processing to environment hoook * refactor: network handling * refactor: remove dialog from provider and add env setter * feat: add network switcher dialog to the trading app * refactor: add network redirect to dialog connect callback * fix: lint * fix: jsonify env variable for possible networks * fix: add formatter file * fix: assign correct global state to network swicther * feat: add network-switcher lib * feat: add env variables for some deployed app urls * feat: add network processing to environment hoook * refactor: network handling * refactor: remove dialog from provider and add env setter * feat: add network switcher dialog to the trading app * refactor: add network redirect to dialog connect callback * fix: lint * fix: jsonify env variable for possible networks * fix: add formatter file * fix: assign correct global state to network swicther * fix: failing tests from UI changes * fix: lint * fix: lint Co-authored-by: Joe <joe@vega.xyz> Co-authored-by: Dexter <dexter.edwards93@gmail.com>
This commit is contained in:
parent
f6f62cbc6a
commit
ecda46caa5
@ -24,6 +24,7 @@ NX_TENDERMINT_WEBSOCKET_URL = "wss://lb.testnet.vega.xyz/tm/websocket"
|
|||||||
NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"
|
NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"
|
||||||
NX_VEGA_ENV = 'TESTNET'
|
NX_VEGA_ENV = 'TESTNET'
|
||||||
NX_VEGA_REST = 'https://lb.testnet.vega.xyz/datanode/rest'
|
NX_VEGA_REST = 'https://lb.testnet.vega.xyz/datanode/rest'
|
||||||
|
NX_VEGA_NETWORKS = '{\"TESTNET\":\"https://explorer.fairground.wtf\",\"MAINNET\":\"https://explorer.vega.xyz\"}'
|
||||||
CYPRESS_VEGA_TENDERMINT_URL='https://lb.testnet.vega.xyz/tm'
|
CYPRESS_VEGA_TENDERMINT_URL='https://lb.testnet.vega.xyz/tm'
|
||||||
|
|
||||||
# App flags
|
# App flags
|
||||||
|
@ -3,6 +3,7 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
|
|||||||
NX_TENDERMINT_URL = "http://localhost:26617"
|
NX_TENDERMINT_URL = "http://localhost:26617"
|
||||||
NX_TENDERMINT_WEBSOCKET_URL = "wss://localhost:26617/websocket"
|
NX_TENDERMINT_WEBSOCKET_URL = "wss://localhost:26617/websocket"
|
||||||
NX_VEGA_URL = "http://localhost:3028/query"
|
NX_VEGA_URL = "http://localhost:3028/query"
|
||||||
|
NX_VEGA_NETWORKS = '{\"TESTNET\":\"https://explorer.fairground.wtf\",\"MAINNET\":\"https://explorer.vega.xyz\"}'
|
||||||
NX_VEGA_ENV = 'LOCAL'
|
NX_VEGA_ENV = 'LOCAL'
|
||||||
NX_VEGA_REST = 'http://localhost:3029'
|
NX_VEGA_REST = 'http://localhost:3029'
|
||||||
|
|
||||||
|
@ -3,5 +3,6 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
|
|||||||
NX_TENDERMINT_URL = "https://n04.d.vega.xyz/tm"
|
NX_TENDERMINT_URL = "https://n04.d.vega.xyz/tm"
|
||||||
NX_TENDERMINT_WEBSOCKET_URL = "wss://n04.d.vega.xyz/tm/websocket"
|
NX_TENDERMINT_WEBSOCKET_URL = "wss://n04.d.vega.xyz/tm/websocket"
|
||||||
NX_VEGA_URL = "https://n04.d.vega.xyz/query"
|
NX_VEGA_URL = "https://n04.d.vega.xyz/query"
|
||||||
|
NX_VEGA_NETWORKS = '{\"TESTNET\":\"https://explorer.fairground.wtf\",\"MAINNET\":\"https://explorer.vega.xyz\"}'
|
||||||
NX_VEGA_ENV = 'DEVNET'
|
NX_VEGA_ENV = 'DEVNET'
|
||||||
NX_VEGA_REST = 'https://n04.d.vega.xyz/datanode/rest'
|
NX_VEGA_REST = 'https://n04.d.vega.xyz/datanode/rest'
|
||||||
|
@ -3,5 +3,6 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
|
|||||||
NX_TENDERMINT_URL = "https://mainnet-observer-proxy01.ops.vega.xyz/"
|
NX_TENDERMINT_URL = "https://mainnet-observer-proxy01.ops.vega.xyz/"
|
||||||
NX_TENDERMINT_WEBSOCKET_URL = "wss://mainnet-observer-proxy01.ops.vega.xyz/websocket"
|
NX_TENDERMINT_WEBSOCKET_URL = "wss://mainnet-observer-proxy01.ops.vega.xyz/websocket"
|
||||||
NX_VEGA_URL = "https://api.token.vega.xyz/query"
|
NX_VEGA_URL = "https://api.token.vega.xyz/query"
|
||||||
|
NX_VEGA_NETWORKS = '{\"TESTNET\":\"https://explorer.fairground.wtf\",\"MAINNET\":\"https://explorer.vega.xyz\"}'
|
||||||
NX_VEGA_ENV = 'MAINNET'
|
NX_VEGA_ENV = 'MAINNET'
|
||||||
NX_VEGA_REST = 'https://api.token.vega.xyz/'
|
NX_VEGA_REST = 'https://api.token.vega.xyz/'
|
||||||
|
@ -3,5 +3,6 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
|
|||||||
NX_TENDERMINT_URL = "https://n03.s.vega.xyz/tm"
|
NX_TENDERMINT_URL = "https://n03.s.vega.xyz/tm"
|
||||||
NX_TENDERMINT_WEBSOCKET_URL = "wss://n03.s.vega.xyz/tm/websocket"
|
NX_TENDERMINT_WEBSOCKET_URL = "wss://n03.s.vega.xyz/tm/websocket"
|
||||||
NX_VEGA_URL = "https://n03.s.vega.xyz/query"
|
NX_VEGA_URL = "https://n03.s.vega.xyz/query"
|
||||||
|
NX_VEGA_NETWORKS = '{\"TESTNET\":\"https://explorer.fairground.wtf\",\"MAINNET\":\"https://explorer.vega.xyz\"}'
|
||||||
NX_VEGA_ENV = 'STAGNET'
|
NX_VEGA_ENV = 'STAGNET'
|
||||||
NX_VEGA_REST = 'https://n03.s.vega.xyz/datanode/rest'
|
NX_VEGA_REST = 'https://n03.s.vega.xyz/datanode/rest'
|
||||||
|
@ -3,5 +3,6 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
|
|||||||
NX_TENDERMINT_URL = "https://n03.stagnet2.vega.xyz/tm"
|
NX_TENDERMINT_URL = "https://n03.stagnet2.vega.xyz/tm"
|
||||||
NX_TENDERMINT_WEBSOCKET_URL = "wss://n03.stagnet2.vega.xyz/tm/websocket"
|
NX_TENDERMINT_WEBSOCKET_URL = "wss://n03.stagnet2.vega.xyz/tm/websocket"
|
||||||
NX_VEGA_URL = "https://n03.stagnet2.vega.xyz/query"
|
NX_VEGA_URL = "https://n03.stagnet2.vega.xyz/query"
|
||||||
|
NX_VEGA_NETWORKS = '{\"TESTNET\":\"https://explorer.fairground.wtf\",\"MAINNET\":\"https://explorer.vega.xyz\"}'
|
||||||
NX_VEGA_ENV = 'STAGNET2'
|
NX_VEGA_ENV = 'STAGNET2'
|
||||||
NX_VEGA_REST = 'https://n01.stagnet2.vega.xyz/datanode/rest'
|
NX_VEGA_REST = 'https://n01.stagnet2.vega.xyz/datanode/rest'
|
||||||
|
@ -3,5 +3,6 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
|
|||||||
NX_TENDERMINT_URL = "https://lb.testnet.vega.xyz/tm"
|
NX_TENDERMINT_URL = "https://lb.testnet.vega.xyz/tm"
|
||||||
NX_TENDERMINT_WEBSOCKET_URL = "wss://lb.testnet.vega.xyz/tm/websocket"
|
NX_TENDERMINT_WEBSOCKET_URL = "wss://lb.testnet.vega.xyz/tm/websocket"
|
||||||
NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"
|
NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"
|
||||||
|
NX_VEGA_NETWORKS = '{\"TESTNET\":\"https://explorer.fairground.wtf\",\"MAINNET\":\"https://explorer.vega.xyz\"}'
|
||||||
NX_VEGA_ENV = 'TESTNET'
|
NX_VEGA_ENV = 'TESTNET'
|
||||||
NX_VEGA_REST = 'https://lb.testnet.vega.xyz/datanode/rest'
|
NX_VEGA_REST = 'https://lb.testnet.vega.xyz/datanode/rest'
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
import { useState, useEffect, useMemo } from 'react';
|
import { useState, useEffect, useMemo } from 'react';
|
||||||
import { useLocation } from 'react-router-dom';
|
import { useLocation } from 'react-router-dom';
|
||||||
import { ApolloProvider } from '@apollo/client';
|
import { ApolloProvider } from '@apollo/client';
|
||||||
import { ThemeContext } from '@vegaprotocol/react-helpers';
|
import { ThemeContext, useThemeSwitcher } from '@vegaprotocol/react-helpers';
|
||||||
import {
|
import { EnvironmentProvider } from '@vegaprotocol/network-switcher';
|
||||||
useThemeSwitcher,
|
|
||||||
EnvironmentProvider,
|
|
||||||
} from '@vegaprotocol/react-helpers';
|
|
||||||
import { createClient } from './lib/apollo-client';
|
import { createClient } from './lib/apollo-client';
|
||||||
import { Nav } from './components/nav';
|
import { Nav } from './components/nav';
|
||||||
import { Header } from './components/header';
|
import { Header } from './components/header';
|
||||||
|
@ -9,7 +9,7 @@ import {
|
|||||||
VegaManageDialog,
|
VegaManageDialog,
|
||||||
VegaWalletProvider,
|
VegaWalletProvider,
|
||||||
} from '@vegaprotocol/wallet';
|
} from '@vegaprotocol/wallet';
|
||||||
import { EnvironmentProvider } from '@vegaprotocol/react-helpers';
|
import { EnvironmentProvider } from '@vegaprotocol/network-switcher';
|
||||||
import { VegaWalletConnectButton } from './components/vega-wallet-connect-button';
|
import { VegaWalletConnectButton } from './components/vega-wallet-connect-button';
|
||||||
import { ThemeSwitcher } from '@vegaprotocol/ui-toolkit';
|
import { ThemeSwitcher } from '@vegaprotocol/ui-toolkit';
|
||||||
import { Connectors } from './lib/vega-connectors';
|
import { Connectors } from './lib/vega-connectors';
|
||||||
|
@ -3,7 +3,7 @@ import { DATA_SOURCES } from './config';
|
|||||||
import { Header } from './components/header';
|
import { Header } from './components/header';
|
||||||
import { StatsManager } from '@vegaprotocol/network-stats';
|
import { StatsManager } from '@vegaprotocol/network-stats';
|
||||||
import { ThemeContext } from '@vegaprotocol/react-helpers';
|
import { ThemeContext } from '@vegaprotocol/react-helpers';
|
||||||
import { EnvironmentProvider } from '@vegaprotocol/react-helpers';
|
import { EnvironmentProvider } from '@vegaprotocol/network-switcher';
|
||||||
import { useThemeSwitcher } from '@vegaprotocol/react-helpers';
|
import { useThemeSwitcher } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
const envName = DATA_SOURCES.envName;
|
const envName = DATA_SOURCES.envName;
|
||||||
|
@ -25,6 +25,7 @@ NX_ETHEREUM_CHAIN_ID = 3
|
|||||||
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
||||||
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
||||||
NX_FAIRGROUND = false
|
NX_FAIRGROUND = false
|
||||||
|
NX_VEGA_NETWORKS='{\"DEVNET\":\"https://dev.token.vega.xyz\",\"STAGNET\":\"https://dev.token.vega.xyz\",\"STAGNET2\":\"staging2.token.vega.xyz\",\"TESTNET\":\"token.fairground.wtf\",\"MAINNET\":\"token.vega.xyz\"}'
|
||||||
|
|
||||||
#Test configuration variables
|
#Test configuration variables
|
||||||
CYPRESS_FAIRGROUND = false
|
CYPRESS_FAIRGROUND = false
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_VEGA_ENV = "DEVNET"
|
NX_VEGA_ENV = "DEVNET"
|
||||||
NX_VEGA_URL = "https://n04.d.vega.xyz/query"
|
NX_VEGA_URL = "https://n04.d.vega.xyz/query"
|
||||||
|
NX_VEGA_NETWORKS='{\"DEVNET\":\"https://dev.token.vega.xyz\",\"STAGNET\":\"https://dev.token.vega.xyz\",\"STAGNET2\":\"staging2.token.vega.xyz\",\"TESTNET\":\"token.fairground.wtf\",\"MAINNET\":\"token.vega.xyz\"}'
|
||||||
NX_ETHEREUM_CHAIN_ID = 3
|
NX_ETHEREUM_CHAIN_ID = 3
|
||||||
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
||||||
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_VEGA_ENV = "MAINNET"
|
NX_VEGA_ENV = "MAINNET"
|
||||||
NX_VEGA_URL = "https://api.token.vega.xyz/query"
|
NX_VEGA_URL = "https://api.token.vega.xyz/query"
|
||||||
|
NX_VEGA_NETWORKS='{\"DEVNET\":\"https://dev.token.vega.xyz\",\"STAGNET\":\"https://dev.token.vega.xyz\",\"STAGNET2\":\"staging2.token.vega.xyz\",\"TESTNET\":\"token.fairground.wtf\",\"MAINNET\":\"token.vega.xyz\"}'
|
||||||
NX_ETHEREUM_CHAIN_ID = 1
|
NX_ETHEREUM_CHAIN_ID = 1
|
||||||
NX_ETHEREUM_PROVIDER_URL = "https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
NX_ETHEREUM_PROVIDER_URL = "https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
||||||
NX_ETHERSCAN_URL = "https://etherscan.io"
|
NX_ETHERSCAN_URL = "https://etherscan.io"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_VEGA_ENV = "STAGNET"
|
NX_VEGA_ENV = "STAGNET"
|
||||||
NX_VEGA_URL = "https://n03.s.vega.xyz/query"
|
NX_VEGA_URL = "https://n03.s.vega.xyz/query"
|
||||||
|
NX_VEGA_NETWORKS='{\"DEVNET\":\"https://dev.token.vega.xyz\",\"STAGNET\":\"https://dev.token.vega.xyz\",\"STAGNET2\":\"staging2.token.vega.xyz\",\"TESTNET\":\"token.fairground.wtf\",\"MAINNET\":\"token.vega.xyz\"}'
|
||||||
NX_ETHEREUM_CHAIN_ID = 3
|
NX_ETHEREUM_CHAIN_ID = 3
|
||||||
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
||||||
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_VEGA_ENV = "STAGNET2"
|
NX_VEGA_ENV = "STAGNET2"
|
||||||
NX_VEGA_URL = "https://n03.stagnet2.vega.xyz/query"
|
NX_VEGA_URL = "https://n03.stagnet2.vega.xyz/query"
|
||||||
|
NX_VEGA_NETWORKS='{\"DEVNET\":\"https://dev.token.vega.xyz\",\"STAGNET\":\"https://dev.token.vega.xyz\",\"STAGNET2\":\"staging2.token.vega.xyz\",\"TESTNET\":\"token.fairground.wtf\",\"MAINNET\":\"token.vega.xyz\"}'
|
||||||
NX_ETHEREUM_CHAIN_ID = 3
|
NX_ETHEREUM_CHAIN_ID = 3
|
||||||
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
||||||
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_VEGA_ENV = "TESTNET"
|
NX_VEGA_ENV = "TESTNET"
|
||||||
NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"
|
NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"
|
||||||
|
NX_VEGA_NETWORKS='{\"DEVNET\":\"https://dev.token.vega.xyz\",\"STAGNET\":\"https://dev.token.vega.xyz\",\"STAGNET2\":\"staging2.token.vega.xyz\",\"TESTNET\":\"token.fairground.wtf\",\"MAINNET\":\"token.vega.xyz\"}'
|
||||||
NX_ETHEREUM_CHAIN_ID = 3
|
NX_ETHEREUM_CHAIN_ID = 3
|
||||||
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
||||||
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
||||||
|
@ -18,7 +18,7 @@ import { Web3Provider } from '@vegaprotocol/web3';
|
|||||||
import { Connectors } from './lib/web3-connectors';
|
import { Connectors } from './lib/web3-connectors';
|
||||||
import { VegaWalletDialogs } from './components/vega-wallet-dialogs';
|
import { VegaWalletDialogs } from './components/vega-wallet-dialogs';
|
||||||
import { VegaWalletProvider } from '@vegaprotocol/wallet';
|
import { VegaWalletProvider } from '@vegaprotocol/wallet';
|
||||||
import { EnvironmentProvider } from '@vegaprotocol/react-helpers';
|
import { EnvironmentProvider } from '@vegaprotocol/network-switcher';
|
||||||
import { client } from './lib/apollo-client';
|
import { client } from './lib/apollo-client';
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
import { useAddAssetSupported } from '../../hooks/use-add-asset-to-wallet';
|
import { useAddAssetSupported } from '../../hooks/use-add-asset-to-wallet';
|
||||||
import vegaVesting from '../../images/vega_vesting.png';
|
import vegaVesting from '../../images/vega_vesting.png';
|
||||||
import { AddTokenButtonLink } from '../add-token-button/add-token-button';
|
import { AddTokenButtonLink } from '../add-token-button/add-token-button';
|
||||||
import { Callout } from '@vegaprotocol/ui-toolkit';
|
import { Callout } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
|
||||||
|
|
||||||
export const AddLockedTokenAddress = () => {
|
export const AddLockedTokenAddress = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
@ -3,6 +3,7 @@ import { toBigNum } from '@vegaprotocol/react-helpers';
|
|||||||
import { useEthereumConfig } from '@vegaprotocol/web3';
|
import { useEthereumConfig } from '@vegaprotocol/web3';
|
||||||
import { useWeb3React } from '@web3-react/core';
|
import { useWeb3React } from '@web3-react/core';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AppStateActionType,
|
AppStateActionType,
|
||||||
useAppState,
|
useAppState,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Callout, Intent } from '@vegaprotocol/ui-toolkit';
|
import { Callout, Intent } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Link } from '@vegaprotocol/ui-toolkit';
|
import { Link } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
import type { ReactElement } from 'react';
|
import type { ReactElement } from 'react';
|
||||||
|
|
||||||
export const TransactionComplete = ({
|
export const TransactionComplete = ({
|
||||||
|
@ -2,7 +2,7 @@ import { Button, Callout, Intent } from '@vegaprotocol/ui-toolkit';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { Link } from '@vegaprotocol/ui-toolkit';
|
import { Link } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
|
|
||||||
export interface TransactionErrorProps {
|
export interface TransactionErrorProps {
|
||||||
error: Error | null;
|
error: Error | null;
|
||||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import { Callout, Loader } from '@vegaprotocol/ui-toolkit';
|
import { Callout, Loader } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Link } from '@vegaprotocol/ui-toolkit';
|
import { Link } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
|
|
||||||
export const TransactionPending = ({
|
export const TransactionPending = ({
|
||||||
hash,
|
hash,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Dialog, Link } from '@vegaprotocol/ui-toolkit';
|
import { Dialog, Link } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ import type {
|
|||||||
DelegationsVariables,
|
DelegationsVariables,
|
||||||
} from './__generated__/Delegations';
|
} from './__generated__/Delegations';
|
||||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
|
|
||||||
const DELEGATIONS_QUERY = gql`
|
const DELEGATIONS_QUERY = gql`
|
||||||
query Delegations($partyId: ID!) {
|
query Delegations($partyId: ID!) {
|
||||||
|
@ -14,7 +14,7 @@ import type { ContractsContextShape } from './contracts-context';
|
|||||||
import { ContractsContext } from './contracts-context';
|
import { ContractsContext } from './contracts-context';
|
||||||
import { defaultProvider } from '../../lib/web3-connectors';
|
import { defaultProvider } from '../../lib/web3-connectors';
|
||||||
import { useEthereumConfig } from '@vegaprotocol/web3';
|
import { useEthereumConfig } from '@vegaprotocol/web3';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides Vega Ethereum contract instances to its children.
|
* Provides Vega Ethereum contract instances to its children.
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import * as Sentry from '@sentry/react';
|
import * as Sentry from '@sentry/react';
|
||||||
import { Networks, useEnvironment } from '@vegaprotocol/react-helpers';
|
import { Networks } from '@vegaprotocol/react-helpers';
|
||||||
import { useWeb3React } from '@web3-react/core';
|
import { useWeb3React } from '@web3-react/core';
|
||||||
import { MetaMask } from '@web3-react/metamask';
|
import { MetaMask } from '@web3-react/metamask';
|
||||||
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
|
|
||||||
export const useAddAssetSupported = () => {
|
export const useAddAssetSupported = () => {
|
||||||
const { connector } = useWeb3React();
|
const { connector } = useWeb3React();
|
||||||
|
@ -2,7 +2,7 @@ import type { Networks } from '@vegaprotocol/react-helpers';
|
|||||||
import { useFetch } from '@vegaprotocol/react-helpers';
|
import { useFetch } from '@vegaprotocol/react-helpers';
|
||||||
import type { Tranche } from '@vegaprotocol/smart-contracts';
|
import type { Tranche } from '@vegaprotocol/smart-contracts';
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
|
|
||||||
import { BigNumber } from '../lib/bignumber';
|
import { BigNumber } from '../lib/bignumber';
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Callout, Intent, Link, Button } from '@vegaprotocol/ui-toolkit';
|
import { Callout, Intent, Link, Button } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
import { Trans, useTranslation } from 'react-i18next';
|
import { Trans, useTranslation } from 'react-i18next';
|
||||||
import { Link as RouteLink } from 'react-router-dom';
|
import { Link as RouteLink } from 'react-router-dom';
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { t, useEnvironment } from '@vegaprotocol/react-helpers';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { Link, Splash } from '@vegaprotocol/ui-toolkit';
|
import { Link, Splash } from '@vegaprotocol/ui-toolkit';
|
||||||
import type { EthereumConfig } from '@vegaprotocol/web3';
|
import type { EthereumConfig } from '@vegaprotocol/web3';
|
||||||
import { useEthereumConfig } from '@vegaprotocol/web3';
|
import { useEthereumConfig } from '@vegaprotocol/web3';
|
||||||
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
import { Heading } from '../../components/heading';
|
import { Heading } from '../../components/heading';
|
||||||
import { SplashLoader } from '../../components/splash-loader';
|
import { SplashLoader } from '../../components/splash-loader';
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ const Contracts = () => {
|
|||||||
title={t('View address on Etherscan')}
|
title={t('View address on Etherscan')}
|
||||||
href={`${ETHERSCAN_URL}/address/${value}`}
|
href={`${ETHERSCAN_URL}/address/${value}`}
|
||||||
>
|
>
|
||||||
|
asdfasd
|
||||||
{value}
|
{value}
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { Callout, Link, Intent, Splash } from '@vegaprotocol/ui-toolkit';
|
import { Callout, Link, Intent, Splash } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit';
|
import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useTranches } from '../../../hooks/use-tranches';
|
import { useTranches } from '../../../hooks/use-tranches';
|
||||||
import type { BigNumber } from '../../../lib/bignumber';
|
import type { BigNumber } from '../../../lib/bignumber';
|
||||||
|
@ -3,7 +3,7 @@ import { Trans, useTranslation } from 'react-i18next';
|
|||||||
import { Link, useParams, useOutletContext } from 'react-router-dom';
|
import { Link, useParams, useOutletContext } from 'react-router-dom';
|
||||||
|
|
||||||
import { TransactionCallout } from '../../../components/transaction-callout';
|
import { TransactionCallout } from '../../../components/transaction-callout';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
import { useAppState } from '../../../contexts/app-state/app-state-context';
|
import { useAppState } from '../../../contexts/app-state/app-state-context';
|
||||||
import { useContracts } from '../../../contexts/contracts/contracts-context';
|
import { useContracts } from '../../../contexts/contracts/contracts-context';
|
||||||
import {
|
import {
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
Intent,
|
Intent,
|
||||||
Loader,
|
Loader,
|
||||||
} from '@vegaprotocol/ui-toolkit';
|
} from '@vegaprotocol/ui-toolkit';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Link as RouteLink } from 'react-router-dom';
|
import { Link as RouteLink } from 'react-router-dom';
|
||||||
|
@ -5,7 +5,7 @@ import { Link as RouteLink } from 'react-router-dom';
|
|||||||
|
|
||||||
import { BulletHeader } from '../../components/bullet-header';
|
import { BulletHeader } from '../../components/bullet-header';
|
||||||
import { Link } from '@vegaprotocol/ui-toolkit';
|
import { Link } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
import { Links } from '../../config';
|
import { Links } from '../../config';
|
||||||
import {
|
import {
|
||||||
AppStateActionType,
|
AppStateActionType,
|
||||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { Link } from '@vegaprotocol/ui-toolkit';
|
import { Link } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit';
|
import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit';
|
||||||
import { BigNumber } from '../../lib/bignumber';
|
import { BigNumber } from '../../lib/bignumber';
|
||||||
import { formatNumber } from '../../lib/format-number';
|
import { formatNumber } from '../../lib/format-number';
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
|
||||||
import type { Tranche as ITranche } from '@vegaprotocol/smart-contracts';
|
import type { Tranche as ITranche } from '@vegaprotocol/smart-contracts';
|
||||||
import { Link } from '@vegaprotocol/ui-toolkit';
|
import { Link } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useWeb3React } from '@web3-react/core';
|
import { useWeb3React } from '@web3-react/core';
|
||||||
@ -8,6 +7,7 @@ import { useParams } from 'react-router';
|
|||||||
import { Navigate } from 'react-router-dom';
|
import { Navigate } from 'react-router-dom';
|
||||||
|
|
||||||
import { useOutletContext } from 'react-router-dom';
|
import { useOutletContext } from 'react-router-dom';
|
||||||
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
import { BigNumber } from '../../lib/bignumber';
|
import { BigNumber } from '../../lib/bignumber';
|
||||||
import { formatNumber } from '../../lib/format-number';
|
import { formatNumber } from '../../lib/format-number';
|
||||||
import { TrancheItem } from '../redemption/tranche-item';
|
import { TrancheItem } from '../redemption/tranche-item';
|
||||||
|
@ -5,7 +5,7 @@ import React from 'react';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { Link } from '@vegaprotocol/ui-toolkit';
|
import { Link } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
import { Heading } from '../../components/heading';
|
import { Heading } from '../../components/heading';
|
||||||
import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit';
|
import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit';
|
||||||
import { SplashLoader } from '../../components/splash-loader';
|
import { SplashLoader } from '../../components/splash-loader';
|
||||||
|
@ -7,6 +7,7 @@ export default class VegaWallet {
|
|||||||
walletInputError = 'input-wallet-error';
|
walletInputError = 'input-wallet-error';
|
||||||
walletFormError = 'form-error';
|
walletFormError = 'form-error';
|
||||||
inputError = 'input-error-text';
|
inputError = 'input-error-text';
|
||||||
|
connectNetworkBtn = 'connect-network';
|
||||||
|
|
||||||
openVegaWalletConnectDialog() {
|
openVegaWalletConnectDialog() {
|
||||||
this.clickOnWalletConnectDialog();
|
this.clickOnWalletConnectDialog();
|
||||||
|
@ -24,3 +24,4 @@ NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"
|
|||||||
NX_ETHEREUM_CHAIN_ID = 3
|
NX_ETHEREUM_CHAIN_ID = 3
|
||||||
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
||||||
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
||||||
|
NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_VEGA_ENV = "DEVNET"
|
NX_VEGA_ENV = "DEVNET"
|
||||||
NX_VEGA_URL = "https://n04.d.vega.xyz/query"
|
NX_VEGA_URL = "https://n04.d.vega.xyz/query"
|
||||||
|
NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
|
||||||
NX_ETHEREUM_CHAIN_ID = 3
|
NX_ETHEREUM_CHAIN_ID = 3
|
||||||
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
||||||
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_VEGA_ENV = "MAINNET"
|
NX_VEGA_ENV = "MAINNET"
|
||||||
NX_VEGA_URL = "https://api.token.vega.xyz/query"
|
NX_VEGA_URL = "https://api.token.vega.xyz/query"
|
||||||
|
NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
|
||||||
NX_ETHEREUM_CHAIN_ID = 1
|
NX_ETHEREUM_CHAIN_ID = 1
|
||||||
NX_ETHEREUM_PROVIDER_URL = "https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
NX_ETHEREUM_PROVIDER_URL = "https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
||||||
NX_ETHERSCAN_URL = "https://etherscan.io"
|
NX_ETHERSCAN_URL = "https://etherscan.io"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_VEGA_ENV = "STAGNET"
|
NX_VEGA_ENV = "STAGNET"
|
||||||
NX_VEGA_URL = "https://n03.s.vega.xyz/query"
|
NX_VEGA_URL = "https://n03.s.vega.xyz/query"
|
||||||
|
NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
|
||||||
NX_ETHEREUM_CHAIN_ID = 3
|
NX_ETHEREUM_CHAIN_ID = 3
|
||||||
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
||||||
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_VEGA_ENV = "STAGNET2"
|
NX_VEGA_ENV = "STAGNET2"
|
||||||
NX_VEGA_URL = "https://n03.stagnet2.vega.xyz/query"
|
NX_VEGA_URL = "https://n03.stagnet2.vega.xyz/query"
|
||||||
|
NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
|
||||||
NX_ETHEREUM_CHAIN_ID = 3
|
NX_ETHEREUM_CHAIN_ID = 3
|
||||||
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
||||||
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_VEGA_ENV = "TESTNET"
|
NX_VEGA_ENV = "TESTNET"
|
||||||
NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"
|
NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"
|
||||||
|
NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}'
|
||||||
NX_ETHEREUM_CHAIN_ID = 3
|
NX_ETHEREUM_CHAIN_ID = 3
|
||||||
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
NX_ETHEREUM_PROVIDER_URL = "https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8"
|
||||||
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
NX_ETHERSCAN_URL = "https://ropsten.etherscan.io"
|
||||||
|
@ -7,7 +7,11 @@ import {
|
|||||||
VegaManageDialog,
|
VegaManageDialog,
|
||||||
VegaWalletProvider,
|
VegaWalletProvider,
|
||||||
} from '@vegaprotocol/wallet';
|
} from '@vegaprotocol/wallet';
|
||||||
import { EnvironmentProvider } from '@vegaprotocol/react-helpers';
|
import {
|
||||||
|
useEnvironment,
|
||||||
|
EnvironmentProvider,
|
||||||
|
NetworkSwitcherDialog,
|
||||||
|
} from '@vegaprotocol/network-switcher';
|
||||||
import { Connectors } from '../lib/vega-connectors';
|
import { Connectors } from '../lib/vega-connectors';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { createClient } from '../lib/apollo-client';
|
import { createClient } from '../lib/apollo-client';
|
||||||
@ -18,10 +22,57 @@ import { VegaWalletConnectButton } from '../components/vega-wallet-connect-butto
|
|||||||
import './styles.css';
|
import './styles.css';
|
||||||
import { useGlobalStore } from '../stores';
|
import { useGlobalStore } from '../stores';
|
||||||
|
|
||||||
function VegaTradingApp({ Component, pageProps }: AppProps) {
|
function AppBody({ Component, pageProps }: AppProps) {
|
||||||
const client = useMemo(() => createClient(process.env['NX_VEGA_URL']), []);
|
|
||||||
const store = useGlobalStore();
|
const store = useGlobalStore();
|
||||||
const [theme, toggleTheme] = useThemeSwitcher();
|
const { VEGA_NETWORKS } = useEnvironment();
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
const [_, toggleTheme] = useThemeSwitcher();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="h-full dark:bg-black dark:text-white-60 bg-white relative z-0 text-black-60 grid grid-rows-[min-content,1fr]">
|
||||||
|
<div className="flex items-stretch border-b-[7px] border-vega-yellow">
|
||||||
|
<Navbar />
|
||||||
|
<div className="flex items-center gap-4 ml-auto mr-8">
|
||||||
|
<VegaWalletConnectButton
|
||||||
|
setConnectDialog={(open) => {
|
||||||
|
store.setVegaWalletConnectDialog(open);
|
||||||
|
}}
|
||||||
|
setManageDialog={(open) => {
|
||||||
|
store.setVegaWalletManageDialog(open);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<ThemeSwitcher onToggle={toggleTheme} className="-my-4" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<main data-testid={pageProps.page}>
|
||||||
|
{/* @ts-ignore conflict between @types/react and nextjs internal types */}
|
||||||
|
<Component {...pageProps} />
|
||||||
|
</main>
|
||||||
|
<VegaConnectDialog
|
||||||
|
connectors={Connectors}
|
||||||
|
dialogOpen={store.vegaWalletConnectDialog}
|
||||||
|
setDialogOpen={(open) => store.setVegaWalletConnectDialog(open)}
|
||||||
|
/>
|
||||||
|
<VegaManageDialog
|
||||||
|
dialogOpen={store.vegaWalletManageDialog}
|
||||||
|
setDialogOpen={(open) => store.setVegaWalletManageDialog(open)}
|
||||||
|
/>
|
||||||
|
<NetworkSwitcherDialog
|
||||||
|
dialogOpen={store.vegaNetworkSwitcherDialog}
|
||||||
|
setDialogOpen={(open) => store.setVegaNetworkSwitcherDialog(open)}
|
||||||
|
onConnect={({ network }) => {
|
||||||
|
if (VEGA_NETWORKS[network]) {
|
||||||
|
window.location.href = VEGA_NETWORKS[network];
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function VegaTradingApp(props: AppProps) {
|
||||||
|
const [theme] = useThemeSwitcher();
|
||||||
|
const client = useMemo(() => createClient(process.env['NX_VEGA_URL']), []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EnvironmentProvider>
|
<EnvironmentProvider>
|
||||||
@ -48,39 +99,7 @@ function VegaTradingApp({ Component, pageProps }: AppProps) {
|
|||||||
href="https://static.vega.xyz/fonts.css"
|
href="https://static.vega.xyz/fonts.css"
|
||||||
/>
|
/>
|
||||||
</Head>
|
</Head>
|
||||||
<div className="h-full dark:bg-black dark:text-white-60 bg-white relative z-0 text-black-60 grid grid-rows-[min-content,1fr]">
|
<AppBody {...props} />
|
||||||
<div className="flex items-stretch border-b-[7px] border-vega-yellow">
|
|
||||||
<Navbar />
|
|
||||||
<div className="flex items-center gap-4 ml-auto mr-8">
|
|
||||||
<VegaWalletConnectButton
|
|
||||||
setConnectDialog={(open) => {
|
|
||||||
store.setVegaWalletConnectDialog(open);
|
|
||||||
}}
|
|
||||||
setManageDialog={(open) => {
|
|
||||||
store.setVegaWalletManageDialog(open);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<ThemeSwitcher onToggle={toggleTheme} className="-my-4" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<main data-testid={pageProps.page}>
|
|
||||||
{/* @ts-ignore conflict between @types/react and nextjs internal types */}
|
|
||||||
<Component {...pageProps} />
|
|
||||||
</main>
|
|
||||||
<VegaConnectDialog
|
|
||||||
connectors={Connectors}
|
|
||||||
dialogOpen={store.vegaWalletConnectDialog}
|
|
||||||
setDialogOpen={(open) =>
|
|
||||||
store.setVegaWalletConnectDialog(open)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<VegaManageDialog
|
|
||||||
dialogOpen={store.vegaWalletManageDialog}
|
|
||||||
setDialogOpen={(open) =>
|
|
||||||
store.setVegaWalletManageDialog(open)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</AppLoader>
|
</AppLoader>
|
||||||
</VegaWalletProvider>
|
</VegaWalletProvider>
|
||||||
</ApolloProvider>
|
</ApolloProvider>
|
||||||
|
@ -2,7 +2,8 @@ import { gql } from '@apollo/client';
|
|||||||
import { PageQueryContainer } from '../../../components/page-query-container';
|
import { PageQueryContainer } from '../../../components/page-query-container';
|
||||||
import type { DepositPage } from './__generated__/DepositPage';
|
import type { DepositPage } from './__generated__/DepositPage';
|
||||||
import { DepositManager } from '@vegaprotocol/deposits';
|
import { DepositManager } from '@vegaprotocol/deposits';
|
||||||
import { t, useEnvironment } from '@vegaprotocol/react-helpers';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
import { Splash } from '@vegaprotocol/ui-toolkit';
|
import { Splash } from '@vegaprotocol/ui-toolkit';
|
||||||
import { ASSET_FRAGMENT } from '../../../lib/query-fragments';
|
import { ASSET_FRAGMENT } from '../../../lib/query-fragments';
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ interface GlobalStore {
|
|||||||
setVegaWalletConnectDialog: (isOpen: boolean) => void;
|
setVegaWalletConnectDialog: (isOpen: boolean) => void;
|
||||||
vegaWalletManageDialog: boolean;
|
vegaWalletManageDialog: boolean;
|
||||||
setVegaWalletManageDialog: (isOpen: boolean) => void;
|
setVegaWalletManageDialog: (isOpen: boolean) => void;
|
||||||
|
vegaNetworkSwitcherDialog: boolean;
|
||||||
|
setVegaNetworkSwitcherDialog: (isOpen: boolean) => void;
|
||||||
landingDialog: boolean;
|
landingDialog: boolean;
|
||||||
setLandingDialog: (isOpen: boolean) => void;
|
setLandingDialog: (isOpen: boolean) => void;
|
||||||
}
|
}
|
||||||
@ -19,6 +21,10 @@ export const useGlobalStore = create((set: SetState<GlobalStore>) => ({
|
|||||||
setVegaWalletManageDialog: (isOpen: boolean) => {
|
setVegaWalletManageDialog: (isOpen: boolean) => {
|
||||||
set({ vegaWalletManageDialog: isOpen });
|
set({ vegaWalletManageDialog: isOpen });
|
||||||
},
|
},
|
||||||
|
vegaNetworkSwitcherDialog: false,
|
||||||
|
setVegaNetworkSwitcherDialog: (isOpen: boolean) => {
|
||||||
|
set({ vegaNetworkSwitcherDialog: isOpen });
|
||||||
|
},
|
||||||
landingDialog: false,
|
landingDialog: false,
|
||||||
setLandingDialog: (isOpen: boolean) => {
|
setLandingDialog: (isOpen: boolean) => {
|
||||||
set({ landingDialog: isOpen });
|
set({ landingDialog: isOpen });
|
||||||
|
12
libs/network-switcher/.babelrc
Normal file
12
libs/network-switcher/.babelrc
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
[
|
||||||
|
"@nrwl/react/babel",
|
||||||
|
{
|
||||||
|
"runtime": "automatic",
|
||||||
|
"useBuiltIns": "usage"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"plugins": []
|
||||||
|
}
|
18
libs/network-switcher/.eslintrc.json
Normal file
18
libs/network-switcher/.eslintrc.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"],
|
||||||
|
"ignorePatterns": ["!**/*"],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
||||||
|
"rules": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["*.ts", "*.tsx"],
|
||||||
|
"rules": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["*.js", "*.jsx"],
|
||||||
|
"rules": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
17
libs/network-switcher/README.md
Normal file
17
libs/network-switcher/README.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# network-switcher
|
||||||
|
|
||||||
|
This library was generated with [Nx](https://nx.dev).
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
Two environment variables need to be present for any app consuming this library.
|
||||||
|
|
||||||
|
`NX_VEGA_ENV` is the name of the environment.
|
||||||
|
|
||||||
|
`NX_VEGA_REST` is the REST endpoint for the environment.
|
||||||
|
|
||||||
|
For examples, see Block Explorer's .env files [here](../../apps/explorer)
|
||||||
|
|
||||||
|
## Running unit tests
|
||||||
|
|
||||||
|
Run `nx test network-switcher` to execute the unit tests via [Jest](https://jestjs.io).
|
9
libs/network-switcher/jest.config.js
Normal file
9
libs/network-switcher/jest.config.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
module.exports = {
|
||||||
|
displayName: 'network-switcher',
|
||||||
|
preset: '../../jest.preset.js',
|
||||||
|
transform: {
|
||||||
|
'^.+\\.[tj]sx?$': 'babel-jest',
|
||||||
|
},
|
||||||
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
||||||
|
coverageDirectory: '../../coverage/libs/network-switcher',
|
||||||
|
};
|
4
libs/network-switcher/package.json
Normal file
4
libs/network-switcher/package.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"name": "@vegaprotocol/network-switcher",
|
||||||
|
"version": "0.0.1"
|
||||||
|
}
|
43
libs/network-switcher/project.json
Normal file
43
libs/network-switcher/project.json
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"root": "libs/network-switcher",
|
||||||
|
"sourceRoot": "libs/network-switcher/src",
|
||||||
|
"projectType": "library",
|
||||||
|
"tags": [],
|
||||||
|
"targets": {
|
||||||
|
"build": {
|
||||||
|
"executor": "@nrwl/web:rollup",
|
||||||
|
"outputs": ["{options.outputPath}"],
|
||||||
|
"options": {
|
||||||
|
"outputPath": "dist/libs/network-switcher",
|
||||||
|
"tsConfig": "libs/network-switcher/tsconfig.lib.json",
|
||||||
|
"project": "libs/network-switcher/package.json",
|
||||||
|
"entryFile": "libs/network-switcher/src/index.ts",
|
||||||
|
"external": ["react/jsx-runtime"],
|
||||||
|
"rollupConfig": "@nrwl/react/plugins/bundle-rollup",
|
||||||
|
"compiler": "babel",
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"glob": "libs/network-switcher/README.md",
|
||||||
|
"input": ".",
|
||||||
|
"output": "."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"executor": "@nrwl/linter:eslint",
|
||||||
|
"outputs": ["{options.outputFile}"],
|
||||||
|
"options": {
|
||||||
|
"lintFilePatterns": ["libs/network-switcher/**/*.{ts,tsx,js,jsx}"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"executor": "@nrwl/jest:jest",
|
||||||
|
"outputs": ["coverage/libs/network-switcher"],
|
||||||
|
"options": {
|
||||||
|
"jestConfig": "libs/network-switcher/jest.config.js",
|
||||||
|
"passWithNoTests": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
2
libs/network-switcher/src/components/index.ts
Normal file
2
libs/network-switcher/src/components/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from './network-switcher';
|
||||||
|
export * from './network-switcher-dialog';
|
@ -0,0 +1 @@
|
|||||||
|
export { NetworkSwitcherDialog } from './network-switcher-dialog';
|
@ -0,0 +1,37 @@
|
|||||||
|
import type { ComponentProps } from 'react';
|
||||||
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
import type { Intent } from '@vegaprotocol/ui-toolkit';
|
||||||
|
import { Dialog } from '@vegaprotocol/ui-toolkit';
|
||||||
|
import { NetworkSwitcher } from '../network-switcher';
|
||||||
|
|
||||||
|
type NetworkSwitcherDialogProps = Pick<
|
||||||
|
ComponentProps<typeof NetworkSwitcher>,
|
||||||
|
'onConnect' | 'onError'
|
||||||
|
> & {
|
||||||
|
dialogOpen: boolean;
|
||||||
|
setDialogOpen: (dialogOpen: boolean) => void;
|
||||||
|
intent?: Intent;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const NetworkSwitcherDialog = ({
|
||||||
|
dialogOpen,
|
||||||
|
setDialogOpen,
|
||||||
|
intent,
|
||||||
|
onConnect,
|
||||||
|
onError,
|
||||||
|
}: NetworkSwitcherDialogProps) => {
|
||||||
|
return (
|
||||||
|
<Dialog
|
||||||
|
open={dialogOpen}
|
||||||
|
onChange={setDialogOpen}
|
||||||
|
title={t('Choose a network')}
|
||||||
|
intent={intent}
|
||||||
|
>
|
||||||
|
<NetworkSwitcher
|
||||||
|
onConnect={onConnect}
|
||||||
|
onError={onError}
|
||||||
|
onClose={() => setDialogOpen(false)}
|
||||||
|
/>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
};
|
@ -0,0 +1 @@
|
|||||||
|
export { NetworkSwitcher } from './network-switcher';
|
@ -0,0 +1,47 @@
|
|||||||
|
import { useForm, Controller } from 'react-hook-form';
|
||||||
|
import { Button, Select } from '@vegaprotocol/ui-toolkit';
|
||||||
|
import type { Networks } from '@vegaprotocol/react-helpers';
|
||||||
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
import { useEnvironment } from '../../hooks';
|
||||||
|
|
||||||
|
type NetworkState = {
|
||||||
|
network: Networks;
|
||||||
|
};
|
||||||
|
|
||||||
|
type NetworkSwitcherProps = {
|
||||||
|
onConnect: (network: NetworkState) => void;
|
||||||
|
onError?: () => void;
|
||||||
|
onClose: () => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const NetworkSwitcher = ({ onConnect }: NetworkSwitcherProps) => {
|
||||||
|
const { VEGA_ENV, VEGA_NETWORKS } = useEnvironment();
|
||||||
|
const { control, handleSubmit } = useForm<NetworkState>({
|
||||||
|
defaultValues: {
|
||||||
|
network: VEGA_ENV,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<form onSubmit={handleSubmit(onConnect)}>
|
||||||
|
<div className="py-16">
|
||||||
|
<Controller
|
||||||
|
name="network"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<Select value={field.value} onChange={field.onChange}>
|
||||||
|
{Object.keys(VEGA_NETWORKS).map((network) => (
|
||||||
|
<option value={network}>{network}</option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="py-16">
|
||||||
|
<Button data-testid="connect-network" type="submit">
|
||||||
|
{t('Connect')}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
};
|
1
libs/network-switcher/src/hooks/index.ts
Normal file
1
libs/network-switcher/src/hooks/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './use-environment';
|
@ -1,6 +1,9 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import { createContext, useContext } from 'react';
|
import { createContext, useContext } from 'react';
|
||||||
import type { Networks } from '../lib/environment';
|
import type { Networks } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
|
const isBrowser = typeof window !== 'undefined';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
@ -50,13 +53,14 @@ export const ContractAddresses: { [key in Networks]: VegaContracts } = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type EnvironmentProviderProps = {
|
type EnvironmentProviderProps = {
|
||||||
definintions?: Partial<RawEnvironment>;
|
definitions?: Partial<RawEnvironment>;
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ENV_KEYS = [
|
export const ENV_KEYS = [
|
||||||
'VEGA_URL',
|
'VEGA_URL',
|
||||||
'VEGA_ENV',
|
'VEGA_ENV',
|
||||||
|
'VEGA_NETWORKS',
|
||||||
'ETHEREUM_CHAIN_ID',
|
'ETHEREUM_CHAIN_ID',
|
||||||
'ETHEREUM_PROVIDER_URL',
|
'ETHEREUM_PROVIDER_URL',
|
||||||
'ETHERSCAN_URL',
|
'ETHERSCAN_URL',
|
||||||
@ -69,12 +73,15 @@ type RawEnvironment = Record<EnvKey, string>;
|
|||||||
export type Environment = {
|
export type Environment = {
|
||||||
VEGA_URL: string;
|
VEGA_URL: string;
|
||||||
VEGA_ENV: Networks;
|
VEGA_ENV: Networks;
|
||||||
|
VEGA_NETWORKS: Record<Networks, string>;
|
||||||
ETHEREUM_CHAIN_ID: number;
|
ETHEREUM_CHAIN_ID: number;
|
||||||
ETHEREUM_PROVIDER_URL: string;
|
ETHEREUM_PROVIDER_URL: string;
|
||||||
ETHERSCAN_URL: string;
|
ETHERSCAN_URL: string;
|
||||||
ADDRESSES: VegaContracts;
|
ADDRESSES: VegaContracts;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type EnvironmentState = Environment;
|
||||||
|
|
||||||
const getBundledEnvironmentValue = (key: EnvKey) => {
|
const getBundledEnvironmentValue = (key: EnvKey) => {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
// need to have these hardcoded so on build time we can insert sensible defaults
|
// need to have these hardcoded so on build time we can insert sensible defaults
|
||||||
@ -88,6 +95,8 @@ const getBundledEnvironmentValue = (key: EnvKey) => {
|
|||||||
return process.env['NX_ETHEREUM_PROVIDER_URL'];
|
return process.env['NX_ETHEREUM_PROVIDER_URL'];
|
||||||
case 'ETHERSCAN_URL':
|
case 'ETHERSCAN_URL':
|
||||||
return process.env['NX_ETHERSCAN_URL'];
|
return process.env['NX_ETHERSCAN_URL'];
|
||||||
|
case 'VEGA_NETWORKS':
|
||||||
|
return process.env['NX_VEGA_NETWORKS'];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -97,38 +106,67 @@ const transformValue = (key: EnvKey, value?: string) => {
|
|||||||
return value as Networks;
|
return value as Networks;
|
||||||
case 'ETHEREUM_CHAIN_ID':
|
case 'ETHEREUM_CHAIN_ID':
|
||||||
return value && Number(value);
|
return value && Number(value);
|
||||||
|
case 'VEGA_NETWORKS': {
|
||||||
|
if (value) {
|
||||||
|
try {
|
||||||
|
return JSON.parse(value);
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error(
|
||||||
|
'Error parsing the "NX_VEGA_NETWORKS" environment variable. Make sure it has a valid JSON format.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getValue = (key: EnvKey, definintions: Partial<RawEnvironment> = {}) => {
|
const getValue = (key: EnvKey, definitions: Partial<RawEnvironment> = {}) => {
|
||||||
if (typeof window === 'undefined') {
|
if (!isBrowser) {
|
||||||
return transformValue(
|
return transformValue(
|
||||||
key,
|
key,
|
||||||
definintions[key] ?? getBundledEnvironmentValue(key)
|
definitions[key] ?? getBundledEnvironmentValue(key)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return transformValue(
|
return transformValue(
|
||||||
key,
|
key,
|
||||||
window._ENV?.[key] ?? definintions[key] ?? getBundledEnvironmentValue(key)
|
window._ENV?.[key] ?? definitions[key] ?? getBundledEnvironmentValue(key)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const EnvironmentContext = createContext({} as Environment);
|
const compileEnvironment = (
|
||||||
|
definitions?: Partial<RawEnvironment>
|
||||||
export const EnvironmentProvider = ({
|
): Environment => {
|
||||||
definintions,
|
|
||||||
children,
|
|
||||||
}: EnvironmentProviderProps) => {
|
|
||||||
const environment = ENV_KEYS.reduce(
|
const environment = ENV_KEYS.reduce(
|
||||||
(acc, key) => ({
|
(acc, key) => ({
|
||||||
...acc,
|
...acc,
|
||||||
[key]: getValue(key, definintions),
|
[key]: getValue(key, definitions),
|
||||||
}),
|
}),
|
||||||
{} as Environment
|
{} as Environment
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...environment,
|
||||||
|
ADDRESSES: ContractAddresses[environment['VEGA_ENV']],
|
||||||
|
VEGA_NETWORKS: {
|
||||||
|
[environment.VEGA_ENV]: isBrowser
|
||||||
|
? window.location.href
|
||||||
|
: environment.VEGA_NETWORKS[environment.VEGA_ENV],
|
||||||
|
...environment.VEGA_NETWORKS,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const EnvironmentContext = createContext({} as EnvironmentState);
|
||||||
|
|
||||||
|
export const EnvironmentProvider = ({
|
||||||
|
definitions,
|
||||||
|
children,
|
||||||
|
}: EnvironmentProviderProps) => {
|
||||||
|
const [environment] = useState<Environment>(compileEnvironment(definitions));
|
||||||
|
|
||||||
const missingKeys = Object.keys(environment)
|
const missingKeys = Object.keys(environment)
|
||||||
.filter((key) => typeof environment[key as EnvKey] === undefined)
|
.filter((key) => typeof environment[key as EnvKey] === undefined)
|
||||||
.map((key) => `"${key}"`)
|
.map((key) => `"${key}"`)
|
||||||
@ -141,12 +179,7 @@ export const EnvironmentProvider = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EnvironmentContext.Provider
|
<EnvironmentContext.Provider value={environment}>
|
||||||
value={{
|
|
||||||
...environment,
|
|
||||||
ADDRESSES: ContractAddresses[environment['VEGA_ENV']],
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</EnvironmentContext.Provider>
|
</EnvironmentContext.Provider>
|
||||||
);
|
);
|
5
libs/network-switcher/src/index.ts
Normal file
5
libs/network-switcher/src/index.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// Components
|
||||||
|
export * from './components';
|
||||||
|
|
||||||
|
// Hooks
|
||||||
|
export * from './hooks';
|
25
libs/network-switcher/tsconfig.json
Normal file
25
libs/network-switcher/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
"allowJs": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"strict": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
"noPropertyAccessFromIndexSignature": false,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noFallthroughCasesInSwitch": true
|
||||||
|
},
|
||||||
|
"files": [],
|
||||||
|
"include": [],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.lib.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.spec.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
22
libs/network-switcher/tsconfig.lib.json
Normal file
22
libs/network-switcher/tsconfig.lib.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../../dist/out-tsc",
|
||||||
|
"types": ["node"]
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
|
||||||
|
"../../node_modules/@nrwl/react/typings/image.d.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"**/*.spec.ts",
|
||||||
|
"**/*.test.ts",
|
||||||
|
"**/*.spec.tsx",
|
||||||
|
"**/*.test.tsx",
|
||||||
|
"**/*.spec.js",
|
||||||
|
"**/*.test.js",
|
||||||
|
"**/*.spec.jsx",
|
||||||
|
"**/*.test.jsx"
|
||||||
|
],
|
||||||
|
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
|
||||||
|
}
|
19
libs/network-switcher/tsconfig.spec.json
Normal file
19
libs/network-switcher/tsconfig.spec.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../../dist/out-tsc",
|
||||||
|
"module": "commonjs",
|
||||||
|
"types": ["jest", "node"]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"**/*.test.ts",
|
||||||
|
"**/*.spec.ts",
|
||||||
|
"**/*.test.tsx",
|
||||||
|
"**/*.spec.tsx",
|
||||||
|
"**/*.test.js",
|
||||||
|
"**/*.spec.js",
|
||||||
|
"**/*.test.jsx",
|
||||||
|
"**/*.spec.jsx",
|
||||||
|
"**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
@ -2,4 +2,3 @@ export * from './use-apply-grid-transaction';
|
|||||||
export * from './use-data-provider';
|
export * from './use-data-provider';
|
||||||
export * from './use-theme-switcher';
|
export * from './use-theme-switcher';
|
||||||
export * from './use-fetch';
|
export * from './use-fetch';
|
||||||
export * from './use-environment';
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { t } from '@vegaprotocol/react-helpers';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { Link } from '@vegaprotocol/ui-toolkit';
|
import { Link } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
import { EthTxStatus } from '../use-ethereum-transaction';
|
import { EthTxStatus } from '../use-ethereum-transaction';
|
||||||
|
|
||||||
const ACTIVE_CLASSES = 'text-black dark:text-white';
|
const ACTIVE_CLASSES = 'text-black dark:text-white';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Link, Dialog, Icon, Intent, Loader } from '@vegaprotocol/ui-toolkit';
|
import { Link, Dialog, Icon, Intent, Loader } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
import type { VegaTxState } from '@vegaprotocol/wallet';
|
import type { VegaTxState } from '@vegaprotocol/wallet';
|
||||||
import { VegaTxStatus } from '@vegaprotocol/wallet';
|
import { VegaTxStatus } from '@vegaprotocol/wallet';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
|
@ -11,7 +11,7 @@ import {
|
|||||||
} from '@vegaprotocol/react-helpers';
|
} from '@vegaprotocol/react-helpers';
|
||||||
import { WithdrawalStatus } from '@vegaprotocol/types';
|
import { WithdrawalStatus } from '@vegaprotocol/types';
|
||||||
import { Link, AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit';
|
import { Link, AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useEnvironment } from '@vegaprotocol/react-helpers';
|
import { useEnvironment } from '@vegaprotocol/network-switcher';
|
||||||
import { TransactionDialog } from '@vegaprotocol/web3';
|
import { TransactionDialog } from '@vegaprotocol/web3';
|
||||||
import { useCompleteWithdraw } from './use-complete-withdraw';
|
import { useCompleteWithdraw } from './use-complete-withdraw';
|
||||||
import type { Withdrawals_party_withdrawals } from './__generated__/Withdrawals';
|
import type { Withdrawals_party_withdrawals } from './__generated__/Withdrawals';
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
"@vegaprotocol/market-depth": ["libs/market-depth/src/index.ts"],
|
"@vegaprotocol/market-depth": ["libs/market-depth/src/index.ts"],
|
||||||
"@vegaprotocol/market-list": ["libs/market-list/src/index.ts"],
|
"@vegaprotocol/market-list": ["libs/market-list/src/index.ts"],
|
||||||
"@vegaprotocol/network-stats": ["libs/network-stats/src/index.ts"],
|
"@vegaprotocol/network-stats": ["libs/network-stats/src/index.ts"],
|
||||||
|
"@vegaprotocol/network-switcher": ["libs/network-switcher/src/index.ts"],
|
||||||
"@vegaprotocol/order-list": ["libs/order-list/src/index.ts"],
|
"@vegaprotocol/order-list": ["libs/order-list/src/index.ts"],
|
||||||
"@vegaprotocol/positions": ["libs/positions/src/index.ts"],
|
"@vegaprotocol/positions": ["libs/positions/src/index.ts"],
|
||||||
"@vegaprotocol/react-helpers": ["libs/react-helpers/src/index.ts"],
|
"@vegaprotocol/react-helpers": ["libs/react-helpers/src/index.ts"],
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
"market-depth": "libs/market-depth",
|
"market-depth": "libs/market-depth",
|
||||||
"market-list": "libs/market-list",
|
"market-list": "libs/market-list",
|
||||||
"network-stats": "libs/network-stats",
|
"network-stats": "libs/network-stats",
|
||||||
|
"network-switcher": "libs/network-switcher",
|
||||||
"order-list": "libs/order-list",
|
"order-list": "libs/order-list",
|
||||||
"positions": "libs/positions",
|
"positions": "libs/positions",
|
||||||
"react-helpers": "libs/react-helpers",
|
"react-helpers": "libs/react-helpers",
|
||||||
|
Loading…
Reference in New Issue
Block a user