Rename type

This commit is contained in:
Willian Mitsuda 2021-10-30 21:10:15 -03:00
parent b8eea08f4d
commit 60ead1ba49
3 changed files with 7 additions and 7 deletions

View File

@ -3,7 +3,7 @@ import { IAddressResolver } from "./address-resolver";
import { CompositeAddressResolver } from "./CompositeAddressResolver";
import { ENSAddressResolver } from "./ENSAddressResolver";
export type ENSReverseCache = Record<string, string>;
export type ResolvedAddresses = Record<string, string>;
// Create and configure the main resolver
const _mainResolver = new CompositeAddressResolver();
@ -14,14 +14,14 @@ export const mainResolver: IAddressResolver = _mainResolver;
export const batchPopulate = async (
provider: BaseProvider,
addresses: string[]
): Promise<ENSReverseCache> => {
): Promise<ResolvedAddresses> => {
const solvers: Promise<string | undefined>[] = [];
for (const a of addresses) {
solvers.push(mainResolver.resolveAddress(provider, a));
}
const results = await Promise.all(solvers);
const cache: ENSReverseCache = {};
const cache: ResolvedAddresses = {};
for (let i = 0; i < results.length; i++) {
const r = results[i];
if (r === undefined) {

View File

@ -18,11 +18,11 @@ import { ProcessedTransaction } from "../types";
import { FeeDisplay } from "./useFeeToggler";
import { formatValue } from "../components/formatter";
import ETH2USDValue from "../components/ETH2USDValue";
import { ENSReverseCache } from "../api/address-resolver";
import { ResolvedAddresses } from "../api/address-resolver";
type TransactionItemProps = {
tx: ProcessedTransaction;
ensCache?: ENSReverseCache;
ensCache?: ResolvedAddresses;
selectedAddress?: string;
feeDisplay: FeeDisplay;
priceMap: Record<BlockTag, BigNumber>;

View File

@ -1,13 +1,13 @@
import { useState, useEffect } from "react";
import { JsonRpcProvider } from "@ethersproject/providers";
import { ProcessedTransaction } from "./types";
import { batchPopulate, ENSReverseCache } from "./api/address-resolver";
import { batchPopulate, ResolvedAddresses } from "./api/address-resolver";
export const useENSCache = (
provider?: JsonRpcProvider,
page?: ProcessedTransaction[]
) => {
const [reverseCache, setReverseCache] = useState<ENSReverseCache>();
const [reverseCache, setReverseCache] = useState<ResolvedAddresses>();
useEffect(() => {
if (!provider || !page) {