Update backup url
This commit is contained in:
parent
96b5b7ff2a
commit
7035297775
|
@ -1,36 +1,36 @@
|
||||||
import { clusterApiUrl } from '@solana/web3.js';
|
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 = [
|
export const CLUSTERS = [
|
||||||
{
|
{
|
||||||
name: 'mainnet-beta',
|
name: 'mainnet-beta',
|
||||||
apiUrl: MAINNET_URL,
|
apiUrl: MAINNET_URL,
|
||||||
label: 'Mainnet Beta',
|
label: 'Mainnet Beta',
|
||||||
clusterSlug: 'mainnet-beta',
|
clusterSlug: 'mainnet-beta',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'mainnet-beta-backup',
|
name: 'mainnet-beta-backup',
|
||||||
apiUrl: MAINNET_VIP_URL,
|
apiUrl: MAINNET_BACKUP_URL,
|
||||||
label: 'Mainnet Beta Backup',
|
label: 'Mainnet Beta Backup',
|
||||||
clusterSlug: 'mainnet-beta',
|
clusterSlug: 'mainnet-beta',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'devnet',
|
name: 'devnet',
|
||||||
apiUrl: clusterApiUrl('devnet'),
|
apiUrl: clusterApiUrl('devnet'),
|
||||||
label: 'Devnet',
|
label: 'Devnet',
|
||||||
clusterSlug: 'devnet',
|
clusterSlug: 'devnet',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'testnet',
|
name: 'testnet',
|
||||||
apiUrl: clusterApiUrl('testnet'),
|
apiUrl: clusterApiUrl('testnet'),
|
||||||
label: 'Testnet',
|
label: 'Testnet',
|
||||||
clusterSlug: 'testnet',
|
clusterSlug: 'testnet',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'localnet',
|
name: 'localnet',
|
||||||
apiUrl: 'http://localhost:8899',
|
apiUrl: 'http://localhost:8899',
|
||||||
label: null,
|
label: null,
|
||||||
clusterSlug: 'localnet',
|
clusterSlug: 'localnet',
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,9 @@ const ConnectionContext = React.createContext<{
|
||||||
} | null>(null);
|
} | null>(null);
|
||||||
|
|
||||||
export const MAINNET_URL = 'https://solana-api.projectserum.com';
|
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 }) {
|
export function ConnectionProvider({ children }) {
|
||||||
const [endpoint, setEndpoint] = useLocalStorageState(
|
const [endpoint, setEndpoint] = useLocalStorageState(
|
||||||
'connectionEndpoint',
|
'connectionEndpoint',
|
||||||
|
@ -56,7 +58,7 @@ export function useIsProdNetwork() {
|
||||||
if (!context) {
|
if (!context) {
|
||||||
throw new Error('Missing connection 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() {
|
export function useSolanaExplorerUrlSuffix() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import EventEmitter from 'events';
|
||||||
import {
|
import {
|
||||||
useConnectionConfig,
|
useConnectionConfig,
|
||||||
MAINNET_URL,
|
MAINNET_URL,
|
||||||
MAINNET_VIP_URL,
|
MAINNET_BACKUP_URL,
|
||||||
} from '../connection';
|
} from '../connection';
|
||||||
import { useListener } from '../utils';
|
import { useListener } from '../utils';
|
||||||
import { clusterForEndpoint } from '../clusters';
|
import { clusterForEndpoint } from '../clusters';
|
||||||
|
@ -278,7 +278,7 @@ export function TokenRegistryProvider(props) {
|
||||||
const { endpoint } = useConnectionConfig();
|
const { endpoint } = useConnectionConfig();
|
||||||
const [tokenInfos, setTokenInfos] = useState(null);
|
const [tokenInfos, setTokenInfos] = useState(null);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (endpoint !== MAINNET_VIP_URL && endpoint !== MAINNET_URL) return;
|
if (endpoint !== MAINNET_BACKUP_URL && endpoint !== MAINNET_URL) return;
|
||||||
const tokenListProvider = new TokenListProvider();
|
const tokenListProvider = new TokenListProvider();
|
||||||
tokenListProvider.resolve().then((tokenListContainer) => {
|
tokenListProvider.resolve().then((tokenListContainer) => {
|
||||||
const cluster = clusterForEndpoint(endpoint);
|
const cluster = clusterForEndpoint(endpoint);
|
||||||
|
|
Loading…
Reference in New Issue