Mainnet beta backup
This commit is contained in:
parent
e6d5af727b
commit
60cffa6bc4
|
@ -1,29 +1,39 @@
|
|||
import { clusterApiUrl } from '@solana/web3.js';
|
||||
import { MAINNET_URL } from '../utils/connection';
|
||||
import { MAINNET_URL, MAINNET_VIP_URL } from '../utils/connection';
|
||||
|
||||
export const CLUSTERS = [
|
||||
{
|
||||
name: 'mainnet-beta',
|
||||
apiUrl: MAINNET_URL,
|
||||
label: 'Mainnet Beta'
|
||||
label: 'Mainnet Beta',
|
||||
clusterSlug: 'mainnet-beta',
|
||||
},
|
||||
{
|
||||
name: 'mainnet-beta-backup',
|
||||
apiUrl: MAINNET_VIP_URL,
|
||||
label: 'Mainnet Beta Backup',
|
||||
clusterSlug: 'mainnet-beta',
|
||||
},
|
||||
{
|
||||
name: 'devnet',
|
||||
apiUrl: clusterApiUrl('devnet'),
|
||||
label: 'Devnet'
|
||||
label: 'Devnet',
|
||||
clusterSlug: 'devnet',
|
||||
},
|
||||
{
|
||||
name: 'testnet',
|
||||
apiUrl: clusterApiUrl('testnet'),
|
||||
label: 'Testnet'
|
||||
label: 'Testnet',
|
||||
clusterSlug: 'testnet',
|
||||
},
|
||||
{
|
||||
name: 'localnet',
|
||||
apiUrl: 'http://localhost:8899',
|
||||
label: null
|
||||
label: null,
|
||||
clusterSlug: 'localnet',
|
||||
}
|
||||
];
|
||||
|
||||
export function clusterForEndpoint(endpoint) {
|
||||
return CLUSTERS.find(({ apiUrl }) => apiUrl === endpoint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ const ConnectionContext = React.createContext<{
|
|||
} | null>(null);
|
||||
|
||||
export const MAINNET_URL = 'https://solana-api.projectserum.com';
|
||||
export const MAINNET_VIP_URL = 'https://vip-api.mainnet-beta.solana.com/';
|
||||
export function ConnectionProvider({ children }) {
|
||||
const [endpoint, setEndpoint] = useLocalStorageState(
|
||||
'connectionEndpoint',
|
||||
|
@ -56,7 +57,7 @@ export function useIsProdNetwork() {
|
|||
if (!context) {
|
||||
throw new Error('Missing connection context');
|
||||
}
|
||||
return context.endpoint === MAINNET_URL;
|
||||
return context.endpoint === MAINNET_URL || context.endpoint === MAINNET_VIP_URL;
|
||||
}
|
||||
|
||||
export function useSolanaExplorerUrlSuffix() {
|
||||
|
|
|
@ -279,7 +279,7 @@ export function TokenRegistryProvider(props) {
|
|||
const cluster = clusterForEndpoint(endpoint);
|
||||
|
||||
const filteredTokenListContainer = tokenListContainer?.filterByClusterSlug(
|
||||
cluster?.name,
|
||||
cluster?.clusterSlug
|
||||
);
|
||||
const tokenInfos =
|
||||
tokenListContainer !== filteredTokenListContainer
|
||||
|
|
Loading…
Reference in New Issue