@cosmwasm/ts-codegen 1.9.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/builder/builder.d.ts +1 -1
  2. package/builder/builder.js +12 -12
  3. package/cli.d.ts +1 -0
  4. package/cli.js +2 -2
  5. package/commands/create-boilerplate.d.ts +1 -0
  6. package/commands/create-boilerplate.js +1 -1
  7. package/commands/generate.d.ts +1 -0
  8. package/commands/generate.js +1 -2
  9. package/commands/install.d.ts +1 -0
  10. package/commands/install.js +5 -5
  11. package/esm/builder/builder.js +19 -19
  12. package/esm/bundler/bundler.js +1 -1
  13. package/esm/cli.js +2 -2
  14. package/esm/commands/create-boilerplate.js +1 -1
  15. package/esm/commands/generate.js +1 -2
  16. package/esm/commands/install.js +5 -5
  17. package/esm/file.js +2 -2
  18. package/esm/helpers/create-helpers.js +9 -9
  19. package/esm/index.js +1 -1
  20. package/esm/plugins/client.js +9 -9
  21. package/esm/plugins/index.js +7 -7
  22. package/esm/plugins/message-builder.js +2 -2
  23. package/esm/plugins/message-composer.js +9 -9
  24. package/esm/plugins/plugin-base.js +9 -9
  25. package/esm/plugins/provider-bundle.js +20 -20
  26. package/esm/plugins/provider.js +12 -12
  27. package/esm/plugins/react-query.js +2 -2
  28. package/esm/plugins/recoil.js +2 -2
  29. package/esm/plugins/types.js +3 -3
  30. package/esm/ts-codegen.js +1 -1
  31. package/esm/utils/clean.js +3 -3
  32. package/esm/utils/cleanse.js +7 -7
  33. package/esm/utils/files.js +15 -15
  34. package/esm/utils/header.js +1 -1
  35. package/esm/utils/package.js +2 -2
  36. package/esm/utils/parse.js +1 -1
  37. package/esm/utils/prompt.js +4 -4
  38. package/esm/utils/schemas.js +6 -3
  39. package/file.js +2 -2
  40. package/helpers/create-helpers.d.ts +2 -1
  41. package/helpers/create-helpers.js +6 -6
  42. package/index.d.ts +1 -1
  43. package/index.js +1 -1
  44. package/package.json +6 -5
  45. package/plugins/client.d.ts +3 -3
  46. package/plugins/client.js +6 -6
  47. package/plugins/index.d.ts +7 -7
  48. package/plugins/index.js +3 -3
  49. package/plugins/message-builder.d.ts +1 -1
  50. package/plugins/message-builder.js +2 -2
  51. package/plugins/message-composer.d.ts +3 -3
  52. package/plugins/message-composer.js +6 -6
  53. package/plugins/plugin-base.d.ts +4 -4
  54. package/plugins/plugin-base.js +6 -6
  55. package/plugins/provider-bundle.d.ts +3 -3
  56. package/plugins/provider-bundle.js +16 -16
  57. package/plugins/provider.d.ts +3 -3
  58. package/plugins/provider.js +9 -9
  59. package/plugins/react-query.d.ts +1 -1
  60. package/plugins/react-query.js +2 -2
  61. package/plugins/recoil.d.ts +1 -1
  62. package/plugins/recoil.js +2 -2
  63. package/plugins/types.js +2 -2
  64. package/ts-codegen.js +1 -1
  65. package/utils/clean.js +3 -3
  66. package/utils/cleanse.js +6 -6
  67. package/utils/contracts.d.ts +1 -0
  68. package/utils/files.d.ts +1 -1
  69. package/utils/files.js +11 -11
  70. package/utils/package.js +1 -1
  71. package/utils/parse.js +1 -1
  72. package/utils/prompt.d.ts +2 -2
  73. package/utils/prompt.js +4 -4
  74. package/utils/schemas.d.ts +1 -1
  75. package/utils/schemas.js +6 -3
