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

Function getBytecodeQueryOptions

packages/core/src/query/getBytecode.ts:18–36  ·  view source on GitHub ↗
(
  config: config,
  options: GetBytecodeOptions<config> = {},
)

Source from the content-addressed store, hash-verified

16>
17
18export function getBytecodeQueryOptions<config extends Config>(
19 config: config,
20 options: GetBytecodeOptions<config> = {},
21) {
22 return {
23 async queryFn({ queryKey }) {
24 const { address, scopeKey: _, ...parameters } = queryKey[1]
25 if (!address) throw new Error('address is required')
26 const bytecode = await getBytecode(config, { ...parameters, address })
27 return (bytecode ?? null) as any
28 },
29 queryKey: getBytecodeQueryKey(options),
30 } as const satisfies QueryOptions<
31 GetBytecodeQueryFnData,
32 GetBytecodeErrorType,
33 GetBytecodeData,
34 GetBytecodeQueryKey<config>
35 >
36}
37export type GetBytecodeQueryFnData = GetBytecodeReturnType
38
39export type GetBytecodeData = GetBytecodeQueryFnData

Callers 3

useBytecodeFunction · 0.90
useBytecodeFunction · 0.90

Calls 1

getBytecodeQueryKeyFunction · 0.85

Tested by

no test coverage detected