3

In the new metadata v14, a types.json is no longer required for custom types. How does this affect the typegen procedure in the docs which require us to specify these types in the definition.ts for each module we declared in runtime before running the types-from-defs script of the @polkadotjs/typegen package (which is required for types-from-metadata)?

1 Answer 1

5

You are correct in that the actual definitions are basically deprecated. However, it does still play a (small) role in that the RPC types are not carried in the metadata. (This will change in the future and is on the issue list in Substrate, but we are not there as of yet.)

For metadata v14 chains, just pass a completely empty types in definitions.ts, i.e. if no extra RPC type overrides and/or no extra RPC endpoints, just leave the types entry blank.

In this case it should generate no extra definitions from the empty types, but will create the lookups and all additional interfaces for augmentation.

(There may be dragons... while is gets used exactly in this fashion in the API itself to generate augmentation for Substrate master, Kusama and Polkadot, some brave early-adopters did have some small hiccups which is detailed in the JS API issues.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.