@@ -1,9 +1,9 @@
1
- import { pascal } from "case";
1
+ import { pascal } from 'case';
2
2
  const cleanFor = (str) => {
3
3
  /*
4
- 1. look at first char after _for_
5
- 2. ONLY if you find capitals after, modify it
6
- */
4
+ 1. look at first char after _for_
5
+ 2. ONLY if you find capitals after, modify it
6
+ */
7
7
  while (/_[a-z]+_[A-Z]/.test(str)) {
8
8
  const m = str.match(/(_[a-z]+_)[A-Z]/);
9
9
  str = str.replace(m[1], pascal(m[1]));
@@ -17,7 +17,7 @@ const cleanNullable = (str) => {
17
17
  return str;
18
18
  };
19
19
  export const cleanse = (obj) => {
20
- var copy;
20
+ let copy;
21
21
  // Handle the 3 simple types, and null or undefined
22
22
  if (null == obj || 'object' != typeof obj)
23
23
  return obj;
@@ -30,7 +30,7 @@ export const cleanse = (obj) => {
30
30
  // Handle Array
31
31
  if (obj instanceof Array) {
32
32
  copy = [];
33
- for (var i = 0, len = obj.length; i < len; i++) {
33
+ for (let i = 0, len = obj.length; i < len; i++) {
34
34
  copy[i] = cleanse(obj[i]);
35
35
  }
36
36
  return copy;
@@ -45,7 +45,7 @@ export const cleanse = (obj) => {
45
45
  obj.type = 'string';
46
46
  }
47
47
  }
48
- for (var attr in obj) {
48
+ for (let attr in obj) {
49
49
  if (obj.hasOwnProperty(attr)) {
50
50
  if (/_for_/.test(attr)) {
51
51
  // @ts-ignore
@@ -1,18 +1,18 @@
1
- import * as t from "@babel/types";
2
- import { parse } from "@babel/parser";
3
- import { sync as mkdirp } from "mkdirp";
4
- import { writeFileSync } from "fs";
5
- import { dirname } from "path";
6
- import generate from "@babel/generator";
7
- import { unused } from "./unused";
8
- import traverse from "@babel/traverse";
1
+ import generate from '@babel/generator';
2
+ import { parse } from '@babel/parser';
3
+ import traverse from '@babel/traverse';
4
+ import * as t from '@babel/types';
5
+ import { writeFileSync } from 'fs';
6
+ import { sync as mkdirp } from 'mkdirp';
7
+ import { dirname } from 'path';
8
+ import { unused } from './unused';
9
9
  export const writeAstToFile = (outPath, program, filename, removeUnusedImports = false, isTsDisable = false, isEslintDisable = false) => {
10
10
  const ast = t.program(program);
11
11
  const content = generate(ast).code;
12
12
  if (removeUnusedImports) {
13
- const plugins = ["typescript"];
13
+ const plugins = ['typescript'];
14
14
  const newAst = parse(content, {
15
- sourceType: "module",
15
+ sourceType: 'module',
16
16
  plugins,
17
17
  });
18
18
  traverse(newAst, unused);
@@ -24,12 +24,12 @@ export const writeAstToFile = (outPath, program, filename, removeUnusedImports =
24
24
  }
25
25
  };
26
26
  export const writeContentToFile = (outPath, content, filename, isTsDisable = false, isEslintDisable = false) => {
27
- let esLintPrefix = "";
28
- let tsLintPrefix = "";
29
- let nameWithoutPath = filename.replace(outPath, "");
27
+ let esLintPrefix = '';
28
+ let tsLintPrefix = '';
29
+ let nameWithoutPath = filename.replace(outPath, '');
30
30
  // strip off leading slash
31
- if (nameWithoutPath.startsWith("/"))
32
- nameWithoutPath = nameWithoutPath.replace(/^\//, "");
31
+ if (nameWithoutPath.startsWith('/'))
32
+ nameWithoutPath = nameWithoutPath.replace(/^\//, '');
33
33
  if (isTsDisable) {
34
34
  tsLintPrefix = `//@ts-nocheck\n`;
35
35
  }
@@ -1,4 +1,4 @@
1
- import { readAndParsePackageJson } from "./package";
1
+ import { readAndParsePackageJson } from './package';
2
2
  const pkg = readAndParsePackageJson();
3
3
  const version = process.env.NODE_ENV === 'test' ? 'latest' : pkg.version;
4
4
  export const header = `/**
@@ -1,5 +1,5 @@
1
- import { join, dirname } from "path";
2
- import { readFileSync, existsSync } from "fs";
1
+ import { existsSync, readFileSync } from 'fs';
2
+ import { dirname, join } from 'path';
3
3
  // need to search due to the dist/ folder and src/, etc.
4
4
  function findPackageJson(currentDir) {
5
5
  const filePath = join(currentDir, 'package.json');
@@ -1,5 +1,5 @@
1
- import babelTraverse from '@babel/traverse';
2
1
  import { parse } from '@babel/parser';
2
+ import babelTraverse from '@babel/traverse';
3
3
  export const parser = (codes) => {
4
4
  const hash = {};
5
5
  codes.forEach(code => {
@@ -2,7 +2,7 @@
2
2
  import { filter } from 'fuzzy';
3
3
  import { prompt as inquirerer } from 'inquirerer';
4
4
  export const getFuzzySearch = (list) => {
5
- return (answers, input) => {
5
+ return (_answers, input) => {
6
6
  input = input || '';
7
7
  return new Promise(function (resolve) {
8
8
  setTimeout(function () {
@@ -15,14 +15,14 @@ export const getFuzzySearch = (list) => {
15
15
  };
16
16
  };
17
17
  export const getFuzzySearchNames = (nameValueItemList) => {
18
- const list = nameValueItemList.map(({ name, value }) => name);
19
- return (answers, input) => {
18
+ const list = nameValueItemList.map(({ name, value: _value }) => name);
19
+ return (_answers, input) => {
20
20
  input = input || '';
21
21
  return new Promise(function (resolve) {
22
22
  setTimeout(function () {
23
23
  const fuzzyResult = filter(input, list);
24
24
  resolve(fuzzyResult.map(function (el) {
25
- return nameValueItemList.find(({ name, value }) => el.original == name);
25
+ return nameValueItemList.find(({ name, value: _value }) => el.original == name);
26
26
  }));
27
27
  }, 25);
28
28
  });
@@ -1,7 +1,7 @@
1
- import { sync as glob } from 'glob';
1
+ import { compile } from '@pyramation/json-schema-to-typescript';
2
2
  import { readFileSync } from 'fs';
3
+ import { sync as glob } from 'glob';
3
4
  import { cleanse } from './cleanse';
4
- import { compile } from '@pyramation/json-schema-to-typescript';
5
5
  import { parser } from './parse';
6
6
  ;
7
7
  export const readSchemas = async ({ schemaDir, clean = true }) => {
@@ -24,7 +24,10 @@ export const readSchemas = async ({ schemaDir, clean = true }) => {
24
24
  throw new Error('Error [too many files]: CosmWasm v1.1 schemas supports one file');
25
25
  }
26
26
  const idlObject = schemas[0];
27
- const { contract_name, contract_version, idl_version, responses, instantiate, execute, query, migrate, sudo } = idlObject;
27
+ const {
28
+ // contract_name,
29
+ // contract_version,
30
+ idl_version, responses, instantiate, execute, query, migrate, sudo } = idlObject;
28
31
  if (typeof idl_version !== 'string') {
29
32
  // legacy
30
33
  return {
package/file.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- const prompt_1 = require("./utils/prompt");
5
- const cli_1 = require("./cli");
6
4
  const fs_1 = require("fs");
5
+ const cli_1 = require("./cli");
6
+ const prompt_1 = require("./utils/prompt");
7
7
  const argv = require('minimist')(process.argv.slice(2));
8
8
  const question = [
9
9
  {
@@ -1,2 +1,3 @@
1
- import { BuilderFile, TSBuilderInput } from "../builder";
1
+ import { BuilderContext } from '@cosmwasm/ts-codegen-ast';
2
+ import { BuilderFile, TSBuilderInput } from '../builder';
2
3
  export declare const createHelpers: (input: TSBuilderInput, builderContext: BuilderContext) => BuilderFile[];
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createHelpers = void 0;
4
- const path_1 = require("path");
5
4
  const mkdirp_1 = require("mkdirp");
6
- const files_1 = require("../utils/files");
5
+ const path_1 = require("path");
7
6
  const helpers_1 = require("../helpers");
7
+ const files_1 = require("../utils/files");
8
8
  const header_1 = require("../utils/header");
9
9
  const write = (outPath, file, content, varname) => {
10
10
  const outFile = (0, path_1.join)(outPath, file);
11
11
  (0, mkdirp_1.sync)((0, path_1.dirname)(outFile));
12
12
  (0, files_1.writeContentToFile)(outPath, header_1.header + content, outFile);
13
13
  return {
14
- type: "plugin",
15
- pluginType: "helper",
14
+ type: 'plugin',
15
+ pluginType: 'helper',
16
16
  contract: varname ?? (0, path_1.basename)(file, (0, path_1.extname)(file)),
17
17
  localname: file,
18
18
  filename: outFile,
@@ -23,10 +23,10 @@ const createHelpers = (input, builderContext) => {
23
23
  if (input.options?.useContractsHook?.enabled &&
24
24
  Object.keys(builderContext.providers)?.length) {
25
25
  const useShorthandCtor = input.options?.useShorthandCtor;
26
- files.push(write(input.outPath, "contractContextBase.ts", useShorthandCtor
26
+ files.push(write(input.outPath, 'contractContextBase.ts', useShorthandCtor
27
27
  ? helpers_1.contractContextBaseShortHandCtor
28
28
  : helpers_1.contractContextBase));
29
- files.push(write(input.outPath, "contracts-context.tsx", helpers_1.contractsContextTSX, "contractsContext"));
29
+ files.push(write(input.outPath, 'contracts-context.tsx', helpers_1.contractsContextTSX, 'contractsContext'));
30
30
  }
31
31
  return files;
32
32
  };
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { TSBuilderInput } from './builder';
2
- export * from './utils';
3
2
  export * from './builder';
4
3
  export * from './bundler';
5
4
  export * from './plugins';
5
+ export * from './utils';
6
6
  declare const _default: (input: TSBuilderInput) => Promise<void>;
7
7
  export default _default;
package/index.js CHANGED
@@ -15,10 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  const builder_1 = require("./builder");
18
- __exportStar(require("./utils"), exports);
19
18
  __exportStar(require("./builder"), exports);
20
19
  __exportStar(require("./bundler"), exports);
21
20
  __exportStar(require("./plugins"), exports);
21
+ __exportStar(require("./utils"), exports);
22
22
  exports.default = async (input) => {
23
23
  const builder = new builder_1.TSBuilder(input);
24
24
  await builder.build();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmwasm/ts-codegen",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
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",
@@ -18,10 +18,11 @@
18
18
  },
19
19
  "scripts": {
20
20
  "copy": "copyfiles -f LICENSE-Apache LICENSE-MIT README.md package.json dist",
21
- "clean": "del dist/**",
21
+ "clean": "rimraf dist/**",
22
22
  "prepare": "npm run build",
23
23
  "cmds": "ts-node ./scripts/cmds.ts",
24
24
  "build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy",
25
+ "lint": "eslint . --fix",
25
26
  "test": "jest",
26
27
  "test:watch": "jest --watch",
27
28
  "dev": "ts-node src/ts-codegen",
@@ -42,8 +43,8 @@
42
43
  "@babel/generator": "7.24.4",
43
44
  "@babel/traverse": "7.24.1",
44
45
  "@babel/types": "7.24.0",
45
- "@cosmwasm/ts-codegen-ast": "^1.5.1",
46
- "@cosmwasm/ts-codegen-types": "^1.2.0",
46
+ "@cosmwasm/ts-codegen-ast": "^1.6.0",
47
+ "@cosmwasm/ts-codegen-types": "^1.3.0",
47
48
  "@pyramation/json-schema-to-typescript": " 11.0.4",
48
49
  "@types/rimraf": "3.0.2",
49
50
  "@types/shelljs": "0.8.15",
@@ -66,5 +67,5 @@
66
67
  "smart contracts",
67
68
  "codegen"
68
69
  ],
69
- "gitHead": "f25cc410b30af114b6147e3fc264158b1976e362"
70
+ "gitHead": "4784715eecf71b22f273bd260abcbbfd82f1b140"
70
71
  }
@@ -1,6 +1,6 @@
1
- import { RenderContext, ContractInfo, RenderContextBase, RenderOptions } from "@cosmwasm/ts-codegen-ast";
2
- import { BuilderFileType } from "../builder";
3
- import { BuilderPluginBase } from "./plugin-base";
1
+ import { ContractInfo, RenderContext, RenderContextBase, RenderOptions } from '@cosmwasm/ts-codegen-ast';
2
+ import { BuilderFileType } from '../builder';
3
+ import { BuilderPluginBase } from './plugin-base';
4
4
  export declare class ClientPlugin extends BuilderPluginBase<RenderOptions> {
5
5
  initContext(contract: ContractInfo, options?: RenderOptions): RenderContextBase<RenderOptions>;
6
6
  doRender(name: string, context: RenderContext): Promise<{
package/plugins/client.js CHANGED
@@ -24,10 +24,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ClientPlugin = void 0;
27
- const case_1 = require("case");
28
27
  const w = __importStar(require("@cosmwasm/ts-codegen-ast"));
29
- const utils_1 = require("../utils");
30
28
  const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
29
+ const case_1 = require("case");
30
+ const utils_1 = require("../utils");
31
31
  const plugin_base_1 = require("./plugin-base");
32
32
  class ClientPlugin extends plugin_base_1.BuilderPluginBase {
33
33
  initContext(contract, options) {
@@ -39,8 +39,8 @@ class ClientPlugin extends plugin_base_1.BuilderPluginBase {
39
39
  return;
40
40
  }
41
41
  const { schemas } = context.contract;
42
- const localname = (0, case_1.pascal)(name) + ".client.ts";
43
- const TypesFile = (0, case_1.pascal)(name) + ".types";
42
+ const localname = (0, case_1.pascal)(name) + '.client.ts';
43
+ const TypesFile = (0, case_1.pascal)(name) + '.types';
44
44
  const QueryMsg = (0, utils_1.findQueryMsg)(schemas);
45
45
  const ExecuteMsg = (0, utils_1.findExecuteMsg)(schemas);
46
46
  const typeHash = await (0, utils_1.findAndParseTypes)(schemas);
@@ -69,13 +69,13 @@ class ClientPlugin extends plugin_base_1.BuilderPluginBase {
69
69
  context.addProviderInfo(name, w.PROVIDER_TYPES.SIGNING_CLIENT_TYPE, Client, localname);
70
70
  }
71
71
  }
72
- if (typeHash.hasOwnProperty("Coin")) {
72
+ if (typeHash.hasOwnProperty('Coin')) {
73
73
  // @ts-ignore
74
74
  delete context.utils.Coin;
75
75
  }
76
76
  return [
77
77
  {
78
- type: "client",
78
+ type: 'client',
79
79
  localname,
80
80
  body,
81
81
  },
@@ -1,7 +1,7 @@
1
- export * from "./plugin-base";
2
- export * from "./client";
3
- export * from "./react-query";
4
- export * from "./recoil";
5
- export * from "./message-builder";
6
- export * from "./message-composer";
7
- export * from "./types";
1
+ export * from './client';
2
+ export * from './message-builder';
3
+ export * from './message-composer';
4
+ export * from './plugin-base';
5
+ export * from './react-query';
6
+ export * from './recoil';
7
+ export * from './types';
package/plugins/index.js CHANGED
@@ -14,10 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./plugin-base"), exports);
18
17
  __exportStar(require("./client"), exports);
19
- __exportStar(require("./react-query"), exports);
20
- __exportStar(require("./recoil"), exports);
21
18
  __exportStar(require("./message-builder"), exports);
22
19
  __exportStar(require("./message-composer"), exports);
20
+ __exportStar(require("./plugin-base"), exports);
21
+ __exportStar(require("./react-query"), exports);
22
+ __exportStar(require("./recoil"), exports);
23
23
  __exportStar(require("./types"), exports);
@@ -1,4 +1,4 @@
1
- import { RenderContext, RenderContextBase, ContractInfo, RenderOptions } from '@cosmwasm/ts-codegen-ast';
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 MessageBuilderPlugin extends BuilderPluginBase<RenderOptions> {
@@ -24,10 +24,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.MessageBuilderPlugin = void 0;
27
- const case_1 = require("case");
28
27
  const w = __importStar(require("@cosmwasm/ts-codegen-ast"));
29
- const utils_1 = require("../utils");
30
28
  const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
29
+ const case_1 = require("case");
30
+ const utils_1 = require("../utils");
31
31
  const plugin_base_1 = require("./plugin-base");
32
32
  class MessageBuilderPlugin extends plugin_base_1.BuilderPluginBase {
33
33
  initContext(contract, options) {
@@ -1,6 +1,6 @@
1
- import { ContractInfo, RenderContextBase, RenderContext, RenderOptions } from "@cosmwasm/ts-codegen-ast";
2
- import { BuilderFileType } from "../builder";
3
- import { BuilderPluginBase } from "./plugin-base";
1
+ import { ContractInfo, RenderContext, RenderContextBase, RenderOptions } from '@cosmwasm/ts-codegen-ast';
2
+ import { BuilderFileType } from '../builder';
3
+ import { BuilderPluginBase } from './plugin-base';
4
4
  export declare class MessageComposerPlugin extends BuilderPluginBase<RenderOptions> {
5
5
  initContext(contract: ContractInfo, options?: RenderOptions): RenderContextBase<RenderOptions>;
6
6
  doRender(name: string, context: RenderContext): Promise<{
@@ -24,10 +24,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.MessageComposerPlugin = void 0;
27
- const case_1 = require("case");
28
27
  const w = __importStar(require("@cosmwasm/ts-codegen-ast"));
29
- const utils_1 = require("../utils");
30
28
  const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
29
+ const case_1 = require("case");
30
+ const utils_1 = require("../utils");
31
31
  const plugin_base_1 = require("./plugin-base");
32
32
  class MessageComposerPlugin extends plugin_base_1.BuilderPluginBase {
33
33
  initContext(contract, options) {
@@ -39,8 +39,8 @@ class MessageComposerPlugin extends plugin_base_1.BuilderPluginBase {
39
39
  return;
40
40
  }
41
41
  const { schemas } = context.contract;
42
- const localname = (0, case_1.pascal)(name) + ".message-composer.ts";
43
- const TypesFile = (0, case_1.pascal)(name) + ".types";
42
+ const localname = (0, case_1.pascal)(name) + '.message-composer.ts';
43
+ const TypesFile = (0, case_1.pascal)(name) + '.types';
44
44
  const ExecuteMsg = (0, utils_1.findExecuteMsg)(schemas);
45
45
  const typeHash = await (0, utils_1.findAndParseTypes)(schemas);
46
46
  const body = [];
@@ -56,13 +56,13 @@ class MessageComposerPlugin extends plugin_base_1.BuilderPluginBase {
56
56
  context.addProviderInfo(name, w.PROVIDER_TYPES.MESSAGE_COMPOSER_TYPE, TheClass, localname);
57
57
  }
58
58
  }
59
- if (typeHash.hasOwnProperty("Coin")) {
59
+ if (typeHash.hasOwnProperty('Coin')) {
60
60
  // @ts-ignore
61
61
  delete context.utils.Coin;
62
62
  }
63
63
  return [
64
64
  {
65
- type: "message-composer",
65
+ type: 'message-composer',
66
66
  localname,
67
67
  body,
68
68
  },
@@ -1,5 +1,5 @@
1
- import { ContractInfo, UtilMapping, IContext } from "@cosmwasm/ts-codegen-ast";
2
- import { BuilderFile, BuilderFileType, TSBuilder } from "../builder";
1
+ import { ContractInfo, IContext, UtilMapping } from '@cosmwasm/ts-codegen-ast';
2
+ import { BuilderFile, BuilderFileType, TSBuilder } from '../builder';
3
3
  /**
4
4
  * IBuilderPlugin is a common plugin that render generated code.
5
5
  */
@@ -13,7 +13,7 @@ export interface IBuilderPlugin {
13
13
  /**
14
14
  * prop to indicate to execute the render function in the lifecycle of main process or after
15
15
  */
16
- readonly lifecycle: "main" | "after";
16
+ readonly lifecycle: 'main' | 'after';
17
17
  defaultContractName?: string;
18
18
  /**
19
19
  * render generated cdoe.
@@ -36,7 +36,7 @@ export declare abstract class BuilderPluginBase<TOpt extends {
36
36
  /**
37
37
  * prop to indicate to execute the render function in the lifecycle of main process or after
38
38
  */
39
- lifecycle: "main" | "after";
39
+ lifecycle: 'main' | 'after';
40
40
  defaultContractName?: string;
41
41
  constructor(opts?: TOpt, builder?: TSBuilder);
42
42
  setBuilder(builder: TSBuilder): void;
@@ -27,14 +27,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.BuilderPluginBase = void 0;
30
- const mkdirp_1 = require("mkdirp");
31
- const path_1 = require("path");
32
- const fs_1 = require("fs");
33
- const header_1 = require("../utils/header");
34
- const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
35
30
  const generator_1 = __importDefault(require("@babel/generator"));
36
31
  const t = __importStar(require("@babel/types"));
32
+ const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
37
33
  const deepmerge_1 = __importDefault(require("deepmerge"));
34
+ const fs_1 = require("fs");
35
+ const mkdirp_1 = require("mkdirp");
36
+ const path_1 = require("path");
37
+ const header_1 = require("../utils/header");
38
38
  /**
39
39
  * BuilderPluginBase enable ts-codegen users implement their own plugins by only implement a few functions.
40
40
  */
@@ -50,7 +50,7 @@ class BuilderPluginBase {
50
50
  constructor(opts, builder) {
51
51
  this.options = opts;
52
52
  this.builder = builder;
53
- this.lifecycle = "main";
53
+ this.lifecycle = 'main';
54
54
  }
55
55
  setBuilder(builder) {
56
56
  this.builder = builder;
@@ -1,6 +1,6 @@
1
- import { ContractInfo, RenderContextBase, RenderContext } from "@cosmwasm/ts-codegen-ast";
2
- import { BuilderFileType, TSBuilderOptions } from "../builder";
3
- import { BuilderPluginBase } from "./plugin-base";
1
+ import { ContractInfo, RenderContext, RenderContextBase } from '@cosmwasm/ts-codegen-ast';
2
+ import { BuilderFileType, TSBuilderOptions } from '../builder';
3
+ import { BuilderPluginBase } from './plugin-base';
4
4
  export declare class ContractsProviderBundlePlugin extends BuilderPluginBase<TSBuilderOptions> {
5
5
  constructor(opt?: TSBuilderOptions);
6
6
  initContext(contract: ContractInfo, options?: TSBuilderOptions): RenderContextBase<TSBuilderOptions>;
@@ -24,22 +24,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ContractsProviderBundlePlugin = void 0;
27
- const case_1 = require("case");
28
27
  const w = __importStar(require("@cosmwasm/ts-codegen-ast"));
29
28
  const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
29
+ const case_1 = require("case");
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 {
33
33
  constructor(opt) {
34
34
  super(opt);
35
- this.lifecycle = "after";
36
- this.defaultContractName = "contractContextProviders";
35
+ this.lifecycle = 'after';
36
+ this.defaultContractName = 'contractContextProviders';
37
37
  this.utils = {
38
- CosmWasmClient: "@cosmjs/cosmwasm-stargate",
39
- SigningCosmWasmClient: "@cosmjs/cosmwasm-stargate",
40
- IQueryClientProvider: "__contractContextBase__",
41
- ISigningClientProvider: "__contractContextBase__",
42
- IMessageComposerProvider: "__contractContextBase__",
38
+ CosmWasmClient: '@cosmjs/cosmwasm-stargate',
39
+ SigningCosmWasmClient: '@cosmjs/cosmwasm-stargate',
40
+ IQueryClientProvider: '__contractContextBase__',
41
+ ISigningClientProvider: '__contractContextBase__',
42
+ IMessageComposerProvider: '__contractContextBase__',
43
43
  };
44
44
  }
45
45
  initContext(contract, options) {
@@ -53,13 +53,13 @@ class ContractsProviderBundlePlugin extends plugin_base_1.BuilderPluginBase {
53
53
  if (!Object.keys(providerInfos || {})?.length) {
54
54
  return;
55
55
  }
56
- const localname = "contractContextProviders.ts";
56
+ const localname = 'contractContextProviders.ts';
57
57
  const body = [];
58
- context.addUtil("CosmWasmClient");
59
- context.addUtil("SigningCosmWasmClient");
60
- context.addUtil("IQueryClientProvider");
61
- context.addUtil("ISigningClientProvider");
62
- context.addUtil("IMessageComposerProvider");
58
+ context.addUtil('CosmWasmClient');
59
+ context.addUtil('SigningCosmWasmClient');
60
+ context.addUtil('IQueryClientProvider');
61
+ context.addUtil('ISigningClientProvider');
62
+ context.addUtil('IMessageComposerProvider');
63
63
  for (const name in providerInfos) {
64
64
  if (Object.prototype.hasOwnProperty.call(providerInfos, name)) {
65
65
  const providerInfo = providerInfos[name];
@@ -76,8 +76,8 @@ class ContractsProviderBundlePlugin extends plugin_base_1.BuilderPluginBase {
76
76
  body.push(w.createGettingProviders(providerInfos));
77
77
  return [
78
78
  {
79
- type: "plugin",
80
- pluginType: "contractContextProviders",
79
+ type: 'plugin',
80
+ pluginType: 'contractContextProviders',
81
81
  localname,
82
82
  body,
83
83
  },
@@ -1,6 +1,6 @@
1
- import { ContractInfo, RenderContextBase, RenderContext } from "@cosmwasm/ts-codegen-ast";
2
- import { BuilderFileType, TSBuilderOptions } from "../builder";
3
- import { BuilderPluginBase } from "./plugin-base";
1
+ import { ContractInfo, RenderContext, RenderContextBase } from '@cosmwasm/ts-codegen-ast';
2
+ import { BuilderFileType, TSBuilderOptions } from '../builder';
3
+ import { BuilderPluginBase } from './plugin-base';
4
4
  export declare const GetLocalNameByContractName: (name: string) => string;
5
5
  export declare const GetLocalBaseNameByContractName: (name: string) => string;
6
6
  export declare class ContractsContextProviderPlugin extends BuilderPluginBase<TSBuilderOptions> {
@@ -24,9 +24,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ContractsContextProviderPlugin = exports.GetLocalBaseNameByContractName = exports.GetLocalNameByContractName = void 0;
27
- const case_1 = require("case");
28
27
  const w = __importStar(require("@cosmwasm/ts-codegen-ast"));
29
28
  const ts_codegen_ast_1 = require("@cosmwasm/ts-codegen-ast");
29
+ const case_1 = require("case");
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;
@@ -36,9 +36,9 @@ class ContractsContextProviderPlugin extends plugin_base_1.BuilderPluginBase {
36
36
  constructor(opt) {
37
37
  super(opt);
38
38
  this.utils = {
39
- ContractBase: "__contractContextBase__",
40
- IContractConstructor: "__contractContextBase__",
41
- IEmptyClient: "__contractContextBase__",
39
+ ContractBase: '__contractContextBase__',
40
+ IContractConstructor: '__contractContextBase__',
41
+ IEmptyClient: '__contractContextBase__',
42
42
  };
43
43
  }
44
44
  initContext(contract, options) {
@@ -52,8 +52,8 @@ class ContractsContextProviderPlugin extends plugin_base_1.BuilderPluginBase {
52
52
  if (!Object.keys(providerInfo || {})?.length) {
53
53
  return;
54
54
  }
55
- context.addUtil("ContractBase");
56
- context.addUtil("IContractConstructor");
55
+ context.addUtil('ContractBase');
56
+ context.addUtil('IContractConstructor');
57
57
  const localname = (0, exports.GetLocalNameByContractName)(name);
58
58
  let needEmptyClientType = false;
59
59
  let clientFile = null;
@@ -86,13 +86,13 @@ class ContractsContextProviderPlugin extends plugin_base_1.BuilderPluginBase {
86
86
  needEmptyClientType = true;
87
87
  }
88
88
  if (needEmptyClientType) {
89
- context.addUtil("IEmptyClient");
89
+ context.addUtil('IEmptyClient');
90
90
  }
91
91
  body.push(w.createProvider(name, providerInfo));
92
92
  return [
93
93
  {
94
- type: "plugin",
95
- pluginType: "provider",
94
+ type: 'plugin',
95
+ pluginType: 'provider',
96
96
  localname,
97
97
  body,
98
98
  },
@@ -1,4 +1,4 @@
1
- import { ContractInfo, RenderOptions, RenderContextBase, RenderContext } from '@cosmwasm/ts-codegen-ast';
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 ReactQueryPlugin extends BuilderPluginBase<RenderOptions> {