Skip to content
IC Reactor

Metadata Reactor Capabilities

This browser-only demo showcases MetadataReactor capabilities using a local IDL service definition, so it can run without a live canister.

  • Generate runtime input metadata with getInputMeta() and getAllInputMeta()
  • Generate runtime output metadata with getOutputMeta() and getAllOutputMeta()
  • Build dynamic variable references with buildMethodVariableCandidates()
  • Hydrate form values from hex-encoded Candid args with buildForMethod()
  • Resolve rich method outputs with metadata-driven resolvers
import type { MetadataReactor } from "@ic-reactor/candid"
import { IDL } from "@icp-sdk/core/candid"
const toHex = (bytes: Uint8Array): string =>
Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("")
async function inspectMethod(
reactor: MetadataReactor,
methodName: string,
argTypes: IDL.Type[],
args: unknown[],
sampleOutputs: Record<string, unknown>
) {
const inputMeta = reactor.getInputMeta(methodName)
const outputMeta = reactor.getOutputMeta(methodName)
const variableCandidates = reactor.buildMethodVariableCandidates(methodName)
const candidArgsHex = toHex(IDL.encode(argTypes, args))
const hydrated = await reactor.buildForMethod(methodName, { candidArgsHex })
const resolved = outputMeta?.resolve(sampleOutputs[methodName])
}