@cosmwasm/ts-codegen 1.13.3 β 1.14.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/LICENSE-Apache +1 -1
- package/LICENSE-MIT +1 -1
- package/README.md +5 -5
- package/dist/LICENSE-Apache +201 -0
- package/dist/LICENSE-MIT +21 -0
- package/dist/README.md +667 -0
- package/dist/package.json +75 -0
- package/esm/ts-codegen.js +0 -0
- package/package.json +6 -7
- package/ts-codegen.js +0 -0
package/LICENSE-Apache
CHANGED
|
@@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work.
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright (c)
|
|
189
|
+
Copyright (c) 2025 Constructive <developers@constructive.io>
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/LICENSE-MIT
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 Constructive <developers@constructive.io>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -10,11 +10,11 @@ Generate TypeScript SDKs for your CosmWasm smart contracts
|
|
|
10
10
|
<a href="https://github.com/hyperweb-io/ts-codegen/actions/workflows/run-tests.yaml">
|
|
11
11
|
<img height="20" src="https://github.com/hyperweb-io/ts-codegen/actions/workflows/run-tests.yaml/badge.svg" />
|
|
12
12
|
</a>
|
|
13
|
-
<a href="https://github.com/
|
|
14
|
-
<img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%
|
|
13
|
+
<a href="https://github.com/constructive-io/lib-count">
|
|
14
|
+
<img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fconstructive-io%2Flib-count%2Fmain%2Foutput%2Fbadges%2Fproducts%2Fcosmwasm%2Ftotal.json"/>
|
|
15
15
|
</a>
|
|
16
|
-
<a href="https://github.com/
|
|
17
|
-
<img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%
|
|
16
|
+
<a href="https://github.com/constructive-io/lib-count">
|
|
17
|
+
<img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fconstructive-io%2Flib-count%2Fmain%2Foutput%2Fbadges%2Fproducts%2Fcosmwasm%2Fmonthly.json"/>
|
|
18
18
|
</a>
|
|
19
19
|
<br />
|
|
20
20
|
<a href="https://github.com/hyperweb-io/ts-codegen/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
|
|
@@ -657,7 +657,7 @@ A unified toolkit for building applications and smart contracts in the Interchai
|
|
|
657
657
|
|
|
658
658
|
## Credits
|
|
659
659
|
|
|
660
|
-
π Built by [
|
|
660
|
+
π Built by the [Constructive](https://constructive.io) team β makers of [Hyperweb](https://hyperweb.io)
|
|
661
661
|
|
|
662
662
|
|
|
663
663
|
## Disclaimer
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright (c) 2025 Constructive <developers@constructive.io>
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/dist/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Constructive <developers@constructive.io>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,667 @@
|
|
|
1
|
+
# @cosmwasm/ts-codegen
|
|
2
|
+
|
|
3
|
+
Generate TypeScript SDKs for your CosmWasm smart contracts
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img width="120" src="https://user-images.githubusercontent.com/545047/191621556-6f1baa40-15ff-4465-8d80-63b3ff9bc23a.svg">
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center" width="100%">
|
|
10
|
+
<a href="https://github.com/hyperweb-io/ts-codegen/actions/workflows/run-tests.yaml">
|
|
11
|
+
<img height="20" src="https://github.com/hyperweb-io/ts-codegen/actions/workflows/run-tests.yaml/badge.svg" />
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://github.com/constructive-io/lib-count">
|
|
14
|
+
<img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fconstructive-io%2Flib-count%2Fmain%2Foutput%2Fbadges%2Fproducts%2Fcosmwasm%2Ftotal.json"/>
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://github.com/constructive-io/lib-count">
|
|
17
|
+
<img height="20" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fconstructive-io%2Flib-count%2Fmain%2Foutput%2Fbadges%2Fproducts%2Fcosmwasm%2Fmonthly.json"/>
|
|
18
|
+
</a>
|
|
19
|
+
<br />
|
|
20
|
+
<a href="https://github.com/hyperweb-io/ts-codegen/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
|
|
21
|
+
<a href="https://github.com/hyperweb-io/ts-codegen/blob/main/LICENSE-Apache"><img height="20" src="https://img.shields.io/badge/license-Apache-blue.svg"></a>
|
|
22
|
+
<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>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
npm install @cosmwasm/ts-codegen
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The quickest and easiest way to interact with CosmWasm Contracts. `@cosmwasm/ts-codegen` converts your CosmWasm smart contracts into dev-friendly TypeScript classes so you can focus on shipping code.
|
|
30
|
+
|
|
31
|
+
π₯ [Checkout our video playlist](https://cosmology.zone/learn/ts-codegen) to learn how to use `ts-codegen`!
|
|
32
|
+
|
|
33
|
+
## Table of contents
|
|
34
|
+
|
|
35
|
+
- [@cosmwasm/ts-codegen](#cosmwasmts-codegen)
|
|
36
|
+
- [Table of contents](#table-of-contents)
|
|
37
|
+
- [Usage](#usage)
|
|
38
|
+
- [Programmatic Usage](#programmatic-usage)
|
|
39
|
+
- [Types](#types)
|
|
40
|
+
- [TS Clients](#client)
|
|
41
|
+
- [React Query](#react-query)
|
|
42
|
+
- [Recoil](#recoil)
|
|
43
|
+
- [Message Composer](#message-composer)
|
|
44
|
+
- [Message Builder](#message-builder)
|
|
45
|
+
- [Use Contracts Hook](#use-contracts-hooks-usage)
|
|
46
|
+
- [Bundles](#bundles)
|
|
47
|
+
- [CLI Usage and Examples](#cli-usage-and-examples)
|
|
48
|
+
- [Advanced Usage](#advanced-usage)
|
|
49
|
+
- [JSON Schema](#json-schema)
|
|
50
|
+
- [JSON Schema Generation](#json-schema-generation)
|
|
51
|
+
- [Exporting Schemas](#exporting-schemas)
|
|
52
|
+
- [Developing](#developing)
|
|
53
|
+
- [Related](#related)
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
56
|
+
|
|
57
|
+
### Programmatic Usage
|
|
58
|
+
|
|
59
|
+
For production usage, we recommend setting up a build script that uses the main entry point:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import codegen from "@cosmwasm/ts-codegen";
|
|
63
|
+
|
|
64
|
+
codegen({
|
|
65
|
+
contracts: [
|
|
66
|
+
{
|
|
67
|
+
name: "SG721",
|
|
68
|
+
dir: "./path/to/sg721/schema",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "Minter",
|
|
72
|
+
dir: "./path/to/Minter/schema",
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
outPath: "./path/to/code/src/",
|
|
76
|
+
|
|
77
|
+
// options are completely optional ;)
|
|
78
|
+
options: {
|
|
79
|
+
bundle: {
|
|
80
|
+
bundleFile: "index.ts",
|
|
81
|
+
scope: "contracts",
|
|
82
|
+
},
|
|
83
|
+
types: {
|
|
84
|
+
enabled: true,
|
|
85
|
+
},
|
|
86
|
+
client: {
|
|
87
|
+
enabled: true,
|
|
88
|
+
},
|
|
89
|
+
reactQuery: {
|
|
90
|
+
enabled: true,
|
|
91
|
+
optionalClient: true,
|
|
92
|
+
version: "v4",
|
|
93
|
+
mutations: true,
|
|
94
|
+
queryKeys: true,
|
|
95
|
+
queryFactory: true,
|
|
96
|
+
},
|
|
97
|
+
recoil: {
|
|
98
|
+
enabled: false,
|
|
99
|
+
},
|
|
100
|
+
messageComposer: {
|
|
101
|
+
enabled: false,
|
|
102
|
+
},
|
|
103
|
+
messageBuilder: {
|
|
104
|
+
enabled: false,
|
|
105
|
+
},
|
|
106
|
+
useContractsHook: {
|
|
107
|
+
enabled: false,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
}).then(() => {
|
|
111
|
+
console.log("β¨ all done!");
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
#### Types
|
|
116
|
+
|
|
117
|
+
Typescript types and interfaces are generated in separate files so they can be imported into various generated plugins.
|
|
118
|
+
|
|
119
|
+
[see example output code](https://github.com/hyperweb-io/ts-codegen/blob/main/__output__/sg721/Sg721.types.ts)
|
|
120
|
+
|
|
121
|
+
#### Types Options
|
|
122
|
+
|
|
123
|
+
| option | description |
|
|
124
|
+
| ------------------------ | --------------------------------------------------------------------- |
|
|
125
|
+
| `types.enabled` | enable type generation |
|
|
126
|
+
| `types.aliasExecuteMsg` | generate a type alias based on the contract name |
|
|
127
|
+
| `types.aliasEntryPoints` | generate type aliases for the entry points based on the contract name |
|
|
128
|
+
|
|
129
|
+
### BaseClient
|
|
130
|
+
The `baseClient.ts` will be generated as dependency for most files. It includes the base client for interchainjs.
|
|
131
|
+
|
|
132
|
+
#### Gas Configuration
|
|
133
|
+
|
|
134
|
+
The generated client provides flexible gas fee configuration options to handle different blockchain networks and fee settings.
|
|
135
|
+
|
|
136
|
+
##### Default Gas Settings
|
|
137
|
+
|
|
138
|
+
By default, the client uses a gas limit of `200000` for all transactions. You can customize this behavior through the `setDefaultGasAmount`.
|
|
139
|
+
|
|
140
|
+
##### ChainConfig Options
|
|
141
|
+
|
|
142
|
+
The `ChainConfig` interface supports two approaches for gas configuration:
|
|
143
|
+
|
|
144
|
+
1. Chain Registry Integration (Recommended)
|
|
145
|
+
|
|
146
|
+
When you provide chain information, the client automatically fetches gas prices from the chain registry:
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
import { useChain } from '@interchain-kit/react';
|
|
150
|
+
|
|
151
|
+
const { chain } = useChain('osmosistestnet');
|
|
152
|
+
const chainConfig: ChainConfig = { chain: chain };
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
2. Manual Gas Price Configuration
|
|
156
|
+
You can explicitly set gas prices for more control:
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
const chainConfig: ChainConfig = {
|
|
160
|
+
gasPrice: {
|
|
161
|
+
denom: 'uosmo',
|
|
162
|
+
amount: '0.025'
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Client
|
|
168
|
+
|
|
169
|
+
The `client` plugin will generate TS client classes for your contracts. This option generates a `QueryClient` for queries as well as a `Client` for queries and mutations.
|
|
170
|
+
|
|
171
|
+
[see example output code](https://github.com/hyperweb-io/ts-codegen/blob/main/__output__/sg721/Sg721.client.ts)
|
|
172
|
+
|
|
173
|
+
#### Client Options
|
|
174
|
+
|
|
175
|
+
| option | description |
|
|
176
|
+
| --------------------------- | ---------------------------------------------------- |
|
|
177
|
+
| `client.enabled` | generate TS client classes for your contracts |
|
|
178
|
+
| `client.execExtendsQuery` | execute should extend query message clients |
|
|
179
|
+
| `client.noImplicitOverride` | should match your tsconfig noImplicitOverride option |
|
|
180
|
+
| `client.useDeclareKeyword` | use declare keyword for inherited class fields |
|
|
181
|
+
|
|
182
|
+
### React Query
|
|
183
|
+
|
|
184
|
+
Generate [react-query v3](https://react-query-v3.tanstack.com/) or [react-query v4](https://tanstack.com/query/v4/) bindings for your contracts with the `react-query` command.
|
|
185
|
+
|
|
186
|
+
[see example output code](https://github.com/hyperweb-io/ts-codegen/blob/main/__output__/sg721/Sg721.react-query.ts)
|
|
187
|
+
|
|
188
|
+
#### React Query Options
|
|
189
|
+
|
|
190
|
+
| option | description |
|
|
191
|
+
| --------------------------- | ---------------------------------------------------------------------------- |
|
|
192
|
+
| `reactQuery.enabled` | enable the react-query plugin |
|
|
193
|
+
| `reactQuery.optionalClient` | allows contract client to be undefined as the component renders |
|
|
194
|
+
| `reactQuery.queryKeys` | generates a const queryKeys object for use with invalidations and set values |
|
|
195
|
+
| `reactQuery.queryFactory` | generates a const queryFactory object for useQueries and prefetchQueries use |
|
|
196
|
+
| `reactQuery.version` | `v4` uses `@tanstack/react-query` and `v3` uses `react-query` |
|
|
197
|
+
| `reactQuery.mutations` | also generate mutations |
|
|
198
|
+
| `reactQuery.camelize` | use camelCase style for property names |
|
|
199
|
+
|
|
200
|
+
### Recoil
|
|
201
|
+
|
|
202
|
+
Generate [recoil](https://recoiljs.org/) bindings for your contracts with the `recoil` command.
|
|
203
|
+
|
|
204
|
+
[see example output code](https://github.com/hyperweb-io/ts-codegen/blob/main/__output__/sg721/Sg721.recoil.ts)
|
|
205
|
+
|
|
206
|
+
#### Recoil Options
|
|
207
|
+
|
|
208
|
+
| option | description |
|
|
209
|
+
| ---------------- | ------------------------ |
|
|
210
|
+
| `recoil.enabled` | enable the recoil plugin |
|
|
211
|
+
|
|
212
|
+
### Message Composer
|
|
213
|
+
|
|
214
|
+
Generate pure message objects with the proper `utf8` encoding and `typeUrl` configured that you can broadcast yourself via `interchainjs` with the `message-composer` command.
|
|
215
|
+
|
|
216
|
+
[see example output code](https://github.com/hyperweb-io/ts-codegen/blob/main/__output__/sg721/Sg721.message-composer.ts)
|
|
217
|
+
|
|
218
|
+
#### Message Composer Options
|
|
219
|
+
|
|
220
|
+
| option | description |
|
|
221
|
+
| ------------------------- | --------------------------------- |
|
|
222
|
+
| `messageComposer.enabled` | enable the messageComposer plugin |
|
|
223
|
+
|
|
224
|
+
### Message Builder
|
|
225
|
+
|
|
226
|
+
Generate raw message jsons for use in your application with the `message-builder` command.
|
|
227
|
+
|
|
228
|
+
[see example output code](https://github.com/hyperweb-io/ts-codegen/blob/main/__output__/sg721/Sg721.message-builder.ts)
|
|
229
|
+
|
|
230
|
+
#### Message Builder Options
|
|
231
|
+
|
|
232
|
+
| option | description |
|
|
233
|
+
| ------------------------ | -------------------------------- |
|
|
234
|
+
| `messageBuilder.enabled` | enable the messageBuilder plugin |
|
|
235
|
+
|
|
236
|
+
### `useContracts` Hook
|
|
237
|
+
|
|
238
|
+
Generates `useContracts` hook to easily access contracts, already equipped with a signing client
|
|
239
|
+
|
|
240
|
+
| option | description |
|
|
241
|
+
| -------------------------- | -------------------------------- |
|
|
242
|
+
| `useContractsHook.enabled` | enable the `useContracts` plugin |
|
|
243
|
+
|
|
244
|
+
#### Example Output
|
|
245
|
+
|
|
246
|
+
- [Provider](https://github.com/hyperweb-io/ts-codegen/blob/main/__output__/builder/bundler_test/contracts/Factory.provider.ts)
|
|
247
|
+
- [Contract Providers](https://github.com/hyperweb-io/ts-codegen/blob/main/__output__/builder/bundler_test/contracts/contractContextProviders.ts)
|
|
248
|
+
- [Contract Context](https://github.com/hyperweb-io/ts-codegen/blob/main/__output__/builder/bundler_test/contracts/contracts-context.tsx)
|
|
249
|
+
- [Context Base](https://github.com/hyperweb-io/ts-codegen/blob/main/__output__/builder/bundler_test/contracts/contractContextBase.ts)
|
|
250
|
+
|
|
251
|
+
#### Use Contracts Provider Usage
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
import { useChain } from "@cosmos-kit/react";
|
|
255
|
+
import { ContractsProvider } from "../path/to/codegen/contracts-context";
|
|
256
|
+
|
|
257
|
+
export default function YourComponent() {
|
|
258
|
+
const { address, getCosmWasmClient, getSigningCosmWasmClient } =
|
|
259
|
+
useChain(chainName);
|
|
260
|
+
|
|
261
|
+
return (
|
|
262
|
+
<ContractsProvider
|
|
263
|
+
contractsConfig={{
|
|
264
|
+
address,
|
|
265
|
+
getCosmWasmClient,
|
|
266
|
+
getSigningCosmWasmClient,
|
|
267
|
+
}}
|
|
268
|
+
>
|
|
269
|
+
<SomeCoolComponent />
|
|
270
|
+
</ContractsProvider>
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
#### Use Contracts Provider Babel/TSC config
|
|
276
|
+
|
|
277
|
+
If you're using Babel, please make sure include `'@babel/preset-react'` in devDeps and presets in `.babelrc.js`:
|
|
278
|
+
|
|
279
|
+
```js
|
|
280
|
+
presets: ["@babel/typescript", "@babel/env", "@babel/preset-react"];
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
For `tsc`, you should set the `jsx` option to `'react'` in your `tsconfig.json`.
|
|
284
|
+
|
|
285
|
+
#### Use Contracts Hooks Usage
|
|
286
|
+
|
|
287
|
+
Once enabled, you can get contracts very simply:
|
|
288
|
+
|
|
289
|
+
```ts
|
|
290
|
+
const { marketplace } = useContracts();
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
```ts
|
|
294
|
+
const marketplaceClient = marketplace.signingClient(marketplaceContract);
|
|
295
|
+
await marketplaceClient.updateAskPrice({
|
|
296
|
+
collection: token.collectionAddr,
|
|
297
|
+
price: {
|
|
298
|
+
amount,
|
|
299
|
+
denom,
|
|
300
|
+
},
|
|
301
|
+
tokenId,
|
|
302
|
+
});
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Bundles
|
|
306
|
+
|
|
307
|
+
The bundler will make a nice package of all your contracts. For example:
|
|
308
|
+
|
|
309
|
+
```ts
|
|
310
|
+
const { MinterQueryClient, useMinterConfigQuery } = contracts.Minter;
|
|
311
|
+
|
|
312
|
+
const { CwAdminFactoryClient } = contracts.CwAdminFactory;
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
#### Bundler Options
|
|
316
|
+
|
|
317
|
+
| option | description |
|
|
318
|
+
| ------------------- | -------------------------------------------------------------------------------- |
|
|
319
|
+
| `bundle.enabled` | enable the bundler plugin |
|
|
320
|
+
| `bundle.scope` | name of the scope, defaults to `contracts` (you can use `.` to make more scopes) |
|
|
321
|
+
| `bundle.bundleFile` | name of the bundle file |
|
|
322
|
+
|
|
323
|
+
#### Coding Style
|
|
324
|
+
|
|
325
|
+
| option | description | default |
|
|
326
|
+
| ------------------ | ----------------------------------- | ------- |
|
|
327
|
+
| `useShorthandCtor` | Enable using shorthand constructor. | true |
|
|
328
|
+
|
|
329
|
+
Using shorthand constructor (Might not be transpiled correctly with babel):
|
|
330
|
+
|
|
331
|
+
```ts
|
|
332
|
+
constructor(
|
|
333
|
+
protected address: string | undefined,
|
|
334
|
+
protected cosmWasmClient: CosmWasmClient | undefined,
|
|
335
|
+
protected signingCosmWasmClient: SigningCosmWasmClient | undefined,
|
|
336
|
+
private TSign?: new (
|
|
337
|
+
client: SigningCosmWasmClient,
|
|
338
|
+
sender: string,
|
|
339
|
+
contractAddress: string
|
|
340
|
+
) => TSign,
|
|
341
|
+
private TQuery?: new (
|
|
342
|
+
client: CosmWasmClient,
|
|
343
|
+
contractAddress: string
|
|
344
|
+
) => TQuery,
|
|
345
|
+
private TMsgComposer?: new (
|
|
346
|
+
sender: string,
|
|
347
|
+
contractAddress: string
|
|
348
|
+
) => TMsgComposer
|
|
349
|
+
) {}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
Without using shorthand constructor:
|
|
353
|
+
|
|
354
|
+
```ts
|
|
355
|
+
address: string | undefined;
|
|
356
|
+
...
|
|
357
|
+
TMsgComposer?: new (
|
|
358
|
+
sender: string,
|
|
359
|
+
contractAddress: string
|
|
360
|
+
) => TMsgComposer;
|
|
361
|
+
|
|
362
|
+
constructor(
|
|
363
|
+
address: string | undefined,
|
|
364
|
+
...
|
|
365
|
+
TMsgComposer?: new (
|
|
366
|
+
sender: string,
|
|
367
|
+
contractAddress: string
|
|
368
|
+
) => TMsgComposer
|
|
369
|
+
) {
|
|
370
|
+
this.address = address;
|
|
371
|
+
...
|
|
372
|
+
this.TMsgComposer = TMsgComposer;
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### CLI Usage and Examples
|
|
377
|
+
|
|
378
|
+
You can get started quickly using our `cli` by globally installing via npm:
|
|
379
|
+
|
|
380
|
+
```
|
|
381
|
+
npm install @cosmwasm/ts-codegen
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
Clone your project and `cd` into your contracts folder
|
|
385
|
+
|
|
386
|
+
```sh
|
|
387
|
+
git clone https://github.com/hyperweb-io/launchpad.git
|
|
388
|
+
cd launchpad/contracts/whitelists/whitelist
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Run `ts-codegen` or `cosmwasm-ts-codegen` to generate your code.
|
|
392
|
+
|
|
393
|
+
```sh
|
|
394
|
+
ts-codegen generate \
|
|
395
|
+
--plugin client \
|
|
396
|
+
--schema ./schema \
|
|
397
|
+
--out ./ts \
|
|
398
|
+
--name Whitelist \
|
|
399
|
+
--no-bundle
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
The output will be in the folder specified by `--out`, enjoy!
|
|
403
|
+
|
|
404
|
+
#### Interactive prompt
|
|
405
|
+
|
|
406
|
+
The CLI is interactive, and if you don't specify an option, it will interactively prompt you.
|
|
407
|
+
|
|
408
|
+
```sh
|
|
409
|
+
cosmwasm-ts-codegen generate
|
|
410
|
+
? [plugin] which plugins? (Press <space> to select, <a> to toggle all, <i> to invert selection)
|
|
411
|
+
β―β― client
|
|
412
|
+
β― recoil
|
|
413
|
+
β― react-query
|
|
414
|
+
β― message-composer
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
In this example, you can press space bar to select a number of plugins you wish you enable.
|
|
418
|
+
|
|
419
|
+
#### Specifying Plugins
|
|
420
|
+
|
|
421
|
+
Additionally, it will also show you the name of the field (in this case `plugin`) so you can specify the parameter (for example when using CI/CD) on the comand line. Here is an exampl with `--plugin` set to `client` via CLI:
|
|
422
|
+
|
|
423
|
+
```sh
|
|
424
|
+
ts-codegen generate \
|
|
425
|
+
--plugin client
|
|
426
|
+
--schema ./schema \
|
|
427
|
+
--out ./ts \
|
|
428
|
+
--name MyContractName
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
You can specify multiple `--plugin` options using the `generate` command:
|
|
432
|
+
|
|
433
|
+
```sh
|
|
434
|
+
ts-codegen generate \
|
|
435
|
+
--plugin client \
|
|
436
|
+
--plugin recoil \
|
|
437
|
+
--schema ./schema \
|
|
438
|
+
--out ./ts \
|
|
439
|
+
--name SG721
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
#### Bypassing the Prompt
|
|
443
|
+
|
|
444
|
+
All options can be provided so you can bypass the prompt.
|
|
445
|
+
|
|
446
|
+
For confirm options, you can pass `--no-<name>` to set the value to false. Here is an example without optional client, using v3 for `react-query`, without mutations:
|
|
447
|
+
|
|
448
|
+
```sh
|
|
449
|
+
ts-codegen generate \
|
|
450
|
+
--plugin client \
|
|
451
|
+
--plugin react-query \
|
|
452
|
+
--schema ./schema \
|
|
453
|
+
--out ./ts \
|
|
454
|
+
--name MyContractName \
|
|
455
|
+
--version v3 \
|
|
456
|
+
--no-optionalClient \
|
|
457
|
+
--no-mutations
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
Example with optional client, using v4, with mutations:
|
|
461
|
+
|
|
462
|
+
```sh
|
|
463
|
+
ts-codegen generate \
|
|
464
|
+
--plugin react-query \
|
|
465
|
+
--schema ./schema \
|
|
466
|
+
--out ./ts \
|
|
467
|
+
--name MyContractName \
|
|
468
|
+
--optionalClient \
|
|
469
|
+
--version v4 \
|
|
470
|
+
--mutations
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
#### Types Only Option
|
|
474
|
+
|
|
475
|
+
If needed, you can generate only the types with the `typesOnly` option;
|
|
476
|
+
|
|
477
|
+
```sh
|
|
478
|
+
ts-codegen generate \
|
|
479
|
+
--typesOnly \
|
|
480
|
+
--schema ./schema \
|
|
481
|
+
--out ./ts \
|
|
482
|
+
--name SG721
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
#### Client via CLI
|
|
486
|
+
|
|
487
|
+
```sh
|
|
488
|
+
ts-codegen generate \
|
|
489
|
+
--plugin client
|
|
490
|
+
--schema ./schema \
|
|
491
|
+
--out ./ts \
|
|
492
|
+
--name MyContractName
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
#### React Query via CLI
|
|
496
|
+
|
|
497
|
+
Here is an example without optional client, using v3 for `react-query`, without mutations:
|
|
498
|
+
|
|
499
|
+
```sh
|
|
500
|
+
ts-codegen generate \
|
|
501
|
+
--plugin client \
|
|
502
|
+
--plugin react-query \
|
|
503
|
+
--schema ./schema \
|
|
504
|
+
--out ./ts \
|
|
505
|
+
--name MyContractName \
|
|
506
|
+
--version v3 \
|
|
507
|
+
--no-optionalClient \
|
|
508
|
+
--no-mutations
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
Example with optional client, using v4, with mutations:
|
|
512
|
+
|
|
513
|
+
```sh
|
|
514
|
+
ts-codegen generate \
|
|
515
|
+
--plugin react-query \
|
|
516
|
+
--schema ./schema \
|
|
517
|
+
--out ./ts \
|
|
518
|
+
--name MyContractName \
|
|
519
|
+
--optionalClient \
|
|
520
|
+
--version v4 \
|
|
521
|
+
--mutations
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
#### Recoil via CLI
|
|
525
|
+
|
|
526
|
+
```sh
|
|
527
|
+
ts-codegen generate \
|
|
528
|
+
--plugin recoil \
|
|
529
|
+
--schema ./schema \
|
|
530
|
+
--out ./ts \
|
|
531
|
+
--name MyContractName
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
#### Message Composer via CLI
|
|
535
|
+
|
|
536
|
+
```sh
|
|
537
|
+
ts-codegen generate \
|
|
538
|
+
--plugin message-composer \
|
|
539
|
+
--schema ./schema \
|
|
540
|
+
--out ./ts \
|
|
541
|
+
--name MyContractName
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
#### Message Builder via CLI
|
|
545
|
+
|
|
546
|
+
```sh
|
|
547
|
+
ts-codegen generate \
|
|
548
|
+
--plugin message-builder \
|
|
549
|
+
--schema ./schema \
|
|
550
|
+
--out ./ts \
|
|
551
|
+
--name MyContractName
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
### JSON Schema
|
|
555
|
+
|
|
556
|
+
We generate code from the [JSON Schema](https://json-schema.org/) exported from CosmWasm smart contracts.
|
|
557
|
+
|
|
558
|
+
### JSON Schema Generation
|
|
559
|
+
|
|
560
|
+
Currently you have to have the JSON Schema output. Here is an example to start.
|
|
561
|
+
|
|
562
|
+
First, get the Rust contracts and run `cargo build`:
|
|
563
|
+
|
|
564
|
+
```sh
|
|
565
|
+
git clone git@github.com:public-awesome/stargaze-contracts.git
|
|
566
|
+
cd stargaze-contracts
|
|
567
|
+
cargo build
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
now build the schema with `cargo schema`
|
|
571
|
+
|
|
572
|
+
```sh
|
|
573
|
+
cd contracts/sg721/
|
|
574
|
+
cargo schema
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
### Exporting Schemas
|
|
578
|
+
|
|
579
|
+
#### `cosmwasm v1.1` Example
|
|
580
|
+
|
|
581
|
+
Using the new `write_api` method, you can export schemas:
|
|
582
|
+
|
|
583
|
+
```rs
|
|
584
|
+
use cosmwasm_schema::write_api;
|
|
585
|
+
|
|
586
|
+
use cw4_group::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};
|
|
587
|
+
|
|
588
|
+
fn main() {
|
|
589
|
+
write_api! {
|
|
590
|
+
instantiate: InstantiateMsg,
|
|
591
|
+
execute: ExecuteMsg,
|
|
592
|
+
query: QueryMsg,
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
#### `cosmwasm_std` Example
|
|
598
|
+
|
|
599
|
+
Here is a legacy example:
|
|
600
|
+
|
|
601
|
+
```rs
|
|
602
|
+
use cosmwasm_std::{Addr, CosmosMsg, Empty};
|
|
603
|
+
|
|
604
|
+
export_schema_with_title(&schema_for!(MinterData), &out_dir, "MinterResponse");
|
|
605
|
+
export_schema_with_title(&schema_for!(Addr), &out_dir, "StakingResponse");
|
|
606
|
+
export_schema_with_title(&schema_for!(Addr), &out_dir, "DaoResponse");
|
|
607
|
+
export_schema_with_title(
|
|
608
|
+
&schema_for!(CosmosMsg<Empty>),
|
|
609
|
+
&out_dir,
|
|
610
|
+
"CosmosMsg_for_Empty",
|
|
611
|
+
);
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
## Developing
|
|
615
|
+
|
|
616
|
+
### Initial setup
|
|
617
|
+
|
|
618
|
+
```
|
|
619
|
+
yarn
|
|
620
|
+
yarn bootstrap
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
### Building
|
|
624
|
+
|
|
625
|
+
```
|
|
626
|
+
yarn build
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
### Tests
|
|
630
|
+
|
|
631
|
+
Then `cd` into a package and run the tests
|
|
632
|
+
|
|
633
|
+
```
|
|
634
|
+
cd ./packages/ast
|
|
635
|
+
yarn test:watch
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
### Working with ASTs
|
|
639
|
+
|
|
640
|
+
See the [docs](https://github.com/hyperweb-io/ts-codegen/blob/main/packages/ast/README.md) in the `@cosmwasm/ts-codegen-ast` package.
|
|
641
|
+
|
|
642
|
+
## Interchain JavaScript Stack
|
|
643
|
+
|
|
644
|
+
A unified toolkit for building applications and smart contracts in the Interchain ecosystem βοΈ
|
|
645
|
+
|
|
646
|
+
| Category | Tools | Description |
|
|
647
|
+
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
648
|
+
| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. |
|
|
649
|
+
| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)<sup>beta</sup>, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. |
|
|
650
|
+
| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)<sup>beta</sup>, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network |
|
|
651
|
+
| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. |
|
|
652
|
+
| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)<sup>beta</sup>, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. |
|
|
653
|
+
| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. |
|
|
654
|
+
| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. |
|
|
655
|
+
| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript |
|
|
656
|
+
| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/hyperweb-io/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. |
|
|
657
|
+
|
|
658
|
+
## Credits
|
|
659
|
+
|
|
660
|
+
π Built by the [Constructive](https://constructive.io) team β makers of [Hyperweb](https://hyperweb.io)
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
## Disclaimer
|
|
664
|
+
|
|
665
|
+
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED βAS ISβ, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
|
|
666
|
+
|
|
667
|
+
No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cosmwasm/ts-codegen",
|
|
3
|
+
"version": "1.14.1",
|
|
4
|
+
"description": "@cosmwasm/ts-codegen converts your CosmWasm smart contracts into dev-friendly TypeScript classes so you can focus on shipping code.",
|
|
5
|
+
"author": "Constructive <developers@constructive.io>",
|
|
6
|
+
"homepage": "https://github.com/hyperweb-io/ts-codegen",
|
|
7
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"module": "esm/index.js",
|
|
10
|
+
"types": "index.d.ts",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public",
|
|
13
|
+
"directory": "dist"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"cosmwasm-ts-codegen": "ts-codegen.js",
|
|
17
|
+
"ts-codegen": "ts-codegen.js"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"copy": "copyfiles -f LICENSE-Apache LICENSE-MIT README.md package.json dist",
|
|
21
|
+
"clean": "rimraf dist/**",
|
|
22
|
+
"prepare": "npm run build",
|
|
23
|
+
"cmds": "tsx ./scripts/cmds.ts",
|
|
24
|
+
"build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy",
|
|
25
|
+
"lint": "eslint . --fix",
|
|
26
|
+
"format": "prettier --write --log-level warn \"./**/*.ts\"",
|
|
27
|
+
"test": "jest",
|
|
28
|
+
"test:watch": "jest --watch",
|
|
29
|
+
"dev": "tsx src/ts-codegen",
|
|
30
|
+
"file": "tsx src/file"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/hyperweb-io/ts-codegen"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/hyperweb-io/ts-codegen/issues"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@babel/generator": "7.24.4",
|
|
41
|
+
"@babel/traverse": "7.24.1",
|
|
42
|
+
"@babel/types": "7.24.0",
|
|
43
|
+
"@chain-registry/types": "^0.17.1",
|
|
44
|
+
"@chain-registry/utils": "^1.51.71",
|
|
45
|
+
"@chain-registry/v2": "^1.71.229",
|
|
46
|
+
"@cosmwasm/ts-codegen-ast": "^1.10.0",
|
|
47
|
+
"@cosmwasm/ts-codegen-types": "^1.5.0",
|
|
48
|
+
"@interchainjs/amino": "1.17.1",
|
|
49
|
+
"@interchainjs/cosmos": "1.17.1",
|
|
50
|
+
"@interchainjs/types": "1.17.1",
|
|
51
|
+
"@pyramation/json-schema-to-typescript": " 11.0.4",
|
|
52
|
+
"@types/rimraf": "3.0.2",
|
|
53
|
+
"@types/shelljs": "0.8.15",
|
|
54
|
+
"case": "1.6.3",
|
|
55
|
+
"dargs": "7.0.0",
|
|
56
|
+
"deepmerge": "4.2.2",
|
|
57
|
+
"fuzzy": "0.1.3",
|
|
58
|
+
"glob": "^10",
|
|
59
|
+
"inquirerer": "0.1.3",
|
|
60
|
+
"interchainjs": "1.17.1",
|
|
61
|
+
"minimatch": "^10.0.3",
|
|
62
|
+
"minimist": "1.2.6",
|
|
63
|
+
"mkdirp": "1.0.4",
|
|
64
|
+
"nested-obj": "0.2.2",
|
|
65
|
+
"parse-package-name": "1.0.0",
|
|
66
|
+
"rimraf": "3.0.2",
|
|
67
|
+
"shelljs": "0.8.5"
|
|
68
|
+
},
|
|
69
|
+
"keywords": [
|
|
70
|
+
"cosmwasm",
|
|
71
|
+
"interchain",
|
|
72
|
+
"smart contracts",
|
|
73
|
+
"codegen"
|
|
74
|
+
]
|
|
75
|
+
}
|
package/esm/ts-codegen.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmwasm/ts-codegen",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.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
|
-
"author": "
|
|
5
|
+
"author": "Constructive <developers@constructive.io>",
|
|
6
6
|
"homepage": "https://github.com/hyperweb-io/ts-codegen",
|
|
7
7
|
"license": "SEE LICENSE IN LICENSE",
|
|
8
8
|
"main": "index.js",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"@chain-registry/types": "^0.17.1",
|
|
44
44
|
"@chain-registry/utils": "^1.51.71",
|
|
45
45
|
"@chain-registry/v2": "^1.71.229",
|
|
46
|
-
"@cosmwasm/ts-codegen-ast": "^1.
|
|
47
|
-
"@cosmwasm/ts-codegen-types": "^1.
|
|
46
|
+
"@cosmwasm/ts-codegen-ast": "^1.10.0",
|
|
47
|
+
"@cosmwasm/ts-codegen-types": "^1.5.0",
|
|
48
48
|
"@interchainjs/amino": "1.17.1",
|
|
49
49
|
"@interchainjs/cosmos": "1.17.1",
|
|
50
50
|
"@interchainjs/types": "1.17.1",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"minimatch": "^10.0.3",
|
|
62
62
|
"minimist": "1.2.6",
|
|
63
63
|
"mkdirp": "1.0.4",
|
|
64
|
-
"nested-obj": "0.
|
|
64
|
+
"nested-obj": "0.2.2",
|
|
65
65
|
"parse-package-name": "1.0.0",
|
|
66
66
|
"rimraf": "3.0.2",
|
|
67
67
|
"shelljs": "0.8.5"
|
|
@@ -71,6 +71,5 @@
|
|
|
71
71
|
"interchain",
|
|
72
72
|
"smart contracts",
|
|
73
73
|
"codegen"
|
|
74
|
-
]
|
|
75
|
-
"gitHead": "9f7a1f7bc4ce7c86b145c9c2c32ff544fc1b252a"
|
|
74
|
+
]
|
|
76
75
|
}
|
package/ts-codegen.js
CHANGED
|
File without changes
|