@cosmwasm/ts-codegen 1.3.0 → 1.4.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 +3 -3
- package/builder/builder.d.ts +1 -1
- package/esm/generators/create-helpers.js +1 -1
- package/esm/plugins/provider-bundle.js +1 -1
- package/esm/plugins/provider.js +1 -1
- package/generators/create-helpers.js +1 -1
- package/package.json +6 -4
- package/plugins/provider-bundle.js +1 -1
- package/plugins/provider.js +1 -1
package/README.md
CHANGED
@@ -98,7 +98,7 @@ codegen({
|
|
98
98
|
messageBuilder: {
|
99
99
|
enabled: false
|
100
100
|
},
|
101
|
-
|
101
|
+
useContractHooks: {
|
102
102
|
enabled: false
|
103
103
|
}
|
104
104
|
}
|
@@ -195,7 +195,7 @@ Generate raw message jsons for use in your application with the `message-builder
|
|
195
195
|
|
196
196
|
| option | description |
|
197
197
|
| -------------------------------- | --------------------------------------- |
|
198
|
-
| `
|
198
|
+
| `useContractHooks.enabled` | enable the `useContracts` plugin |
|
199
199
|
|
200
200
|
#### Use Contracts Provider Usage
|
201
201
|
|
@@ -344,7 +344,7 @@ Clone your project and `cd` into your contracts folder
|
|
344
344
|
|
345
345
|
```sh
|
346
346
|
git clone https://github.com/public-awesome/launchpad.git
|
347
|
-
cd launchpad/contracts/whitelists/
|
347
|
+
cd launchpad/contracts/whitelists/whitelist
|
348
348
|
```
|
349
349
|
|
350
350
|
Run `cosmwasm-ts-codegen` to generate your code.
|
package/builder/builder.d.ts
CHANGED
@@ -22,7 +22,7 @@ export type TSBuilderOptions = {
|
|
22
22
|
* Default: true
|
23
23
|
*/
|
24
24
|
useShorthandCtor?: boolean;
|
25
|
-
|
25
|
+
useContractHooks?: UseContractsOptions;
|
26
26
|
} & RenderOptions;
|
27
27
|
export type BuilderFileType = 'type' | 'client' | 'recoil' | 'react-query' | 'message-composer' | 'message-builder' | 'plugin';
|
28
28
|
export interface BuilderFile {
|
@@ -25,7 +25,7 @@ const write = (outPath, file, content, varname) => {
|
|
25
25
|
};
|
26
26
|
export const createHelpers = (input, builderContext) => {
|
27
27
|
const files = [];
|
28
|
-
if (input.options?.
|
28
|
+
if (input.options?.useContractHooks?.enabled &&
|
29
29
|
Object.keys(builderContext.providers)?.length) {
|
30
30
|
const useShorthandCtor = input.options?.useShorthandCtor;
|
31
31
|
files.push(write(input.outPath, "contractContextBase.ts", useShorthandCtor
|
@@ -18,7 +18,7 @@ export class ContractsProviderBundlePlugin extends BuilderPluginBase {
|
|
18
18
|
return new RenderContext(contract, options, this.builder.builderContext);
|
19
19
|
}
|
20
20
|
async doRender(name, context) {
|
21
|
-
if (!this.option?.
|
21
|
+
if (!this.option?.useContractHooks?.enabled) {
|
22
22
|
return;
|
23
23
|
}
|
24
24
|
const providerInfos = context.getProviderInfos();
|
package/esm/plugins/provider.js
CHANGED
@@ -17,7 +17,7 @@ export class ContractsContextProviderPlugin extends BuilderPluginBase {
|
|
17
17
|
return new RenderContext(contract, options, this.builder.builderContext);
|
18
18
|
}
|
19
19
|
async doRender(name, context) {
|
20
|
-
if (!this.option?.
|
20
|
+
if (!this.option?.useContractHooks?.enabled) {
|
21
21
|
return;
|
22
22
|
}
|
23
23
|
const providerInfo = context.getProviderInfos()[name];
|
@@ -28,7 +28,7 @@ const write = (outPath, file, content, varname) => {
|
|
28
28
|
};
|
29
29
|
const createHelpers = (input, builderContext) => {
|
30
30
|
const files = [];
|
31
|
-
if (input.options?.
|
31
|
+
if (input.options?.useContractHooks?.enabled &&
|
32
32
|
Object.keys(builderContext.providers)?.length) {
|
33
33
|
const useShorthandCtor = input.options?.useShorthandCtor;
|
34
34
|
files.push(write(input.outPath, "contractContextBase.ts", useShorthandCtor
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@cosmwasm/ts-codegen",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.4.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",
|
@@ -38,7 +38,9 @@
|
|
38
38
|
"ast-stringify": "0.1.0"
|
39
39
|
},
|
40
40
|
"dependencies": {
|
41
|
-
"@babel/
|
41
|
+
"@babel/generator": "7.24.4",
|
42
|
+
"@babel/traverse": "7.24.1",
|
43
|
+
"@babel/types": "7.24.0",
|
42
44
|
"@cosmology/ts-codegen-types": "^1.1.0",
|
43
45
|
"@pyramation/json-schema-to-typescript": " 11.0.4",
|
44
46
|
"@types/rimraf": "3.0.2",
|
@@ -55,7 +57,7 @@
|
|
55
57
|
"parse-package-name": "1.0.0",
|
56
58
|
"rimraf": "3.0.2",
|
57
59
|
"shelljs": "0.8.5",
|
58
|
-
"wasm-ast-types": "^1.
|
60
|
+
"wasm-ast-types": "^1.2.0"
|
59
61
|
},
|
60
62
|
"keywords": [
|
61
63
|
"cosmwasm",
|
@@ -63,5 +65,5 @@
|
|
63
65
|
"smart contracts",
|
64
66
|
"codegen"
|
65
67
|
],
|
66
|
-
"gitHead": "
|
68
|
+
"gitHead": "d8c3043ed7655b205faca52eb17c346ca0369f3c"
|
67
69
|
}
|
@@ -44,7 +44,7 @@ class ContractsProviderBundlePlugin extends plugin_base_1.BuilderPluginBase {
|
|
44
44
|
return new wasm_ast_types_1.RenderContext(contract, options, this.builder.builderContext);
|
45
45
|
}
|
46
46
|
async doRender(name, context) {
|
47
|
-
if (!this.option?.
|
47
|
+
if (!this.option?.useContractHooks?.enabled) {
|
48
48
|
return;
|
49
49
|
}
|
50
50
|
const providerInfos = context.getProviderInfos();
|
package/plugins/provider.js
CHANGED
@@ -45,7 +45,7 @@ class ContractsContextProviderPlugin extends plugin_base_1.BuilderPluginBase {
|
|
45
45
|
return new wasm_ast_types_1.RenderContext(contract, options, this.builder.builderContext);
|
46
46
|
}
|
47
47
|
async doRender(name, context) {
|
48
|
-
if (!this.option?.
|
48
|
+
if (!this.option?.useContractHooks?.enabled) {
|
49
49
|
return;
|
50
50
|
}
|
51
51
|
const providerInfo = context.getProviderInfos()[name];
|