Skip to content

@joystream/types upgrade step 1 - normalization and polkadot/api ^1.26.0 compatibility #1118

@Lezek123

Description

@Lezek123

First part of the @joystream/types upgrade (before the runtime is ready) will consist of:

  • Upgrading all Struct and Enum types to use our JoyEnum / JoyStruct wrappers. The reasonsing behind this is that:
    • We have to change all of those anyway, because thier constructors will now take another argument (Registry), so it makes sense to use this as an opportunity to perform further normalization.
    • This should greatly simplify implementing similar changes in the future
    • Should also simplify decorating the api with auto-generated type definitions based on runtime metadata (which we can implement at some point, see: https://polkadot.js.org/api/examples/promise/90_typegen)
    • Save time and code - no need to specify our own getters each time, since we can just use the ones that come from Struct.with and create one shared TypeScript interface that will take care of those
    • Allow us to preserve as much backward compatibility as we need now
    • Allow us to possibly introduce some other helpful methods/interfaces for all Structs / Enums (which we use a lot) at once
  • Using Tuple.with(), Vec.with() etc. whenever possible (avoid having to specify constructors on our side for same reasons as mentioned above)
  • Changing some import paths and other minor adjustments related to the removal / renaming of some @polkadot/types
  • Updating all other functions / methods / constructors that will now need Registry in order to do their job
  • Make @joystream/types just export the RegistryTypes that we can then pass as argument when creating the api (since this is the recommended way to handle this now) instead of registering them "gloablly" with registerJoystreamTypes

The goal is to:

  • Make @joystream/types build with the new versions of dependencies
  • Make them much more normalized and ready for future improvements (ie. https://polkadot.js.org/api/examples/promise/90_typegen related)
  • Make them as backwards-compatible as possible for now to save time needed to upgrade Pioneer, CLI, network tests, storage node, status server etc. in Alexandria

Metadata

Metadata

Assignees

Labels

estimate-12hTime estimation for issues in a project - 12h

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions