How to query objects after a package upgrade

Is there an efficient way to avoid the need to use both the ORIGINAL_PACKAGE id and the UPGRADED_PACKAGE id ?

If I create objects through an upgraded package, I can only retrieve them with the struct filter by passing in the original package id because an object created through an upgraded package stills create an object of type <original package::type::Type>

      const result = await client.getOwnedObjects({
        owner: account.address,
        filter: {
          StructType: `${original_package}::user::UserProfile`,
        },
        options: {
          showContent: true,
        },
      });
1 Like