Quickstart
Follow the instructions below to generate a new Typescript package that you can publish to npm.
First, install telescope:
npm install -g @cosmology/telescopeGenerate
Use the generate command to create a new package.
telescope generate
cd ./your-new-project
yarnAdd Protobufs
If you have .proto files, simply add them to a ./proto folder.
However, if you want to get started quickly using existing protos from our registry, simply use the install command.
telescope installIt's not necessary, but you may also specify specific packages, e.g.
telescope install @protobufs/osmosisTranspile
To create the Typescript files, run the transpile command.
telescope transpileYou should now see some .ts files generated in ./src. These are the real source files used in your application.
Examples:
# Telescope takes chain1 folder as input,
# and generate files in 'gen/src' folder.
telescope transpile --protoDirs ../../__fixtures__/chain1 --outPath gen/src# Telescope takes chain1 folder as input,
# and generate files in 'gen/src' folder using default telescope options.
telescope transpile --protoDirs ../../__fixtures__/chain1 --outPath gen/src --useDefaults# Telescope takes chain1 folder(from args) and chain2 folder(from config) as input,
# and generate files in 'gen/src'(defined in the config file, will override outPath in args) folder using a config file.
# Note: --config will override --useDefaults.
telescope transpile --protoDirs ../../__fixtures__/chain1 --config .telescope.json# Telescope takes more than one config. The config afterward will override those in front. In this case values in .telescope-ext.json will override those in .telescope.json.
telescope transpile --config .telescope.json --config .telescope-ext.json//.telescope.json
{
"protoDirs": [
"../../fixtures/chain2"
],
"outPath": "gen/src",
"options": {
// telescope options
...
}
}Build
Finally, run install and buidl to generate the JS and types for publishing your module to npm.
yarn install
yarn buidlNow you should have code inside of your ./src folder, ready for publishing via npm publish. Or, if you used the defaults, you can start developing and your code can be imported from ./src/codegen;