Add Sourcify decorations to BlockTransactions page
This commit is contained in:
parent
dca72a13b4
commit
7102a746b9
@ -9,9 +9,11 @@ import { useFeeToggler } from "../search/useFeeToggler";
|
||||
import { RuntimeContext } from "../useRuntime";
|
||||
import { SelectionContext, useSelection } from "../useSelection";
|
||||
import { pageCollector, useResolvedAddresses } from "../useResolvedAddresses";
|
||||
import { ProcessedTransaction } from "../types";
|
||||
import { ChecksummedAddress, ProcessedTransaction } from "../types";
|
||||
import { PAGE_SIZE } from "../params";
|
||||
import { useMultipleETHUSDOracle } from "../usePriceOracle";
|
||||
import { useAppConfigContext } from "../useAppConfig";
|
||||
import { useMultipleMetadata } from "../useSourcify";
|
||||
|
||||
type BlockTransactionResultsProps = {
|
||||
blockTag: BlockTag;
|
||||
@ -34,6 +36,21 @@ const BlockTransactionResults: React.FC<BlockTransactionResultsProps> = ({
|
||||
const blockTags = useMemo(() => [blockTag], [blockTag]);
|
||||
const priceMap = useMultipleETHUSDOracle(provider, blockTags);
|
||||
|
||||
const addresses = useMemo((): ChecksummedAddress[] => {
|
||||
if (!page) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return page.map((t) => t.to).filter((to): to is string => to !== undefined);
|
||||
}, [page]);
|
||||
const { sourcifySource } = useAppConfigContext();
|
||||
const metadatas = useMultipleMetadata(
|
||||
undefined,
|
||||
addresses,
|
||||
provider?.network.chainId,
|
||||
sourcifySource
|
||||
);
|
||||
|
||||
return (
|
||||
<ContentFrame>
|
||||
<div className="flex justify-between items-baseline py-3">
|
||||
@ -63,6 +80,7 @@ const BlockTransactionResults: React.FC<BlockTransactionResultsProps> = ({
|
||||
resolvedAddresses={resolvedAddresses}
|
||||
feeDisplay={feeDisplay}
|
||||
priceMap={priceMap}
|
||||
metadatas={metadatas}
|
||||
/>
|
||||
))}
|
||||
<div className="flex justify-between items-baseline py-3">
|
||||
|
@ -27,7 +27,7 @@ type TransactionItemProps = {
|
||||
selectedAddress?: string;
|
||||
feeDisplay: FeeDisplay;
|
||||
priceMap: Record<BlockTag, BigNumber>;
|
||||
metadatas?:
|
||||
metadatas:
|
||||
| Record<ChecksummedAddress, Metadata | null | undefined>
|
||||
| undefined;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user