@pear-protocol/symmio-client 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -675,6 +675,9 @@ function useSymmWs(params = {}) {
675
675
  }, [symmCoreClient, accountAddress, chainId, queryClient, setConnected]);
676
676
  return { isConnected };
677
677
  }
678
+ function trimTrailingSlashes(value) {
679
+ return value.replace(/\/+$/, "");
680
+ }
678
681
  function SymmProvider({
679
682
  chainId = 42161,
680
683
  address,
@@ -686,13 +689,21 @@ function SymmProvider({
686
689
  symmioConfig,
687
690
  children
688
691
  }) {
692
+ const normalizedApiUrl = useMemo(
693
+ () => trimTrailingSlashes(symmCoreConfig.apiUrl),
694
+ [symmCoreConfig.apiUrl]
695
+ );
696
+ const normalizedWsUrl = useMemo(
697
+ () => symmCoreConfig.wsUrl ? trimTrailingSlashes(symmCoreConfig.wsUrl) : void 0,
698
+ [symmCoreConfig.wsUrl]
699
+ );
689
700
  const symmCoreClient = useMemo(() => {
690
701
  return createSymmSDK({
691
- apiUrl: symmCoreConfig.apiUrl,
692
- wsUrl: symmCoreConfig.wsUrl,
702
+ apiUrl: normalizedApiUrl,
703
+ wsUrl: normalizedWsUrl,
693
704
  defaultChainId: chainId
694
705
  });
695
- }, [chainId, symmCoreConfig.apiUrl, symmCoreConfig.wsUrl]);
706
+ }, [chainId, normalizedApiUrl, normalizedWsUrl]);
696
707
  const value = useMemo(
697
708
  () => ({
698
709
  symmCoreClient,