Skip to content

feat(scripts): Flexible TypeScript code generation command for smart contract types #85

Open
@Unique-Divine

Description

@Unique-Divine

Summary

Provide a simplified abstraction around CosmWasm/ts-codegen. This should be usable from the top-level justfile.

  • Make a command that runs ts-codegen for everything to an output dir like dist.
  • ci: Add a manually runnable workflow to publish TypeScript code intended for app.nibiru.fi.

Intent / Motivation

  • Dev X and Reduced Complexity: Simplifying the interactions with ts-codegen will help eliminate the need to remember or input intricate command specifics.

  • Unified Output Directory: Centralizing generated code into a directory like dist fosters organization and ensures uniformity across the repo.

  • Better Publishing: A publishing workflow for the TypeScript code will simplify the process of sharing or distributing the generated code, reducing manual steps and potential errors.

Basic Usage for Getting Started

Install

npm install -g @cosmwasm/ts-codegen

Generating a client

# Template: Using the "client" plugin
cosmwasm-ts-codegen generate \
          --plugin client \
          --schema [path-to-schema-dir] \
          --out [path-to-ts-out-dir] \
          --name [contract-crate-name] \
          --no-bundle

# Example: Using the "client" plugin
cosmwasm-ts-codegen generate \
          --plugin client \
          --schema ./schema \
          --out ./ts \
          --name SG721 \
          --no-bundle

Generally, everything we need is some variation on cosmwasm-ts-codegen generate

Metadata

Metadata

Assignees

Labels

scope: scriptsScope in the conventional commit sense is a noun describing the section of the codebase.type: enhancementNew feature or request

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions