CanisterTarget
CanisterTarget = {
id:string;name?:never;certified?:boolean;timeoutMs?:number; } | {name:string;id?:never;certified?:boolean;timeoutMs?:number; }
Defined in: core/src/types.ts:248
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 aTypeErrorthat names it, when the canister is made.{ name }: read from the cookie’sPUBLIC_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 rejectsinvalid_argswith code"canister_id_unresolved"and sends nothing, and keys carry"$unresolved:<name>"in place of the id.certified: truemakes another canister object, whosequerymethods are sent as replicated calls so that their replies are certified, and whose keys end in"certified". Acomposite_queryhas no certified path: on such a canister its direct call rejectsinvalid_args(code"no_certified_path") andqueryOptionsthrows aTypeError.timeoutMsbounds how long each call made through the canister object waits for its answer, from the moment it is called: its direct calls, its reads made withqueryOptions, its mutations (unlessmutationOptionsgives its own), andclient.time()on it. Without it, a request that gets no HTTP answer waits as long as thefetchin use does. When it passes, the call rejects with code"timeout":cancelledwithmayHaveExecuted: falsefor a read, and for a write before its request went out; a write whose request went out (an{ update: "idempotent" }read’s included), or a re-send of a writeclient.resendOf()offered at any point, rejectsoutcome_unknownwithmayHaveExecuted: true, an unknown outcome to reconcile (read the state back, orclient.resendOf()with this same canister object), never one to send again blindly. Nothing is sent again for it, and the request itself is not torn down: only the waiting stops. A number of milliseconds from 1 to 2147483647; anything else throws aTypeError. AnothertimeoutMsmakes another canister object, with the same keys: a read observed through two of them is bounded by the options TanStack Query was given last.