dfinity / dfinity/pic-js

createActor parameters pattern

Open
#46 3 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

Suggestion

I just used pic.createActor for the first time and, I was suprised to notice that the pattern used to pass its parameters is different that other function such as upgradeCanister or setupCanister. Therefore, I would like to suggest, even if it's a breaking change, to modify the signature of the method as follow.

From:

public createActor<T = ActorInterface>(
    interfaceFactory: IDL.InterfaceFactory,
    canisterId: Principal,
  ): Actor<T> {

To something similar to:

public createActor<T = ActorInterface>(
    {interfaceFactory, canisterId}: {
       interfaceFactory: IDL.InterfaceFactory,
       canisterId: Principal,
    }
  ): Actor<T> {

i.e. pass an object as parameter

WDYT?

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

Locate createActor and compare its parameter convention with upgradeCanister and setupCanister, including their existing usages and tests if present. Confirm whether maintainers accept the breaking API change; done means the chosen signature is applied consistently and the relevant checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.