@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.
@@ -677,6 +677,9 @@ function useSymmWs(params = {}) {
677
677
  }, [symmCoreClient, accountAddress, chainId, queryClient, setConnected]);
678
678
  return { isConnected };
679
679
  }
680
+ function trimTrailingSlashes(value) {
681
+ return value.replace(/\/+$/, "");
682
+ }
680
683
  function SymmProvider({
681
684
  chainId = 42161,
682
685
  address,
@@ -688,13 +691,21 @@ function SymmProvider({
688
691
  symmioConfig,
689
692
  children
690
693
  }) {
694
+ const normalizedApiUrl = react.useMemo(
695
+ () => trimTrailingSlashes(symmCoreConfig.apiUrl),
696
+ [symmCoreConfig.apiUrl]
697
+ );
698
+ const normalizedWsUrl = react.useMemo(
699
+ () => symmCoreConfig.wsUrl ? trimTrailingSlashes(symmCoreConfig.wsUrl) : void 0,
700
+ [symmCoreConfig.wsUrl]
701
+ );
691
702
  const symmCoreClient = react.useMemo(() => {
692
703
  return symmCore.createSymmSDK({
693
- apiUrl: symmCoreConfig.apiUrl,
694
- wsUrl: symmCoreConfig.wsUrl,
704
+ apiUrl: normalizedApiUrl,
705
+ wsUrl: normalizedWsUrl,
695
706
  defaultChainId: chainId
696
707
  });
697
- }, [chainId, symmCoreConfig.apiUrl, symmCoreConfig.wsUrl]);
708
+ }, [chainId, normalizedApiUrl, normalizedWsUrl]);
698
709
  const value = react.useMemo(
699
710
  () => ({
700
711
  symmCoreClient,