SubQuery simplifies and ensures type-safety when working with GraphQL entities, actions, and transactions.
yarn codegen
npm run-script codegen
This action will generate a new directory (or update the existing one) named src/types
. Inside this directory, you will find automatically generated entity classes corresponding to each type defined in your schema.graphql
. These classes facilitate type-safe operations for loading, reading, and writing entity fields. You can learn more about this process in the GraphQL Schema section.
If you've expressed a preference to employ the Cosmos message based on the provided proto files, this command will also generate types for your listed protobufs and save them into src/types
directory, providing you with more typesafety. For example, you can find Osmosis' protobuf definitions in the official documentation. Read about how this is done in Cosmos Codegen from CosmWasm Protobufs and Cosmos Manifest File Configuration.
Now that you have made essential changes to the GraphQL Schema file, let’s go ahead with the next configuration.