Switch to serum api endpoint
This commit is contained in:
parent
07fec11bc6
commit
f894445f7d
|
@ -5,9 +5,9 @@ import {
|
|||
} from '../utils/wallet';
|
||||
import { useUpdateTokenName } from '../utils/tokens/names';
|
||||
import { useCallAsync, useSendTransaction } from '../utils/notifications';
|
||||
import { Account, clusterApiUrl, LAMPORTS_PER_SOL } from '@solana/web3.js';
|
||||
import { Account, LAMPORTS_PER_SOL } from '@solana/web3.js';
|
||||
import { abbreviateAddress, sleep } from '../utils/utils';
|
||||
import { refreshAccountInfo, useConnectionConfig } from '../utils/connection';
|
||||
import { refreshAccountInfo, useConnectionConfig, MAINNET_URL } from '../utils/connection';
|
||||
import { createAndInitializeMint } from '../utils/tokens';
|
||||
import { Tooltip, Button } from '@material-ui/core';
|
||||
import React from 'react';
|
||||
|
@ -60,7 +60,7 @@ export default function DebugButtons() {
|
|||
}
|
||||
|
||||
const noSol = amount === 0;
|
||||
const requestAirdropDisabled = endpoint === clusterApiUrl('mainnet-beta');
|
||||
const requestAirdropDisabled = endpoint === MAINNET_URL;
|
||||
return (
|
||||
<div style={{ display: 'flex' }}>
|
||||
<Tooltip
|
||||
|
|
|
@ -3,7 +3,7 @@ import Toolbar from '@material-ui/core/Toolbar';
|
|||
import AppBar from '@material-ui/core/AppBar';
|
||||
import Typography from '@material-ui/core/Typography';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import { useConnectionConfig } from '../utils/connection';
|
||||
import { useConnectionConfig, MAINNET_URL } from '../utils/connection';
|
||||
import Button from '@material-ui/core/Button';
|
||||
import Menu from '@material-ui/core/Menu';
|
||||
import MenuItem from '@material-ui/core/MenuItem';
|
||||
|
@ -87,14 +87,14 @@ function NetworkSelector() {
|
|||
const classes = useStyles();
|
||||
|
||||
const networks = [
|
||||
clusterApiUrl('mainnet-beta'),
|
||||
MAINNET_URL,
|
||||
clusterApiUrl('devnet'),
|
||||
clusterApiUrl('testnet'),
|
||||
'http://localhost:8899',
|
||||
];
|
||||
|
||||
const networkLabels = {
|
||||
[clusterApiUrl('mainnet-beta')]: 'Mainnet Beta',
|
||||
[MAINNET_URL]: 'Mainnet Beta',
|
||||
[clusterApiUrl('devnet')]: 'Devnet',
|
||||
[clusterApiUrl('testnet')]: 'Testnet',
|
||||
};
|
||||
|
|
|
@ -6,10 +6,11 @@ import tuple from 'immutable-tuple';
|
|||
|
||||
const ConnectionContext = React.createContext(null);
|
||||
|
||||
export const MAINNET_URL = 'https://solana-api.projectserum.com';
|
||||
export function ConnectionProvider({ children }) {
|
||||
const [endpoint, setEndpoint] = useLocalStorageState(
|
||||
'endpoint',
|
||||
clusterApiUrl('mainnet-beta'),
|
||||
MAINNET_URL,
|
||||
);
|
||||
|
||||
const connection = useMemo(() => new Connection(endpoint, 'recent'), [
|
||||
|
@ -34,7 +35,7 @@ export function useConnectionConfig() {
|
|||
|
||||
export function useIsProdNetwork() {
|
||||
const endpoint = useContext(ConnectionContext).endpoint;
|
||||
return endpoint === clusterApiUrl('mainnet-beta');
|
||||
return endpoint === MAINNET_URL;
|
||||
}
|
||||
|
||||
export function useSolanaExplorerUrlSuffix() {
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import EventEmitter from 'events';
|
||||
import { useConnectionConfig } from '../connection';
|
||||
import { useConnectionConfig, MAINNET_URL } from '../connection';
|
||||
import { useListener } from '../utils';
|
||||
import { useCallback } from 'react';
|
||||
import { clusterApiUrl } from '@solana/web3.js';
|
||||
|
||||
export const TOKENS = {
|
||||
[clusterApiUrl('mainnet-beta')]: [
|
||||
[MAINNET_URL]: [
|
||||
{
|
||||
mintAddress: 'SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt',
|
||||
tokenName: 'Serum',
|
||||
|
|
Loading…
Reference in New Issue