on eba9d63 help sign in
bridge/src/lib/utils/roller.ts
19 lines 648 B history raw
1export const SECOND = 1000;
2export const MINUTE = SECOND * 60;
3export const HOUR = MINUTE * 60;
5export const padZero = (amount: number) =>
6 `${amount < 10 && amount > 0 ? '0' : ''}${amount}`;
8export const getTimeToNextBatch = (nextBatch: number, now: number) => {
9 const toNext = nextBatch - now;
10 const hours = Math.floor(toNext / HOUR);
11 const minutes = Math.floor((toNext - hours * HOUR) / MINUTE);
12 const seconds = Math.floor(
13 (toNext - hours * HOUR - minutes * MINUTE) / SECOND
14 );
16 return `${padZero(hours)}h ${padZero(minutes)}m ${padZero(seconds)}s`;
17};
19export const isL2 = (dom?: string) => dom === 'l2' || dom === 'spawn';