Skip to content

Dynamic Candid

b3hr4d edited this page Mar 11, 2026 · 1 revision

Dynamic Candid

Use the candid package family when you do not know everything at compile time.

Main Use Cases

  • canister explorers
  • admin tools
  • runtime-selected canisters
  • metadata-driven forms
  • devtools and debugging utilities

Main APIs

CandidAdapter

Fetches Candid source and compiles it into usable definitions.

import { CandidAdapter } from "@ic-reactor/candid"

const adapter = new CandidAdapter({ clientManager })
const definition = await adapter.getCandidDefinition("ryjl3-tyaaa-aaaaa-aaaba-cai")

CandidReactor / CandidDisplayReactor

Runtime reactors that can work without compile-time IDL.

import { CandidDisplayReactor } from "@ic-reactor/candid"

const reactor = new CandidDisplayReactor({
  clientManager,
  canisterId: "ryjl3-tyaaa-aaaaa-aaaba-cai",
  name: "ledger",
})

await reactor.initialize()

MetadataReactor / MetadataDisplayReactor

Use these when you want runtime field metadata, validation hints, and form generation.

Local Compilation

Add @ic-reactor/parser when you want local Candid compilation instead of remote fallback:

await adapter.loadParser()
const jsSource = adapter.compileLocal(candidSource)

When To Use It

Use dynamic candid support only when compile-time declarations are not enough. For normal app code, generated or static reactors are usually simpler.

Clone this wiki locally