diff --git a/src/lib/web3/hooks/useIndexer.ts b/src/lib/web3/hooks/useIndexer.ts index f2af1bfb8..f5737b714 100644 --- a/src/lib/web3/hooks/useIndexer.ts +++ b/src/lib/web3/hooks/useIndexer.ts @@ -275,16 +275,14 @@ function useIndexerStream< DataSet = BaseDataSet >( url: URL | string | undefined, - IndexerClass: typeof IndexerStreamAccumulateSingleDataSet, - opts?: StreamOptions + IndexerClass: typeof IndexerStreamAccumulateSingleDataSet ): StaleWhileRevalidateState; function useIndexerStream< DataRow extends BaseDataRow, DataSet = BaseDataSet >( url: URL | string | undefined, - IndexerClass: typeof IndexerStreamAccumulateDualDataSet, - opts?: StreamOptions + IndexerClass: typeof IndexerStreamAccumulateDualDataSet ): StaleWhileRevalidateState; function useIndexerStream< DataRow extends BaseDataRow, @@ -293,8 +291,7 @@ function useIndexerStream< url: URL | string | undefined, IndexerClass: | typeof IndexerStreamAccumulateSingleDataSet - | typeof IndexerStreamAccumulateDualDataSet, - opts?: StreamOptions + | typeof IndexerStreamAccumulateDualDataSet ): StaleWhileRevalidateState { const [dataset, setDataSet] = useState(); const [isValidating, setIsValidating] = useState(false); @@ -304,23 +301,19 @@ function useIndexerStream< useEffect(() => { if (url) { setIsValidating(true); - const stream = new IndexerClass( - url, - { - onAccumulated: (dataSet) => { - // note: the TypeScript here is a bit hacky but this should be ok - setDataSet(dataSet as unknown as DataSet | DataSet[]); - }, - onCompleted: () => setIsValidating(false), - onError: (error) => setError(error), + const stream = new IndexerClass(url, { + onAccumulated: (dataSet) => { + // note: the TypeScript here is a bit hacky but this should be ok + setDataSet(dataSet as unknown as DataSet | DataSet[]); }, - opts - ); + onCompleted: () => setIsValidating(false), + onError: (error) => setError(error), + }); return () => { stream.unsubscribe(); }; } - }, [IndexerClass, opts, url]); + }, [IndexerClass, url]); return { data: dataset, isValidating, error }; } @@ -329,11 +322,10 @@ function useIndexerStream< export function useIndexerStreamOfSingleDataSet< DataRow extends BaseDataRow, DataSet = BaseDataSet ->(url: URL | string | undefined, opts?: StreamOptions) { +>(url: URL | string | undefined) { return useIndexerStream( url, - IndexerStreamAccumulateSingleDataSet, - opts + IndexerStreamAccumulateSingleDataSet ); } @@ -344,8 +336,7 @@ export function useIndexerStreamOfDualDataSet< >(url: URL | string | undefined, opts?: StreamOptions) { return useIndexerStream( url, - IndexerStreamAccumulateDualDataSet, - opts + IndexerStreamAccumulateDualDataSet ); }