@hyperweb/telescope 1.17.4 → 2.0.1
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.
- package/README.md +30 -15
- package/main/commands/transpile.js +23 -16
- package/main/generators/customize-utils.js +0 -1
- package/main/helpers/react-query-hooks-icjs.js +5 -5
- package/main/helpers/react-query-hooks.js +5 -5
- package/main/helpers/types-helper.js +1 -1
- package/main/helpers/vue-query-hooks.js +4 -4
- package/main/protod/recursive.js +10 -1
- package/main/utils/index.js +0 -1
- package/module/commands/transpile.js +23 -16
- package/module/generators/customize-utils.js +0 -1
- package/module/helpers/react-query-hooks-icjs.js +5 -5
- package/module/helpers/react-query-hooks.js +5 -5
- package/module/helpers/types-helper.js +1 -1
- package/module/helpers/vue-query-hooks.js +4 -4
- package/module/protod/recursive.js +10 -1
- package/module/utils/index.js +0 -1
- package/package.json +6 -6
- package/src/commands/transpile.ts +23 -16
- package/src/generators/customize-utils.ts +0 -2
- package/src/helpers/react-query-hooks-icjs.ts +5 -5
- package/src/helpers/react-query-hooks.ts +5 -5
- package/src/helpers/types-helper.ts +1 -1
- package/src/helpers/vue-query-hooks.ts +4 -4
- package/src/protod/recursive.ts +11 -1
- 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. | `
|
|
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) | `
|
|
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 | `
|
|
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 | `
|
|
577
|
-
| `prototypes.methods.toJSON` | Enable `toJSON` method on proto objects | `
|
|
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 | `
|
|
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 | `
|
|
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` | `
|
|
641
|
-
| `helperFunctions.useGlobalDecoderRegistry` | Use global decoder registry in helper functions | `
|
|
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.
|
|
660
|
-
| `stargateClients.
|
|
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 | `
|
|
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` | `
|
|
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` |
|
|
@@ -765,6 +774,13 @@ See [MCP Integration](https://docs.hyperweb.io/telescope/developing/mcp-integrat
|
|
|
765
774
|
|
|
766
775
|
| option | description | defaults |
|
|
767
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` |
|
|
768
784
|
| `env` | 'default' or 'v-next', set to 'v-next' to enable yet-to-be-released features | `default` |
|
|
769
785
|
| `removeUnusedImports` | Remove unused imports | `true` |
|
|
770
786
|
| `classesUseArrowFunctions` | Classes use arrow functions instead of `bind()`ing in constructors | `false` |
|
|
@@ -1586,4 +1602,3 @@ Thanks to these engineers, teams and projects for inspiring Telescope:
|
|
|
1586
1602
|
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
|
|
1587
1603
|
|
|
1588
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.
|
|
1589
|
-
|
|
@@ -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:
|
|
53
|
-
useByDefault:
|
|
54
|
-
useUnionTypes:
|
|
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:
|
|
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:
|
|
104
|
+
enabled: false
|
|
97
105
|
},
|
|
98
106
|
rpcClients: {
|
|
99
|
-
enabled:
|
|
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: './
|
|
117
|
+
default: './protos'
|
|
111
118
|
},
|
|
112
119
|
{
|
|
113
120
|
_: true,
|
|
@@ -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) {
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import { ISigningClient, isISigningClient } from "@interchainjs/cosmos";
|
|
16
16
|
import {
|
|
17
17
|
StdFee,
|
|
18
|
-
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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
|
-
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
252
|
+
options as Omit<UseMutationOptions<any, Error, ITxArgs<TMsg>, unknown>, "mutationFn">
|
|
253
253
|
);
|
|
254
254
|
};
|
|
255
255
|
}
|
|
@@ -10,7 +10,7 @@ ${options.useInterchainJs ? `
|
|
|
10
10
|
|
|
11
11
|
import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types";
|
|
12
12
|
|
|
13
|
-
export { DeliverTxResponse }
|
|
13
|
+
export type { DeliverTxResponse }
|
|
14
14
|
|
|
15
15
|
` : ''}
|
|
16
16
|
export type ProtoMsg = Omit<Any, "typeUrl"> & { typeUrl: any };
|
|
@@ -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
|
-
|
|
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<
|
|
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<
|
|
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<
|
|
209
|
+
return useMutation<any, TError, ITxArgs<TMsg>>(
|
|
210
210
|
{
|
|
211
211
|
mutationFn: (reqData: ITxArgs<TMsg>) =>
|
|
212
212
|
opts.builderMutationFn(
|
package/main/protod/recursive.js
CHANGED
|
@@ -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.
|
|
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
|
}
|
package/main/utils/index.js
CHANGED
|
@@ -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:
|
|
25
|
-
useByDefault:
|
|
26
|
-
useUnionTypes:
|
|
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:
|
|
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:
|
|
76
|
+
enabled: false
|
|
69
77
|
},
|
|
70
78
|
rpcClients: {
|
|
71
|
-
enabled:
|
|
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: './
|
|
89
|
+
default: './protos'
|
|
83
90
|
},
|
|
84
91
|
{
|
|
85
92
|
_: true,
|
|
@@ -10,7 +10,6 @@ export const plugin = (builder) => {
|
|
|
10
10
|
UTILS.toBase64 = '@interchainjs/encoding';
|
|
11
11
|
UTILS.toUtf8 = '@interchainjs/encoding';
|
|
12
12
|
UTILS.Decimal = '@interchainjs/math';
|
|
13
|
-
UTILS.DeliverTxResponse = '@interchainjs/types';
|
|
14
13
|
}
|
|
15
14
|
if (builder.options.prototypes.typingsFormat.customTypes.useEnhancedDecimal ===
|
|
16
15
|
true) {
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import { ISigningClient, isISigningClient } from "@interchainjs/cosmos";
|
|
13
13
|
import {
|
|
14
14
|
StdFee,
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
} from './types${options.restoreImportExtension ?? ""}'
|
|
17
17
|
import {
|
|
18
18
|
useQuery,
|
|
@@ -173,7 +173,7 @@ export interface UseMutationBuilderOptions<TMsg> {
|
|
|
173
173
|
message: TMsg | TMsg[],
|
|
174
174
|
fee: StdFee | 'auto',
|
|
175
175
|
memo: string
|
|
176
|
-
) => Promise<
|
|
176
|
+
) => Promise<any>,
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
const getSigningClientFromCache = (
|
|
@@ -189,7 +189,7 @@ export function buildUseMutation<TMsg, TError>(opts: UseMutationBuilderOptions<T
|
|
|
189
189
|
return ({
|
|
190
190
|
options,
|
|
191
191
|
clientResolver
|
|
192
|
-
}: ReactMutationParams<
|
|
192
|
+
}: ReactMutationParams<any, TError, ITxArgs<TMsg>>) => {
|
|
193
193
|
const queryClient = useQueryClient({
|
|
194
194
|
context: options?.context
|
|
195
195
|
});
|
|
@@ -209,9 +209,9 @@ export function buildUseMutation<TMsg, TError>(opts: UseMutationBuilderOptions<T
|
|
|
209
209
|
signingClientResolver = cachedClient || (!isCacheResolver(clientResolver) ? clientResolver : undefined);
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
return useMutation<
|
|
212
|
+
return useMutation<any, Error, ITxArgs<TMsg>>(
|
|
213
213
|
(reqData: ITxArgs<TMsg>) => opts.builderMutationFn(signingClientResolver!, reqData.signerAddress, reqData.message, reqData.fee, reqData.memo),
|
|
214
|
-
options as Omit<UseMutationOptions<
|
|
214
|
+
options as Omit<UseMutationOptions<any, Error, ITxArgs<TMsg>, unknown>, "mutationFn">
|
|
215
215
|
);
|
|
216
216
|
};
|
|
217
217
|
}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from './helpers${options.restoreImportExtension ?? ""}'
|
|
10
10
|
import {
|
|
11
11
|
StdFee,
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
} from './types${options.restoreImportExtension ?? ""}'
|
|
14
14
|
import {
|
|
15
15
|
ITxArgs,
|
|
@@ -206,7 +206,7 @@ export interface UseMutationBuilderOptions<TMsg> {
|
|
|
206
206
|
message: TMsg | TMsg[],
|
|
207
207
|
fee: StdFee | 'auto',
|
|
208
208
|
memo: string
|
|
209
|
-
) => Promise<
|
|
209
|
+
) => Promise<any>,
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
const getSigningClientFromCache = (
|
|
@@ -222,7 +222,7 @@ export function buildUseMutation<TMsg, TError>(opts: UseMutationBuilderOptions<T
|
|
|
222
222
|
return ({
|
|
223
223
|
options,
|
|
224
224
|
clientResolver
|
|
225
|
-
}: ReactMutationParams<
|
|
225
|
+
}: ReactMutationParams<any, TError, ITxArgs<TMsg>>) => {
|
|
226
226
|
const queryClient = useQueryClient({
|
|
227
227
|
context: options?.context
|
|
228
228
|
});
|
|
@@ -244,9 +244,9 @@ export function buildUseMutation<TMsg, TError>(opts: UseMutationBuilderOptions<T
|
|
|
244
244
|
|
|
245
245
|
const mutationFn = opts.builderMutationFn(signingClientResolver);
|
|
246
246
|
|
|
247
|
-
return useMutation<
|
|
247
|
+
return useMutation<any, Error, ITxArgs<TMsg>>(
|
|
248
248
|
(reqData: ITxArgs<TMsg>) => mutationFn(reqData.signerAddress, reqData.message, reqData.fee, reqData.memo),
|
|
249
|
-
options as Omit<UseMutationOptions<
|
|
249
|
+
options as Omit<UseMutationOptions<any, Error, ITxArgs<TMsg>, unknown>, "mutationFn">
|
|
250
250
|
);
|
|
251
251
|
};
|
|
252
252
|
}
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import { ISigningClient, isISigningClient } from "@interchainjs/cosmos/types/signing-client${options.restoreImportExtension ?? ""}";
|
|
15
15
|
import {
|
|
16
16
|
StdFee,
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
} from './types${options.restoreImportExtension ?? ""}'
|
|
19
19
|
import {
|
|
20
20
|
useQuery,
|
|
@@ -174,7 +174,7 @@ export interface UseMutationBuilderOptions<TMsg> {
|
|
|
174
174
|
message: TMsg | TMsg[],
|
|
175
175
|
fee: StdFee | 'auto',
|
|
176
176
|
memo: string
|
|
177
|
-
) => Promise<
|
|
177
|
+
) => Promise<any>;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
export function buildUseVueMutation<TMsg, TError>(
|
|
@@ -183,7 +183,7 @@ export function buildUseVueMutation<TMsg, TError>(
|
|
|
183
183
|
return function useBuiltMutation({
|
|
184
184
|
options,
|
|
185
185
|
clientResolver,
|
|
186
|
-
}: VueMutationParams<
|
|
186
|
+
}: VueMutationParams<any, TError, ITxArgs<TMsg>>) {
|
|
187
187
|
const queryClient = useQueryClient();
|
|
188
188
|
|
|
189
189
|
let signingClientResolver: ISigningClient | undefined;
|
|
@@ -203,7 +203,7 @@ export function buildUseVueMutation<TMsg, TError>(
|
|
|
203
203
|
clientResolver = clientResolver;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
return useMutation<
|
|
206
|
+
return useMutation<any, TError, ITxArgs<TMsg>>(
|
|
207
207
|
{
|
|
208
208
|
mutationFn: (reqData: ITxArgs<TMsg>) =>
|
|
209
209
|
opts.builderMutationFn(
|
|
@@ -61,6 +61,13 @@ export async function clone({ owner, repo, branch, gitModulesDir: outDir, protoD
|
|
|
61
61
|
}));
|
|
62
62
|
return clonedResult;
|
|
63
63
|
}
|
|
64
|
+
function sanitizeProtoContent(content) {
|
|
65
|
+
// Remove any standalone semicolon lines that could be introduced upstream
|
|
66
|
+
// e.g., a line that only contains ';' or whitespace + ';'
|
|
67
|
+
const lines = content.split(/\r?\n/);
|
|
68
|
+
const sanitized = lines.filter((line) => !/^\s*;\s*$/.test(line));
|
|
69
|
+
return sanitized.join("\n");
|
|
70
|
+
}
|
|
64
71
|
export function extractProto({ sources, targets, outDir }) {
|
|
65
72
|
const extractProtoFiles = extractProtoFromDirs({
|
|
66
73
|
targets,
|
|
@@ -70,7 +77,9 @@ export function extractProto({ sources, targets, outDir }) {
|
|
|
70
77
|
const targetFile = join(outDir, target);
|
|
71
78
|
const deepTargetDir = dirname(targetFile);
|
|
72
79
|
makeDir(deepTargetDir);
|
|
73
|
-
fs.
|
|
80
|
+
const raw = fs.readFileSync(sourceFile, "utf8");
|
|
81
|
+
const sanitized = sanitizeProtoContent(raw);
|
|
82
|
+
fs.writeFileSync(targetFile, sanitized, "utf8");
|
|
74
83
|
console.info(`Copied ${target} from ${sourceFile.replace(target, "")}`);
|
|
75
84
|
});
|
|
76
85
|
}
|
package/module/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperweb/telescope",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "A TypeScript Transpiler for Cosmos Protobufs",
|
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/hyperweb-io/telescope/tree/master/packages/telescope#readme",
|
|
@@ -90,10 +90,10 @@
|
|
|
90
90
|
"@babel/parser": "^7.23.6",
|
|
91
91
|
"@babel/traverse": "7.23.6",
|
|
92
92
|
"@babel/types": "7.23.6",
|
|
93
|
-
"@cosmology/ast": "^
|
|
94
|
-
"@cosmology/proto-parser": "^
|
|
95
|
-
"@cosmology/types": "^
|
|
96
|
-
"@cosmology/utils": "^
|
|
93
|
+
"@cosmology/ast": "^2.0.0",
|
|
94
|
+
"@cosmology/proto-parser": "^2.0.0",
|
|
95
|
+
"@cosmology/types": "^2.0.0",
|
|
96
|
+
"@cosmology/utils": "^2.0.0",
|
|
97
97
|
"@cosmwasm/ts-codegen": "0.35.7",
|
|
98
98
|
"@types/parse-package-name": "0.1.0",
|
|
99
99
|
"case": "1.6.3",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"rimraf": "5.0.0",
|
|
112
112
|
"yaml": "^2.3.4"
|
|
113
113
|
},
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "1804eecac10a575169679de3ca4a52c0191fc292"
|
|
115
115
|
}
|
|
@@ -27,10 +27,11 @@ export default async (argv: {
|
|
|
27
27
|
} else {
|
|
28
28
|
options = {
|
|
29
29
|
// global options (can be overridden through plugins)
|
|
30
|
+
useInterchainJs: true,
|
|
30
31
|
interfaces: {
|
|
31
|
-
enabled:
|
|
32
|
-
useByDefault:
|
|
33
|
-
useUnionTypes:
|
|
32
|
+
enabled: true,
|
|
33
|
+
useByDefault: true,
|
|
34
|
+
useUnionTypes: true,
|
|
34
35
|
},
|
|
35
36
|
|
|
36
37
|
prototypes: {
|
|
@@ -53,37 +54,43 @@ export default async (argv: {
|
|
|
53
54
|
addTypeUrlToDecoders: true,
|
|
54
55
|
|
|
55
56
|
typingsFormat: {
|
|
56
|
-
duration: 'duration',
|
|
57
|
-
timestamp: 'date',
|
|
58
|
-
useExact: false,
|
|
59
|
-
useDeepPartial: false,
|
|
60
|
-
num64: 'bigint',
|
|
61
57
|
customTypes: {
|
|
62
|
-
useCosmosSDKDec: true
|
|
63
|
-
}
|
|
58
|
+
useCosmosSDKDec: true,
|
|
59
|
+
},
|
|
60
|
+
num64: "bigint",
|
|
61
|
+
useDeepPartial: false,
|
|
62
|
+
useExact: false,
|
|
63
|
+
toJsonUnknown: false,
|
|
64
|
+
timestamp: "date",
|
|
65
|
+
duration: "duration",
|
|
66
|
+
updatedDuration: false,
|
|
67
|
+
useTelescopeGeneratedType: true,
|
|
68
|
+
setDefaultEnumToUnrecognized: true,
|
|
69
|
+
autoFixUndefinedEnumDefault: false,
|
|
64
70
|
},
|
|
65
71
|
},
|
|
66
72
|
|
|
67
73
|
bundle: {
|
|
68
|
-
enabled: true
|
|
74
|
+
enabled: true,
|
|
75
|
+
type: "namespace",
|
|
69
76
|
},
|
|
70
77
|
|
|
71
78
|
stargateClients: {
|
|
72
|
-
enabled:
|
|
79
|
+
enabled: false,
|
|
73
80
|
includeCosmosDefaultTypes: true
|
|
74
81
|
},
|
|
75
82
|
|
|
76
83
|
aminoEncoding: {
|
|
77
84
|
enabled: true,
|
|
85
|
+
useLegacyInlineEncoding: false,
|
|
78
86
|
},
|
|
79
87
|
|
|
80
88
|
lcdClients: {
|
|
81
|
-
enabled:
|
|
89
|
+
enabled: false
|
|
82
90
|
},
|
|
83
91
|
|
|
84
92
|
rpcClients: {
|
|
85
|
-
enabled:
|
|
86
|
-
camelCase: true
|
|
93
|
+
enabled: false,
|
|
87
94
|
}
|
|
88
95
|
}
|
|
89
96
|
|
|
@@ -95,7 +102,7 @@ export default async (argv: {
|
|
|
95
102
|
type: 'path',
|
|
96
103
|
name: 'protoDirs',
|
|
97
104
|
message: 'where is the proto directory?',
|
|
98
|
-
default: './
|
|
105
|
+
default: './protos'
|
|
99
106
|
},
|
|
100
107
|
{
|
|
101
108
|
_: true,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import { ISigningClient, isISigningClient } from "@interchainjs/cosmos";
|
|
15
15
|
import {
|
|
16
16
|
StdFee,
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
} from './types${options.restoreImportExtension ?? ""}'
|
|
19
19
|
import {
|
|
20
20
|
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<
|
|
180
|
+
) => Promise<any>,
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
const getSigningClientFromCache = (
|
|
@@ -193,7 +193,7 @@ export function buildUseMutation<TMsg, TError>(opts: UseMutationBuilderOptions<T
|
|
|
193
193
|
return ({
|
|
194
194
|
options,
|
|
195
195
|
clientResolver
|
|
196
|
-
}: ReactMutationParams<
|
|
196
|
+
}: ReactMutationParams<any, TError, ITxArgs<TMsg>>) => {
|
|
197
197
|
const queryClient = useQueryClient({
|
|
198
198
|
context: options?.context
|
|
199
199
|
});
|
|
@@ -213,9 +213,9 @@ export function buildUseMutation<TMsg, TError>(opts: UseMutationBuilderOptions<T
|
|
|
213
213
|
signingClientResolver = cachedClient || (!isCacheResolver(clientResolver) ? clientResolver : undefined);
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
return useMutation<
|
|
216
|
+
return useMutation<any, Error, ITxArgs<TMsg>>(
|
|
217
217
|
(reqData: ITxArgs<TMsg>) => opts.builderMutationFn(signingClientResolver!, reqData.signerAddress, reqData.message, reqData.fee, reqData.memo),
|
|
218
|
-
options as Omit<UseMutationOptions<
|
|
218
|
+
options as Omit<UseMutationOptions<any, Error, ITxArgs<TMsg>, unknown>, "mutationFn">
|
|
219
219
|
);
|
|
220
220
|
};
|
|
221
221
|
}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from './helpers${options.restoreImportExtension ?? ""}'
|
|
12
12
|
import {
|
|
13
13
|
StdFee,
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
} from './types${options.restoreImportExtension ?? ""}'
|
|
16
16
|
import {
|
|
17
17
|
ITxArgs,
|
|
@@ -218,7 +218,7 @@ export interface UseMutationBuilderOptions<TMsg> {
|
|
|
218
218
|
message: TMsg | TMsg[],
|
|
219
219
|
fee: StdFee | 'auto',
|
|
220
220
|
memo: string
|
|
221
|
-
) => Promise<
|
|
221
|
+
) => Promise<any>,
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
const getSigningClientFromCache = (
|
|
@@ -234,7 +234,7 @@ export function buildUseMutation<TMsg, TError>(opts: UseMutationBuilderOptions<T
|
|
|
234
234
|
return ({
|
|
235
235
|
options,
|
|
236
236
|
clientResolver
|
|
237
|
-
}: ReactMutationParams<
|
|
237
|
+
}: ReactMutationParams<any, TError, ITxArgs<TMsg>>) => {
|
|
238
238
|
const queryClient = useQueryClient({
|
|
239
239
|
context: options?.context
|
|
240
240
|
});
|
|
@@ -256,9 +256,9 @@ export function buildUseMutation<TMsg, TError>(opts: UseMutationBuilderOptions<T
|
|
|
256
256
|
|
|
257
257
|
const mutationFn = opts.builderMutationFn(signingClientResolver);
|
|
258
258
|
|
|
259
|
-
return useMutation<
|
|
259
|
+
return useMutation<any, Error, ITxArgs<TMsg>>(
|
|
260
260
|
(reqData: ITxArgs<TMsg>) => mutationFn(reqData.signerAddress, reqData.message, reqData.fee, reqData.memo),
|
|
261
|
-
options as Omit<UseMutationOptions<
|
|
261
|
+
options as Omit<UseMutationOptions<any, Error, ITxArgs<TMsg>, unknown>, "mutationFn">
|
|
262
262
|
);
|
|
263
263
|
};
|
|
264
264
|
}
|
|
@@ -15,7 +15,7 @@ ${options.useInterchainJs ? `
|
|
|
15
15
|
|
|
16
16
|
import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types";
|
|
17
17
|
|
|
18
|
-
export { DeliverTxResponse }
|
|
18
|
+
export type { DeliverTxResponse }
|
|
19
19
|
|
|
20
20
|
` : ''}
|
|
21
21
|
export type ProtoMsg = Omit<Any, "typeUrl"> & { typeUrl: any };
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import { ISigningClient, isISigningClient } from "@interchainjs/cosmos/types/signing-client${options.restoreImportExtension ?? ""}";
|
|
17
17
|
import {
|
|
18
18
|
StdFee,
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
} from './types${options.restoreImportExtension ?? ""}'
|
|
21
21
|
import {
|
|
22
22
|
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<
|
|
179
|
+
) => Promise<any>;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
export function buildUseVueMutation<TMsg, TError>(
|
|
@@ -185,7 +185,7 @@ export function buildUseVueMutation<TMsg, TError>(
|
|
|
185
185
|
return function useBuiltMutation({
|
|
186
186
|
options,
|
|
187
187
|
clientResolver,
|
|
188
|
-
}: VueMutationParams<
|
|
188
|
+
}: VueMutationParams<any, TError, ITxArgs<TMsg>>) {
|
|
189
189
|
const queryClient = useQueryClient();
|
|
190
190
|
|
|
191
191
|
let signingClientResolver: ISigningClient | undefined;
|
|
@@ -205,7 +205,7 @@ export function buildUseVueMutation<TMsg, TError>(
|
|
|
205
205
|
clientResolver = clientResolver;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
return useMutation<
|
|
208
|
+
return useMutation<any, TError, ITxArgs<TMsg>>(
|
|
209
209
|
{
|
|
210
210
|
mutationFn: (reqData: ITxArgs<TMsg>) =>
|
|
211
211
|
opts.builderMutationFn(
|
package/src/protod/recursive.ts
CHANGED
|
@@ -95,6 +95,14 @@ export async function clone({
|
|
|
95
95
|
return clonedResult;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
function sanitizeProtoContent(content: string): string {
|
|
99
|
+
// Remove any standalone semicolon lines that could be introduced upstream
|
|
100
|
+
// e.g., a line that only contains ';' or whitespace + ';'
|
|
101
|
+
const lines = content.split(/\r?\n/);
|
|
102
|
+
const sanitized = lines.filter((line) => !/^\s*;\s*$/.test(line));
|
|
103
|
+
return sanitized.join("\n");
|
|
104
|
+
}
|
|
105
|
+
|
|
98
106
|
export function extractProto({ sources, targets, outDir }: ProtoCopyOptions) {
|
|
99
107
|
const extractProtoFiles: { sourceFile: string; target: string }[] =
|
|
100
108
|
extractProtoFromDirs({
|
|
@@ -106,7 +114,9 @@ export function extractProto({ sources, targets, outDir }: ProtoCopyOptions) {
|
|
|
106
114
|
const targetFile = join(outDir, target);
|
|
107
115
|
const deepTargetDir = dirname(targetFile);
|
|
108
116
|
makeDir(deepTargetDir);
|
|
109
|
-
fs.
|
|
117
|
+
const raw = fs.readFileSync(sourceFile, "utf8");
|
|
118
|
+
const sanitized = sanitizeProtoContent(raw);
|
|
119
|
+
fs.writeFileSync(targetFile, sanitized, "utf8");
|
|
110
120
|
console.info(`Copied ${target} from ${sourceFile.replace(target, "")}`);
|
|
111
121
|
});
|
|
112
122
|
}
|
package/src/utils/index.ts
CHANGED
|
@@ -61,7 +61,6 @@ export const UTILS: { [key: string]: UtilValue } = {
|
|
|
61
61
|
TxRpc: '__types__',
|
|
62
62
|
BroadcastTxReq: '__types__',
|
|
63
63
|
BroadcastTxRes: '__types__',
|
|
64
|
-
DeliverTxResponse: '__types__',
|
|
65
64
|
EncodeObject: '__types__',
|
|
66
65
|
SigningClientParams: '__types__',
|
|
67
66
|
grpc: '@improbable-eng/grpc-web',
|