Skip to content

API Reference


Interface: CustomCanisterBuilder

Defined in: docs-entry.ts:506

A builder for configuring Custom (pre-compiled Wasm) canisters. Provides a fluent API to set installation arguments, upgrade arguments, and dependencies.

Configuration

Pass a CustomCanisterConfig to canister.custom():

PropertyTypeDescription
wasmstringPath to the pre-compiled Wasm file
candidstringPath to the Candid interface file
canisterIdstring?Optional specific canister ID
settingsCanisterSettings?Initial canister settings

Example

typescript
export const token = canister.custom({
  wasm: "canisters/token.wasm",
  candid: "canisters/token.did"
}).make()

Methods

as()

as<T>(): CustomCanisterBuilder

Defined in: docs-entry.ts:512

Override the canister's service type for typed actor calls.

Type Parameters

Type ParameterDescription
TThe service interface type.

Returns

CustomCanisterBuilder

The builder for chaining.


deps()

deps<D>(deps): CustomCanisterBuilder

Defined in: docs-entry.ts:542

Declare dependencies on other canisters or tasks. Dependencies are executed before this canister and their results are available in installArgs.

  • CanisterScope: Uses its deploy task. Result contains { canisterId, actor }.
  • Task: Uses the task directly. Result is whatever the task returns.

Type Parameters

Type Parameter
D extends Record<string, Scope | Task>

Parameters

ParameterTypeDescription
depsDRecord of canister scopes or tasks this canister depends on.

Returns

CustomCanisterBuilder

The builder for chaining.


installArgs()

installArgs(argsOrFn): CustomCanisterBuilder

Defined in: docs-entry.ts:521

Set the canister installation arguments. Accepts a plain value, a sync function, or an async function.

Parameters

ParameterTypeDescription
argsOrFnunknown[] | (args) => unknown[] | Promise<unknown[]>The install arguments, or a function that returns them.

Returns

CustomCanisterBuilder

The builder for chaining.


make()

make(): CustomCanisterScope

Defined in: docs-entry.ts:554

Finalize and create the canister scope.

Returns

CustomCanisterScope

The canister scope with all configured tasks (deploy, build, install, etc.).


upgradeArgs()

upgradeArgs(argsOrFn): CustomCanisterBuilder

Defined in: docs-entry.ts:530

Set the canister upgrade arguments. Accepts a plain value, a sync function, or an async function.

Parameters

ParameterTypeDescription
argsOrFnunknown[] | (args) => unknown[] | Promise<unknown[]>The upgrade arguments, or a function that returns them.

Returns

CustomCanisterBuilder

The builder for chaining.