polkadot-js / docs

This is the documentation portal for all Polkadot and Substrate related tools and libraries in the polkadot-js family of repos.
https://polkadot.js.org/docs/
Creative Commons Zero v1.0 Universal
164 stars 200 forks source link

Add JSON export guide to typegen docs #7

Open apopiak opened 4 years ago

apopiak commented 4 years ago

It would be great to have instructions on how to (quickly) generate polkadot-js types to json for development purposes.

e.g. something similar to the following script we created together:

const edgewareDefinitions = require('./dist/definitions.js');

console.log(edgewareDefinitions);

const types = Object
  .values(edgewareDefinitions)
  .reduce((res, { types }) => ({ ...res, ...types }), {});

console.log(JSON.stringify(types));

and add it here (or similar).

jacogr commented 3 years ago

Updated doc link for the "here" above - https://polkadot.js.org/docs/api/examples/promise/typegen/#packages