Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: ts-client dependency updates. Update vue/react templates #3726

Merged
merged 13 commits into from
Nov 8, 2023
Merged
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
- [#3655](https://github.com/ignite/cli/pull/3655) Re-enable TS client generation
- [#3661](https://github.com/ignite/cli/pull/3661) Change `pkg/cosmosanalysis` to find Cosmos SDK runtime app registered modules
- [#3716](https://github.com/ignite/cli/pull/3716) Fix invalid plugin hook check
- [#3725](https://github.com/ignite/cli/pull/3725) Fix flaky TS client generation issues on linux
- [#3726](https://github.com/ignite/cli/pull/3726) Update TS client dependencies. Bump vue/react template versions

## [`v0.27.0`](https://github.com/ignite/cli/releases/tag/v0.27.0)

Expand Down
17 changes: 13 additions & 4 deletions ignite/pkg/cosmosgen/generate_openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/ignite/cli/ignite/pkg/cache"
"github.com/ignite/cli/ignite/pkg/cosmosanalysis/module"
"github.com/ignite/cli/ignite/pkg/dirchange"
"github.com/ignite/cli/ignite/pkg/nodetime"
swaggercombine "github.com/ignite/cli/ignite/pkg/nodetime/programs/swagger-combine"
"github.com/ignite/cli/ignite/pkg/xos"
)
Expand Down Expand Up @@ -39,7 +40,11 @@ func (g *generator) generateOpenAPISpec() error {
},
}
)

command, cleanup, err := nodetime.Command(nodetime.CommandSwaggerCombine)
if err != nil {
return err
}
defer cleanup()
defer func() {
for _, dir := range specDirs {
os.RemoveAll(dir)
Expand Down Expand Up @@ -157,7 +162,7 @@ func (g *generator) generateOpenAPISpec() error {
}

// combine specs into one and save to out.
if err := swaggercombine.Combine(g.ctx, conf, out); err != nil {
if err := swaggercombine.Combine(g.ctx, conf, command, out); err != nil {
return err
}

Expand All @@ -174,6 +179,11 @@ func (g *generator) generateModuleOpenAPISpec(m module.Module, out string) error
},
}
)
command, cleanup, err := nodetime.Command(nodetime.CommandSwaggerCombine)
if err != nil {
return err
}
defer cleanup()

defer func() {
for _, dir := range specDirs {
Expand Down Expand Up @@ -242,7 +252,6 @@ func (g *generator) generateModuleOpenAPISpec(m module.Module, out string) error
if err := os.MkdirAll(outDir, 0o766); err != nil {
return err
}

// combine specs into one and save to out.
return swaggercombine.Combine(g.ctx, conf, out)
return swaggercombine.Combine(g.ctx, conf, command, out)
}
5 changes: 2 additions & 3 deletions ignite/pkg/cosmosgen/templates/module/module.ts.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Generated by Ignite ignite.com/cli

import { StdFee } from "@cosmjs/launchpad";
import { SigningStargateClient, DeliverTxResponse } from "@cosmjs/stargate";
import { SigningStargateClient, DeliverTxResponse, StdFee } from "@cosmjs/stargate";
import { EncodeObject, GeneratedType, OfflineSigner, Registry } from "@cosmjs/proto-signing";
import { msgTypes } from './registry';
import { IgniteClient } from "../client"
Expand Down Expand Up @@ -60,7 +59,7 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
}
try {
const { address } = (await signer.getAccounts())[0];
const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix});
const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry});
let msg = this.{{ camelCase .Name }}({ value: {{ .Name }}.fromPartial(value) })
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
} catch (e: any) {
Expand Down
5 changes: 2 additions & 3 deletions ignite/pkg/cosmosgen/templates/root/client.ts.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import {
EncodeObject,
Registry,
} from "@cosmjs/proto-signing";
import { StdFee } from "@cosmjs/launchpad";
import { SigningStargateClient } from "@cosmjs/stargate";
import { SigningStargateClient, StdFee } from "@cosmjs/stargate";
import { Env } from "./env";
import { UnionToIntersection, Return, Constructor } from "./helpers";
import { Module } from "./modules";
Expand Down Expand Up @@ -42,7 +41,7 @@ export class IgniteClient extends EventEmitter {
async signAndBroadcast(msgs: EncodeObject[], fee: StdFee, memo: string) {
if (this.signer) {
const { address } = (await this.signer.getAccounts())[0];
const signingClient = await SigningStargateClient.connectWithSigner(this.env.rpcURL, this.signer, { registry: new Registry(this.registry), prefix: this.env.prefix });
const signingClient = await SigningStargateClient.connectWithSigner(this.env.rpcURL, this.signer, { registry: new Registry(this.registry) });
return await signingClient.signAndBroadcast(address, msgs, fee ? fee : defaultFee, memo)
} else {
throw new Error(" Signer is not present.");
Expand Down
17 changes: 9 additions & 8 deletions ignite/pkg/cosmosgen/templates/root/package.json.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,24 @@
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"main": "index.ts",
"main": "lib/index.js",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@cosmjs/launchpad": "0.27.0",
"@cosmjs/proto-signing": "0.27.0",
"@cosmjs/stargate": "0.27.0",
"scripts": {
"build": "NODE_OPTIONS='--max-old-space-size=16384' tsc"
},
"dependencies": {
"@cosmjs/proto-signing": "0.31.1",
"@cosmjs/stargate": "0.31.1",
"@keplr-wallet/types": "^0.11.3",
Copy link
Contributor

@lxgr-linux lxgr-linux Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keplr types should maybe also be bumped to 0.12.40.

"axios": "0.21.4",
"buffer": "^6.0.3",
"events": "^3.3.0"
},
"peerDependencies": {
"@cosmjs/launchpad": "0.27.0",
"@cosmjs/proto-signing": "0.27.0",
"@cosmjs/stargate": "0.27.0"
"@cosmjs/proto-signing": "0.31.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, does it fixes #3686 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep...

Copy link
Member

@julienrbrt julienrbrt Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to bump it here (https://github.com/ignite/web ) but everything was breaking 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to document the integrations tbh

"@cosmjs/stargate": "0.31.1"
},
"devDependencies": {
"@types/events": "^3.0.0",
Expand Down
1 change: 1 addition & 0 deletions ignite/pkg/cosmosgen/templates/root/tsconfig.json.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"module": "ES2020",
"moduleResolution": "node",
"outDir": "./lib",
"declaration": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": false,
"strict": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"regexp"

"github.com/ignite/cli/ignite/pkg/cmdrunner/exec"
"github.com/ignite/cli/ignite/pkg/nodetime"
)

// Config represent swagger-combine config.
Expand Down Expand Up @@ -81,13 +80,7 @@ func (c *Config) AddSpec(id, path string, makeUnique bool) error {

// Combine combines openapi specs into one and saves to out path.
// specs is a spec id-fs path pair.
func Combine(ctx context.Context, c Config, out string) error {
command, cleanup, err := nodetime.Command(nodetime.CommandSwaggerCombine)
if err != nil {
return err
}
defer cleanup()

func Combine(ctx context.Context, c Config, command []string, out string) error {
f, err := os.CreateTemp("", "*.json")
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion ignite/templates/app/files/go.mod.plush
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/golang/protobuf v1.5.3
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0
github.com/spf13/cast v1.5.1
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
Expand Down
1 change: 1 addition & 0 deletions ignite/templates/app/files/proto/buf.gen.sta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ plugins:
opt:
- logtostderr=true
- openapi_naming_strategy=simple
- ignore_comments=true
- simple_operation_ids=false
- json_names_for_fields=false