From c26e803d7970a892af17f7cf583e68cca4ce1472 Mon Sep 17 00:00:00 2001 From: alexandermendes Date: Wed, 13 Nov 2024 21:57:36 +0000 Subject: [PATCH] refactor: kill duplicate function --- src/utils/staking.ts | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/utils/staking.ts b/src/utils/staking.ts index 8bac2ca..ef95c38 100644 --- a/src/utils/staking.ts +++ b/src/utils/staking.ts @@ -5,6 +5,7 @@ import { type AuroraNetworkConfig } from '../types/network.js'; import { logger } from '../logger.js'; import { isDefined } from './is-defined.js'; import { StreamSchedule } from '../types/stream.js'; +import { getScheduleStartAndEndTimes } from './schedule.js'; export const getDeposit = async ( account: string, @@ -194,24 +195,6 @@ export const getStreamsSchedule = async ( }); }; -const getScheduleStartAndEndTimes = (schedule: StreamSchedule) => { - const startTime = schedule.scheduleTimes[0]; - const endTime = schedule.scheduleTimes[schedule.scheduleTimes.length - 1]; - - if (!isDefined(startTime)) { - throw new Error('Invalid schedule: start time not found'); - } - - if (!isDefined(endTime)) { - throw new Error('Invalid schedule: end time not found'); - } - - return { - startTime: startTime.toNumber() * 1000, - endTime: endTime.toNumber() * 1000, - }; -}; - export const getStreamsProgress = ( streamsSchedule: StreamSchedule[], ): number[] => {