Skip to content

Commit

Permalink
chore: ts-client dependency updates. Update vue/react templates (#3726)
Browse files Browse the repository at this point in the history
* fix: Optimise ts-client generation

* chore: Update changelog

* chore: Bump cosmjs to 0.31.1

* chore: Update changelog

* chore: bump templates to 0.5.1

* fix: main module is now js so we must build after installing

---------

Co-authored-by: Danilo Pantani <[email protected]>
Co-authored-by: Jerónimo Albi <[email protected]>
  • Loading branch information
3 people authored Nov 8, 2023
1 parent 3771563 commit ee672ce
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- [#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
- [#3728](https://github.com/ignite/cli/pull/3728) Fix wrong parser for proto package names
- [#3729](https://github.com/ignite/cli/pull/3729) Fix broken generator due to caching /tmp include folders

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ require (
github.com/iancoleman/strcase v0.2.0
github.com/ignite/ignite-files/nodetime v0.0.2
github.com/ignite/ignite-files/protoc v0.0.1
github.com/ignite/web v0.4.3
github.com/ignite/web v0.5.1
github.com/imdario/mergo v0.3.15
github.com/jpillora/chisel v1.8.1
github.com/lib/pq v1.10.9
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,8 @@ github.com/ignite/ignite-files/nodetime v0.0.2 h1:9Aj0OEa7FWI22J/Zdq7M2JvsjgFLng
github.com/ignite/ignite-files/nodetime v0.0.2/go.mod h1:GKDsXdeazHyhSBPdVLp7mNIo/m9LmZ6/h8RmQ0/CoaM=
github.com/ignite/ignite-files/protoc v0.0.1 h1:wXxU1dzruUgSVl1diAuAOA+xv0NQKXJFsDWht2+tAP8=
github.com/ignite/ignite-files/protoc v0.0.1/go.mod h1:cVCHJbEHPIeKHMPk3ZoPS0Xw4XQfUc76BAMAPU9Fwjg=
github.com/ignite/web v0.4.3 h1:LHucUEXttzCf5JmxO5/xLKVx1Qz1o124HqF4Nii5uWQ=
github.com/ignite/web v0.4.3/go.mod h1:WZWBaBYF8RazN7dE462BLpvXDY8ScacxcJ07BKwX/jY=
github.com/ignite/web v0.5.1 h1:xGOt8wJG7WIrNO30e8Zbm669VFyo6sje/vWnusLPp6k=
github.com/ignite/web v0.5.1/go.mod h1:WZWBaBYF8RazN7dE462BLpvXDY8ScacxcJ07BKwX/jY=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
Expand Down
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
18 changes: 10 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,25 @@
"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",
"postinstall": "npm run build"
},
"dependencies": {
"@cosmjs/proto-signing": "0.31.1",
"@cosmjs/stargate": "0.31.1",
"@keplr-wallet/types": "^0.11.3",
"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",
"@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

0 comments on commit ee672ce

Please sign in to comment.