API to list packages deployed by given address?

Hi Friends!

In current version of RPC API there is a nice feature suix_getOwnedObjects. But is there a way to list in the same manner all packages (and versions!) published by given account?

The motivation is simple - this may allow me to omit configuring package IDs to call on my serverside - I can simply browse them, find necessary ones by module names and lastest version and that’s it!

3 Likes

While I see no direct method yet, I found a kind of suitable workaround:

Use suix_getOwnedObjects to find all UpgradeCap objects, which are created with every package publishing. They contain packageId of the latest version of the packages.

curl -Hcontent-type:application/json https://fullnode.testnet.sui.io \
  -d '{ "jsonrpc":"2.0", "method":"suix_getOwnedObjects","id":1,
        "params":["0xfe261f4ae6ff057818e988e57be9c295ededde6e7f4c05da92ae6139bceae2b8",
           {"filter":{"StructType":"0x2::package::UpgradeCap"},"options":{"showContent":true}}]}' \
  | jq .
4 Likes