@cosmwasm/ts-codegen 0.19.0 → 0.21.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.
package/README.md CHANGED
@@ -10,11 +10,13 @@ Generate TypeScript SDKs for your CosmWasm smart contracts
10
10
  <a href="https://github.com/CosmWasm/ts-codegen/actions/workflows/run-tests.yaml">
11
11
  <img height="20" src="https://github.com/CosmWasm/ts-codegen/actions/workflows/run-tests.yaml/badge.svg" />
12
12
  </a>
13
+ <a href="https://www.npmjs.com/package/@cosmwasm/ts-codegen"><img height="20" src="https://img.shields.io/npm/dt/@cosmwasm/ts-codegen"></a>
13
14
  <a href="https://github.com/CosmWasm/ts-codegen/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
14
15
  <a href="https://github.com/CosmWasm/ts-codegen/blob/main/LICENSE-Apache"><img height="20" src="https://img.shields.io/badge/license-Apache-blue.svg"></a>
15
16
  <a href="https://www.npmjs.com/package/@cosmwasm/ts-codegen"><img height="20" src="https://img.shields.io/github/package-json/v/CosmWasm/ts-codegen?filename=packages%2Fts-codegen%2Fpackage.json"></a>
16
17
  </p>
17
18
 
19
+
18
20
  ```
19
21
  npm install -g @cosmwasm/ts-codegen
20
22
  ```
