* various released contract improvements * fix contract image stuff * fix link * try it with readonlyRpc setup * try it with default polygon * add note
18 lines
488 B
TypeScript
18 lines
488 B
TypeScript
import { useQueryWithNetwork } from "@3rdweb-sdk/react/hooks/query/useQueryWithNetwork";
|
|
import { useSDK } from "@thirdweb-dev/react";
|
|
|
|
export function useContractSources(contractAddress?: string) {
|
|
const sdk = useSDK();
|
|
return useQueryWithNetwork(
|
|
["contract-sources", contractAddress],
|
|
async () => {
|
|
return await sdk
|
|
?.getPublisher()
|
|
.fetchContractSourcesFromAddress(contractAddress || "");
|
|
},
|
|
{
|
|
enabled: !!contractAddress,
|
|
},
|
|
);
|
|
}
|