diff --git a/src/utils/ProviderUtils.ts b/src/utils/ProviderUtils.ts index 6a1297450..be728e0b5 100644 --- a/src/utils/ProviderUtils.ts +++ b/src/utils/ProviderUtils.ts @@ -11,7 +11,7 @@ import { PROVIDER_CACHE_TTL_MODIFIER as ttl_modifier, BLOCK_NUMBER_TTL, } from "../common"; -import { Logger } from "."; +import { delay, Logger } from "./"; const logger = Logger; @@ -71,10 +71,6 @@ class RateLimitedProvider extends ethers.providers.StaticJsonRpcProvider { const defaultTimeout = 60 * 1000; -function delay(s: number): Promise { - return new Promise((resolve) => setTimeout(resolve, Math.round(s * 1000))); -} - function formatProviderError(provider: ethers.providers.StaticJsonRpcProvider, rawErrorText: string) { return `Provider ${provider.connection.url} failed with error: ${rawErrorText}`; } diff --git a/src/utils/TimeUtils.ts b/src/utils/TimeUtils.ts index 14aa18a50..759b9dbd1 100644 --- a/src/utils/TimeUtils.ts +++ b/src/utils/TimeUtils.ts @@ -5,3 +5,7 @@ export function getCurrentTime(): number { return Math.round(Date.now().valueOf() / 1000); } + +export function delay(s: number): Promise { + return new Promise((resolve) => setTimeout(resolve, Math.round(s * 1000))); +}