Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Szegoo committed Apr 22, 2024
1 parent 46e6f2a commit 690068b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
13 changes: 6 additions & 7 deletions src/components/Hooks/salePhase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const useSalePhase = () => {

const router = useRouter();
const { network } = router.query;
const blockTime = getBlockTime(network);

const fetchCurrentPhase = useCallback(
async (api: ApiPromise) => {
Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions src/utils/sale/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

Expand Down

0 comments on commit 690068b

Please sign in to comment.