From 7d13b78cf5926295952161981fd197643d20a00e Mon Sep 17 00:00:00 2001 From: yogurtandjam Date: Mon, 14 Oct 2024 18:32:26 -0400 Subject: [PATCH] address comments --- src/hooks/transfers/skipClient.tsx | 5 ++++- src/lib/skip.ts | 12 ------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/hooks/transfers/skipClient.tsx b/src/hooks/transfers/skipClient.tsx index 9011b1d4c..647e8c960 100644 --- a/src/hooks/transfers/skipClient.tsx +++ b/src/hooks/transfers/skipClient.tsx @@ -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; @@ -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( () => @@ -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]; diff --git a/src/lib/skip.ts b/src/lib/skip.ts index 079934196..ef330f34a 100644 --- a/src/lib/skip.ts +++ b/src/lib/skip.ts @@ -1,7 +1,6 @@ import { AxelarTransferInfoJSON, CCTPTransferInfoJSON, - SkipClient, TrackTxResponseJSON, TransferEventJSON, TransferInfoJSON, @@ -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'; - }, - }, -});