@cosmwasm/ts-codegen 1.7.2 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/builder/builder.d.ts +1 -1
- package/builder/builder.js +3 -3
- package/cli.d.ts +1 -1
- package/commands/create-boilerplate.d.ts +1 -1
- package/commands/generate.d.ts +1 -1
- package/commands/install.d.ts +1 -1
- package/esm/builder/builder.js +1 -1
- package/esm/plugins/client.js +2 -2
- package/esm/plugins/message-builder.js +2 -2
- package/esm/plugins/message-composer.js +2 -2
- package/esm/plugins/plugin-base.js +1 -1
- package/esm/plugins/provider-bundle.js +2 -2
- package/esm/plugins/provider.js +2 -2
- package/esm/plugins/react-query.js +2 -2
- package/esm/plugins/recoil.js +2 -2
- package/esm/plugins/types.js +1 -1
- package/helpers/create-helpers.d.ts +1 -1
- package/package.json +5 -5
- package/plugins/client.d.ts +1 -1
- package/plugins/client.js +4 -4
- package/plugins/message-builder.d.ts +1 -1
- package/plugins/message-builder.js +5 -5
- package/plugins/message-composer.d.ts +1 -1
- package/plugins/message-composer.js +4 -4
- package/plugins/plugin-base.d.ts +1 -1
- package/plugins/plugin-base.js +2 -2
- package/plugins/provider-bundle.d.ts +1 -1
- package/plugins/provider-bundle.js +3 -3
- package/plugins/provider.d.ts +1 -1
- package/plugins/provider.js +3 -3
- package/plugins/react-query.d.ts +1 -1
- package/plugins/react-query.js +4 -4
- package/plugins/recoil.d.ts +1 -1
- package/plugins/recoil.js +3 -3
- package/plugins/types.d.ts +1 -1
- package/plugins/types.js +2 -2
- package/utils/contracts.d.ts +1 -1
- package/utils/schemas.d.ts +2 -2
package/README.md
CHANGED
@@ -601,7 +601,7 @@ yarn test:watch
|
|
601
601
|
|
602
602
|
### Working with ASTs
|
603
603
|
|
604
|
-
See the [docs](https://github.com/CosmWasm/ts-codegen/blob/main/packages/ast/README.md) in the
|
604
|
+
See the [docs](https://github.com/CosmWasm/ts-codegen/blob/main/packages/ast/README.md) in the `@cosmwasm/ts-codegen-ast` package.
|
605
605
|
|
606
606
|
## Related
|
607
607
|
|
package/builder/builder.d.ts
CHANGED
package/builder/builder.js
CHANGED
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
27
|
};
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
29
|
exports.TSBuilder = void 0;
|
30
|
-
const
|
30
|
+
const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
|
31
31
|
const header_1 = require("../utils/header");
|
32
32
|
const path_1 = require("path");
|
33
33
|
const fs_1 = require("fs");
|
@@ -79,7 +79,7 @@ class TSBuilder {
|
|
79
79
|
outPath;
|
80
80
|
options;
|
81
81
|
plugins = [];
|
82
|
-
builderContext = new
|
82
|
+
builderContext = new ts_codegen_ast_1.BuilderContext();
|
83
83
|
files = [];
|
84
84
|
loadDefaultPlugins() {
|
85
85
|
this.plugins.push(new types_1.TypesPlugin(this.options), new client_1.ClientPlugin(this.options), new message_composer_1.MessageComposerPlugin(this.options), new react_query_1.ReactQueryPlugin(this.options), new recoil_1.RecoilPlugin(this.options), new message_builder_1.MessageBuilderPlugin(this.options), new provider_1.ContractsContextProviderPlugin(this.options), new provider_bundle_1.ContractsProviderBundlePlugin(this.options));
|
@@ -87,7 +87,7 @@ class TSBuilder {
|
|
87
87
|
constructor({ contracts, outPath, options, plugins }) {
|
88
88
|
this.contracts = contracts;
|
89
89
|
this.outPath = outPath;
|
90
|
-
this.options = (0, deepmerge_1.default)((0, deepmerge_1.default)(
|
90
|
+
this.options = (0, deepmerge_1.default)((0, deepmerge_1.default)(ts_codegen_ast_1.defaultOptions, defaultOpts), options ?? {});
|
91
91
|
this.loadDefaultPlugins();
|
92
92
|
if (plugins && plugins.length) {
|
93
93
|
this.plugins.push(...plugins);
|
package/cli.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import { MinimistArgs } from '@
|
1
|
+
import { MinimistArgs } from '@cosmwasm/ts-codegen-types';
|
2
2
|
export declare const cli: (argv: MinimistArgs) => Promise<void>;
|
package/commands/generate.d.ts
CHANGED
package/commands/install.d.ts
CHANGED
package/esm/builder/builder.js
CHANGED
package/esm/plugins/client.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { pascal } from "case";
|
2
|
-
import * as w from "
|
2
|
+
import * as w from "@cosmwasm/ts-codegen-ast";
|
3
3
|
import { findExecuteMsg, findAndParseTypes, findQueryMsg } from "../utils";
|
4
|
-
import { RenderContext, getMessageProperties, } from "
|
4
|
+
import { RenderContext, getMessageProperties, } from "@cosmwasm/ts-codegen-ast";
|
5
5
|
import { BuilderPluginBase } from "./plugin-base";
|
6
6
|
export class ClientPlugin extends BuilderPluginBase {
|
7
7
|
initContext(contract, options) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { pascal } from 'case';
|
2
|
-
import * as w from '
|
2
|
+
import * as w from '@cosmwasm/ts-codegen-ast';
|
3
3
|
import { findAndParseTypes, findQueryMsg, findExecuteMsg } from '../utils';
|
4
|
-
import { getMessageProperties, RenderContext } from '
|
4
|
+
import { getMessageProperties, RenderContext } from '@cosmwasm/ts-codegen-ast';
|
5
5
|
import { BuilderPluginBase } from './plugin-base';
|
6
6
|
export class MessageBuilderPlugin extends BuilderPluginBase {
|
7
7
|
initContext(contract, options) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { pascal } from "case";
|
2
|
-
import * as w from "
|
2
|
+
import * as w from "@cosmwasm/ts-codegen-ast";
|
3
3
|
import { findAndParseTypes, findExecuteMsg } from "../utils";
|
4
|
-
import { getMessageProperties, RenderContext, } from "
|
4
|
+
import { getMessageProperties, RenderContext, } from "@cosmwasm/ts-codegen-ast";
|
5
5
|
import { BuilderPluginBase } from "./plugin-base";
|
6
6
|
export class MessageComposerPlugin extends BuilderPluginBase {
|
7
7
|
initContext(contract, options) {
|
@@ -2,7 +2,7 @@ import { sync as mkdirp } from "mkdirp";
|
|
2
2
|
import { join } from "path";
|
3
3
|
import { writeFileSync } from "fs";
|
4
4
|
import { header } from "../utils/header";
|
5
|
-
import { defaultOptions } from "
|
5
|
+
import { defaultOptions } from "@cosmwasm/ts-codegen-ast";
|
6
6
|
import generate from "@babel/generator";
|
7
7
|
import * as t from "@babel/types";
|
8
8
|
import deepmerge from "deepmerge";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { pascal } from "case";
|
2
|
-
import * as w from "
|
3
|
-
import { RenderContext } from "
|
2
|
+
import * as w from "@cosmwasm/ts-codegen-ast";
|
3
|
+
import { RenderContext } from "@cosmwasm/ts-codegen-ast";
|
4
4
|
import { BuilderPluginBase } from "./plugin-base";
|
5
5
|
import { GetLocalBaseNameByContractName } from "./provider";
|
6
6
|
export class ContractsProviderBundlePlugin extends BuilderPluginBase {
|
package/esm/plugins/provider.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { pascal } from "case";
|
2
|
-
import * as w from "
|
3
|
-
import { RenderContext } from "
|
2
|
+
import * as w from "@cosmwasm/ts-codegen-ast";
|
3
|
+
import { RenderContext } from "@cosmwasm/ts-codegen-ast";
|
4
4
|
import { BuilderPluginBase } from "./plugin-base";
|
5
5
|
export const GetLocalNameByContractName = (name) => `${pascal(name)}.provider.ts`;
|
6
6
|
export const GetLocalBaseNameByContractName = (name) => `${pascal(name)}.provider`;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { pascal } from 'case';
|
2
|
-
import * as w from '
|
2
|
+
import * as w from '@cosmwasm/ts-codegen-ast';
|
3
3
|
import { findAndParseTypes, findExecuteMsg, findQueryMsg } from '../utils';
|
4
|
-
import { getMessageProperties, RenderContext } from '
|
4
|
+
import { getMessageProperties, RenderContext } from '@cosmwasm/ts-codegen-ast';
|
5
5
|
import { BuilderPluginBase } from './plugin-base';
|
6
6
|
export class ReactQueryPlugin extends BuilderPluginBase {
|
7
7
|
initContext(contract, options) {
|
package/esm/plugins/recoil.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { pascal } from 'case';
|
2
|
-
import * as w from '
|
2
|
+
import * as w from '@cosmwasm/ts-codegen-ast';
|
3
3
|
import { findAndParseTypes, findQueryMsg } from '../utils';
|
4
|
-
import { RenderContext } from '
|
4
|
+
import { RenderContext } from '@cosmwasm/ts-codegen-ast';
|
5
5
|
import { BuilderPluginBase } from './plugin-base';
|
6
6
|
export class RecoilPlugin extends BuilderPluginBase {
|
7
7
|
utils = {
|
package/esm/plugins/types.js
CHANGED
@@ -2,7 +2,7 @@ import * as t from '@babel/types';
|
|
2
2
|
import { clean } from '../utils/clean';
|
3
3
|
import { pascal } from 'case';
|
4
4
|
import { findExecuteMsg, findAndParseTypes } from '../utils';
|
5
|
-
import { RenderContext } from '
|
5
|
+
import { RenderContext } from '@cosmwasm/ts-codegen-ast';
|
6
6
|
import { BuilderPluginBase } from './plugin-base';
|
7
7
|
export class TypesPlugin extends BuilderPluginBase {
|
8
8
|
initContext(contract, options) {
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { BuilderFile, TSBuilderInput } from "../builder";
|
2
|
-
import { BuilderContext } from "
|
2
|
+
import { BuilderContext } from "@cosmwasm/ts-codegen-ast";
|
3
3
|
export declare const createHelpers: (input: TSBuilderInput, builderContext: BuilderContext) => BuilderFile[];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@cosmwasm/ts-codegen",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.8.1",
|
4
4
|
"description": "@cosmwasm/ts-codegen converts your CosmWasm smart contracts into dev-friendly TypeScript classes so you can focus on shipping code.",
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
6
6
|
"homepage": "https://github.com/cosmwasm/ts-codegen",
|
@@ -42,7 +42,8 @@
|
|
42
42
|
"@babel/generator": "7.24.4",
|
43
43
|
"@babel/traverse": "7.24.1",
|
44
44
|
"@babel/types": "7.24.0",
|
45
|
-
"@
|
45
|
+
"@cosmwasm/ts-codegen-ast": "^1.5.1",
|
46
|
+
"@cosmwasm/ts-codegen-types": "^1.2.0",
|
46
47
|
"@pyramation/json-schema-to-typescript": " 11.0.4",
|
47
48
|
"@types/rimraf": "3.0.2",
|
48
49
|
"@types/shelljs": "0.8.15",
|
@@ -57,8 +58,7 @@
|
|
57
58
|
"nested-obj": "0.0.1",
|
58
59
|
"parse-package-name": "1.0.0",
|
59
60
|
"rimraf": "3.0.2",
|
60
|
-
"shelljs": "0.8.5"
|
61
|
-
"wasm-ast-types": "^1.4.1"
|
61
|
+
"shelljs": "0.8.5"
|
62
62
|
},
|
63
63
|
"keywords": [
|
64
64
|
"cosmwasm",
|
@@ -66,5 +66,5 @@
|
|
66
66
|
"smart contracts",
|
67
67
|
"codegen"
|
68
68
|
],
|
69
|
-
"gitHead": "
|
69
|
+
"gitHead": "7c8ccc3f6066feecc46d3cb16148cd4ae057213f"
|
70
70
|
}
|
package/plugins/client.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { RenderContext, ContractInfo, RenderContextBase, RenderOptions } from "
|
1
|
+
import { RenderContext, ContractInfo, RenderContextBase, RenderOptions } from "@cosmwasm/ts-codegen-ast";
|
2
2
|
import { BuilderFileType } from "../builder";
|
3
3
|
import { BuilderPluginBase } from "./plugin-base";
|
4
4
|
export declare class ClientPlugin extends BuilderPluginBase<RenderOptions> {
|
package/plugins/client.js
CHANGED
@@ -25,13 +25,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
26
|
exports.ClientPlugin = void 0;
|
27
27
|
const case_1 = require("case");
|
28
|
-
const w = __importStar(require("
|
28
|
+
const w = __importStar(require("@cosmwasm/ts-codegen-ast"));
|
29
29
|
const utils_1 = require("../utils");
|
30
|
-
const
|
30
|
+
const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
|
31
31
|
const plugin_base_1 = require("./plugin-base");
|
32
32
|
class ClientPlugin extends plugin_base_1.BuilderPluginBase {
|
33
33
|
initContext(contract, options) {
|
34
|
-
return new
|
34
|
+
return new ts_codegen_ast_1.RenderContext(contract, options, this.builder?.builderContext);
|
35
35
|
}
|
36
36
|
async doRender(name, context) {
|
37
37
|
const { enabled } = this.options.client;
|
@@ -60,7 +60,7 @@ class ClientPlugin extends plugin_base_1.BuilderPluginBase {
|
|
60
60
|
}
|
61
61
|
// execute messages
|
62
62
|
if (ExecuteMsg) {
|
63
|
-
const children = (0,
|
63
|
+
const children = (0, ts_codegen_ast_1.getMessageProperties)(ExecuteMsg);
|
64
64
|
if (children.length > 0) {
|
65
65
|
Client = (0, case_1.pascal)(`${name}Client`);
|
66
66
|
Instance = (0, case_1.pascal)(`${name}Interface`);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { RenderContext, RenderContextBase, ContractInfo, RenderOptions } from '
|
1
|
+
import { RenderContext, RenderContextBase, ContractInfo, RenderOptions } from '@cosmwasm/ts-codegen-ast';
|
2
2
|
import { BuilderFileType } from '../builder';
|
3
3
|
import { BuilderPluginBase } from './plugin-base';
|
4
4
|
export declare class MessageBuilderPlugin extends BuilderPluginBase<RenderOptions> {
|
@@ -25,13 +25,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
26
|
exports.MessageBuilderPlugin = void 0;
|
27
27
|
const case_1 = require("case");
|
28
|
-
const w = __importStar(require("
|
28
|
+
const w = __importStar(require("@cosmwasm/ts-codegen-ast"));
|
29
29
|
const utils_1 = require("../utils");
|
30
|
-
const
|
30
|
+
const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
|
31
31
|
const plugin_base_1 = require("./plugin-base");
|
32
32
|
class MessageBuilderPlugin extends plugin_base_1.BuilderPluginBase {
|
33
33
|
initContext(contract, options) {
|
34
|
-
return new
|
34
|
+
return new ts_codegen_ast_1.RenderContext(contract, options, this.builder?.builderContext);
|
35
35
|
}
|
36
36
|
async doRender(name, context) {
|
37
37
|
const { enabled } = this.options.messageBuilder;
|
@@ -48,7 +48,7 @@ class MessageBuilderPlugin extends plugin_base_1.BuilderPluginBase {
|
|
48
48
|
body.push(w.importStmt(['CamelCasedProperties'], 'type-fest'));
|
49
49
|
// execute messages
|
50
50
|
if (ExecuteMsg) {
|
51
|
-
const children = (0,
|
51
|
+
const children = (0, ts_codegen_ast_1.getMessageProperties)(ExecuteMsg);
|
52
52
|
if (children.length > 0) {
|
53
53
|
const className = (0, case_1.pascal)(`${name}ExecuteMsgBuilder`);
|
54
54
|
body.push(w.createMessageBuilderClass(context, className, ExecuteMsg));
|
@@ -57,7 +57,7 @@ class MessageBuilderPlugin extends plugin_base_1.BuilderPluginBase {
|
|
57
57
|
const QueryMsg = (0, utils_1.findQueryMsg)(schemas);
|
58
58
|
// query messages
|
59
59
|
if (QueryMsg) {
|
60
|
-
const children = (0,
|
60
|
+
const children = (0, ts_codegen_ast_1.getMessageProperties)(QueryMsg);
|
61
61
|
if (children.length > 0) {
|
62
62
|
const className = (0, case_1.pascal)(`${name}QueryMsgBuilder`);
|
63
63
|
body.push(w.createMessageBuilderClass(context, className, QueryMsg));
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ContractInfo, RenderContextBase, RenderContext, RenderOptions } from "
|
1
|
+
import { ContractInfo, RenderContextBase, RenderContext, RenderOptions } from "@cosmwasm/ts-codegen-ast";
|
2
2
|
import { BuilderFileType } from "../builder";
|
3
3
|
import { BuilderPluginBase } from "./plugin-base";
|
4
4
|
export declare class MessageComposerPlugin extends BuilderPluginBase<RenderOptions> {
|
@@ -25,13 +25,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
26
|
exports.MessageComposerPlugin = void 0;
|
27
27
|
const case_1 = require("case");
|
28
|
-
const w = __importStar(require("
|
28
|
+
const w = __importStar(require("@cosmwasm/ts-codegen-ast"));
|
29
29
|
const utils_1 = require("../utils");
|
30
|
-
const
|
30
|
+
const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
|
31
31
|
const plugin_base_1 = require("./plugin-base");
|
32
32
|
class MessageComposerPlugin extends plugin_base_1.BuilderPluginBase {
|
33
33
|
initContext(contract, options) {
|
34
|
-
return new
|
34
|
+
return new ts_codegen_ast_1.RenderContext(contract, options, this.builder?.builderContext);
|
35
35
|
}
|
36
36
|
async doRender(name, context) {
|
37
37
|
const { enabled } = this.options.messageComposer;
|
@@ -47,7 +47,7 @@ class MessageComposerPlugin extends plugin_base_1.BuilderPluginBase {
|
|
47
47
|
body.push(w.importStmt(Object.keys(typeHash), `./${TypesFile}`));
|
48
48
|
// execute messages
|
49
49
|
if (ExecuteMsg) {
|
50
|
-
const children = (0,
|
50
|
+
const children = (0, ts_codegen_ast_1.getMessageProperties)(ExecuteMsg);
|
51
51
|
if (children.length > 0) {
|
52
52
|
const TheClass = (0, case_1.pascal)(`${name}MsgComposer`);
|
53
53
|
const Interface = (0, case_1.pascal)(`${name}Msg`);
|
package/plugins/plugin-base.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ContractInfo, UtilMapping, IContext } from "
|
1
|
+
import { ContractInfo, UtilMapping, IContext } from "@cosmwasm/ts-codegen-ast";
|
2
2
|
import { BuilderFile, BuilderFileType, TSBuilder } from "../builder";
|
3
3
|
/**
|
4
4
|
* IBuilderPlugin is a common plugin that render generated code.
|
package/plugins/plugin-base.js
CHANGED
@@ -31,7 +31,7 @@ const mkdirp_1 = require("mkdirp");
|
|
31
31
|
const path_1 = require("path");
|
32
32
|
const fs_1 = require("fs");
|
33
33
|
const header_1 = require("../utils/header");
|
34
|
-
const
|
34
|
+
const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
|
35
35
|
const generator_1 = __importDefault(require("@babel/generator"));
|
36
36
|
const t = __importStar(require("@babel/types"));
|
37
37
|
const deepmerge_1 = __importDefault(require("deepmerge"));
|
@@ -88,7 +88,7 @@ class BuilderPluginBase {
|
|
88
88
|
* get default options
|
89
89
|
*/
|
90
90
|
getDefaultOptions(opts) {
|
91
|
-
return (0, deepmerge_1.default)(
|
91
|
+
return (0, deepmerge_1.default)(ts_codegen_ast_1.defaultOptions, opts ?? {});
|
92
92
|
}
|
93
93
|
}
|
94
94
|
exports.BuilderPluginBase = BuilderPluginBase;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ContractInfo, RenderContextBase, RenderContext } from "
|
1
|
+
import { ContractInfo, RenderContextBase, RenderContext } from "@cosmwasm/ts-codegen-ast";
|
2
2
|
import { BuilderFileType, TSBuilderOptions } from "../builder";
|
3
3
|
import { BuilderPluginBase } from "./plugin-base";
|
4
4
|
export declare class ContractsProviderBundlePlugin extends BuilderPluginBase<TSBuilderOptions> {
|
@@ -25,8 +25,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
26
|
exports.ContractsProviderBundlePlugin = void 0;
|
27
27
|
const case_1 = require("case");
|
28
|
-
const w = __importStar(require("
|
29
|
-
const
|
28
|
+
const w = __importStar(require("@cosmwasm/ts-codegen-ast"));
|
29
|
+
const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
|
30
30
|
const plugin_base_1 = require("./plugin-base");
|
31
31
|
const provider_1 = require("./provider");
|
32
32
|
class ContractsProviderBundlePlugin extends plugin_base_1.BuilderPluginBase {
|
@@ -43,7 +43,7 @@ class ContractsProviderBundlePlugin extends plugin_base_1.BuilderPluginBase {
|
|
43
43
|
};
|
44
44
|
}
|
45
45
|
initContext(contract, options) {
|
46
|
-
return new
|
46
|
+
return new ts_codegen_ast_1.RenderContext(contract, options, this.builder?.builderContext);
|
47
47
|
}
|
48
48
|
async doRender(name, context) {
|
49
49
|
if (!this.options?.useContractsHook?.enabled) {
|
package/plugins/provider.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ContractInfo, RenderContextBase, RenderContext } from "
|
1
|
+
import { ContractInfo, RenderContextBase, RenderContext } from "@cosmwasm/ts-codegen-ast";
|
2
2
|
import { BuilderFileType, TSBuilderOptions } from "../builder";
|
3
3
|
import { BuilderPluginBase } from "./plugin-base";
|
4
4
|
export declare const GetLocalNameByContractName: (name: string) => string;
|
package/plugins/provider.js
CHANGED
@@ -25,8 +25,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
26
|
exports.ContractsContextProviderPlugin = exports.GetLocalBaseNameByContractName = exports.GetLocalNameByContractName = void 0;
|
27
27
|
const case_1 = require("case");
|
28
|
-
const w = __importStar(require("
|
29
|
-
const
|
28
|
+
const w = __importStar(require("@cosmwasm/ts-codegen-ast"));
|
29
|
+
const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
|
30
30
|
const plugin_base_1 = require("./plugin-base");
|
31
31
|
const GetLocalNameByContractName = (name) => `${(0, case_1.pascal)(name)}.provider.ts`;
|
32
32
|
exports.GetLocalNameByContractName = GetLocalNameByContractName;
|
@@ -42,7 +42,7 @@ class ContractsContextProviderPlugin extends plugin_base_1.BuilderPluginBase {
|
|
42
42
|
};
|
43
43
|
}
|
44
44
|
initContext(contract, options) {
|
45
|
-
return new
|
45
|
+
return new ts_codegen_ast_1.RenderContext(contract, options, this.builder?.builderContext);
|
46
46
|
}
|
47
47
|
async doRender(name, context) {
|
48
48
|
if (!this.options?.useContractsHook?.enabled) {
|
package/plugins/react-query.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ContractInfo, RenderOptions, RenderContextBase, RenderContext } from '
|
1
|
+
import { ContractInfo, RenderOptions, RenderContextBase, RenderContext } from '@cosmwasm/ts-codegen-ast';
|
2
2
|
import { BuilderFileType } from '../builder';
|
3
3
|
import { BuilderPluginBase } from './plugin-base';
|
4
4
|
export declare class ReactQueryPlugin extends BuilderPluginBase<RenderOptions> {
|
package/plugins/react-query.js
CHANGED
@@ -25,13 +25,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
26
|
exports.ReactQueryPlugin = void 0;
|
27
27
|
const case_1 = require("case");
|
28
|
-
const w = __importStar(require("
|
28
|
+
const w = __importStar(require("@cosmwasm/ts-codegen-ast"));
|
29
29
|
const utils_1 = require("../utils");
|
30
|
-
const
|
30
|
+
const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
|
31
31
|
const plugin_base_1 = require("./plugin-base");
|
32
32
|
class ReactQueryPlugin extends plugin_base_1.BuilderPluginBase {
|
33
33
|
initContext(contract, options) {
|
34
|
-
return new
|
34
|
+
return new ts_codegen_ast_1.RenderContext(contract, options, this.builder?.builderContext);
|
35
35
|
}
|
36
36
|
async doRender(name, context) {
|
37
37
|
const options = this.options.reactQuery;
|
@@ -55,7 +55,7 @@ class ReactQueryPlugin extends plugin_base_1.BuilderPluginBase {
|
|
55
55
|
const shouldGenerateMutationHooks = ExecuteMsg &&
|
56
56
|
options?.version === 'v4' &&
|
57
57
|
options?.mutations &&
|
58
|
-
(0,
|
58
|
+
(0, ts_codegen_ast_1.getMessageProperties)(ExecuteMsg).length > 0;
|
59
59
|
if (shouldGenerateMutationHooks) {
|
60
60
|
clientImports.push(ExecuteClient);
|
61
61
|
}
|
package/plugins/recoil.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ContractInfo, RenderContext, RenderContextBase, UtilMapping, RenderOptions } from '
|
1
|
+
import { ContractInfo, RenderContext, RenderContextBase, UtilMapping, RenderOptions } from '@cosmwasm/ts-codegen-ast';
|
2
2
|
import { BuilderFileType } from '../builder';
|
3
3
|
import { BuilderPluginBase } from './plugin-base';
|
4
4
|
export declare class RecoilPlugin extends BuilderPluginBase<RenderOptions> {
|
package/plugins/recoil.js
CHANGED
@@ -25,16 +25,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
26
|
exports.RecoilPlugin = void 0;
|
27
27
|
const case_1 = require("case");
|
28
|
-
const w = __importStar(require("
|
28
|
+
const w = __importStar(require("@cosmwasm/ts-codegen-ast"));
|
29
29
|
const utils_1 = require("../utils");
|
30
|
-
const
|
30
|
+
const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
|
31
31
|
const plugin_base_1 = require("./plugin-base");
|
32
32
|
class RecoilPlugin extends plugin_base_1.BuilderPluginBase {
|
33
33
|
utils = {
|
34
34
|
selectorFamily: 'recoil',
|
35
35
|
};
|
36
36
|
initContext(contract, options) {
|
37
|
-
return new
|
37
|
+
return new ts_codegen_ast_1.RenderContext(contract, options, this.builder?.builderContext);
|
38
38
|
}
|
39
39
|
async doRender(name, context) {
|
40
40
|
const { enabled } = this.options.recoil;
|
package/plugins/types.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ContractInfo, RenderContext, RenderContextBase, RenderOptions } from '
|
1
|
+
import { ContractInfo, RenderContext, RenderContextBase, RenderOptions } from '@cosmwasm/ts-codegen-ast';
|
2
2
|
import { BuilderFileType } from '../builder';
|
3
3
|
import { BuilderPluginBase } from './plugin-base';
|
4
4
|
export declare class TypesPlugin extends BuilderPluginBase<RenderOptions> {
|
package/plugins/types.js
CHANGED
@@ -28,11 +28,11 @@ const t = __importStar(require("@babel/types"));
|
|
28
28
|
const clean_1 = require("../utils/clean");
|
29
29
|
const case_1 = require("case");
|
30
30
|
const utils_1 = require("../utils");
|
31
|
-
const
|
31
|
+
const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
|
32
32
|
const plugin_base_1 = require("./plugin-base");
|
33
33
|
class TypesPlugin extends plugin_base_1.BuilderPluginBase {
|
34
34
|
initContext(contract, options) {
|
35
|
-
return new
|
35
|
+
return new ts_codegen_ast_1.RenderContext(contract, options, this.builder?.builderContext);
|
36
36
|
}
|
37
37
|
async doRender(name, context) {
|
38
38
|
const { enabled } = this.options.types;
|
package/utils/contracts.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import { ContractInfo } from "
|
1
|
+
import { ContractInfo } from "@cosmwasm/ts-codegen-ast";
|
2
2
|
export declare const createDefaultContractInfo: () => ContractInfo;
|
package/utils/schemas.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { ContractInfo } from '
|
2
|
-
import { ExecuteMsg, JSONSchema, QueryMsg } from '@
|
1
|
+
import { ContractInfo } from '@cosmwasm/ts-codegen-ast';
|
2
|
+
import { ExecuteMsg, JSONSchema, QueryMsg } from '@cosmwasm/ts-codegen-types';
|
3
3
|
interface ReadSchemaOpts {
|
4
4
|
schemaDir: string;
|
5
5
|
clean?: boolean;
|