@hyperweb/telescope 1.17.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +30 -16
  2. package/main/commands/transpile.js +23 -16
  3. package/main/generators/create-bundle.js +41 -9
  4. package/main/generators/customize-utils.js +0 -1
  5. package/main/helpers/helper-func-types-interface.js +7 -7
  6. package/main/helpers/helper-func-types.js +7 -7
  7. package/main/helpers/react-query-hooks-icjs.js +5 -5
  8. package/main/helpers/react-query-hooks.js +5 -5
  9. package/main/helpers/types-helper.js +4 -38
  10. package/main/helpers/vue-query-hooks.js +4 -4
  11. package/main/protod/recursive.js +10 -1
  12. package/main/utils/index.js +0 -1
  13. package/module/commands/transpile.js +23 -16
  14. package/module/generators/create-bundle.js +41 -9
  15. package/module/generators/customize-utils.js +0 -1
  16. package/module/helpers/helper-func-types-interface.js +7 -7
  17. package/module/helpers/helper-func-types.js +7 -7
  18. package/module/helpers/react-query-hooks-icjs.js +5 -5
  19. package/module/helpers/react-query-hooks.js +5 -5
  20. package/module/helpers/types-helper.js +4 -38
  21. package/module/helpers/vue-query-hooks.js +4 -4
  22. package/module/protod/recursive.js +10 -1
  23. package/module/utils/index.js +0 -1
  24. package/package.json +6 -6
  25. package/src/commands/transpile.ts +23 -16
  26. package/src/generators/create-bundle.ts +51 -9
  27. package/src/generators/customize-utils.ts +0 -2
  28. package/src/helpers/helper-func-types-interface.ts +7 -7
  29. package/src/helpers/helper-func-types.ts +7 -7
  30. package/src/helpers/react-query-hooks-icjs.ts +5 -5
  31. package/src/helpers/react-query-hooks.ts +5 -5
  32. package/src/helpers/types-helper.ts +4 -38
  33. package/src/helpers/vue-query-hooks.ts +4 -4
  34. package/src/protod/recursive.ts +11 -1
  35. package/src/utils/index.ts +0 -1
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Telescope 🔭
2
2
 
3
3
  > ⚠️ **Important**: Please upgrade to `@hyperweb/telescope` to leverage new features like generating MCP servers and agents for AI-powered blockchain interactions!
4
+ **Update**: We have now updated '@hyperweb/telescope' to version 2.0 which now use interchainjs as the default dependency.
4
5
 
5
6
  <p align="center">
6
7
  <img width="280" src="https://user-images.githubusercontent.com/545047/175660665-5cbde84b-0928-4e59-ab56-be6adb2f3a7e.png"/>
