Feature Request
Depends on caffeinelabs/motoko#6016. Alternatively use a softlink and --actor-idl.
Problem
When a Motoko canister uses ic:aaaaa-aa URL imports (e.g. to call the IC management canister directly), moc requires either:
--actor-idl <dir> pointing to a directory containing aaaaa-aa.did, or
--actor-id-alias aaaaa-aa aaaaa-aa <did-path> (available since moc 1.4.1)
Today, dfx handles this automatically by bundling the management canister's DID and passing the flag to moc. However, when using mops as the build driver (e.g. via the @dfinity/motoko icp-cli recipe, or mops test), neither flag is passed, so ic:aaaaa-aa imports fail with a compiler error.
Proposed Solution
mops should:
-
Bundle ic.did — include the IC management canister Candid interface (from https://raw.githubusercontent.com/dfinity/portal/refs/heads/master/docs/references/_attachments/ic.did) alongside the toolchain/moc binary it manages.
-
Automatically inject --actor-id-alias aaaaa-aa aaaaa-aa <bundled-ic.did> into every moc invocation — so that ic:aaaaa-aa imports just work, the same way dfx handles it today.
Why in mops?
- mops already manages the
moc binary version via mops toolchain — it's the natural place to also manage the IC system DID that moc needs.
- This makes the
ic:aaaaa-aa import pattern work uniformly across all build toolchains that delegate to mops, without requiring each recipe or build script to find and pass the DID path themselves.
- The
moc-flags escape hatch (documented in mops.toml but currently unimplemented) could serve as a fallback for overrides, but the common case should work out of the box.
Alternatives Considered
- Recipe-level fix: The
@dfinity/motoko icp-cli recipe could add --actor-id-alias, but it would need to know where ic.did lives — which brings the same bundling question back.
--actor-idl directory: The older approach works but requires a directory symlink/copy setup; --actor-id-alias (moc ≥ 1.4.1) is cleaner.
- Inline type definitions: The generated code can avoid the
ic:aaaaa-aa import by inlining the management canister types — but this is a workaround, not a fix, and loses the benefits of the canonical interface.
References
Feature Request
Depends on caffeinelabs/motoko#6016. Alternatively use a softlink and
--actor-idl.Problem
When a Motoko canister uses
ic:aaaaa-aaURL imports (e.g. to call the IC management canister directly),mocrequires either:--actor-idl <dir>pointing to a directory containingaaaaa-aa.did, or--actor-id-alias aaaaa-aa aaaaa-aa <did-path>(available since moc 1.4.1)Today,
dfxhandles this automatically by bundling the management canister's DID and passing the flag tomoc. However, when usingmopsas the build driver (e.g. via the@dfinity/motokoicp-cli recipe, ormops test), neither flag is passed, soic:aaaaa-aaimports fail with a compiler error.Proposed Solution
mopsshould:Bundle
ic.did— include the IC management canister Candid interface (from https://raw.githubusercontent.com/dfinity/portal/refs/heads/master/docs/references/_attachments/ic.did) alongside the toolchain/moc binary it manages.Automatically inject
--actor-id-alias aaaaa-aa aaaaa-aa <bundled-ic.did>into everymocinvocation — so thatic:aaaaa-aaimports just work, the same waydfxhandles it today.Why in mops?
mocbinary version viamops toolchain— it's the natural place to also manage the IC system DID thatmocneeds.ic:aaaaa-aaimport pattern work uniformly across all build toolchains that delegate to mops, without requiring each recipe or build script to find and pass the DID path themselves.moc-flagsescape hatch (documented inmops.tomlbut currently unimplemented) could serve as a fallback for overrides, but the common case should work out of the box.Alternatives Considered
@dfinity/motokoicp-cli recipe could add--actor-id-alias, but it would need to know whereic.didlives — which brings the same bundling question back.--actor-idldirectory: The older approach works but requires a directory symlink/copy setup;--actor-id-alias(moc ≥ 1.4.1) is cleaner.ic:aaaaa-aaimport by inlining the management canister types — but this is a workaround, not a fix, and loses the benefits of the canonical interface.References
moc --help(1.4.1):--actor-id-alias <alias> <principal> <did-path> actor import alias with explicit IDL path