diff --git a/src/components/Hooks/salePhase.tsx b/src/components/Hooks/salePhase.tsx index d2cc9c81..700d4712 100644 --- a/src/components/Hooks/salePhase.tsx +++ b/src/components/Hooks/salePhase.tsx @@ -38,7 +38,6 @@ const useSalePhase = () => { const router = useRouter(); const { network } = router.query; - const blockTime = getBlockTime(network); const fetchCurrentPhase = useCallback( async (api: ApiPromise) => { @@ -57,11 +56,11 @@ const useSalePhase = () => { network ); - getBlockTimestamp(api, _saleStart, blockTime).then((value: number) => - setSaleStartTimestamp(value) + getBlockTimestamp(api, _saleStart, getBlockTime(network)).then( + (value: number) => setSaleStartTimestamp(value) ); - getBlockTimestamp(api, _saleEnd, blockTime).then((value: number) => - setSaleEndTimestamp(value) + getBlockTimestamp(api, _saleEnd, getBlockTime(network)).then( + (value: number) => setSaleEndTimestamp(value) ); const progress = getSaleProgress( @@ -91,14 +90,14 @@ const useSalePhase = () => { }, ]); }, - [saleInfo, config, network, blockTime] + [saleInfo, config, network] ); useEffect(() => { if (!api || apiState !== ApiState.READY) return; fetchCurrentPhase(api); - }, [fetchCurrentPhase, api, apiState, network]); + }, [fetchCurrentPhase, api, apiState]); return { currentPhase, diff --git a/src/utils/sale/utils.test.ts b/src/utils/sale/utils.test.ts index 5175b223..82b84771 100644 --- a/src/utils/sale/utils.test.ts +++ b/src/utils/sale/utils.test.ts @@ -79,9 +79,7 @@ describe('Purchase page', () => { describe('getSaleStartInBlocks', () => { it('works', () => { - expect(getSaleStartInBlocks(mockSaleInfo)).toBe( - mockSaleInfo.saleStart - mockConfig.interludeLength - ); + expect(getSaleStartInBlocks(mockSaleInfo)).toBe(mockSaleInfo.saleStart); }); });