Open peterpeterparker opened 6 months ago
A propos, maybe would also be interesting to add an optional identity to the parameters - e.g. this is how I had to use it:
const newActor = pic.createActor<SatelliteActor>(idlFactorSatellite, canisterId);
newActor.setIdentity(controller);
My thinking here was that less than 3 paramters didn't justify an object as a parameter, but I can see how this feels inconsistent with the vast majority of public methods that have 3 or more parameters and hence have an object as a parameter.
The identity parameter is a nice suggestion too. I'll take a look at both next week and report back.
Thanks for the suggestion!
I have to add that I enforce object for all parameters in my projects for maintability reason and to prevent unexpected runtime error (when no candid or library such as Zod is used), so that's probably also why I was suprised. Definitely just a suggestion.
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 asupgradeCanister
orsetupCanister
. Therefore, I would like to suggest, even if it's a breaking change, to modify the signature of the method as follow.From:
To something similar to:
i.e. pass an object as parameter
WDYT?