dfinity / dfinity/pic-js

Actor interface upgradeCanister

Open
#47 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
10
Forks
13
Avg merge
4h 41m
Merged PRs (30d)
1

Description

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()
});

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the existing upgradeCanister and setupCanister entry points and their related tests. Add support for the ActorInterface generic and return an updated actor from upgradeCanister, then verify the shown upgrade flow works when the candid declaration changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.