cosmosgen

package
v29.0.0-...-a2903dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBufConfig     = errors.New("invalid Buf config")
	ErrMissingSDKDep = errors.New("cosmos-sdk dependency not found")
)

Functions

func DepTools

func DepTools() []string

DepTools necessary tools to build and run the chain.

func Generate

func Generate(ctx context.Context, cacheStorage cache.Storage, appPath, protoDir, gomodPath string, options ...Option) error

Generate generates code from protoDir of an SDK app residing at appPath with given options. protoDir must be relative to the projectPath.

func InstallDepTools

func InstallDepTools(ctx context.Context, appPath string) error

InstallDepTools installs protoc dependencies needed by Cosmos ecosystem.

func MissingTools

func MissingTools(f *ast.File) (missingTools []string)

MissingTools find missing tools import indo a *ast.File.

func React

func React(path string) error

React scaffolds a React app for a chain.

func UnusedTools

func UnusedTools(f *ast.File) (unusedTools []string)

UnusedTools find unused tools import indo a *ast.File.

func Vue

func Vue(path string) error

Vue scaffolds a Vue.js app for a chain.

Types

type ModulePathFunc

type ModulePathFunc func(module.Module) string

ModulePathFunc defines a function type that returns a path based on a Cosmos SDK module.

func ComposableModulePath

func ComposableModulePath(rootPath string) ModulePathFunc

ComposableModulePath generates useQuery hook/composable module paths for Cosmos SDK modules. The root path is used as prefix for the generated paths.

func TypescriptModulePath

func TypescriptModulePath(rootPath string) ModulePathFunc

TypescriptModulePath generates TS module paths for Cosmos SDK modules. The root path is used as prefix for the generated paths.

type Option

type Option func(*generateOptions)

Option configures code generation.

func CollectEvents

func CollectEvents(ev events.Bus) Option

CollectEvents sets an event bus for sending generation feedback events.

func IncludeDirs

func IncludeDirs(dirs []string) Option

IncludeDirs configures the third party proto dirs that used by app's proto. relative to the projectPath.

func UpdateBufModule

func UpdateBufModule() Option

UpdateBufModule enables Buf config proto dependencies update. This option updates app's Buf config when proto packages or Buf modules are found within the Go dependencies.

func WithComposablesGeneration

func WithComposablesGeneration(out ModulePathFunc, composablesRootPath string) Option

func WithGoGeneration

func WithGoGeneration() Option

WithGoGeneration adds protobuf (gogoproto and pulsar) code generation.

func WithHooksGeneration

func WithHooksGeneration(out ModulePathFunc, hooksRootPath string) Option

func WithOpenAPIGeneration

func WithOpenAPIGeneration(out string) Option

WithOpenAPIGeneration adds OpenAPI spec generation.

func WithTSClientGeneration

func WithTSClientGeneration(out ModulePathFunc, tsClientRootPath string, useCache bool) Option

WithTSClientGeneration adds Typescript Client code generation. The tsClientRootPath is used to determine the root path of generated Typescript classes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL