Couple questions on package upgrade

Dear Friends, Hi!

  1. If package is upgraded, is there any magic-function (like init) called in action to perform necessary secondary custom actions?

  2. If I know the packageId of some package, can I find (presumably via API) the packageId of the next version, if it was upgraded?

3 Likes
  1. So, at this time, there is no automagic function run on an upgrade
  2. Yes, the package current version can be reviewed via api (like getObject)
  3. You also get version information on the UpgradeCap object for the package (if you have that)
3 Likes

Hi Frank, thanks a lot, you are really fast :slight_smile:

About “2” probably I poorly expressed myself. Suppose that:

  • some package was published, resulting in version-1 and packageId-1
  • then it was upgraded, resulting in version-2 and packageId-2
  • now, if I have only packageId-1 how can I find out there exists packageId-2?

I think I found some workaround - to do getOwnedObjects browsing UpgradeCaps among them, then find the specific UpgradeCap linked to packageId-1 and execute queryTransactionBlocks with InputObject filter referencing that UpgradeCap object… But perhaps there is something little more straightforward?

3 Likes

Ok, yes… that approach is best as there is no explicit ‘getXXX’ without some anchor about the package ID. UpgradeCaps seem best.

3 Likes