From 646928d16e00da13ed55ec22e9907de4e145e8c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20G=C3=B6ktu=C4=9F=20=C3=96ZT=C3=9CRK?= Date: Tue, 2 Mar 2021 22:49:57 -0800 Subject: [PATCH 01/10] codegen(vuex): add Vuex code generation & refactor code generation related packages. --- starport/pkg/cmdrunner/cmdrunner.go | 14 - starport/pkg/cmdrunner/exec/exec.go | 78 ++++ starport/pkg/cosmosanalysis/module/message.go | 84 ++++ starport/pkg/cosmosanalysis/module/module.go | 209 ++++----- .../pkg/cosmosanalysis/module/module_test.go | 81 ++-- starport/pkg/cosmosgen/cosmosgen.go | 104 +++++ starport/pkg/cosmosgen/generate.go | 326 +------------- starport/pkg/cosmosgen/generate_go.go | 62 +++ starport/pkg/cosmosgen/generate_javascript.go | 273 ++++++++++++ starport/pkg/cosmosgen/template.go | 44 ++ .../templates/{ => js}/client.ts.tpl | 0 .../cosmosgen/templates/vuex/loader.ts.tpl | 27 ++ .../pkg/cosmosgen/templates/vuex/store.ts.tpl | 112 +++++ starport/pkg/nodetime/sta/sta.go | 4 +- starport/pkg/nodetime/tsc/tsc.go | 4 +- starport/pkg/protoanalysis/protoanalysis.go | 48 ++- starport/pkg/protoc/protoc.go | 20 +- starport/services/chain/build.go | 13 +- starport/services/scaffolder/init.go | 13 +- .../cosmos-sdk/cosmos.bank.v1beta1/index.d.ts | 135 ++++++ .../cosmos-sdk/cosmos.bank.v1beta1/index.js | 227 ++++++++++ .../cosmos-sdk/cosmos.bank.v1beta1/index.ts | 224 ++++++++++ .../cosmos-sdk/cosmos.bank.v1beta1/vuex-root | 0 .../cosmos.crisis.v1beta1/index.d.ts | 42 ++ .../cosmos-sdk/cosmos.crisis.v1beta1/index.js | 82 ++++ .../cosmos-sdk/cosmos.crisis.v1beta1/index.ts | 95 +++++ .../cosmos.crisis.v1beta1/vuex-root | 0 .../cosmos.distribution.v1beta1/index.d.ts | 196 +++++++++ .../cosmos.distribution.v1beta1/index.js | 301 +++++++++++++ .../cosmos.distribution.v1beta1/index.ts | 292 +++++++++++++ .../module/index.d.ts | 8 +- .../module/index.js | 12 +- .../module/index.ts | 12 +- .../cosmos.distribution.v1beta1/vuex-root | 0 .../cosmos.evidence.v1beta1/index.d.ts | 64 +++ .../cosmos.evidence.v1beta1/index.js | 119 ++++++ .../cosmos.evidence.v1beta1/index.ts | 127 ++++++ .../cosmos.evidence.v1beta1/vuex-root | 0 .../cosmos-sdk/cosmos.gov.v1beta1/index.d.ts | 149 +++++++ .../cosmos-sdk/cosmos.gov.v1beta1/index.js | 253 +++++++++++ .../cosmos-sdk/cosmos.gov.v1beta1/index.ts | 247 +++++++++++ .../cosmos.gov.v1beta1/module/index.d.ts | 4 +- .../cosmos.gov.v1beta1/module/index.js | 6 +- .../cosmos.gov.v1beta1/module/index.ts | 6 +- .../cosmos-sdk/cosmos.gov.v1beta1/vuex-root | 0 .../cosmos.slashing.v1beta1/index.d.ts | 85 ++++ .../cosmos.slashing.v1beta1/index.js | 144 +++++++ .../cosmos.slashing.v1beta1/index.ts | 150 +++++++ .../cosmos.slashing.v1beta1/vuex-root | 0 .../cosmos.staking.v1beta1/index.d.ts | 252 +++++++++++ .../cosmos.staking.v1beta1/index.js | 399 ++++++++++++++++++ .../cosmos.staking.v1beta1/index.ts | 379 +++++++++++++++++ .../cosmos.staking.v1beta1/module/index.d.ts | 12 +- .../cosmos.staking.v1beta1/module/index.js | 18 +- .../cosmos.staking.v1beta1/module/index.ts | 18 +- .../cosmos.staking.v1beta1/vuex-root | 0 .../cosmos.vesting.v1beta1/index.d.ts | 58 +++ .../cosmos.vesting.v1beta1/index.js | 93 ++++ .../cosmos.vesting.v1beta1/index.ts | 105 +++++ .../cosmos.vesting.v1beta1/vuex-root | 0 .../ibc.applications.transfer.v1/index.d.ts | 79 ++++ .../ibc.applications.transfer.v1/index.js | 140 ++++++ .../ibc.applications.transfer.v1/index.ts | 146 +++++++ .../ibc.applications.transfer.v1/vuex-root | 0 .../cosmos-sdk/ibc.core.channel.v1/index.d.ts | 226 ++++++++++ .../cosmos-sdk/ibc.core.channel.v1/index.js | 399 ++++++++++++++++++ .../cosmos-sdk/ibc.core.channel.v1/index.ts | 376 +++++++++++++++++ .../ibc.core.channel.v1/module/index.d.ts | 24 +- .../ibc.core.channel.v1/module/index.js | 36 +- .../ibc.core.channel.v1/module/index.ts | 36 +- .../cosmos-sdk/ibc.core.channel.v1/vuex-root | 0 .../cosmos-sdk/ibc.core.client.v1/index.d.ts | 127 ++++++ .../cosmos-sdk/ibc.core.client.v1/index.js | 211 +++++++++ .../cosmos-sdk/ibc.core.client.v1/index.ts | 210 +++++++++ .../cosmos-sdk/ibc.core.client.v1/vuex-root | 0 .../ibc.core.connection.v1/index.d.ts | 121 ++++++ .../ibc.core.connection.v1/index.js | 207 +++++++++ .../ibc.core.connection.v1/index.ts | 206 +++++++++ .../ibc.core.connection.v1/module/index.d.ts | 8 +- .../ibc.core.connection.v1/module/index.js | 12 +- .../ibc.core.connection.v1/module/index.ts | 12 +- .../ibc.core.connection.v1/vuex-root | 0 .../stargate/vue/src/store/chain/index.d.ts | 15 + .../app/stargate/vue/src/store/chain/index.js | 48 ++- .../app/stargate/vue/src/store/chain/index.ts | 49 +++ starport/templates/typed/new_stargate.go | 2 +- 86 files changed, 7908 insertions(+), 612 deletions(-) create mode 100644 starport/pkg/cmdrunner/exec/exec.go create mode 100644 starport/pkg/cosmosanalysis/module/message.go create mode 100644 starport/pkg/cosmosgen/cosmosgen.go create mode 100644 starport/pkg/cosmosgen/generate_go.go create mode 100644 starport/pkg/cosmosgen/generate_javascript.go create mode 100644 starport/pkg/cosmosgen/template.go rename starport/pkg/cosmosgen/templates/{ => js}/client.ts.tpl (100%) create mode 100644 starport/pkg/cosmosgen/templates/vuex/loader.ts.tpl create mode 100644 starport/pkg/cosmosgen/templates/vuex/store.ts.tpl create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/index.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/index.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/index.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/index.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/index.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/chain/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/chain/index.ts diff --git a/starport/pkg/cmdrunner/cmdrunner.go b/starport/pkg/cmdrunner/cmdrunner.go index 449468725c..946e1ec7b6 100644 --- a/starport/pkg/cmdrunner/cmdrunner.go +++ b/starport/pkg/cmdrunner/cmdrunner.go @@ -1,13 +1,11 @@ package cmdrunner import ( - "bytes" "context" "io" "os" "os/exec" - "github.com/pkg/errors" "github.com/tendermint/starport/starport/pkg/cmdrunner/step" "golang.org/x/sync/errgroup" ) @@ -189,15 +187,3 @@ func (r *Runner) newCommand(s *step.Step) Executor { } return &cmdSignal{c, w} } - -// Exec executes a command with args, it's a shortcut func for basic command executions. -func Exec(ctx context.Context, command string, args ...string) error { - errb := &bytes.Buffer{} - - err := New( - DefaultStderr(errb)). - Run(ctx, - step.New(step.Exec(command, args...))) - - return errors.Wrap(err, errb.String()) -} diff --git a/starport/pkg/cmdrunner/exec/exec.go b/starport/pkg/cmdrunner/exec/exec.go new file mode 100644 index 0000000000..e12f76d2e7 --- /dev/null +++ b/starport/pkg/cmdrunner/exec/exec.go @@ -0,0 +1,78 @@ +// Package exec provides easy access to command execution for basic uses. +package exec + +import ( + "bytes" + "context" + "fmt" + "strings" + + "github.com/pkg/errors" + "github.com/tendermint/starport/starport/pkg/cmdrunner" + "github.com/tendermint/starport/starport/pkg/cmdrunner/step" +) + +type execConfig struct { + stepOptions []step.Option + includeStdLogsToError bool +} + +type Option func(*execConfig) + +func StepOption(o step.Option) Option { + return func(c *execConfig) { + c.stepOptions = append(c.stepOptions, o) + } +} + +func IncludeStdLogsToError() Option { + return func(c *execConfig) { + c.includeStdLogsToError = true + } +} + +// Exec executes a command with args, it's a shortcut func for basic command executions. +func Exec(ctx context.Context, fullCommand []string, options ...Option) error { + errb := &bytes.Buffer{} + logs := &bytes.Buffer{} + + c := &execConfig{ + stepOptions: []step.Option{ + step.Exec(fullCommand[0], fullCommand[1:]...), + step.Stdout(logs), + step.Stderr(errb), + }, + } + + for _, apply := range options { + apply(c) + } + + err := cmdrunner.New().Run(ctx, step.New(c.stepOptions...)) + if err != nil { + return &Error{ + Err: errors.Wrap(err, errb.String()), + Command: fullCommand[0], + StdLogs: logs.String(), + includeStdLogsToError: c.includeStdLogsToError, + } + } + + return nil +} + +// Error provides detailed errors from the executed program. +type Error struct { + Err error + Command string + StdLogs string // collected logs from code generation tools. + includeStdLogsToError bool +} + +func (e *Error) Error() string { + message := fmt.Sprintf("error while running command %s: %s", e.Command, e.Err.Error()) + if e.includeStdLogsToError && strings.TrimSpace(e.StdLogs) != "" { + return fmt.Sprintf("%s\n\n%s", message, e.StdLogs) + } + return message +} diff --git a/starport/pkg/cosmosanalysis/module/message.go b/starport/pkg/cosmosanalysis/module/message.go new file mode 100644 index 0000000000..0e071f3ae4 --- /dev/null +++ b/starport/pkg/cosmosanalysis/module/message.go @@ -0,0 +1,84 @@ +package module + +import ( + "go/ast" + "go/parser" + "go/token" +) + +// DiscoverMessages discovers sdk messages defined in a module that resides under modulePath. +func DiscoverMessages(modulePath string) (msgs []string, err error) { + // parse go packages/files under modulePath. + fset := token.NewFileSet() + + pkgs, err := parser.ParseDir(fset, modulePath, nil, 0) + if err != nil { + return nil, err + } + + // collect all structs under modulePath to find out the ones that satisfy requirements. + structs := make(map[string]requirements) + + for _, pkg := range pkgs { + for _, f := range pkg.Files { + ast.Inspect(f, func(n ast.Node) bool { + // look for struct methods. + fdecl, ok := n.(*ast.FuncDecl) + if !ok { + return true + } + + // not a method. + if fdecl.Recv == nil { + return true + } + + // fname is the name of method. + fname := fdecl.Name.Name + + // find the struct name that method belongs to. + t := fdecl.Recv.List[0].Type + sident, ok := t.(*ast.Ident) + if !ok { + sexp, ok := t.(*ast.StarExpr) + if !ok { + return true + } + sident = sexp.X.(*ast.Ident) + } + sname := sident.Name + + // mark the requirement that this struct satisfies. + if _, ok := structs[sname]; !ok { + structs[sname] = newRequirements() + } + + structs[sname][fname] = true + + return true + }) + } + } + + // checkRequirements checks if all requirements are satisfied. + checkRequirements := func(r requirements) bool { + for _, ok := range r { + if !ok { + return false + } + } + return true + } + + for name, reqs := range structs { + if checkRequirements(reqs) { + msgs = append(msgs, name) + } + } + + if len(msgs) == 0 { + return nil, ErrModuleNotFound + } + + return msgs, nil +} diff --git a/starport/pkg/cosmosanalysis/module/module.go b/starport/pkg/cosmosanalysis/module/module.go index 754c7ac08d..ae56ea2fb6 100644 --- a/starport/pkg/cosmosanalysis/module/module.go +++ b/starport/pkg/cosmosanalysis/module/module.go @@ -3,9 +3,6 @@ package module import ( "errors" "fmt" - "go/ast" - "go/parser" - "go/token" "path/filepath" "strings" @@ -44,6 +41,12 @@ type Module struct { // Msg is a list of sdk.Msg implementation of the module. Msgs []Msg + + // Queries is a list of module queries. + Queries []Query + + // Types is a list of proto types that might be used by module. + Types []Type } // Msg keeps metadata about an sdk.Msg implementation. @@ -58,6 +61,27 @@ type Msg struct { FilePath string } +// Query is an sdk Query. +type Query struct { + // Name of the RPC func. + Name string + + // FullName of the query with service name and rpc func name. + FullName string +} + +// Type is a proto type that might be used by module. +type Type struct { + Name string + + // FilePath is the path of the .proto file where message is defined at. + FilePath string +} + +type moduleDiscoverer struct { + sourcePath, basegopath string +} + // Discover discovers and returns modules and their types that implements sdk.Msg. // sourcePath is the root path of an sdk blockchain. // @@ -74,144 +98,125 @@ func Discover(sourcePath string) ([]Module, error) { if err != nil { return nil, err } - basegopath := gm.Module.Mod.Path + + md := &moduleDiscoverer{ + sourcePath: sourcePath, + basegopath: gm.Module.Mod.Path, + } // find proto packages that belong to modules under x/. - pkgs, err := findModuleProtoPkgs(sourcePath, basegopath) + pkgs, err := md.findModuleProtoPkgs() if err != nil { return nil, err } var modules []Module - // discover discovers and sdk module by a proto pkg. - discover := func(pkg protoanalysis.Package) error { - pkgrelpath := strings.TrimPrefix(pkg.GoImportPath(), basegopath) - pkgpath := filepath.Join(sourcePath, pkgrelpath) - - msgs, err := DiscoverModule(pkgpath) - if err == ErrModuleNotFound { - return nil - } + for _, pkg := range pkgs { + m, err := md.discover(pkg) if err != nil { - return err - } - - var ( - spname = strings.Split(pkg.Name, ".") - m = Module{ - Name: spname[len(spname)-1], - Pkg: pkg, - } - ) - - for _, msg := range msgs { - pkgmsg, err := pkg.MessageByName(msg) - if err != nil { // no msg found in the proto defs corresponds to discovered sdk message. - return nil - } - - m.Msgs = append(m.Msgs, Msg{ - Name: msg, - URI: fmt.Sprintf("%s.%s", pkg.Name, msg), - FilePath: pkgmsg.Path, - }) + return nil, err } modules = append(modules, m) - - return nil - } - - for _, pkg := range pkgs { - if err := discover(pkg); err != nil { - return nil, err - } } return modules, nil } -// DiscoverModule discovers sdk messages defined in a module that resides under modulePath. -func DiscoverModule(modulePath string) (msgs []string, err error) { - // parse go packages/files under modulePath. - fset := token.NewFileSet() +// discover discovers and sdk module by a proto pkg. +func (d *moduleDiscoverer) discover(pkg protoanalysis.Package) (Module, error) { + pkgrelpath := strings.TrimPrefix(pkg.GoImportPath(), d.basegopath) + pkgpath := filepath.Join(d.sourcePath, pkgrelpath) - pkgs, err := parser.ParseDir(fset, modulePath, nil, 0) + msgs, err := DiscoverMessages(pkgpath) + if err == ErrModuleNotFound { + return Module{}, nil + } if err != nil { - return nil, err + return Module{}, nil } - // collect all structs under modulePath to find out the ones that satisfy requirements. - structs := make(map[string]requirements) - - for _, pkg := range pkgs { - for _, f := range pkg.Files { - ast.Inspect(f, func(n ast.Node) bool { - // look for struct methods. - fdecl, ok := n.(*ast.FuncDecl) - if !ok { - return true - } - - // not a method. - if fdecl.Recv == nil { - return true - } - - // fname is the name of method. - fname := fdecl.Name.Name - - // find the struct name that method belongs to. - t := fdecl.Recv.List[0].Type - sident, ok := t.(*ast.Ident) - if !ok { - sexp, ok := t.(*ast.StarExpr) - if !ok { - return true - } - sident = sexp.X.(*ast.Ident) - } - sname := sident.Name + namesplit := strings.Split(pkg.Name, ".") + m := Module{ + Name: namesplit[len(namesplit)-1], + Pkg: pkg, + } - // mark the requirement that this struct satisfies. - if _, ok := structs[sname]; !ok { - structs[sname] = newRequirements() - } + // fill sdk Msgs. + for _, msg := range msgs { + pkgmsg, err := pkg.MessageByName(msg) + if err != nil { // no msg found in the proto defs corresponds to discovered sdk message. + return Module{}, nil + } - structs[sname][fname] = true + m.Msgs = append(m.Msgs, Msg{ + Name: msg, + URI: fmt.Sprintf("%s.%s", pkg.Name, msg), + FilePath: pkgmsg.Path, + }) + } - return true - }) + // isType whether if protomsg can be added as an any Type to Module. + isType := func(protomsg protoanalysis.Message) bool { + // do not use GenesisState type. + if protomsg.Name == "GenesisState" { + return false } - } - // checkRequirements checks if all requirements are satisfied. - checkRequirements := func(r requirements) bool { - for _, ok := range r { - if !ok { + // do not use if an SDK message. + for _, msg := range msgs { + if msg == protomsg.Name { return false } } + + // do not use if used as a request/return type type of an RPC. + for _, s := range pkg.Services { + for _, q := range s.RPCFuncs { + if q.RequestType == protomsg.Name || q.ReturnsType == protomsg.Name { + return false + } + } + } + return true } - for name, reqs := range structs { - if checkRequirements(reqs) { - msgs = append(msgs, name) + // fill types. + for _, protomsg := range pkg.Messages { + if !isType(protomsg) { + continue } + + m.Types = append(m.Types, Type{ + Name: protomsg.Name, + FilePath: protomsg.Path, + }) } - if len(msgs) == 0 { - return nil, ErrModuleNotFound + // fill queries. + for _, s := range pkg.Services { + for _, q := range s.RPCFuncs { + fullName := s.Name + q.Name + // cannot have a msg and query with the same name. + // if there is, this must be due to there is a Msg service definition. + if _, err := pkg.MessageByName(fullName); err == nil { + continue + } + m.Queries = append(m.Queries, Query{ + Name: q.Name, + FullName: fullName, + }) + } } - return msgs, nil + return m, nil } -func findModuleProtoPkgs(sourcePath, bpath string) ([]protoanalysis.Package, error) { +func (d *moduleDiscoverer) findModuleProtoPkgs() ([]protoanalysis.Package, error) { // find out all proto packages inside blockchain. - allprotopkgs, err := protoanalysis.DiscoverPackages(sourcePath) + allprotopkgs, err := protoanalysis.DiscoverPackages(d.sourcePath) if err != nil { return nil, err } @@ -219,7 +224,7 @@ func findModuleProtoPkgs(sourcePath, bpath string) ([]protoanalysis.Package, err // filter out proto packages that do not represent x/ modules of blockchain. var xprotopkgs []protoanalysis.Package for _, pkg := range allprotopkgs { - if !strings.HasPrefix(pkg.GoImportName, bpath) { + if !strings.HasPrefix(pkg.GoImportName, d.basegopath) { continue } diff --git a/starport/pkg/cosmosanalysis/module/module_test.go b/starport/pkg/cosmosanalysis/module/module_test.go index 30a67688ef..527f119b29 100644 --- a/starport/pkg/cosmosanalysis/module/module_test.go +++ b/starport/pkg/cosmosanalysis/module/module_test.go @@ -5,36 +5,59 @@ import ( ) func ExampleDiscover() { - pretty.Println(Discover("/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon")) + pretty.Println(Discover("/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars")) // outputs: // []module.Module{ - // { - // Name: "moon", - // Pkg: protoanalysis.Package{ - // Name: "test.moon.moon", - // Path: "/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon", - // GoImportName: "github.com/test/moon/x/moon/types", - // Messages: { - // {Name:"GenesisState", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon/genesis.proto"}, - // {Name:"GenesisState", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon/genesis.proto"}, - // {Name:"QueryGetUserRequest", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon/query.proto"}, - // {Name:"QueryGetUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon/query.proto"}, - // {Name:"QueryAllUserRequest", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon/query.proto"}, - // {Name:"QueryAllUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon/query.proto"}, - // {Name:"MsgCreateUser", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon/tx.proto"}, - // {Name:"MsgCreateUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon/tx.proto"}, - // {Name:"MsgUpdateUser", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon/tx.proto"}, - // {Name:"MsgUpdateUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon/tx.proto"}, - // {Name:"MsgDeleteUser", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon/tx.proto"}, - // {Name:"MsgDeleteUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon/tx.proto"}, - // {Name:"User", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon/user.proto"}, - // }, - // }, - // Msgs: { - // {Name:"MsgUpdateUser", URI:"test.moon.moon.MsgUpdateUser", FilePath:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon/tx.proto"}, - // {Name:"MsgDeleteUser", URI:"test.moon.moon.MsgDeleteUser", FilePath:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon/tx.proto"}, - // {Name:"MsgCreateUser", URI:"test.moon.moon.MsgCreateUser", FilePath:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/moon/proto/moon/tx.proto"}, - // }, - // }, + // { + // Name: "mars", + // Pkg: protoanalysis.Package{ + // Name: "tendermint.mars.mars", + // Path: "/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars", + // GoImportName: "github.com/tendermint/mars/x/mars/types", + // Messages: { + // {Name:"GenesisState", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/genesis.proto"}, + // {Name:"User", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/user.proto"}, + // {Name:"MsgCreateUser", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // {Name:"MsgCreateUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // {Name:"MsgUpdateUser", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // {Name:"MsgUpdateUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // {Name:"MsgDeleteUser", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // {Name:"MsgDeleteUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // {Name:"QueryGetUserRequest", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/query.proto"}, + // {Name:"QueryGetUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/query.proto"}, + // {Name:"QueryAllUserRequest", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/query.proto"}, + // {Name:"QueryAllUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/query.proto"}, + // }, + // Services: { + // { + // Name: "Msg", + // RPCFuncs: { + // {Name:"CreateUser", RequestType:"MsgCreateUser", ReturnsType:"MsgCreateUserResponse"}, + // {Name:"UpdateUser", RequestType:"MsgUpdateUser", ReturnsType:"MsgUpdateUserResponse"}, + // {Name:"DeleteUser", RequestType:"MsgDeleteUser", ReturnsType:"MsgDeleteUserResponse"}, + // }, + // }, + // { + // Name: "Query", + // RPCFuncs: { + // {Name:"User", RequestType:"QueryGetUserRequest", ReturnsType:"QueryGetUserResponse"}, + // {Name:"UserAll", RequestType:"QueryAllUserRequest", ReturnsType:"QueryAllUserResponse"}, + // }, + // }, + // }, + // }, + // Msgs: { + // {Name:"MsgUpdateUser", URI:"tendermint.mars.mars.MsgUpdateUser", FilePath:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // {Name:"MsgDeleteUser", URI:"tendermint.mars.mars.MsgDeleteUser", FilePath:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // {Name:"MsgCreateUser", URI:"tendermint.mars.mars.MsgCreateUser", FilePath:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // }, + // Queries: { + // {Name:"User", FullName:"QueryUser"}, + // {Name:"UserAll", FullName:"QueryUserAll"}, + // }, + // Types: { + // {Name:"User", FilePath:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/user.proto"}, + // }, + // }, // } nil } diff --git a/starport/pkg/cosmosgen/cosmosgen.go b/starport/pkg/cosmosgen/cosmosgen.go new file mode 100644 index 0000000000..c67b9bb98d --- /dev/null +++ b/starport/pkg/cosmosgen/cosmosgen.go @@ -0,0 +1,104 @@ +package cosmosgen + +import ( + "context" + + "github.com/tendermint/starport/starport/pkg/cosmosanalysis/module" + gomodmodule "golang.org/x/mod/module" +) + +// generateOptions used to configure code generation. +type generateOptions struct { + includeDirs []string + gomodPath string + jsOut func(module.Module) string + jsIncludeThirdParty bool + vuexStoreRootPath string +} + +// TODO add WithInstall. + +// Option configures code generation. +type Option func(*generateOptions) + +// WithJSGeneration adds JS code generation. out hook is called for each module to +// retrieve the path that should be used to place generated js code inside for a given module. +// if includeThirdPartyModules set to true, code generation will be made for the 3rd party modules +// used by the app -including the SDK- as well. +func WithJSGeneration(includeThirdPartyModules bool, out func(module.Module) (path string)) Option { + return func(o *generateOptions) { + o.jsOut = out + o.jsIncludeThirdParty = includeThirdPartyModules + } +} + +// WithVuexGeneration adds Vuex code generation. storeRootPath is used to determine the root path of generated +// Vuex stores. includeThirdPartyModules and out configures the underlying JS lib generation which is +// documented in WithJSGeneration. +func WithVuexGeneration(includeThirdPartyModules bool, out func(module.Module) (path string), storeRootPath string) Option { + return func(o *generateOptions) { + o.jsOut = out + o.jsIncludeThirdParty = includeThirdPartyModules + o.vuexStoreRootPath = storeRootPath + } +} + +// WithGoGeneration adds Go code generation. +func WithGoGeneration(gomodPath string) Option { + return func(o *generateOptions) { + o.gomodPath = gomodPath + } +} + +// IncludeDirs configures the third party proto dirs that used by app's proto. +// relative to the projectPath. +func IncludeDirs(dirs []string) Option { + return func(o *generateOptions) { + o.includeDirs = dirs + } +} + +// generator generates code for sdk and sdk apps. +type generator struct { + ctx context.Context + appPath string + protoDir string + o *generateOptions + deps []gomodmodule.Version +} + +// Generate generates code from protoDir of an SDK app residing at appPath with given options. +// protoDir must be relative to the projectPath. +func Generate(ctx context.Context, appPath, protoDir string, options ...Option) error { + g := &generator{ + ctx: ctx, + appPath: appPath, + protoDir: protoDir, + o: &generateOptions{}, + } + + for _, apply := range options { + apply(g.o) + } + + if err := g.setup(); err != nil { + return err + } + + if g.o.gomodPath != "" { + if err := g.generateGo(); err != nil { + return err + } + } + + // js generation requires Go types to be existent in the source code. because + // sdk.Msg implementations defined on the generated Go types. + // so it needs to run after Go code gen. + if g.o.jsOut != nil { + if err := g.generateJS(); err != nil { + return err + } + } + + return nil +} diff --git a/starport/pkg/cosmosgen/generate.go b/starport/pkg/cosmosgen/generate.go index e1b791ff5b..d9ab5f2dd6 100644 --- a/starport/pkg/cosmosgen/generate.go +++ b/starport/pkg/cosmosgen/generate.go @@ -1,149 +1,17 @@ package cosmosgen import ( - "context" - "embed" - "io/ioutil" - "os" "path/filepath" "strings" - "text/template" - "github.com/iancoleman/strcase" - "github.com/otiai10/copy" - "github.com/pkg/errors" "github.com/tendermint/starport/starport/pkg/cmdrunner" "github.com/tendermint/starport/starport/pkg/cmdrunner/step" "github.com/tendermint/starport/starport/pkg/cosmosanalysis/module" "github.com/tendermint/starport/starport/pkg/gomodule" - "github.com/tendermint/starport/starport/pkg/nodetime/sta" - tsproto "github.com/tendermint/starport/starport/pkg/nodetime/ts-proto" - "github.com/tendermint/starport/starport/pkg/nodetime/tsc" - "github.com/tendermint/starport/starport/pkg/protoanalysis" - "github.com/tendermint/starport/starport/pkg/protoc" "github.com/tendermint/starport/starport/pkg/protopath" - gomodmodule "golang.org/x/mod/module" - "golang.org/x/sync/errgroup" ) -var ( - goOuts = []string{ - "--gocosmos_out=plugins=interfacetype+grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:.", - "--grpc-gateway_out=logtostderr=true:.", - } - - tsOut = []string{ - "--ts_proto_out=.", - } - - openAPIOut = []string{ - "--openapiv2_out=logtostderr=true,allow_merge=true:.", - } - - sdkImport = "github.com/cosmos/cosmos-sdk" -) - -//go:embed templates/* -var templates embed.FS - -// tpl holds the js client template which is for wrapping the generated protobufjs types and rest client, -// utilizing cosmjs' type registry, tx signing & broadcasting through exported, high level txClient() and queryClient() funcs. -func tpl(protoPath string) *template.Template { - return template.Must( - template.New("client.ts.tpl"). - Funcs(template.FuncMap{ - "camelCase": strcase.ToLowerCamel, - "resolveFile": func(fullPath string) string { - rel, _ := filepath.Rel(protoPath, fullPath) - rel = strings.TrimSuffix(rel, ".proto") - return rel - }, - }). - ParseFS(templates, "templates/client.ts.tpl"), - ) -} - -type generateOptions struct { - includeDirs []string - gomodPath string - jsOut func(module.Module) string - jsIncludeThirdParty bool -} - -// TODO add WithInstall. - -// Option configures code generation. -type Option func(*generateOptions) - -// WithJSGeneration adds JS code generation. out hook is called for each module to -// retrieve the path that should be used to place generated js code inside for a given module. -// if includeThirdPartyModules set to true, code generation will be made for the 3rd party modules -// used by the app -including the SDK- as well. -func WithJSGeneration(includeThirdPartyModules bool, out func(module.Module) (path string)) Option { - return func(o *generateOptions) { - o.jsOut = out - o.jsIncludeThirdParty = includeThirdPartyModules - } -} - -// WithGoGeneration adds Go code generation. -func WithGoGeneration(gomodPath string) Option { - return func(o *generateOptions) { - o.gomodPath = gomodPath - } -} - -// IncludeDirs configures the third party proto dirs that used by app's proto. -// relative to the projectPath. -func IncludeDirs(dirs []string) Option { - return func(o *generateOptions) { - o.includeDirs = dirs - } -} - -// generator generates code for sdk and sdk apps. -type generator struct { - ctx context.Context - appPath string - protoDir string - o *generateOptions - deps []gomodmodule.Version -} - -// Generate generates code from protoDir of an SDK app residing at appPath with given options. -// protoDir must be relative to the projectPath. -func Generate(ctx context.Context, appPath, protoDir string, options ...Option) error { - g := &generator{ - ctx: ctx, - appPath: appPath, - protoDir: protoDir, - o: &generateOptions{}, - } - - for _, apply := range options { - apply(g.o) - } - - if err := g.setup(); err != nil { - return err - } - - if g.o.gomodPath != "" { - if err := g.generateGo(); err != nil { - return err - } - } - - // js generation requires Go types to be existent in the source code. - // so it needs to run after Go code gen. - if g.o.jsOut != nil { - if err := g.generateJS(); err != nil { - return err - } - } - - return nil -} +var sdkImport = "github.com/cosmos/cosmos-sdk" func (g *generator) setup() (err error) { // Cosmos SDK hosts proto files of own x/ modules and some third party ones needed by itself and @@ -171,198 +39,6 @@ func (g *generator) setup() (err error) { return } -func (g *generator) generateGo() error { - includePaths, err := g.resolveInclude(g.appPath) - if err != nil { - return err - } - - // created a temporary dir to locate generated code under which later only some of them will be moved to the - // app's source code. this also prevents having leftover files in the app's source code or its parent dir -when - // command executed directly there- in case of an interrupt. - tmp, err := ioutil.TempDir("", "") - if err != nil { - return err - } - defer os.RemoveAll(tmp) - - // discover proto packages in the app. - pp := filepath.Join(g.appPath, g.protoDir) - pkgs, err := protoanalysis.DiscoverPackages(pp) - if err != nil { - return err - } - - // code generate for each module. - for _, pkg := range pkgs { - if err := protoc.Generate(g.ctx, tmp, pkg.Path, includePaths, goOuts); err != nil { - return err - } - } - - // move generated code for the app under the relative locations in its source code. - generatedPath := filepath.Join(tmp, g.o.gomodPath) - - _, err = os.Stat(generatedPath) - if err == nil { - err = copy.Copy(generatedPath, g.appPath) - return errors.Wrap(err, "cannot copy path") - } - if !os.IsNotExist(err) { - return err - } - return nil -} - -func (g *generator) generateJS() error { - tsprotoPluginPath, err := tsproto.BinaryPath() - if err != nil { - return err - } - - // generate generates JS code for a module. - generate := func(ctx context.Context, appPath string, m module.Module) error { - var ( - out = g.o.jsOut(m) - typesOut = filepath.Join(out, "types") - ) - - includePaths, err := g.resolveInclude(appPath) - if err != nil { - return err - } - - // reset destination dir. - if err := os.RemoveAll(out); err != nil { - return err - } - if err := os.MkdirAll(typesOut, 0755); err != nil { - return err - } - - // generate ts-proto types. - err = protoc.Generate( - g.ctx, - typesOut, - m.Pkg.Path, - includePaths, - tsOut, - protoc.Plugin(tsprotoPluginPath), - ) - if err != nil { - return err - } - - // generate OpenAPI spec. - oaitemp, err := ioutil.TempDir("", "") - if err != nil { - return err - } - defer os.RemoveAll(oaitemp) - - err = protoc.Generate( - ctx, - oaitemp, - m.Pkg.Path, - includePaths, - openAPIOut, - ) - if err != nil { - return err - } - - // generate the REST client from the OpenAPI spec. - var ( - srcspec = filepath.Join(oaitemp, "apidocs.swagger.json") - outREST = filepath.Join(out, "rest.ts") - ) - - if err := sta.Generate(g.ctx, outREST, srcspec, "-1"); err != nil { // -1 removes the route namespace. - return err - } - - // generate the js client wrapper. - outclient := filepath.Join(out, "index.ts") - f, err := os.OpenFile(outclient, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644) - if err != nil { - return err - } - defer f.Close() - - pp := filepath.Join(appPath, g.protoDir) - err = tpl(pp).Execute(f, struct{ Module module.Module }{m}) - if err != nil { - return err - } - - // generate .js and .d.ts files for all ts files. - err = tsc.Generate(g.ctx, tsc.Config{ - Include: []string{out + "/**/*.ts"}, - CompilerOptions: tsc.CompilerOptions{ - Declaration: true, - }, - }) - - return err - } - - // sourcePaths keeps a list of root paths of Go projects (source codes) that might contain - // Cosmos SDK modules inside. - sourcePaths := []string{ - g.appPath, // user's blockchain. may contain internal modules. it is the first place to look for. - } - - if g.o.jsIncludeThirdParty { - // go through the Go dependencies (inside go.mod) of each source path, some of them might be hosting - // Cosmos SDK modules that could be in use by user's blockchain. - // - // Cosmos SDK is a dependency of all blockchains, so it's absolute that we'll be discovering all modules of the - // SDK as well during this process. - // - // even if a dependency contains some SDK modules, not all of these modules could be used by user's blockchain. - // this is fine, we can still generate JS clients for those non modules, it is up to user to use (import in JS) - // not use generated modules. - // not used ones will never get resolved inside JS environment and will not ship to production, JS bundlers will avoid. - // - // TODO(ilgooz): we can still implement some sort of smart filtering to detect non used modules by the user's blockchain - // at some point, it is a nice to have. - for _, dep := range g.deps { - deppath, err := gomodule.LocatePath(dep) - if err != nil { - return err - } - sourcePaths = append(sourcePaths, deppath) - } - } - - gs := &errgroup.Group{} - - // try to discover SDK modules in all source paths. - for _, sourcePath := range sourcePaths { - sourcePath := sourcePath - - gs.Go(func() error { - modules, err := g.discoverModules(sourcePath) - if err != nil { - return err - } - - gg, ctx := errgroup.WithContext(g.ctx) - - // do code generation for each found module. - for _, m := range modules { - m := m - - gg.Go(func() error { return generate(ctx, sourcePath, m) }) - } - - return gg.Wait() - }) - } - - return gs.Wait() -} - func (g *generator) resolveInclude(path string) (paths []string, err error) { paths = append(paths, filepath.Join(path, g.protoDir)) for _, p := range g.o.includeDirs { diff --git a/starport/pkg/cosmosgen/generate_go.go b/starport/pkg/cosmosgen/generate_go.go new file mode 100644 index 0000000000..1cafd436e2 --- /dev/null +++ b/starport/pkg/cosmosgen/generate_go.go @@ -0,0 +1,62 @@ +package cosmosgen + +import ( + "io/ioutil" + "os" + "path/filepath" + + "github.com/otiai10/copy" + "github.com/pkg/errors" + "github.com/tendermint/starport/starport/pkg/protoanalysis" + "github.com/tendermint/starport/starport/pkg/protoc" +) + +var ( + goOuts = []string{ + "--gocosmos_out=plugins=interfacetype+grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:.", + "--grpc-gateway_out=logtostderr=true:.", + } +) + +func (g *generator) generateGo() error { + includePaths, err := g.resolveInclude(g.appPath) + if err != nil { + return err + } + + // created a temporary dir to locate generated code under which later only some of them will be moved to the + // app's source code. this also prevents having leftover files in the app's source code or its parent dir -when + // command executed directly there- in case of an interrupt. + tmp, err := ioutil.TempDir("", "") + if err != nil { + return err + } + defer os.RemoveAll(tmp) + + // discover proto packages in the app. + pp := filepath.Join(g.appPath, g.protoDir) + pkgs, err := protoanalysis.DiscoverPackages(pp) + if err != nil { + return err + } + + // code generate for each module. + for _, pkg := range pkgs { + if err := protoc.Generate(g.ctx, tmp, pkg.Path, includePaths, goOuts); err != nil { + return err + } + } + + // move generated code for the app under the relative locations in its source code. + generatedPath := filepath.Join(tmp, g.o.gomodPath) + + _, err = os.Stat(generatedPath) + if err == nil { + err = copy.Copy(generatedPath, g.appPath) + return errors.Wrap(err, "cannot copy path") + } + if !os.IsNotExist(err) { + return err + } + return nil +} diff --git a/starport/pkg/cosmosgen/generate_javascript.go b/starport/pkg/cosmosgen/generate_javascript.go new file mode 100644 index 0000000000..7a40c07e14 --- /dev/null +++ b/starport/pkg/cosmosgen/generate_javascript.go @@ -0,0 +1,273 @@ +package cosmosgen + +import ( + "context" + "io/ioutil" + "os" + "path/filepath" + "strings" + + "github.com/iancoleman/strcase" + "github.com/mattn/go-zglob" + "github.com/tendermint/starport/starport/pkg/cosmosanalysis/module" + "github.com/tendermint/starport/starport/pkg/gomodule" + "github.com/tendermint/starport/starport/pkg/nodetime/sta" + tsproto "github.com/tendermint/starport/starport/pkg/nodetime/ts-proto" + "github.com/tendermint/starport/starport/pkg/nodetime/tsc" + "github.com/tendermint/starport/starport/pkg/protoc" + "golang.org/x/sync/errgroup" +) + +var ( + tsOut = []string{ + "--ts_proto_out=.", + } + + openAPIOut = []string{ + "--openapiv2_out=logtostderr=true,allow_merge=true:.", + } + + vuexRootMarker = "vuex-root" +) + +type jsGenerator struct { + g *generator + tsprotoPluginPath string +} + +func newJSGenerator(g *generator) (jsGenerator, error) { + tsprotoPluginPath, err := tsproto.BinaryPath() + if err != nil { + return jsGenerator{}, err + } + + return jsGenerator{ + g: g, + tsprotoPluginPath: tsprotoPluginPath, + }, nil +} + +func (g *generator) generateJS() error { + jsg, err := newJSGenerator(g) + if err != nil { + return err + } + + if err := jsg.generateModules(); err != nil { + return err + } + + if err := jsg.generateVuexModuleLoader(); err != nil { + return err + } + + return nil +} + +func (g *jsGenerator) generateModules() error { + // sourcePaths keeps a list of root paths of Go projects (source codes) that might contain + // Cosmos SDK modules inside. + sourcePaths := []string{ + g.g.appPath, // user's blockchain. may contain internal modules. it is the first place to look for. + } + + if g.g.o.jsIncludeThirdParty { + // go through the Go dependencies (inside go.mod) of each source path, some of them might be hosting + // Cosmos SDK modules that could be in use by user's blockchain. + // + // Cosmos SDK is a dependency of all blockchains, so it's absolute that we'll be discovering all modules of the + // SDK as well during this process. + // + // even if a dependency contains some SDK modules, not all of these modules could be used by user's blockchain. + // this is fine, we can still generate JS clients for those non modules, it is up to user to use (import in JS) + // not use generated modules. + // not used ones will never get resolved inside JS environment and will not ship to production, JS bundlers will avoid. + // + // TODO(ilgooz): we can still implement some sort of smart filtering to detect non used modules by the user's blockchain + // at some point, it is a nice to have. + for _, dep := range g.g.deps { + deppath, err := gomodule.LocatePath(dep) + if err != nil { + return err + } + sourcePaths = append(sourcePaths, deppath) + } + } + + gs := &errgroup.Group{} + + // try to discover SDK modules in all source paths. + for _, sourcePath := range sourcePaths { + sourcePath := sourcePath + + gs.Go(func() error { + modules, err := g.g.discoverModules(sourcePath) + if err != nil { + return err + } + + gg, ctx := errgroup.WithContext(g.g.ctx) + + // do code generation for each found module. + for _, m := range modules { + m := m + + gg.Go(func() error { return g.generateModule(ctx, g.tsprotoPluginPath, sourcePath, m) }) + } + + return gg.Wait() + }) + } + + return gs.Wait() +} + +// generateModule generates generates JS code for a module. +func (g *jsGenerator) generateModule(ctx context.Context, tsprotoPluginPath, appPath string, m module.Module) error { + var ( + out = g.g.o.jsOut(m) + storeDirPath = filepath.Dir(out) + typesOut = filepath.Join(out, "types") + ) + + includePaths, err := g.g.resolveInclude(appPath) + if err != nil { + return err + } + + // reset destination dir. + if err := os.RemoveAll(out); err != nil { + return err + } + if err := os.MkdirAll(typesOut, 0755); err != nil { + return err + } + + // generate ts-proto types. + err = protoc.Generate( + g.g.ctx, + typesOut, + m.Pkg.Path, + includePaths, + tsOut, + protoc.Plugin(tsprotoPluginPath), + ) + if err != nil { + return err + } + + // generate OpenAPI spec. + oaitemp, err := ioutil.TempDir("", "") + if err != nil { + return err + } + defer os.RemoveAll(oaitemp) + + err = protoc.Generate( + ctx, + oaitemp, + m.Pkg.Path, + includePaths, + openAPIOut, + ) + if err != nil { + return err + } + + // generate the REST client from the OpenAPI spec. + var ( + srcspec = filepath.Join(oaitemp, "apidocs.swagger.json") + outREST = filepath.Join(out, "rest.ts") + ) + + if err := sta.Generate(g.g.ctx, outREST, srcspec, "-1"); err != nil { // -1 removes the route namespace. + return err + } + + // generate the js client wrapper. + outclient := filepath.Join(out, "index.ts") + f, err := os.OpenFile(outclient, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644) + if err != nil { + return err + } + defer f.Close() + + pp := filepath.Join(appPath, g.g.protoDir) + err = templateJSClient(pp).Execute(f, struct{ Module module.Module }{m}) + if err != nil { + return err + } + + // generate Vuex if enabled. + if g.g.o.vuexStoreRootPath != "" { + storePath := filepath.Join(storeDirPath, "index.ts") + f, err := os.OpenFile(storePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644) + if err != nil { + return err + } + defer f.Close() + + err = templateVuexStore(pp).Execute(f, struct{ Module module.Module }{m}) + if err != nil { + return err + } + + // mark vuex root dir. + f, err = os.Create(filepath.Join(storeDirPath, vuexRootMarker)) + if err != nil { + return err + } + f.Close() + } + + // generate .js and .d.ts files for all ts files. + return tsc.Generate(g.g.ctx, tscConfig(storeDirPath+"/**/*.ts")) +} + +func (g *jsGenerator) generateVuexModuleLoader() error { + modulePaths, err := zglob.Glob(filepath.Join(g.g.o.vuexStoreRootPath, "/**/"+vuexRootMarker)) + if err != nil { + return err + } + + type module struct { + Name string + Path string + } + + var modules []module + + for _, path := range modulePaths { + pathrel, err := filepath.Rel(g.g.o.vuexStoreRootPath, path) + if err != nil { + return err + } + pathrel = filepath.Dir(pathrel) + name := strcase.ToCamel(strings.ReplaceAll(pathrel, "/", "_")) + modules = append(modules, module{name, pathrel}) + } + + loaderPath := filepath.Join(g.g.o.vuexStoreRootPath, "index.ts") + + f, err := os.OpenFile(loaderPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644) + if err != nil { + return err + } + defer f.Close() + + err = templateVuexLoader(g.g.o.vuexStoreRootPath).Execute(f, modules) + if err != nil { + return err + } + + return tsc.Generate(g.g.ctx, tscConfig(loaderPath)) +} + +func tscConfig(include ...string) tsc.Config { + return tsc.Config{ + Include: include, + CompilerOptions: tsc.CompilerOptions{ + Declaration: true, + }, + } +} diff --git a/starport/pkg/cosmosgen/template.go b/starport/pkg/cosmosgen/template.go new file mode 100644 index 0000000000..899ec57637 --- /dev/null +++ b/starport/pkg/cosmosgen/template.go @@ -0,0 +1,44 @@ +package cosmosgen + +import ( + "embed" + "path/filepath" + "strings" + "text/template" + + "github.com/iancoleman/strcase" +) + +var ( + //go:embed templates/* + templates embed.FS + + templateJSClient = tpl("js/client.ts.tpl") // js wrapper client. + templateVuexStore = tpl("vuex/store.ts.tpl") // vuex store. + templateVuexLoader = tpl("vuex/loader.ts.tpl") // vuex store loader. +) + +// tpl returns a func for template residing at templatePath to initialize a text template +// with given protoPath. +func tpl(templatePath string) func(protoPath string) *template.Template { + return func(protoPath string) *template.Template { + path := filepath.Join("templates", templatePath) + + funcs := template.FuncMap{ + "camelCase": strcase.ToLowerCamel, + "resolveFile": func(fullPath string) string { + rel, _ := filepath.Rel(protoPath, fullPath) + rel = strings.TrimSuffix(rel, ".proto") + return rel + }, + } + + return template. + Must( + template. + New(filepath.Base(path)). + Funcs(funcs). + ParseFS(templates, path), + ) + } +} diff --git a/starport/pkg/cosmosgen/templates/client.ts.tpl b/starport/pkg/cosmosgen/templates/js/client.ts.tpl similarity index 100% rename from starport/pkg/cosmosgen/templates/client.ts.tpl rename to starport/pkg/cosmosgen/templates/js/client.ts.tpl diff --git a/starport/pkg/cosmosgen/templates/vuex/loader.ts.tpl b/starport/pkg/cosmosgen/templates/vuex/loader.ts.tpl new file mode 100644 index 0000000000..d7e6759d94 --- /dev/null +++ b/starport/pkg/cosmosgen/templates/vuex/loader.ts.tpl @@ -0,0 +1,27 @@ +{{ range . }}import {{ .Name }} from './{{ .Path }}' +{{ end }} + +export default { + {{ range . }}{{ .Name }}: load({{ .Name }}, 'chain/{{ .Path }}'), + {{ end }} +} + +function load(mod, fullns) { + return function init(store) { + const fullnsLevels = fullns.split('/') + for (let i = 1; i < fullnsLevels.length; i++) { + let ns = fullnsLevels.slice(0, i) + if (!store.hasModule(ns)) { + store.registerModule(ns, { namespaced: true }) + } + } + store.registerModule(fullnsLevels, mod) + store.subscribe((mutation) => { + if (mutation.type == 'chain/common/env/INITIALIZE_WS_COMPLETE') { + store.dispatch(fullns+ '/init', null, { + root: true + }) + } + }) + } +} diff --git a/starport/pkg/cosmosgen/templates/vuex/store.ts.tpl b/starport/pkg/cosmosgen/templates/vuex/store.ts.tpl new file mode 100644 index 0000000000..4bd5c3c8fe --- /dev/null +++ b/starport/pkg/cosmosgen/templates/vuex/store.ts.tpl @@ -0,0 +1,112 @@ +import { txClient, queryClient } from './module' + +{{ range .Module.Types }}import { {{ .Name }} } from "./module/types/{{ resolveFile .FilePath }}" +{{ end }} + +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }) +} + +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }) +} + +function getStructure(template) { + let structure = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field: any = {} + field.name = key + field.type = typeof value + structure.fields.push(field) + } + return structure +} + +const getDefaultState = () => { + return { + {{ range .Module.Queries }}get{{ .Name }}: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + {{ end }} + _Structure: { + {{ range .Module.Types }}{{ .Name }}: getStructure({{ .Name }}.fromPartial({})), + {{ end }} + }, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription) + } + }, + getters: { + {{ range .Module.Queries }}get{{ .Name }}: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + {{ end }} + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init') + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload) + }) + }, + {{ range .Module.Queries }}async {{ .FullName }}({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).{{ camelCase .FullName }}.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + {{ end }} + {{ range .Module.Msgs }}async {{ .Name }}({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).{{ camelCase .Name }}(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + {{ end }} + } +} diff --git a/starport/pkg/nodetime/sta/sta.go b/starport/pkg/nodetime/sta/sta.go index 509973212d..017a794d02 100644 --- a/starport/pkg/nodetime/sta/sta.go +++ b/starport/pkg/nodetime/sta/sta.go @@ -6,7 +6,7 @@ import ( "path/filepath" "sync" - "github.com/tendermint/starport/starport/pkg/cmdrunner" + "github.com/tendermint/starport/starport/pkg/cmdrunner/exec" "github.com/tendermint/starport/starport/pkg/nodetime" ) @@ -41,5 +41,5 @@ func Generate(ctx context.Context, outPath, specPath, moduleNameIndex string) er } // execute the command. - return cmdrunner.Exec(ctx, command[0], command[1:]...) + return exec.Exec(ctx, command, exec.IncludeStdLogsToError()) } diff --git a/starport/pkg/nodetime/tsc/tsc.go b/starport/pkg/nodetime/tsc/tsc.go index c242ada067..9c7b789012 100644 --- a/starport/pkg/nodetime/tsc/tsc.go +++ b/starport/pkg/nodetime/tsc/tsc.go @@ -7,7 +7,7 @@ import ( "sync" "github.com/imdario/mergo" - "github.com/tendermint/starport/starport/pkg/cmdrunner" + "github.com/tendermint/starport/starport/pkg/cmdrunner/exec" "github.com/tendermint/starport/starport/pkg/confile" "github.com/tendermint/starport/starport/pkg/nodetime" ) @@ -89,5 +89,5 @@ func Generate(ctx context.Context, config Config) error { } // execute the command. - return cmdrunner.Exec(ctx, command[0], command[1:]...) + return exec.Exec(ctx, command, exec.IncludeStdLogsToError()) } diff --git a/starport/pkg/protoanalysis/protoanalysis.go b/starport/pkg/protoanalysis/protoanalysis.go index c0ef90784c..4650241e17 100644 --- a/starport/pkg/protoanalysis/protoanalysis.go +++ b/starport/pkg/protoanalysis/protoanalysis.go @@ -30,6 +30,30 @@ type Package struct { // Messages is a list of proto messages defined in the package. Messages []Message + + // Services is a list of RPC services. + Services []Service +} + +// Service is an RPC service. +type Service struct { + // Name of the services. + Name string + + // RPCFuncs is a list of RPC funcs of the service. + RPCFuncs []RPCFunc +} + +// RPCFunc is an RPC func. +type RPCFunc struct { + // Name of the RPC func. + Name string + + // RequestType is the request type of RPC func. + RequestType string + + // ReturnsType is the response type of RPC func. + ReturnsType string } // MessageByName finds a message by its name inside Package. @@ -95,9 +119,10 @@ func DiscoverPackages(path string) ([]Package, error) { } if !exists { pkgs = append(pkgs, pkg) - index = len(pkgs) - 1 + } else { + pkgs[index].Messages = append(pkgs[index].Messages, pkg.Messages...) + pkgs[index].Services = append(pkgs[index].Services, pkg.Services...) } - pkgs[index].Messages = append(pkgs[index].Messages, pkg.Messages...) return nil }) @@ -138,6 +163,25 @@ func Parse(path string) (Package, error) { Path: path, }) }), + proto.WithService(func(s *proto.Service) { + sv := Service{ + Name: s.Name, + } + + for _, el := range s.Elements { + rpc, ok := el.(*proto.RPC) + if !ok { + continue + } + sv.RPCFuncs = append(sv.RPCFuncs, RPCFunc{ + Name: rpc.Name, + RequestType: rpc.RequestType, + ReturnsType: rpc.ReturnsType, + }) + } + + pkg.Services = append(pkg.Services, sv) + }), ) return pkg, nil diff --git a/starport/pkg/protoc/protoc.go b/starport/pkg/protoc/protoc.go index 984c911212..4896b84c43 100644 --- a/starport/pkg/protoc/protoc.go +++ b/starport/pkg/protoc/protoc.go @@ -2,12 +2,10 @@ package protoc import ( - "bytes" "context" "os" - "github.com/pkg/errors" - "github.com/tendermint/starport/starport/pkg/cmdrunner" + "github.com/tendermint/starport/starport/pkg/cmdrunner/exec" "github.com/tendermint/starport/starport/pkg/cmdrunner/step" "github.com/tendermint/starport/starport/pkg/protoanalysis" ) @@ -64,17 +62,11 @@ func Generate(ctx context.Context, outDir, protoPath string, includePaths, proto command := append(command, out) command = append(command, files...) - errb := &bytes.Buffer{} - - err := cmdrunner. - New( - cmdrunner.DefaultStderr(errb), - cmdrunner.DefaultWorkdir(outDir)). - Run(ctx, - step.New(step.Exec(command[0], command[1:]...))) - - if err != nil { - return errors.Wrap(err, errb.String()) + if err := exec.Exec(ctx, command, + exec.StepOption(step.Workdir(outDir)), + exec.IncludeStdLogsToError(), + ); err != nil { + return err } } diff --git a/starport/services/chain/build.go b/starport/services/chain/build.go index 4fefea14e8..44e8e89945 100644 --- a/starport/services/chain/build.go +++ b/starport/services/chain/build.go @@ -173,9 +173,16 @@ func (c *Chain) buildProto(ctx context.Context) error { // generate Vuex code as well if it is enabled. if conf.Client.Vuex.Path != "" { - options = append(options, cosmosgen.WithJSGeneration(enableThirdPartyModuleCodegen, func(m module.Module) string { - return filepath.Join(c.app.Path, conf.Client.Vuex.Path, "chain", giturl.UserAndRepo(m.Pkg.GoImportName), m.Pkg.Name, "module") - })) + storeRootPath := filepath.Join(c.app.Path, conf.Client.Vuex.Path, "chain") + options = append(options, + cosmosgen.WithVuexGeneration( + enableThirdPartyModuleCodegen, + func(m module.Module) string { + return filepath.Join(storeRootPath, giturl.UserAndRepo(m.Pkg.GoImportName), m.Pkg.Name, "module") + }, + storeRootPath, + ), + ) } if err := cosmosgen.Generate(ctx, c.app.Path, conf.Build.Proto.Path, options...); err != nil { diff --git a/starport/services/scaffolder/init.go b/starport/services/scaffolder/init.go index 8d81267d86..1297fb40c1 100644 --- a/starport/services/scaffolder/init.go +++ b/starport/services/scaffolder/init.go @@ -108,9 +108,16 @@ func (s *Scaffolder) protoc(projectPath, gomodPath string, version cosmosver.Maj // generate Vuex code as well if it is enabled. if conf.Client.Vuex.Path != "" { - options = append(options, cosmosgen.WithJSGeneration(false, func(m module.Module) string { - return filepath.Join(projectPath, conf.Client.Vuex.Path, "chain", giturl.UserAndRepo(m.Pkg.GoImportName), m.Pkg.Name, "module") - })) + storeRootPath := filepath.Join(projectPath, conf.Client.Vuex.Path, "chain") + options = append(options, + cosmosgen.WithVuexGeneration( + false, + func(m module.Module) string { + return filepath.Join(storeRootPath, giturl.UserAndRepo(m.Pkg.GoImportName), m.Pkg.Name, "module") + }, + storeRootPath, + ), + ) } return cosmosgen.Generate(context.Background(), projectPath, conf.Build.Proto.Path, options...) diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.d.ts new file mode 100644 index 0000000000..d12531b1ed --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.d.ts @@ -0,0 +1,135 @@ +declare const _default: { + namespaced: boolean; + state: { + getBalance: (state: any) => (params?: {}) => any; + getAllBalances: (state: any) => (params?: {}) => any; + getTotalSupply: (state: any) => (params?: {}) => any; + getSupplyOf: (state: any) => (params?: {}) => any; + getParams: (state: any) => (params?: {}) => any; + getDenomMetadata: (state: any) => (params?: {}) => any; + getDenomsMetadata: (state: any) => (params?: {}) => any; + _Structure: { + Params: { + fields: any[]; + }; + SendEnabled: { + fields: any[]; + }; + Input: { + fields: any[]; + }; + Output: { + fields: any[]; + }; + Supply: { + fields: any[]; + }; + DenomUnit: { + fields: any[]; + }; + Metadata: { + fields: any[]; + }; + Balance: { + fields: any[]; + }; + }; + _Subscriptions: Set; + }; + mutations: { + RESET_STATE(state: any): void; + QUERY(state: any, { query, key, value }: { + query: any; + key: any; + value: any; + }): void; + SUBSCRIBE(state: any, subscription: any): void; + UNSUBSCRIBE(state: any, subscription: any): void; + }; + getters: { + getBalance: (state: any) => (params?: {}) => any; + getAllBalances: (state: any) => (params?: {}) => any; + getTotalSupply: (state: any) => (params?: {}) => any; + getSupplyOf: (state: any) => (params?: {}) => any; + getParams: (state: any) => (params?: {}) => any; + getDenomMetadata: (state: any) => (params?: {}) => any; + getDenomsMetadata: (state: any) => (params?: {}) => any; + getTypeStructure: (state: any) => (type: any) => any; + }; + actions: { + init({ dispatch, rootGetters }: { + dispatch: any; + rootGetters: any; + }): void; + resetState({ commit }: { + commit: any; + }): void; + unsubscribe({ commit }: { + commit: any; + }, subscription: any): void; + StoreUpdate({ state, dispatch }: { + state: any; + dispatch: any; + }): Promise; + QueryBalance({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryAllBalances({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryTotalSupply({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QuerySupplyOf({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryParams({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryDenomMetadata({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryDenomsMetadata({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + MsgSend({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgMultiSend({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + }; +}; +export default _default; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.js new file mode 100644 index 0000000000..5410e1ce2f --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.js @@ -0,0 +1,227 @@ +import { txClient, queryClient } from './module'; +import { Params } from "./module/types/cosmos/bank/v1beta1/bank"; +import { SendEnabled } from "./module/types/cosmos/bank/v1beta1/bank"; +import { Input } from "./module/types/cosmos/bank/v1beta1/bank"; +import { Output } from "./module/types/cosmos/bank/v1beta1/bank"; +import { Supply } from "./module/types/cosmos/bank/v1beta1/bank"; +import { DenomUnit } from "./module/types/cosmos/bank/v1beta1/bank"; +import { Metadata } from "./module/types/cosmos/bank/v1beta1/bank"; +import { Balance } from "./module/types/cosmos/bank/v1beta1/genesis"; +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }); +} +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }); +} +function getStructure(template) { + let structure = { fields: [] }; + for (const [key, value] of Object.entries(template)) { + let field = {}; + field.name = key; + field.type = typeof value; + structure.fields.push(field); + } + return structure; +} +const getDefaultState = () => { + return { + getBalance: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getAllBalances: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getTotalSupply: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getSupplyOf: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDenomMetadata: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDenomsMetadata: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + _Structure: { + Params: getStructure(Params.fromPartial({})), + SendEnabled: getStructure(SendEnabled.fromPartial({})), + Input: getStructure(Input.fromPartial({})), + Output: getStructure(Output.fromPartial({})), + Supply: getStructure(Supply.fromPartial({})), + DenomUnit: getStructure(DenomUnit.fromPartial({})), + Metadata: getStructure(Metadata.fromPartial({})), + Balance: getStructure(Balance.fromPartial({})), + }, + _Subscriptions: new Set(), + }; +}; +// initial state +const state = getDefaultState(); +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()); + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value; + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription); + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription); + } + }, + getters: { + getBalance: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getAllBalances: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getTotalSupply: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getSupplyOf: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDenomMetadata: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDenomsMetadata: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields; + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init'); + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate'); + }); + } + }, + resetState({ commit }) { + commit('RESET_STATE'); + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription); + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload); + }); + }, + async QueryBalance({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryBalance.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryAllBalances({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryAllBalances.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryTotalSupply({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryTotalSupply.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QuerySupplyOf({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).querySupplyOf.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryParams({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryParams.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryDenomMetadata({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDenomMetadata.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryDenomsMetadata({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDenomsMetadata.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async MsgSend({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgSend(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgMultiSend({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgMultiSend(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + } +}; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.ts new file mode 100644 index 0000000000..3b018f84cb --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.ts @@ -0,0 +1,224 @@ +import { txClient, queryClient } from './module' + +import { Params } from "./module/types/cosmos/bank/v1beta1/bank" +import { SendEnabled } from "./module/types/cosmos/bank/v1beta1/bank" +import { Input } from "./module/types/cosmos/bank/v1beta1/bank" +import { Output } from "./module/types/cosmos/bank/v1beta1/bank" +import { Supply } from "./module/types/cosmos/bank/v1beta1/bank" +import { DenomUnit } from "./module/types/cosmos/bank/v1beta1/bank" +import { Metadata } from "./module/types/cosmos/bank/v1beta1/bank" +import { Balance } from "./module/types/cosmos/bank/v1beta1/genesis" + + +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }) +} + +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }) +} + +function getStructure(template) { + let structure = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field: any = {} + field.name = key + field.type = typeof value + structure.fields.push(field) + } + return structure +} + +const getDefaultState = () => { + return { + getBalance: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getAllBalances: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getTotalSupply: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getSupplyOf: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDenomMetadata: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDenomsMetadata: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + _Structure: { + Params: getStructure(Params.fromPartial({})), + SendEnabled: getStructure(SendEnabled.fromPartial({})), + Input: getStructure(Input.fromPartial({})), + Output: getStructure(Output.fromPartial({})), + Supply: getStructure(Supply.fromPartial({})), + DenomUnit: getStructure(DenomUnit.fromPartial({})), + Metadata: getStructure(Metadata.fromPartial({})), + Balance: getStructure(Balance.fromPartial({})), + + }, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription) + } + }, + getters: { + getBalance: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getAllBalances: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getTotalSupply: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getSupplyOf: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDenomMetadata: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDenomsMetadata: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init') + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload) + }) + }, + async QueryBalance({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryBalance.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryAllBalances({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryAllBalances.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryTotalSupply({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryTotalSupply.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QuerySupplyOf({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).querySupplyOf.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryParams({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryParams.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryDenomMetadata({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDenomMetadata.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryDenomsMetadata({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDenomsMetadata.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + + async MsgSend({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgSend(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgMultiSend({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgMultiSend(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + + } +} diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/vuex-root b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/vuex-root new file mode 100644 index 0000000000..e69de29bb2 diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/index.d.ts new file mode 100644 index 0000000000..2a10c9ed80 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/index.d.ts @@ -0,0 +1,42 @@ +declare const _default: { + namespaced: boolean; + state: { + _Structure: {}; + _Subscriptions: Set; + }; + mutations: { + RESET_STATE(state: any): void; + QUERY(state: any, { query, key, value }: { + query: any; + key: any; + value: any; + }): void; + SUBSCRIBE(state: any, subscription: any): void; + UNSUBSCRIBE(state: any, subscription: any): void; + }; + getters: { + getTypeStructure: (state: any) => (type: any) => any; + }; + actions: { + init({ dispatch, rootGetters }: { + dispatch: any; + rootGetters: any; + }): void; + resetState({ commit }: { + commit: any; + }): void; + unsubscribe({ commit }: { + commit: any; + }, subscription: any): void; + StoreUpdate({ state, dispatch }: { + state: any; + dispatch: any; + }): Promise; + MsgVerifyInvariant({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + }; +}; +export default _default; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/index.js new file mode 100644 index 0000000000..67fafcd18d --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/index.js @@ -0,0 +1,82 @@ +import { txClient, queryClient } from './module'; +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }); +} +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }); +} +function getStructure(template) { + let structure = { fields: [] }; + for (const [key, value] of Object.entries(template)) { + let field = {}; + field.name = key; + field.type = typeof value; + structure.fields.push(field); + } + return structure; +} +const getDefaultState = () => { + return { + _Structure: {}, + _Subscriptions: new Set(), + }; +}; +// initial state +const state = getDefaultState(); +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()); + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value; + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription); + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription); + } + }, + getters: { + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields; + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init'); + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate'); + }); + } + }, + resetState({ commit }) { + commit('RESET_STATE'); + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription); + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload); + }); + }, + async MsgVerifyInvariant({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgVerifyInvariant(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + } +}; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/index.ts new file mode 100644 index 0000000000..571ed01d01 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/index.ts @@ -0,0 +1,95 @@ +import { txClient, queryClient } from './module' + + + +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }) +} + +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }) +} + +function getStructure(template) { + let structure = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field: any = {} + field.name = key + field.type = typeof value + structure.fields.push(field) + } + return structure +} + +const getDefaultState = () => { + return { + + _Structure: { + + }, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription) + } + }, + getters: { + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init') + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload) + }) + }, + + async MsgVerifyInvariant({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgVerifyInvariant(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + + } +} diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/vuex-root b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/vuex-root new file mode 100644 index 0000000000..e69de29bb2 diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.d.ts new file mode 100644 index 0000000000..5432205e1e --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.d.ts @@ -0,0 +1,196 @@ +declare const _default: { + namespaced: boolean; + state: { + getParams: (state: any) => (params?: {}) => any; + getValidatorOutstandingRewards: (state: any) => (params?: {}) => any; + getValidatorCommission: (state: any) => (params?: {}) => any; + getValidatorSlashes: (state: any) => (params?: {}) => any; + getDelegationRewards: (state: any) => (params?: {}) => any; + getDelegationTotalRewards: (state: any) => (params?: {}) => any; + getDelegatorValidators: (state: any) => (params?: {}) => any; + getDelegatorWithdrawAddress: (state: any) => (params?: {}) => any; + getCommunityPool: (state: any) => (params?: {}) => any; + _Structure: { + Params: { + fields: any[]; + }; + ValidatorHistoricalRewards: { + fields: any[]; + }; + ValidatorCurrentRewards: { + fields: any[]; + }; + ValidatorAccumulatedCommission: { + fields: any[]; + }; + ValidatorOutstandingRewards: { + fields: any[]; + }; + ValidatorSlashEvent: { + fields: any[]; + }; + ValidatorSlashEvents: { + fields: any[]; + }; + FeePool: { + fields: any[]; + }; + CommunityPoolSpendProposal: { + fields: any[]; + }; + DelegatorStartingInfo: { + fields: any[]; + }; + DelegationDelegatorReward: { + fields: any[]; + }; + CommunityPoolSpendProposalWithDeposit: { + fields: any[]; + }; + DelegatorWithdrawInfo: { + fields: any[]; + }; + ValidatorOutstandingRewardsRecord: { + fields: any[]; + }; + ValidatorAccumulatedCommissionRecord: { + fields: any[]; + }; + ValidatorHistoricalRewardsRecord: { + fields: any[]; + }; + ValidatorCurrentRewardsRecord: { + fields: any[]; + }; + DelegatorStartingInfoRecord: { + fields: any[]; + }; + ValidatorSlashEventRecord: { + fields: any[]; + }; + }; + _Subscriptions: Set; + }; + mutations: { + RESET_STATE(state: any): void; + QUERY(state: any, { query, key, value }: { + query: any; + key: any; + value: any; + }): void; + SUBSCRIBE(state: any, subscription: any): void; + UNSUBSCRIBE(state: any, subscription: any): void; + }; + getters: { + getParams: (state: any) => (params?: {}) => any; + getValidatorOutstandingRewards: (state: any) => (params?: {}) => any; + getValidatorCommission: (state: any) => (params?: {}) => any; + getValidatorSlashes: (state: any) => (params?: {}) => any; + getDelegationRewards: (state: any) => (params?: {}) => any; + getDelegationTotalRewards: (state: any) => (params?: {}) => any; + getDelegatorValidators: (state: any) => (params?: {}) => any; + getDelegatorWithdrawAddress: (state: any) => (params?: {}) => any; + getCommunityPool: (state: any) => (params?: {}) => any; + getTypeStructure: (state: any) => (type: any) => any; + }; + actions: { + init({ dispatch, rootGetters }: { + dispatch: any; + rootGetters: any; + }): void; + resetState({ commit }: { + commit: any; + }): void; + unsubscribe({ commit }: { + commit: any; + }, subscription: any): void; + StoreUpdate({ state, dispatch }: { + state: any; + dispatch: any; + }): Promise; + QueryParams({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryValidatorOutstandingRewards({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryValidatorCommission({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryValidatorSlashes({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryDelegationRewards({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryDelegationTotalRewards({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryDelegatorValidators({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryDelegatorWithdrawAddress({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryCommunityPool({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + MsgFundCommunityPool({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgSetWithdrawAddress({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgWithdrawDelegatorReward({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgWithdrawValidatorCommission({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + }; +}; +export default _default; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.js new file mode 100644 index 0000000000..1f8b2563b8 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.js @@ -0,0 +1,301 @@ +import { txClient, queryClient } from './module'; +import { Params } from "./module/types/cosmos/distribution/v1beta1/distribution"; +import { ValidatorHistoricalRewards } from "./module/types/cosmos/distribution/v1beta1/distribution"; +import { ValidatorCurrentRewards } from "./module/types/cosmos/distribution/v1beta1/distribution"; +import { ValidatorAccumulatedCommission } from "./module/types/cosmos/distribution/v1beta1/distribution"; +import { ValidatorOutstandingRewards } from "./module/types/cosmos/distribution/v1beta1/distribution"; +import { ValidatorSlashEvent } from "./module/types/cosmos/distribution/v1beta1/distribution"; +import { ValidatorSlashEvents } from "./module/types/cosmos/distribution/v1beta1/distribution"; +import { FeePool } from "./module/types/cosmos/distribution/v1beta1/distribution"; +import { CommunityPoolSpendProposal } from "./module/types/cosmos/distribution/v1beta1/distribution"; +import { DelegatorStartingInfo } from "./module/types/cosmos/distribution/v1beta1/distribution"; +import { DelegationDelegatorReward } from "./module/types/cosmos/distribution/v1beta1/distribution"; +import { CommunityPoolSpendProposalWithDeposit } from "./module/types/cosmos/distribution/v1beta1/distribution"; +import { DelegatorWithdrawInfo } from "./module/types/cosmos/distribution/v1beta1/genesis"; +import { ValidatorOutstandingRewardsRecord } from "./module/types/cosmos/distribution/v1beta1/genesis"; +import { ValidatorAccumulatedCommissionRecord } from "./module/types/cosmos/distribution/v1beta1/genesis"; +import { ValidatorHistoricalRewardsRecord } from "./module/types/cosmos/distribution/v1beta1/genesis"; +import { ValidatorCurrentRewardsRecord } from "./module/types/cosmos/distribution/v1beta1/genesis"; +import { DelegatorStartingInfoRecord } from "./module/types/cosmos/distribution/v1beta1/genesis"; +import { ValidatorSlashEventRecord } from "./module/types/cosmos/distribution/v1beta1/genesis"; +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }); +} +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }); +} +function getStructure(template) { + let structure = { fields: [] }; + for (const [key, value] of Object.entries(template)) { + let field = {}; + field.name = key; + field.type = typeof value; + structure.fields.push(field); + } + return structure; +} +const getDefaultState = () => { + return { + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getValidatorOutstandingRewards: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getValidatorCommission: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getValidatorSlashes: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegationRewards: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegationTotalRewards: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegatorValidators: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegatorWithdrawAddress: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getCommunityPool: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + _Structure: { + Params: getStructure(Params.fromPartial({})), + ValidatorHistoricalRewards: getStructure(ValidatorHistoricalRewards.fromPartial({})), + ValidatorCurrentRewards: getStructure(ValidatorCurrentRewards.fromPartial({})), + ValidatorAccumulatedCommission: getStructure(ValidatorAccumulatedCommission.fromPartial({})), + ValidatorOutstandingRewards: getStructure(ValidatorOutstandingRewards.fromPartial({})), + ValidatorSlashEvent: getStructure(ValidatorSlashEvent.fromPartial({})), + ValidatorSlashEvents: getStructure(ValidatorSlashEvents.fromPartial({})), + FeePool: getStructure(FeePool.fromPartial({})), + CommunityPoolSpendProposal: getStructure(CommunityPoolSpendProposal.fromPartial({})), + DelegatorStartingInfo: getStructure(DelegatorStartingInfo.fromPartial({})), + DelegationDelegatorReward: getStructure(DelegationDelegatorReward.fromPartial({})), + CommunityPoolSpendProposalWithDeposit: getStructure(CommunityPoolSpendProposalWithDeposit.fromPartial({})), + DelegatorWithdrawInfo: getStructure(DelegatorWithdrawInfo.fromPartial({})), + ValidatorOutstandingRewardsRecord: getStructure(ValidatorOutstandingRewardsRecord.fromPartial({})), + ValidatorAccumulatedCommissionRecord: getStructure(ValidatorAccumulatedCommissionRecord.fromPartial({})), + ValidatorHistoricalRewardsRecord: getStructure(ValidatorHistoricalRewardsRecord.fromPartial({})), + ValidatorCurrentRewardsRecord: getStructure(ValidatorCurrentRewardsRecord.fromPartial({})), + DelegatorStartingInfoRecord: getStructure(DelegatorStartingInfoRecord.fromPartial({})), + ValidatorSlashEventRecord: getStructure(ValidatorSlashEventRecord.fromPartial({})), + }, + _Subscriptions: new Set(), + }; +}; +// initial state +const state = getDefaultState(); +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()); + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value; + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription); + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription); + } + }, + getters: { + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getValidatorOutstandingRewards: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getValidatorCommission: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getValidatorSlashes: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegationRewards: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegationTotalRewards: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegatorValidators: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegatorWithdrawAddress: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getCommunityPool: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields; + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init'); + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate'); + }); + } + }, + resetState({ commit }) { + commit('RESET_STATE'); + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription); + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload); + }); + }, + async QueryParams({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryParams.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryValidatorOutstandingRewards({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryValidatorOutstandingRewards.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryValidatorCommission({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryValidatorCommission.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryValidatorSlashes({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryValidatorSlashes.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryDelegationRewards({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegationRewards.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryDelegationTotalRewards({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegationTotalRewards.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryDelegatorValidators({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegatorValidators.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryDelegatorWithdrawAddress({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegatorWithdrawAddress.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryCommunityPool({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryCommunityPool.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async MsgFundCommunityPool({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgFundCommunityPool(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgSetWithdrawAddress({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgSetWithdrawAddress(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgWithdrawDelegatorReward({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgWithdrawDelegatorReward(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgWithdrawValidatorCommission({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgWithdrawValidatorCommission(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + } +}; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.ts new file mode 100644 index 0000000000..1e78151e68 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.ts @@ -0,0 +1,292 @@ +import { txClient, queryClient } from './module' + +import { Params } from "./module/types/cosmos/distribution/v1beta1/distribution" +import { ValidatorHistoricalRewards } from "./module/types/cosmos/distribution/v1beta1/distribution" +import { ValidatorCurrentRewards } from "./module/types/cosmos/distribution/v1beta1/distribution" +import { ValidatorAccumulatedCommission } from "./module/types/cosmos/distribution/v1beta1/distribution" +import { ValidatorOutstandingRewards } from "./module/types/cosmos/distribution/v1beta1/distribution" +import { ValidatorSlashEvent } from "./module/types/cosmos/distribution/v1beta1/distribution" +import { ValidatorSlashEvents } from "./module/types/cosmos/distribution/v1beta1/distribution" +import { FeePool } from "./module/types/cosmos/distribution/v1beta1/distribution" +import { CommunityPoolSpendProposal } from "./module/types/cosmos/distribution/v1beta1/distribution" +import { DelegatorStartingInfo } from "./module/types/cosmos/distribution/v1beta1/distribution" +import { DelegationDelegatorReward } from "./module/types/cosmos/distribution/v1beta1/distribution" +import { CommunityPoolSpendProposalWithDeposit } from "./module/types/cosmos/distribution/v1beta1/distribution" +import { DelegatorWithdrawInfo } from "./module/types/cosmos/distribution/v1beta1/genesis" +import { ValidatorOutstandingRewardsRecord } from "./module/types/cosmos/distribution/v1beta1/genesis" +import { ValidatorAccumulatedCommissionRecord } from "./module/types/cosmos/distribution/v1beta1/genesis" +import { ValidatorHistoricalRewardsRecord } from "./module/types/cosmos/distribution/v1beta1/genesis" +import { ValidatorCurrentRewardsRecord } from "./module/types/cosmos/distribution/v1beta1/genesis" +import { DelegatorStartingInfoRecord } from "./module/types/cosmos/distribution/v1beta1/genesis" +import { ValidatorSlashEventRecord } from "./module/types/cosmos/distribution/v1beta1/genesis" + + +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }) +} + +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }) +} + +function getStructure(template) { + let structure = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field: any = {} + field.name = key + field.type = typeof value + structure.fields.push(field) + } + return structure +} + +const getDefaultState = () => { + return { + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getValidatorOutstandingRewards: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getValidatorCommission: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getValidatorSlashes: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegationRewards: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegationTotalRewards: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegatorValidators: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegatorWithdrawAddress: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getCommunityPool: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + _Structure: { + Params: getStructure(Params.fromPartial({})), + ValidatorHistoricalRewards: getStructure(ValidatorHistoricalRewards.fromPartial({})), + ValidatorCurrentRewards: getStructure(ValidatorCurrentRewards.fromPartial({})), + ValidatorAccumulatedCommission: getStructure(ValidatorAccumulatedCommission.fromPartial({})), + ValidatorOutstandingRewards: getStructure(ValidatorOutstandingRewards.fromPartial({})), + ValidatorSlashEvent: getStructure(ValidatorSlashEvent.fromPartial({})), + ValidatorSlashEvents: getStructure(ValidatorSlashEvents.fromPartial({})), + FeePool: getStructure(FeePool.fromPartial({})), + CommunityPoolSpendProposal: getStructure(CommunityPoolSpendProposal.fromPartial({})), + DelegatorStartingInfo: getStructure(DelegatorStartingInfo.fromPartial({})), + DelegationDelegatorReward: getStructure(DelegationDelegatorReward.fromPartial({})), + CommunityPoolSpendProposalWithDeposit: getStructure(CommunityPoolSpendProposalWithDeposit.fromPartial({})), + DelegatorWithdrawInfo: getStructure(DelegatorWithdrawInfo.fromPartial({})), + ValidatorOutstandingRewardsRecord: getStructure(ValidatorOutstandingRewardsRecord.fromPartial({})), + ValidatorAccumulatedCommissionRecord: getStructure(ValidatorAccumulatedCommissionRecord.fromPartial({})), + ValidatorHistoricalRewardsRecord: getStructure(ValidatorHistoricalRewardsRecord.fromPartial({})), + ValidatorCurrentRewardsRecord: getStructure(ValidatorCurrentRewardsRecord.fromPartial({})), + DelegatorStartingInfoRecord: getStructure(DelegatorStartingInfoRecord.fromPartial({})), + ValidatorSlashEventRecord: getStructure(ValidatorSlashEventRecord.fromPartial({})), + + }, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription) + } + }, + getters: { + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getValidatorOutstandingRewards: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getValidatorCommission: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getValidatorSlashes: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegationRewards: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegationTotalRewards: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegatorValidators: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegatorWithdrawAddress: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getCommunityPool: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init') + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload) + }) + }, + async QueryParams({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryParams.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryValidatorOutstandingRewards({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryValidatorOutstandingRewards.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryValidatorCommission({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryValidatorCommission.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryValidatorSlashes({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryValidatorSlashes.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryDelegationRewards({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegationRewards.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryDelegationTotalRewards({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegationTotalRewards.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryDelegatorValidators({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegatorValidators.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryDelegatorWithdrawAddress({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegatorWithdrawAddress.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryCommunityPool({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryCommunityPool.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + + async MsgFundCommunityPool({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgFundCommunityPool(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgSetWithdrawAddress({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgSetWithdrawAddress(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgWithdrawDelegatorReward({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgWithdrawDelegatorReward(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgWithdrawValidatorCommission({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgWithdrawValidatorCommission(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + + } +} diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/index.d.ts index 040c2ad06d..4eb200192b 100644 --- a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/index.d.ts +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/index.d.ts @@ -1,10 +1,10 @@ import { StdFee } from "@cosmjs/launchpad"; import { OfflineSigner, EncodeObject } from "@cosmjs/proto-signing"; import { Api } from "./rest"; -import { MsgSetWithdrawAddress } from "./types/cosmos/distribution/v1beta1/tx"; import { MsgFundCommunityPool } from "./types/cosmos/distribution/v1beta1/tx"; -import { MsgWithdrawValidatorCommission } from "./types/cosmos/distribution/v1beta1/tx"; +import { MsgSetWithdrawAddress } from "./types/cosmos/distribution/v1beta1/tx"; import { MsgWithdrawDelegatorReward } from "./types/cosmos/distribution/v1beta1/tx"; +import { MsgWithdrawValidatorCommission } from "./types/cosmos/distribution/v1beta1/tx"; interface TxClientOptions { addr: string; } @@ -13,10 +13,10 @@ interface SignAndBroadcastOptions { } declare const txClient: (wallet: OfflineSigner, { addr: addr }?: TxClientOptions) => Promise<{ signAndBroadcast: (msgs: EncodeObject[], { fee: fee }?: SignAndBroadcastOptions) => Promise; - msgSetWithdrawAddress: (data: MsgSetWithdrawAddress) => EncodeObject; msgFundCommunityPool: (data: MsgFundCommunityPool) => EncodeObject; - msgWithdrawValidatorCommission: (data: MsgWithdrawValidatorCommission) => EncodeObject; + msgSetWithdrawAddress: (data: MsgSetWithdrawAddress) => EncodeObject; msgWithdrawDelegatorReward: (data: MsgWithdrawDelegatorReward) => EncodeObject; + msgWithdrawValidatorCommission: (data: MsgWithdrawValidatorCommission) => EncodeObject; }>; interface QueryClientOptions { addr: string; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/index.js index fe66a4b230..42dacf658f 100644 --- a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/index.js +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/index.js @@ -1,15 +1,15 @@ import { SigningStargateClient } from "@cosmjs/stargate"; import { Registry } from "@cosmjs/proto-signing"; import { Api } from "./rest"; -import { MsgSetWithdrawAddress } from "./types/cosmos/distribution/v1beta1/tx"; import { MsgFundCommunityPool } from "./types/cosmos/distribution/v1beta1/tx"; -import { MsgWithdrawValidatorCommission } from "./types/cosmos/distribution/v1beta1/tx"; +import { MsgSetWithdrawAddress } from "./types/cosmos/distribution/v1beta1/tx"; import { MsgWithdrawDelegatorReward } from "./types/cosmos/distribution/v1beta1/tx"; +import { MsgWithdrawValidatorCommission } from "./types/cosmos/distribution/v1beta1/tx"; const types = [ - ["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool], - ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], + ["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], + ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ]; const registry = new Registry(types); const defaultFee = { @@ -23,10 +23,10 @@ const txClient = async (wallet, { addr: addr } = { addr: "http://localhost:26657 const { address } = (await wallet.getAccounts())[0]; return { signAndBroadcast: (msgs, { fee: fee } = { fee: defaultFee }) => client.signAndBroadcast(address, msgs, fee), - msgSetWithdrawAddress: (data) => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", value: data }), msgFundCommunityPool: (data) => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", value: data }), - msgWithdrawValidatorCommission: (data) => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", value: data }), + msgSetWithdrawAddress: (data) => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", value: data }), msgWithdrawDelegatorReward: (data) => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", value: data }), + msgWithdrawValidatorCommission: (data) => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", value: data }), }; }; const queryClient = async ({ addr: addr } = { addr: "http://localhost:1317" }) => { diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/index.ts index 21625414d2..a3ecb76d0f 100644 --- a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/index.ts +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/index.ts @@ -2,17 +2,17 @@ import { coins, StdFee } from "@cosmjs/launchpad"; import { SigningStargateClient } from "@cosmjs/stargate"; import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; import { Api } from "./rest"; -import { MsgSetWithdrawAddress } from "./types/cosmos/distribution/v1beta1/tx"; import { MsgFundCommunityPool } from "./types/cosmos/distribution/v1beta1/tx"; -import { MsgWithdrawValidatorCommission } from "./types/cosmos/distribution/v1beta1/tx"; +import { MsgSetWithdrawAddress } from "./types/cosmos/distribution/v1beta1/tx"; import { MsgWithdrawDelegatorReward } from "./types/cosmos/distribution/v1beta1/tx"; +import { MsgWithdrawValidatorCommission } from "./types/cosmos/distribution/v1beta1/tx"; const types = [ - ["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool], - ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], + ["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress], ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward], + ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission], ]; @@ -39,10 +39,10 @@ const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = return { signAndBroadcast: (msgs: EncodeObject[], { fee: fee }: SignAndBroadcastOptions = { fee: defaultFee }) => client.signAndBroadcast(address, msgs, fee), - msgSetWithdrawAddress: (data: MsgSetWithdrawAddress): EncodeObject => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", value: data }), msgFundCommunityPool: (data: MsgFundCommunityPool): EncodeObject => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", value: data }), - msgWithdrawValidatorCommission: (data: MsgWithdrawValidatorCommission): EncodeObject => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", value: data }), + msgSetWithdrawAddress: (data: MsgSetWithdrawAddress): EncodeObject => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", value: data }), msgWithdrawDelegatorReward: (data: MsgWithdrawDelegatorReward): EncodeObject => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", value: data }), + msgWithdrawValidatorCommission: (data: MsgWithdrawValidatorCommission): EncodeObject => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", value: data }), }; }; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/vuex-root b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/vuex-root new file mode 100644 index 0000000000..e69de29bb2 diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.d.ts new file mode 100644 index 0000000000..81b110f4a5 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.d.ts @@ -0,0 +1,64 @@ +declare const _default: { + namespaced: boolean; + state: { + getEvidence: (state: any) => (params?: {}) => any; + getAllEvidence: (state: any) => (params?: {}) => any; + _Structure: { + Equivocation: { + fields: any[]; + }; + }; + _Subscriptions: Set; + }; + mutations: { + RESET_STATE(state: any): void; + QUERY(state: any, { query, key, value }: { + query: any; + key: any; + value: any; + }): void; + SUBSCRIBE(state: any, subscription: any): void; + UNSUBSCRIBE(state: any, subscription: any): void; + }; + getters: { + getEvidence: (state: any) => (params?: {}) => any; + getAllEvidence: (state: any) => (params?: {}) => any; + getTypeStructure: (state: any) => (type: any) => any; + }; + actions: { + init({ dispatch, rootGetters }: { + dispatch: any; + rootGetters: any; + }): void; + resetState({ commit }: { + commit: any; + }): void; + unsubscribe({ commit }: { + commit: any; + }, subscription: any): void; + StoreUpdate({ state, dispatch }: { + state: any; + dispatch: any; + }): Promise; + QueryEvidence({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryAllEvidence({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + MsgSubmitEvidence({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + }; +}; +export default _default; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.js new file mode 100644 index 0000000000..67c9ac6f2a --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.js @@ -0,0 +1,119 @@ +import { txClient, queryClient } from './module'; +import { Equivocation } from "./module/types/cosmos/evidence/v1beta1/evidence"; +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }); +} +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }); +} +function getStructure(template) { + let structure = { fields: [] }; + for (const [key, value] of Object.entries(template)) { + let field = {}; + field.name = key; + field.type = typeof value; + structure.fields.push(field); + } + return structure; +} +const getDefaultState = () => { + return { + getEvidence: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getAllEvidence: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + _Structure: { + Equivocation: getStructure(Equivocation.fromPartial({})), + }, + _Subscriptions: new Set(), + }; +}; +// initial state +const state = getDefaultState(); +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()); + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value; + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription); + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription); + } + }, + getters: { + getEvidence: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getAllEvidence: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields; + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init'); + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate'); + }); + } + }, + resetState({ commit }) { + commit('RESET_STATE'); + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription); + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload); + }); + }, + async QueryEvidence({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryEvidence.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryAllEvidence({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryAllEvidence.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async MsgSubmitEvidence({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgSubmitEvidence(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + } +}; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.ts new file mode 100644 index 0000000000..f3c88a0f09 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.ts @@ -0,0 +1,127 @@ +import { txClient, queryClient } from './module' + +import { Equivocation } from "./module/types/cosmos/evidence/v1beta1/evidence" + + +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }) +} + +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }) +} + +function getStructure(template) { + let structure = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field: any = {} + field.name = key + field.type = typeof value + structure.fields.push(field) + } + return structure +} + +const getDefaultState = () => { + return { + getEvidence: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getAllEvidence: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + _Structure: { + Equivocation: getStructure(Equivocation.fromPartial({})), + + }, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription) + } + }, + getters: { + getEvidence: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getAllEvidence: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init') + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload) + }) + }, + async QueryEvidence({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryEvidence.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryAllEvidence({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryAllEvidence.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + + async MsgSubmitEvidence({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgSubmitEvidence(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + + } +} diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/vuex-root b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/vuex-root new file mode 100644 index 0000000000..e69de29bb2 diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.d.ts new file mode 100644 index 0000000000..69e07fa241 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.d.ts @@ -0,0 +1,149 @@ +declare const _default: { + namespaced: boolean; + state: { + getProposal: (state: any) => (params?: {}) => any; + getProposals: (state: any) => (params?: {}) => any; + getVote: (state: any) => (params?: {}) => any; + getVotes: (state: any) => (params?: {}) => any; + getParams: (state: any) => (params?: {}) => any; + getDeposit: (state: any) => (params?: {}) => any; + getDeposits: (state: any) => (params?: {}) => any; + getTallyResult: (state: any) => (params?: {}) => any; + _Structure: { + TextProposal: { + fields: any[]; + }; + Deposit: { + fields: any[]; + }; + Proposal: { + fields: any[]; + }; + TallyResult: { + fields: any[]; + }; + Vote: { + fields: any[]; + }; + DepositParams: { + fields: any[]; + }; + VotingParams: { + fields: any[]; + }; + TallyParams: { + fields: any[]; + }; + }; + _Subscriptions: Set; + }; + mutations: { + RESET_STATE(state: any): void; + QUERY(state: any, { query, key, value }: { + query: any; + key: any; + value: any; + }): void; + SUBSCRIBE(state: any, subscription: any): void; + UNSUBSCRIBE(state: any, subscription: any): void; + }; + getters: { + getProposal: (state: any) => (params?: {}) => any; + getProposals: (state: any) => (params?: {}) => any; + getVote: (state: any) => (params?: {}) => any; + getVotes: (state: any) => (params?: {}) => any; + getParams: (state: any) => (params?: {}) => any; + getDeposit: (state: any) => (params?: {}) => any; + getDeposits: (state: any) => (params?: {}) => any; + getTallyResult: (state: any) => (params?: {}) => any; + getTypeStructure: (state: any) => (type: any) => any; + }; + actions: { + init({ dispatch, rootGetters }: { + dispatch: any; + rootGetters: any; + }): void; + resetState({ commit }: { + commit: any; + }): void; + unsubscribe({ commit }: { + commit: any; + }, subscription: any): void; + StoreUpdate({ state, dispatch }: { + state: any; + dispatch: any; + }): Promise; + QueryProposal({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryProposals({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryVote({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryVotes({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryParams({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryDeposit({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryDeposits({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryTallyResult({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + MsgVote({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgSubmitProposal({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgDeposit({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + }; +}; +export default _default; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.js new file mode 100644 index 0000000000..1fac59c4cb --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.js @@ -0,0 +1,253 @@ +import { txClient, queryClient } from './module'; +import { TextProposal } from "./module/types/cosmos/gov/v1beta1/gov"; +import { Deposit } from "./module/types/cosmos/gov/v1beta1/gov"; +import { Proposal } from "./module/types/cosmos/gov/v1beta1/gov"; +import { TallyResult } from "./module/types/cosmos/gov/v1beta1/gov"; +import { Vote } from "./module/types/cosmos/gov/v1beta1/gov"; +import { DepositParams } from "./module/types/cosmos/gov/v1beta1/gov"; +import { VotingParams } from "./module/types/cosmos/gov/v1beta1/gov"; +import { TallyParams } from "./module/types/cosmos/gov/v1beta1/gov"; +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }); +} +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }); +} +function getStructure(template) { + let structure = { fields: [] }; + for (const [key, value] of Object.entries(template)) { + let field = {}; + field.name = key; + field.type = typeof value; + structure.fields.push(field); + } + return structure; +} +const getDefaultState = () => { + return { + getProposal: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getProposals: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getVote: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getVotes: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDeposit: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDeposits: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getTallyResult: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + _Structure: { + TextProposal: getStructure(TextProposal.fromPartial({})), + Deposit: getStructure(Deposit.fromPartial({})), + Proposal: getStructure(Proposal.fromPartial({})), + TallyResult: getStructure(TallyResult.fromPartial({})), + Vote: getStructure(Vote.fromPartial({})), + DepositParams: getStructure(DepositParams.fromPartial({})), + VotingParams: getStructure(VotingParams.fromPartial({})), + TallyParams: getStructure(TallyParams.fromPartial({})), + }, + _Subscriptions: new Set(), + }; +}; +// initial state +const state = getDefaultState(); +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()); + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value; + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription); + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription); + } + }, + getters: { + getProposal: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getProposals: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getVote: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getVotes: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDeposit: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDeposits: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getTallyResult: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields; + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init'); + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate'); + }); + } + }, + resetState({ commit }) { + commit('RESET_STATE'); + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription); + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload); + }); + }, + async QueryProposal({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryProposal.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryProposals({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryProposals.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryVote({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryVote.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryVotes({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryVotes.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryParams({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryParams.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryDeposit({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDeposit.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryDeposits({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDeposits.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryTallyResult({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryTallyResult.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async MsgVote({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgVote(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgSubmitProposal({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgSubmitProposal(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgDeposit({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgDeposit(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + } +}; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.ts new file mode 100644 index 0000000000..b0a7129f96 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.ts @@ -0,0 +1,247 @@ +import { txClient, queryClient } from './module' + +import { TextProposal } from "./module/types/cosmos/gov/v1beta1/gov" +import { Deposit } from "./module/types/cosmos/gov/v1beta1/gov" +import { Proposal } from "./module/types/cosmos/gov/v1beta1/gov" +import { TallyResult } from "./module/types/cosmos/gov/v1beta1/gov" +import { Vote } from "./module/types/cosmos/gov/v1beta1/gov" +import { DepositParams } from "./module/types/cosmos/gov/v1beta1/gov" +import { VotingParams } from "./module/types/cosmos/gov/v1beta1/gov" +import { TallyParams } from "./module/types/cosmos/gov/v1beta1/gov" + + +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }) +} + +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }) +} + +function getStructure(template) { + let structure = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field: any = {} + field.name = key + field.type = typeof value + structure.fields.push(field) + } + return structure +} + +const getDefaultState = () => { + return { + getProposal: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getProposals: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getVote: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getVotes: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDeposit: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDeposits: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getTallyResult: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + _Structure: { + TextProposal: getStructure(TextProposal.fromPartial({})), + Deposit: getStructure(Deposit.fromPartial({})), + Proposal: getStructure(Proposal.fromPartial({})), + TallyResult: getStructure(TallyResult.fromPartial({})), + Vote: getStructure(Vote.fromPartial({})), + DepositParams: getStructure(DepositParams.fromPartial({})), + VotingParams: getStructure(VotingParams.fromPartial({})), + TallyParams: getStructure(TallyParams.fromPartial({})), + + }, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription) + } + }, + getters: { + getProposal: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getProposals: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getVote: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getVotes: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDeposit: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDeposits: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getTallyResult: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init') + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload) + }) + }, + async QueryProposal({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryProposal.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryProposals({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryProposals.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryVote({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryVote.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryVotes({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryVotes.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryParams({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryParams.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryDeposit({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDeposit.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryDeposits({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDeposits.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryTallyResult({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryTallyResult.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + + async MsgVote({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgVote(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgSubmitProposal({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgSubmitProposal(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgDeposit({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgDeposit(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + + } +} diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/index.d.ts index db36d9dd80..7946fe328e 100644 --- a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/index.d.ts +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/index.d.ts @@ -1,9 +1,9 @@ import { StdFee } from "@cosmjs/launchpad"; import { OfflineSigner, EncodeObject } from "@cosmjs/proto-signing"; import { Api } from "./rest"; +import { MsgVote } from "./types/cosmos/gov/v1beta1/tx"; import { MsgSubmitProposal } from "./types/cosmos/gov/v1beta1/tx"; import { MsgDeposit } from "./types/cosmos/gov/v1beta1/tx"; -import { MsgVote } from "./types/cosmos/gov/v1beta1/tx"; interface TxClientOptions { addr: string; } @@ -12,9 +12,9 @@ interface SignAndBroadcastOptions { } declare const txClient: (wallet: OfflineSigner, { addr: addr }?: TxClientOptions) => Promise<{ signAndBroadcast: (msgs: EncodeObject[], { fee: fee }?: SignAndBroadcastOptions) => Promise; + msgVote: (data: MsgVote) => EncodeObject; msgSubmitProposal: (data: MsgSubmitProposal) => EncodeObject; msgDeposit: (data: MsgDeposit) => EncodeObject; - msgVote: (data: MsgVote) => EncodeObject; }>; interface QueryClientOptions { addr: string; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/index.js index 8d6047df13..5b8c8d7ff9 100644 --- a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/index.js +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/index.js @@ -1,13 +1,13 @@ import { SigningStargateClient } from "@cosmjs/stargate"; import { Registry } from "@cosmjs/proto-signing"; import { Api } from "./rest"; +import { MsgVote } from "./types/cosmos/gov/v1beta1/tx"; import { MsgSubmitProposal } from "./types/cosmos/gov/v1beta1/tx"; import { MsgDeposit } from "./types/cosmos/gov/v1beta1/tx"; -import { MsgVote } from "./types/cosmos/gov/v1beta1/tx"; const types = [ + ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit], - ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ]; const registry = new Registry(types); const defaultFee = { @@ -21,9 +21,9 @@ const txClient = async (wallet, { addr: addr } = { addr: "http://localhost:26657 const { address } = (await wallet.getAccounts())[0]; return { signAndBroadcast: (msgs, { fee: fee } = { fee: defaultFee }) => client.signAndBroadcast(address, msgs, fee), + msgVote: (data) => ({ typeUrl: "/cosmos.gov.v1beta1.MsgVote", value: data }), msgSubmitProposal: (data) => ({ typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", value: data }), msgDeposit: (data) => ({ typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", value: data }), - msgVote: (data) => ({ typeUrl: "/cosmos.gov.v1beta1.MsgVote", value: data }), }; }; const queryClient = async ({ addr: addr } = { addr: "http://localhost:1317" }) => { diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/index.ts index 0117e3acc9..b90b523512 100644 --- a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/index.ts +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/index.ts @@ -2,15 +2,15 @@ import { coins, StdFee } from "@cosmjs/launchpad"; import { SigningStargateClient } from "@cosmjs/stargate"; import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; import { Api } from "./rest"; +import { MsgVote } from "./types/cosmos/gov/v1beta1/tx"; import { MsgSubmitProposal } from "./types/cosmos/gov/v1beta1/tx"; import { MsgDeposit } from "./types/cosmos/gov/v1beta1/tx"; -import { MsgVote } from "./types/cosmos/gov/v1beta1/tx"; const types = [ + ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal], ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit], - ["/cosmos.gov.v1beta1.MsgVote", MsgVote], ]; @@ -37,9 +37,9 @@ const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = return { signAndBroadcast: (msgs: EncodeObject[], { fee: fee }: SignAndBroadcastOptions = { fee: defaultFee }) => client.signAndBroadcast(address, msgs, fee), + msgVote: (data: MsgVote): EncodeObject => ({ typeUrl: "/cosmos.gov.v1beta1.MsgVote", value: data }), msgSubmitProposal: (data: MsgSubmitProposal): EncodeObject => ({ typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", value: data }), msgDeposit: (data: MsgDeposit): EncodeObject => ({ typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", value: data }), - msgVote: (data: MsgVote): EncodeObject => ({ typeUrl: "/cosmos.gov.v1beta1.MsgVote", value: data }), }; }; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/vuex-root b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/vuex-root new file mode 100644 index 0000000000..e69de29bb2 diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.d.ts new file mode 100644 index 0000000000..9253dfec36 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.d.ts @@ -0,0 +1,85 @@ +declare const _default: { + namespaced: boolean; + state: { + getParams: (state: any) => (params?: {}) => any; + getSigningInfo: (state: any) => (params?: {}) => any; + getSigningInfos: (state: any) => (params?: {}) => any; + _Structure: { + ValidatorSigningInfo: { + fields: any[]; + }; + Params: { + fields: any[]; + }; + SigningInfo: { + fields: any[]; + }; + ValidatorMissedBlocks: { + fields: any[]; + }; + MissedBlock: { + fields: any[]; + }; + }; + _Subscriptions: Set; + }; + mutations: { + RESET_STATE(state: any): void; + QUERY(state: any, { query, key, value }: { + query: any; + key: any; + value: any; + }): void; + SUBSCRIBE(state: any, subscription: any): void; + UNSUBSCRIBE(state: any, subscription: any): void; + }; + getters: { + getParams: (state: any) => (params?: {}) => any; + getSigningInfo: (state: any) => (params?: {}) => any; + getSigningInfos: (state: any) => (params?: {}) => any; + getTypeStructure: (state: any) => (type: any) => any; + }; + actions: { + init({ dispatch, rootGetters }: { + dispatch: any; + rootGetters: any; + }): void; + resetState({ commit }: { + commit: any; + }): void; + unsubscribe({ commit }: { + commit: any; + }, subscription: any): void; + StoreUpdate({ state, dispatch }: { + state: any; + dispatch: any; + }): Promise; + QueryParams({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QuerySigningInfo({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QuerySigningInfos({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + MsgUnjail({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + }; +}; +export default _default; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.js new file mode 100644 index 0000000000..ca801157be --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.js @@ -0,0 +1,144 @@ +import { txClient, queryClient } from './module'; +import { ValidatorSigningInfo } from "./module/types/cosmos/slashing/v1beta1/slashing"; +import { Params } from "./module/types/cosmos/slashing/v1beta1/slashing"; +import { SigningInfo } from "./module/types/cosmos/slashing/v1beta1/genesis"; +import { ValidatorMissedBlocks } from "./module/types/cosmos/slashing/v1beta1/genesis"; +import { MissedBlock } from "./module/types/cosmos/slashing/v1beta1/genesis"; +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }); +} +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }); +} +function getStructure(template) { + let structure = { fields: [] }; + for (const [key, value] of Object.entries(template)) { + let field = {}; + field.name = key; + field.type = typeof value; + structure.fields.push(field); + } + return structure; +} +const getDefaultState = () => { + return { + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getSigningInfo: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getSigningInfos: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + _Structure: { + ValidatorSigningInfo: getStructure(ValidatorSigningInfo.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + SigningInfo: getStructure(SigningInfo.fromPartial({})), + ValidatorMissedBlocks: getStructure(ValidatorMissedBlocks.fromPartial({})), + MissedBlock: getStructure(MissedBlock.fromPartial({})), + }, + _Subscriptions: new Set(), + }; +}; +// initial state +const state = getDefaultState(); +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()); + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value; + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription); + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription); + } + }, + getters: { + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getSigningInfo: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getSigningInfos: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields; + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init'); + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate'); + }); + } + }, + resetState({ commit }) { + commit('RESET_STATE'); + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription); + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload); + }); + }, + async QueryParams({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryParams.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QuerySigningInfo({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).querySigningInfo.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QuerySigningInfos({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).querySigningInfos.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async MsgUnjail({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgUnjail(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + } +}; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.ts new file mode 100644 index 0000000000..4adb858433 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.ts @@ -0,0 +1,150 @@ +import { txClient, queryClient } from './module' + +import { ValidatorSigningInfo } from "./module/types/cosmos/slashing/v1beta1/slashing" +import { Params } from "./module/types/cosmos/slashing/v1beta1/slashing" +import { SigningInfo } from "./module/types/cosmos/slashing/v1beta1/genesis" +import { ValidatorMissedBlocks } from "./module/types/cosmos/slashing/v1beta1/genesis" +import { MissedBlock } from "./module/types/cosmos/slashing/v1beta1/genesis" + + +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }) +} + +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }) +} + +function getStructure(template) { + let structure = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field: any = {} + field.name = key + field.type = typeof value + structure.fields.push(field) + } + return structure +} + +const getDefaultState = () => { + return { + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getSigningInfo: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getSigningInfos: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + _Structure: { + ValidatorSigningInfo: getStructure(ValidatorSigningInfo.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + SigningInfo: getStructure(SigningInfo.fromPartial({})), + ValidatorMissedBlocks: getStructure(ValidatorMissedBlocks.fromPartial({})), + MissedBlock: getStructure(MissedBlock.fromPartial({})), + + }, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription) + } + }, + getters: { + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getSigningInfo: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getSigningInfos: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init') + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload) + }) + }, + async QueryParams({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryParams.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QuerySigningInfo({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).querySigningInfo.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QuerySigningInfos({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).querySigningInfos.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + + async MsgUnjail({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgUnjail(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + + } +} diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/vuex-root b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/vuex-root new file mode 100644 index 0000000000..e69de29bb2 diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.d.ts new file mode 100644 index 0000000000..0775ead8f5 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.d.ts @@ -0,0 +1,252 @@ +declare const _default: { + namespaced: boolean; + state: { + getValidators: (state: any) => (params?: {}) => any; + getValidator: (state: any) => (params?: {}) => any; + getValidatorDelegations: (state: any) => (params?: {}) => any; + getValidatorUnbondingDelegations: (state: any) => (params?: {}) => any; + getDelegation: (state: any) => (params?: {}) => any; + getUnbondingDelegation: (state: any) => (params?: {}) => any; + getDelegatorDelegations: (state: any) => (params?: {}) => any; + getDelegatorUnbondingDelegations: (state: any) => (params?: {}) => any; + getRedelegations: (state: any) => (params?: {}) => any; + getDelegatorValidators: (state: any) => (params?: {}) => any; + getDelegatorValidator: (state: any) => (params?: {}) => any; + getHistoricalInfo: (state: any) => (params?: {}) => any; + getPool: (state: any) => (params?: {}) => any; + getParams: (state: any) => (params?: {}) => any; + _Structure: { + HistoricalInfo: { + fields: any[]; + }; + CommissionRates: { + fields: any[]; + }; + Commission: { + fields: any[]; + }; + Description: { + fields: any[]; + }; + Validator: { + fields: any[]; + }; + ValAddresses: { + fields: any[]; + }; + DVPair: { + fields: any[]; + }; + DVPairs: { + fields: any[]; + }; + DVVTriplet: { + fields: any[]; + }; + DVVTriplets: { + fields: any[]; + }; + Delegation: { + fields: any[]; + }; + UnbondingDelegation: { + fields: any[]; + }; + UnbondingDelegationEntry: { + fields: any[]; + }; + RedelegationEntry: { + fields: any[]; + }; + Redelegation: { + fields: any[]; + }; + Params: { + fields: any[]; + }; + DelegationResponse: { + fields: any[]; + }; + RedelegationEntryResponse: { + fields: any[]; + }; + RedelegationResponse: { + fields: any[]; + }; + Pool: { + fields: any[]; + }; + LastValidatorPower: { + fields: any[]; + }; + }; + _Subscriptions: Set; + }; + mutations: { + RESET_STATE(state: any): void; + QUERY(state: any, { query, key, value }: { + query: any; + key: any; + value: any; + }): void; + SUBSCRIBE(state: any, subscription: any): void; + UNSUBSCRIBE(state: any, subscription: any): void; + }; + getters: { + getValidators: (state: any) => (params?: {}) => any; + getValidator: (state: any) => (params?: {}) => any; + getValidatorDelegations: (state: any) => (params?: {}) => any; + getValidatorUnbondingDelegations: (state: any) => (params?: {}) => any; + getDelegation: (state: any) => (params?: {}) => any; + getUnbondingDelegation: (state: any) => (params?: {}) => any; + getDelegatorDelegations: (state: any) => (params?: {}) => any; + getDelegatorUnbondingDelegations: (state: any) => (params?: {}) => any; + getRedelegations: (state: any) => (params?: {}) => any; + getDelegatorValidators: (state: any) => (params?: {}) => any; + getDelegatorValidator: (state: any) => (params?: {}) => any; + getHistoricalInfo: (state: any) => (params?: {}) => any; + getPool: (state: any) => (params?: {}) => any; + getParams: (state: any) => (params?: {}) => any; + getTypeStructure: (state: any) => (type: any) => any; + }; + actions: { + init({ dispatch, rootGetters }: { + dispatch: any; + rootGetters: any; + }): void; + resetState({ commit }: { + commit: any; + }): void; + unsubscribe({ commit }: { + commit: any; + }, subscription: any): void; + StoreUpdate({ state, dispatch }: { + state: any; + dispatch: any; + }): Promise; + QueryValidators({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryValidator({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryValidatorDelegations({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryValidatorUnbondingDelegations({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryDelegation({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryUnbondingDelegation({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryDelegatorDelegations({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryDelegatorUnbondingDelegations({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryRedelegations({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryDelegatorValidators({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryDelegatorValidator({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryHistoricalInfo({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryPool({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryParams({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + MsgBeginRedelegate({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgEditValidator({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgDelegate({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgUndelegate({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgCreateValidator({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + }; +}; +export default _default; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.js new file mode 100644 index 0000000000..f19e97d063 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.js @@ -0,0 +1,399 @@ +import { txClient, queryClient } from './module'; +import { HistoricalInfo } from "./module/types/cosmos/staking/v1beta1/staking"; +import { CommissionRates } from "./module/types/cosmos/staking/v1beta1/staking"; +import { Commission } from "./module/types/cosmos/staking/v1beta1/staking"; +import { Description } from "./module/types/cosmos/staking/v1beta1/staking"; +import { Validator } from "./module/types/cosmos/staking/v1beta1/staking"; +import { ValAddresses } from "./module/types/cosmos/staking/v1beta1/staking"; +import { DVPair } from "./module/types/cosmos/staking/v1beta1/staking"; +import { DVPairs } from "./module/types/cosmos/staking/v1beta1/staking"; +import { DVVTriplet } from "./module/types/cosmos/staking/v1beta1/staking"; +import { DVVTriplets } from "./module/types/cosmos/staking/v1beta1/staking"; +import { Delegation } from "./module/types/cosmos/staking/v1beta1/staking"; +import { UnbondingDelegation } from "./module/types/cosmos/staking/v1beta1/staking"; +import { UnbondingDelegationEntry } from "./module/types/cosmos/staking/v1beta1/staking"; +import { RedelegationEntry } from "./module/types/cosmos/staking/v1beta1/staking"; +import { Redelegation } from "./module/types/cosmos/staking/v1beta1/staking"; +import { Params } from "./module/types/cosmos/staking/v1beta1/staking"; +import { DelegationResponse } from "./module/types/cosmos/staking/v1beta1/staking"; +import { RedelegationEntryResponse } from "./module/types/cosmos/staking/v1beta1/staking"; +import { RedelegationResponse } from "./module/types/cosmos/staking/v1beta1/staking"; +import { Pool } from "./module/types/cosmos/staking/v1beta1/staking"; +import { LastValidatorPower } from "./module/types/cosmos/staking/v1beta1/genesis"; +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }); +} +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }); +} +function getStructure(template) { + let structure = { fields: [] }; + for (const [key, value] of Object.entries(template)) { + let field = {}; + field.name = key; + field.type = typeof value; + structure.fields.push(field); + } + return structure; +} +const getDefaultState = () => { + return { + getValidators: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getValidator: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getValidatorDelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getValidatorUnbondingDelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegation: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getUnbondingDelegation: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegatorDelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegatorUnbondingDelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getRedelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegatorValidators: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegatorValidator: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getHistoricalInfo: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getPool: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + _Structure: { + HistoricalInfo: getStructure(HistoricalInfo.fromPartial({})), + CommissionRates: getStructure(CommissionRates.fromPartial({})), + Commission: getStructure(Commission.fromPartial({})), + Description: getStructure(Description.fromPartial({})), + Validator: getStructure(Validator.fromPartial({})), + ValAddresses: getStructure(ValAddresses.fromPartial({})), + DVPair: getStructure(DVPair.fromPartial({})), + DVPairs: getStructure(DVPairs.fromPartial({})), + DVVTriplet: getStructure(DVVTriplet.fromPartial({})), + DVVTriplets: getStructure(DVVTriplets.fromPartial({})), + Delegation: getStructure(Delegation.fromPartial({})), + UnbondingDelegation: getStructure(UnbondingDelegation.fromPartial({})), + UnbondingDelegationEntry: getStructure(UnbondingDelegationEntry.fromPartial({})), + RedelegationEntry: getStructure(RedelegationEntry.fromPartial({})), + Redelegation: getStructure(Redelegation.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + DelegationResponse: getStructure(DelegationResponse.fromPartial({})), + RedelegationEntryResponse: getStructure(RedelegationEntryResponse.fromPartial({})), + RedelegationResponse: getStructure(RedelegationResponse.fromPartial({})), + Pool: getStructure(Pool.fromPartial({})), + LastValidatorPower: getStructure(LastValidatorPower.fromPartial({})), + }, + _Subscriptions: new Set(), + }; +}; +// initial state +const state = getDefaultState(); +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()); + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value; + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription); + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription); + } + }, + getters: { + getValidators: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getValidator: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getValidatorDelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getValidatorUnbondingDelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegation: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getUnbondingDelegation: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegatorDelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegatorUnbondingDelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getRedelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegatorValidators: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDelegatorValidator: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getHistoricalInfo: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getPool: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields; + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init'); + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate'); + }); + } + }, + resetState({ commit }) { + commit('RESET_STATE'); + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription); + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload); + }); + }, + async QueryValidators({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryValidators.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryValidator({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryValidator.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryValidatorDelegations({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryValidatorDelegations.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryValidatorUnbondingDelegations({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryValidatorUnbondingDelegations.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryDelegation({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegation.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryUnbondingDelegation({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryUnbondingDelegation.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryDelegatorDelegations({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegatorDelegations.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryDelegatorUnbondingDelegations({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegatorUnbondingDelegations.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryRedelegations({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryRedelegations.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryDelegatorValidators({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegatorValidators.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryDelegatorValidator({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegatorValidator.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryHistoricalInfo({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryHistoricalInfo.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryPool({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryPool.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryParams({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryParams.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async MsgBeginRedelegate({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgBeginRedelegate(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgEditValidator({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgEditValidator(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgDelegate({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgDelegate(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgUndelegate({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgUndelegate(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgCreateValidator({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgCreateValidator(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + } +}; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.ts new file mode 100644 index 0000000000..a9f914eb18 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.ts @@ -0,0 +1,379 @@ +import { txClient, queryClient } from './module' + +import { HistoricalInfo } from "./module/types/cosmos/staking/v1beta1/staking" +import { CommissionRates } from "./module/types/cosmos/staking/v1beta1/staking" +import { Commission } from "./module/types/cosmos/staking/v1beta1/staking" +import { Description } from "./module/types/cosmos/staking/v1beta1/staking" +import { Validator } from "./module/types/cosmos/staking/v1beta1/staking" +import { ValAddresses } from "./module/types/cosmos/staking/v1beta1/staking" +import { DVPair } from "./module/types/cosmos/staking/v1beta1/staking" +import { DVPairs } from "./module/types/cosmos/staking/v1beta1/staking" +import { DVVTriplet } from "./module/types/cosmos/staking/v1beta1/staking" +import { DVVTriplets } from "./module/types/cosmos/staking/v1beta1/staking" +import { Delegation } from "./module/types/cosmos/staking/v1beta1/staking" +import { UnbondingDelegation } from "./module/types/cosmos/staking/v1beta1/staking" +import { UnbondingDelegationEntry } from "./module/types/cosmos/staking/v1beta1/staking" +import { RedelegationEntry } from "./module/types/cosmos/staking/v1beta1/staking" +import { Redelegation } from "./module/types/cosmos/staking/v1beta1/staking" +import { Params } from "./module/types/cosmos/staking/v1beta1/staking" +import { DelegationResponse } from "./module/types/cosmos/staking/v1beta1/staking" +import { RedelegationEntryResponse } from "./module/types/cosmos/staking/v1beta1/staking" +import { RedelegationResponse } from "./module/types/cosmos/staking/v1beta1/staking" +import { Pool } from "./module/types/cosmos/staking/v1beta1/staking" +import { LastValidatorPower } from "./module/types/cosmos/staking/v1beta1/genesis" + + +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }) +} + +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }) +} + +function getStructure(template) { + let structure = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field: any = {} + field.name = key + field.type = typeof value + structure.fields.push(field) + } + return structure +} + +const getDefaultState = () => { + return { + getValidators: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getValidator: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getValidatorDelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getValidatorUnbondingDelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegation: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getUnbondingDelegation: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegatorDelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegatorUnbondingDelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getRedelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegatorValidators: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegatorValidator: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getHistoricalInfo: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getPool: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + _Structure: { + HistoricalInfo: getStructure(HistoricalInfo.fromPartial({})), + CommissionRates: getStructure(CommissionRates.fromPartial({})), + Commission: getStructure(Commission.fromPartial({})), + Description: getStructure(Description.fromPartial({})), + Validator: getStructure(Validator.fromPartial({})), + ValAddresses: getStructure(ValAddresses.fromPartial({})), + DVPair: getStructure(DVPair.fromPartial({})), + DVPairs: getStructure(DVPairs.fromPartial({})), + DVVTriplet: getStructure(DVVTriplet.fromPartial({})), + DVVTriplets: getStructure(DVVTriplets.fromPartial({})), + Delegation: getStructure(Delegation.fromPartial({})), + UnbondingDelegation: getStructure(UnbondingDelegation.fromPartial({})), + UnbondingDelegationEntry: getStructure(UnbondingDelegationEntry.fromPartial({})), + RedelegationEntry: getStructure(RedelegationEntry.fromPartial({})), + Redelegation: getStructure(Redelegation.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + DelegationResponse: getStructure(DelegationResponse.fromPartial({})), + RedelegationEntryResponse: getStructure(RedelegationEntryResponse.fromPartial({})), + RedelegationResponse: getStructure(RedelegationResponse.fromPartial({})), + Pool: getStructure(Pool.fromPartial({})), + LastValidatorPower: getStructure(LastValidatorPower.fromPartial({})), + + }, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription) + } + }, + getters: { + getValidators: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getValidator: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getValidatorDelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getValidatorUnbondingDelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegation: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getUnbondingDelegation: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegatorDelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegatorUnbondingDelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getRedelegations: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegatorValidators: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDelegatorValidator: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getHistoricalInfo: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getPool: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init') + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload) + }) + }, + async QueryValidators({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryValidators.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryValidator({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryValidator.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryValidatorDelegations({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryValidatorDelegations.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryValidatorUnbondingDelegations({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryValidatorUnbondingDelegations.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryDelegation({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegation.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryUnbondingDelegation({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryUnbondingDelegation.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryDelegatorDelegations({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegatorDelegations.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryDelegatorUnbondingDelegations({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegatorUnbondingDelegations.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryRedelegations({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryRedelegations.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryDelegatorValidators({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegatorValidators.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryDelegatorValidator({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDelegatorValidator.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryHistoricalInfo({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryHistoricalInfo.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryPool({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryPool.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryParams({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryParams.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + + async MsgBeginRedelegate({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgBeginRedelegate(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgEditValidator({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgEditValidator(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgDelegate({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgDelegate(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgUndelegate({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgUndelegate(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgCreateValidator({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgCreateValidator(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + + } +} diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/index.d.ts index b380efe13b..9a76844e14 100644 --- a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/index.d.ts +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/index.d.ts @@ -1,11 +1,11 @@ import { StdFee } from "@cosmjs/launchpad"; import { OfflineSigner, EncodeObject } from "@cosmjs/proto-signing"; import { Api } from "./rest"; -import { MsgCreateValidator } from "./types/cosmos/staking/v1beta1/tx"; -import { MsgUndelegate } from "./types/cosmos/staking/v1beta1/tx"; -import { MsgEditValidator } from "./types/cosmos/staking/v1beta1/tx"; import { MsgBeginRedelegate } from "./types/cosmos/staking/v1beta1/tx"; +import { MsgEditValidator } from "./types/cosmos/staking/v1beta1/tx"; import { MsgDelegate } from "./types/cosmos/staking/v1beta1/tx"; +import { MsgUndelegate } from "./types/cosmos/staking/v1beta1/tx"; +import { MsgCreateValidator } from "./types/cosmos/staking/v1beta1/tx"; interface TxClientOptions { addr: string; } @@ -14,11 +14,11 @@ interface SignAndBroadcastOptions { } declare const txClient: (wallet: OfflineSigner, { addr: addr }?: TxClientOptions) => Promise<{ signAndBroadcast: (msgs: EncodeObject[], { fee: fee }?: SignAndBroadcastOptions) => Promise; - msgCreateValidator: (data: MsgCreateValidator) => EncodeObject; - msgUndelegate: (data: MsgUndelegate) => EncodeObject; - msgEditValidator: (data: MsgEditValidator) => EncodeObject; msgBeginRedelegate: (data: MsgBeginRedelegate) => EncodeObject; + msgEditValidator: (data: MsgEditValidator) => EncodeObject; msgDelegate: (data: MsgDelegate) => EncodeObject; + msgUndelegate: (data: MsgUndelegate) => EncodeObject; + msgCreateValidator: (data: MsgCreateValidator) => EncodeObject; }>; interface QueryClientOptions { addr: string; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/index.js index fb2f918304..79776cf529 100644 --- a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/index.js +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/index.js @@ -1,17 +1,17 @@ import { SigningStargateClient } from "@cosmjs/stargate"; import { Registry } from "@cosmjs/proto-signing"; import { Api } from "./rest"; -import { MsgCreateValidator } from "./types/cosmos/staking/v1beta1/tx"; -import { MsgUndelegate } from "./types/cosmos/staking/v1beta1/tx"; -import { MsgEditValidator } from "./types/cosmos/staking/v1beta1/tx"; import { MsgBeginRedelegate } from "./types/cosmos/staking/v1beta1/tx"; +import { MsgEditValidator } from "./types/cosmos/staking/v1beta1/tx"; import { MsgDelegate } from "./types/cosmos/staking/v1beta1/tx"; +import { MsgUndelegate } from "./types/cosmos/staking/v1beta1/tx"; +import { MsgCreateValidator } from "./types/cosmos/staking/v1beta1/tx"; const types = [ - ["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], - ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate], - ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], + ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], + ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate], + ["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], ]; const registry = new Registry(types); const defaultFee = { @@ -25,11 +25,11 @@ const txClient = async (wallet, { addr: addr } = { addr: "http://localhost:26657 const { address } = (await wallet.getAccounts())[0]; return { signAndBroadcast: (msgs, { fee: fee } = { fee: defaultFee }) => client.signAndBroadcast(address, msgs, fee), - msgCreateValidator: (data) => ({ typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", value: data }), - msgUndelegate: (data) => ({ typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", value: data }), - msgEditValidator: (data) => ({ typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", value: data }), msgBeginRedelegate: (data) => ({ typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", value: data }), + msgEditValidator: (data) => ({ typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", value: data }), msgDelegate: (data) => ({ typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", value: data }), + msgUndelegate: (data) => ({ typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", value: data }), + msgCreateValidator: (data) => ({ typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", value: data }), }; }; const queryClient = async ({ addr: addr } = { addr: "http://localhost:1317" }) => { diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/index.ts index 9167272620..373a87f17a 100644 --- a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/index.ts +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/index.ts @@ -2,19 +2,19 @@ import { coins, StdFee } from "@cosmjs/launchpad"; import { SigningStargateClient } from "@cosmjs/stargate"; import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; import { Api } from "./rest"; -import { MsgCreateValidator } from "./types/cosmos/staking/v1beta1/tx"; -import { MsgUndelegate } from "./types/cosmos/staking/v1beta1/tx"; -import { MsgEditValidator } from "./types/cosmos/staking/v1beta1/tx"; import { MsgBeginRedelegate } from "./types/cosmos/staking/v1beta1/tx"; +import { MsgEditValidator } from "./types/cosmos/staking/v1beta1/tx"; import { MsgDelegate } from "./types/cosmos/staking/v1beta1/tx"; +import { MsgUndelegate } from "./types/cosmos/staking/v1beta1/tx"; +import { MsgCreateValidator } from "./types/cosmos/staking/v1beta1/tx"; const types = [ - ["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], - ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate], - ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate], + ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator], ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate], + ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate], + ["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator], ]; @@ -41,11 +41,11 @@ const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = return { signAndBroadcast: (msgs: EncodeObject[], { fee: fee }: SignAndBroadcastOptions = { fee: defaultFee }) => client.signAndBroadcast(address, msgs, fee), - msgCreateValidator: (data: MsgCreateValidator): EncodeObject => ({ typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", value: data }), - msgUndelegate: (data: MsgUndelegate): EncodeObject => ({ typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", value: data }), - msgEditValidator: (data: MsgEditValidator): EncodeObject => ({ typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", value: data }), msgBeginRedelegate: (data: MsgBeginRedelegate): EncodeObject => ({ typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", value: data }), + msgEditValidator: (data: MsgEditValidator): EncodeObject => ({ typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", value: data }), msgDelegate: (data: MsgDelegate): EncodeObject => ({ typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", value: data }), + msgUndelegate: (data: MsgUndelegate): EncodeObject => ({ typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", value: data }), + msgCreateValidator: (data: MsgCreateValidator): EncodeObject => ({ typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", value: data }), }; }; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/vuex-root b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/vuex-root new file mode 100644 index 0000000000..e69de29bb2 diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/index.d.ts new file mode 100644 index 0000000000..4ef897753c --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/index.d.ts @@ -0,0 +1,58 @@ +declare const _default: { + namespaced: boolean; + state: { + _Structure: { + BaseVestingAccount: { + fields: any[]; + }; + ContinuousVestingAccount: { + fields: any[]; + }; + DelayedVestingAccount: { + fields: any[]; + }; + Period: { + fields: any[]; + }; + PeriodicVestingAccount: { + fields: any[]; + }; + }; + _Subscriptions: Set; + }; + mutations: { + RESET_STATE(state: any): void; + QUERY(state: any, { query, key, value }: { + query: any; + key: any; + value: any; + }): void; + SUBSCRIBE(state: any, subscription: any): void; + UNSUBSCRIBE(state: any, subscription: any): void; + }; + getters: { + getTypeStructure: (state: any) => (type: any) => any; + }; + actions: { + init({ dispatch, rootGetters }: { + dispatch: any; + rootGetters: any; + }): void; + resetState({ commit }: { + commit: any; + }): void; + unsubscribe({ commit }: { + commit: any; + }, subscription: any): void; + StoreUpdate({ state, dispatch }: { + state: any; + dispatch: any; + }): Promise; + MsgCreateVestingAccount({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + }; +}; +export default _default; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/index.js new file mode 100644 index 0000000000..1829466d2e --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/index.js @@ -0,0 +1,93 @@ +import { txClient, queryClient } from './module'; +import { BaseVestingAccount } from "./module/types/cosmos/vesting/v1beta1/vesting"; +import { ContinuousVestingAccount } from "./module/types/cosmos/vesting/v1beta1/vesting"; +import { DelayedVestingAccount } from "./module/types/cosmos/vesting/v1beta1/vesting"; +import { Period } from "./module/types/cosmos/vesting/v1beta1/vesting"; +import { PeriodicVestingAccount } from "./module/types/cosmos/vesting/v1beta1/vesting"; +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }); +} +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }); +} +function getStructure(template) { + let structure = { fields: [] }; + for (const [key, value] of Object.entries(template)) { + let field = {}; + field.name = key; + field.type = typeof value; + structure.fields.push(field); + } + return structure; +} +const getDefaultState = () => { + return { + _Structure: { + BaseVestingAccount: getStructure(BaseVestingAccount.fromPartial({})), + ContinuousVestingAccount: getStructure(ContinuousVestingAccount.fromPartial({})), + DelayedVestingAccount: getStructure(DelayedVestingAccount.fromPartial({})), + Period: getStructure(Period.fromPartial({})), + PeriodicVestingAccount: getStructure(PeriodicVestingAccount.fromPartial({})), + }, + _Subscriptions: new Set(), + }; +}; +// initial state +const state = getDefaultState(); +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()); + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value; + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription); + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription); + } + }, + getters: { + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields; + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init'); + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate'); + }); + } + }, + resetState({ commit }) { + commit('RESET_STATE'); + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription); + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload); + }); + }, + async MsgCreateVestingAccount({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgCreateVestingAccount(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + } +}; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/index.ts new file mode 100644 index 0000000000..6ee51ddcba --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/index.ts @@ -0,0 +1,105 @@ +import { txClient, queryClient } from './module' + +import { BaseVestingAccount } from "./module/types/cosmos/vesting/v1beta1/vesting" +import { ContinuousVestingAccount } from "./module/types/cosmos/vesting/v1beta1/vesting" +import { DelayedVestingAccount } from "./module/types/cosmos/vesting/v1beta1/vesting" +import { Period } from "./module/types/cosmos/vesting/v1beta1/vesting" +import { PeriodicVestingAccount } from "./module/types/cosmos/vesting/v1beta1/vesting" + + +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }) +} + +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }) +} + +function getStructure(template) { + let structure = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field: any = {} + field.name = key + field.type = typeof value + structure.fields.push(field) + } + return structure +} + +const getDefaultState = () => { + return { + + _Structure: { + BaseVestingAccount: getStructure(BaseVestingAccount.fromPartial({})), + ContinuousVestingAccount: getStructure(ContinuousVestingAccount.fromPartial({})), + DelayedVestingAccount: getStructure(DelayedVestingAccount.fromPartial({})), + Period: getStructure(Period.fromPartial({})), + PeriodicVestingAccount: getStructure(PeriodicVestingAccount.fromPartial({})), + + }, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription) + } + }, + getters: { + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init') + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload) + }) + }, + + async MsgCreateVestingAccount({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgCreateVestingAccount(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + + } +} diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/vuex-root b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/vuex-root new file mode 100644 index 0000000000..e69de29bb2 diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.d.ts new file mode 100644 index 0000000000..9a6c947767 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.d.ts @@ -0,0 +1,79 @@ +declare const _default: { + namespaced: boolean; + state: { + getDenomTrace: (state: any) => (params?: {}) => any; + getDenomTraces: (state: any) => (params?: {}) => any; + getParams: (state: any) => (params?: {}) => any; + _Structure: { + FungibleTokenPacketData: { + fields: any[]; + }; + DenomTrace: { + fields: any[]; + }; + Params: { + fields: any[]; + }; + }; + _Subscriptions: Set; + }; + mutations: { + RESET_STATE(state: any): void; + QUERY(state: any, { query, key, value }: { + query: any; + key: any; + value: any; + }): void; + SUBSCRIBE(state: any, subscription: any): void; + UNSUBSCRIBE(state: any, subscription: any): void; + }; + getters: { + getDenomTrace: (state: any) => (params?: {}) => any; + getDenomTraces: (state: any) => (params?: {}) => any; + getParams: (state: any) => (params?: {}) => any; + getTypeStructure: (state: any) => (type: any) => any; + }; + actions: { + init({ dispatch, rootGetters }: { + dispatch: any; + rootGetters: any; + }): void; + resetState({ commit }: { + commit: any; + }): void; + unsubscribe({ commit }: { + commit: any; + }, subscription: any): void; + StoreUpdate({ state, dispatch }: { + state: any; + dispatch: any; + }): Promise; + QueryDenomTrace({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryDenomTraces({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryParams({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + MsgTransfer({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + }; +}; +export default _default; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.js new file mode 100644 index 0000000000..097d6ba880 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.js @@ -0,0 +1,140 @@ +import { txClient, queryClient } from './module'; +import { FungibleTokenPacketData } from "./module/types/ibc/applications/transfer/v1/transfer"; +import { DenomTrace } from "./module/types/ibc/applications/transfer/v1/transfer"; +import { Params } from "./module/types/ibc/applications/transfer/v1/transfer"; +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }); +} +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }); +} +function getStructure(template) { + let structure = { fields: [] }; + for (const [key, value] of Object.entries(template)) { + let field = {}; + field.name = key; + field.type = typeof value; + structure.fields.push(field); + } + return structure; +} +const getDefaultState = () => { + return { + getDenomTrace: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDenomTraces: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + _Structure: { + FungibleTokenPacketData: getStructure(FungibleTokenPacketData.fromPartial({})), + DenomTrace: getStructure(DenomTrace.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + }, + _Subscriptions: new Set(), + }; +}; +// initial state +const state = getDefaultState(); +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()); + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value; + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription); + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription); + } + }, + getters: { + getDenomTrace: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getDenomTraces: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields; + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init'); + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate'); + }); + } + }, + resetState({ commit }) { + commit('RESET_STATE'); + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription); + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload); + }); + }, + async QueryDenomTrace({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDenomTrace.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryDenomTraces({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDenomTraces.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryParams({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryParams.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async MsgTransfer({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgTransfer(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + } +}; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.ts new file mode 100644 index 0000000000..63e3fec1e7 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.ts @@ -0,0 +1,146 @@ +import { txClient, queryClient } from './module' + +import { FungibleTokenPacketData } from "./module/types/ibc/applications/transfer/v1/transfer" +import { DenomTrace } from "./module/types/ibc/applications/transfer/v1/transfer" +import { Params } from "./module/types/ibc/applications/transfer/v1/transfer" + + +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }) +} + +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }) +} + +function getStructure(template) { + let structure = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field: any = {} + field.name = key + field.type = typeof value + structure.fields.push(field) + } + return structure +} + +const getDefaultState = () => { + return { + getDenomTrace: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDenomTraces: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + _Structure: { + FungibleTokenPacketData: getStructure(FungibleTokenPacketData.fromPartial({})), + DenomTrace: getStructure(DenomTrace.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + + }, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription) + } + }, + getters: { + getDenomTrace: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getDenomTraces: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init') + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload) + }) + }, + async QueryDenomTrace({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDenomTrace.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryDenomTraces({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryDenomTraces.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryParams({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryParams.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + + async MsgTransfer({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgTransfer(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + + } +} diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/vuex-root b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/vuex-root new file mode 100644 index 0000000000..e69de29bb2 diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/index.d.ts new file mode 100644 index 0000000000..9fea7c2c68 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/index.d.ts @@ -0,0 +1,226 @@ +declare const _default: { + namespaced: boolean; + state: { + getChannel: (state: any) => (params?: {}) => any; + getChannels: (state: any) => (params?: {}) => any; + getConnectionChannels: (state: any) => (params?: {}) => any; + getChannelClientState: (state: any) => (params?: {}) => any; + getChannelConsensusState: (state: any) => (params?: {}) => any; + getPacketCommitment: (state: any) => (params?: {}) => any; + getPacketCommitments: (state: any) => (params?: {}) => any; + getPacketReceipt: (state: any) => (params?: {}) => any; + getPacketAcknowledgement: (state: any) => (params?: {}) => any; + getPacketAcknowledgements: (state: any) => (params?: {}) => any; + getUnreceivedPackets: (state: any) => (params?: {}) => any; + getUnreceivedAcks: (state: any) => (params?: {}) => any; + getNextSequenceReceive: (state: any) => (params?: {}) => any; + _Structure: { + Channel: { + fields: any[]; + }; + IdentifiedChannel: { + fields: any[]; + }; + Counterparty: { + fields: any[]; + }; + Packet: { + fields: any[]; + }; + PacketState: { + fields: any[]; + }; + Acknowledgement: { + fields: any[]; + }; + PacketSequence: { + fields: any[]; + }; + }; + _Subscriptions: Set; + }; + mutations: { + RESET_STATE(state: any): void; + QUERY(state: any, { query, key, value }: { + query: any; + key: any; + value: any; + }): void; + SUBSCRIBE(state: any, subscription: any): void; + UNSUBSCRIBE(state: any, subscription: any): void; + }; + getters: { + getChannel: (state: any) => (params?: {}) => any; + getChannels: (state: any) => (params?: {}) => any; + getConnectionChannels: (state: any) => (params?: {}) => any; + getChannelClientState: (state: any) => (params?: {}) => any; + getChannelConsensusState: (state: any) => (params?: {}) => any; + getPacketCommitment: (state: any) => (params?: {}) => any; + getPacketCommitments: (state: any) => (params?: {}) => any; + getPacketReceipt: (state: any) => (params?: {}) => any; + getPacketAcknowledgement: (state: any) => (params?: {}) => any; + getPacketAcknowledgements: (state: any) => (params?: {}) => any; + getUnreceivedPackets: (state: any) => (params?: {}) => any; + getUnreceivedAcks: (state: any) => (params?: {}) => any; + getNextSequenceReceive: (state: any) => (params?: {}) => any; + getTypeStructure: (state: any) => (type: any) => any; + }; + actions: { + init({ dispatch, rootGetters }: { + dispatch: any; + rootGetters: any; + }): void; + resetState({ commit }: { + commit: any; + }): void; + unsubscribe({ commit }: { + commit: any; + }, subscription: any): void; + StoreUpdate({ state, dispatch }: { + state: any; + dispatch: any; + }): Promise; + QueryChannel({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryChannels({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryConnectionChannels({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryChannelClientState({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryChannelConsensusState({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryPacketCommitment({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryPacketCommitments({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryPacketReceipt({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryPacketAcknowledgement({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryPacketAcknowledgements({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryUnreceivedPackets({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryUnreceivedAcks({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryNextSequenceReceive({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + MsgTimeout({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgChannelOpenInit({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgTimeoutOnClose({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgAcknowledgement({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgChannelOpenTry({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgRecvPacket({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgChannelOpenAck({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgChannelCloseConfirm({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgChannelOpenConfirm({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgChannelCloseInit({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + }; +}; +export default _default; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/index.js new file mode 100644 index 0000000000..1941cde049 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/index.js @@ -0,0 +1,399 @@ +import { txClient, queryClient } from './module'; +import { Channel } from "./module/types/ibc/core/channel/v1/channel"; +import { IdentifiedChannel } from "./module/types/ibc/core/channel/v1/channel"; +import { Counterparty } from "./module/types/ibc/core/channel/v1/channel"; +import { Packet } from "./module/types/ibc/core/channel/v1/channel"; +import { PacketState } from "./module/types/ibc/core/channel/v1/channel"; +import { Acknowledgement } from "./module/types/ibc/core/channel/v1/channel"; +import { PacketSequence } from "./module/types/ibc/core/channel/v1/genesis"; +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }); +} +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }); +} +function getStructure(template) { + let structure = { fields: [] }; + for (const [key, value] of Object.entries(template)) { + let field = {}; + field.name = key; + field.type = typeof value; + structure.fields.push(field); + } + return structure; +} +const getDefaultState = () => { + return { + getChannel: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getChannels: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getConnectionChannels: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getChannelClientState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getChannelConsensusState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getPacketCommitment: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getPacketCommitments: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getPacketReceipt: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getPacketAcknowledgement: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getPacketAcknowledgements: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getUnreceivedPackets: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getUnreceivedAcks: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getNextSequenceReceive: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + _Structure: { + Channel: getStructure(Channel.fromPartial({})), + IdentifiedChannel: getStructure(IdentifiedChannel.fromPartial({})), + Counterparty: getStructure(Counterparty.fromPartial({})), + Packet: getStructure(Packet.fromPartial({})), + PacketState: getStructure(PacketState.fromPartial({})), + Acknowledgement: getStructure(Acknowledgement.fromPartial({})), + PacketSequence: getStructure(PacketSequence.fromPartial({})), + }, + _Subscriptions: new Set(), + }; +}; +// initial state +const state = getDefaultState(); +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()); + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value; + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription); + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription); + } + }, + getters: { + getChannel: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getChannels: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getConnectionChannels: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getChannelClientState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getChannelConsensusState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getPacketCommitment: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getPacketCommitments: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getPacketReceipt: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getPacketAcknowledgement: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getPacketAcknowledgements: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getUnreceivedPackets: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getUnreceivedAcks: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getNextSequenceReceive: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields; + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init'); + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate'); + }); + } + }, + resetState({ commit }) { + commit('RESET_STATE'); + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription); + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload); + }); + }, + async QueryChannel({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryChannel.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryChannels({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryChannels.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryConnectionChannels({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryConnectionChannels.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryChannelClientState({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryChannelClientState.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryChannelConsensusState({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryChannelConsensusState.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryPacketCommitment({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryPacketCommitment.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryPacketCommitments({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryPacketCommitments.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryPacketReceipt({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryPacketReceipt.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryPacketAcknowledgement({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryPacketAcknowledgement.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryPacketAcknowledgements({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryPacketAcknowledgements.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryUnreceivedPackets({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryUnreceivedPackets.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryUnreceivedAcks({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryUnreceivedAcks.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryNextSequenceReceive({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryNextSequenceReceive.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async MsgTimeout({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgTimeout(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgChannelOpenInit({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgChannelOpenInit(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgTimeoutOnClose({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgTimeoutOnClose(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgAcknowledgement({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgAcknowledgement(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgChannelOpenTry({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgChannelOpenTry(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgRecvPacket({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgRecvPacket(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgChannelOpenAck({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgChannelOpenAck(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgChannelCloseConfirm({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgChannelCloseConfirm(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgChannelOpenConfirm({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgChannelOpenConfirm(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgChannelCloseInit({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgChannelCloseInit(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + } +}; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/index.ts new file mode 100644 index 0000000000..ff4ca27533 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/index.ts @@ -0,0 +1,376 @@ +import { txClient, queryClient } from './module' + +import { Channel } from "./module/types/ibc/core/channel/v1/channel" +import { IdentifiedChannel } from "./module/types/ibc/core/channel/v1/channel" +import { Counterparty } from "./module/types/ibc/core/channel/v1/channel" +import { Packet } from "./module/types/ibc/core/channel/v1/channel" +import { PacketState } from "./module/types/ibc/core/channel/v1/channel" +import { Acknowledgement } from "./module/types/ibc/core/channel/v1/channel" +import { PacketSequence } from "./module/types/ibc/core/channel/v1/genesis" + + +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }) +} + +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }) +} + +function getStructure(template) { + let structure = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field: any = {} + field.name = key + field.type = typeof value + structure.fields.push(field) + } + return structure +} + +const getDefaultState = () => { + return { + getChannel: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getChannels: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getConnectionChannels: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getChannelClientState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getChannelConsensusState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getPacketCommitment: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getPacketCommitments: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getPacketReceipt: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getPacketAcknowledgement: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getPacketAcknowledgements: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getUnreceivedPackets: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getUnreceivedAcks: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getNextSequenceReceive: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + _Structure: { + Channel: getStructure(Channel.fromPartial({})), + IdentifiedChannel: getStructure(IdentifiedChannel.fromPartial({})), + Counterparty: getStructure(Counterparty.fromPartial({})), + Packet: getStructure(Packet.fromPartial({})), + PacketState: getStructure(PacketState.fromPartial({})), + Acknowledgement: getStructure(Acknowledgement.fromPartial({})), + PacketSequence: getStructure(PacketSequence.fromPartial({})), + + }, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription) + } + }, + getters: { + getChannel: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getChannels: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getConnectionChannels: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getChannelClientState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getChannelConsensusState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getPacketCommitment: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getPacketCommitments: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getPacketReceipt: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getPacketAcknowledgement: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getPacketAcknowledgements: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getUnreceivedPackets: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getUnreceivedAcks: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getNextSequenceReceive: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init') + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload) + }) + }, + async QueryChannel({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryChannel.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryChannels({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryChannels.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryConnectionChannels({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryConnectionChannels.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryChannelClientState({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryChannelClientState.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryChannelConsensusState({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryChannelConsensusState.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryPacketCommitment({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryPacketCommitment.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryPacketCommitments({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryPacketCommitments.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryPacketReceipt({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryPacketReceipt.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryPacketAcknowledgement({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryPacketAcknowledgement.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryPacketAcknowledgements({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryPacketAcknowledgements.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryUnreceivedPackets({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryUnreceivedPackets.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryUnreceivedAcks({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryUnreceivedAcks.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryNextSequenceReceive({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryNextSequenceReceive.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + + async MsgTimeout({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgTimeout(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgChannelOpenInit({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgChannelOpenInit(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgTimeoutOnClose({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgTimeoutOnClose(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgAcknowledgement({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgAcknowledgement(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgChannelOpenTry({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgChannelOpenTry(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgRecvPacket({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgRecvPacket(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgChannelOpenAck({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgChannelOpenAck(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgChannelCloseConfirm({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgChannelCloseConfirm(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgChannelOpenConfirm({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgChannelOpenConfirm(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgChannelCloseInit({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgChannelCloseInit(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + + } +} diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/module/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/module/index.d.ts index d967c9ecd6..c16c5173f5 100644 --- a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/module/index.d.ts +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/module/index.d.ts @@ -1,16 +1,16 @@ import { StdFee } from "@cosmjs/launchpad"; import { OfflineSigner, EncodeObject } from "@cosmjs/proto-signing"; import { Api } from "./rest"; +import { MsgTimeout } from "./types/ibc/core/channel/v1/tx"; +import { MsgChannelOpenInit } from "./types/ibc/core/channel/v1/tx"; +import { MsgTimeoutOnClose } from "./types/ibc/core/channel/v1/tx"; import { MsgAcknowledgement } from "./types/ibc/core/channel/v1/tx"; +import { MsgChannelOpenTry } from "./types/ibc/core/channel/v1/tx"; +import { MsgRecvPacket } from "./types/ibc/core/channel/v1/tx"; +import { MsgChannelOpenAck } from "./types/ibc/core/channel/v1/tx"; import { MsgChannelCloseConfirm } from "./types/ibc/core/channel/v1/tx"; import { MsgChannelOpenConfirm } from "./types/ibc/core/channel/v1/tx"; import { MsgChannelCloseInit } from "./types/ibc/core/channel/v1/tx"; -import { MsgRecvPacket } from "./types/ibc/core/channel/v1/tx"; -import { MsgTimeout } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelOpenTry } from "./types/ibc/core/channel/v1/tx"; -import { MsgTimeoutOnClose } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelOpenAck } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelOpenInit } from "./types/ibc/core/channel/v1/tx"; interface TxClientOptions { addr: string; } @@ -19,16 +19,16 @@ interface SignAndBroadcastOptions { } declare const txClient: (wallet: OfflineSigner, { addr: addr }?: TxClientOptions) => Promise<{ signAndBroadcast: (msgs: EncodeObject[], { fee: fee }?: SignAndBroadcastOptions) => Promise; + msgTimeout: (data: MsgTimeout) => EncodeObject; + msgChannelOpenInit: (data: MsgChannelOpenInit) => EncodeObject; + msgTimeoutOnClose: (data: MsgTimeoutOnClose) => EncodeObject; msgAcknowledgement: (data: MsgAcknowledgement) => EncodeObject; + msgChannelOpenTry: (data: MsgChannelOpenTry) => EncodeObject; + msgRecvPacket: (data: MsgRecvPacket) => EncodeObject; + msgChannelOpenAck: (data: MsgChannelOpenAck) => EncodeObject; msgChannelCloseConfirm: (data: MsgChannelCloseConfirm) => EncodeObject; msgChannelOpenConfirm: (data: MsgChannelOpenConfirm) => EncodeObject; msgChannelCloseInit: (data: MsgChannelCloseInit) => EncodeObject; - msgRecvPacket: (data: MsgRecvPacket) => EncodeObject; - msgTimeout: (data: MsgTimeout) => EncodeObject; - msgChannelOpenTry: (data: MsgChannelOpenTry) => EncodeObject; - msgTimeoutOnClose: (data: MsgTimeoutOnClose) => EncodeObject; - msgChannelOpenAck: (data: MsgChannelOpenAck) => EncodeObject; - msgChannelOpenInit: (data: MsgChannelOpenInit) => EncodeObject; }>; interface QueryClientOptions { addr: string; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/module/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/module/index.js index 0720c3efa6..d373480547 100644 --- a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/module/index.js +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/module/index.js @@ -1,27 +1,27 @@ import { SigningStargateClient } from "@cosmjs/stargate"; import { Registry } from "@cosmjs/proto-signing"; import { Api } from "./rest"; +import { MsgTimeout } from "./types/ibc/core/channel/v1/tx"; +import { MsgChannelOpenInit } from "./types/ibc/core/channel/v1/tx"; +import { MsgTimeoutOnClose } from "./types/ibc/core/channel/v1/tx"; import { MsgAcknowledgement } from "./types/ibc/core/channel/v1/tx"; +import { MsgChannelOpenTry } from "./types/ibc/core/channel/v1/tx"; +import { MsgRecvPacket } from "./types/ibc/core/channel/v1/tx"; +import { MsgChannelOpenAck } from "./types/ibc/core/channel/v1/tx"; import { MsgChannelCloseConfirm } from "./types/ibc/core/channel/v1/tx"; import { MsgChannelOpenConfirm } from "./types/ibc/core/channel/v1/tx"; import { MsgChannelCloseInit } from "./types/ibc/core/channel/v1/tx"; -import { MsgRecvPacket } from "./types/ibc/core/channel/v1/tx"; -import { MsgTimeout } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelOpenTry } from "./types/ibc/core/channel/v1/tx"; -import { MsgTimeoutOnClose } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelOpenAck } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelOpenInit } from "./types/ibc/core/channel/v1/tx"; const types = [ + ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], + ["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], + ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], ["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement], + ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], + ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], + ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], ["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm], ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], - ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], - ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], - ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], - ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], - ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], - ["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], ]; const registry = new Registry(types); const defaultFee = { @@ -35,16 +35,16 @@ const txClient = async (wallet, { addr: addr } = { addr: "http://localhost:26657 const { address } = (await wallet.getAccounts())[0]; return { signAndBroadcast: (msgs, { fee: fee } = { fee: defaultFee }) => client.signAndBroadcast(address, msgs, fee), + msgTimeout: (data) => ({ typeUrl: "/ibc.core.channel.v1.MsgTimeout", value: data }), + msgChannelOpenInit: (data) => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", value: data }), + msgTimeoutOnClose: (data) => ({ typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", value: data }), msgAcknowledgement: (data) => ({ typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", value: data }), + msgChannelOpenTry: (data) => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", value: data }), + msgRecvPacket: (data) => ({ typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", value: data }), + msgChannelOpenAck: (data) => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", value: data }), msgChannelCloseConfirm: (data) => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", value: data }), msgChannelOpenConfirm: (data) => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", value: data }), msgChannelCloseInit: (data) => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", value: data }), - msgRecvPacket: (data) => ({ typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", value: data }), - msgTimeout: (data) => ({ typeUrl: "/ibc.core.channel.v1.MsgTimeout", value: data }), - msgChannelOpenTry: (data) => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", value: data }), - msgTimeoutOnClose: (data) => ({ typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", value: data }), - msgChannelOpenAck: (data) => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", value: data }), - msgChannelOpenInit: (data) => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", value: data }), }; }; const queryClient = async ({ addr: addr } = { addr: "http://localhost:1317" }) => { diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/module/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/module/index.ts index 04e72c3df9..600cc7c993 100644 --- a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/module/index.ts +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/module/index.ts @@ -2,29 +2,29 @@ import { coins, StdFee } from "@cosmjs/launchpad"; import { SigningStargateClient } from "@cosmjs/stargate"; import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; import { Api } from "./rest"; +import { MsgTimeout } from "./types/ibc/core/channel/v1/tx"; +import { MsgChannelOpenInit } from "./types/ibc/core/channel/v1/tx"; +import { MsgTimeoutOnClose } from "./types/ibc/core/channel/v1/tx"; import { MsgAcknowledgement } from "./types/ibc/core/channel/v1/tx"; +import { MsgChannelOpenTry } from "./types/ibc/core/channel/v1/tx"; +import { MsgRecvPacket } from "./types/ibc/core/channel/v1/tx"; +import { MsgChannelOpenAck } from "./types/ibc/core/channel/v1/tx"; import { MsgChannelCloseConfirm } from "./types/ibc/core/channel/v1/tx"; import { MsgChannelOpenConfirm } from "./types/ibc/core/channel/v1/tx"; import { MsgChannelCloseInit } from "./types/ibc/core/channel/v1/tx"; -import { MsgRecvPacket } from "./types/ibc/core/channel/v1/tx"; -import { MsgTimeout } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelOpenTry } from "./types/ibc/core/channel/v1/tx"; -import { MsgTimeoutOnClose } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelOpenAck } from "./types/ibc/core/channel/v1/tx"; -import { MsgChannelOpenInit } from "./types/ibc/core/channel/v1/tx"; const types = [ + ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], + ["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], + ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], ["/ibc.core.channel.v1.MsgAcknowledgement", MsgAcknowledgement], + ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], + ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], + ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], ["/ibc.core.channel.v1.MsgChannelCloseConfirm", MsgChannelCloseConfirm], ["/ibc.core.channel.v1.MsgChannelOpenConfirm", MsgChannelOpenConfirm], ["/ibc.core.channel.v1.MsgChannelCloseInit", MsgChannelCloseInit], - ["/ibc.core.channel.v1.MsgRecvPacket", MsgRecvPacket], - ["/ibc.core.channel.v1.MsgTimeout", MsgTimeout], - ["/ibc.core.channel.v1.MsgChannelOpenTry", MsgChannelOpenTry], - ["/ibc.core.channel.v1.MsgTimeoutOnClose", MsgTimeoutOnClose], - ["/ibc.core.channel.v1.MsgChannelOpenAck", MsgChannelOpenAck], - ["/ibc.core.channel.v1.MsgChannelOpenInit", MsgChannelOpenInit], ]; @@ -51,16 +51,16 @@ const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = return { signAndBroadcast: (msgs: EncodeObject[], { fee: fee }: SignAndBroadcastOptions = { fee: defaultFee }) => client.signAndBroadcast(address, msgs, fee), + msgTimeout: (data: MsgTimeout): EncodeObject => ({ typeUrl: "/ibc.core.channel.v1.MsgTimeout", value: data }), + msgChannelOpenInit: (data: MsgChannelOpenInit): EncodeObject => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", value: data }), + msgTimeoutOnClose: (data: MsgTimeoutOnClose): EncodeObject => ({ typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", value: data }), msgAcknowledgement: (data: MsgAcknowledgement): EncodeObject => ({ typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", value: data }), + msgChannelOpenTry: (data: MsgChannelOpenTry): EncodeObject => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", value: data }), + msgRecvPacket: (data: MsgRecvPacket): EncodeObject => ({ typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", value: data }), + msgChannelOpenAck: (data: MsgChannelOpenAck): EncodeObject => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", value: data }), msgChannelCloseConfirm: (data: MsgChannelCloseConfirm): EncodeObject => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", value: data }), msgChannelOpenConfirm: (data: MsgChannelOpenConfirm): EncodeObject => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", value: data }), msgChannelCloseInit: (data: MsgChannelCloseInit): EncodeObject => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", value: data }), - msgRecvPacket: (data: MsgRecvPacket): EncodeObject => ({ typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", value: data }), - msgTimeout: (data: MsgTimeout): EncodeObject => ({ typeUrl: "/ibc.core.channel.v1.MsgTimeout", value: data }), - msgChannelOpenTry: (data: MsgChannelOpenTry): EncodeObject => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", value: data }), - msgTimeoutOnClose: (data: MsgTimeoutOnClose): EncodeObject => ({ typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", value: data }), - msgChannelOpenAck: (data: MsgChannelOpenAck): EncodeObject => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", value: data }), - msgChannelOpenInit: (data: MsgChannelOpenInit): EncodeObject => ({ typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", value: data }), }; }; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/vuex-root b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/vuex-root new file mode 100644 index 0000000000..e69de29bb2 diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/index.d.ts new file mode 100644 index 0000000000..b596679152 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/index.d.ts @@ -0,0 +1,127 @@ +declare const _default: { + namespaced: boolean; + state: { + getClientState: (state: any) => (params?: {}) => any; + getClientStates: (state: any) => (params?: {}) => any; + getConsensusState: (state: any) => (params?: {}) => any; + getConsensusStates: (state: any) => (params?: {}) => any; + getClientParams: (state: any) => (params?: {}) => any; + _Structure: { + IdentifiedClientState: { + fields: any[]; + }; + ConsensusStateWithHeight: { + fields: any[]; + }; + ClientConsensusStates: { + fields: any[]; + }; + ClientUpdateProposal: { + fields: any[]; + }; + Height: { + fields: any[]; + }; + Params: { + fields: any[]; + }; + GenesisMetadata: { + fields: any[]; + }; + IdentifiedGenesisMetadata: { + fields: any[]; + }; + }; + _Subscriptions: Set; + }; + mutations: { + RESET_STATE(state: any): void; + QUERY(state: any, { query, key, value }: { + query: any; + key: any; + value: any; + }): void; + SUBSCRIBE(state: any, subscription: any): void; + UNSUBSCRIBE(state: any, subscription: any): void; + }; + getters: { + getClientState: (state: any) => (params?: {}) => any; + getClientStates: (state: any) => (params?: {}) => any; + getConsensusState: (state: any) => (params?: {}) => any; + getConsensusStates: (state: any) => (params?: {}) => any; + getClientParams: (state: any) => (params?: {}) => any; + getTypeStructure: (state: any) => (type: any) => any; + }; + actions: { + init({ dispatch, rootGetters }: { + dispatch: any; + rootGetters: any; + }): void; + resetState({ commit }: { + commit: any; + }): void; + unsubscribe({ commit }: { + commit: any; + }, subscription: any): void; + StoreUpdate({ state, dispatch }: { + state: any; + dispatch: any; + }): Promise; + QueryClientState({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryClientStates({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryConsensusState({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryConsensusStates({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryClientParams({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + MsgSubmitMisbehaviour({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgCreateClient({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgUpdateClient({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgUpgradeClient({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + }; +}; +export default _default; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/index.js new file mode 100644 index 0000000000..20aeef2355 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/index.js @@ -0,0 +1,211 @@ +import { txClient, queryClient } from './module'; +import { IdentifiedClientState } from "./module/types/ibc/core/client/v1/client"; +import { ConsensusStateWithHeight } from "./module/types/ibc/core/client/v1/client"; +import { ClientConsensusStates } from "./module/types/ibc/core/client/v1/client"; +import { ClientUpdateProposal } from "./module/types/ibc/core/client/v1/client"; +import { Height } from "./module/types/ibc/core/client/v1/client"; +import { Params } from "./module/types/ibc/core/client/v1/client"; +import { GenesisMetadata } from "./module/types/ibc/core/client/v1/genesis"; +import { IdentifiedGenesisMetadata } from "./module/types/ibc/core/client/v1/genesis"; +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }); +} +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }); +} +function getStructure(template) { + let structure = { fields: [] }; + for (const [key, value] of Object.entries(template)) { + let field = {}; + field.name = key; + field.type = typeof value; + structure.fields.push(field); + } + return structure; +} +const getDefaultState = () => { + return { + getClientState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getClientStates: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getConsensusState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getConsensusStates: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getClientParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + _Structure: { + IdentifiedClientState: getStructure(IdentifiedClientState.fromPartial({})), + ConsensusStateWithHeight: getStructure(ConsensusStateWithHeight.fromPartial({})), + ClientConsensusStates: getStructure(ClientConsensusStates.fromPartial({})), + ClientUpdateProposal: getStructure(ClientUpdateProposal.fromPartial({})), + Height: getStructure(Height.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + GenesisMetadata: getStructure(GenesisMetadata.fromPartial({})), + IdentifiedGenesisMetadata: getStructure(IdentifiedGenesisMetadata.fromPartial({})), + }, + _Subscriptions: new Set(), + }; +}; +// initial state +const state = getDefaultState(); +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()); + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value; + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription); + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription); + } + }, + getters: { + getClientState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getClientStates: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getConsensusState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getConsensusStates: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getClientParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields; + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init'); + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate'); + }); + } + }, + resetState({ commit }) { + commit('RESET_STATE'); + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription); + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload); + }); + }, + async QueryClientState({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryClientState.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryClientStates({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryClientStates.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryConsensusState({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryConsensusState.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryConsensusStates({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryConsensusStates.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryClientParams({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryClientParams.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async MsgSubmitMisbehaviour({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgSubmitMisbehaviour(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgCreateClient({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgCreateClient(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgUpdateClient({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgUpdateClient(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgUpgradeClient({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgUpgradeClient(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + } +}; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/index.ts new file mode 100644 index 0000000000..01367f263d --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/index.ts @@ -0,0 +1,210 @@ +import { txClient, queryClient } from './module' + +import { IdentifiedClientState } from "./module/types/ibc/core/client/v1/client" +import { ConsensusStateWithHeight } from "./module/types/ibc/core/client/v1/client" +import { ClientConsensusStates } from "./module/types/ibc/core/client/v1/client" +import { ClientUpdateProposal } from "./module/types/ibc/core/client/v1/client" +import { Height } from "./module/types/ibc/core/client/v1/client" +import { Params } from "./module/types/ibc/core/client/v1/client" +import { GenesisMetadata } from "./module/types/ibc/core/client/v1/genesis" +import { IdentifiedGenesisMetadata } from "./module/types/ibc/core/client/v1/genesis" + + +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }) +} + +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }) +} + +function getStructure(template) { + let structure = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field: any = {} + field.name = key + field.type = typeof value + structure.fields.push(field) + } + return structure +} + +const getDefaultState = () => { + return { + getClientState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getClientStates: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getConsensusState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getConsensusStates: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getClientParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + _Structure: { + IdentifiedClientState: getStructure(IdentifiedClientState.fromPartial({})), + ConsensusStateWithHeight: getStructure(ConsensusStateWithHeight.fromPartial({})), + ClientConsensusStates: getStructure(ClientConsensusStates.fromPartial({})), + ClientUpdateProposal: getStructure(ClientUpdateProposal.fromPartial({})), + Height: getStructure(Height.fromPartial({})), + Params: getStructure(Params.fromPartial({})), + GenesisMetadata: getStructure(GenesisMetadata.fromPartial({})), + IdentifiedGenesisMetadata: getStructure(IdentifiedGenesisMetadata.fromPartial({})), + + }, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription) + } + }, + getters: { + getClientState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getClientStates: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getConsensusState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getConsensusStates: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getClientParams: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init') + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload) + }) + }, + async QueryClientState({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryClientState.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryClientStates({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryClientStates.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryConsensusState({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryConsensusState.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryConsensusStates({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryConsensusStates.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryClientParams({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryClientParams.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + + async MsgSubmitMisbehaviour({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgSubmitMisbehaviour(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgCreateClient({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgCreateClient(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgUpdateClient({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgUpdateClient(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgUpgradeClient({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgUpgradeClient(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + + } +} diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/vuex-root b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/vuex-root new file mode 100644 index 0000000000..e69de29bb2 diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/index.d.ts new file mode 100644 index 0000000000..97eb368870 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/index.d.ts @@ -0,0 +1,121 @@ +declare const _default: { + namespaced: boolean; + state: { + getConnection: (state: any) => (params?: {}) => any; + getConnections: (state: any) => (params?: {}) => any; + getClientConnections: (state: any) => (params?: {}) => any; + getConnectionClientState: (state: any) => (params?: {}) => any; + getConnectionConsensusState: (state: any) => (params?: {}) => any; + _Structure: { + ConnectionEnd: { + fields: any[]; + }; + IdentifiedConnection: { + fields: any[]; + }; + Counterparty: { + fields: any[]; + }; + ClientPaths: { + fields: any[]; + }; + ConnectionPaths: { + fields: any[]; + }; + Version: { + fields: any[]; + }; + }; + _Subscriptions: Set; + }; + mutations: { + RESET_STATE(state: any): void; + QUERY(state: any, { query, key, value }: { + query: any; + key: any; + value: any; + }): void; + SUBSCRIBE(state: any, subscription: any): void; + UNSUBSCRIBE(state: any, subscription: any): void; + }; + getters: { + getConnection: (state: any) => (params?: {}) => any; + getConnections: (state: any) => (params?: {}) => any; + getClientConnections: (state: any) => (params?: {}) => any; + getConnectionClientState: (state: any) => (params?: {}) => any; + getConnectionConsensusState: (state: any) => (params?: {}) => any; + getTypeStructure: (state: any) => (type: any) => any; + }; + actions: { + init({ dispatch, rootGetters }: { + dispatch: any; + rootGetters: any; + }): void; + resetState({ commit }: { + commit: any; + }): void; + unsubscribe({ commit }: { + commit: any; + }, subscription: any): void; + StoreUpdate({ state, dispatch }: { + state: any; + dispatch: any; + }): Promise; + QueryConnection({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryConnections({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryClientConnections({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryConnectionClientState({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + QueryConnectionConsensusState({ commit, rootGetters }: { + commit: any; + rootGetters: any; + }, { subscribe, ...key }: { + [x: string]: any; + subscribe?: boolean; + }): Promise; + MsgConnectionOpenTry({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgConnectionOpenInit({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgConnectionOpenAck({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + MsgConnectionOpenConfirm({ rootGetters }: { + rootGetters: any; + }, { value }: { + value: any; + }): Promise; + }; +}; +export default _default; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/index.js new file mode 100644 index 0000000000..b49c5709dd --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/index.js @@ -0,0 +1,207 @@ +import { txClient, queryClient } from './module'; +import { ConnectionEnd } from "./module/types/ibc/core/connection/v1/connection"; +import { IdentifiedConnection } from "./module/types/ibc/core/connection/v1/connection"; +import { Counterparty } from "./module/types/ibc/core/connection/v1/connection"; +import { ClientPaths } from "./module/types/ibc/core/connection/v1/connection"; +import { ConnectionPaths } from "./module/types/ibc/core/connection/v1/connection"; +import { Version } from "./module/types/ibc/core/connection/v1/connection"; +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }); +} +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }); +} +function getStructure(template) { + let structure = { fields: [] }; + for (const [key, value] of Object.entries(template)) { + let field = {}; + field.name = key; + field.type = typeof value; + structure.fields.push(field); + } + return structure; +} +const getDefaultState = () => { + return { + getConnection: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getConnections: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getClientConnections: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getConnectionClientState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getConnectionConsensusState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + _Structure: { + ConnectionEnd: getStructure(ConnectionEnd.fromPartial({})), + IdentifiedConnection: getStructure(IdentifiedConnection.fromPartial({})), + Counterparty: getStructure(Counterparty.fromPartial({})), + ClientPaths: getStructure(ClientPaths.fromPartial({})), + ConnectionPaths: getStructure(ConnectionPaths.fromPartial({})), + Version: getStructure(Version.fromPartial({})), + }, + _Subscriptions: new Set(), + }; +}; +// initial state +const state = getDefaultState(); +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()); + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value; + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription); + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription); + } + }, + getters: { + getConnection: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getConnections: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getClientConnections: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getConnectionClientState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getConnectionConsensusState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {}; + }, + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields; + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init'); + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate'); + }); + } + }, + resetState({ commit }) { + commit('RESET_STATE'); + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription); + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload); + }); + }, + async QueryConnection({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryConnection.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryConnections({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryConnections.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryClientConnections({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryClientConnections.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryConnectionClientState({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryConnectionClientState.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async QueryConnectionConsensusState({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryConnectionConsensusState.apply(null, Object.values(key))).data; + commit('QUERY', { query: 'Post', key, value }); + if (subscribe) + commit('SUBSCRIBE', { action: 'QueryPost', payload: key }); + } + catch (e) { + console.log('Query Failed: API node unavailable'); + } + }, + async MsgConnectionOpenTry({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgConnectionOpenTry(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgConnectionOpenInit({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgConnectionOpenInit(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgConnectionOpenAck({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgConnectionOpenAck(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + async MsgConnectionOpenConfirm({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgConnectionOpenConfirm(value); + await (await initTxClient(rootGetters)).signAndBroadcast([msg]); + } + catch (e) { + throw 'Failed to broadcast transaction: ' + e; + } + }, + } +}; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/index.ts new file mode 100644 index 0000000000..d1157ab3e5 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/index.ts @@ -0,0 +1,206 @@ +import { txClient, queryClient } from './module' + +import { ConnectionEnd } from "./module/types/ibc/core/connection/v1/connection" +import { IdentifiedConnection } from "./module/types/ibc/core/connection/v1/connection" +import { Counterparty } from "./module/types/ibc/core/connection/v1/connection" +import { ClientPaths } from "./module/types/ibc/core/connection/v1/connection" +import { ConnectionPaths } from "./module/types/ibc/core/connection/v1/connection" +import { Version } from "./module/types/ibc/core/connection/v1/connection" + + +async function initTxClient(vuexGetters) { + return await txClient(vuexGetters['chain/common/wallet/signer'], { + addr: vuexGetters['chain/common/env/apiTendermint'] + }) +} + +async function initQueryClient(vuexGetters) { + return await queryClient({ + addr: vuexGetters['chain/common/env/apiCosmos'] + }) +} + +function getStructure(template) { + let structure = { fields: [] } + for (const [key, value] of Object.entries(template)) { + let field: any = {} + field.name = key + field.type = typeof value + structure.fields.push(field) + } + return structure +} + +const getDefaultState = () => { + return { + getConnection: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getConnections: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getClientConnections: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getConnectionClientState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getConnectionConsensusState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + _Structure: { + ConnectionEnd: getStructure(ConnectionEnd.fromPartial({})), + IdentifiedConnection: getStructure(IdentifiedConnection.fromPartial({})), + Counterparty: getStructure(Counterparty.fromPartial({})), + ClientPaths: getStructure(ClientPaths.fromPartial({})), + ConnectionPaths: getStructure(ConnectionPaths.fromPartial({})), + Version: getStructure(Version.fromPartial({})), + + }, + _Subscriptions: new Set(), + } +} + +// initial state +const state = getDefaultState() + +export default { + namespaced: true, + state, + mutations: { + RESET_STATE(state) { + Object.assign(state, getDefaultState()) + }, + QUERY(state, { query, key, value }) { + state[query][JSON.stringify(key)] = value + }, + SUBSCRIBE(state, subscription) { + state._Subscriptions.add(subscription) + }, + UNSUBSCRIBE(state, subscription) { + state._Subscriptions.delete(subscription) + } + }, + getters: { + getConnection: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getConnections: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getClientConnections: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getConnectionClientState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + getConnectionConsensusState: (state) => (params = {}) => { + return state.Post[JSON.stringify(params)] ?? {} + }, + + getTypeStructure: (state) => (type) => { + return state._Structure[type].fields + } + }, + actions: { + init({ dispatch, rootGetters }) { + console.log('init') + if (rootGetters['chain/common/env/client']) { + rootGetters['chain/common/env/client'].on('newblock', () => { + dispatch('StoreUpdate') + }) + } + }, + resetState({ commit }) { + commit('RESET_STATE') + }, + unsubscribe({ commit }, subscription) { + commit('UNSUBSCRIBE', subscription) + }, + async StoreUpdate({ state, dispatch }) { + state._Subscriptions.forEach((subscription) => { + dispatch(subscription.action, subscription.payload) + }) + }, + async QueryConnection({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryConnection.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryConnections({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryConnections.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryClientConnections({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryClientConnections.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryConnectionClientState({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryConnectionClientState.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + async QueryConnectionConsensusState({ commit, rootGetters }, { subscribe = false, ...key }) { + try { + const value = (await (await initQueryClient(rootGetters)).queryConnectionConsensusState.apply(null, Object.values(key))).data + commit('QUERY', { query: 'Post', key, value }) + if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + } catch (e) { + console.log('Query Failed: API node unavailable') + } + }, + + async MsgConnectionOpenTry({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgConnectionOpenTry(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgConnectionOpenInit({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgConnectionOpenInit(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgConnectionOpenAck({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgConnectionOpenAck(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + async MsgConnectionOpenConfirm({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).msgConnectionOpenConfirm(value) + await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + } catch (e) { + throw 'Failed to broadcast transaction: ' + e + } + }, + + } +} diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/module/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/module/index.d.ts index 1453b99d5e..887208e8ba 100644 --- a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/module/index.d.ts +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/module/index.d.ts @@ -1,10 +1,10 @@ import { StdFee } from "@cosmjs/launchpad"; import { OfflineSigner, EncodeObject } from "@cosmjs/proto-signing"; import { Api } from "./rest"; -import { MsgConnectionOpenAck } from "./types/ibc/core/connection/v1/tx"; import { MsgConnectionOpenTry } from "./types/ibc/core/connection/v1/tx"; -import { MsgConnectionOpenConfirm } from "./types/ibc/core/connection/v1/tx"; import { MsgConnectionOpenInit } from "./types/ibc/core/connection/v1/tx"; +import { MsgConnectionOpenAck } from "./types/ibc/core/connection/v1/tx"; +import { MsgConnectionOpenConfirm } from "./types/ibc/core/connection/v1/tx"; interface TxClientOptions { addr: string; } @@ -13,10 +13,10 @@ interface SignAndBroadcastOptions { } declare const txClient: (wallet: OfflineSigner, { addr: addr }?: TxClientOptions) => Promise<{ signAndBroadcast: (msgs: EncodeObject[], { fee: fee }?: SignAndBroadcastOptions) => Promise; - msgConnectionOpenAck: (data: MsgConnectionOpenAck) => EncodeObject; msgConnectionOpenTry: (data: MsgConnectionOpenTry) => EncodeObject; - msgConnectionOpenConfirm: (data: MsgConnectionOpenConfirm) => EncodeObject; msgConnectionOpenInit: (data: MsgConnectionOpenInit) => EncodeObject; + msgConnectionOpenAck: (data: MsgConnectionOpenAck) => EncodeObject; + msgConnectionOpenConfirm: (data: MsgConnectionOpenConfirm) => EncodeObject; }>; interface QueryClientOptions { addr: string; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/module/index.js b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/module/index.js index d52fde2a0b..e2ce9b6c96 100644 --- a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/module/index.js +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/module/index.js @@ -1,15 +1,15 @@ import { SigningStargateClient } from "@cosmjs/stargate"; import { Registry } from "@cosmjs/proto-signing"; import { Api } from "./rest"; -import { MsgConnectionOpenAck } from "./types/ibc/core/connection/v1/tx"; import { MsgConnectionOpenTry } from "./types/ibc/core/connection/v1/tx"; -import { MsgConnectionOpenConfirm } from "./types/ibc/core/connection/v1/tx"; import { MsgConnectionOpenInit } from "./types/ibc/core/connection/v1/tx"; +import { MsgConnectionOpenAck } from "./types/ibc/core/connection/v1/tx"; +import { MsgConnectionOpenConfirm } from "./types/ibc/core/connection/v1/tx"; const types = [ - ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], - ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm], ["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], + ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], + ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm], ]; const registry = new Registry(types); const defaultFee = { @@ -23,10 +23,10 @@ const txClient = async (wallet, { addr: addr } = { addr: "http://localhost:26657 const { address } = (await wallet.getAccounts())[0]; return { signAndBroadcast: (msgs, { fee: fee } = { fee: defaultFee }) => client.signAndBroadcast(address, msgs, fee), - msgConnectionOpenAck: (data) => ({ typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", value: data }), msgConnectionOpenTry: (data) => ({ typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", value: data }), - msgConnectionOpenConfirm: (data) => ({ typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", value: data }), msgConnectionOpenInit: (data) => ({ typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", value: data }), + msgConnectionOpenAck: (data) => ({ typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", value: data }), + msgConnectionOpenConfirm: (data) => ({ typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", value: data }), }; }; const queryClient = async ({ addr: addr } = { addr: "http://localhost:1317" }) => { diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/module/index.ts b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/module/index.ts index 43e7db7bfc..69eb0e8bd5 100644 --- a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/module/index.ts +++ b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/module/index.ts @@ -2,17 +2,17 @@ import { coins, StdFee } from "@cosmjs/launchpad"; import { SigningStargateClient } from "@cosmjs/stargate"; import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; import { Api } from "./rest"; -import { MsgConnectionOpenAck } from "./types/ibc/core/connection/v1/tx"; import { MsgConnectionOpenTry } from "./types/ibc/core/connection/v1/tx"; -import { MsgConnectionOpenConfirm } from "./types/ibc/core/connection/v1/tx"; import { MsgConnectionOpenInit } from "./types/ibc/core/connection/v1/tx"; +import { MsgConnectionOpenAck } from "./types/ibc/core/connection/v1/tx"; +import { MsgConnectionOpenConfirm } from "./types/ibc/core/connection/v1/tx"; const types = [ - ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], ["/ibc.core.connection.v1.MsgConnectionOpenTry", MsgConnectionOpenTry], - ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm], ["/ibc.core.connection.v1.MsgConnectionOpenInit", MsgConnectionOpenInit], + ["/ibc.core.connection.v1.MsgConnectionOpenAck", MsgConnectionOpenAck], + ["/ibc.core.connection.v1.MsgConnectionOpenConfirm", MsgConnectionOpenConfirm], ]; @@ -39,10 +39,10 @@ const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = return { signAndBroadcast: (msgs: EncodeObject[], { fee: fee }: SignAndBroadcastOptions = { fee: defaultFee }) => client.signAndBroadcast(address, msgs, fee), - msgConnectionOpenAck: (data: MsgConnectionOpenAck): EncodeObject => ({ typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", value: data }), msgConnectionOpenTry: (data: MsgConnectionOpenTry): EncodeObject => ({ typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", value: data }), - msgConnectionOpenConfirm: (data: MsgConnectionOpenConfirm): EncodeObject => ({ typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", value: data }), msgConnectionOpenInit: (data: MsgConnectionOpenInit): EncodeObject => ({ typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", value: data }), + msgConnectionOpenAck: (data: MsgConnectionOpenAck): EncodeObject => ({ typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", value: data }), + msgConnectionOpenConfirm: (data: MsgConnectionOpenConfirm): EncodeObject => ({ typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", value: data }), }; }; diff --git a/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/vuex-root b/starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/vuex-root new file mode 100644 index 0000000000..e69de29bb2 diff --git a/starport/templates/app/stargate/vue/src/store/chain/index.d.ts b/starport/templates/app/stargate/vue/src/store/chain/index.d.ts new file mode 100644 index 0000000000..86fcfa2f4c --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/index.d.ts @@ -0,0 +1,15 @@ +declare const _default: { + CosmosCosmosSdkIbcApplicationsTransferV1: (store: any) => void; + CosmosCosmosSdkCosmosVestingV1Beta1: (store: any) => void; + CosmosCosmosSdkCosmosStakingV1Beta1: (store: any) => void; + CosmosCosmosSdkIbcCoreChannelV1: (store: any) => void; + CosmosCosmosSdkCosmosEvidenceV1Beta1: (store: any) => void; + CosmosCosmosSdkCosmosGovV1Beta1: (store: any) => void; + CosmosCosmosSdkIbcCoreClientV1: (store: any) => void; + CosmosCosmosSdkIbcCoreConnectionV1: (store: any) => void; + CosmosCosmosSdkCosmosCrisisV1Beta1: (store: any) => void; + CosmosCosmosSdkCosmosBankV1Beta1: (store: any) => void; + CosmosCosmosSdkCosmosDistributionV1Beta1: (store: any) => void; + CosmosCosmosSdkCosmosSlashingV1Beta1: (store: any) => void; +}; +export default _default; diff --git a/starport/templates/app/stargate/vue/src/store/chain/index.js b/starport/templates/app/stargate/vue/src/store/chain/index.js index 9b5062abd4..8e2a0c05d6 100644 --- a/starport/templates/app/stargate/vue/src/store/chain/index.js +++ b/starport/templates/app/stargate/vue/src/store/chain/index.js @@ -1,3 +1,45 @@ -import CosmosBankV1beta1 from './cosmos/cosmos-sdk/cosmos.bank.v1beta1' -// To be filled with rest of sdk modules -export default { CosmosBankV1beta1 } +import CosmosCosmosSdkIbcApplicationsTransferV1 from './cosmos/cosmos-sdk/ibc.applications.transfer.v1'; +import CosmosCosmosSdkCosmosVestingV1Beta1 from './cosmos/cosmos-sdk/cosmos.vesting.v1beta1'; +import CosmosCosmosSdkCosmosStakingV1Beta1 from './cosmos/cosmos-sdk/cosmos.staking.v1beta1'; +import CosmosCosmosSdkIbcCoreChannelV1 from './cosmos/cosmos-sdk/ibc.core.channel.v1'; +import CosmosCosmosSdkCosmosEvidenceV1Beta1 from './cosmos/cosmos-sdk/cosmos.evidence.v1beta1'; +import CosmosCosmosSdkCosmosGovV1Beta1 from './cosmos/cosmos-sdk/cosmos.gov.v1beta1'; +import CosmosCosmosSdkIbcCoreClientV1 from './cosmos/cosmos-sdk/ibc.core.client.v1'; +import CosmosCosmosSdkIbcCoreConnectionV1 from './cosmos/cosmos-sdk/ibc.core.connection.v1'; +import CosmosCosmosSdkCosmosCrisisV1Beta1 from './cosmos/cosmos-sdk/cosmos.crisis.v1beta1'; +import CosmosCosmosSdkCosmosBankV1Beta1 from './cosmos/cosmos-sdk/cosmos.bank.v1beta1'; +import CosmosCosmosSdkCosmosDistributionV1Beta1 from './cosmos/cosmos-sdk/cosmos.distribution.v1beta1'; +import CosmosCosmosSdkCosmosSlashingV1Beta1 from './cosmos/cosmos-sdk/cosmos.slashing.v1beta1'; +export default { + CosmosCosmosSdkIbcApplicationsTransferV1: load(CosmosCosmosSdkIbcApplicationsTransferV1, 'chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1'), + CosmosCosmosSdkCosmosVestingV1Beta1: load(CosmosCosmosSdkCosmosVestingV1Beta1, 'chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1'), + CosmosCosmosSdkCosmosStakingV1Beta1: load(CosmosCosmosSdkCosmosStakingV1Beta1, 'chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1'), + CosmosCosmosSdkIbcCoreChannelV1: load(CosmosCosmosSdkIbcCoreChannelV1, 'chain/cosmos/cosmos-sdk/ibc.core.channel.v1'), + CosmosCosmosSdkCosmosEvidenceV1Beta1: load(CosmosCosmosSdkCosmosEvidenceV1Beta1, 'chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1'), + CosmosCosmosSdkCosmosGovV1Beta1: load(CosmosCosmosSdkCosmosGovV1Beta1, 'chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1'), + CosmosCosmosSdkIbcCoreClientV1: load(CosmosCosmosSdkIbcCoreClientV1, 'chain/cosmos/cosmos-sdk/ibc.core.client.v1'), + CosmosCosmosSdkIbcCoreConnectionV1: load(CosmosCosmosSdkIbcCoreConnectionV1, 'chain/cosmos/cosmos-sdk/ibc.core.connection.v1'), + CosmosCosmosSdkCosmosCrisisV1Beta1: load(CosmosCosmosSdkCosmosCrisisV1Beta1, 'chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1'), + CosmosCosmosSdkCosmosBankV1Beta1: load(CosmosCosmosSdkCosmosBankV1Beta1, 'chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1'), + CosmosCosmosSdkCosmosDistributionV1Beta1: load(CosmosCosmosSdkCosmosDistributionV1Beta1, 'chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1'), + CosmosCosmosSdkCosmosSlashingV1Beta1: load(CosmosCosmosSdkCosmosSlashingV1Beta1, 'chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1'), +}; +function load(mod, fullns) { + return function init(store) { + const fullnsLevels = fullns.split('/'); + for (let i = 1; i < fullnsLevels.length; i++) { + let ns = fullnsLevels.slice(0, i); + if (!store.hasModule(ns)) { + store.registerModule(ns, { namespaced: true }); + } + } + store.registerModule(fullnsLevels, mod); + store.subscribe((mutation) => { + if (mutation.type == 'chain/common/env/INITIALIZE_WS_COMPLETE') { + store.dispatch(fullns + '/init', null, { + root: true + }); + } + }); + }; +} diff --git a/starport/templates/app/stargate/vue/src/store/chain/index.ts b/starport/templates/app/stargate/vue/src/store/chain/index.ts new file mode 100644 index 0000000000..f98b748a15 --- /dev/null +++ b/starport/templates/app/stargate/vue/src/store/chain/index.ts @@ -0,0 +1,49 @@ +import CosmosCosmosSdkIbcApplicationsTransferV1 from './cosmos/cosmos-sdk/ibc.applications.transfer.v1' +import CosmosCosmosSdkCosmosVestingV1Beta1 from './cosmos/cosmos-sdk/cosmos.vesting.v1beta1' +import CosmosCosmosSdkCosmosStakingV1Beta1 from './cosmos/cosmos-sdk/cosmos.staking.v1beta1' +import CosmosCosmosSdkIbcCoreChannelV1 from './cosmos/cosmos-sdk/ibc.core.channel.v1' +import CosmosCosmosSdkCosmosEvidenceV1Beta1 from './cosmos/cosmos-sdk/cosmos.evidence.v1beta1' +import CosmosCosmosSdkCosmosGovV1Beta1 from './cosmos/cosmos-sdk/cosmos.gov.v1beta1' +import CosmosCosmosSdkIbcCoreClientV1 from './cosmos/cosmos-sdk/ibc.core.client.v1' +import CosmosCosmosSdkIbcCoreConnectionV1 from './cosmos/cosmos-sdk/ibc.core.connection.v1' +import CosmosCosmosSdkCosmosCrisisV1Beta1 from './cosmos/cosmos-sdk/cosmos.crisis.v1beta1' +import CosmosCosmosSdkCosmosBankV1Beta1 from './cosmos/cosmos-sdk/cosmos.bank.v1beta1' +import CosmosCosmosSdkCosmosDistributionV1Beta1 from './cosmos/cosmos-sdk/cosmos.distribution.v1beta1' +import CosmosCosmosSdkCosmosSlashingV1Beta1 from './cosmos/cosmos-sdk/cosmos.slashing.v1beta1' + + +export default { + CosmosCosmosSdkIbcApplicationsTransferV1: load(CosmosCosmosSdkIbcApplicationsTransferV1, 'chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1'), + CosmosCosmosSdkCosmosVestingV1Beta1: load(CosmosCosmosSdkCosmosVestingV1Beta1, 'chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1'), + CosmosCosmosSdkCosmosStakingV1Beta1: load(CosmosCosmosSdkCosmosStakingV1Beta1, 'chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1'), + CosmosCosmosSdkIbcCoreChannelV1: load(CosmosCosmosSdkIbcCoreChannelV1, 'chain/cosmos/cosmos-sdk/ibc.core.channel.v1'), + CosmosCosmosSdkCosmosEvidenceV1Beta1: load(CosmosCosmosSdkCosmosEvidenceV1Beta1, 'chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1'), + CosmosCosmosSdkCosmosGovV1Beta1: load(CosmosCosmosSdkCosmosGovV1Beta1, 'chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1'), + CosmosCosmosSdkIbcCoreClientV1: load(CosmosCosmosSdkIbcCoreClientV1, 'chain/cosmos/cosmos-sdk/ibc.core.client.v1'), + CosmosCosmosSdkIbcCoreConnectionV1: load(CosmosCosmosSdkIbcCoreConnectionV1, 'chain/cosmos/cosmos-sdk/ibc.core.connection.v1'), + CosmosCosmosSdkCosmosCrisisV1Beta1: load(CosmosCosmosSdkCosmosCrisisV1Beta1, 'chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1'), + CosmosCosmosSdkCosmosBankV1Beta1: load(CosmosCosmosSdkCosmosBankV1Beta1, 'chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1'), + CosmosCosmosSdkCosmosDistributionV1Beta1: load(CosmosCosmosSdkCosmosDistributionV1Beta1, 'chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1'), + CosmosCosmosSdkCosmosSlashingV1Beta1: load(CosmosCosmosSdkCosmosSlashingV1Beta1, 'chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1'), + +} + +function load(mod, fullns) { + return function init(store) { + const fullnsLevels = fullns.split('/') + for (let i = 1; i < fullnsLevels.length; i++) { + let ns = fullnsLevels.slice(0, i) + if (!store.hasModule(ns)) { + store.registerModule(ns, { namespaced: true }) + } + } + store.registerModule(fullnsLevels, mod) + store.subscribe((mutation) => { + if (mutation.type == 'chain/common/env/INITIALIZE_WS_COMPLETE') { + store.dispatch(fullns+ '/init', null, { + root: true + }) + } + }) + } +} diff --git a/starport/templates/typed/new_stargate.go b/starport/templates/typed/new_stargate.go index ef9c71a2ed..353c252be0 100644 --- a/starport/templates/typed/new_stargate.go +++ b/starport/templates/typed/new_stargate.go @@ -479,7 +479,7 @@ func (t *typedStargate) frontendSrcStoreAppModify(opts *Options) genny.RunFn { return err } replacement := fmt.Sprintf(`%[1]v - `, + `, Placeholder4, opts.OwnerName, opts.AppName, From a845c445d76a2fe8cd1f79443be50b000772f10f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20G=C3=B6ktu=C4=9F=20=C3=96ZT=C3=9CRK?= Date: Sun, 7 Mar 2021 08:20:35 -0800 Subject: [PATCH 02/10] fix err handling & linter errors --- starport/pkg/cosmosanalysis/module/module.go | 6 +++--- starport/services/chain/grpcweb_proxy.go | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/starport/pkg/cosmosanalysis/module/module.go b/starport/pkg/cosmosanalysis/module/module.go index ae56ea2fb6..6ce571c18a 100644 --- a/starport/pkg/cosmosanalysis/module/module.go +++ b/starport/pkg/cosmosanalysis/module/module.go @@ -131,10 +131,10 @@ func (d *moduleDiscoverer) discover(pkg protoanalysis.Package) (Module, error) { msgs, err := DiscoverMessages(pkgpath) if err == ErrModuleNotFound { - return Module{}, nil + return Module{}, err } if err != nil { - return Module{}, nil + return Module{}, err } namesplit := strings.Split(pkg.Name, ".") @@ -147,7 +147,7 @@ func (d *moduleDiscoverer) discover(pkg protoanalysis.Package) (Module, error) { for _, msg := range msgs { pkgmsg, err := pkg.MessageByName(msg) if err != nil { // no msg found in the proto defs corresponds to discovered sdk message. - return Module{}, nil + return Module{}, err } m.Msgs = append(m.Msgs, Msg{ diff --git a/starport/services/chain/grpcweb_proxy.go b/starport/services/chain/grpcweb_proxy.go index 5e0177524e..99b654fb78 100644 --- a/starport/services/chain/grpcweb_proxy.go +++ b/starport/services/chain/grpcweb_proxy.go @@ -18,7 +18,6 @@ func newGRPCWebProxyHandler(grpcServerAddress string) (*grpc.ClientConn, http.Ha grpcopts := []grpc.DialOption{ grpc.WithInsecure(), // TODO: https://github.com/tendermint/starport/issues/562 - // nolint:staticcheck grpc.WithCodec(proxy.Codec()), } @@ -42,7 +41,6 @@ func newGRPCWebProxyHandler(grpcServerAddress string) (*grpc.ClientConn, http.Ha // Server with logging and monitoring enabled. grpcserver := grpc.NewServer( // TODO: https://github.com/tendermint/starport/issues/562 - // nolint:staticcheck grpc.CustomCodec(proxy.Codec()), // needed for proxy to function. grpc.UnknownServiceHandler(proxy.TransparentHandler(director)), grpc_middleware.WithUnaryServerChain(), From d0dcaec1a1465b7aaa6b34c98612abe49f22291f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20G=C3=B6ktu=C4=9F=20=C3=96ZT=C3=9CRK?= Date: Sun, 7 Mar 2021 08:25:56 -0800 Subject: [PATCH 03/10] fix err handling --- starport/pkg/cosmosanalysis/module/module.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starport/pkg/cosmosanalysis/module/module.go b/starport/pkg/cosmosanalysis/module/module.go index 6ce571c18a..e84c96ba12 100644 --- a/starport/pkg/cosmosanalysis/module/module.go +++ b/starport/pkg/cosmosanalysis/module/module.go @@ -131,7 +131,7 @@ func (d *moduleDiscoverer) discover(pkg protoanalysis.Package) (Module, error) { msgs, err := DiscoverMessages(pkgpath) if err == ErrModuleNotFound { - return Module{}, err + return Module{}, nil } if err != nil { return Module{}, err From 0b63dae37a2dfc30ab82df22c595cd1187b0827c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20G=C3=B6ktu=C4=9F=20=C3=96ZT=C3=9CRK?= Date: Mon, 8 Mar 2021 07:51:35 -0800 Subject: [PATCH 04/10] fix msg discovery --- starport/pkg/cosmosanalysis/module/module.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/starport/pkg/cosmosanalysis/module/module.go b/starport/pkg/cosmosanalysis/module/module.go index e84c96ba12..c47d0ee896 100644 --- a/starport/pkg/cosmosanalysis/module/module.go +++ b/starport/pkg/cosmosanalysis/module/module.go @@ -146,8 +146,11 @@ func (d *moduleDiscoverer) discover(pkg protoanalysis.Package) (Module, error) { // fill sdk Msgs. for _, msg := range msgs { pkgmsg, err := pkg.MessageByName(msg) - if err != nil { // no msg found in the proto defs corresponds to discovered sdk message. - return Module{}, err + if err != nil { + // no msg found in the proto defs corresponds to discovered sdk message. + // if it cannot be found, nothing to worry about, this means that it is used + // only internally and not open for actual use. + continue } m.Msgs = append(m.Msgs, Msg{ From 9c418bbd43a1077de5b8c39aa1d6ff0efa875858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20G=C3=B6ktu=C4=9F=20=C3=96ZT=C3=9CRK?= Date: Tue, 9 Mar 2021 22:05:36 -0800 Subject: [PATCH 05/10] cosmosanalysis: add metadata about grpc gateway --- starport/pkg/cosmosanalysis/module/module.go | 8 +- .../pkg/cosmosanalysis/module/module_test.go | 142 ++++++++++++------ starport/pkg/protoanalysis/protoanalysis.go | 100 ++++++++++-- 3 files changed, 184 insertions(+), 66 deletions(-) diff --git a/starport/pkg/cosmosanalysis/module/module.go b/starport/pkg/cosmosanalysis/module/module.go index c47d0ee896..e516e7280f 100644 --- a/starport/pkg/cosmosanalysis/module/module.go +++ b/starport/pkg/cosmosanalysis/module/module.go @@ -68,6 +68,9 @@ type Query struct { // FullName of the query with service name and rpc func name. FullName string + + // HTTPAnnotations keeps info about http annotations of query. + HTTPAnnotations protoanalysis.HTTPAnnotations } // Type is a proto type that might be used by module. @@ -208,8 +211,9 @@ func (d *moduleDiscoverer) discover(pkg protoanalysis.Package) (Module, error) { continue } m.Queries = append(m.Queries, Query{ - Name: q.Name, - FullName: fullName, + Name: q.Name, + FullName: fullName, + HTTPAnnotations: q.HTTPAnnotations, }) } } diff --git a/starport/pkg/cosmosanalysis/module/module_test.go b/starport/pkg/cosmosanalysis/module/module_test.go index 527f119b29..72dfd4b789 100644 --- a/starport/pkg/cosmosanalysis/module/module_test.go +++ b/starport/pkg/cosmosanalysis/module/module_test.go @@ -8,56 +8,102 @@ func ExampleDiscover() { pretty.Println(Discover("/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars")) // outputs: // []module.Module{ - // { - // Name: "mars", - // Pkg: protoanalysis.Package{ - // Name: "tendermint.mars.mars", - // Path: "/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars", - // GoImportName: "github.com/tendermint/mars/x/mars/types", - // Messages: { - // {Name:"GenesisState", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/genesis.proto"}, - // {Name:"User", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/user.proto"}, - // {Name:"MsgCreateUser", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, - // {Name:"MsgCreateUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, - // {Name:"MsgUpdateUser", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, - // {Name:"MsgUpdateUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, - // {Name:"MsgDeleteUser", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, - // {Name:"MsgDeleteUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, - // {Name:"QueryGetUserRequest", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/query.proto"}, - // {Name:"QueryGetUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/query.proto"}, - // {Name:"QueryAllUserRequest", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/query.proto"}, - // {Name:"QueryAllUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/query.proto"}, - // }, - // Services: { + // { + // Name: "mars", + // Pkg: protoanalysis.Package{ + // Name: "test.mars.mars", + // Path: "/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars", + // GoImportName: "github.com/test/mars/x/mars/types", + // Messages: { + // {Name:"GenesisState", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/genesis.proto"}, + // {Name:"QueryGetUserRequest", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/query.proto"}, + // {Name:"QueryGetUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/query.proto"}, + // {Name:"QueryAllUserRequest", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/query.proto"}, + // {Name:"QueryAllUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/query.proto"}, + // {Name:"User", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/user.proto"}, + // {Name:"MsgCreateUser", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // {Name:"MsgCreateUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // {Name:"MsgUpdateUser", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // {Name:"MsgUpdateUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // {Name:"MsgDeleteUser", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // {Name:"MsgDeleteUserResponse", Path:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // }, + // Services: { + // { + // Name: "Query", + // RPCFuncs: { + // { + // Name: "User", + // RequestType: "QueryGetUserRequest", + // ReturnsType: "QueryGetUserResponse", + // HTTPAnnotations: protoanalysis.HTTPAnnotations{ + // URLParams: {"id"}, + // URLHasQuery: false, + // }, + // }, + // { + // Name: "UserAll", + // RequestType: "QueryAllUserRequest", + // ReturnsType: "QueryAllUserResponse", + // HTTPAnnotations: protoanalysis.HTTPAnnotations{ + // URLParams: nil, + // URLHasQuery: true, + // }, + // }, + // }, + // }, // { - // Name: "Msg", - // RPCFuncs: { - // {Name:"CreateUser", RequestType:"MsgCreateUser", ReturnsType:"MsgCreateUserResponse"}, - // {Name:"UpdateUser", RequestType:"MsgUpdateUser", ReturnsType:"MsgUpdateUserResponse"}, - // {Name:"DeleteUser", RequestType:"MsgDeleteUser", ReturnsType:"MsgDeleteUserResponse"}, - // }, - // }, - // { - // Name: "Query", - // RPCFuncs: { - // {Name:"User", RequestType:"QueryGetUserRequest", ReturnsType:"QueryGetUserResponse"}, - // {Name:"UserAll", RequestType:"QueryAllUserRequest", ReturnsType:"QueryAllUserResponse"}, - // }, - // }, - // }, - // }, - // Msgs: { - // {Name:"MsgUpdateUser", URI:"tendermint.mars.mars.MsgUpdateUser", FilePath:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, - // {Name:"MsgDeleteUser", URI:"tendermint.mars.mars.MsgDeleteUser", FilePath:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, - // {Name:"MsgCreateUser", URI:"tendermint.mars.mars.MsgCreateUser", FilePath:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, - // }, - // Queries: { - // {Name:"User", FullName:"QueryUser"}, - // {Name:"UserAll", FullName:"QueryUserAll"}, - // }, - // Types: { - // {Name:"User", FilePath:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/user.proto"}, + // Name: "Msg", + // RPCFuncs: { + // { + // Name: "CreateUser", + // RequestType: "MsgCreateUser", + // ReturnsType: "MsgCreateUserResponse", + // HTTPAnnotations: protoanalysis.HTTPAnnotations{}, + // }, + // { + // Name: "UpdateUser", + // RequestType: "MsgUpdateUser", + // ReturnsType: "MsgUpdateUserResponse", + // HTTPAnnotations: protoanalysis.HTTPAnnotations{}, + // }, + // { + // Name: "DeleteUser", + // RequestType: "MsgDeleteUser", + // ReturnsType: "MsgDeleteUserResponse", + // HTTPAnnotations: protoanalysis.HTTPAnnotations{}, + // }, + // }, + // }, + // }, + // }, + // Msgs: { + // {Name:"MsgUpdateUser", URI:"test.mars.mars.MsgUpdateUser", FilePath:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // {Name:"MsgCreateUser", URI:"test.mars.mars.MsgCreateUser", FilePath:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // {Name:"MsgDeleteUser", URI:"test.mars.mars.MsgDeleteUser", FilePath:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/tx.proto"}, + // }, + // Queries: { + // { + // Name: "User", + // FullName: "QueryUser", + // HTTPAnnotations: protoanalysis.HTTPAnnotations{ + // URLParams: {"id"}, + // URLHasQuery: false, + // }, + // }, + // { + // Name: "UserAll", + // FullName: "QueryUserAll", + // HTTPAnnotations: protoanalysis.HTTPAnnotations{ + // URLParams: nil, + // URLHasQuery: true, + // }, + // }, + // }, + // Types: { + // {Name:"User", FilePath:"/home/ilker/Documents/code/src/github.com/tendermint/starport/local_test/mars/proto/mars/user.proto"}, // }, // }, // } nil + } diff --git a/starport/pkg/protoanalysis/protoanalysis.go b/starport/pkg/protoanalysis/protoanalysis.go index 4650241e17..6bb8b96e99 100644 --- a/starport/pkg/protoanalysis/protoanalysis.go +++ b/starport/pkg/protoanalysis/protoanalysis.go @@ -5,6 +5,7 @@ import ( "errors" "os" "path/filepath" + "regexp" "strings" "sync" @@ -54,6 +55,18 @@ type RPCFunc struct { // ReturnsType is the response type of RPC func. ReturnsType string + + // HTTPAnnotations keeps info about http annotations of an RPC func. + HTTPAnnotations HTTPAnnotations +} + +// HTTPAnnotations keeps info about http annotations of an RPC func. +type HTTPAnnotations struct { + // URLParams is a list of paramaters defined in the http endpoint annotation. + URLParams []string + + // URLHasQuery indicates if query paramaters can be passed in the gRPC Gatweway mode. + URLHasQuery bool } // MessageByName finds a message by its name inside Package. @@ -131,6 +144,8 @@ func DiscoverPackages(path string) ([]Package, error) { return pkgs, g.Wait() } +var urlParamRe = regexp.MustCompile(`(?m){(\w+)}`) + // Parse parses a proto file residing at path. func Parse(path string) (Package, error) { f, err := os.Open(path) @@ -148,6 +163,11 @@ func Parse(path string) (Package, error) { Path: filepath.Dir(path), } + var ( + messages []*proto.Message + services []*proto.Service + ) + proto.Walk( def, proto.WithPackage(func(p *proto.Package) { pkg.Name = p.Name }), @@ -158,31 +178,79 @@ func Parse(path string) (Package, error) { pkg.GoImportName = o.Constant.Source }), proto.WithMessage(func(m *proto.Message) { - pkg.Messages = append(pkg.Messages, Message{ - Name: m.Name, - Path: path, - }) + messages = append(messages, m) }), proto.WithService(func(s *proto.Service) { - sv := Service{ - Name: s.Name, + services = append(services, s) + }), + ) + + for _, m := range messages { + pkg.Messages = append(pkg.Messages, Message{ + Name: m.Name, + Path: path, + }) + } + + for _, s := range services { + sv := Service{ + Name: s.Name, + } + + for _, el := range s.Elements { + rpc, ok := el.(*proto.RPC) + if !ok { + continue + } + + rpcFunc := RPCFunc{ + Name: rpc.Name, + RequestType: rpc.RequestType, + ReturnsType: rpc.ReturnsType, } - for _, el := range s.Elements { - rpc, ok := el.(*proto.RPC) + // check for http annotations and collect info about them. + for _, el := range rpc.Elements { + option, ok := el.(*proto.Option) if !ok { continue } - sv.RPCFuncs = append(sv.RPCFuncs, RPCFunc{ - Name: rpc.Name, - RequestType: rpc.RequestType, - ReturnsType: rpc.ReturnsType, - }) + if !strings.Contains(option.Name, "google.api.http") { + continue + } + + // fill url params. + match := urlParamRe.FindAllStringSubmatch(option.Constant.Source, -1) + for _, item := range match { + rpcFunc.HTTPAnnotations.URLParams = append(rpcFunc.HTTPAnnotations.URLParams, item[1]) + } + + // fill has query params. + for _, m := range messages { + if m.Name != rpc.RequestType { + continue + } + + var fieldCount int + for _, el := range m.Elements { + switch el.(type) { + case + *proto.NormalField, + *proto.MapField, + *proto.OneOfField: + fieldCount++ + } + } + + rpcFunc.HTTPAnnotations.URLHasQuery = fieldCount > len(rpcFunc.HTTPAnnotations.URLParams) + } + } + sv.RPCFuncs = append(sv.RPCFuncs, rpcFunc) + } - pkg.Services = append(pkg.Services, sv) - }), - ) + pkg.Services = append(pkg.Services, sv) + } return pkg, nil } From 0f923730a4c5baa256633bbb446fbe2aa91b7e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20G=C3=B6ktu=C4=9F=20=C3=96ZT=C3=9CRK?= Date: Wed, 10 Mar 2021 07:51:44 -0800 Subject: [PATCH 06/10] docs: fix typo --- starport/pkg/protoanalysis/protoanalysis.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/starport/pkg/protoanalysis/protoanalysis.go b/starport/pkg/protoanalysis/protoanalysis.go index 6bb8b96e99..19f51e99ba 100644 --- a/starport/pkg/protoanalysis/protoanalysis.go +++ b/starport/pkg/protoanalysis/protoanalysis.go @@ -62,10 +62,10 @@ type RPCFunc struct { // HTTPAnnotations keeps info about http annotations of an RPC func. type HTTPAnnotations struct { - // URLParams is a list of paramaters defined in the http endpoint annotation. + // URLParams is a list of parameters defined in the http endpoint annotation. URLParams []string - // URLHasQuery indicates if query paramaters can be passed in the gRPC Gatweway mode. + // URLHasQuery indicates if query parameters can be passed in the gRPC Gatweway mode. URLHasQuery bool } From e80e097f711d738a423649a95c30c9f4015d50da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20G=C3=B6ktu=C4=9F=20=C3=96ZT=C3=9CRK?= Date: Wed, 10 Mar 2021 23:45:40 -0800 Subject: [PATCH 07/10] fix linter err --- starport/services/chain/grpcweb_proxy.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/starport/services/chain/grpcweb_proxy.go b/starport/services/chain/grpcweb_proxy.go index 99b654fb78..5e0177524e 100644 --- a/starport/services/chain/grpcweb_proxy.go +++ b/starport/services/chain/grpcweb_proxy.go @@ -18,6 +18,7 @@ func newGRPCWebProxyHandler(grpcServerAddress string) (*grpc.ClientConn, http.Ha grpcopts := []grpc.DialOption{ grpc.WithInsecure(), // TODO: https://github.com/tendermint/starport/issues/562 + // nolint:staticcheck grpc.WithCodec(proxy.Codec()), } @@ -41,6 +42,7 @@ func newGRPCWebProxyHandler(grpcServerAddress string) (*grpc.ClientConn, http.Ha // Server with logging and monitoring enabled. grpcserver := grpc.NewServer( // TODO: https://github.com/tendermint/starport/issues/562 + // nolint:staticcheck grpc.CustomCodec(proxy.Codec()), // needed for proxy to function. grpc.UnknownServiceHandler(proxy.TransparentHandler(director)), grpc_middleware.WithUnaryServerChain(), From b20771865a94b9c1074ac7bcf7cc23817645ee50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20G=2E=20=C3=96zt=C3=BCrk?= Date: Mon, 15 Mar 2021 14:57:42 +0300 Subject: [PATCH 08/10] feat: provide more tpl data to loader & add user-side warnings (#857) * feat: provide more tpl data to loader & add user-side warnings about not modifying generated dirs/files. * cosmetic --- starport/pkg/cosmosgen/generate_javascript.go | 56 +++++--------- starport/pkg/cosmosgen/template.go | 75 ++++++++++++++----- .../js/{client.ts.tpl => index.ts.tpl} | 2 + .../vuex/{loader.ts.tpl => root/index.ts.tpl} | 7 +- .../cosmosgen/templates/vuex/root/readme.md | 1 + .../vuex/{store.ts.tpl => store/index.ts.tpl} | 0 .../cosmosgen/templates/vuex/store/vuex-root | 1 + 7 files changed, 86 insertions(+), 56 deletions(-) rename starport/pkg/cosmosgen/templates/js/{client.ts.tpl => index.ts.tpl} (96%) rename starport/pkg/cosmosgen/templates/vuex/{loader.ts.tpl => root/index.ts.tpl} (77%) create mode 100644 starport/pkg/cosmosgen/templates/vuex/root/readme.md rename starport/pkg/cosmosgen/templates/vuex/{store.ts.tpl => store/index.ts.tpl} (100%) create mode 100644 starport/pkg/cosmosgen/templates/vuex/store/vuex-root diff --git a/starport/pkg/cosmosgen/generate_javascript.go b/starport/pkg/cosmosgen/generate_javascript.go index 7a40c07e14..5f407231cf 100644 --- a/starport/pkg/cosmosgen/generate_javascript.go +++ b/starport/pkg/cosmosgen/generate_javascript.go @@ -185,39 +185,17 @@ func (g *jsGenerator) generateModule(ctx context.Context, tsprotoPluginPath, app } // generate the js client wrapper. - outclient := filepath.Join(out, "index.ts") - f, err := os.OpenFile(outclient, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644) - if err != nil { - return err - } - defer f.Close() - pp := filepath.Join(appPath, g.g.protoDir) - err = templateJSClient(pp).Execute(f, struct{ Module module.Module }{m}) - if err != nil { + if err := templateJSClient.Write(out, pp, struct{ Module module.Module }{m}); err != nil { return err } // generate Vuex if enabled. if g.g.o.vuexStoreRootPath != "" { - storePath := filepath.Join(storeDirPath, "index.ts") - f, err := os.OpenFile(storePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644) + err = templateVuexStore.Write(storeDirPath, pp, struct{ Module module.Module }{m}) if err != nil { return err } - defer f.Close() - - err = templateVuexStore(pp).Execute(f, struct{ Module module.Module }{m}) - if err != nil { - return err - } - - // mark vuex root dir. - f, err = os.Create(filepath.Join(storeDirPath, vuexRootMarker)) - if err != nil { - return err - } - f.Close() } // generate .js and .d.ts files for all ts files. @@ -231,8 +209,10 @@ func (g *jsGenerator) generateVuexModuleLoader() error { } type module struct { - Name string - Path string + Name string + Path string + FullName string + FullPath string } var modules []module @@ -242,21 +222,23 @@ func (g *jsGenerator) generateVuexModuleLoader() error { if err != nil { return err } - pathrel = filepath.Dir(pathrel) - name := strcase.ToCamel(strings.ReplaceAll(pathrel, "/", "_")) - modules = append(modules, module{name, pathrel}) + var ( + fullPath = filepath.Dir(pathrel) + fullName = strcase.ToCamel(strings.ReplaceAll(fullPath, "/", "_")) + path = filepath.Base(fullPath) + name = strcase.ToCamel(path) + ) + modules = append(modules, module{ + Name: name, + Path: path, + FullName: fullName, + FullPath: fullPath, + }) } loaderPath := filepath.Join(g.g.o.vuexStoreRootPath, "index.ts") - f, err := os.OpenFile(loaderPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644) - if err != nil { - return err - } - defer f.Close() - - err = templateVuexLoader(g.g.o.vuexStoreRootPath).Execute(f, modules) - if err != nil { + if err := templateVuexRoot.Write(g.g.o.vuexStoreRootPath, "", modules); err != nil { return err } diff --git a/starport/pkg/cosmosgen/template.go b/starport/pkg/cosmosgen/template.go index 899ec57637..4d45111556 100644 --- a/starport/pkg/cosmosgen/template.go +++ b/starport/pkg/cosmosgen/template.go @@ -2,6 +2,7 @@ package cosmosgen import ( "embed" + "os" "path/filepath" "strings" "text/template" @@ -13,32 +14,72 @@ var ( //go:embed templates/* templates embed.FS - templateJSClient = tpl("js/client.ts.tpl") // js wrapper client. - templateVuexStore = tpl("vuex/store.ts.tpl") // vuex store. - templateVuexLoader = tpl("vuex/loader.ts.tpl") // vuex store loader. + templateJSClient = newTemplateWriter("js") // js wrapper client. + templateVuexRoot = newTemplateWriter("vuex/root") // vuex store loader. + templateVuexStore = newTemplateWriter("vuex/store") // vuex store. ) +type templateWriter struct { + templateDir string +} + // tpl returns a func for template residing at templatePath to initialize a text template // with given protoPath. -func tpl(templatePath string) func(protoPath string) *template.Template { - return func(protoPath string) *template.Template { - path := filepath.Join("templates", templatePath) - - funcs := template.FuncMap{ - "camelCase": strcase.ToLowerCamel, - "resolveFile": func(fullPath string) string { - rel, _ := filepath.Rel(protoPath, fullPath) - rel = strings.TrimSuffix(rel, ".proto") - return rel - }, - } +func newTemplateWriter(templateDir string) templateWriter { + return templateWriter{ + templateDir, + } +} + +func (t templateWriter) Write(destDir, protoPath string, data interface{}) error { + base := filepath.Join("templates", t.templateDir) + + // find out templates inside the dir. + files, err := templates.ReadDir(base) + if err != nil { + return err + } + + var paths []string + for _, file := range files { + paths = append(paths, filepath.Join(base, file.Name())) + } - return template. + funcs := template.FuncMap{ + "camelCase": strcase.ToLowerCamel, + "resolveFile": func(fullPath string) string { + rel, _ := filepath.Rel(protoPath, fullPath) + rel = strings.TrimSuffix(rel, ".proto") + return rel + }, + } + + // render and write the template. + write := func(path string) error { + tpl := template. Must( template. New(filepath.Base(path)). Funcs(funcs). - ParseFS(templates, path), + ParseFS(templates, paths...), ) + + out := filepath.Join(destDir, strings.TrimSuffix(filepath.Base(path), ".tpl")) + + f, err := os.OpenFile(out, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644) + if err != nil { + return err + } + defer f.Close() + + return tpl.Execute(f, data) } + + for _, path := range paths { + if err := write(path); err != nil { + return err + } + } + + return nil } diff --git a/starport/pkg/cosmosgen/templates/js/client.ts.tpl b/starport/pkg/cosmosgen/templates/js/index.ts.tpl similarity index 96% rename from starport/pkg/cosmosgen/templates/js/client.ts.tpl rename to starport/pkg/cosmosgen/templates/js/index.ts.tpl index 588d655163..0d94d084ed 100644 --- a/starport/pkg/cosmosgen/templates/js/client.ts.tpl +++ b/starport/pkg/cosmosgen/templates/js/index.ts.tpl @@ -1,3 +1,5 @@ +// THIS FILE IS GENERATED AUTOMATICALLY. DO NOT MODIFY. + import { coins, StdFee } from "@cosmjs/launchpad"; import { SigningStargateClient } from "@cosmjs/stargate"; import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; diff --git a/starport/pkg/cosmosgen/templates/vuex/loader.ts.tpl b/starport/pkg/cosmosgen/templates/vuex/root/index.ts.tpl similarity index 77% rename from starport/pkg/cosmosgen/templates/vuex/loader.ts.tpl rename to starport/pkg/cosmosgen/templates/vuex/root/index.ts.tpl index d7e6759d94..06b5ef6590 100644 --- a/starport/pkg/cosmosgen/templates/vuex/loader.ts.tpl +++ b/starport/pkg/cosmosgen/templates/vuex/root/index.ts.tpl @@ -1,11 +1,14 @@ -{{ range . }}import {{ .Name }} from './{{ .Path }}' +// THIS FILE IS GENERATED AUTOMATICALLY. DO NOT MODIFY. + +{{ range . }}import {{ .FullName }} from './{{ .FullPath }}' {{ end }} export default { - {{ range . }}{{ .Name }}: load({{ .Name }}, 'chain/{{ .Path }}'), + {{ range . }}{{ .FullName }}: load({{ .FullName }}, 'chain/{{ .FullPath }}'), {{ end }} } + function load(mod, fullns) { return function init(store) { const fullnsLevels = fullns.split('/') diff --git a/starport/pkg/cosmosgen/templates/vuex/root/readme.md b/starport/pkg/cosmosgen/templates/vuex/root/readme.md new file mode 100644 index 0000000000..a9a292f4b9 --- /dev/null +++ b/starport/pkg/cosmosgen/templates/vuex/root/readme.md @@ -0,0 +1 @@ +THIS FOLDER IS GENERATED AUTOMATICALLY. DO NOT MODIFY. diff --git a/starport/pkg/cosmosgen/templates/vuex/store.ts.tpl b/starport/pkg/cosmosgen/templates/vuex/store/index.ts.tpl similarity index 100% rename from starport/pkg/cosmosgen/templates/vuex/store.ts.tpl rename to starport/pkg/cosmosgen/templates/vuex/store/index.ts.tpl diff --git a/starport/pkg/cosmosgen/templates/vuex/store/vuex-root b/starport/pkg/cosmosgen/templates/vuex/store/vuex-root new file mode 100644 index 0000000000..0fcc121a15 --- /dev/null +++ b/starport/pkg/cosmosgen/templates/vuex/store/vuex-root @@ -0,0 +1 @@ +THIS FILE IS GENERATED AUTOMATICALLY. DO NOT DELETE. From f9eb23260bc667c8a046d8181304546d6f7ee80c Mon Sep 17 00:00:00 2001 From: Alex Megalokonomos Date: Tue, 16 Mar 2021 06:57:26 +0200 Subject: [PATCH 09/10] fix: Template updates (#825) * fix: Template updates * feat: sendMsg* actions, Msg* message creation * feat: Add true Error()s * fix: Change `chain` to `generated` * fix: tsc ignore imported dependency * Updated generated JS/TS for SDK modules * feat: Add get all pages option to queries * fiix: Pass all option to subscription * feat: Add query returns from store * WIP v0.15 Layout * Regenerated JS/TS * fix: stale state, return from getters * Regenerated TS/JS * JS Template changes * Regenerated JS/TS * Additional template changes * fix: Template changes * Regenerated TS/JS --- .../pkg/cosmosgen/templates/js/index.ts.tpl | 7 +- .../templates/vuex/root/index.ts.tpl | 22 +- .../templates/vuex/store/index.ts.tpl | 75 +- starport/services/chain/build.go | 2 +- starport/services/scaffolder/init.go | 2 +- .../templates/app/stargate/vue/src/App.vue | 39 +- .../stargate/vue/src/components/Sidebar.vue | 35 + .../app/stargate/vue/src/router/index.js | 14 +- .../cosmos-sdk/cosmos.bank.v1beta1/index.d.ts | 135 - .../cosmos-sdk/cosmos.bank.v1beta1/index.js | 227 - .../cosmos-sdk/cosmos.bank.v1beta1/index.ts | 224 - .../cosmos-sdk/cosmos.bank.v1beta1/vuex-root | 0 .../cosmos.crisis.v1beta1/vuex-root | 0 .../cosmos.distribution.v1beta1/index.d.ts | 196 - .../cosmos.distribution.v1beta1/index.js | 301 - .../cosmos.distribution.v1beta1/index.ts | 292 - .../cosmos.distribution.v1beta1/vuex-root | 0 .../cosmos.evidence.v1beta1/index.d.ts | 64 - .../cosmos.evidence.v1beta1/index.js | 119 - .../cosmos.evidence.v1beta1/index.ts | 127 - .../cosmos.evidence.v1beta1/vuex-root | 0 .../cosmos-sdk/cosmos.gov.v1beta1/index.d.ts | 149 - .../cosmos-sdk/cosmos.gov.v1beta1/index.js | 253 - .../cosmos-sdk/cosmos.gov.v1beta1/index.ts | 247 - .../types/google/protobuf/descriptor.d.ts | 996 --- .../types/google/protobuf/descriptor.js | 4123 ------------ .../types/google/protobuf/descriptor.ts | 5216 --------------- .../cosmos-sdk/cosmos.gov.v1beta1/vuex-root | 0 .../cosmos.slashing.v1beta1/index.d.ts | 85 - .../cosmos.slashing.v1beta1/index.js | 144 - .../cosmos.slashing.v1beta1/index.ts | 150 - .../types/google/protobuf/descriptor.d.ts | 996 --- .../types/google/protobuf/descriptor.js | 4123 ------------ .../types/google/protobuf/descriptor.ts | 5216 --------------- .../cosmos.slashing.v1beta1/vuex-root | 0 .../cosmos.staking.v1beta1/index.d.ts | 252 - .../cosmos.staking.v1beta1/index.js | 399 -- .../cosmos.staking.v1beta1/index.ts | 379 -- .../types/google/protobuf/descriptor.d.ts | 996 --- .../types/google/protobuf/descriptor.js | 4123 ------------ .../types/google/protobuf/descriptor.ts | 5216 --------------- .../cosmos.staking.v1beta1/vuex-root | 0 .../types/google/protobuf/descriptor.d.ts | 996 --- .../types/google/protobuf/descriptor.js | 4123 ------------ .../types/google/protobuf/descriptor.ts | 5216 --------------- .../cosmos.vesting.v1beta1/vuex-root | 0 .../ibc.applications.transfer.v1/index.d.ts | 79 - .../ibc.applications.transfer.v1/index.js | 140 - .../ibc.applications.transfer.v1/index.ts | 146 - .../types/google/protobuf/descriptor.d.ts | 996 --- .../types/google/protobuf/descriptor.js | 4123 ------------ .../types/google/protobuf/descriptor.ts | 5216 --------------- .../ibc.applications.transfer.v1/vuex-root | 0 .../cosmos-sdk/ibc.core.channel.v1/index.d.ts | 226 - .../cosmos-sdk/ibc.core.channel.v1/index.js | 399 -- .../cosmos-sdk/ibc.core.channel.v1/index.ts | 376 -- .../types/google/protobuf/descriptor.d.ts | 996 --- .../types/google/protobuf/descriptor.js | 4123 ------------ .../types/google/protobuf/descriptor.ts | 5216 --------------- .../cosmos-sdk/ibc.core.channel.v1/vuex-root | 0 .../cosmos-sdk/ibc.core.client.v1/index.d.ts | 127 - .../cosmos-sdk/ibc.core.client.v1/index.js | 211 - .../cosmos-sdk/ibc.core.client.v1/index.ts | 210 - .../types/google/protobuf/descriptor.d.ts | 996 --- .../types/google/protobuf/descriptor.js | 4123 ------------ .../types/google/protobuf/descriptor.ts | 5216 --------------- .../cosmos-sdk/ibc.core.client.v1/vuex-root | 0 .../ibc.core.connection.v1/index.d.ts | 121 - .../ibc.core.connection.v1/index.js | 207 - .../ibc.core.connection.v1/index.ts | 206 - .../types/google/protobuf/descriptor.d.ts | 996 --- .../types/google/protobuf/descriptor.js | 4123 ------------ .../types/google/protobuf/descriptor.ts | 5216 --------------- .../ibc.core.connection.v1/vuex-root | 0 .../app/stargate/vue/src/store/config.js | 5 +- .../cosmos-sdk/cosmos.bank.v1beta1/index.d.ts | 2 + .../cosmos-sdk/cosmos.bank.v1beta1/index.js | 314 + .../cosmos-sdk/cosmos.bank.v1beta1/index.ts | 320 + .../cosmos.bank.v1beta1/module/index.d.ts | 3 +- .../cosmos.bank.v1beta1/module/index.js | 3 +- .../cosmos.bank.v1beta1/module/index.ts | 9 +- .../cosmos.bank.v1beta1/module/rest.d.ts | 2 +- .../cosmos.bank.v1beta1/module/rest.js | 2 +- .../cosmos.bank.v1beta1/module/rest.ts | 2 +- .../types/cosmos/bank/v1beta1/bank.d.ts | 0 .../module/types/cosmos/bank/v1beta1/bank.js | 0 .../module/types/cosmos/bank/v1beta1/bank.ts | 0 .../types/cosmos/bank/v1beta1/genesis.d.ts | 0 .../types/cosmos/bank/v1beta1/genesis.js | 0 .../types/cosmos/bank/v1beta1/genesis.ts | 0 .../types/cosmos/bank/v1beta1/query.d.ts | 0 .../module/types/cosmos/bank/v1beta1/query.js | 0 .../module/types/cosmos/bank/v1beta1/query.ts | 0 .../module/types/cosmos/bank/v1beta1/tx.d.ts | 0 .../module/types/cosmos/bank/v1beta1/tx.js | 0 .../module/types/cosmos/bank/v1beta1/tx.ts | 0 .../cosmos/base/query/v1beta1/pagination.d.ts | 0 .../cosmos/base/query/v1beta1/pagination.js | 0 .../cosmos/base/query/v1beta1/pagination.ts | 0 .../types/cosmos/base/v1beta1/coin.d.ts | 0 .../module/types/cosmos/base/v1beta1/coin.js | 0 .../module/types/cosmos/base/v1beta1/coin.ts | 0 .../module/types/cosmos_proto/cosmos.d.ts | 0 .../module/types/cosmos_proto/cosmos.js | 0 .../module/types/cosmos_proto/cosmos.ts | 0 .../module/types/gogoproto/gogo.d.ts | 0 .../module/types/gogoproto/gogo.js | 0 .../module/types/gogoproto/gogo.ts | 0 .../module/types/google/api/annotations.d.ts | 0 .../module/types/google/api/annotations.js | 0 .../module/types/google/api/annotations.ts | 0 .../module/types/google/api/http.d.ts | 0 .../module/types/google/api/http.js | 0 .../module/types/google/api/http.ts | 0 .../types/google/protobuf/descriptor.d.ts | 34 +- .../types/google/protobuf/descriptor.js | 21 + .../types/google/protobuf/descriptor.ts | 53 +- .../cosmos-sdk/cosmos.bank.v1beta1/vuex-root | 1 + .../cosmos.base.abci.v1beta1}/index.d.ts | 38 +- .../cosmos.base.abci.v1beta1/index.js | 94 + .../cosmos.base.abci.v1beta1/index.ts | 110 + .../module/index.d.ts | 18 + .../cosmos.base.abci.v1beta1/module/index.js | 23 + .../cosmos.base.abci.v1beta1/module/index.ts | 52 + .../cosmos.base.abci.v1beta1/module/rest.d.ts | 184 + .../cosmos.base.abci.v1beta1/module/rest.js | 137 + .../cosmos.base.abci.v1beta1/module/rest.ts | 334 + .../types/cosmos/base/abci/v1beta1/abci.d.ts | 202 + .../types/cosmos/base/abci/v1beta1/abci.js | 1085 ++++ .../types/cosmos/base/abci/v1beta1/abci.ts | 1246 ++++ .../module/types/gogoproto/gogo.d.ts | 0 .../module/types/gogoproto/gogo.js | 0 .../module/types/gogoproto/gogo.ts | 0 .../module/types/google/protobuf/any.d.ts | 0 .../module/types/google/protobuf/any.js | 0 .../module/types/google/protobuf/any.ts | 0 .../types/google/protobuf/descriptor.d.ts | 34 +- .../types/google/protobuf/descriptor.js | 21 + .../types/google/protobuf/descriptor.ts | 53 +- .../types/google/protobuf/duration.d.ts | 2 +- .../module/types/google/protobuf/duration.js | 0 .../module/types/google/protobuf/duration.ts | 2 +- .../types/google/protobuf/timestamp.d.ts | 36 +- .../module/types/google/protobuf/timestamp.js | 0 .../module/types/google/protobuf/timestamp.ts | 36 +- .../module/types/tendermint/abci/types.d.ts | 697 ++ .../module/types/tendermint/abci/types.js | 4788 ++++++++++++++ .../module/types/tendermint/abci/types.ts | 5624 +++++++++++++++++ .../module/types/tendermint/crypto/keys.d.ts | 0 .../module/types/tendermint/crypto/keys.js | 0 .../module/types/tendermint/crypto/keys.ts | 0 .../module/types/tendermint/crypto/proof.d.ts | 0 .../module/types/tendermint/crypto/proof.js | 0 .../module/types/tendermint/crypto/proof.ts | 0 .../module/types/tendermint/types/params.d.ts | 124 + .../module/types/tendermint/types/params.js | 510 ++ .../module/types/tendermint/types/params.ts | 625 ++ .../module/types/tendermint/types/types.d.ts | 0 .../module/types/tendermint/types/types.js | 0 .../module/types/tendermint/types/types.ts | 0 .../types/tendermint/types/validator.d.ts | 0 .../types/tendermint/types/validator.js | 0 .../types/tendermint/types/validator.ts | 0 .../types/tendermint/version/types.d.ts | 0 .../module/types/tendermint/version/types.js | 0 .../module/types/tendermint/version/types.ts | 0 .../cosmos.base.abci.v1beta1/vuex-root | 1 + .../cosmos.base.v1beta1}/index.d.ts | 16 +- .../cosmos-sdk/cosmos.base.v1beta1}/index.js | 30 +- .../cosmos-sdk/cosmos.base.v1beta1}/index.ts | 33 +- .../cosmos.base.v1beta1/module/index.d.ts | 18 + .../cosmos.base.v1beta1/module/index.js | 23 + .../cosmos.base.v1beta1/module/index.ts | 52 + .../cosmos.base.v1beta1/module/rest.d.ts | 71 + .../cosmos.base.v1beta1}/module/rest.js | 2 +- .../cosmos.base.v1beta1/module/rest.ts | 221 + .../types/cosmos/base/v1beta1/coin.d.ts | 0 .../module/types/cosmos/base/v1beta1/coin.js | 0 .../module/types/cosmos/base/v1beta1/coin.ts | 0 .../module/types/gogoproto/gogo.d.ts | 0 .../module/types/gogoproto/gogo.js | 0 .../module/types/gogoproto/gogo.ts | 0 .../types/google/protobuf/descriptor.d.ts | 34 +- .../types/google/protobuf/descriptor.js | 21 + .../types/google/protobuf/descriptor.ts | 53 +- .../cosmos-sdk/cosmos.base.v1beta1/vuex-root | 1 + .../cosmos.crisis.v1beta1/index.d.ts | 2 + .../cosmos-sdk/cosmos.crisis.v1beta1/index.js | 105 + .../cosmos-sdk/cosmos.crisis.v1beta1/index.ts | 116 + .../cosmos.crisis.v1beta1/module/index.d.ts | 3 +- .../cosmos.crisis.v1beta1/module/index.js | 3 +- .../cosmos.crisis.v1beta1/module/index.ts | 9 +- .../cosmos.crisis.v1beta1/module/rest.d.ts | 2 +- .../cosmos.crisis.v1beta1/module/rest.js | 137 + .../cosmos.crisis.v1beta1/module/rest.ts | 2 +- .../types/cosmos/base/v1beta1/coin.d.ts | 0 .../module/types/cosmos/base/v1beta1/coin.js | 0 .../module/types/cosmos/base/v1beta1/coin.ts | 0 .../types/cosmos/crisis/v1beta1/genesis.d.ts | 0 .../types/cosmos/crisis/v1beta1/genesis.js | 0 .../types/cosmos/crisis/v1beta1/genesis.ts | 0 .../types/cosmos/crisis/v1beta1/tx.d.ts | 0 .../module/types/cosmos/crisis/v1beta1/tx.js | 0 .../module/types/cosmos/crisis/v1beta1/tx.ts | 0 .../module/types/gogoproto/gogo.d.ts | 0 .../module/types/gogoproto/gogo.js | 0 .../module/types/gogoproto/gogo.ts | 0 .../types/google/protobuf/descriptor.d.ts | 34 +- .../types/google/protobuf/descriptor.js | 21 + .../types/google/protobuf/descriptor.ts | 53 +- .../cosmos.crisis.v1beta1/vuex-root | 1 + .../cosmos.distribution.v1beta1/index.d.ts | 2 + .../cosmos.distribution.v1beta1/index.js | 425 ++ .../cosmos.distribution.v1beta1/index.ts | 423 ++ .../module/index.d.ts | 11 +- .../module/index.js | 15 +- .../module/index.ts | 21 +- .../module/rest.d.ts | 2 +- .../module/rest.js | 2 +- .../module/rest.ts | 2 +- .../cosmos/base/query/v1beta1/pagination.d.ts | 0 .../cosmos/base/query/v1beta1/pagination.js | 0 .../cosmos/base/query/v1beta1/pagination.ts | 0 .../types/cosmos/base/v1beta1/coin.d.ts | 0 .../module/types/cosmos/base/v1beta1/coin.js | 0 .../module/types/cosmos/base/v1beta1/coin.ts | 0 .../distribution/v1beta1/distribution.d.ts | 0 .../distribution/v1beta1/distribution.js | 0 .../distribution/v1beta1/distribution.ts | 0 .../cosmos/distribution/v1beta1/genesis.d.ts | 0 .../cosmos/distribution/v1beta1/genesis.js | 0 .../cosmos/distribution/v1beta1/genesis.ts | 0 .../cosmos/distribution/v1beta1/query.d.ts | 0 .../cosmos/distribution/v1beta1/query.js | 0 .../cosmos/distribution/v1beta1/query.ts | 0 .../types/cosmos/distribution/v1beta1/tx.d.ts | 0 .../types/cosmos/distribution/v1beta1/tx.js | 0 .../types/cosmos/distribution/v1beta1/tx.ts | 0 .../module/types/gogoproto/gogo.d.ts | 0 .../module/types/gogoproto/gogo.js | 0 .../module/types/gogoproto/gogo.ts | 0 .../module/types/google/api/annotations.d.ts | 0 .../module/types/google/api/annotations.js | 0 .../module/types/google/api/annotations.ts | 0 .../module/types/google/api/http.d.ts | 0 .../module/types/google/api/http.js | 0 .../module/types/google/api/http.ts | 0 .../types/google/protobuf/descriptor.d.ts | 1022 +++ .../types/google/protobuf/descriptor.js | 4144 ++++++++++++ .../types/google/protobuf/descriptor.ts | 5261 +++++++++++++++ .../cosmos.distribution.v1beta1/vuex-root | 1 + .../cosmos.evidence.v1beta1/index.d.ts | 2 + .../cosmos.evidence.v1beta1/index.js | 159 + .../cosmos.evidence.v1beta1/index.ts | 169 + .../cosmos.evidence.v1beta1/module/index.d.ts | 3 +- .../cosmos.evidence.v1beta1/module/index.js | 3 +- .../cosmos.evidence.v1beta1/module/index.ts | 9 +- .../cosmos.evidence.v1beta1/module/rest.d.ts | 2 +- .../cosmos.evidence.v1beta1/module/rest.js | 2 +- .../cosmos.evidence.v1beta1/module/rest.ts | 2 +- .../cosmos/base/query/v1beta1/pagination.d.ts | 0 .../cosmos/base/query/v1beta1/pagination.js | 0 .../cosmos/base/query/v1beta1/pagination.ts | 0 .../cosmos/evidence/v1beta1/evidence.d.ts | 0 .../types/cosmos/evidence/v1beta1/evidence.js | 0 .../types/cosmos/evidence/v1beta1/evidence.ts | 0 .../cosmos/evidence/v1beta1/genesis.d.ts | 0 .../types/cosmos/evidence/v1beta1/genesis.js | 0 .../types/cosmos/evidence/v1beta1/genesis.ts | 0 .../types/cosmos/evidence/v1beta1/query.d.ts | 0 .../types/cosmos/evidence/v1beta1/query.js | 0 .../types/cosmos/evidence/v1beta1/query.ts | 0 .../types/cosmos/evidence/v1beta1/tx.d.ts | 0 .../types/cosmos/evidence/v1beta1/tx.js | 0 .../types/cosmos/evidence/v1beta1/tx.ts | 0 .../module/types/cosmos_proto/cosmos.d.ts | 0 .../module/types/cosmos_proto/cosmos.js | 0 .../module/types/cosmos_proto/cosmos.ts | 0 .../module/types/gogoproto/gogo.d.ts | 0 .../module/types/gogoproto/gogo.js | 0 .../module/types/gogoproto/gogo.ts | 0 .../module/types/google/api/annotations.d.ts | 0 .../module/types/google/api/annotations.js | 0 .../module/types/google/api/annotations.ts | 0 .../module/types/google/api/http.d.ts | 0 .../module/types/google/api/http.js | 0 .../module/types/google/api/http.ts | 0 .../module/types/google/protobuf/any.d.ts | 0 .../module/types/google/protobuf/any.js | 0 .../module/types/google/protobuf/any.ts | 0 .../types/google/protobuf/descriptor.d.ts | 1022 +++ .../types/google/protobuf/descriptor.js | 4144 ++++++++++++ .../types/google/protobuf/descriptor.ts | 5261 +++++++++++++++ .../types/google/protobuf/timestamp.d.ts | 36 +- .../module/types/google/protobuf/timestamp.js | 0 .../module/types/google/protobuf/timestamp.ts | 36 +- .../cosmos.evidence.v1beta1/vuex-root | 1 + .../cosmos-sdk/cosmos.gov.v1beta1/index.d.ts | 2 + .../cosmos-sdk/cosmos.gov.v1beta1/index.js | 375 ++ .../cosmos-sdk/cosmos.gov.v1beta1/index.ts | 377 ++ .../cosmos.gov.v1beta1/module/index.d.ts | 7 +- .../cosmos.gov.v1beta1/module/index.js | 9 +- .../cosmos.gov.v1beta1/module/index.ts | 15 +- .../cosmos.gov.v1beta1/module/rest.d.ts | 2 +- .../cosmos.gov.v1beta1/module/rest.js | 2 +- .../cosmos.gov.v1beta1/module/rest.ts | 2 +- .../cosmos/base/query/v1beta1/pagination.d.ts | 0 .../cosmos/base/query/v1beta1/pagination.js | 0 .../cosmos/base/query/v1beta1/pagination.ts | 0 .../types/cosmos/base/v1beta1/coin.d.ts | 0 .../module/types/cosmos/base/v1beta1/coin.js | 0 .../module/types/cosmos/base/v1beta1/coin.ts | 0 .../types/cosmos/gov/v1beta1/genesis.d.ts | 0 .../types/cosmos/gov/v1beta1/genesis.js | 0 .../types/cosmos/gov/v1beta1/genesis.ts | 0 .../module/types/cosmos/gov/v1beta1/gov.d.ts | 0 .../module/types/cosmos/gov/v1beta1/gov.js | 0 .../module/types/cosmos/gov/v1beta1/gov.ts | 0 .../types/cosmos/gov/v1beta1/query.d.ts | 0 .../module/types/cosmos/gov/v1beta1/query.js | 0 .../module/types/cosmos/gov/v1beta1/query.ts | 0 .../module/types/cosmos/gov/v1beta1/tx.d.ts | 0 .../module/types/cosmos/gov/v1beta1/tx.js | 0 .../module/types/cosmos/gov/v1beta1/tx.ts | 0 .../module/types/cosmos_proto/cosmos.d.ts | 0 .../module/types/cosmos_proto/cosmos.js | 0 .../module/types/cosmos_proto/cosmos.ts | 0 .../module/types/gogoproto/gogo.d.ts | 0 .../module/types/gogoproto/gogo.js | 0 .../module/types/gogoproto/gogo.ts | 0 .../module/types/google/api/annotations.d.ts | 0 .../module/types/google/api/annotations.js | 0 .../module/types/google/api/annotations.ts | 0 .../module/types/google/api/http.d.ts | 0 .../module/types/google/api/http.js | 0 .../module/types/google/api/http.ts | 0 .../module/types/google/protobuf/any.d.ts | 0 .../module/types/google/protobuf/any.js | 0 .../module/types/google/protobuf/any.ts | 0 .../types/google/protobuf/descriptor.d.ts | 1022 +++ .../types/google/protobuf/descriptor.js | 4144 ++++++++++++ .../types/google/protobuf/descriptor.ts | 5261 +++++++++++++++ .../types/google/protobuf/duration.d.ts | 2 +- .../module/types/google/protobuf/duration.js | 0 .../module/types/google/protobuf/duration.ts | 2 +- .../types/google/protobuf/timestamp.d.ts | 36 +- .../module/types/google/protobuf/timestamp.js | 0 .../module/types/google/protobuf/timestamp.ts | 36 +- .../cosmos-sdk/cosmos.gov.v1beta1/vuex-root | 1 + .../cosmos.slashing.v1beta1/index.d.ts | 2 + .../cosmos.slashing.v1beta1/index.js | 187 + .../cosmos.slashing.v1beta1/index.ts | 197 + .../cosmos.slashing.v1beta1/module/index.d.ts | 3 +- .../cosmos.slashing.v1beta1/module/index.js | 3 +- .../cosmos.slashing.v1beta1/module/index.ts | 9 +- .../cosmos.slashing.v1beta1/module/rest.d.ts | 2 +- .../cosmos.slashing.v1beta1/module/rest.js | 2 +- .../cosmos.slashing.v1beta1/module/rest.ts | 2 +- .../cosmos/base/query/v1beta1/pagination.d.ts | 0 .../cosmos/base/query/v1beta1/pagination.js | 0 .../cosmos/base/query/v1beta1/pagination.ts | 0 .../cosmos/slashing/v1beta1/genesis.d.ts | 0 .../types/cosmos/slashing/v1beta1/genesis.js | 0 .../types/cosmos/slashing/v1beta1/genesis.ts | 0 .../types/cosmos/slashing/v1beta1/query.d.ts | 0 .../types/cosmos/slashing/v1beta1/query.js | 0 .../types/cosmos/slashing/v1beta1/query.ts | 0 .../cosmos/slashing/v1beta1/slashing.d.ts | 0 .../types/cosmos/slashing/v1beta1/slashing.js | 0 .../types/cosmos/slashing/v1beta1/slashing.ts | 0 .../types/cosmos/slashing/v1beta1/tx.d.ts | 0 .../types/cosmos/slashing/v1beta1/tx.js | 0 .../types/cosmos/slashing/v1beta1/tx.ts | 0 .../module/types/gogoproto/gogo.d.ts | 0 .../module/types/gogoproto/gogo.js | 0 .../module/types/gogoproto/gogo.ts | 0 .../module/types/google/api/annotations.d.ts | 0 .../module/types/google/api/annotations.js | 0 .../module/types/google/api/annotations.ts | 0 .../module/types/google/api/http.d.ts | 0 .../module/types/google/api/http.js | 0 .../module/types/google/api/http.ts | 0 .../types/google/protobuf/descriptor.d.ts | 1022 +++ .../types/google/protobuf/descriptor.js | 4144 ++++++++++++ .../types/google/protobuf/descriptor.ts | 5261 +++++++++++++++ .../types/google/protobuf/duration.d.ts | 2 +- .../module/types/google/protobuf/duration.js | 0 .../module/types/google/protobuf/duration.ts | 2 +- .../types/google/protobuf/timestamp.d.ts | 36 +- .../module/types/google/protobuf/timestamp.js | 0 .../module/types/google/protobuf/timestamp.ts | 36 +- .../cosmos.slashing.v1beta1/vuex-root | 1 + .../cosmos.staking.v1beta1/index.d.ts | 2 + .../cosmos.staking.v1beta1/index.js | 625 ++ .../cosmos.staking.v1beta1/index.ts | 619 ++ .../cosmos.staking.v1beta1/module/index.d.ts | 15 +- .../cosmos.staking.v1beta1/module/index.js | 21 +- .../cosmos.staking.v1beta1/module/index.ts | 27 +- .../cosmos.staking.v1beta1/module/rest.d.ts | 179 +- .../cosmos.staking.v1beta1/module/rest.js | 2 +- .../cosmos.staking.v1beta1/module/rest.ts | 203 +- .../cosmos/base/query/v1beta1/pagination.d.ts | 0 .../cosmos/base/query/v1beta1/pagination.js | 0 .../cosmos/base/query/v1beta1/pagination.ts | 0 .../types/cosmos/base/v1beta1/coin.d.ts | 0 .../module/types/cosmos/base/v1beta1/coin.js | 0 .../module/types/cosmos/base/v1beta1/coin.ts | 0 .../types/cosmos/staking/v1beta1/genesis.d.ts | 0 .../types/cosmos/staking/v1beta1/genesis.js | 0 .../types/cosmos/staking/v1beta1/genesis.ts | 0 .../types/cosmos/staking/v1beta1/query.d.ts | 0 .../types/cosmos/staking/v1beta1/query.js | 0 .../types/cosmos/staking/v1beta1/query.ts | 0 .../types/cosmos/staking/v1beta1/staking.d.ts | 46 +- .../types/cosmos/staking/v1beta1/staking.js | 0 .../types/cosmos/staking/v1beta1/staking.ts | 46 +- .../types/cosmos/staking/v1beta1/tx.d.ts | 0 .../module/types/cosmos/staking/v1beta1/tx.js | 0 .../module/types/cosmos/staking/v1beta1/tx.ts | 0 .../module/types/cosmos_proto/cosmos.d.ts | 0 .../module/types/cosmos_proto/cosmos.js | 0 .../module/types/cosmos_proto/cosmos.ts | 0 .../module/types/gogoproto/gogo.d.ts | 0 .../module/types/gogoproto/gogo.js | 0 .../module/types/gogoproto/gogo.ts | 0 .../module/types/google/api/annotations.d.ts | 0 .../module/types/google/api/annotations.js | 0 .../module/types/google/api/annotations.ts | 0 .../module/types/google/api/http.d.ts | 0 .../module/types/google/api/http.js | 0 .../module/types/google/api/http.ts | 0 .../module/types/google/protobuf/any.d.ts | 0 .../module/types/google/protobuf/any.js | 0 .../module/types/google/protobuf/any.ts | 0 .../types/google/protobuf/descriptor.d.ts | 1022 +++ .../types/google/protobuf/descriptor.js | 4144 ++++++++++++ .../types/google/protobuf/descriptor.ts | 5261 +++++++++++++++ .../types/google/protobuf/duration.d.ts | 91 + .../module/types/google/protobuf/duration.js | 95 + .../module/types/google/protobuf/duration.ts | 188 + .../types/google/protobuf/timestamp.d.ts | 113 + .../module/types/google/protobuf/timestamp.js | 95 + .../module/types/google/protobuf/timestamp.ts | 210 + .../module/types/tendermint/crypto/keys.d.ts | 19 + .../module/types/tendermint/crypto/keys.js | 105 + .../module/types/tendermint/crypto/keys.ts | 130 + .../module/types/tendermint/crypto/proof.d.ts | 73 + .../module/types/tendermint/crypto/proof.js | 456 ++ .../module/types/tendermint/crypto/proof.ts | 529 ++ .../module/types/tendermint/types/types.d.ts | 233 + .../module/types/tendermint/types/types.js | 1689 +++++ .../module/types/tendermint/types/types.ts | 1912 ++++++ .../types/tendermint/types/validator.d.ts | 44 + .../types/tendermint/types/validator.js | 333 + .../types/tendermint/types/validator.ts | 382 ++ .../types/tendermint/version/types.d.ts | 39 + .../module/types/tendermint/version/types.js | 165 + .../module/types/tendermint/version/types.ts | 202 + .../cosmos.staking.v1beta1/vuex-root | 1 + .../cosmos.vesting.v1beta1/index.d.ts | 2 + .../cosmos.vesting.v1beta1/index.js | 37 +- .../cosmos.vesting.v1beta1/index.ts | 41 +- .../cosmos.vesting.v1beta1/module/index.d.ts | 3 +- .../cosmos.vesting.v1beta1/module/index.js | 3 +- .../cosmos.vesting.v1beta1/module/index.ts | 9 +- .../cosmos.vesting.v1beta1/module/rest.d.ts | 0 .../cosmos.vesting.v1beta1/module/rest.js | 0 .../cosmos.vesting.v1beta1/module/rest.ts | 0 .../types/cosmos/auth/v1beta1/auth.d.ts | 0 .../module/types/cosmos/auth/v1beta1/auth.js | 0 .../module/types/cosmos/auth/v1beta1/auth.ts | 0 .../types/cosmos/base/v1beta1/coin.d.ts | 0 .../module/types/cosmos/base/v1beta1/coin.js | 0 .../module/types/cosmos/base/v1beta1/coin.ts | 0 .../types/cosmos/vesting/v1beta1/tx.d.ts | 0 .../module/types/cosmos/vesting/v1beta1/tx.js | 0 .../module/types/cosmos/vesting/v1beta1/tx.ts | 0 .../types/cosmos/vesting/v1beta1/vesting.d.ts | 0 .../types/cosmos/vesting/v1beta1/vesting.js | 0 .../types/cosmos/vesting/v1beta1/vesting.ts | 0 .../module/types/cosmos_proto/cosmos.d.ts | 0 .../module/types/cosmos_proto/cosmos.js | 0 .../module/types/cosmos_proto/cosmos.ts | 0 .../module/types/gogoproto/gogo.d.ts | 0 .../module/types/gogoproto/gogo.js | 0 .../module/types/gogoproto/gogo.ts | 0 .../module/types/google/protobuf/any.d.ts | 0 .../module/types/google/protobuf/any.js | 0 .../module/types/google/protobuf/any.ts | 0 .../types/google/protobuf/descriptor.d.ts | 1022 +++ .../types/google/protobuf/descriptor.js | 4144 ++++++++++++ .../types/google/protobuf/descriptor.ts | 5261 +++++++++++++++ .../cosmos.vesting.v1beta1/vuex-root | 1 + .../ibc.applications.transfer.v1/index.d.ts | 2 + .../ibc.applications.transfer.v1/index.js | 183 + .../ibc.applications.transfer.v1/index.ts | 193 + .../module/index.d.ts | 3 +- .../module/index.js | 3 +- .../module/index.ts | 9 +- .../module/rest.d.ts | 2 +- .../module/rest.js | 2 +- .../module/rest.ts | 2 +- .../cosmos/base/query/v1beta1/pagination.d.ts | 0 .../cosmos/base/query/v1beta1/pagination.js | 0 .../cosmos/base/query/v1beta1/pagination.ts | 0 .../types/cosmos/base/v1beta1/coin.d.ts | 63 + .../module/types/cosmos/base/v1beta1/coin.js | 245 + .../module/types/cosmos/base/v1beta1/coin.ts | 301 + .../module/types/gogoproto/gogo.d.ts | 0 .../module/types/gogoproto/gogo.js | 0 .../module/types/gogoproto/gogo.ts | 0 .../module/types/google/api/annotations.d.ts | 0 .../module/types/google/api/annotations.js | 0 .../module/types/google/api/annotations.ts | 0 .../module/types/google/api/http.d.ts | 0 .../module/types/google/api/http.js | 0 .../module/types/google/api/http.ts | 0 .../module/types/google/protobuf/any.d.ts | 0 .../module/types/google/protobuf/any.js | 0 .../module/types/google/protobuf/any.ts | 0 .../types/google/protobuf/descriptor.d.ts | 1022 +++ .../types/google/protobuf/descriptor.js | 4144 ++++++++++++ .../types/google/protobuf/descriptor.ts | 5261 +++++++++++++++ .../ibc/applications/transfer/v1/genesis.d.ts | 0 .../ibc/applications/transfer/v1/genesis.js | 0 .../ibc/applications/transfer/v1/genesis.ts | 0 .../ibc/applications/transfer/v1/query.d.ts | 0 .../ibc/applications/transfer/v1/query.js | 0 .../ibc/applications/transfer/v1/query.ts | 0 .../applications/transfer/v1/transfer.d.ts | 0 .../ibc/applications/transfer/v1/transfer.js | 0 .../ibc/applications/transfer/v1/transfer.ts | 0 .../ibc/applications/transfer/v1/tx.d.ts | 0 .../types/ibc/applications/transfer/v1/tx.js | 0 .../types/ibc/applications/transfer/v1/tx.ts | 0 .../types/ibc/core/client/v1/client.d.ts | 0 .../module/types/ibc/core/client/v1/client.js | 0 .../module/types/ibc/core/client/v1/client.ts | 0 .../ibc.applications.transfer.v1/vuex-root | 1 + .../cosmos-sdk/ibc.core.channel.v1/index.d.ts | 2 + .../cosmos-sdk/ibc.core.channel.v1/index.js | 694 ++ .../cosmos-sdk/ibc.core.channel.v1/index.ts | 668 ++ .../ibc.core.channel.v1/module/index.d.ts | 31 +- .../ibc.core.channel.v1/module/index.js | 45 +- .../ibc.core.channel.v1/module/index.ts | 51 +- .../ibc.core.channel.v1/module/rest.d.ts | 2 +- .../ibc.core.channel.v1/module/rest.js | 2 +- .../ibc.core.channel.v1/module/rest.ts | 2 +- .../cosmos/base/query/v1beta1/pagination.d.ts | 0 .../cosmos/base/query/v1beta1/pagination.js | 0 .../cosmos/base/query/v1beta1/pagination.ts | 0 .../module/types/gogoproto/gogo.d.ts | 0 .../module/types/gogoproto/gogo.js | 0 .../module/types/gogoproto/gogo.ts | 0 .../module/types/google/api/annotations.d.ts | 0 .../module/types/google/api/annotations.js | 0 .../module/types/google/api/annotations.ts | 0 .../module/types/google/api/http.d.ts | 0 .../module/types/google/api/http.js | 0 .../module/types/google/api/http.ts | 0 .../module/types/google/protobuf/any.d.ts | 0 .../module/types/google/protobuf/any.js | 0 .../module/types/google/protobuf/any.ts | 0 .../types/google/protobuf/descriptor.d.ts | 1022 +++ .../types/google/protobuf/descriptor.js | 4144 ++++++++++++ .../types/google/protobuf/descriptor.ts | 5261 +++++++++++++++ .../types/ibc/core/channel/v1/channel.d.ts | 0 .../types/ibc/core/channel/v1/channel.js | 0 .../types/ibc/core/channel/v1/channel.ts | 0 .../types/ibc/core/channel/v1/genesis.d.ts | 0 .../types/ibc/core/channel/v1/genesis.js | 0 .../types/ibc/core/channel/v1/genesis.ts | 0 .../types/ibc/core/channel/v1/query.d.ts | 0 .../module/types/ibc/core/channel/v1/query.js | 0 .../module/types/ibc/core/channel/v1/query.ts | 0 .../module/types/ibc/core/channel/v1/tx.d.ts | 0 .../module/types/ibc/core/channel/v1/tx.js | 0 .../module/types/ibc/core/channel/v1/tx.ts | 0 .../types/ibc/core/client/v1/client.d.ts | 0 .../module/types/ibc/core/client/v1/client.js | 0 .../module/types/ibc/core/client/v1/client.ts | 0 .../cosmos-sdk/ibc.core.channel.v1/vuex-root | 1 + .../cosmos-sdk/ibc.core.client.v1/index.d.ts | 2 + .../cosmos-sdk/ibc.core.client.v1/index.js | 345 + .../cosmos-sdk/ibc.core.client.v1/index.ts | 343 + .../ibc.core.client.v1/module/index.d.ts | 7 +- .../ibc.core.client.v1/module/index.js | 9 +- .../ibc.core.client.v1/module/index.ts | 15 +- .../ibc.core.client.v1/module/rest.d.ts | 2 +- .../ibc.core.client.v1/module/rest.js | 2 +- .../ibc.core.client.v1/module/rest.ts | 2 +- .../cosmos/base/query/v1beta1/pagination.d.ts | 0 .../cosmos/base/query/v1beta1/pagination.js | 0 .../cosmos/base/query/v1beta1/pagination.ts | 0 .../module/types/gogoproto/gogo.d.ts | 1 + .../module/types/gogoproto/gogo.js | 2 + .../module/types/gogoproto/gogo.ts | 2 + .../module/types/google/api/annotations.d.ts | 0 .../module/types/google/api/annotations.js | 0 .../module/types/google/api/annotations.ts | 0 .../module/types/google/api/http.d.ts | 0 .../module/types/google/api/http.js | 0 .../module/types/google/api/http.ts | 0 .../module/types/google/protobuf/any.d.ts | 0 .../module/types/google/protobuf/any.js | 0 .../module/types/google/protobuf/any.ts | 0 .../types/google/protobuf/descriptor.d.ts | 1022 +++ .../types/google/protobuf/descriptor.js | 4144 ++++++++++++ .../types/google/protobuf/descriptor.ts | 5261 +++++++++++++++ .../types/ibc/core/client/v1/client.d.ts | 0 .../module/types/ibc/core/client/v1/client.js | 0 .../module/types/ibc/core/client/v1/client.ts | 0 .../types/ibc/core/client/v1/genesis.d.ts | 0 .../types/ibc/core/client/v1/genesis.js | 0 .../types/ibc/core/client/v1/genesis.ts | 0 .../types/ibc/core/client/v1/query.d.ts | 0 .../module/types/ibc/core/client/v1/query.js | 0 .../module/types/ibc/core/client/v1/query.ts | 0 .../module/types/ibc/core/client/v1/tx.d.ts | 0 .../module/types/ibc/core/client/v1/tx.js | 0 .../module/types/ibc/core/client/v1/tx.ts | 0 .../cosmos-sdk/ibc.core.client.v1/vuex-root | 1 + .../ibc.core.connection.v1/index.d.ts | 2 + .../ibc.core.connection.v1/index.js | 319 + .../ibc.core.connection.v1/index.ts | 317 + .../ibc.core.connection.v1/module/index.d.ts | 7 +- .../ibc.core.connection.v1/module/index.js | 9 +- .../ibc.core.connection.v1/module/index.ts | 15 +- .../ibc.core.connection.v1/module/rest.d.ts | 2 +- .../ibc.core.connection.v1/module/rest.js | 2 +- .../ibc.core.connection.v1/module/rest.ts | 2 +- .../module/types/confio/proofs.d.ts | 0 .../module/types/confio/proofs.js | 0 .../module/types/confio/proofs.ts | 0 .../cosmos/base/query/v1beta1/pagination.d.ts | 0 .../cosmos/base/query/v1beta1/pagination.js | 0 .../cosmos/base/query/v1beta1/pagination.ts | 0 .../module/types/gogoproto/gogo.d.ts | 1 + .../module/types/gogoproto/gogo.js | 2 + .../module/types/gogoproto/gogo.ts | 2 + .../module/types/google/api/annotations.d.ts | 0 .../module/types/google/api/annotations.js | 0 .../module/types/google/api/annotations.ts | 0 .../module/types/google/api/http.d.ts | 0 .../module/types/google/api/http.js | 0 .../module/types/google/api/http.ts | 0 .../module/types/google/protobuf/any.d.ts | 129 + .../module/types/google/protobuf/any.js | 101 + .../module/types/google/protobuf/any.ts | 237 + .../types/google/protobuf/descriptor.d.ts | 1022 +++ .../types/google/protobuf/descriptor.js | 4144 ++++++++++++ .../types/google/protobuf/descriptor.ts | 5261 +++++++++++++++ .../types/ibc/core/client/v1/client.d.ts | 0 .../module/types/ibc/core/client/v1/client.js | 0 .../module/types/ibc/core/client/v1/client.ts | 0 .../ibc/core/commitment/v1/commitment.d.ts | 0 .../ibc/core/commitment/v1/commitment.js | 0 .../ibc/core/commitment/v1/commitment.ts | 0 .../ibc/core/connection/v1/connection.d.ts | 0 .../ibc/core/connection/v1/connection.js | 0 .../ibc/core/connection/v1/connection.ts | 0 .../types/ibc/core/connection/v1/genesis.d.ts | 0 .../types/ibc/core/connection/v1/genesis.js | 0 .../types/ibc/core/connection/v1/genesis.ts | 0 .../types/ibc/core/connection/v1/query.d.ts | 0 .../types/ibc/core/connection/v1/query.js | 0 .../types/ibc/core/connection/v1/query.ts | 0 .../types/ibc/core/connection/v1/tx.d.ts | 0 .../module/types/ibc/core/connection/v1/tx.js | 0 .../module/types/ibc/core/connection/v1/tx.ts | 0 .../ibc.core.connection.v1/vuex-root | 1 + .../src/store/{chain => generated}/index.d.ts | 18 +- .../src/store/{chain => generated}/index.js | 66 +- .../src/store/{chain => generated}/index.ts | 67 +- .../vue/src/store/generated/readme.md | 1 + .../app/stargate/vue/src/store/index.js | 5 +- .../app/stargate/vue/src/views/Address.vue | 17 - .../app/stargate/vue/src/views/Block.vue | 41 - .../app/stargate/vue/src/views/Blocks.vue | 141 - .../app/stargate/vue/src/views/Index.vue | 18 +- .../app/stargate/vue/src/views/Send.vue | 18 - .../vue/src/views/{Legacy.vue => Types.vue} | 5 +- .../app/stargate/vue/src/views/Wallet.vue | 121 - starport/templates/typed/new_stargate.go | 6 +- starport/ui/package-lock.json | 12 +- 685 files changed, 137799 insertions(+), 90037 deletions(-) create mode 100644 starport/templates/app/stargate/vue/src/components/Sidebar.vue delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1/vuex-root delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/vuex-root delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/vuex-root delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/vuex-root delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/google/protobuf/descriptor.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/google/protobuf/descriptor.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/google/protobuf/descriptor.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1/vuex-root delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/google/protobuf/descriptor.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/google/protobuf/descriptor.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/google/protobuf/descriptor.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/vuex-root delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/protobuf/descriptor.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/protobuf/descriptor.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/protobuf/descriptor.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1/vuex-root delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/google/protobuf/descriptor.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/google/protobuf/descriptor.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/google/protobuf/descriptor.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/vuex-root delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/google/protobuf/descriptor.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/google/protobuf/descriptor.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/google/protobuf/descriptor.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1/vuex-root delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/index.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/index.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/index.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/google/protobuf/descriptor.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/google/protobuf/descriptor.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/google/protobuf/descriptor.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.channel.v1/vuex-root delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/index.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/index.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/index.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/google/protobuf/descriptor.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/google/protobuf/descriptor.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/google/protobuf/descriptor.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.client.v1/vuex-root delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/index.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/index.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/index.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/google/protobuf/descriptor.d.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/google/protobuf/descriptor.js delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/google/protobuf/descriptor.ts delete mode 100644 starport/templates/app/stargate/vue/src/store/chain/cosmos/cosmos-sdk/ibc.core.connection.v1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.bank.v1beta1/index.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/index.d.ts (90%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/index.js (83%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/index.ts (81%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/rest.d.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/rest.js (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/rest.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/bank/v1beta1/bank.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/bank/v1beta1/bank.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/bank/v1beta1/bank.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/bank/v1beta1/genesis.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/bank/v1beta1/genesis.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/bank/v1beta1/genesis.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/bank/v1beta1/query.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/bank/v1beta1/query.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/bank/v1beta1/query.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/bank/v1beta1/tx.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/bank/v1beta1/tx.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/bank/v1beta1/tx.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/base/v1beta1/coin.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/base/v1beta1/coin.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos/base/v1beta1/coin.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos_proto/cosmos.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos_proto/cosmos.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/cosmos_proto/cosmos.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/gogoproto/gogo.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/gogoproto/gogo.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/gogoproto/gogo.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/google/api/annotations.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/google/api/annotations.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/google/api/annotations.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/google/api/http.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/google/api/http.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/google/api/http.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/google/protobuf/descriptor.d.ts (96%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/types/google/protobuf/descriptor.js (99%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.bank.v1beta1}/module/types/google/protobuf/descriptor.ts (98%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.bank.v1beta1/vuex-root rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/index.d.ts (56%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/index.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/module/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/module/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/module/index.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/module/rest.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/module/rest.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/module/rest.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/module/types/cosmos/base/abci/v1beta1/abci.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/module/types/cosmos/base/abci/v1beta1/abci.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/module/types/cosmos/base/abci/v1beta1/abci.ts rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/gogoproto/gogo.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/gogoproto/gogo.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/gogoproto/gogo.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/google/protobuf/any.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/google/protobuf/any.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/google/protobuf/any.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/google/protobuf/descriptor.d.ts (96%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/google/protobuf/descriptor.js (99%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.bank.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/google/protobuf/descriptor.ts (98%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/google/protobuf/duration.d.ts (98%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/google/protobuf/duration.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/google/protobuf/duration.ts (98%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/google/protobuf/timestamp.d.ts (77%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/google/protobuf/timestamp.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/google/protobuf/timestamp.ts (85%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/module/types/tendermint/abci/types.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/module/types/tendermint/abci/types.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/module/types/tendermint/abci/types.ts rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/tendermint/crypto/keys.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/tendermint/crypto/keys.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/tendermint/crypto/keys.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/tendermint/crypto/proof.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/tendermint/crypto/proof.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/tendermint/crypto/proof.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/module/types/tendermint/types/params.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/module/types/tendermint/types/params.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/module/types/tendermint/types/params.ts rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/tendermint/types/types.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/tendermint/types/types.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/tendermint/types/types.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/tendermint/types/validator.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/tendermint/types/validator.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/tendermint/types/validator.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/tendermint/version/types.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/tendermint/version/types.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1}/module/types/tendermint/version/types.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.abci.v1beta1/vuex-root rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.v1beta1}/index.d.ts (76%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.v1beta1}/index.js (69%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.v1beta1}/index.ts (65%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.v1beta1/module/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.v1beta1/module/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.v1beta1/module/index.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.v1beta1/module/rest.d.ts rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.v1beta1}/module/rest.js (99%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.v1beta1/module/rest.ts rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.v1beta1}/module/types/cosmos/base/v1beta1/coin.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.v1beta1}/module/types/cosmos/base/v1beta1/coin.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.v1beta1}/module/types/cosmos/base/v1beta1/coin.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.v1beta1}/module/types/gogoproto/gogo.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.v1beta1}/module/types/gogoproto/gogo.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.v1beta1}/module/types/gogoproto/gogo.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.v1beta1}/module/types/google/protobuf/descriptor.d.ts (96%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.crisis.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.v1beta1}/module/types/google/protobuf/descriptor.js (99%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.base.v1beta1}/module/types/google/protobuf/descriptor.ts (98%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.base.v1beta1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/index.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/module/index.d.ts (89%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/module/index.js (81%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/module/index.ts (79%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/module/rest.d.ts (98%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/module/rest.js rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/module/rest.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.crisis.v1beta1}/module/types/cosmos/base/v1beta1/coin.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.crisis.v1beta1}/module/types/cosmos/base/v1beta1/coin.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.distribution.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.crisis.v1beta1}/module/types/cosmos/base/v1beta1/coin.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/module/types/cosmos/crisis/v1beta1/genesis.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/module/types/cosmos/crisis/v1beta1/genesis.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/module/types/cosmos/crisis/v1beta1/genesis.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/module/types/cosmos/crisis/v1beta1/tx.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/module/types/cosmos/crisis/v1beta1/tx.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/module/types/cosmos/crisis/v1beta1/tx.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.crisis.v1beta1}/module/types/gogoproto/gogo.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.crisis.v1beta1}/module/types/gogoproto/gogo.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.crisis.v1beta1}/module/types/gogoproto/gogo.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.crisis.v1beta1}/module/types/google/protobuf/descriptor.d.ts (96%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.crisis.v1beta1}/module/types/google/protobuf/descriptor.js (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/module/types/google/protobuf/descriptor.ts (98%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.crisis.v1beta1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/index.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/index.d.ts (93%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/index.js (89%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/index.ts (87%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/rest.d.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/rest.js (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/rest.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.distribution.v1beta1}/module/types/cosmos/base/v1beta1/coin.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.distribution.v1beta1}/module/types/cosmos/base/v1beta1/coin.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.distribution.v1beta1}/module/types/cosmos/base/v1beta1/coin.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/cosmos/distribution/v1beta1/distribution.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/cosmos/distribution/v1beta1/distribution.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/cosmos/distribution/v1beta1/distribution.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/cosmos/distribution/v1beta1/genesis.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/cosmos/distribution/v1beta1/genesis.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/cosmos/distribution/v1beta1/genesis.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/cosmos/distribution/v1beta1/query.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/cosmos/distribution/v1beta1/query.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/cosmos/distribution/v1beta1/query.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/cosmos/distribution/v1beta1/tx.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/cosmos/distribution/v1beta1/tx.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/cosmos/distribution/v1beta1/tx.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.distribution.v1beta1}/module/types/gogoproto/gogo.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.distribution.v1beta1}/module/types/gogoproto/gogo.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.distribution.v1beta1}/module/types/gogoproto/gogo.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/google/api/annotations.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/google/api/annotations.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/google/api/annotations.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/google/api/http.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/google/api/http.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/google/api/http.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/google/protobuf/descriptor.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/google/protobuf/descriptor.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/module/types/google/protobuf/descriptor.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.distribution.v1beta1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/index.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/index.d.ts (89%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/index.js (81%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/index.ts (79%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/rest.d.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/rest.js (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/rest.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos/evidence/v1beta1/evidence.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos/evidence/v1beta1/evidence.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos/evidence/v1beta1/evidence.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos/evidence/v1beta1/genesis.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos/evidence/v1beta1/genesis.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos/evidence/v1beta1/genesis.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos/evidence/v1beta1/query.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos/evidence/v1beta1/query.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos/evidence/v1beta1/query.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos/evidence/v1beta1/tx.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos/evidence/v1beta1/tx.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos/evidence/v1beta1/tx.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos_proto/cosmos.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos_proto/cosmos.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/cosmos_proto/cosmos.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.evidence.v1beta1}/module/types/gogoproto/gogo.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.evidence.v1beta1}/module/types/gogoproto/gogo.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.evidence.v1beta1}/module/types/gogoproto/gogo.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/google/api/annotations.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/google/api/annotations.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/google/api/annotations.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/google/api/http.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/google/api/http.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/google/api/http.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.evidence.v1beta1}/module/types/google/protobuf/any.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.evidence.v1beta1}/module/types/google/protobuf/any.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.evidence.v1beta1}/module/types/google/protobuf/any.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/google/protobuf/descriptor.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/google/protobuf/descriptor.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/module/types/google/protobuf/descriptor.ts rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.evidence.v1beta1}/module/types/google/protobuf/timestamp.d.ts (77%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.evidence.v1beta1}/module/types/google/protobuf/timestamp.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.evidence.v1beta1}/module/types/google/protobuf/timestamp.ts (85%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.evidence.v1beta1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1/index.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/index.d.ts (91%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/index.js (85%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/index.ts (83%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/rest.d.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/rest.js (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/rest.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1}/module/types/cosmos/base/v1beta1/coin.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1}/module/types/cosmos/base/v1beta1/coin.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1}/module/types/cosmos/base/v1beta1/coin.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos/gov/v1beta1/genesis.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos/gov/v1beta1/genesis.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos/gov/v1beta1/genesis.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos/gov/v1beta1/gov.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos/gov/v1beta1/gov.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos/gov/v1beta1/gov.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos/gov/v1beta1/query.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos/gov/v1beta1/query.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos/gov/v1beta1/query.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos/gov/v1beta1/tx.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos/gov/v1beta1/tx.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos/gov/v1beta1/tx.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos_proto/cosmos.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos_proto/cosmos.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/cosmos_proto/cosmos.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1}/module/types/gogoproto/gogo.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1}/module/types/gogoproto/gogo.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1}/module/types/gogoproto/gogo.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/google/api/annotations.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/google/api/annotations.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/google/api/annotations.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/google/api/http.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/google/api/http.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/google/api/http.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1}/module/types/google/protobuf/any.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1}/module/types/google/protobuf/any.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1}/module/types/google/protobuf/any.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/google/protobuf/descriptor.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/google/protobuf/descriptor.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/google/protobuf/descriptor.ts rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1}/module/types/google/protobuf/duration.d.ts (98%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1}/module/types/google/protobuf/duration.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.gov.v1beta1/module/types/google/protobuf/duration.ts (98%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1}/module/types/google/protobuf/timestamp.d.ts (77%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.slashing.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1}/module/types/google/protobuf/timestamp.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1}/module/types/google/protobuf/timestamp.ts (85%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.gov.v1beta1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/index.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/index.d.ts (89%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/index.js (80%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/index.ts (78%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/rest.d.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/rest.js (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/rest.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/cosmos/slashing/v1beta1/genesis.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/cosmos/slashing/v1beta1/genesis.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/cosmos/slashing/v1beta1/genesis.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/cosmos/slashing/v1beta1/query.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/cosmos/slashing/v1beta1/query.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/cosmos/slashing/v1beta1/query.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/cosmos/slashing/v1beta1/slashing.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/cosmos/slashing/v1beta1/slashing.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/cosmos/slashing/v1beta1/slashing.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/cosmos/slashing/v1beta1/tx.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/cosmos/slashing/v1beta1/tx.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/cosmos/slashing/v1beta1/tx.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.slashing.v1beta1}/module/types/gogoproto/gogo.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.slashing.v1beta1}/module/types/gogoproto/gogo.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.slashing.v1beta1}/module/types/gogoproto/gogo.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/google/api/annotations.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/google/api/annotations.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/google/api/annotations.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/google/api/http.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/google/api/http.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/google/api/http.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/google/protobuf/descriptor.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/google/protobuf/descriptor.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/google/protobuf/descriptor.ts rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.slashing.v1beta1}/module/types/google/protobuf/duration.d.ts (98%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.slashing.v1beta1}/module/types/google/protobuf/duration.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module/types/google/protobuf/duration.ts (98%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.gov.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.slashing.v1beta1}/module/types/google/protobuf/timestamp.d.ts (77%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.staking.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.slashing.v1beta1}/module/types/google/protobuf/timestamp.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.evidence.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.slashing.v1beta1}/module/types/google/protobuf/timestamp.ts (85%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/index.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/index.d.ts (93%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/index.js (89%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/index.ts (87%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/rest.d.ts (87%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/rest.js (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/rest.ts (89%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos/base/query/v1beta1/pagination.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1}/module/types/cosmos/base/v1beta1/coin.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1}/module/types/cosmos/base/v1beta1/coin.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1}/module/types/cosmos/base/v1beta1/coin.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos/staking/v1beta1/genesis.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos/staking/v1beta1/genesis.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos/staking/v1beta1/genesis.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos/staking/v1beta1/query.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos/staking/v1beta1/query.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos/staking/v1beta1/query.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos/staking/v1beta1/staking.d.ts (79%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos/staking/v1beta1/staking.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos/staking/v1beta1/staking.ts (95%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos/staking/v1beta1/tx.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos/staking/v1beta1/tx.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos/staking/v1beta1/tx.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos_proto/cosmos.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos_proto/cosmos.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/cosmos_proto/cosmos.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1 => generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1}/module/types/gogoproto/gogo.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1 => generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1}/module/types/gogoproto/gogo.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1 => generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1}/module/types/gogoproto/gogo.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/api/annotations.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/api/annotations.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/api/annotations.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/api/http.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/api/http.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/api/http.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1}/module/types/google/protobuf/any.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1}/module/types/google/protobuf/any.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/cosmos.vesting.v1beta1 => generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1}/module/types/google/protobuf/any.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/protobuf/descriptor.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/protobuf/descriptor.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/protobuf/descriptor.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/protobuf/duration.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/protobuf/duration.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/protobuf/duration.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/protobuf/timestamp.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/protobuf/timestamp.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/google/protobuf/timestamp.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/tendermint/crypto/keys.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/tendermint/crypto/keys.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/tendermint/crypto/keys.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/tendermint/crypto/proof.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/tendermint/crypto/proof.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/tendermint/crypto/proof.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/tendermint/types/types.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/tendermint/types/types.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/tendermint/types/types.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/tendermint/types/validator.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/tendermint/types/validator.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/tendermint/types/validator.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/tendermint/version/types.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/tendermint/version/types.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/module/types/tendermint/version/types.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.staking.v1beta1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/index.d.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/index.js (64%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/index.ts (65%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/index.d.ts (90%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/index.js (81%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/index.ts (79%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/rest.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/rest.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/rest.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/cosmos/auth/v1beta1/auth.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/cosmos/auth/v1beta1/auth.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/cosmos/auth/v1beta1/auth.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1 => generated/cosmos/cosmos-sdk/cosmos.vesting.v1beta1}/module/types/cosmos/base/v1beta1/coin.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1 => generated/cosmos/cosmos-sdk/cosmos.vesting.v1beta1}/module/types/cosmos/base/v1beta1/coin.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1 => generated/cosmos/cosmos-sdk/cosmos.vesting.v1beta1}/module/types/cosmos/base/v1beta1/coin.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/cosmos/vesting/v1beta1/tx.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/cosmos/vesting/v1beta1/tx.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/cosmos/vesting/v1beta1/tx.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/cosmos/vesting/v1beta1/vesting.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/cosmos/vesting/v1beta1/vesting.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/cosmos/vesting/v1beta1/vesting.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/cosmos_proto/cosmos.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/cosmos_proto/cosmos.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/cosmos_proto/cosmos.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.channel.v1 => generated/cosmos/cosmos-sdk/cosmos.vesting.v1beta1}/module/types/gogoproto/gogo.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.channel.v1 => generated/cosmos/cosmos-sdk/cosmos.vesting.v1beta1}/module/types/gogoproto/gogo.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.channel.v1 => generated/cosmos/cosmos-sdk/cosmos.vesting.v1beta1}/module/types/gogoproto/gogo.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1 => generated/cosmos/cosmos-sdk/cosmos.vesting.v1beta1}/module/types/google/protobuf/any.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1 => generated/cosmos/cosmos-sdk/cosmos.vesting.v1beta1}/module/types/google/protobuf/any.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.applications.transfer.v1 => generated/cosmos/cosmos-sdk/cosmos.vesting.v1beta1}/module/types/google/protobuf/any.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/google/protobuf/descriptor.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/google/protobuf/descriptor.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/module/types/google/protobuf/descriptor.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.vesting.v1beta1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.applications.transfer.v1/index.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/index.d.ts (89%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/index.js (80%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/index.ts (78%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/rest.d.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/rest.js (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/rest.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/cosmos/base/query/v1beta1/pagination.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/cosmos/base/query/v1beta1/pagination.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/cosmos/base/query/v1beta1/pagination.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/cosmos/base/v1beta1/coin.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/cosmos/base/v1beta1/coin.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/cosmos/base/v1beta1/coin.ts rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.client.v1 => generated/cosmos/cosmos-sdk/ibc.applications.transfer.v1}/module/types/gogoproto/gogo.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.client.v1 => generated/cosmos/cosmos-sdk/ibc.applications.transfer.v1}/module/types/gogoproto/gogo.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.client.v1 => generated/cosmos/cosmos-sdk/ibc.applications.transfer.v1}/module/types/gogoproto/gogo.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/google/api/annotations.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/google/api/annotations.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/google/api/annotations.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/google/api/http.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/google/api/http.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/google/api/http.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.channel.v1 => generated/cosmos/cosmos-sdk/ibc.applications.transfer.v1}/module/types/google/protobuf/any.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.channel.v1 => generated/cosmos/cosmos-sdk/ibc.applications.transfer.v1}/module/types/google/protobuf/any.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.channel.v1 => generated/cosmos/cosmos-sdk/ibc.applications.transfer.v1}/module/types/google/protobuf/any.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/google/protobuf/descriptor.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/google/protobuf/descriptor.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/google/protobuf/descriptor.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/ibc/applications/transfer/v1/genesis.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/ibc/applications/transfer/v1/genesis.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/ibc/applications/transfer/v1/genesis.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/ibc/applications/transfer/v1/query.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/ibc/applications/transfer/v1/query.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/ibc/applications/transfer/v1/query.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/ibc/applications/transfer/v1/transfer.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/ibc/applications/transfer/v1/transfer.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/ibc/applications/transfer/v1/transfer.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/ibc/applications/transfer/v1/tx.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/ibc/applications/transfer/v1/tx.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/ibc/applications/transfer/v1/tx.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/ibc/core/client/v1/client.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/ibc/core/client/v1/client.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.applications.transfer.v1/module/types/ibc/core/client/v1/client.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.applications.transfer.v1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.channel.v1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.channel.v1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.channel.v1/index.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/index.d.ts (95%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/index.js (93%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/index.ts (91%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/rest.d.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/rest.js (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/rest.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/cosmos/base/query/v1beta1/pagination.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/cosmos/base/query/v1beta1/pagination.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/cosmos/base/query/v1beta1/pagination.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.connection.v1 => generated/cosmos/cosmos-sdk/ibc.core.channel.v1}/module/types/gogoproto/gogo.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.connection.v1 => generated/cosmos/cosmos-sdk/ibc.core.channel.v1}/module/types/gogoproto/gogo.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.connection.v1 => generated/cosmos/cosmos-sdk/ibc.core.channel.v1}/module/types/gogoproto/gogo.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/google/api/annotations.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/google/api/annotations.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/google/api/annotations.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/google/api/http.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/google/api/http.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/google/api/http.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.client.v1 => generated/cosmos/cosmos-sdk/ibc.core.channel.v1}/module/types/google/protobuf/any.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.client.v1 => generated/cosmos/cosmos-sdk/ibc.core.channel.v1}/module/types/google/protobuf/any.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.client.v1 => generated/cosmos/cosmos-sdk/ibc.core.channel.v1}/module/types/google/protobuf/any.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/google/protobuf/descriptor.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/google/protobuf/descriptor.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/google/protobuf/descriptor.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/ibc/core/channel/v1/channel.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/ibc/core/channel/v1/channel.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/ibc/core/channel/v1/channel.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/ibc/core/channel/v1/genesis.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/ibc/core/channel/v1/genesis.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/ibc/core/channel/v1/genesis.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/ibc/core/channel/v1/query.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/ibc/core/channel/v1/query.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/ibc/core/channel/v1/query.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/ibc/core/channel/v1/tx.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/ibc/core/channel/v1/tx.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/ibc/core/channel/v1/tx.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/ibc/core/client/v1/client.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/ibc/core/client/v1/client.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.channel.v1/module/types/ibc/core/client/v1/client.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.channel.v1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.client.v1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.client.v1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.client.v1/index.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/index.d.ts (93%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/index.js (88%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/index.ts (85%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/rest.d.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/rest.js (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/rest.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/cosmos/base/query/v1beta1/pagination.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/cosmos/base/query/v1beta1/pagination.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/cosmos/base/query/v1beta1/pagination.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/gogoproto/gogo.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/gogoproto/gogo.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/gogoproto/gogo.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/google/api/annotations.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/google/api/annotations.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/google/api/annotations.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/google/api/http.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/google/api/http.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/google/api/http.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.connection.v1 => generated/cosmos/cosmos-sdk/ibc.core.client.v1}/module/types/google/protobuf/any.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.connection.v1 => generated/cosmos/cosmos-sdk/ibc.core.client.v1}/module/types/google/protobuf/any.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain/cosmos/cosmos-sdk/ibc.core.connection.v1 => generated/cosmos/cosmos-sdk/ibc.core.client.v1}/module/types/google/protobuf/any.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/google/protobuf/descriptor.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/google/protobuf/descriptor.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/google/protobuf/descriptor.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/ibc/core/client/v1/client.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/ibc/core/client/v1/client.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/ibc/core/client/v1/client.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/ibc/core/client/v1/genesis.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/ibc/core/client/v1/genesis.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/ibc/core/client/v1/genesis.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/ibc/core/client/v1/query.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/ibc/core/client/v1/query.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/ibc/core/client/v1/query.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/ibc/core/client/v1/tx.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/ibc/core/client/v1/tx.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.client.v1/module/types/ibc/core/client/v1/tx.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.client.v1/vuex-root create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.connection.v1/index.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.connection.v1/index.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.connection.v1/index.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/index.d.ts (93%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/index.js (88%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/index.ts (86%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/rest.d.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/rest.js (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/rest.ts (99%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/confio/proofs.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/confio/proofs.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/confio/proofs.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/cosmos/base/query/v1beta1/pagination.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/cosmos/base/query/v1beta1/pagination.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/cosmos/base/query/v1beta1/pagination.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/gogoproto/gogo.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/gogoproto/gogo.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/gogoproto/gogo.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/google/api/annotations.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/google/api/annotations.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/google/api/annotations.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/google/api/http.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/google/api/http.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/google/api/http.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/google/protobuf/any.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/google/protobuf/any.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/google/protobuf/any.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/google/protobuf/descriptor.d.ts create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/google/protobuf/descriptor.js create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/google/protobuf/descriptor.ts rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/client/v1/client.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/client/v1/client.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/client/v1/client.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/commitment/v1/commitment.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/commitment/v1/commitment.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/commitment/v1/commitment.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/connection/v1/connection.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/connection/v1/connection.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/connection/v1/connection.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/connection/v1/genesis.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/connection/v1/genesis.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/connection/v1/genesis.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/connection/v1/query.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/connection/v1/query.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/connection/v1/query.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/connection/v1/tx.d.ts (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/connection/v1/tx.js (100%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/cosmos/cosmos-sdk/ibc.core.connection.v1/module/types/ibc/core/connection/v1/tx.ts (100%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/cosmos/cosmos-sdk/ibc.core.connection.v1/vuex-root rename starport/templates/app/stargate/vue/src/store/{chain => generated}/index.d.ts (86%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/index.js (60%) rename starport/templates/app/stargate/vue/src/store/{chain => generated}/index.ts (60%) create mode 100644 starport/templates/app/stargate/vue/src/store/generated/readme.md delete mode 100644 starport/templates/app/stargate/vue/src/views/Address.vue delete mode 100644 starport/templates/app/stargate/vue/src/views/Block.vue delete mode 100644 starport/templates/app/stargate/vue/src/views/Blocks.vue delete mode 100644 starport/templates/app/stargate/vue/src/views/Send.vue rename starport/templates/app/stargate/vue/src/views/{Legacy.vue => Types.vue} (58%) delete mode 100644 starport/templates/app/stargate/vue/src/views/Wallet.vue diff --git a/starport/pkg/cosmosgen/templates/js/index.ts.tpl b/starport/pkg/cosmosgen/templates/js/index.ts.tpl index 0d94d084ed..a5ccf8e0fe 100644 --- a/starport/pkg/cosmosgen/templates/js/index.ts.tpl +++ b/starport/pkg/cosmosgen/templates/js/index.ts.tpl @@ -1,6 +1,6 @@ // THIS FILE IS GENERATED AUTOMATICALLY. DO NOT MODIFY. -import { coins, StdFee } from "@cosmjs/launchpad"; +import { StdFee } from "@cosmjs/launchpad"; import { SigningStargateClient } from "@cosmjs/stargate"; import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; import { Api } from "./rest"; @@ -24,7 +24,8 @@ interface TxClientOptions { } interface SignAndBroadcastOptions { - fee: StdFee + fee: StdFee, + memo?: string } const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = { addr: "http://localhost:26657" }) => { @@ -34,7 +35,7 @@ const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = const { address } = (await wallet.getAccounts())[0]; return { - signAndBroadcast: (msgs: EncodeObject[], { fee: fee }: SignAndBroadcastOptions = { fee: defaultFee }) => client.signAndBroadcast(address, msgs, fee), + signAndBroadcast: (msgs: EncodeObject[], { fee=defaultFee, memo=null }: SignAndBroadcastOptions) => memo?client.signAndBroadcast(address, msgs, fee,memo):client.signAndBroadcast(address, msgs, fee), {{ range .Module.Msgs }}{{ camelCase .Name }}: (data: {{ .Name }}): EncodeObject => ({ typeUrl: "/{{ .URI }}", value: data }), {{ end }} }; diff --git a/starport/pkg/cosmosgen/templates/vuex/root/index.ts.tpl b/starport/pkg/cosmosgen/templates/vuex/root/index.ts.tpl index 06b5ef6590..7505baa434 100644 --- a/starport/pkg/cosmosgen/templates/vuex/root/index.ts.tpl +++ b/starport/pkg/cosmosgen/templates/vuex/root/index.ts.tpl @@ -4,7 +4,7 @@ {{ end }} export default { - {{ range . }}{{ .FullName }}: load({{ .FullName }}, 'chain/{{ .FullPath }}'), + {{ range . }}{{ .FullName }}: load({{ .FullName }}, '{{ .Path }}'), {{ end }} } @@ -18,13 +18,17 @@ function load(mod, fullns) { store.registerModule(ns, { namespaced: true }) } } - store.registerModule(fullnsLevels, mod) - store.subscribe((mutation) => { - if (mutation.type == 'chain/common/env/INITIALIZE_WS_COMPLETE') { - store.dispatch(fullns+ '/init', null, { - root: true - }) - } - }) + if (store.hasModule(fullnsLevels)) { + throw new Error('Duplicate module name detected: '+ fullnsLevels.pop()) + }else{ + store.registerModule(fullnsLevels, mod) + store.subscribe((mutation) => { + if (mutation.type == 'common/env/INITIALIZE_WS_COMPLETE') { + store.dispatch(fullns+ '/init', null, { + root: true + }) + } + }) + } } } diff --git a/starport/pkg/cosmosgen/templates/vuex/store/index.ts.tpl b/starport/pkg/cosmosgen/templates/vuex/store/index.ts.tpl index 4bd5c3c8fe..0880ed6aec 100644 --- a/starport/pkg/cosmosgen/templates/vuex/store/index.ts.tpl +++ b/starport/pkg/cosmosgen/templates/vuex/store/index.ts.tpl @@ -1,17 +1,19 @@ import { txClient, queryClient } from './module' +// @ts-ignore +import { SpVuexError } from '@starport/vuex' {{ range .Module.Types }}import { {{ .Name }} } from "./module/types/{{ resolveFile .FilePath }}" {{ end }} async function initTxClient(vuexGetters) { - return await txClient(vuexGetters['chain/common/wallet/signer'], { - addr: vuexGetters['chain/common/env/apiTendermint'] + return await txClient(vuexGetters['common/wallet/signer'], { + addr: vuexGetters['common/env/apiTendermint'] }) } async function initQueryClient(vuexGetters) { return await queryClient({ - addr: vuexGetters['chain/common/env/apiCosmos'] + addr: vuexGetters['common/env/apiCosmos'] }) } @@ -28,9 +30,7 @@ function getStructure(template) { const getDefaultState = () => { return { - {{ range .Module.Queries }}get{{ .Name }}: (state) => (params = {}) => { - return state.Post[JSON.stringify(params)] ?? {} - }, + {{ range .Module.Queries }}{{ .Name }}: {}, {{ end }} _Structure: { {{ range .Module.Types }}{{ .Name }}: getStructure({{ .Name }}.fromPartial({})), @@ -62,7 +62,10 @@ export default { }, getters: { {{ range .Module.Queries }}get{{ .Name }}: (state) => (params = {}) => { - return state.Post[JSON.stringify(params)] ?? {} + if (!( params).query) { + ( params).query=null + } + return state.{{ .Name }}[JSON.stringify(params)] ?? {} }, {{ end }} getTypeStructure: (state) => (type) => { @@ -72,8 +75,8 @@ export default { actions: { init({ dispatch, rootGetters }) { console.log('init') - if (rootGetters['chain/common/env/client']) { - rootGetters['chain/common/env/client'].on('newblock', () => { + if (rootGetters['common/env/client']) { + rootGetters['common/env/client'].on('newblock', () => { dispatch('StoreUpdate') }) } @@ -89,24 +92,58 @@ export default { dispatch(subscription.action, subscription.payload) }) }, - {{ range .Module.Queries }}async {{ .FullName }}({ commit, rootGetters }, { subscribe = false, ...key }) { + {{ range .Module.Queries }}async {{ .FullName }}({ commit, rootGetters, getters }, { options: { subscribe = false , all = false}, params: {...key}, query=null }) { try { - const value = (await (await initQueryClient(rootGetters)).{{ camelCase .FullName }}.apply(null, Object.values(key))).data - commit('QUERY', { query: 'Post', key, value }) - if (subscribe) commit('SUBSCRIBE', { action: 'QueryPost', payload: key }) + + let value = query?(await (await initQueryClient(rootGetters)).{{ camelCase .FullName }}({{ range $i,$a :=.HTTPAnnotations.URLParams}} key.{{$a}}, {{end}} query)).data:(await (await initQueryClient(rootGetters)).{{ camelCase .FullName }}({{ range $i,$a :=.HTTPAnnotations.URLParams}}{{ if (gt $i 0)}}, {{ end}} key.{{$a}} {{end}})).data + {{ if .HTTPAnnotations.URLHasQuery}} + while (all && ( value).pagination && ( value).pagination.nextKey!=null) { + let next_values=(await (await initQueryClient(rootGetters)).{{ camelCase .FullName }}({{ range $i,$a :=.HTTPAnnotations.URLParams}} key.{{$a}}, {{end}}{...query, 'pagination.key':( value).pagination.nextKey})).data + for (let prop of Object.keys(next_values)) { + if (Array.isArray(next_values[prop])) { + value[prop]=[...value[prop], ...next_values[prop]] + }else{ + value[prop]=next_values[prop] + } + } + } + {{ end }} + commit('QUERY', { query: '{{ .Name }}', key: { params: {...key}, query}, value }) + if (subscribe) commit('SUBSCRIBE', { action: '{{ .FullName }}', payload: { options: { all }, params: {...key},query }}) + return getters['get{{.Name }}']( { params: {...key}, query}) ?? {} } catch (e) { - console.log('Query Failed: API node unavailable') + console.error(new SpVuexError('QueryClient:{{ .FullName }}', 'API Node Unavailable. Could not perform query.')) + return {} } }, - {{ end }} - {{ range .Module.Msgs }}async {{ .Name }}({ rootGetters }, { value }) { + {{ end }} + {{ range .Module.Msgs }}async send{{ .Name }}({ rootGetters }, { value, fee, memo }) { try { const msg = await (await initTxClient(rootGetters)).{{ camelCase .Name }}(value) - await (await initTxClient(rootGetters)).signAndBroadcast([msg]) + const result = await (await initTxClient(rootGetters)).signAndBroadcast([msg], {fee: { amount: fee, + gas: "200000" }, memo}) + return result } catch (e) { - throw 'Failed to broadcast transaction: ' + e + if (e.toString()=='wallet is required') { + throw new SpVuexError('TxClient:{{ .Name }}:Init', 'Could not initialize signing client. Wallet is required.') + }else{ + throw new SpVuexError('TxClient:{{ .Name }}:Send', 'Could not broadcast Tx.') + } } }, - {{ end }} + {{ end }} + {{ range .Module.Msgs }}async {{ .Name }}({ rootGetters }, { value }) { + try { + const msg = await (await initTxClient(rootGetters)).{{ camelCase .Name }}(value) + return msg + } catch (e) { + if (e.toString()=='wallet is required') { + throw new SpVuexError('TxClient:{{ .Name }}:Init', 'Could not initialize signing client. Wallet is required.') + }else{ + throw new SpVuexError('TxClient:{{ .Name }}:Create', 'Could not create message.') + } + } + }, + {{ end }} } } diff --git a/starport/services/chain/build.go b/starport/services/chain/build.go index 44e8e89945..3757d49ad6 100644 --- a/starport/services/chain/build.go +++ b/starport/services/chain/build.go @@ -173,7 +173,7 @@ func (c *Chain) buildProto(ctx context.Context) error { // generate Vuex code as well if it is enabled. if conf.Client.Vuex.Path != "" { - storeRootPath := filepath.Join(c.app.Path, conf.Client.Vuex.Path, "chain") + storeRootPath := filepath.Join(c.app.Path, conf.Client.Vuex.Path, "generated") options = append(options, cosmosgen.WithVuexGeneration( enableThirdPartyModuleCodegen, diff --git a/starport/services/scaffolder/init.go b/starport/services/scaffolder/init.go index 1297fb40c1..1a7f34a931 100644 --- a/starport/services/scaffolder/init.go +++ b/starport/services/scaffolder/init.go @@ -108,7 +108,7 @@ func (s *Scaffolder) protoc(projectPath, gomodPath string, version cosmosver.Maj // generate Vuex code as well if it is enabled. if conf.Client.Vuex.Path != "" { - storeRootPath := filepath.Join(projectPath, conf.Client.Vuex.Path, "chain") + storeRootPath := filepath.Join(projectPath, conf.Client.Vuex.Path, "generated") options = append(options, cosmosgen.WithVuexGeneration( false, diff --git a/starport/templates/app/stargate/vue/src/App.vue b/starport/templates/app/stargate/vue/src/App.vue index 68a51077fa..31bb7a9700 100644 --- a/starport/templates/app/stargate/vue/src/App.vue +++ b/starport/templates/app/stargate/vue/src/App.vue @@ -3,33 +3,7 @@