Small refactorings
This commit is contained in:
parent
2e04c726d7
commit
c40e653bef
|
@ -123,12 +123,12 @@ const AddressTransactionResults: React.FC<AddressTransactionResultsProps> = ({
|
||||||
}
|
}
|
||||||
return _addresses;
|
return _addresses;
|
||||||
}, [address, page]);
|
}, [address, page]);
|
||||||
const { sourcifySource } = useAppConfigContext();
|
|
||||||
const deduped = useDedupedAddresses(addresses);
|
const deduped = useDedupedAddresses(addresses);
|
||||||
const checked = useAddressesWithCode(provider, deduped);
|
const contracts = useAddressesWithCode(provider, deduped);
|
||||||
|
const { sourcifySource } = useAppConfigContext();
|
||||||
const metadatas = useMultipleMetadata(
|
const metadatas = useMultipleMetadata(
|
||||||
undefined,
|
undefined,
|
||||||
checked,
|
contracts,
|
||||||
provider?.network.chainId,
|
provider?.network.chainId,
|
||||||
sourcifySource
|
sourcifySource
|
||||||
);
|
);
|
||||||
|
|
|
@ -47,12 +47,12 @@ const BlockTransactionResults: React.FC<BlockTransactionResultsProps> = ({
|
||||||
|
|
||||||
return page.map((t) => t.to).filter((to): to is string => to !== undefined);
|
return page.map((t) => t.to).filter((to): to is string => to !== undefined);
|
||||||
}, [page]);
|
}, [page]);
|
||||||
const { sourcifySource } = useAppConfigContext();
|
|
||||||
const deduped = useDedupedAddresses(addresses);
|
const deduped = useDedupedAddresses(addresses);
|
||||||
const checked = useAddressesWithCode(provider, deduped);
|
const contracts = useAddressesWithCode(provider, deduped);
|
||||||
|
const { sourcifySource } = useAppConfigContext();
|
||||||
const metadatas = useMultipleMetadata(
|
const metadatas = useMultipleMetadata(
|
||||||
undefined,
|
undefined,
|
||||||
checked,
|
contracts,
|
||||||
provider?.network.chainId,
|
provider?.network.chainId,
|
||||||
sourcifySource
|
sourcifySource
|
||||||
);
|
);
|
||||||
|
|
|
@ -132,12 +132,10 @@ export const useSingleMetadata = (
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useDedupedAddresses = (
|
export const useDedupedAddresses = (
|
||||||
addresses: (ChecksummedAddress | undefined)[]
|
addresses: ChecksummedAddress[]
|
||||||
): ChecksummedAddress[] => {
|
): ChecksummedAddress[] => {
|
||||||
return useMemo(() => {
|
return useMemo(() => {
|
||||||
const deduped = new Set(
|
const deduped = new Set(addresses);
|
||||||
addresses.filter((a): a is ChecksummedAddress => a !== undefined)
|
|
||||||
);
|
|
||||||
return [...deduped];
|
return [...deduped];
|
||||||
}, [addresses]);
|
}, [addresses]);
|
||||||
};
|
};
|
||||||
|
|
|
@ -101,12 +101,12 @@ const Details: React.FC<DetailsProps> = ({
|
||||||
}
|
}
|
||||||
return _addresses;
|
return _addresses;
|
||||||
}, [txData]);
|
}, [txData]);
|
||||||
const { sourcifySource } = useAppConfigContext();
|
|
||||||
const deduped = useDedupedAddresses(addresses);
|
const deduped = useDedupedAddresses(addresses);
|
||||||
const checked = useAddressesWithCode(provider, deduped);
|
const contracts = useAddressesWithCode(provider, deduped);
|
||||||
|
const { sourcifySource } = useAppConfigContext();
|
||||||
const metadatas = useMultipleMetadata(
|
const metadatas = useMultipleMetadata(
|
||||||
undefined,
|
undefined,
|
||||||
checked,
|
contracts,
|
||||||
provider?.network.chainId,
|
provider?.network.chainId,
|
||||||
sourcifySource
|
sourcifySource
|
||||||
);
|
);
|
||||||
|
|
|
@ -35,12 +35,12 @@ const Logs: React.FC<LogsProps> = ({ txData, metadata, resolvedAddresses }) => {
|
||||||
[txData]
|
[txData]
|
||||||
);
|
);
|
||||||
const { provider } = useContext(RuntimeContext);
|
const { provider } = useContext(RuntimeContext);
|
||||||
const { sourcifySource } = useAppConfigContext();
|
|
||||||
const deduped = useDedupedAddresses(logAddresses);
|
const deduped = useDedupedAddresses(logAddresses);
|
||||||
const checked = useAddressesWithCode(provider, deduped);
|
const contracts = useAddressesWithCode(provider, deduped);
|
||||||
|
const { sourcifySource } = useAppConfigContext();
|
||||||
const metadatas = useMultipleMetadata(
|
const metadatas = useMultipleMetadata(
|
||||||
baseMetadatas,
|
baseMetadatas,
|
||||||
checked,
|
contracts,
|
||||||
provider?.network.chainId,
|
provider?.network.chainId,
|
||||||
sourcifySource
|
sourcifySource
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue