@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.
- package/README.md +30 -16
- package/main/commands/transpile.js +23 -16
- package/main/generators/create-bundle.js +41 -9
- package/main/generators/customize-utils.js +0 -1
- package/main/helpers/helper-func-types-interface.js +7 -7
- package/main/helpers/helper-func-types.js +7 -7
- 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 +4 -38
- 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/create-bundle.js +41 -9
- package/module/generators/customize-utils.js +0 -1
- package/module/helpers/helper-func-types-interface.js +7 -7
- package/module/helpers/helper-func-types.js +7 -7
- 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 +4 -38
- 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/create-bundle.ts +51 -9
- package/src/generators/customize-utils.ts +0 -2
- package/src/helpers/helper-func-types-interface.ts +7 -7
- package/src/helpers/helper-func-types.ts +7 -7
- 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 +4 -38
- package/src/helpers/vue-query-hooks.ts +4 -4
- package/src/protod/recursive.ts +11 -1
- package/src/utils/index.ts +0 -1
|
@@ -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
|
}
|
|
@@ -13,9 +13,9 @@ import { HttpEndpoint } from "${
|
|
|
13
13
|
}";
|
|
14
14
|
${options.useInterchainJs ? `
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { Event, Attribute } from "@interchainjs/types";
|
|
17
|
+
|
|
17
18
|
|
|
18
|
-
export { DeliverTxResponse }
|
|
19
19
|
|
|
20
20
|
` : ''}
|
|
21
21
|
export type ProtoMsg = Omit<Any, "typeUrl"> & { typeUrl: any };
|
|
@@ -110,41 +110,7 @@ export interface Event {
|
|
|
110
110
|
attributes: readonly Attribute[];
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
* The response after successfully broadcasting a transaction.
|
|
115
|
-
* Success or failure refer to the execution result.
|
|
116
|
-
*/
|
|
117
|
-
export interface DeliverTxResponse {
|
|
118
|
-
height: number;
|
|
119
|
-
/** The position of the transaction within the block. This is a 0-based index. */
|
|
120
|
-
txIndex: number;
|
|
121
|
-
/** Error code. The transaction suceeded if and only if code is 0. */
|
|
122
|
-
code: number;
|
|
123
|
-
transactionHash: string;
|
|
124
|
-
events: readonly Event[];
|
|
125
|
-
/**
|
|
126
|
-
* A string-based log document.
|
|
127
|
-
*
|
|
128
|
-
* This currently seems to merge attributes of multiple events into one event per type
|
|
129
|
-
* (https://github.com/tendermint/tendermint/issues/9595). You might want to use the \`events\`
|
|
130
|
-
* field instead.
|
|
131
|
-
*/
|
|
132
|
-
rawLog?: string;
|
|
133
|
-
/** @deprecated Use \`msgResponses\` instead. */
|
|
134
|
-
data?: readonly MsgData[];
|
|
135
|
-
/**
|
|
136
|
-
* 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)
|
|
137
|
-
* as \`Any\`s.
|
|
138
|
-
* This field is an empty list for chains running Cosmos SDK < 0.46.
|
|
139
|
-
*/
|
|
140
|
-
msgResponses: Array<{
|
|
141
|
-
typeUrl: string;
|
|
142
|
-
value: Uint8Array;
|
|
143
|
-
}>;
|
|
144
|
-
gasUsed: bigint;
|
|
145
|
-
gasWanted: bigint;
|
|
146
|
-
origin?: any;
|
|
147
|
-
}
|
|
113
|
+
|
|
148
114
|
`}
|
|
149
115
|
export interface TxRpc {
|
|
150
116
|
request(
|
|
@@ -157,7 +123,7 @@ export interface TxRpc {
|
|
|
157
123
|
messages: EncodeObject[],
|
|
158
124
|
fee: StdFee | "auto" | number,
|
|
159
125
|
memo: string
|
|
160
|
-
): Promise<
|
|
126
|
+
): Promise<any>;
|
|
161
127
|
}
|
|
162
128
|
${options.useInterchainJs ? '' : `
|
|
163
129
|
export interface SigningClientParams {
|
|
@@ -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',
|