@orderly.network/wallet-connector-privy 2.8.3 → 2.8.4-alpha.0

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.
package/dist/index.mjs CHANGED
@@ -3253,6 +3253,10 @@ function WalletConnectorPrivyProvider(props) {
3253
3253
  );
3254
3254
  const fetchMainChains = useMainnetChainsStore((state) => state.fetchData);
3255
3255
  const fetchTestChains = useTestnetChainsStore((state) => state.fetchData);
3256
+ const mainnetChainsHydrated = useMainnetChainsStore(
3257
+ (state) => state.hydrated
3258
+ );
3259
+ const testChainsHydrated = useTestnetChainsStore((state) => state.hydrated);
3256
3260
  const mainnetChainInfosFromStore = useMainnetChainsStore(
3257
3261
  (state) => state.data
3258
3262
  );
@@ -3314,13 +3318,18 @@ function WalletConnectorPrivyProvider(props) {
3314
3318
  fetchSwapData();
3315
3319
  }, [props.enableSwapDeposit, props.customChains]);
3316
3320
  useEffect(() => {
3321
+ if (!mainnetChainsHydrated || !testChainsHydrated)
3322
+ return;
3323
+ if (Array.isArray(useMainnetChainsStore.getState().data) && useTestnetChainsStore.getState().data) {
3324
+ return;
3325
+ }
3317
3326
  fetchMainChains().then((data) => {
3318
3327
  setMainnetChainInfos(data);
3319
3328
  });
3320
3329
  fetchTestChains().then((data) => {
3321
3330
  setTestChainInfos(data);
3322
3331
  });
3323
- }, []);
3332
+ }, [mainnetChainsHydrated, testChainsHydrated]);
3324
3333
  const handleCustomerChains = () => {
3325
3334
  const testChains = processChainInfo(
3326
3335
  props.customChains.testnet?.map((item) => item.network_infos)