From 0859b8492dd3714e9b888b3f3a7decf1d4bc58a5 Mon Sep 17 00:00:00 2001 From: Fraser Scott Date: Tue, 30 Apr 2024 15:23:58 +0100 Subject: [PATCH] refactor: defensive check --- packages/store-sync/src/createStoreSync.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/store-sync/src/createStoreSync.ts b/packages/store-sync/src/createStoreSync.ts index 99ad2fa466..36ed9ae862 100644 --- a/packages/store-sync/src/createStoreSync.ts +++ b/packages/store-sync/src/createStoreSync.ts @@ -34,7 +34,6 @@ import { bigIntMax, chunk, isDefined, waitForIdle } from "@latticexyz/common/uti import { getSnapshot } from "./getSnapshot"; import { fetchAndStoreLogs } from "./fetchAndStoreLogs"; import { Store as StoreConfig } from "@latticexyz/store"; -import { MUDChain } from "@latticexyz/common/chains"; const debug = parentDebug.extend("createStoreSync"); @@ -97,7 +96,11 @@ export async function createStoreSync( filters, initialState, initialBlockLogs, - indexerUrl: indexerUrl ?? (publicClient.chain as MUDChain).indexerUrl, + indexerUrl: + indexerUrl ?? + (publicClient.chain && "indexerUrl" in publicClient.chain && typeof publicClient.chain.indexerUrl === "string" + ? publicClient.chain.indexerUrl + : undefined), }); onProgress?.({