JoshOrndorff / substrate-recipes

A Hands-On Cookbook for Aspiring Blockchain Chefs
GNU General Public License v3.0
380 stars 184 forks source link

Question: How can I generate "types.json" file in each pallets ? #446

Open CocDap opened 3 years ago

CocDap commented 3 years ago

When I read recipes code or others substrate code. I saw that in every pallets has types.json. types.json contains information about storage when we declare in decl_module!. I dont know how to generate it (Although I find and know a file " aggrerate_types.json" that generate types.json, I dont how to execute that file )

Can anyone help me and explain why we generate that files and what we do? Thanks you so much

JoshOrndorff commented 3 years ago

In recipes they aren't generated; they are written by hand. I don't know of a general process to generate them. But here is some info about how to convert your own Rust types into the corresponding json type definitions.

https://polkadot.js.org/docs/api/start/types.basics https://polkadot.js.org/docs/api/start/types.extend

https://github.com/polkadot-js/apps/blob/master/packages/page-settings/src/md/basics.md#developer

CocDap commented 3 years ago

Thanks for replying soon. Thank you very much