@hyperweb/telescope 2.0.1 → 2.0.2

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 CHANGED
@@ -1431,31 +1431,8 @@ Here is how these patches can be defined within the prototypes configuration:
1431
1431
  }
1432
1432
  }
1433
1433
  ```
1434
-
1435
-
1436
- ## CosmWasm
1437
-
1438
- Generate TypeScript SDKs for your CosmWasm smart contracts by using the `cosmwasm` option on `TelescopeOptions`. The `cosmwasm` option is actually a direct reference to the `TSBuilderInput` object, for the most up-to-date documentation, visit [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen).
1439
-
1440
- ```ts
1441
- import { TSBuilderInput } from '@cosmwasm/ts-codegen';
1442
- const options: TelescopeOptions = {
1443
- cosmwasm: {
1444
- contracts: [
1445
- {
1446
- name: 'SG721',
1447
- dir: './path/to/sg721/schema'
1448
- },
1449
- {
1450
- name: 'Minter',
1451
- dir: './path/to/Minter/schema'
1452
- }
1453
- ],
1454
- outPath: './path/to/code/src/'
1455
- }
1456
- };
1457
- ```
1458
-
1434
+ ## Cosmwasm
1435
+ Cosmwasm option is deprecated. Please visit [@cosmwasm/ts-codegen](https://github.com/hyperweb-io/ts-codegen) for cosmwasm codegen.
1459
1436
 
1460
1437
  ## Helper Functions Configuration
1461
1438
  The nameMappers object supports three service types: All, Query, and Msg. Each pattern within these categories can specify:
@@ -1586,7 +1563,8 @@ A unified toolkit for building applications and smart contracts in the Interchai
1586
1563
 
1587
1564
  ## Credits
1588
1565
 
1589
- 🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io)
1566
+ 🛠 Built by [Interweb](https://interweb.co) — if you like our tools, please checkout and contribute [https://interweb.co](https://interweb.co)
1567
+
1590
1568
 
1591
1569
  Thanks to these engineers, teams and projects for inspiring Telescope:
1592
1570
 
package/main/builder.js CHANGED
@@ -36,7 +36,6 @@ const create_sdk_module_stargate_clients_1 = require("./generators/create-sdk-mo
36
36
  const create_bundle_1 = require("./generators/create-bundle");
37
37
  const create_index_1 = require("./generators/create-index");
38
38
  const create_helpers_1 = require("./generators/create-helpers");
39
- const create_cosmwasm_bundle_1 = require("./generators/create-cosmwasm-bundle");
40
39
  const create_pinia_store_1 = require("./generators/create-pinia-store");
41
40
  const create_pinia_store_bundle_1 = require("./generators/create-pinia-store-bundle");
42
41
  const create_rpc_ops_bundle_1 = require("./generators/create-rpc-ops-bundle");
@@ -46,14 +45,6 @@ const create_mcp_server_1 = require("./generators/create-mcp-server");
46
45
  const sanitizeOptions = (options) => {
47
46
  // If an element at the same key is present for both x and y, the value from y will appear in the result.
48
47
  options = (0, deepmerge_1.default)(types_1.defaultTelescopeOptions, options ?? {});
49
- // correct the path for windows
50
- if (options.cosmwasm) {
51
- options.cosmwasm.outPath = (0, utils_1.toPosixPath)(options.cosmwasm.outPath);
52
- options.cosmwasm.contracts = options.cosmwasm.contracts.map((item) => {
53
- item.dir = (0, utils_1.toPosixPath)(item.dir);
54
- return item;
55
- });
56
- }
57
48
  // strip off leading slashes
58
49
  options.tsDisable.files = options.tsDisable.files.map((file) => file.startsWith('/') ? file : file.replace(/^\//, ''));
59
50
  options.eslintDisable.files = options.eslintDisable.files.map((file) => file.startsWith('/') ? file : file.replace(/^\//, ''));
@@ -209,7 +200,6 @@ class TelescopeBuilder {
209
200
  (0, create_react_query_bundle_1.plugin)(this);
210
201
  (0, create_mobx_bundle_1.plugin)(this);
211
202
  (0, create_aggregated_lcd_client_1.plugin)(this);
212
- await (0, create_cosmwasm_bundle_1.plugin)(this);
213
203
  (0, create_helpers_1.plugin)(this);
214
204
  (0, create_pinia_store_bundle_1.plugin)(this);
215
205
  // finally, write one index file with all files, exported
package/main/cli.js CHANGED
@@ -26,31 +26,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.cli = void 0;
27
27
  const prompt_1 = require("./prompt");
28
28
  const cmds_1 = require("./cmds");
29
- const cmds_2 = require("./cmds");
30
29
  const pkg = __importStar(require("../package.json"));
31
30
  const cli = async (argv) => {
32
31
  if (argv.v || argv.version) {
33
32
  console.log(pkg.version);
34
33
  return;
35
34
  }
36
- if (argv.contract) {
37
- const { cmd } = await (0, prompt_1.prompt)([
38
- {
39
- _: true,
40
- type: 'fuzzy',
41
- name: 'cmd',
42
- message: 'what do you want to do?',
43
- choices: Object.keys(cmds_2.Contracts)
44
- }
45
- ], argv);
46
- if (typeof cmds_2.Contracts[cmd] === 'function') {
47
- await cmds_2.Contracts[cmd](argv);
48
- }
49
- else {
50
- console.log('command not found.');
51
- }
52
- return;
53
- }
54
35
  console.log(`Telescope ${pkg.version}`);
55
36
  const { cmd } = await (0, prompt_1.prompt)([
56
37
  {
package/main/cmds.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Contracts = exports.Commands = void 0;
6
+ exports.Commands = void 0;
7
7
  const generate_1 = __importDefault(require("./commands/generate"));
8
8
  const install_1 = __importDefault(require("./commands/install"));
9
9
  const download_1 = __importDefault(require("./commands/download"));
@@ -14,15 +14,3 @@ Commands['generate'] = generate_1.default;
14
14
  Commands['install'] = install_1.default;
15
15
  Commands['download'] = download_1.default;
16
16
  Commands['transpile'] = transpile_1.default;
17
- const generate_2 = __importDefault(require("./contracts/generate"));
18
- const install_2 = __importDefault(require("./contracts/install"));
19
- const message_composer_1 = __importDefault(require("./contracts/message-composer"));
20
- const react_query_1 = __importDefault(require("./contracts/react-query"));
21
- const recoil_1 = __importDefault(require("./contracts/recoil"));
22
- const Contracts = {};
23
- exports.Contracts = Contracts;
24
- Contracts['generate'] = generate_2.default;
25
- Contracts['install'] = install_2.default;
26
- Contracts['message-composer'] = message_composer_1.default;
27
- Contracts['react-query'] = react_query_1.default;
28
- Contracts['recoil'] = recoil_1.default;
package/module/builder.js CHANGED
@@ -30,7 +30,6 @@ import { plugin as createSdkModuleStargateClients } from './generators/create-sd
30
30
  import { plugin as createBundle } from './generators/create-bundle';
31
31
  import { plugin as createIndex } from './generators/create-index';
32
32
  import { plugin as createHelpers } from './generators/create-helpers';
33
- import { plugin as createCosmWasmBundle } from './generators/create-cosmwasm-bundle';
34
33
  import { plugin as createPiniaStore } from './generators/create-pinia-store';
35
34
  import { plugin as createPiniaStoreBundle } from './generators/create-pinia-store-bundle';
36
35
  import { plugin as createRpcOpsBundle } from './generators/create-rpc-ops-bundle';
@@ -40,14 +39,6 @@ import { plugin as createMcpServer } from './generators/create-mcp-server';
40
39
  const sanitizeOptions = (options) => {
41
40
  // If an element at the same key is present for both x and y, the value from y will appear in the result.
42
41
  options = deepmerge(defaultTelescopeOptions, options ?? {});
43
- // correct the path for windows
44
- if (options.cosmwasm) {
45
- options.cosmwasm.outPath = toPosixPath(options.cosmwasm.outPath);
46
- options.cosmwasm.contracts = options.cosmwasm.contracts.map((item) => {
47
- item.dir = toPosixPath(item.dir);
48
- return item;
49
- });
50
- }
51
42
  // strip off leading slashes
52
43
  options.tsDisable.files = options.tsDisable.files.map((file) => file.startsWith('/') ? file : file.replace(/^\//, ''));
53
44
  options.eslintDisable.files = options.eslintDisable.files.map((file) => file.startsWith('/') ? file : file.replace(/^\//, ''));
@@ -203,7 +194,6 @@ export class TelescopeBuilder {
203
194
  createReactQueryBundle(this);
204
195
  createMobxBundle(this);
205
196
  createAggregatedLCDClient(this);
206
- await createCosmWasmBundle(this);
207
197
  createHelpers(this);
208
198
  createPiniaStoreBundle(this);
209
199
  // finally, write one index file with all files, exported
package/module/cli.js CHANGED
@@ -1,30 +1,11 @@
1
1
  import { prompt } from './prompt';
2
2
  import { Commands as commands } from './cmds';
3
- import { Contracts as contracts } from './cmds';
4
3
  import * as pkg from '../package.json';
5
4
  export const cli = async (argv) => {
6
5
  if (argv.v || argv.version) {
7
6
  console.log(pkg.version);
8
7
  return;
9
8
  }
10
- if (argv.contract) {
11
- const { cmd } = await prompt([
12
- {
13
- _: true,
14
- type: 'fuzzy',
15
- name: 'cmd',
16
- message: 'what do you want to do?',
17
- choices: Object.keys(contracts)
18
- }
19
- ], argv);
20
- if (typeof contracts[cmd] === 'function') {
21
- await contracts[cmd](argv);
22
- }
23
- else {
24
- console.log('command not found.');
25
- }
26
- return;
27
- }
28
9
  console.log(`Telescope ${pkg.version}`);
29
10
  const { cmd } = await prompt([
30
11
  {
package/module/cmds.js CHANGED
@@ -8,15 +8,3 @@ Commands['install'] = _commands_install;
8
8
  Commands['download'] = _commands_download;
9
9
  Commands['transpile'] = _commands_transpile;
10
10
  export { Commands };
11
- import _contracts_generate from './contracts/generate';
12
- import _contracts_install from './contracts/install';
13
- import _contracts_message_composer from './contracts/message-composer';
14
- import _contracts_react_query from './contracts/react-query';
15
- import _contracts_recoil from './contracts/recoil';
16
- const Contracts = {};
17
- Contracts['generate'] = _contracts_generate;
18
- Contracts['install'] = _contracts_install;
19
- Contracts['message-composer'] = _contracts_message_composer;
20
- Contracts['react-query'] = _contracts_react_query;
21
- Contracts['recoil'] = _contracts_recoil;
22
- export { Contracts };
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperweb/telescope",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
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,11 +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": "^2.0.0",
94
- "@cosmology/proto-parser": "^2.0.0",
95
- "@cosmology/types": "^2.0.0",
96
- "@cosmology/utils": "^2.0.0",
97
- "@cosmwasm/ts-codegen": "0.35.7",
93
+ "@cosmology/ast": "^2.0.1",
94
+ "@cosmology/proto-parser": "^2.0.1",
95
+ "@cosmology/types": "^2.0.1",
96
+ "@cosmology/utils": "^2.0.1",
98
97
  "@types/parse-package-name": "0.1.0",
99
98
  "case": "1.6.3",
100
99
  "dargs": "7.0.0",
@@ -111,5 +110,5 @@
111
110
  "rimraf": "5.0.0",
112
111
  "yaml": "^2.3.4"
113
112
  },
114
- "gitHead": "1804eecac10a575169679de3ca4a52c0191fc292"
113
+ "gitHead": "fff620923ff95b8ec8fade65317e0ba099213ac4"
115
114
  }
package/src/builder.ts CHANGED
@@ -32,7 +32,7 @@ import { plugin as createSdkModuleStargateClients } from './generators/create-sd
32
32
  import { plugin as createBundle } from './generators/create-bundle';
33
33
  import { plugin as createIndex } from './generators/create-index';
34
34
  import { plugin as createHelpers } from './generators/create-helpers';
35
- import { plugin as createCosmWasmBundle } from './generators/create-cosmwasm-bundle';
35
+
36
36
  import { plugin as createPiniaStore } from './generators/create-pinia-store';
37
37
  import { plugin as createPiniaStoreBundle } from './generators/create-pinia-store-bundle';
38
38
  import { plugin as createRpcOpsBundle } from './generators/create-rpc-ops-bundle';
@@ -43,16 +43,7 @@ import { plugin as createMcpServer } from './generators/create-mcp-server';
43
43
  const sanitizeOptions = (options: TelescopeOptions): TelescopeOptions => {
44
44
  // If an element at the same key is present for both x and y, the value from y will appear in the result.
45
45
  options = deepmerge(defaultTelescopeOptions, options ?? {});
46
- // correct the path for windows
47
- if (options.cosmwasm) {
48
- options.cosmwasm.outPath = toPosixPath(options.cosmwasm.outPath);
49
- options.cosmwasm.contracts = options.cosmwasm.contracts.map(
50
- (item: { name: string; dir: string }) => {
51
- item.dir = toPosixPath(item.dir);
52
- return item;
53
- }
54
- );
55
- }
46
+
56
47
  // strip off leading slashes
57
48
  options.tsDisable.files = options.tsDisable.files.map((file) =>
58
49
  file.startsWith('/') ? file : file.replace(/^\//, '')
@@ -279,7 +270,6 @@ export class TelescopeBuilder {
279
270
  createReactQueryBundle(this);
280
271
  createMobxBundle(this);
281
272
  createAggregatedLCDClient(this);
282
- await createCosmWasmBundle(this);
283
273
 
284
274
  createHelpers(this);
285
275
  createPiniaStoreBundle(this);
package/src/cli.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { prompt } from './prompt';
2
2
  import { Commands as commands } from './cmds';
3
- import { Contracts as contracts } from './cmds';
4
3
  import * as pkg from '../package.json';
5
4
 
6
5
  export const cli = async (argv) => {
@@ -9,26 +8,7 @@ export const cli = async (argv) => {
9
8
  return;
10
9
  }
11
10
 
12
- if (argv.contract) {
13
- const { cmd } = await prompt(
14
- [
15
- {
16
- _: true,
17
- type: 'fuzzy',
18
- name: 'cmd',
19
- message: 'what do you want to do?',
20
- choices: Object.keys(contracts)
21
- }
22
- ],
23
- argv
24
- );
25
- if (typeof contracts[cmd] === 'function') {
26
- await contracts[cmd](argv);
27
- } else {
28
- console.log('command not found.');
29
- }
30
- return;
31
- }
11
+
32
12
 
33
13
  console.log(`Telescope ${pkg.version}`);
34
14
  const { cmd } = await prompt(
package/src/cmds.js CHANGED
@@ -9,17 +9,3 @@ Commands['download'] = _commands_download;
9
9
  Commands['transpile'] = _commands_transpile;
10
10
 
11
11
  export { Commands };
12
-
13
- import _contracts_generate from './contracts/generate';
14
- import _contracts_install from './contracts/install';
15
- import _contracts_message_composer from './contracts/message-composer';
16
- import _contracts_react_query from './contracts/react-query';
17
- import _contracts_recoil from './contracts/recoil';
18
- const Contracts = {};
19
- Contracts['generate'] = _contracts_generate;
20
- Contracts['install'] = _contracts_install;
21
- Contracts['message-composer'] = _contracts_message_composer;
22
- Contracts['react-query'] = _contracts_react_query;
23
- Contracts['recoil'] = _contracts_recoil;
24
-
25
- export { Contracts };
package/types/cmds.d.ts CHANGED
@@ -4,7 +4,6 @@ export namespace Commands {
4
4
  export { _commands_download as download };
5
5
  export { _commands_transpile as transpile };
6
6
  }
7
- export const Contracts: typeof Contracts;
8
7
  import _commands_generate from './commands/generate';
9
8
  import _commands_install from './commands/install';
10
9
  import _commands_download from './commands/download';
@@ -1,99 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.plugin = void 0;
4
- const path_1 = require("path");
5
- const ast_1 = require("@cosmology/ast");
6
- const case_1 = require("case");
7
- const utils_1 = require("@cosmology/utils");
8
- const imports_1 = require("../imports");
9
- const files_1 = require("../utils/files");
10
- const plugin = (builder, allRegistries, allConverters) => {
11
- builder.options.rpcClients.combinedClient.map((currentClient) => {
12
- if (!allRegistries || !allRegistries.length) {
13
- return;
14
- }
15
- const registryImports = [];
16
- const converterImports = [];
17
- const clientFile = currentClient.fileName;
18
- const ctxRef = {
19
- absolute: '/',
20
- filename: '/',
21
- proto: {
22
- imports: [],
23
- package: currentClient.name,
24
- root: {},
25
- }
26
- };
27
- const ctx = new ast_1.GenericParseContext(ctxRef, null, builder.options);
28
- const registryVariables = [];
29
- const converterVariables = [];
30
- const filteredRegistries = allRegistries.filter(item => (0, utils_1.isPackageIncluded)(item.package, currentClient.include.patterns));
31
- filteredRegistries.forEach(registry => {
32
- let rel = (0, path_1.relative)((0, path_1.dirname)(clientFile), registry.localname);
33
- if (!rel.startsWith('.'))
34
- rel = `./${rel}`;
35
- rel = (0, utils_1.toPosixPath)(rel);
36
- const variable = (0, utils_1.variableSlug)(registry.localname);
37
- registryVariables.push(variable);
38
- registryImports.push((0, ast_1.importNamespace)(variable, rel));
39
- });
40
- const filteredConverters = allConverters.filter(item => (0, utils_1.isPackageIncluded)(item.package, currentClient.include.patterns));
41
- filteredConverters.forEach(converter => {
42
- let rel = (0, path_1.relative)((0, path_1.dirname)(clientFile), converter.localname);
43
- if (!rel.startsWith('.'))
44
- rel = `./${rel}`;
45
- rel = (0, utils_1.toPosixPath)(rel);
46
- const variable = (0, utils_1.variableSlug)(converter.localname);
47
- converterVariables.push(variable);
48
- converterImports.push((0, ast_1.importNamespace)(variable, rel));
49
- });
50
- const name = 'get' + (0, case_1.pascal)(currentClient.name + 'SigningClient');
51
- const txRpcName = 'get' + (0, case_1.pascal)(currentClient.name + 'SigningTxRpc');
52
- const prefix = (0, case_1.camel)(currentClient.name);
53
- const aminos = (0, ast_1.createStargateClientAminoRegistry)({
54
- context: ctx,
55
- aminos: converterVariables,
56
- aminoConverters: prefix + 'AminoConverters'
57
- });
58
- const protos = (0, ast_1.createStargateClientProtoRegistry)({
59
- context: ctx,
60
- registries: registryVariables,
61
- protoTypeRegistry: prefix + 'ProtoRegistry'
62
- });
63
- const clientOptions = (0, ast_1.createStargateClientOptions)({
64
- context: ctx,
65
- name: name + 'Options',
66
- protoTypeRegistry: prefix + 'ProtoRegistry',
67
- aminoConverters: prefix + 'AminoConverters'
68
- });
69
- const clientBody = (0, ast_1.createStargateClient)({
70
- context: ctx,
71
- name,
72
- options: name + 'Options',
73
- });
74
- let getTxRpc;
75
- if (ctx.pluginValue("stargateClients.addGetTxRpc")) {
76
- getTxRpc = (0, ast_1.createGetTxRpc)(ctx, txRpcName, name);
77
- }
78
- const imports = (0, imports_1.buildAllImportsFromGenericContext)(ctx, clientFile);
79
- let importDecls = [...imports, ...registryImports, ...converterImports];
80
- importDecls = (0, utils_1.duplicateImportPathsWithExt)(importDecls, builder.options.restoreImportExtension);
81
- let cProg = importDecls
82
- .concat(aminos)
83
- .concat(protos)
84
- .concat(clientOptions)
85
- .concat(clientBody);
86
- // replace all backslash path for windows
87
- for (let i = 0; i < cProg.length; i++) {
88
- if (cProg[i].source?.value) {
89
- cProg[i].source.value = (0, utils_1.toPosixPath)(cProg[i].source?.value);
90
- }
91
- }
92
- if (getTxRpc) {
93
- cProg = cProg.concat(getTxRpc);
94
- }
95
- const clientOutFile = (0, path_1.join)(builder.outPath, clientFile);
96
- (0, files_1.writeAstToFile)(builder.outPath, builder.options, cProg, clientOutFile);
97
- });
98
- };
99
- exports.plugin = plugin;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generatedType = void 0;
4
- exports.generatedType = `import { BinaryReader, BinaryWriter } from "../../../binary";
5
-
6
- /**
7
- * A type generated by Telescope 1.0.
8
- */
9
- export interface TelescopeGeneratedType {
10
- readonly typeUrl: string;
11
- readonly encode: (
12
- message:
13
- | any
14
- | {
15
- [k: string]: any;
16
- },
17
- writer?: BinaryWriter
18
- ) => BinaryWriter;
19
- readonly decode: (input: BinaryReader | Uint8Array, length?: number) => any;
20
- readonly fromPartial: (object: any) => any;
21
- }
22
-
23
- export type GeneratedType = TelescopeGeneratedType;
24
- `;