Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yogurtandjam committed Oct 14, 2024
1 parent bf65466 commit 7d13b78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
5 changes: 4 additions & 1 deletion src/hooks/transfers/skipClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useAppSelector } from '@/state/appTypes';

import { RPCUrlsByChainId } from '@/lib/wagmi';

import { useDydxClient } from '../useDydxClient';
import { useEndpointsConfig } from '../useEndpointsConfig';

type SkipContextType = ReturnType<typeof useSkipClientContext>;
Expand All @@ -25,6 +26,7 @@ export const useSkipClient = () => useContext(SkipContext);
const useSkipClientContext = () => {
const { solanaRpcUrl, nobleValidator, neutronValidator, osmosisValidator, validators } =
useEndpointsConfig();
const { compositeClient } = useDydxClient();
const selectedDydxChainId = useAppSelector(getSelectedDydxChainId);
const skipClient = useMemo(
() =>
Expand All @@ -34,7 +36,8 @@ const useSkipClientContext = () => {
if (chainId === getNobleChainId()) return nobleValidator;
if (chainId === getNeutronChainId()) return neutronValidator;
if (chainId === getOsmosisChainId()) return osmosisValidator;
if (chainId === selectedDydxChainId) return validators[0];
if (chainId === selectedDydxChainId)
return compositeClient?.network.validatorConfig.restEndpoint ?? validators[0];
if (chainId === getSolanaChainId()) return solanaRpcUrl;
const evmRpcUrls = RPCUrlsByChainId[chainId];
if (evmRpcUrls) return evmRpcUrls[0];
Expand Down
12 changes: 0 additions & 12 deletions src/lib/skip.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
AxelarTransferInfoJSON,
CCTPTransferInfoJSON,
SkipClient,
TrackTxResponseJSON,
TransferEventJSON,
TransferInfoJSON,
Expand Down Expand Up @@ -239,14 +238,3 @@ export const fetchTransferStatus = ({
}) => {
return fetchSkipStatus({ transactionHash: transactionId, chainId: fromChainId, baseUrl });
};

export const skipClient = new SkipClient({
endpointOptions: {
getRpcEndpointForChain: async (chainId: string) => {
if (chainId === 'noble-1') return 'https://noble-yx-rpc.polkachu.com/';
if (chainId === 'dydx-mainnet-1') return 'https://dydx-ops-rpc.kingnodes.com';
if (chainId === '43114') return 'https://api.avax.network/ext/bc/C/rpc';
return 'https://dydx-ops-rpc.kingnodes.com';
},
},
});

0 comments on commit 7d13b78

Please sign in to comment.