* move over the last prebuilt pages and use nightly * fix lint * update to latest dev * remove log * fix various more things * upgrade to @nightly * fix lister for creating listings * update dependencies to solve token metadata issue
23 lines
650 B
TypeScript
23 lines
650 B
TypeScript
import { contractKeys, networkKeys } from "../cache-keys";
|
|
import { useQuery } from "@tanstack/react-query";
|
|
import {
|
|
PrebuiltContractType,
|
|
SUPPORTED_CHAIN_ID,
|
|
SchemaForPrebuiltContractType,
|
|
} from "@thirdweb-dev/sdk";
|
|
import { z } from "zod";
|
|
|
|
export function useContractMetadataWithAddress(
|
|
address: string,
|
|
queryFn: () => Promise<
|
|
z.infer<SchemaForPrebuiltContractType<PrebuiltContractType>["output"]>
|
|
>,
|
|
chainId: SUPPORTED_CHAIN_ID,
|
|
) {
|
|
return useQuery(
|
|
[...networkKeys.chain(chainId), ...contractKeys.detail(address)],
|
|
() => queryFn(),
|
|
{ enabled: !!address && typeof queryFn === "function" && !!chainId },
|
|
);
|
|
}
|