@hyperweb/telescope 1.17.1 → 1.17.3

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.
@@ -45,22 +45,16 @@ const plugin = (builder, bundler) => {
45
45
  if (duplicatedType) {
46
46
  let alias;
47
47
  if (exportObj.isHelperFunc) {
48
- const serialNumber = builder.store.getAndIncTypeSerialNumber(identifier);
49
- if (serialNumber > 0) {
50
- alias = (0, utils_1.makeAliasNameWithPackageAtEnd)({ package: exportObj.pkg, name: identifier });
51
- }
52
- else {
53
- alias = identifier;
54
- }
48
+ alias = (0, utils_1.makeAliasNameWithPackageAtEnd)({
49
+ package: exportObj.pkg,
50
+ name: identifier,
51
+ });
55
52
  }
56
53
  else {
57
- const serialNumber = builder.store.getAndIncTypeSerialNumber(identifier);
58
- if (serialNumber > 0) {
59
- alias = (0, utils_1.makeAliasName)({ package: exportObj.pkg, name: identifier });
60
- }
61
- else {
62
- alias = identifier;
63
- }
54
+ alias = (0, utils_1.makeAliasName)({
55
+ package: exportObj.pkg,
56
+ name: identifier,
57
+ });
64
58
  }
65
59
  return { name: identifier, alias: alias };
66
60
  }
@@ -11,10 +11,10 @@ function getAliasedFunctionName(builder, functionName, packageName) {
11
11
  const duplicatedHelperFuncs = builder.store.getHelperFuncsInMultipleFiles();
12
12
  const isDuplicated = duplicatedHelperFuncs.includes(functionName);
13
13
  if (isDuplicated) {
14
- const serialNumber = builder.store.getAndIncTypeSerialNumber(functionName);
15
- if (serialNumber > 0) {
16
- return (0, utils_1.makeAliasNameWithPackageAtEnd)({ package: packageName, name: functionName });
17
- }
14
+ return (0, utils_1.makeAliasNameWithPackageAtEnd)({
15
+ package: packageName,
16
+ name: functionName,
17
+ });
18
18
  }
19
19
  return functionName;
20
20
  }
@@ -27,15 +27,15 @@ function cleanComment(comment) {
27
27
  // Remove lint directives and technical annotations
28
28
  const cleanedComment = comment
29
29
  // Remove buf:lint:ignore directives
30
- .replace(/buf:lint:ignore\s+[A-Z_]+/gi, '')
30
+ .replace(/buf:lint:ignore\s+[A-Z_]+/gi, "")
31
31
  // Remove other common lint directives
32
- .replace(/lint:ignore[:\s]+[A-Z_]+/gi, '')
32
+ .replace(/lint:ignore[:\s]+[A-Z_]+/gi, "")
33
33
  // Remove protolint directives
34
- .replace(/protolint:disable[:\s]+[A-Z_]+/gi, '')
34
+ .replace(/protolint:disable[:\s]+[A-Z_]+/gi, "")
35
35
  // Remove eslint directives
36
- .replace(/eslint-disable[:\s-]+[a-z-]+/gi, '')
36
+ .replace(/eslint-disable[:\s-]+[a-z-]+/gi, "")
37
37
  // Remove multiple consecutive spaces
38
- .replace(/\s+/g, ' ')
38
+ .replace(/\s+/g, " ")
39
39
  // Remove leading/trailing whitespace
40
40
  .trim();
41
41
  return cleanedComment;
@@ -58,7 +58,7 @@ function getImportPath(builder, functionName, packageName, projectName, sourceFi
58
58
  const aliasedName = getAliasedFunctionName(builder, functionName, packageName);
59
59
  if (aliasedName !== functionName) {
60
60
  // Extract the top-level package name (e.g., 'akash' from 'akash.audit.v1beta2')
61
- const topLevelPackage = packageName.split('.')[0];
61
+ const topLevelPackage = packageName.split(".")[0];
62
62
  // Function is aliased and should be available in bundle
63
63
  return `${projectName}/${topLevelPackage}/bundle`;
64
64
  }
@@ -67,11 +67,11 @@ function getImportPath(builder, functionName, packageName, projectName, sourceFi
67
67
  // This handles all functions with specific file locations
68
68
  if (sourceFilename) {
69
69
  // Remove .ts extension and convert to proper import path
70
- const filePath = sourceFilename.replace(/\.ts$/, '');
70
+ const filePath = sourceFilename.replace(/\.ts$/, "");
71
71
  return `${projectName}/${filePath}`;
72
72
  }
73
73
  // Fallback: import from the specific package path
74
- return `${projectName}/${packageName.replace(/\./g, '/')}`;
74
+ return `${projectName}/${packageName.replace(/\./g, "/")}`;
75
75
  }
76
76
  /**
77
77
  * Gets all types for a package by looking at export objects and filtering out extended forms
@@ -79,18 +79,18 @@ function getImportPath(builder, functionName, packageName, projectName, sourceFi
79
79
  function getTypesForPackage(builder, packageName) {
80
80
  const types = [];
81
81
  // Get all contexts for this package
82
- const packageContexts = builder.contexts.filter(ctx => ctx.ref.proto.package === packageName);
83
- packageContexts.forEach(context => {
82
+ const packageContexts = builder.contexts.filter((ctx) => ctx.ref.proto.package === packageName);
83
+ packageContexts.forEach((context) => {
84
84
  // Get types from this context
85
- const contextTypes = context.types.filter(type => !type.isNested);
86
- contextTypes.forEach(typeInfo => {
85
+ const contextTypes = context.types.filter((type) => !type.isNested);
86
+ contextTypes.forEach((typeInfo) => {
87
87
  const typeName = typeInfo.name;
88
88
  // Filter out extended forms (these are created during code generation but not in the types array)
89
- if (!typeName.endsWith('ProtoMsg') &&
90
- !typeName.endsWith('Amino') &&
91
- !typeName.endsWith('AminoMsg') &&
92
- !typeName.endsWith('Encoded') &&
93
- !typeName.endsWith('SDKType')) {
89
+ if (!typeName.endsWith("ProtoMsg") &&
90
+ !typeName.endsWith("Amino") &&
91
+ !typeName.endsWith("AminoMsg") &&
92
+ !typeName.endsWith("Encoded") &&
93
+ !typeName.endsWith("SDKType")) {
94
94
  // Get the actual source file from the store mapping
95
95
  const typeFiles = builder.store.getTypeFilesMapping(typeName);
96
96
  let sourceFile;
@@ -100,21 +100,22 @@ function getTypesForPackage(builder, packageName) {
100
100
  }
101
101
  else {
102
102
  // Fallback to context ref filename if not in mapping
103
- sourceFile = context.ref.filename.replace(/\.proto$/, '.ts');
103
+ sourceFile = context.ref.filename.replace(/\.proto$/, ".ts");
104
104
  }
105
105
  types.push({
106
106
  name: typeName,
107
- sourceFile
107
+ sourceFile,
108
108
  });
109
109
  }
110
110
  });
111
111
  });
112
112
  // Remove duplicates and sort
113
- const uniqueTypes = types.filter((type, index, self) => index === self.findIndex(t => t.name === type.name));
113
+ const uniqueTypes = types.filter((type, index, self) => index === self.findIndex((t) => t.name === type.name));
114
114
  return uniqueTypes.sort((a, b) => a.name.localeCompare(b.name));
115
115
  }
116
116
  const plugin = (builder) => {
117
- if (!builder.options?.readme?.enabled && !builder.options?.mcpServer?.enabled) {
117
+ if (!builder.options?.readme?.enabled &&
118
+ !builder.options?.mcpServer?.enabled) {
118
119
  return;
119
120
  }
120
121
  const readmePath = (0, path_1.join)(builder.outPath, "README.md");
@@ -123,7 +124,9 @@ const plugin = (builder) => {
123
124
  const functionMappings = builder.getFunctionMappings();
124
125
  // Generate package documentation
125
126
  let packageDocs = "";
126
- Object.keys(functionMappings).sort().forEach(packageName => {
127
+ Object.keys(functionMappings)
128
+ .sort()
129
+ .forEach((packageName) => {
127
130
  const packageServices = functionMappings[packageName];
128
131
  // Check if package has any methods before adding it
129
132
  const hasQueryMethods = packageServices.Query && Object.keys(packageServices.Query).length > 0;
@@ -138,10 +141,10 @@ const plugin = (builder) => {
138
141
  packageDocs += `### Types\n\n`;
139
142
  packageDocs += `| Type | Name | Source |\n`;
140
143
  packageDocs += `| --- | --- | --- |\n`;
141
- types.forEach(type => {
144
+ types.forEach((type) => {
142
145
  packageDocs += `| Type | \`${type.name}\` | [View source ↗](${type.sourceFile}) |\n`;
143
146
  });
144
- packageDocs += '\n';
147
+ packageDocs += "\n";
145
148
  }
146
149
  // Query section
147
150
  if (packageServices.Query) {
@@ -159,7 +162,9 @@ const plugin = (builder) => {
159
162
  }
160
163
  // Add import code block
161
164
  const functionImportPath = getImportPath(builder, method.functionName, packageName, projectName, method.sourceFilename);
162
- const hookImportPath = method.hookName ? getImportPath(builder, method.hookName, packageName, projectName, method.hookSourceFilename) : functionImportPath;
165
+ const hookImportPath = method.hookName
166
+ ? getImportPath(builder, method.hookName, packageName, projectName, method.hookSourceFilename)
167
+ : functionImportPath;
163
168
  packageDocs += `\`\`\`ts\n`;
164
169
  packageDocs += `import { ${aliasedFunctionName} } from '${functionImportPath}'\n`;
165
170
  if (method.hookName && aliasedHookName !== aliasedFunctionName) {
@@ -170,29 +175,33 @@ const plugin = (builder) => {
170
175
  packageDocs += `| Field | Value | Source |\n`;
171
176
  packageDocs += `| --- | --- | --- |\n`;
172
177
  // Function source
173
- const functionSourcePath = method.sourceFilename || `${packageName.replace(/\./g, '/')}/query.rpc.func.ts`;
178
+ const functionSourcePath = method.sourceFilename ||
179
+ `${packageName.replace(/\./g, "/")}/query.rpc.func.ts`;
174
180
  packageDocs += `| Function | \`${aliasedFunctionName}\` | [View source ↗](${functionSourcePath}) |\n`;
175
181
  // Hook source (React)
176
182
  if (method.hookName && aliasedHookName !== aliasedFunctionName) {
177
- const hookSourcePath = method.hookSourceFilename || `${packageName.replace(/\./g, '/')}/query.rpc.react.ts`;
183
+ const hookSourcePath = method.hookSourceFilename ||
184
+ `${packageName.replace(/\./g, "/")}/query.rpc.react.ts`;
178
185
  packageDocs += `| Hook | \`${aliasedHookName}\` | [View source ↗](${hookSourcePath}) |\n`;
179
186
  }
180
187
  // Request type source
181
188
  if (method.requestType) {
182
- const requestSourcePath = method.typeSourceFilename || `${packageName.replace(/\./g, '/')}/query.ts`;
189
+ const requestSourcePath = method.typeSourceFilename ||
190
+ `${packageName.replace(/\./g, "/")}/query.ts`;
183
191
  packageDocs += `| Request | \`${method.requestType}\` | [View source ↗](${requestSourcePath}) |\n`;
184
192
  }
185
193
  // Response type source
186
194
  if (method.responseType) {
187
- const responseSourcePath = method.typeSourceFilename || `${packageName.replace(/\./g, '/')}/query.ts`;
195
+ const responseSourcePath = method.typeSourceFilename ||
196
+ `${packageName.replace(/\./g, "/")}/query.ts`;
188
197
  packageDocs += `| Response | \`${method.responseType}\` | [View source ↗](${responseSourcePath}) |\n`;
189
198
  }
190
199
  // Add spacing between methods (but not after the last one)
191
200
  if (index < queryMethods.length - 1) {
192
- packageDocs += '\n---\n\n';
201
+ packageDocs += "\n---\n\n";
193
202
  }
194
203
  else {
195
- packageDocs += '\n';
204
+ packageDocs += "\n";
196
205
  }
197
206
  });
198
207
  }
@@ -212,7 +221,9 @@ const plugin = (builder) => {
212
221
  }
213
222
  // Add import code block
214
223
  const functionImportPath = getImportPath(builder, method.functionName, packageName, projectName, method.sourceFilename);
215
- const hookImportPath = method.hookName ? getImportPath(builder, method.hookName, packageName, projectName, method.hookSourceFilename) : functionImportPath;
224
+ const hookImportPath = method.hookName
225
+ ? getImportPath(builder, method.hookName, packageName, projectName, method.hookSourceFilename)
226
+ : functionImportPath;
216
227
  packageDocs += `\`\`\`ts\n`;
217
228
  packageDocs += `import { ${aliasedFunctionName} } from '${functionImportPath}'\n`;
218
229
  if (method.hookName && aliasedHookName !== aliasedFunctionName) {
@@ -223,34 +234,38 @@ const plugin = (builder) => {
223
234
  packageDocs += `| Field | Value | Source |\n`;
224
235
  packageDocs += `| --- | --- | --- |\n`;
225
236
  // Function source
226
- const functionSourcePath = method.sourceFilename || `${packageName.replace(/\./g, '/')}/tx.rpc.func.ts`;
237
+ const functionSourcePath = method.sourceFilename ||
238
+ `${packageName.replace(/\./g, "/")}/tx.rpc.func.ts`;
227
239
  packageDocs += `| Function | \`${aliasedFunctionName}\` | [View source ↗](${functionSourcePath}) |\n`;
228
240
  // Hook source (React)
229
241
  if (method.hookName && aliasedHookName !== aliasedFunctionName) {
230
- const hookSourcePath = method.hookSourceFilename || `${packageName.replace(/\./g, '/')}/tx.rpc.react.ts`;
242
+ const hookSourcePath = method.hookSourceFilename ||
243
+ `${packageName.replace(/\./g, "/")}/tx.rpc.react.ts`;
231
244
  packageDocs += `| Hook | \`${aliasedHookName}\` | [View source ↗](${hookSourcePath}) |\n`;
232
245
  }
233
246
  // Request type source
234
247
  if (method.requestType) {
235
- const requestSourcePath = method.typeSourceFilename || `${packageName.replace(/\./g, '/')}/tx.ts`;
248
+ const requestSourcePath = method.typeSourceFilename ||
249
+ `${packageName.replace(/\./g, "/")}/tx.ts`;
236
250
  packageDocs += `| Request | \`${method.requestType}\` | [View source ↗](${requestSourcePath}) |\n`;
237
251
  }
238
252
  // Response type source
239
253
  if (method.responseType) {
240
- const responseSourcePath = method.typeSourceFilename || `${packageName.replace(/\./g, '/')}/tx.ts`;
254
+ const responseSourcePath = method.typeSourceFilename ||
255
+ `${packageName.replace(/\./g, "/")}/tx.ts`;
241
256
  packageDocs += `| Response | \`${method.responseType}\` | [View source ↗](${responseSourcePath}) |\n`;
242
257
  }
243
258
  // Add spacing between methods (but not after the last one)
244
259
  if (index < msgMethods.length - 1) {
245
- packageDocs += '\n---\n\n';
260
+ packageDocs += "\n---\n\n";
246
261
  }
247
262
  else {
248
- packageDocs += '\n';
263
+ packageDocs += "\n";
249
264
  }
250
265
  });
251
266
  }
252
267
  // Add spacing between packages
253
- packageDocs += '\n';
268
+ packageDocs += "\n";
254
269
  });
255
270
  const readmeContent = `# Package Documentation
256
271
  ${packageDocs}`;
@@ -8,8 +8,8 @@ import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExten
8
8
  import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}";` : ''}
9
9
  import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
10
10
  import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}";` : ''}${!options.isGeneratingCosmosTypes ? `
11
- import { toConverters, toEncoders } from "@interchainjs/cosmos/utils";
12
- import { ISigningClient } from "@interchainjs/cosmos/types/signing-client${options.restoreImportExtension ?? ""}";` : ''}
11
+ import { toConverters, toEncoders } from "@interchainjs/cosmos";
12
+ import { ISigningClient } from "@interchainjs/cosmos";` : ''}
13
13
 
14
14
  export interface QueryBuilderOptions<TReq, TRes> {
15
15
  encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter
@@ -8,8 +8,8 @@ import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExten
8
8
  import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}";` : ''}
9
9
  import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
10
10
  import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}";` : ''}${!options.isGeneratingCosmosTypes ? `
11
- import { toConverters, toEncoders } from "@interchainjs/cosmos/utils";
12
- import { ISigningClient } from "@interchainjs/cosmos/types/signing-client${options.restoreImportExtension ?? ""}";` : ''}
11
+ import { toConverters, toEncoders } from "@interchainjs/cosmos";
12
+ import { ISigningClient } from "@interchainjs/cosmos";` : ''}
13
13
 
14
14
  export interface QueryBuilderOptions<TReq, TRes> {
15
15
  encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter
@@ -2,8 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getHelperForBigint = void 0;
4
4
  const getHelperForBigint = (options) => {
5
- return `
6
- declare var self: any | undefined;
5
+ return `${options.useInterchainJs ?
6
+ 'export { fromBase64 as bytesFromBase64, toBase64 as base64FromBytes } from \'@interchainjs/encoding\';' :
7
+ `declare var self: any | undefined;
7
8
  declare var window: any | undefined;
8
9
  declare var global: any | undefined;
9
10
  var globalThis: any = (() => {
@@ -37,7 +38,7 @@ export function base64FromBytes(arr: Uint8Array): string {
37
38
  bin.push(String.fromCharCode(byte));
38
39
  });
39
40
  return btoa(bin.join(''));
40
- }
41
+ }`}
41
42
 
42
43
  export interface AminoHeight {
43
44
  readonly revision_number?: string;
@@ -14,7 +14,9 @@ if (_m0.util.Long !== Long) {
14
14
 
15
15
  export { Long };
16
16
 
17
- declare var self: any | undefined;
17
+ ${options.useInterchainJs ?
18
+ 'export { fromBase64 as bytesFromBase64, toBase64 as base64FromBytes } from \'@interchainjs/encoding\';' :
19
+ `declare var self: any | undefined;
18
20
  declare var window: any | undefined;
19
21
  declare var global: any | undefined;
20
22
  var globalThis: any = (() => {
@@ -46,7 +48,7 @@ export function base64FromBytes(arr: Uint8Array): string {
46
48
  bin.push(String.fromCharCode(byte));
47
49
  });
48
50
  return btoa(bin.join(''));
49
- }
51
+ }`}
50
52
 
51
53
  export interface AminoHeight {
52
54
  readonly revision_number?: string;
@@ -12,7 +12,7 @@ import {
12
12
  ITxArgs,
13
13
  EndpointOrRpc,
14
14
  } from './helper-func-types${options.restoreImportExtension ?? ""}'
15
- import { ISigningClient, isISigningClient } from "@interchainjs/cosmos/types/signing-client${options.restoreImportExtension ?? ""}";
15
+ import { ISigningClient, isISigningClient } from "@interchainjs/cosmos";
16
16
  import {
17
17
  StdFee,
18
18
  DeliverTxResponse,
@@ -1,5 +1,5 @@
1
1
  import { exportAllFromRelPath, exportTypesWithAlias, recursiveModuleBundle, } from "@cosmology/ast";
2
- import { duplicateImportPathsWithExt, makeAliasName, makeAliasNameWithPackageAtEnd } from "@cosmology/utils";
2
+ import { duplicateImportPathsWithExt, makeAliasName, makeAliasNameWithPackageAtEnd, } from "@cosmology/utils";
3
3
  export const plugin = (builder, bundler) => {
4
4
  if (!builder.options.bundle.enabled) {
5
5
  return;
@@ -42,22 +42,16 @@ export const plugin = (builder, bundler) => {
42
42
  if (duplicatedType) {
43
43
  let alias;
44
44
  if (exportObj.isHelperFunc) {
45
- const serialNumber = builder.store.getAndIncTypeSerialNumber(identifier);
46
- if (serialNumber > 0) {
47
- alias = makeAliasNameWithPackageAtEnd({ package: exportObj.pkg, name: identifier });
48
- }
49
- else {
50
- alias = identifier;
51
- }
45
+ alias = makeAliasNameWithPackageAtEnd({
46
+ package: exportObj.pkg,
47
+ name: identifier,
48
+ });
52
49
  }
53
50
  else {
54
- const serialNumber = builder.store.getAndIncTypeSerialNumber(identifier);
55
- if (serialNumber > 0) {
56
- alias = makeAliasName({ package: exportObj.pkg, name: identifier });
57
- }
58
- else {
59
- alias = identifier;
60
- }
51
+ alias = makeAliasName({
52
+ package: exportObj.pkg,
53
+ name: identifier,
54
+ });
61
55
  }
62
56
  return { name: identifier, alias: alias };
63
57
  }
@@ -8,10 +8,10 @@ function getAliasedFunctionName(builder, functionName, packageName) {
8
8
  const duplicatedHelperFuncs = builder.store.getHelperFuncsInMultipleFiles();
9
9
  const isDuplicated = duplicatedHelperFuncs.includes(functionName);
10
10
  if (isDuplicated) {
11
- const serialNumber = builder.store.getAndIncTypeSerialNumber(functionName);
12
- if (serialNumber > 0) {
13
- return makeAliasNameWithPackageAtEnd({ package: packageName, name: functionName });
14
- }
11
+ return makeAliasNameWithPackageAtEnd({
12
+ package: packageName,
13
+ name: functionName,
14
+ });
15
15
  }
16
16
  return functionName;
17
17
  }
@@ -24,15 +24,15 @@ function cleanComment(comment) {
24
24
  // Remove lint directives and technical annotations
25
25
  const cleanedComment = comment
26
26
  // Remove buf:lint:ignore directives
27
- .replace(/buf:lint:ignore\s+[A-Z_]+/gi, '')
27
+ .replace(/buf:lint:ignore\s+[A-Z_]+/gi, "")
28
28
  // Remove other common lint directives
29
- .replace(/lint:ignore[:\s]+[A-Z_]+/gi, '')
29
+ .replace(/lint:ignore[:\s]+[A-Z_]+/gi, "")
30
30
  // Remove protolint directives
31
- .replace(/protolint:disable[:\s]+[A-Z_]+/gi, '')
31
+ .replace(/protolint:disable[:\s]+[A-Z_]+/gi, "")
32
32
  // Remove eslint directives
33
- .replace(/eslint-disable[:\s-]+[a-z-]+/gi, '')
33
+ .replace(/eslint-disable[:\s-]+[a-z-]+/gi, "")
34
34
  // Remove multiple consecutive spaces
35
- .replace(/\s+/g, ' ')
35
+ .replace(/\s+/g, " ")
36
36
  // Remove leading/trailing whitespace
37
37
  .trim();
38
38
  return cleanedComment;
@@ -55,7 +55,7 @@ function getImportPath(builder, functionName, packageName, projectName, sourceFi
55
55
  const aliasedName = getAliasedFunctionName(builder, functionName, packageName);
56
56
  if (aliasedName !== functionName) {
57
57
  // Extract the top-level package name (e.g., 'akash' from 'akash.audit.v1beta2')
58
- const topLevelPackage = packageName.split('.')[0];
58
+ const topLevelPackage = packageName.split(".")[0];
59
59
  // Function is aliased and should be available in bundle
60
60
  return `${projectName}/${topLevelPackage}/bundle`;
61
61
  }
@@ -64,11 +64,11 @@ function getImportPath(builder, functionName, packageName, projectName, sourceFi
64
64
  // This handles all functions with specific file locations
65
65
  if (sourceFilename) {
66
66
  // Remove .ts extension and convert to proper import path
67
- const filePath = sourceFilename.replace(/\.ts$/, '');
67
+ const filePath = sourceFilename.replace(/\.ts$/, "");
68
68
  return `${projectName}/${filePath}`;
69
69
  }
70
70
  // Fallback: import from the specific package path
71
- return `${projectName}/${packageName.replace(/\./g, '/')}`;
71
+ return `${projectName}/${packageName.replace(/\./g, "/")}`;
72
72
  }
73
73
  /**
74
74
  * Gets all types for a package by looking at export objects and filtering out extended forms
@@ -76,18 +76,18 @@ function getImportPath(builder, functionName, packageName, projectName, sourceFi
76
76
  function getTypesForPackage(builder, packageName) {
77
77
  const types = [];
78
78
  // Get all contexts for this package
79
- const packageContexts = builder.contexts.filter(ctx => ctx.ref.proto.package === packageName);
80
- packageContexts.forEach(context => {
79
+ const packageContexts = builder.contexts.filter((ctx) => ctx.ref.proto.package === packageName);
80
+ packageContexts.forEach((context) => {
81
81
  // Get types from this context
82
- const contextTypes = context.types.filter(type => !type.isNested);
83
- contextTypes.forEach(typeInfo => {
82
+ const contextTypes = context.types.filter((type) => !type.isNested);
83
+ contextTypes.forEach((typeInfo) => {
84
84
  const typeName = typeInfo.name;
85
85
  // Filter out extended forms (these are created during code generation but not in the types array)
86
- if (!typeName.endsWith('ProtoMsg') &&
87
- !typeName.endsWith('Amino') &&
88
- !typeName.endsWith('AminoMsg') &&
89
- !typeName.endsWith('Encoded') &&
90
- !typeName.endsWith('SDKType')) {
86
+ if (!typeName.endsWith("ProtoMsg") &&
87
+ !typeName.endsWith("Amino") &&
88
+ !typeName.endsWith("AminoMsg") &&
89
+ !typeName.endsWith("Encoded") &&
90
+ !typeName.endsWith("SDKType")) {
91
91
  // Get the actual source file from the store mapping
92
92
  const typeFiles = builder.store.getTypeFilesMapping(typeName);
93
93
  let sourceFile;
@@ -97,21 +97,22 @@ function getTypesForPackage(builder, packageName) {
97
97
  }
98
98
  else {
99
99
  // Fallback to context ref filename if not in mapping
100
- sourceFile = context.ref.filename.replace(/\.proto$/, '.ts');
100
+ sourceFile = context.ref.filename.replace(/\.proto$/, ".ts");
101
101
  }
102
102
  types.push({
103
103
  name: typeName,
104
- sourceFile
104
+ sourceFile,
105
105
  });
106
106
  }
107
107
  });
108
108
  });
109
109
  // Remove duplicates and sort
110
- const uniqueTypes = types.filter((type, index, self) => index === self.findIndex(t => t.name === type.name));
110
+ const uniqueTypes = types.filter((type, index, self) => index === self.findIndex((t) => t.name === type.name));
111
111
  return uniqueTypes.sort((a, b) => a.name.localeCompare(b.name));
112
112
  }
113
113
  export const plugin = (builder) => {
114
- if (!builder.options?.readme?.enabled && !builder.options?.mcpServer?.enabled) {
114
+ if (!builder.options?.readme?.enabled &&
115
+ !builder.options?.mcpServer?.enabled) {
115
116
  return;
116
117
  }
117
118
  const readmePath = join(builder.outPath, "README.md");
@@ -120,7 +121,9 @@ export const plugin = (builder) => {
120
121
  const functionMappings = builder.getFunctionMappings();
121
122
  // Generate package documentation
122
123
  let packageDocs = "";
123
- Object.keys(functionMappings).sort().forEach(packageName => {
124
+ Object.keys(functionMappings)
125
+ .sort()
126
+ .forEach((packageName) => {
124
127
  const packageServices = functionMappings[packageName];
125
128
  // Check if package has any methods before adding it
126
129
  const hasQueryMethods = packageServices.Query && Object.keys(packageServices.Query).length > 0;
@@ -135,10 +138,10 @@ export const plugin = (builder) => {
135
138
  packageDocs += `### Types\n\n`;
136
139
  packageDocs += `| Type | Name | Source |\n`;
137
140
  packageDocs += `| --- | --- | --- |\n`;
138
- types.forEach(type => {
141
+ types.forEach((type) => {
139
142
  packageDocs += `| Type | \`${type.name}\` | [View source ↗](${type.sourceFile}) |\n`;
140
143
  });
141
- packageDocs += '\n';
144
+ packageDocs += "\n";
142
145
  }
143
146
  // Query section
144
147
  if (packageServices.Query) {
@@ -156,7 +159,9 @@ export const plugin = (builder) => {
156
159
  }
157
160
  // Add import code block
158
161
  const functionImportPath = getImportPath(builder, method.functionName, packageName, projectName, method.sourceFilename);
159
- const hookImportPath = method.hookName ? getImportPath(builder, method.hookName, packageName, projectName, method.hookSourceFilename) : functionImportPath;
162
+ const hookImportPath = method.hookName
163
+ ? getImportPath(builder, method.hookName, packageName, projectName, method.hookSourceFilename)
164
+ : functionImportPath;
160
165
  packageDocs += `\`\`\`ts\n`;
161
166
  packageDocs += `import { ${aliasedFunctionName} } from '${functionImportPath}'\n`;
162
167
  if (method.hookName && aliasedHookName !== aliasedFunctionName) {
@@ -167,29 +172,33 @@ export const plugin = (builder) => {
167
172
  packageDocs += `| Field | Value | Source |\n`;
168
173
  packageDocs += `| --- | --- | --- |\n`;
169
174
  // Function source
170
- const functionSourcePath = method.sourceFilename || `${packageName.replace(/\./g, '/')}/query.rpc.func.ts`;
175
+ const functionSourcePath = method.sourceFilename ||
176
+ `${packageName.replace(/\./g, "/")}/query.rpc.func.ts`;
171
177
  packageDocs += `| Function | \`${aliasedFunctionName}\` | [View source ↗](${functionSourcePath}) |\n`;
172
178
  // Hook source (React)
173
179
  if (method.hookName && aliasedHookName !== aliasedFunctionName) {
174
- const hookSourcePath = method.hookSourceFilename || `${packageName.replace(/\./g, '/')}/query.rpc.react.ts`;
180
+ const hookSourcePath = method.hookSourceFilename ||
181
+ `${packageName.replace(/\./g, "/")}/query.rpc.react.ts`;
175
182
  packageDocs += `| Hook | \`${aliasedHookName}\` | [View source ↗](${hookSourcePath}) |\n`;
176
183
  }
177
184
  // Request type source
178
185
  if (method.requestType) {
179
- const requestSourcePath = method.typeSourceFilename || `${packageName.replace(/\./g, '/')}/query.ts`;
186
+ const requestSourcePath = method.typeSourceFilename ||
187
+ `${packageName.replace(/\./g, "/")}/query.ts`;
180
188
  packageDocs += `| Request | \`${method.requestType}\` | [View source ↗](${requestSourcePath}) |\n`;
181
189
  }
182
190
  // Response type source
183
191
  if (method.responseType) {
184
- const responseSourcePath = method.typeSourceFilename || `${packageName.replace(/\./g, '/')}/query.ts`;
192
+ const responseSourcePath = method.typeSourceFilename ||
193
+ `${packageName.replace(/\./g, "/")}/query.ts`;
185
194
  packageDocs += `| Response | \`${method.responseType}\` | [View source ↗](${responseSourcePath}) |\n`;
186
195
  }
187
196
  // Add spacing between methods (but not after the last one)
188
197
  if (index < queryMethods.length - 1) {
189
- packageDocs += '\n---\n\n';
198
+ packageDocs += "\n---\n\n";
190
199
  }
191
200
  else {
192
- packageDocs += '\n';
201
+ packageDocs += "\n";
193
202
  }
194
203
  });
195
204
  }
@@ -209,7 +218,9 @@ export const plugin = (builder) => {
209
218
  }
210
219
  // Add import code block
211
220
  const functionImportPath = getImportPath(builder, method.functionName, packageName, projectName, method.sourceFilename);
212
- const hookImportPath = method.hookName ? getImportPath(builder, method.hookName, packageName, projectName, method.hookSourceFilename) : functionImportPath;
221
+ const hookImportPath = method.hookName
222
+ ? getImportPath(builder, method.hookName, packageName, projectName, method.hookSourceFilename)
223
+ : functionImportPath;
213
224
  packageDocs += `\`\`\`ts\n`;
214
225
  packageDocs += `import { ${aliasedFunctionName} } from '${functionImportPath}'\n`;
215
226
  if (method.hookName && aliasedHookName !== aliasedFunctionName) {
@@ -220,34 +231,38 @@ export const plugin = (builder) => {
220
231
  packageDocs += `| Field | Value | Source |\n`;
221
232
  packageDocs += `| --- | --- | --- |\n`;
222
233
  // Function source
223
- const functionSourcePath = method.sourceFilename || `${packageName.replace(/\./g, '/')}/tx.rpc.func.ts`;
234
+ const functionSourcePath = method.sourceFilename ||
235
+ `${packageName.replace(/\./g, "/")}/tx.rpc.func.ts`;
224
236
  packageDocs += `| Function | \`${aliasedFunctionName}\` | [View source ↗](${functionSourcePath}) |\n`;
225
237
  // Hook source (React)
226
238
  if (method.hookName && aliasedHookName !== aliasedFunctionName) {
227
- const hookSourcePath = method.hookSourceFilename || `${packageName.replace(/\./g, '/')}/tx.rpc.react.ts`;
239
+ const hookSourcePath = method.hookSourceFilename ||
240
+ `${packageName.replace(/\./g, "/")}/tx.rpc.react.ts`;
228
241
  packageDocs += `| Hook | \`${aliasedHookName}\` | [View source ↗](${hookSourcePath}) |\n`;
229
242
  }
230
243
  // Request type source
231
244
  if (method.requestType) {
232
- const requestSourcePath = method.typeSourceFilename || `${packageName.replace(/\./g, '/')}/tx.ts`;
245
+ const requestSourcePath = method.typeSourceFilename ||
246
+ `${packageName.replace(/\./g, "/")}/tx.ts`;
233
247
  packageDocs += `| Request | \`${method.requestType}\` | [View source ↗](${requestSourcePath}) |\n`;
234
248
  }
235
249
  // Response type source
236
250
  if (method.responseType) {
237
- const responseSourcePath = method.typeSourceFilename || `${packageName.replace(/\./g, '/')}/tx.ts`;
251
+ const responseSourcePath = method.typeSourceFilename ||
252
+ `${packageName.replace(/\./g, "/")}/tx.ts`;
238
253
  packageDocs += `| Response | \`${method.responseType}\` | [View source ↗](${responseSourcePath}) |\n`;
239
254
  }
240
255
  // Add spacing between methods (but not after the last one)
241
256
  if (index < msgMethods.length - 1) {
242
- packageDocs += '\n---\n\n';
257
+ packageDocs += "\n---\n\n";
243
258
  }
244
259
  else {
245
- packageDocs += '\n';
260
+ packageDocs += "\n";
246
261
  }
247
262
  });
248
263
  }
249
264
  // Add spacing between packages
250
- packageDocs += '\n';
265
+ packageDocs += "\n";
251
266
  });
252
267
  const readmeContent = `# Package Documentation
253
268
  ${packageDocs}`;