Skip to main content

Generate types for your app

The polywrap CLI's codegen command interacts with an App Manifest to automatically generate wrapper types in the language of your application.

App Manifest content#

The App Manifest contains the name of the project, the programming language used to write it, and the location of the wrapper schema that states which code to generate. It can optionally contain an array of URI Redirects.

format: # The manifest format version
name: # Name of project
language: # App programming language
schema: # Path to wrapper schema
import_redirects: # (Optional) Array of URI redirects
- uri: # Source URI to be redirected
schema: # Path to schema of the module to which URI will be redirected

Wrapper Schema for apps#

To automatically generate types for an application or test suite, we must tell the Polywrap CLI which types to generate. This is done using a Wrapper Schema.

In your wrapper schema, you can add an import statement for each wrapper you're using in your project. You can use the * syntax to import a wrapper's module and all of its types, or you can list the types you'd like to use.

Wrapper schema for the Hello World app
#import * into HelloWorld from "ens/helloworld.polytest.eth"

Learn more about schema imports at Wrapper Schema.