* refactor(solana): remove support for solana * chore: update @thirdweb-dev/react and @thirdweb-dev/sdk versions * remove unused code & re-update-next-versions * refactor: Remove unused Solana currency metadata * fix build
22 lines
616 B
TypeScript
22 lines
616 B
TypeScript
import { contractKeys, networkKeys } from "../cache-keys";
|
|
import { useQuery } from "@tanstack/react-query";
|
|
import {
|
|
PrebuiltContractType,
|
|
SchemaForPrebuiltContractType,
|
|
} from "@thirdweb-dev/sdk";
|
|
import { z } from "zod";
|
|
|
|
export function useContractMetadataWithAddress(
|
|
address: string,
|
|
queryFn: () => Promise<
|
|
z.infer<SchemaForPrebuiltContractType<PrebuiltContractType>["output"]>
|
|
>,
|
|
chainId: number,
|
|
) {
|
|
return useQuery(
|
|
[...networkKeys.chain(chainId), ...contractKeys.detail(address)],
|
|
() => queryFn(),
|
|
{ enabled: !!address && typeof queryFn === "function" && !!chainId },
|
|
);
|
|
}
|