Skip to content
IC Reactor

CanisterTarget

CanisterTarget = { id: string; name?: never; certified?: boolean; } | { name: string; id?: never; certified?: boolean; }

Defined in: core/src/types.ts:172

Which canister client.canister() calls: by its id, or by the name the ic_env cookie gives it.

  • { id }: principal text. Text that is not a canonical principal throws a TypeError that names it, when the canister is made.
  • { name }: read from the cookie’s PUBLIC_CANISTER_ID:<name> entry when a call or a key is built, and only where the network trusts the cookie. Unresolved (on a server, on an untrusted host, or with no such entry), every call rejects invalid_args with code "canister_id_unresolved" and sends nothing, and keys carry "$unresolved:<name>" in place of the id.
  • certified: true makes another canister object, whose query methods are sent as replicated calls so that their replies are certified, and whose keys end in "certified". A composite_query has no certified path: on such a canister its direct call rejects invalid_args (code "no_certified_path") and queryOptions throws a TypeError.