Rename type
This commit is contained in:
parent
b8eea08f4d
commit
60ead1ba49
|
@ -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) {
|
||||
|
|
|
@ -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>;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue