@cosmwasm/ts-codegen 0.26.0 → 0.28.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 +26 -0
- package/main/utils/schemas.js +3 -1
- package/module/utils/schemas.js +1 -1
- package/package.json +3 -3
- package/src/utils/schemas.ts +3 -1
package/README.md
CHANGED
@@ -36,6 +36,7 @@ The quickest and easiest way to interact with CosmWasm Contracts. `@cosmwasm/ts-
|
|
36
36
|
- [React Query](#react-query)
|
37
37
|
- [Recoil](#recoil)
|
38
38
|
- [Message Composer](#message-composer)
|
39
|
+
- [Msg Builder](#msg-builder)
|
39
40
|
- [Bundles](#bundles)
|
40
41
|
- [CLI Usage and Examples](#cli-usage-and-examples)
|
41
42
|
- [Advanced Usage](#advanced-usage)
|
@@ -119,6 +120,9 @@ codegen({
|
|
119
120
|
},
|
120
121
|
messageComposer: {
|
121
122
|
enabled: false
|
123
|
+
},
|
124
|
+
msgBuilder: {
|
125
|
+
enabled: false
|
122
126
|
}
|
123
127
|
}
|
124
128
|
}).then(() => {
|
@@ -252,6 +256,28 @@ cosmwasm-ts-codegen generate \
|
|
252
256
|
| ------------------------------ | ------------------------------------------------------------------- |
|
253
257
|
| `messageComposer.enabled` | enable the messageComposer plugin |
|
254
258
|
|
259
|
+
### Msg Builder
|
260
|
+
|
261
|
+
Generate raw message jsons for use in your application with the `msg-builder` command.
|
262
|
+
|
263
|
+
[see example output code](https://gist.github.com/adairrr/b394e62beb9856b0351883f776650f26)
|
264
|
+
|
265
|
+
#### Msg Builder via CLI
|
266
|
+
|
267
|
+
```sh
|
268
|
+
cosmwasm-ts-codegen generate \
|
269
|
+
--plugin msg-builder \
|
270
|
+
--schema ./schema \
|
271
|
+
--out ./ts \
|
272
|
+
--name MyContractName
|
273
|
+
```
|
274
|
+
#### Message Composer Options
|
275
|
+
|
276
|
+
| option | description |
|
277
|
+
-------------| ------------------------------ | ------------------------------------------------------------------- |
|
278
|
+
| `msgBuilder.enabled` | enable the msgBilder plugin |
|
279
|
+
|
280
|
+
|
255
281
|
### Bundles
|
256
282
|
|
257
283
|
The bundler will make a nice package of all your contracts. For example:
|
package/main/utils/schemas.js
CHANGED
@@ -43,7 +43,9 @@ var readSchemas = /*#__PURE__*/function () {
|
|
43
43
|
fn = clean ? _cleanse.cleanse : function (str) {
|
44
44
|
return str;
|
45
45
|
};
|
46
|
-
files = (0, _glob.sync)(schemaDir + '/**/*.json')
|
46
|
+
files = (0, _glob.sync)(schemaDir + '/**/*.json').filter(function (file) {
|
47
|
+
return !file.match(/\/raw\//);
|
48
|
+
});
|
47
49
|
schemas = files.map(function (file) {
|
48
50
|
return JSON.parse((0, _fs.readFileSync)(file, 'utf-8'));
|
49
51
|
});
|
package/module/utils/schemas.js
CHANGED
@@ -15,7 +15,7 @@ export const readSchemas = async ({
|
|
15
15
|
clean = true
|
16
16
|
}) => {
|
17
17
|
const fn = clean ? cleanse : str => str;
|
18
|
-
const files = glob(schemaDir + '/**/*.json');
|
18
|
+
const files = glob(schemaDir + '/**/*.json').filter(file => !file.match(/\/raw\//));
|
19
19
|
const schemas = files.map(file => JSON.parse(readFileSync(file, 'utf-8')));
|
20
20
|
|
21
21
|
if (schemas.length > 1) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@cosmwasm/ts-codegen",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.28.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.
|
99
|
+
"wasm-ast-types": "^0.21.0"
|
100
100
|
},
|
101
|
-
"gitHead": "
|
101
|
+
"gitHead": "90fb688d19f477d246f9021ac91d824c96b8f3fc"
|
102
102
|
}
|
package/src/utils/schemas.ts
CHANGED
@@ -13,7 +13,9 @@ export const readSchemas = async ({
|
|
13
13
|
schemaDir, clean = true
|
14
14
|
}: ReadSchemaOpts): Promise<ContractInfo> => {
|
15
15
|
const fn = clean ? cleanse : (str) => str;
|
16
|
-
const files = glob(schemaDir + '/**/*.json')
|
16
|
+
const files = glob(schemaDir + '/**/*.json')
|
17
|
+
.filter(file => !file.match(/\/raw\//));
|
18
|
+
|
17
19
|
const schemas = files
|
18
20
|
.map(file => JSON.parse(readFileSync(file, 'utf-8')));
|
19
21
|
|