@hyperweb/telescope 2.0.0 → 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 +4 -26
- package/main/builder.js +0 -10
- package/main/cli.js +0 -19
- package/main/cmds.js +1 -13
- package/main/helpers/helper-func-types-interface.js +7 -7
- package/main/helpers/helper-func-types.js +7 -7
- package/main/helpers/types-helper.js +38 -4
- package/module/builder.js +0 -10
- package/module/cli.js +0 -19
- package/module/cmds.js +0 -12
- package/module/helpers/helper-func-types-interface.js +7 -7
- package/module/helpers/helper-func-types.js +7 -7
- package/module/helpers/types-helper.js +38 -4
- package/module/telescope.js +0 -0
- package/package.json +6 -7
- package/src/builder.ts +2 -12
- package/src/cli.js +1 -21
- package/src/cmds.js +0 -14
- package/src/helpers/helper-func-types-interface.ts +7 -7
- package/src/helpers/helper-func-types.ts +7 -7
- package/src/helpers/types-helper.ts +38 -4
- package/types/cmds.d.ts +0 -1
- package/main/generators/create-combined-stargate-clients.js +0 -99
- package/main/helpers/generated-type.js +0 -24
- package/main/helpers/internalForBigInt.js +0 -248
- package/main/helpers/types.js +0 -24
- package/main/helpers/vue-query.js +0 -91
- package/main/protod/proto-download.js +0 -57
- package/module/generators/create-combined-stargate-clients.js +0 -95
- package/module/helpers/generated-type.js +0 -21
- package/module/helpers/internalForBigInt.js +0 -245
- package/module/helpers/types.js +0 -21
- package/module/helpers/vue-query.js +0 -87
- package/module/protod/proto-download.js +0 -55
- package/src/contracts/generate.ts +0 -33
- package/src/contracts/install.ts +0 -118
- package/src/contracts/message-composer.ts +0 -34
- package/src/contracts/react-query.ts +0 -33
- package/src/contracts/recoil.ts +0 -32
- package/src/generators/create-cosmwasm-bundle.ts +0 -17
- package/src/utils/contracts.ts +0 -37
- package/types/codegen/cosmos/orm/module/v1alpha1/module.d.ts +0 -43
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
|
|
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.
|
|
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;
|
|
@@ -4,12 +4,12 @@ exports.getHelperFuncTypesForInterface = void 0;
|
|
|
4
4
|
const getHelperFuncTypesForInterface = (options) => {
|
|
5
5
|
return `
|
|
6
6
|
import { HttpEndpoint } from "@interchainjs/types";
|
|
7
|
-
import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}"
|
|
8
|
-
import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}"
|
|
9
|
-
import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}"
|
|
10
|
-
import { TelescopeGeneratedCodec, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}"
|
|
11
|
-
import { toConverters, toEncoders } from "@interchainjs/cosmos
|
|
12
|
-
import { ISigningClient } from "@interchainjs/cosmos
|
|
7
|
+
import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
|
|
8
|
+
import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}";` : ''}
|
|
9
|
+
import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
|
|
10
|
+
import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}";` : ''}${!options.isGeneratingCosmosTypes ? `
|
|
11
|
+
import { toConverters, toEncoders } from "@interchainjs/cosmos";
|
|
12
|
+
import { ISigningClient } from "@interchainjs/cosmos";` : ''}
|
|
13
13
|
|
|
14
14
|
export interface QueryBuilderOptions<TReq, TRes> {
|
|
15
15
|
encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter
|
|
@@ -61,7 +61,7 @@ export function buildTx<TMsg>(opts: TxBuilderOptions) {
|
|
|
61
61
|
message: TMsg | TMsg[],
|
|
62
62
|
fee: StdFee | 'auto',
|
|
63
63
|
memo: string
|
|
64
|
-
): Promise<
|
|
64
|
+
): Promise<DeliverTxResponse> => {
|
|
65
65
|
if (!client) throw new Error("SigningClient is not initialized");
|
|
66
66
|
|
|
67
67
|
//register all related encoders and converters
|
|
@@ -4,12 +4,12 @@ exports.getHelperFuncTypes = void 0;
|
|
|
4
4
|
const getHelperFuncTypes = (options) => {
|
|
5
5
|
return `
|
|
6
6
|
import { HttpEndpoint } from "@interchainjs/types";
|
|
7
|
-
import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}"
|
|
8
|
-
import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}"
|
|
9
|
-
import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}"
|
|
10
|
-
import { TelescopeGeneratedCodec, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}"
|
|
11
|
-
import { toConverters, toEncoders } from "@interchainjs/cosmos
|
|
12
|
-
import { ISigningClient } from "@interchainjs/cosmos
|
|
7
|
+
import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
|
|
8
|
+
import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}";` : ''}
|
|
9
|
+
import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
|
|
10
|
+
import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}";` : ''}${!options.isGeneratingCosmosTypes ? `
|
|
11
|
+
import { toConverters, toEncoders } from "@interchainjs/cosmos";
|
|
12
|
+
import { ISigningClient } from "@interchainjs/cosmos";` : ''}
|
|
13
13
|
|
|
14
14
|
export interface QueryBuilderOptions<TReq, TRes> {
|
|
15
15
|
encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter
|
|
@@ -54,7 +54,7 @@ export function buildTx<TMsg>(opts: TxBuilderOptions) {
|
|
|
54
54
|
message: TMsg | TMsg[],
|
|
55
55
|
fee: StdFee | 'auto',
|
|
56
56
|
memo: string
|
|
57
|
-
): Promise<
|
|
57
|
+
): Promise<DeliverTxResponse> => {
|
|
58
58
|
if (!client) throw new Error("SigningClient is not initialized");
|
|
59
59
|
|
|
60
60
|
//register all related encoders and converters
|
|
@@ -8,9 +8,9 @@ ${options.useInterchainJs ? '' : `import { OfflineSigner } from "@cosmjs/proto-s
|
|
|
8
8
|
import { HttpEndpoint } from "${options.useInterchainJs ? "@interchainjs/types" : "@cosmjs/tendermint-rpc"}";
|
|
9
9
|
${options.useInterchainJs ? `
|
|
10
10
|
|
|
11
|
-
import { Event, Attribute } from "@interchainjs/types";
|
|
12
|
-
|
|
11
|
+
import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types";
|
|
13
12
|
|
|
13
|
+
export type { DeliverTxResponse }
|
|
14
14
|
|
|
15
15
|
` : ''}
|
|
16
16
|
export type ProtoMsg = Omit<Any, "typeUrl"> & { typeUrl: any };
|
|
@@ -105,7 +105,41 @@ export interface Event {
|
|
|
105
105
|
attributes: readonly Attribute[];
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
/**
|
|
109
|
+
* The response after successfully broadcasting a transaction.
|
|
110
|
+
* Success or failure refer to the execution result.
|
|
111
|
+
*/
|
|
112
|
+
export interface DeliverTxResponse {
|
|
113
|
+
height: number;
|
|
114
|
+
/** The position of the transaction within the block. This is a 0-based index. */
|
|
115
|
+
txIndex: number;
|
|
116
|
+
/** Error code. The transaction suceeded if and only if code is 0. */
|
|
117
|
+
code: number;
|
|
118
|
+
transactionHash: string;
|
|
119
|
+
events: readonly Event[];
|
|
120
|
+
/**
|
|
121
|
+
* A string-based log document.
|
|
122
|
+
*
|
|
123
|
+
* This currently seems to merge attributes of multiple events into one event per type
|
|
124
|
+
* (https://github.com/tendermint/tendermint/issues/9595). You might want to use the \`events\`
|
|
125
|
+
* field instead.
|
|
126
|
+
*/
|
|
127
|
+
rawLog?: string;
|
|
128
|
+
/** @deprecated Use \`msgResponses\` instead. */
|
|
129
|
+
data?: readonly MsgData[];
|
|
130
|
+
/**
|
|
131
|
+
* The message responses of the [TxMsgData](https://github.com/cosmos/cosmos-sdk/blob/v0.46.3/proto/cosmos/base/abci/v1beta1/abci.proto#L128-L140)
|
|
132
|
+
* as \`Any\`s.
|
|
133
|
+
* This field is an empty list for chains running Cosmos SDK < 0.46.
|
|
134
|
+
*/
|
|
135
|
+
msgResponses: Array<{
|
|
136
|
+
typeUrl: string;
|
|
137
|
+
value: Uint8Array;
|
|
138
|
+
}>;
|
|
139
|
+
gasUsed: bigint;
|
|
140
|
+
gasWanted: bigint;
|
|
141
|
+
origin?: any;
|
|
142
|
+
}
|
|
109
143
|
`}
|
|
110
144
|
export interface TxRpc {
|
|
111
145
|
request(
|
|
@@ -118,7 +152,7 @@ export interface TxRpc {
|
|
|
118
152
|
messages: EncodeObject[],
|
|
119
153
|
fee: StdFee | "auto" | number,
|
|
120
154
|
memo: string
|
|
121
|
-
): Promise<
|
|
155
|
+
): Promise<DeliverTxResponse>;
|
|
122
156
|
}
|
|
123
157
|
${options.useInterchainJs ? '' : `
|
|
124
158
|
export interface SigningClientParams {
|
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 };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export const getHelperFuncTypesForInterface = (options) => {
|
|
2
2
|
return `
|
|
3
3
|
import { HttpEndpoint } from "@interchainjs/types";
|
|
4
|
-
import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}"
|
|
5
|
-
import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}"
|
|
6
|
-
import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}"
|
|
7
|
-
import { TelescopeGeneratedCodec, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}"
|
|
8
|
-
import { toConverters, toEncoders } from "@interchainjs/cosmos
|
|
9
|
-
import { ISigningClient } from "@interchainjs/cosmos
|
|
4
|
+
import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
|
|
5
|
+
import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}";` : ''}
|
|
6
|
+
import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
|
|
7
|
+
import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}";` : ''}${!options.isGeneratingCosmosTypes ? `
|
|
8
|
+
import { toConverters, toEncoders } from "@interchainjs/cosmos";
|
|
9
|
+
import { ISigningClient } from "@interchainjs/cosmos";` : ''}
|
|
10
10
|
|
|
11
11
|
export interface QueryBuilderOptions<TReq, TRes> {
|
|
12
12
|
encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter
|
|
@@ -58,7 +58,7 @@ export function buildTx<TMsg>(opts: TxBuilderOptions) {
|
|
|
58
58
|
message: TMsg | TMsg[],
|
|
59
59
|
fee: StdFee | 'auto',
|
|
60
60
|
memo: string
|
|
61
|
-
): Promise<
|
|
61
|
+
): Promise<DeliverTxResponse> => {
|
|
62
62
|
if (!client) throw new Error("SigningClient is not initialized");
|
|
63
63
|
|
|
64
64
|
//register all related encoders and converters
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export const getHelperFuncTypes = (options) => {
|
|
2
2
|
return `
|
|
3
3
|
import { HttpEndpoint } from "@interchainjs/types";
|
|
4
|
-
import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}"
|
|
5
|
-
import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}"
|
|
6
|
-
import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}"
|
|
7
|
-
import { TelescopeGeneratedCodec, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}"
|
|
8
|
-
import { toConverters, toEncoders } from "@interchainjs/cosmos
|
|
9
|
-
import { ISigningClient } from "@interchainjs/cosmos
|
|
4
|
+
import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
|
|
5
|
+
import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}";` : ''}
|
|
6
|
+
import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
|
|
7
|
+
import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}";` : ''}${!options.isGeneratingCosmosTypes ? `
|
|
8
|
+
import { toConverters, toEncoders } from "@interchainjs/cosmos";
|
|
9
|
+
import { ISigningClient } from "@interchainjs/cosmos";` : ''}
|
|
10
10
|
|
|
11
11
|
export interface QueryBuilderOptions<TReq, TRes> {
|
|
12
12
|
encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter
|
|
@@ -51,7 +51,7 @@ export function buildTx<TMsg>(opts: TxBuilderOptions) {
|
|
|
51
51
|
message: TMsg | TMsg[],
|
|
52
52
|
fee: StdFee | 'auto',
|
|
53
53
|
memo: string
|
|
54
|
-
): Promise<
|
|
54
|
+
): Promise<DeliverTxResponse> => {
|
|
55
55
|
if (!client) throw new Error("SigningClient is not initialized");
|
|
56
56
|
|
|
57
57
|
//register all related encoders and converters
|
|
@@ -5,9 +5,9 @@ ${options.useInterchainJs ? '' : `import { OfflineSigner } from "@cosmjs/proto-s
|
|
|
5
5
|
import { HttpEndpoint } from "${options.useInterchainJs ? "@interchainjs/types" : "@cosmjs/tendermint-rpc"}";
|
|
6
6
|
${options.useInterchainJs ? `
|
|
7
7
|
|
|
8
|
-
import { Event, Attribute } from "@interchainjs/types";
|
|
9
|
-
|
|
8
|
+
import { DeliverTxResponse, Event, Attribute } from "@interchainjs/types";
|
|
10
9
|
|
|
10
|
+
export type { DeliverTxResponse }
|
|
11
11
|
|
|
12
12
|
` : ''}
|
|
13
13
|
export type ProtoMsg = Omit<Any, "typeUrl"> & { typeUrl: any };
|
|
@@ -102,7 +102,41 @@ export interface Event {
|
|
|
102
102
|
attributes: readonly Attribute[];
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
/**
|
|
106
|
+
* The response after successfully broadcasting a transaction.
|
|
107
|
+
* Success or failure refer to the execution result.
|
|
108
|
+
*/
|
|
109
|
+
export interface DeliverTxResponse {
|
|
110
|
+
height: number;
|
|
111
|
+
/** The position of the transaction within the block. This is a 0-based index. */
|
|
112
|
+
txIndex: number;
|
|
113
|
+
/** Error code. The transaction suceeded if and only if code is 0. */
|
|
114
|
+
code: number;
|
|
115
|
+
transactionHash: string;
|
|
116
|
+
events: readonly Event[];
|
|
117
|
+
/**
|
|
118
|
+
* A string-based log document.
|
|
119
|
+
*
|
|
120
|
+
* This currently seems to merge attributes of multiple events into one event per type
|
|
121
|
+
* (https://github.com/tendermint/tendermint/issues/9595). You might want to use the \`events\`
|
|
122
|
+
* field instead.
|
|
123
|
+
*/
|
|
124
|
+
rawLog?: string;
|
|
125
|
+
/** @deprecated Use \`msgResponses\` instead. */
|
|
126
|
+
data?: readonly MsgData[];
|
|
127
|
+
/**
|
|
128
|
+
* 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)
|
|
129
|
+
* as \`Any\`s.
|
|
130
|
+
* This field is an empty list for chains running Cosmos SDK < 0.46.
|
|
131
|
+
*/
|
|
132
|
+
msgResponses: Array<{
|
|
133
|
+
typeUrl: string;
|
|
134
|
+
value: Uint8Array;
|
|
135
|
+
}>;
|
|
136
|
+
gasUsed: bigint;
|
|
137
|
+
gasWanted: bigint;
|
|
138
|
+
origin?: any;
|
|
139
|
+
}
|
|
106
140
|
`}
|
|
107
141
|
export interface TxRpc {
|
|
108
142
|
request(
|
|
@@ -115,7 +149,7 @@ export interface TxRpc {
|
|
|
115
149
|
messages: EncodeObject[],
|
|
116
150
|
fee: StdFee | "auto" | number,
|
|
117
151
|
memo: string
|
|
118
|
-
): Promise<
|
|
152
|
+
): Promise<DeliverTxResponse>;
|
|
119
153
|
}
|
|
120
154
|
${options.useInterchainJs ? '' : `
|
|
121
155
|
export interface SigningClientParams {
|
package/module/telescope.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperweb/telescope",
|
|
3
|
-
"version": "2.0.
|
|
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.
|
|
94
|
-
"@cosmology/proto-parser": "^2.0.
|
|
95
|
-
"@cosmology/types": "^2.0.
|
|
96
|
-
"@cosmology/utils": "^2.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": "
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 };
|
|
@@ -3,12 +3,12 @@ import { TelescopeOptions } from "@cosmology/types";
|
|
|
3
3
|
export const getHelperFuncTypesForInterface = (options: TelescopeOptions) => {
|
|
4
4
|
return `
|
|
5
5
|
import { HttpEndpoint } from "@interchainjs/types";
|
|
6
|
-
import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}"
|
|
7
|
-
import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}"
|
|
8
|
-
import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}"
|
|
9
|
-
import { TelescopeGeneratedCodec, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}"
|
|
10
|
-
import { toConverters, toEncoders } from "@interchainjs/cosmos
|
|
11
|
-
import { ISigningClient } from "@interchainjs/cosmos
|
|
6
|
+
import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
|
|
7
|
+
import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}";` : ''}
|
|
8
|
+
import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
|
|
9
|
+
import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}";` : ''}${!options.isGeneratingCosmosTypes ? `
|
|
10
|
+
import { toConverters, toEncoders } from "@interchainjs/cosmos";
|
|
11
|
+
import { ISigningClient } from "@interchainjs/cosmos";` : ''}
|
|
12
12
|
|
|
13
13
|
export interface QueryBuilderOptions<TReq, TRes> {
|
|
14
14
|
encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter
|
|
@@ -60,7 +60,7 @@ export function buildTx<TMsg>(opts: TxBuilderOptions) {
|
|
|
60
60
|
message: TMsg | TMsg[],
|
|
61
61
|
fee: StdFee | 'auto',
|
|
62
62
|
memo: string
|
|
63
|
-
): Promise<
|
|
63
|
+
): Promise<DeliverTxResponse> => {
|
|
64
64
|
if (!client) throw new Error("SigningClient is not initialized");
|
|
65
65
|
|
|
66
66
|
//register all related encoders and converters
|
|
@@ -3,12 +3,12 @@ import { TelescopeOptions } from "@cosmology/types";
|
|
|
3
3
|
export const getHelperFuncTypes = (options: TelescopeOptions) => {
|
|
4
4
|
return `
|
|
5
5
|
import { HttpEndpoint } from "@interchainjs/types";
|
|
6
|
-
import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}"
|
|
7
|
-
import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}"
|
|
8
|
-
import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}"
|
|
9
|
-
import { TelescopeGeneratedCodec, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}"
|
|
10
|
-
import { toConverters, toEncoders } from "@interchainjs/cosmos
|
|
11
|
-
import { ISigningClient } from "@interchainjs/cosmos
|
|
6
|
+
import { BinaryReader, BinaryWriter } from "./binary${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
|
|
7
|
+
import { getRpcClient } from "./extern${options.restoreImportExtension ?? ""}";` : ''}
|
|
8
|
+
import { isRpc, Rpc } from "./helpers${options.restoreImportExtension ?? ""}";${!options.isGeneratingCosmosTypes ? `
|
|
9
|
+
import { TelescopeGeneratedCodec, DeliverTxResponse, Message, StdFee } from "./types${options.restoreImportExtension ?? ""}";` : ''}${!options.isGeneratingCosmosTypes ? `
|
|
10
|
+
import { toConverters, toEncoders } from "@interchainjs/cosmos";
|
|
11
|
+
import { ISigningClient } from "@interchainjs/cosmos";` : ''}
|
|
12
12
|
|
|
13
13
|
export interface QueryBuilderOptions<TReq, TRes> {
|
|
14
14
|
encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter
|
|
@@ -53,7 +53,7 @@ export function buildTx<TMsg>(opts: TxBuilderOptions) {
|
|
|
53
53
|
message: TMsg | TMsg[],
|
|
54
54
|
fee: StdFee | 'auto',
|
|
55
55
|
memo: string
|
|
56
|
-
): Promise<
|
|
56
|
+
): Promise<DeliverTxResponse> => {
|
|
57
57
|
if (!client) throw new Error("SigningClient is not initialized");
|
|
58
58
|
|
|
59
59
|
//register all related encoders and converters
|