Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regenerate types and update @polkadot dependencies #3

Merged
merged 10 commits into from
Apr 29, 2024

Conversation

ebma
Copy link
Member

@ebma ebma commented Apr 29, 2024

Closes #2.

What I did

  • Bump the polkadot dependencies to the latest version found here.
  • Run yarn update-metadata to update the local metadata files. This command will run this script which by default queries the metadata from Foucoco. This is okay as we generally assume that Foucoco receives the updates first which are later rolled out also on the other chains. So by choosing Foucoco, we'll always have the very latest metadata and thus type info available.
  • Run yarn build to try and generate the new types based on the new metadata. This command fails at first because we manually need to change something afterward. The error message will tell us what conflicts we need to solve.

In this case, we get the following errors:

types/src/registry/pendulum.ts:283:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'SpacewalkPrimitivesCurrencyId' must be of type 'SpacewalkPrimitivesCurrencyId', but here has type 'SpacewalkPrimitivesCurrencyId'.

283     SpacewalkPrimitivesCurrencyId: SpacewalkPrimitivesCurrencyId;
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  types/src/registry/interfaces.ts:1093:5
    1093     SpacewalkPrimitivesCurrencyId: SpacewalkPrimitivesCurrencyId;
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'SpacewalkPrimitivesCurrencyId' was also declared here.

types/src/registry/pendulum.ts:291:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'SpacewalkPrimitivesVaultCurrencyPair' must be of type 'SpacewalkPrimitivesVaultCurrencyPair', but here has type 'SpacewalkPrimitivesVaultCurrencyPair'.

291     SpacewalkPrimitivesVaultCurrencyPair: SpacewalkPrimitivesVaultCurrencyPair;
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  types/src/registry/interfaces.ts:1094:5
    1094     SpacewalkPrimitivesVaultCurrencyPair: SpacewalkPrimitivesVaultCurrencyPair;
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'SpacewalkPrimitivesVaultCurrencyPair' was also declared here.

types/src/registry/pendulum.ts:292:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'SpacewalkPrimitivesVaultId' must be of type 'SpacewalkPrimitivesVaultId', but here has type 'SpacewalkPrimitivesVaultId'.

292     SpacewalkPrimitivesVaultId: SpacewalkPrimitivesVaultId;
        ~~~~~~~~~~~~~~~~~~~~~~~~~~

  types/src/registry/interfaces.ts:1095:5
    1095     SpacewalkPrimitivesVaultId: SpacewalkPrimitivesVaultId;
             ~~~~~~~~~~~~~~~~~~~~~~~~~~
    'SpacewalkPrimitivesVaultId' was also declared here.

This is because the types we define for the vault registry here are not matching the rest of the metadata anymore as they don't contain the new 'Token' type. That's why we follow this note in the README and copy the generated values from the lookup file here back into vaultRegistry.ts. The type issue is now fixed and we can run yarn build again to rebuild also the rest of the files.

@ebma ebma linked an issue Apr 29, 2024 that may be closed by this pull request
@ebma ebma requested a review from Sharqiewicz April 29, 2024 09:22
@ebma ebma merged commit 17ee1ae into main Apr 29, 2024
3 checks passed
@ebma ebma deleted the 2-regenerate-types-after-new-rpc-calls-are-included branch April 29, 2024 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regenerate types after new RPC calls are included
1 participant