@@ -110,6 +112,7 @@ codegen({
110
112
  version: 'v4',
111
113
  mutations: true,
112
114
  queryKeys: true,
115
+ queryFactory: true,
113
116
  },
114
117
  recoil: {
115
118
  enabled: false
@@ -143,10 +146,11 @@ The `client` plugin will generate TS client classes for your contracts. This opt
143
146
 
144
147
  #### Client Options
145
148
 
146
- | option | description |
147
- | ----------------------------- | --------------------------------------------------- |
148
- | `client.enabled` | generate TS client classes for your contracts |
149
- | `client.execExtendsQuery` | execute should extend query message clients |
149
+ | option | description |
150
+ | --------------------------------------- | --------------------------------------------------- |
151
+ | `client.enabled` | generate TS client classes for your contracts |
152
+ | `client.execExtendsQuery` | execute should extend query message clients |
153
+ | `client.noImplicit.noImplicitOverride` | should match your tsconfig noImplicitOverride option |
150
154
 
151
155
  #### Client via CLI
152
156
 
@@ -166,10 +170,11 @@ Generate [react-query v3](https://react-query-v3.tanstack.com/) or [react-query
166
170
  #### React Query Options
167
171
 
168
172
  | option | description |
169
- | ----------------------------| ---------------------------------------------------------------------------- |
173
+ -----------------------------| ----------------------------| ---------------------------------------------------------------------------- |
170
174
  | `reactQuery.enabled` | enable the react-query plugin |
171
175
  | `reactQuery.optionalClient` | allows contract client to be undefined as the component renders |
172
176
  | `reactQuery.queryKeys` | generates a const queryKeys object for use with invalidations and set values |
177
+ | `reactQuery.queryFactory` | generates a const queryFactory object for useQueries and prefetchQueries use |
173
178
  | `reactQuery.version` | `v4` uses `@tanstack/react-query` and `v3` uses `react-query` |
174
179
  | `reactQuery.mutations` | also generate mutations |
175
180
  | `reactQuery.camelize` | use camelCase style for property names |
@@ -475,7 +480,8 @@ See the [docs](https://github.com/CosmWasm/ts-codegen/blob/main/packages/wasm-as
475
480
  Checkout these related projects:
476
481
 
477
482
  * [@osmonauts/telescope](https://github.com/osmosis-labs/telescope) a "babel for the Cosmos", Telescope is a TypeScript Transpiler for Cosmos Protobufs.
478
-
483
+ * [chain-registry](https://github.com/cosmology-tech/chain-registry) Cosmos chain registry and chain info.
484
+ * [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) A wallet connector for the Cosmos.
479
485
  ## Credits
480
486
 
481
487
  🛠 Built by Cosmology — if you like our tools, please consider delegating to [our validator ⚛️](https://cosmology.tech/validator)
@@ -17,7 +17,7 @@ var _index = _interopRequireDefault(require("../index"));
17
17
 
18
18
  var _default = /*#__PURE__*/function () {
19
19
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(argv) {
20
- var questions, _yield$prompt, schema, out, name, plugin, bundle, questions2, _yield$prompt2, optionalClient, version, queryKeys, questions3, _yield$prompt3, mutations, questions4, _yield$prompt4, bundleFile, bundleScope, options;
20
+ var questions, _yield$prompt, schema, out, name, plugin, bundle, questions2, _yield$prompt2, optionalClient, version, queryKeys, questions3, _yield$prompt3, mutations, queryFactoryQuestions, _yield$prompt4, queryFactory, questions4, _yield$prompt5, bundleFile, bundleScope, options;
21
21
 
22
22
  return _regenerator["default"].wrap(function _callee$(_context) {
23
23
  while (1) {
@@ -118,6 +118,25 @@ var _default = /*#__PURE__*/function () {
118
118
  case 25:
119
119
  _yield$prompt3 = _context.sent;
120
120
  mutations = _yield$prompt3.mutations;
121
+ queryFactoryQuestions = [];
122
+
123
+ if (queryKeys) {
124
+ [].push.apply(queryFactoryQuestions, [// Only can use queryFactory if queryKeys is enabled
125
+ {
126
+ type: 'confirm',
127
+ name: 'queryFactory',
128
+ message: 'queryFactory? ',
129
+ "default": false
130
+ }]);
131
+ }
132
+
133
+ ;
134
+ _context.next = 32;
135
+ return (0, _prompt.prompt)(queryFactoryQuestions, argv);
136
+
137
+ case 32:
138
+ _yield$prompt4 = _context.sent;
139
+ queryFactory = _yield$prompt4.queryFactory;
121
140
  ///////// END REACT QUERY
122
141
  ///////// BUNDLE
123
142
  questions4 = [];
@@ -137,13 +156,13 @@ var _default = /*#__PURE__*/function () {
137
156
  }
138
157
 
139
158
  ;
140
- _context.next = 32;
159
+ _context.next = 39;
141
160
  return (0, _prompt.prompt)(questions4, argv);
142
161
 
143
- case 32:
144
- _yield$prompt4 = _context.sent;
145
- bundleFile = _yield$prompt4.bundleFile;
146
- bundleScope = _yield$prompt4.bundleScope;
162
+ case 39:
163
+ _yield$prompt5 = _context.sent;
164
+ bundleFile = _yield$prompt5.bundleFile;
165
+ bundleScope = _yield$prompt5.bundleScope;
147
166
  ///////// END BUNDLE
148
167
  options = {
149
168
  types: {
@@ -157,7 +176,8 @@ var _default = /*#__PURE__*/function () {
157
176
  optionalClient: optionalClient,
158
177
  queryKeys: queryKeys,
159
178
  version: version,
160
- mutations: mutations
179
+ mutations: mutations,
180
+ queryFactory: queryFactory
161
181
  },
162
182
  recoil: {
163
183
  enabled: plugin.includes('recoil')
@@ -171,7 +191,7 @@ var _default = /*#__PURE__*/function () {
171
191
  bundleFile: bundleFile
172
192
  }
173
193
  };
174
- _context.next = 38;
194
+ _context.next = 45;
175
195
  return (0, _index["default"])({
176
196
  contracts: [{
177
197
  name: name,
@@ -181,7 +201,7 @@ var _default = /*#__PURE__*/function () {
181
201
  options: options
182
202
  });
183
203
 
184
- case 38:
204
+ case 45:
185
205
  case "end":
186
206
  return _context.stop();
187
207
  }
@@ -86,7 +86,23 @@ export default (async argv => {
86
86
  ;
87
87
  const {
88
88
  mutations
89
- } = await prompt(questions3, argv); ///////// END REACT QUERY
89
+ } = await prompt(questions3, argv);
90
+ const queryFactoryQuestions = [];
91
+
92
+ if (queryKeys) {
93
+ [].push.apply(queryFactoryQuestions, [// Only can use queryFactory if queryKeys is enabled
94
+ {
95
+ type: 'confirm',
96
+ name: 'queryFactory',
97
+ message: 'queryFactory? ',
98
+ default: false
99
+ }]);
100
+ }
101
+
102
+ ;
103
+ const {
104
+ queryFactory
105
+ } = await prompt(queryFactoryQuestions, argv); ///////// END REACT QUERY
90
106
  ///////// BUNDLE
91
107
 
92
108
  const questions4 = [];
@@ -123,7 +139,8 @@ export default (async argv => {
123
139
  optionalClient,
124
140
  queryKeys,
125
141
  version,
126
- mutations
142
+ mutations,
143
+ queryFactory
127
144
  },
128
145
  recoil: {
129
146
  enabled: plugin.includes('recoil')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmwasm/ts-codegen",
3
- "version": "0.19.0",
3
+ "version": "0.21.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",
@@ -96,7 +96,7 @@
96
96
  "parse-package-name": "1.0.0",
97
97
  "rimraf": "3.0.2",
98
98
  "shelljs": "0.8.5",
99
- "wasm-ast-types": "^0.13.0"
99
+ "wasm-ast-types": "^0.15.0"
100
100
  },
101
- "gitHead": "e46828bd476d30465a35a8021e611938abf89846"
101
+ "gitHead": "ef4b39134cf220c860469ae3cae49aeab91ee80d"
102
102
  }
@@ -90,6 +90,20 @@ export default async (argv) => {
90
90
  ])
91
91
  };
92
92
  const { mutations } = await prompt(questions3, argv);
93
+
94
+ const queryFactoryQuestions = [];
95
+ if (queryKeys) {
96
+ [].push.apply(queryFactoryQuestions, [
97
+ // Only can use queryFactory if queryKeys is enabled
98
+ {
99
+ type: 'confirm',
100
+ name: 'queryFactory',
101
+ message: 'queryFactory? ',
102
+ default: false
103
+ }
104
+ ])
105
+ };
106
+ const { queryFactory } = await prompt(queryFactoryQuestions, argv);
93
107
  ///////// END REACT QUERY
94
108
 
95
109
  ///////// BUNDLE
@@ -128,7 +142,8 @@ export default async (argv) => {
128
142
  optionalClient,
129
143
  queryKeys,
130
144
  version,
131
- mutations
145
+ mutations,
146
+ queryFactory
132
147
  },
133
148
  recoil: {
134
149
  enabled: plugin.includes('recoil'),