Skip to content

Actor interface upgradeCanister  #47

@peterpeterparker

Description

@peterpeterparker

Feature request

It would be nice to be able to provide an ActorInterface to the upgradeCanister function, similar to setupCanister, and receive an updated actor as a result.

This can notably be useful if the candid declaration changes between version and one want to test an upgrade.

Currently, this can be solved by creating a new actor once the upgrade has been processed. Such a feature would spare few lines of code.

From:

await pic.upgradeCanister({
  canisterId,
  wasm: SATELLITE_WASM_PATH,
  sender: controller.getPrincipal()
});
		
const newActor = pic.createActor<SatelliteActorNEW>(idlFactorSatellite, canisterId);
newActor.setIdentity(controller);

To:

const {actor: newActor} = await pic.upgradeCanister<SatelliteActorNEW>({
  canisterId,
  wasm: SATELLITE_WASM_PATH,
  sender: controller.getPrincipal()
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions