Update type generation section#445
Conversation
|
This assumes that the user of the type-gen library is running an ESM project, whereas some teams still may be stuck with CJS. It makes more sense to split out the instructions into two sets (for each ESM / CJS) given both are admirably being supported. |
|
We also have CJS, but currently we are focusing on the ESM release. Could you please show me how to use CJS for typegen? I've tried different things, but I haven't been successful. Thank you. |
|
Thanks this help me a bit getting it up and running. Although still having the following issues. Any ideas how to resolve them? Found this PR while reading through the issues for typegen in 10.x . Is this even an ERROR as it's stated, And when typechecking with tsc, I have a bunch of |
|
@peetzweg I no longer use tsc; instead, I am using tsx, and the process has become more seamless as we exclusively utilize ESM. The structural setup is as follows: Next, within interfaces/definitions.ts, you must export these definitions. Once this setup is complete and you have a metadata.json file, execute the following commands: "npx tsx node_modules/.bin/polkadot-types-from-defs --package @mangata-finance/types/interfaces --input src/interfaces --endpoint metadata.json",
"npx tsx node_modules/.bin/polkadot-types-from-chain --package @mangata-finance/types/interfaces --endpoint metadata.json --output src/interfaces"
I hope it will help you. If you have any other question feel free to ask. Or you can show the repo and I can help you more. |

I would like to update this page because it is no longer functional in the new version 10.+
According to this issue, this is the only correct way to generate those types. An example can be found here.
I can also update the GitHub repository associated with this page to ensure everything is up to date. Please let me know if this is acceptable or if any additional actions are required on my part. Thank you!