MCPcopy Create free account
hub / github.com/MiloOweno/vector-mesh / useBytecode

Function useBytecode

packages/react/src/hooks/useBytecode.ts:39–57  ·  view source on GitHub ↗
(
  parameters: UseBytecodeParameters<config, selectData> = {},
)

Source from the content-addressed store, hash-verified

37
38/** https://wagmi.sh/react/api/hooks/useBytecode */
39export function useBytecode<
40 config extends Config = ResolvedRegister['config'],
41 selectData = GetBytecodeData,
42>(
43 parameters: UseBytecodeParameters<config, selectData> = {},
44): UseBytecodeReturnType<selectData> {
45 const { address, query = {} } = parameters
46
47 const config = useConfig(parameters)
48 const chainId = useChainId({ config })
49
50 const options = getBytecodeQueryOptions(config, {
51 ...parameters,
52 chainId: parameters.chainId ?? chainId,
53 })
54 const enabled = Boolean(address && (query.enabled ?? true))
55
56 return useQuery({ ...query, ...options, enabled })
57}

Callers 2

Calls 4

getBytecodeQueryOptionsFunction · 0.90
useConfigFunction · 0.70
useChainIdFunction · 0.70
useQueryFunction · 0.50

Tested by

no test coverage detected