Skip to content

Commit

Permalink
chore: revert change for another PR
Browse files Browse the repository at this point in the history
  • Loading branch information
james-a-morris committed Oct 11, 2023
1 parent 18f1d65 commit cc236b7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/utils/BlockUtils.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { getProvider, getRedis, isDefined, setRedisKey, shouldCache } from "./";
import { utils as sdkUtils } from "@across-protocol/sdk-v2";
import { BlockFinder } from "@uma/financial-templates-lib";
import { Block, getProvider, getRedis, isDefined, setRedisKey, shouldCache } from "./";

const blockFinders: { [chainId: number]: sdkUtils.BlockFinder } = {};
const blockFinders: { [chainId: number]: BlockFinder<Block> } = {};

/**
* @notice Return block finder for chain. Loads from in memory blockFinder cache if this function was called before
* for this chain ID. Otherwise creates a new block finder and adds it to the cache.
* @param chainId
* @returns
*/
export async function getBlockFinder(chainId: number): Promise<sdkUtils.BlockFinder> {
export async function getBlockFinder(chainId: number): Promise<BlockFinder<Block>> {
if (!isDefined(blockFinders[chainId])) {
const providerForChain = await getProvider(chainId);
blockFinders[chainId] = new sdkUtils.BlockFinder(providerForChain);
blockFinders[chainId] = new BlockFinder<Block>(providerForChain.getBlock.bind(providerForChain), [], chainId);
}
return blockFinders[chainId];
}
Expand All @@ -29,7 +29,7 @@ export async function getBlockFinder(chainId: number): Promise<sdkUtils.BlockFin
export async function getBlockForTimestamp(
chainId: number,
timestamp: number,
blockFinder?: sdkUtils.BlockFinder
blockFinder?: BlockFinder<Block>
): Promise<number> {
blockFinder ??= await getBlockFinder(chainId);
const redisClient = await getRedis();
Expand Down

0 comments on commit cc236b7

Please sign in to comment.