From 7035297775114b65622dee5edfaa136ae835dec6 Mon Sep 17 00:00:00 2001 From: armaniferrante Date: Wed, 16 Jun 2021 22:17:23 -0700 Subject: [PATCH] Update backup url --- src/utils/clusters.js | 24 ++++++++++++------------ src/utils/connection.tsx | 6 ++++-- src/utils/tokens/names.js | 4 ++-- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/utils/clusters.js b/src/utils/clusters.js index 1ae412d..72b3e91 100644 --- a/src/utils/clusters.js +++ b/src/utils/clusters.js @@ -1,36 +1,36 @@ import { clusterApiUrl } from '@solana/web3.js'; -import { MAINNET_URL, MAINNET_VIP_URL } from '../utils/connection'; +import { MAINNET_URL, MAINNET_BACKUP_URL } from '../utils/connection'; export const CLUSTERS = [ { name: 'mainnet-beta', apiUrl: MAINNET_URL, - label: 'Mainnet Beta', - clusterSlug: 'mainnet-beta', + label: 'Mainnet Beta', + clusterSlug: 'mainnet-beta', }, { name: 'mainnet-beta-backup', - apiUrl: MAINNET_VIP_URL, - label: 'Mainnet Beta Backup', - clusterSlug: 'mainnet-beta', + apiUrl: MAINNET_BACKUP_URL, + label: 'Mainnet Beta Backup', + clusterSlug: 'mainnet-beta', }, { name: 'devnet', apiUrl: clusterApiUrl('devnet'), - label: 'Devnet', - clusterSlug: 'devnet', + label: 'Devnet', + clusterSlug: 'devnet', }, { name: 'testnet', apiUrl: clusterApiUrl('testnet'), - label: 'Testnet', - clusterSlug: 'testnet', + label: 'Testnet', + clusterSlug: 'testnet', }, { name: 'localnet', apiUrl: 'http://localhost:8899', - label: null, - clusterSlug: 'localnet', + label: null, + clusterSlug: 'localnet', } ]; diff --git a/src/utils/connection.tsx b/src/utils/connection.tsx index b5805b1..fdd1df0 100644 --- a/src/utils/connection.tsx +++ b/src/utils/connection.tsx @@ -17,7 +17,9 @@ const ConnectionContext = React.createContext<{ } | null>(null); export const MAINNET_URL = 'https://solana-api.projectserum.com'; -export const MAINNET_VIP_URL = 'https://vip-api-1e4b2d8l9r.mainnet-beta.solana.com'; +// No backup url for now. Leave the variable to not break wallets that +// have saved the url in their local storage, previously. +export const MAINNET_BACKUP_URL = 'https://solana-api.projectserum.com/'; export function ConnectionProvider({ children }) { const [endpoint, setEndpoint] = useLocalStorageState( 'connectionEndpoint', @@ -56,7 +58,7 @@ export function useIsProdNetwork() { if (!context) { throw new Error('Missing connection context'); } - return context.endpoint === MAINNET_URL || context.endpoint === MAINNET_VIP_URL; + return context.endpoint === MAINNET_URL || context.endpoint === MAINNET_BACKUP_URL; } export function useSolanaExplorerUrlSuffix() { diff --git a/src/utils/tokens/names.js b/src/utils/tokens/names.js index fc7c0f4..aac6bc1 100644 --- a/src/utils/tokens/names.js +++ b/src/utils/tokens/names.js @@ -3,7 +3,7 @@ import EventEmitter from 'events'; import { useConnectionConfig, MAINNET_URL, - MAINNET_VIP_URL, + MAINNET_BACKUP_URL, } from '../connection'; import { useListener } from '../utils'; import { clusterForEndpoint } from '../clusters'; @@ -278,7 +278,7 @@ export function TokenRegistryProvider(props) { const { endpoint } = useConnectionConfig(); const [tokenInfos, setTokenInfos] = useState(null); useEffect(() => { - if (endpoint !== MAINNET_VIP_URL && endpoint !== MAINNET_URL) return; + if (endpoint !== MAINNET_BACKUP_URL && endpoint !== MAINNET_URL) return; const tokenListProvider = new TokenListProvider(); tokenListProvider.resolve().then((tokenListContainer) => { const cluster = clusterForEndpoint(endpoint);