@@ -532,12 +533,12 @@ telescope({
532
533
  | option | description | defaults |
533
534
  | ----------------------------------------- | -------------------------------------------------------------- | ---------- |
534
535
  | `interfaces.enabled` | Enable converters between Any type and specific implemented interfaces | `true` |
535
- | `interfaces.useGlobalDecoderRegistry` | Enable GlobalDecoderRegistry and related functions. Highly recommended when dealing with fields with 'accepted_interface' option. See 'packages/telescope/__tests__/impl-interfaces.test.ts' for usage. | `false` |
536
+ | `interfaces.useGlobalDecoderRegistry` | Enable GlobalDecoderRegistry and related functions. Highly recommended when dealing with fields with 'accepted_interface' option. See 'packages/telescope/__tests__/impl-interfaces.test.ts' for usage. | `true` |
536
537
  | `interfaces.registerAllDecodersToGlobal` | Automatically register all decoders to the global registry | `true` |
537
538
  | `interfaces.useUseInterfacesParams` | Add `useInterfaces` argument to `decode` and `toAmino` functions | `false` |
538
539
  | `interfaces.useByDefault` | Use interface decoders by default (default for `useInterfaces` argument to `decode` and `toAmino` functions) | `true` |
539
540
  | `interfaces.useByDefaultRpc` | Use interface decoders by default in RPC clients | `true` |
540
- | `interfaces.useUnionTypes` | Generate Any type as union types (TextProposal \| RegisterIncentiveProposal) instead of intersection types (TextProposal & RegisterIncentiveProposal) | `false` |
541
+ | `interfaces.useUnionTypes` | Generate Any type as union types (TextProposal \| RegisterIncentiveProposal) instead of intersection types (TextProposal & RegisterIncentiveProposal) | `true` |
541
542
 
542
543
  ### Prototypes Options
543
544
 
@@ -563,7 +564,7 @@ telescope({
563
564
  | `prototypes.addTypeUrlToObjects` | Add typeUrl field to generated Decoders | `true` |
564
565
  | `prototypes.strictNullCheckForPrototypeMethods` | Enable strict null checks for prototype methods | `false` |
565
566
  | `prototypes.paginationDefaultFromPartial` | Set default values for pagination in fromPartial methods | `false` |
566
- | `prototypes.enableRegistryLoader` | Generate Registry loader in *.registry.ts files | `true` |
567
+ | `prototypes.enableRegistryLoader` | Generate Registry loader in *.registry.ts files | `false` |
567
568
  | `prototypes.enableMessageComposer` | Generate MessageComposer in *.registry.ts files | `true` |
568
569
  | `prototypes.patch` | Object mapping filenames to an array of `Operation` to be applied as patches to proto files during generation. See [JSON Patch Protos](#json-patch-protos) | `undefined` |
569
570
 
@@ -573,12 +574,16 @@ telescope({
573
574
  | ---------------------------------- | ----------------------------------------------------------------- | ------- |
574
575
  | `prototypes.methods.encode` | Enable `encode` method on proto objects | `true` |
575
576
  | `prototypes.methods.decode` | Enable `decode` method on proto objects | `true` |
576
- | `prototypes.methods.fromJSON` | Enable `fromJSON` method on proto objects | `true` |
577
- | `prototypes.methods.toJSON` | Enable `toJSON` method on proto objects | `true` |
577
+ | `prototypes.methods.fromJSON` | Enable `fromJSON` method on proto objects | `false` |
578
+ | `prototypes.methods.toJSON` | Enable `toJSON` method on proto objects | `false` |
578
579
  | `prototypes.methods.fromPartial` | Enable `fromPartial` method on proto objects | `true` |
579
580
  | `prototypes.methods.fromSDK` | Enable `fromSDK` method on proto objects | `false` |
580
581
  | `prototypes.methods.toSDK` | Enable `toSDK` method on proto objects | `false` |
581
-
582
+ | `prototypes.methods.fromSDKJSON` | boolean to enable `fromSDKJSON` method on proto objects | `false` |
583
+ | `prototypes.methods.toAmino` | boolean to enable `toAmino` method on proto objects | `true` |
584
+ | `prototypes.methods.fromAmino` | boolean to enable `fromAmino` method on proto objects | `true` |
585
+ | `prototypes.methods.toProto` | boolean to enable `toProto` method on proto objects | `true` |
586
+ | `prototypes.methods.fromProto` | boolean to enable `fromProto` method on proto objects | `true` |
582
587
  ### Enums Options
583
588
 
584
589
  | option | description | defaults |
@@ -590,7 +595,7 @@ telescope({
590
595
 
591
596
  | option | description | defaults |
592
597
  | ------------------------------ | -------------------------------------------------------------- | ---------- |
593
- | `lcdClients.enabled` | Generate LCD clients that can query proto `Query` messages | `true` |
598
+ | `lcdClients.enabled` | Generate LCD clients that can query proto `Query` messages | `false` |
594
599
  | `lcdClients.bundle` | Generate factory bundle aggregate of all LCD Clients | `true` |
595
600
  | `lcdClients.scoped` | Generate factory of scoped LCD Clients | `undefined`|
596
601
  | `lcdClients.scopedIsExclusive` | Allow both scoped bundles and all RPC Clients | `true` |
@@ -612,7 +617,7 @@ See [LCD Clients](#lcd-clients) for more info.
612
617
  | option | description | defaults |
613
618
  | ------------------------------ | ---------------------------------------------------------------------- | ----------------------------- |
614
619
  | `rpcClients.type` | Generate this type of RPC client (`tendermint`, `gRPC-web`, `gRPC`)| `tendermint` |
615
- | `rpcClients.enabled` | Generate RPC clients that can interact with proto messages | `true` |
620
+ | `rpcClients.enabled` | Generate RPC clients that can interact with proto messages | `false` |
616
621
  | `rpcClients.bundle` | Generate factory bundle aggregate of all RPC Clients | `true` |
617
622
  | `rpcClients.inline` | Inline all RPC client methods into a single file | `false` |
618
623
  | `rpcClients.extensions` | Enable extensions for RPC clients | `true` |
@@ -637,8 +642,8 @@ See [RPC Clients](#rpc-clients) for more info.
637
642
 
638
643
  | Option | Description | Defaults |
639
644
  | --------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------- |
640
- | `helperFunctions.enabled` | Enable the generation of helper function files `.func.ts` | `false` |
641
- | `helperFunctions.useGlobalDecoderRegistry` | Use global decoder registry in helper functions | `false` |
645
+ | `helperFunctions.enabled` | Enable the generation of helper function files `.func.ts` | `true` |
646
+ | `helperFunctions.useGlobalDecoderRegistry` | Use global decoder registry in helper functions | `true` |
642
647
  | `helperFunctions.hooks` | Generates hooks selected alongside helper functions | `{ react: false, vue: false }` |
643
648
  | `helperFunctions.include.serviceTypes`| Specifies which types of services to include (`Query`, `Msg`). `undefined` includes all types. | `undefined` |
644
649
  | `helperFunctions.include.patterns` | Array of glob patterns patterns (e.g., `"**"`, `"cosmos.bank.v1beta1.bala*"`, etc.) to match specific proto services. | `undefined` |
@@ -656,8 +661,9 @@ See [Helper Functions Configuration](#helper-functions-configuration) for more i
656
661
 
657
662
  | option | description | defaults |
658
663
  | -------------------------------------------- | -------------------------------------------------------------- | ---------|
659
- | `stargateClients.includeCosmosDefaultTypes` | Include the CosmJS defaults with stargate clients | `true` (except cosmos package) |
660
- | `stargateClients.addGetTxRpc` | Add getSigningTxRpc to clients in namespaces | `false` |
664
+ | `stargateClients.enabled` | if true, will include the cosmjs defaults with stargate clients | `false` |
665
+ | `stargateClients.includeCosmosDefaultTypes` | if true, will include the cosmjs defaults with stargate clients | `true` (except cosmos package) |
666
+ | `stargateClients.addGetTxRpc` | if true, will add getSigningTxRpc to clients in namespaces | `false` |
661
667
 
662
668
  ### State Management
663
669
 
@@ -706,10 +712,10 @@ See [Helper Functions Configuration](#helper-functions-configuration) for more i
706
712
  | `prototypes.typingsFormat.customTypes.useEnhancedDecimal` | Use patched decimal instead of decimal from @cosmjs/math | `false` |
707
713
  | `prototypes.typingsFormat.customTypes.base64Lib` | Use endo/base64 methods | `undefined` |
708
714
  | `prototypes.typingsFormat.num64` | 'long' or 'bigint', the way of generating int64 proto types. Set to 'bigint' to use more stable built-in type | `bigint` |
709
- | `prototypes.typingsFormat.useTelescopeGeneratedType` | Discard GeneratedType from CosmJS, use TelescopeGeneratedType instead inside *.registry.ts files | `false` |
715
+ | `prototypes.typingsFormat.useTelescopeGeneratedType` | Discard GeneratedType from CosmJS, use TelescopeGeneratedType instead inside *.registry.ts files | `true` |
710
716
  | `prototypes.typingsFormat.useDeepPartial` | Use `DeepPartial` type instead of `Partial` TS type | `false` |
711
717
  | `prototypes.typingsFormat.useExact` | Use the `Exact` TS type | `false` |
712
- | `prototypes.typingsFormat.toJsonUnknown` | Use `any` for `toJSON` methods instead of `JsonSafe` | `true` |
718
+ | `prototypes.typingsFormat.toJsonUnknown` | Use `any` for `toJSON` methods instead of `JsonSafe` | `false` |
713
719
  | `prototypes.typingsFormat.timestamp` | Use either `date` or `timestamp` for `Timestamp` proto type | "date" |
714
720
  | `prototypes.typingsFormat.duration` | Use either `duration` or `string` for `Duration` proto type | "duration"|
715
721
  | `prototypes.typingsFormat.updatedDuration` | temporary field to avoid breaking changes | `false` |
@@ -721,6 +727,9 @@ See [Helper Functions Configuration](#helper-functions-configuration) for more i
721
727
 
722
728
  | option | description | defaults |
723
729
  | ----------------------------------------- | -------------------------------------------------------------- | --------- |
730
+ | `prototypes.parser.keepCase` | passes `keepCase` to protobuf `parse()` to keep original casing | `false` |
731
+ | `prototypes.parser.alternateCommentMode` | passes `alternateCommentMode` to protobuf `parse()` method | `true` |
732
+ | `prototypes.parser.preferTrailingComment` | passes `preferTrailingComment` to protobuf `parse()` method | `false` |
724
733
  | `prototypes.parser.keepCase` | Pass `keepCase` to protobuf `parse()` to keep original casing | `true` |
725
734
  | `prototypes.parser.alternateCommentMode` | Pass `alternateCommentMode` to protobuf `parse()` method | `true` |
726
735
  | `prototypes.parser.preferTrailingComment` | Pass `preferTrailingComment` to protobuf `parse()` method | `false` |
@@ -747,7 +756,6 @@ See [Helper Functions Configuration](#helper-functions-configuration) for more i
747
756
  | ------------------------------ | -------------------------------------------------------------- | ---------- |
748
757
  | `bundle.enabled` | Bundle all files into a scoped index file | `true` |
749
758
  | `bundle.type` | Bundle type: "namespace" or "module" | `"namespace"` |
750
- > **Warning:** This option is not recommended. It will generate a bundle file that exports all the types and functions under one namespace. This will make the bundle file very large and hard to maintain. e.g. using `cosmos.bank.v1beta1.MsgSend` might be intuitive, but it will also include `cosmos.gov.v1beta1.*` and other types in the final bundle file. So use this option with caution.
751
759
 
752
760
  ### MCP Server
753
761
 
@@ -766,6 +774,13 @@ See [MCP Integration](https://docs.hyperweb.io/telescope/developing/mcp-integrat
766
774
 
767
775
  | option | description | defaults |
768
776
  | ------------------------------ | ----------------------------------------------------------------- | ---------- |
777
+ | `env` | 'default' or 'v-next', set to 'v-next' to enable yet to release features | `v-next` |
778
+ | `useInterchainJs` | use interchain.js features | `true` |
779
+ | `removeUnusedImports` | removes unused imports | `true` |
780
+ | `classesUseArrowFunctions` | classes use arrow functions instead of `bind()`ing in constructors | `false` |
781
+ | `useSDKTypes` | use SDK types | `true` |
782
+ | `includeExternalHelpers` | exports a few helpers functions in `extern.ts` | `false` |
783
+ | `restoreImportExtension` | restore extensions of imported paths. e.g: '.js'. null means no ext | `null` |
769
784
  | `env` | 'default' or 'v-next', set to 'v-next' to enable yet-to-be-released features | `default` |
770
785
  | `removeUnusedImports` | Remove unused imports | `true` |
771
786
  | `classesUseArrowFunctions` | Classes use arrow functions instead of `bind()`ing in constructors | `false` |
@@ -1587,4 +1602,3 @@ Thanks to these engineers, teams and projects for inspiring Telescope:
1587
1602
  AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
1588
1603
 
1589
1604
  No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
1590
-
@@ -48,10 +48,11 @@ exports.default = async (argv) => {
48
48
  else {
49
49
  options = {
50
50
  // global options (can be overridden through plugins)
51
+ useInterchainJs: true,
51
52
  interfaces: {
52
- enabled: false,
53
- useByDefault: false,
54
- useUnionTypes: false,
53
+ enabled: true,
54
+ useByDefault: true,
55
+ useUnionTypes: true,
55
56
  },
56
57
  prototypes: {
57
58
  enabled: true,
@@ -72,32 +73,38 @@ exports.default = async (argv) => {
72
73
  addTypeUrlToObjects: true,
73
74
  addTypeUrlToDecoders: true,
74
75
  typingsFormat: {
75
- duration: 'duration',
76
- timestamp: 'date',
77
- useExact: false,
78
- useDeepPartial: false,
79
- num64: 'bigint',
80
76
  customTypes: {
81
- useCosmosSDKDec: true
82
- }
77
+ useCosmosSDKDec: true,
78
+ },
79
+ num64: "bigint",
80
+ useDeepPartial: false,
81
+ useExact: false,
82
+ toJsonUnknown: false,
83
+ timestamp: "date",
84
+ duration: "duration",
85
+ updatedDuration: false,
86
+ useTelescopeGeneratedType: true,
87
+ setDefaultEnumToUnrecognized: true,
88
+ autoFixUndefinedEnumDefault: false,
83
89
  },
84
90
  },
85
91
  bundle: {
86
- enabled: true
92
+ enabled: true,
93
+ type: "namespace",
87
94
  },
88
95
  stargateClients: {
89
- enabled: true,
96
+ enabled: false,
90
97
  includeCosmosDefaultTypes: true
91
98
  },
92
99
  aminoEncoding: {
93
100
  enabled: true,
101
+ useLegacyInlineEncoding: false,
94
102
  },
95
103
  lcdClients: {
96
- enabled: true
104
+ enabled: false
97
105
  },
98
106
  rpcClients: {
99
- enabled: true,
100
- camelCase: true
107
+ enabled: false,
101
108
  }
102
109
  };
103
110
  }
@@ -107,7 +114,7 @@ exports.default = async (argv) => {
107
114
  type: 'path',
108
115
  name: 'protoDirs',
109
116
  message: 'where is the proto directory?',
110
- default: './proto'
117
+ default: './protos'
111
118
  },
112
119
  {
113
120
  _: true,
@@ -3,11 +3,36 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.plugin = void 0;
4
4
  const ast_1 = require("@cosmology/ast");
5
5
  const utils_1 = require("@cosmology/utils");
6
+ /**
7
+ * Process noAlias configuration to create a map of names to their first package
8
+ * This ensures that only the first occurrence of a name skips aliasing
9
+ */
10
+ const processNoAliasConfig = (noAlias) => {
11
+ if (!noAlias || noAlias.length === 0) {
12
+ return new Map();
13
+ }
14
+ const nameToFirstPackage = new Map();
15
+ for (const entry of noAlias) {
16
+ if (!nameToFirstPackage.has(entry.name)) {
17
+ nameToFirstPackage.set(entry.name, entry.package);
18
+ }
19
+ }
20
+ return nameToFirstPackage;
21
+ };
22
+ /**
23
+ * Check if a package/name combination should skip aliasing
24
+ */
25
+ const shouldSkipAlias = (pkg, name, nameToFirstPackage) => {
26
+ const firstPackage = nameToFirstPackage.get(name);
27
+ return firstPackage === pkg;
28
+ };
6
29
  const plugin = (builder, bundler) => {
7
30
  if (!builder.options.bundle.enabled) {
8
31
  return;
9
32
  }
10
33
  let prog = [];
34
+ // Process noAlias configuration once at the beginning
35
+ const nameToFirstPackage = processNoAliasConfig(builder.options.bundle.noAlias);
11
36
  if (builder.options.bundle.type === "namespace") {
12
37
  const importPaths = (0, utils_1.duplicateImportPathsWithExt)(bundler.bundle.importPaths, builder.options.restoreImportExtension);
13
38
  // [x] bundle
@@ -44,17 +69,24 @@ const plugin = (builder, bundler) => {
44
69
  const duplicatedType = duplicatedTypeNames.find((type) => type === identifier);
45
70
  if (duplicatedType) {
46
71
  let alias;
47
- if (exportObj.isHelperFunc) {
48
- alias = (0, utils_1.makeAliasNameWithPackageAtEnd)({
49
- package: exportObj.pkg,
50
- name: identifier,
51
- });
72
+ // Check if this package/name combination should skip aliasing
73
+ if (shouldSkipAlias(exportObj.pkg, identifier, nameToFirstPackage)) {
74
+ alias = identifier; // Use original name, no alias
52
75
  }
53
76
  else {
54
- alias = (0, utils_1.makeAliasName)({
55
- package: exportObj.pkg,
56
- name: identifier,
57
- });
77
+ // Generate alias as usual
78
+ if (exportObj.isHelperFunc) {
79
+ alias = (0, utils_1.makeAliasNameWithPackageAtEnd)({
80
+ package: exportObj.pkg,
81
+ name: identifier,
82
+ });
83
+ }
84
+ else {
85
+ alias = (0, utils_1.makeAliasName)({
86
+ package: exportObj.pkg,
87
+ name: identifier,
88
+ });
89
+ }
58
90
  }
59
91
  return { name: identifier, alias: alias };
60
92
  }
@@ -13,7 +13,6 @@ const plugin = (builder) => {
13
13
  utils_1.UTILS.toBase64 = '@interchainjs/encoding';
14
14
  utils_1.UTILS.toUtf8 = '@interchainjs/encoding';
15
15
  utils_1.UTILS.Decimal = '@interchainjs/math';
16
- utils_1.UTILS.DeliverTxResponse = '@interchainjs/types';
17
16
  }
18
17
  if (builder.options.prototypes.typingsFormat.customTypes.useEnhancedDecimal ===
19
18
  true) {
@@ -4,12 +4,12 @@ exports.getHelperFuncTypesForInterface = void 0;
4
4
  const getHelperFuncTypesForInterface = (options) => {
5
5
  return `
6
6
  import { HttpEndpoint } from "@interchainjs/types";
7
- import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
8
- import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}";` : ''}
9
- import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
10
- import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}";` : ''}${!options.isGeneratingCosmosTypes ? `
11
- import { toConverters, toEncoders } from "@interchainjs/cosmos";
12
- import { ISigningClient } from "@interchainjs/cosmos";` : ''}
7
+ import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}";
8
+ import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}";
9
+ import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}";
10
+ import { TelescopeGeneratedCodec, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}";
11
+ import { toConverters, toEncoders } from "@interchainjs/cosmos/utils";
12
+ import { ISigningClient } from "@interchainjs/cosmos/types/signing-client${options.restoreImportExtension ?? ""}";
13
13
 
14
14
  export interface QueryBuilderOptions<TReq, TRes> {
15
15
  encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter
@@ -61,7 +61,7 @@ export function buildTx<TMsg>(opts: TxBuilderOptions) {
61
61
  message: TMsg | TMsg[],
62
62
  fee: StdFee | 'auto',
63
63
  memo: string
64
- ): Promise<DeliverTxResponse> => {
64
+ ): Promise<any> => {
65
65
  if (!client) throw new Error("SigningClient is not initialized");
66
66
 
67
67
  //register all related encoders and converters
@@ -4,12 +4,12 @@ exports.getHelperFuncTypes = void 0;
4
4
  const getHelperFuncTypes = (options) => {
5
5
  return `
6
6
  import { HttpEndpoint } from "@interchainjs/types";
7
- import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
8
- import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}";` : ''}
9
- import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
10
- import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}";` : ''}${!options.isGeneratingCosmosTypes ? `
11
- import { toConverters, toEncoders } from "@interchainjs/cosmos";
12
- import { ISigningClient } from "@interchainjs/cosmos";` : ''}
7
+ import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}";
8
+ import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}";
9
+ import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}";
10
+ import { TelescopeGeneratedCodec, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}";
11
+ import { toConverters, toEncoders } from "@interchainjs/cosmos/utils";
12
+ import { ISigningClient } from "@interchainjs/cosmos/types/signing-client${options.restoreImportExtension ?? ""}";
13
13
 
14
14
  export interface QueryBuilderOptions<TReq, TRes> {
15
15
  encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter
@@ -54,7 +54,7 @@ export function buildTx<TMsg>(opts: TxBuilderOptions) {
54
54
  message: TMsg | TMsg[],
55
55
  fee: StdFee | 'auto',
56
56
  memo: string
57
- ): Promise<DeliverTxResponse> => {
57
+ ): Promise<any> => {
58
58
  if (!client) throw new Error("SigningClient is not initialized");
59
59
 
60
60
  //register all related encoders and converters
@@ -15,7 +15,7 @@ import {
15
15
  import { ISigningClient, isISigningClient } from "@interchainjs/cosmos";
16
16
  import {
17
17
  StdFee,
18
- DeliverTxResponse,
18
+
19
19
  } from './types${options.restoreImportExtension ?? ""}'
20
20
  import {
21
21
  useQuery,
@@ -176,7 +176,7 @@ export interface UseMutationBuilderOptions<TMsg> {
176
176
  message: TMsg | TMsg[],
177
177
  fee: StdFee | 'auto',
178
178
  memo: string
179
- ) => Promise<DeliverTxResponse>,
179
+ ) => Promise<any>,
180
180
  }
181
181
 
182
182
  const getSigningClientFromCache = (
@@ -192,7 +192,7 @@ export function buildUseMutation<TMsg, TError>(opts: UseMutationBuilderOptions<T
192
192
  return ({
193
193
  options,
194
194
  clientResolver
195
- }: ReactMutationParams<DeliverTxResponse, TError, ITxArgs<TMsg>>) => {
195
+ }: ReactMutationParams<any, TError, ITxArgs<TMsg>>) => {
196
196
  const queryClient = useQueryClient({
197
197
  context: options?.context
198
198
  });
@@ -212,9 +212,9 @@ export function buildUseMutation<TMsg, TError>(opts: UseMutationBuilderOptions<T
212
212
  signingClientResolver = cachedClient || (!isCacheResolver(clientResolver) ? clientResolver : undefined);
213
213
  }
214
214
 
215
- return useMutation<DeliverTxResponse, Error, ITxArgs<TMsg>>(
215
+ return useMutation<any, Error, ITxArgs<TMsg>>(
216
216
  (reqData: ITxArgs<TMsg>) => opts.builderMutationFn(signingClientResolver!, reqData.signerAddress, reqData.message, reqData.fee, reqData.memo),
217
- options as Omit<UseMutationOptions<DeliverTxResponse, Error, ITxArgs<TMsg>, unknown>, "mutationFn">
217
+ options as Omit<UseMutationOptions<any, Error, ITxArgs<TMsg>, unknown>, "mutationFn">
218
218
  );
219
219
  };
220
220
  }
@@ -12,7 +12,7 @@ import {
12
12
  } from './helpers${options.restoreImportExtension ?? ""}'
13
13
  import {
14
14
  StdFee,
15
- DeliverTxResponse,
15
+
16
16
  } from './types${options.restoreImportExtension ?? ""}'
17
17
  import {
18
18
  ITxArgs,
@@ -209,7 +209,7 @@ export interface UseMutationBuilderOptions<TMsg> {
209
209
  message: TMsg | TMsg[],
210
210
  fee: StdFee | 'auto',
211
211
  memo: string
212
- ) => Promise<DeliverTxResponse>,
212
+ ) => Promise<any>,
213
213
  }
214
214
 
215
215
  const getSigningClientFromCache = (
@@ -225,7 +225,7 @@ export function buildUseMutation<TMsg, TError>(opts: UseMutationBuilderOptions<T
225
225
  return ({
226
226
  options,
227
227
  clientResolver
228
- }: ReactMutationParams<DeliverTxResponse, TError, ITxArgs<TMsg>>) => {
228
+ }: ReactMutationParams<any, TError, ITxArgs<TMsg>>) => {
229
229
  const queryClient = useQueryClient({
230
230
  context: options?.context
231
231
  });
@@ -247,9 +247,9 @@ export function buildUseMutation<TMsg, TError>(opts: UseMutationBuilderOptions<T
247
247
 
248
248
  const mutationFn = opts.builderMutationFn(signingClientResolver);
249
249
 
250
- return useMutation<DeliverTxResponse, Error, ITxArgs<TMsg>>(
250
+ return useMutation<any, Error, ITxArgs<TMsg>>(
251
251
  (reqData: ITxArgs<TMsg>) => mutationFn(reqData.signerAddress, reqData.message, reqData.fee, reqData.memo),
252
- options as Omit<UseMutationOptions<DeliverTxResponse, Error, ITxArgs<TMsg>, unknown>, "mutationFn">
252
+ options as Omit<UseMutationOptions<any, Error, ITxArgs<TMsg>, unknown>, "mutationFn">
253
253
  );
254
254
  };
255
255
  }
@@ -8,9 +8,9 @@ ${options.useInterchainJs ? '' : `import { OfflineSigner } from "@cosmjs/proto-s
8
8
  import { HttpEndpoint } from "${options.useInterchainJs ? "@interchainjs/types" : "@cosmjs/tendermint-rpc"}";
9
9
  ${options.useInterchainJs ? `
10
10
 
11
- import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types";
11
+ import { Event, Attribute } from "@interchainjs/types";
12
+
12
13
 
13
- export { DeliverTxResponse }
14
14
 
15
15
  ` : ''}
16
16
  export type ProtoMsg = Omit<Any, "typeUrl"> & { typeUrl: any };
@@ -105,41 +105,7 @@ export interface Event {
105
105
  attributes: readonly Attribute[];
106
106
  }
107
107
 
108
- /**
109
- * The response after successfully broadcasting a transaction.
110
- * Success or failure refer to the execution result.
111
- */
112
- export interface DeliverTxResponse {
113
- height: number;
114
- /** The position of the transaction within the block. This is a 0-based index. */
115
- txIndex: number;
116
- /** Error code. The transaction suceeded if and only if code is 0. */
117
- code: number;
118
- transactionHash: string;
119
- events: readonly Event[];
120
- /**
121
- * A string-based log document.
122
- *
123
- * This currently seems to merge attributes of multiple events into one event per type
124
- * (https://github.com/tendermint/tendermint/issues/9595). You might want to use the \`events\`
125
- * field instead.
126
- */
127
- rawLog?: string;
128
- /** @deprecated Use \`msgResponses\` instead. */
129
- data?: readonly MsgData[];
130
- /**
131
- * The message responses of the [TxMsgData](https://github.com/cosmos/cosmos-sdk/blob/v0.46.3/proto/cosmos/base/abci/v1beta1/abci.proto#L128-L140)
132
- * as \`Any\`s.
133
- * This field is an empty list for chains running Cosmos SDK < 0.46.
134
- */
135
- msgResponses: Array<{
136
- typeUrl: string;
137
- value: Uint8Array;
138
- }>;
139
- gasUsed: bigint;
140
- gasWanted: bigint;
141
- origin?: any;
142
- }
108
+
143
109
  `}
144
110
  export interface TxRpc {
145
111
  request(
@@ -152,7 +118,7 @@ export interface TxRpc {
152
118
  messages: EncodeObject[],
153
119
  fee: StdFee | "auto" | number,
154
120
  memo: string
155
- ): Promise<DeliverTxResponse>;
121
+ ): Promise<any>;
156
122
  }
157
123
  ${options.useInterchainJs ? '' : `
158
124
  export interface SigningClientParams {
@@ -17,7 +17,7 @@ import {
17
17
  import { ISigningClient, isISigningClient } from "@interchainjs/cosmos/types/signing-client${options.restoreImportExtension ?? ""}";
18
18
  import {
19
19
  StdFee,
20
- DeliverTxResponse,
20
+
21
21
  } from './types${options.restoreImportExtension ?? ""}'
22
22
  import {
23
23
  useQuery,
@@ -177,7 +177,7 @@ export interface UseMutationBuilderOptions<TMsg> {
177
177
  message: TMsg | TMsg[],
178
178
  fee: StdFee | 'auto',
179
179
  memo: string
180
- ) => Promise<DeliverTxResponse>;
180
+ ) => Promise<any>;
181
181
  }
182
182
 
183
183
  export function buildUseVueMutation<TMsg, TError>(
@@ -186,7 +186,7 @@ export function buildUseVueMutation<TMsg, TError>(
186
186
  return function useBuiltMutation({
187
187
  options,
188
188
  clientResolver,
189
- }: VueMutationParams<DeliverTxResponse, TError, ITxArgs<TMsg>>) {
189
+ }: VueMutationParams<any, TError, ITxArgs<TMsg>>) {
190
190
  const queryClient = useQueryClient();
191
191
 
192
192
  let signingClientResolver: ISigningClient | undefined;
@@ -206,7 +206,7 @@ export function buildUseVueMutation<TMsg, TError>(
206
206
  clientResolver = clientResolver;
207
207
  }
208
208
 
209
- return useMutation<DeliverTxResponse, TError, ITxArgs<TMsg>>(
209
+ return useMutation<any, TError, ITxArgs<TMsg>>(
210
210
  {
211
211
  mutationFn: (reqData: ITxArgs<TMsg>) =>
212
212
  opts.builderMutationFn(
@@ -69,6 +69,13 @@ async function clone({ owner, repo, branch, gitModulesDir: outDir, protoDirMappi
69
69
  return clonedResult;
70
70
  }
71
71
  exports.clone = clone;
72
+ function sanitizeProtoContent(content) {
73
+ // Remove any standalone semicolon lines that could be introduced upstream
74
+ // e.g., a line that only contains ';' or whitespace + ';'
75
+ const lines = content.split(/\r?\n/);
76
+ const sanitized = lines.filter((line) => !/^\s*;\s*$/.test(line));
77
+ return sanitized.join("\n");
78
+ }
72
79
  function extractProto({ sources, targets, outDir }) {
73
80
  const extractProtoFiles = extractProtoFromDirs({
74
81
  targets,
@@ -78,7 +85,9 @@ function extractProto({ sources, targets, outDir }) {
78
85
  const targetFile = (0, path_1.join)(outDir, target);
79
86
  const deepTargetDir = (0, path_1.dirname)(targetFile);
80
87
  (0, utils_1.makeDir)(deepTargetDir);
81
- fs_1.default.copyFileSync(sourceFile, targetFile);
88
+ const raw = fs_1.default.readFileSync(sourceFile, "utf8");
89
+ const sanitized = sanitizeProtoContent(raw);
90
+ fs_1.default.writeFileSync(targetFile, sanitized, "utf8");
82
91
  console.info(`Copied ${target} from ${sourceFile.replace(target, "")}`);
83
92
  });
84
93
  }
@@ -76,7 +76,6 @@ exports.UTILS = {
76
76
  TxRpc: '__types__',
77
77
  BroadcastTxReq: '__types__',
78
78
  BroadcastTxRes: '__types__',
79
- DeliverTxResponse: '__types__',
80
79
  EncodeObject: '__types__',
81
80
  SigningClientParams: '__types__',
82
81
  grpc: '@improbable-eng/grpc-web',
@@ -20,10 +20,11 @@ export default async (argv) => {
20
20
  else {
21
21
  options = {
22
22
  // global options (can be overridden through plugins)
23
+ useInterchainJs: true,
23
24
  interfaces: {
24
- enabled: false,
25
- useByDefault: false,
26
- useUnionTypes: false,
25
+ enabled: true,
26
+ useByDefault: true,
27
+ useUnionTypes: true,
27
28
  },
28
29
  prototypes: {
29
30
  enabled: true,
@@ -44,32 +45,38 @@ export default async (argv) => {
44
45
  addTypeUrlToObjects: true,
45
46
  addTypeUrlToDecoders: true,
46
47
  typingsFormat: {
47
- duration: 'duration',
48
- timestamp: 'date',
49
- useExact: false,
50
- useDeepPartial: false,
51
- num64: 'bigint',
52
48
  customTypes: {
53
- useCosmosSDKDec: true
54
- }
49
+ useCosmosSDKDec: true,
50
+ },
51
+ num64: "bigint",
52
+ useDeepPartial: false,
53
+ useExact: false,
54
+ toJsonUnknown: false,
55
+ timestamp: "date",
56
+ duration: "duration",
57
+ updatedDuration: false,
58
+ useTelescopeGeneratedType: true,
59
+ setDefaultEnumToUnrecognized: true,
60
+ autoFixUndefinedEnumDefault: false,
55
61
  },
56
62
  },
57
63
  bundle: {
58
- enabled: true
64
+ enabled: true,
65
+ type: "namespace",
59
66
  },
60
67
  stargateClients: {
61
- enabled: true,
68
+ enabled: false,
62
69
  includeCosmosDefaultTypes: true
63
70
  },
64
71
  aminoEncoding: {
65
72
  enabled: true,
73
+ useLegacyInlineEncoding: false,
66
74
  },
67
75
  lcdClients: {
68
- enabled: true
76
+ enabled: false
69
77
  },
70
78
  rpcClients: {
71
- enabled: true,
72
- camelCase: true
79
+ enabled: false,
73
80
  }
74
81
  };
75
82
  }
@@ -79,7 +86,7 @@ export default async (argv) => {
79
86
  type: 'path',
80
87
  name: 'protoDirs',
81
88
  message: 'where is the proto directory?',
82
- default: './proto'
89
+ default: './protos'
83
90
  },
84
91
  {
85
92
  _: true,