@cosmwasm/ts-codegen 0.35.7 → 1.1.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 (250) hide show
  1. package/LICENSE-Apache +201 -0
  2. package/LICENSE-MIT +21 -0
  3. package/README.md +106 -101
  4. package/{types/src/builder → builder}/builder.d.ts +2 -2
  5. package/builder/builder.js +172 -0
  6. package/builder/index.js +17 -0
  7. package/bundler/bundler.d.ts +8 -0
  8. package/bundler/bundler.js +79 -0
  9. package/bundler/index.js +17 -0
  10. package/cli.d.ts +2 -0
  11. package/cli.js +24 -0
  12. package/cmds.d.ts +2 -0
  13. package/cmds.js +14 -0
  14. package/commands/create-boilerplate.d.ts +3 -0
  15. package/commands/create-boilerplate.js +132 -0
  16. package/commands/generate.d.ts +3 -0
  17. package/commands/generate.js +175 -0
  18. package/commands/install.d.ts +3 -0
  19. package/commands/install.js +107 -0
  20. package/{src/builder/builder.ts → esm/builder/builder.js} +39 -139
  21. package/esm/builder/index.js +1 -0
  22. package/esm/bundler/bundler.js +47 -0
  23. package/esm/bundler/index.js +1 -0
  24. package/esm/cli.js +20 -0
  25. package/{src → esm}/cmds.js +0 -1
  26. package/{src/commands/create-boilerplate.ts → esm/commands/create-boilerplate.js} +35 -70
  27. package/{src/commands/generate.ts → esm/commands/generate.js} +19 -24
  28. package/{src/commands/install.ts → esm/commands/install.js} +22 -35
  29. package/esm/file.js +18 -0
  30. package/esm/generators/client.js +67 -0
  31. package/esm/generators/create-helpers.js +36 -0
  32. package/esm/generators/message-builder.js +58 -0
  33. package/esm/generators/message-composer.js +55 -0
  34. package/esm/generators/react-query.js +76 -0
  35. package/esm/generators/recoil.js +58 -0
  36. package/esm/generators/types.js +58 -0
  37. package/{src/index.ts → esm/index.js} +4 -6
  38. package/esm/plugins/client.js +59 -0
  39. package/esm/plugins/message-builder.js +52 -0
  40. package/esm/plugins/message-composer.js +46 -0
  41. package/esm/plugins/plugin-base.js +47 -0
  42. package/esm/plugins/provider-bundle.js +58 -0
  43. package/esm/plugins/provider.js +73 -0
  44. package/esm/plugins/react-query.js +69 -0
  45. package/esm/plugins/recoil.js +51 -0
  46. package/esm/plugins/types.js +38 -0
  47. package/{src → esm}/ts-codegen.js +1 -2
  48. package/{src/utils/clean.ts → esm/utils/clean.js} +7 -7
  49. package/{src/utils/cleanse.ts → esm/utils/cleanse.js} +18 -22
  50. package/esm/utils/files.js +42 -0
  51. package/{src/utils/parse.ts → esm/utils/parse.js} +4 -13
  52. package/esm/utils/prompt.js +59 -0
  53. package/{src/utils/schemas.ts → esm/utils/schemas.js} +16 -44
  54. package/esm/utils/unused.js +47 -0
  55. package/file.js +20 -0
  56. package/generators/client.js +95 -0
  57. package/generators/create-helpers.js +43 -0
  58. package/generators/message-builder.js +86 -0
  59. package/generators/message-composer.js +83 -0
  60. package/generators/react-query.js +104 -0
  61. package/generators/recoil.js +86 -0
  62. package/generators/types.js +86 -0
  63. package/{module/helpers → helpers}/contractContextBase.js +5 -2
  64. package/{module/helpers → helpers}/contractContextBaseShortHandCtor.js +5 -2
  65. package/{module/helpers → helpers}/contractsContextTSX.js +5 -2
  66. package/{module/helpers/index.js → helpers/index.d.ts} +1 -1
  67. package/helpers/index.js +19 -0
  68. package/{types/src/index.d.ts → index.d.ts} +1 -0
  69. package/index.js +41 -0
  70. package/package.json +28 -63
  71. package/plugins/client.js +86 -0
  72. package/plugins/index.d.ts +1 -0
  73. package/plugins/index.js +17 -0
  74. package/plugins/message-builder.js +79 -0
  75. package/plugins/message-composer.js +73 -0
  76. package/{types/src/plugins → plugins}/plugin-base.d.ts +1 -1
  77. package/plugins/plugin-base.js +77 -0
  78. package/plugins/provider-bundle.js +85 -0
  79. package/{types/src/plugins → plugins}/provider.d.ts +2 -2
  80. package/plugins/provider.js +102 -0
  81. package/plugins/react-query.js +96 -0
  82. package/plugins/recoil.js +78 -0
  83. package/plugins/types.js +65 -0
  84. package/ts-codegen.js +8 -0
  85. package/utils/clean.js +49 -0
  86. package/utils/cleanse.js +89 -0
  87. package/utils/files.js +73 -0
  88. package/utils/header.js +14 -0
  89. package/utils/index.d.ts +1 -0
  90. package/utils/index.js +17 -0
  91. package/utils/parse.d.ts +1 -0
  92. package/utils/parse.js +43 -0
  93. package/utils/prompt.d.ts +3 -0
  94. package/utils/prompt.js +65 -0
  95. package/utils/schemas.d.ts +11 -0
  96. package/utils/schemas.js +81 -0
  97. package/utils/unused.js +73 -0
  98. package/main/builder/builder.js +0 -308
  99. package/main/builder/index.js +0 -16
  100. package/main/bundler/bundler.js +0 -61
  101. package/main/bundler/index.js +0 -16
  102. package/main/cli.js +0 -51
  103. package/main/cmds.js +0 -15
  104. package/main/commands/create-boilerplate.js +0 -166
  105. package/main/commands/generate.js +0 -196
  106. package/main/commands/install.js +0 -138
  107. package/main/file.js +0 -35
  108. package/main/generators/client.js +0 -90
  109. package/main/generators/create-helpers.js +0 -38
  110. package/main/generators/message-composer.js +0 -77
  111. package/main/generators/msg-builder.js +0 -84
  112. package/main/generators/react-query.js +0 -102
  113. package/main/generators/recoil.js +0 -81
  114. package/main/generators/types.js +0 -82
  115. package/main/helpers/contractContextBase.js +0 -8
  116. package/main/helpers/contractContextBaseShortHandCtor.js +0 -8
  117. package/main/helpers/contractsContextTSX.js +0 -8
  118. package/main/helpers/index.js +0 -38
  119. package/main/index.js +0 -119
  120. package/main/plugins/client.js +0 -112
  121. package/main/plugins/index.js +0 -16
  122. package/main/plugins/message-builder.js +0 -102
  123. package/main/plugins/message-composer.js +0 -98
  124. package/main/plugins/plugin-base.js +0 -103
  125. package/main/plugins/provider-bundle.js +0 -108
  126. package/main/plugins/provider.js +0 -126
  127. package/main/plugins/react-query.js +0 -120
  128. package/main/plugins/recoil.js +0 -108
  129. package/main/plugins/types.js +0 -89
  130. package/main/ts-codegen.js +0 -20
  131. package/main/utils/clean.js +0 -53
  132. package/main/utils/cleanse.js +0 -87
  133. package/main/utils/files.js +0 -57
  134. package/main/utils/header.js +0 -11
  135. package/main/utils/index.js +0 -16
  136. package/main/utils/parse.js +0 -44
  137. package/main/utils/prompt.js +0 -98
  138. package/main/utils/schemas.js +0 -144
  139. package/main/utils/unused.js +0 -57
  140. package/module/builder/builder.js +0 -143
  141. package/module/builder/index.js +0 -1
  142. package/module/bundler/bundler.js +0 -36
  143. package/module/bundler/index.js +0 -1
  144. package/module/cli.js +0 -19
  145. package/module/cmds.js +0 -8
  146. package/module/commands/create-boilerplate.js +0 -102
  147. package/module/commands/generate.js +0 -163
  148. package/module/commands/install.js +0 -98
  149. package/module/file.js +0 -18
  150. package/module/generators/client.js +0 -65
  151. package/module/generators/create-helpers.js +0 -33
  152. package/module/generators/message-composer.js +0 -52
  153. package/module/generators/msg-builder.js +0 -58
  154. package/module/generators/react-query.js +0 -75
  155. package/module/generators/recoil.js +0 -53
  156. package/module/generators/types.js +0 -55
  157. package/module/index.js +0 -14
  158. package/module/plugins/client.js +0 -63
  159. package/module/plugins/index.js +0 -1
  160. package/module/plugins/message-builder.js +0 -55
  161. package/module/plugins/message-composer.js +0 -49
  162. package/module/plugins/plugin-base.js +0 -66
  163. package/module/plugins/provider-bundle.js +0 -56
  164. package/module/plugins/provider.js +0 -68
  165. package/module/plugins/react-query.js +0 -72
  166. package/module/plugins/recoil.js +0 -57
  167. package/module/plugins/types.js +0 -42
  168. package/module/ts-codegen.js +0 -6
  169. package/module/utils/clean.js +0 -44
  170. package/module/utils/cleanse.js +0 -78
  171. package/module/utils/files.js +0 -40
  172. package/module/utils/header.js +0 -8
  173. package/module/utils/index.js +0 -1
  174. package/module/utils/parse.js +0 -35
  175. package/module/utils/prompt.js +0 -63
  176. package/module/utils/schemas.js +0 -85
  177. package/module/utils/unused.js +0 -43
  178. package/src/builder/index.ts +0 -1
  179. package/src/bundler/bundler.ts +0 -67
  180. package/src/bundler/index.ts +0 -1
  181. package/src/cli.js +0 -21
  182. package/src/file.js +0 -20
  183. package/src/generators/client.ts +0 -109
  184. package/src/generators/create-helpers.ts +0 -71
  185. package/src/generators/message-composer.ts +0 -86
  186. package/src/generators/msg-builder.ts +0 -78
  187. package/src/generators/react-query.ts +0 -102
  188. package/src/generators/recoil.ts +0 -92
  189. package/src/generators/types.ts +0 -94
  190. package/src/helpers/index.ts +0 -3
  191. package/src/plugins/client.ts +0 -124
  192. package/src/plugins/index.ts +0 -1
  193. package/src/plugins/message-builder.ts +0 -85
  194. package/src/plugins/message-composer.ts +0 -89
  195. package/src/plugins/plugin-base.ts +0 -122
  196. package/src/plugins/provider-bundle.ts +0 -98
  197. package/src/plugins/provider.ts +0 -115
  198. package/src/plugins/react-query.ts +0 -115
  199. package/src/plugins/recoil.ts +0 -89
  200. package/src/plugins/types.ts +0 -74
  201. package/src/utils/files.ts +0 -73
  202. package/src/utils/index.ts +0 -1
  203. package/src/utils/prompt.js +0 -65
  204. package/src/utils/unused.ts +0 -52
  205. package/types/src/bundler/bundler.d.ts +0 -4
  206. package/types/src/cli.d.ts +0 -1
  207. package/types/src/cmds.d.ts +0 -1
  208. package/types/src/commands/create-boilerplate.d.ts +0 -2
  209. package/types/src/commands/generate.d.ts +0 -2
  210. package/types/src/commands/install.d.ts +0 -2
  211. package/types/src/generators/msg-builder.ts +0 -5
  212. package/types/src/plugins/msg-builder.d.ts +0 -12
  213. package/types/src/plugins/use-contracts.d.ts +0 -12
  214. package/types/src/types.d.ts +0 -16
  215. package/types/src/utils/parse.d.ts +0 -1
  216. package/types/src/utils/prompt.d.ts +0 -3
  217. package/types/src/utils/schemas.d.ts +0 -10
  218. /package/{types/src/builder → builder}/index.d.ts +0 -0
  219. /package/{types/src/bundler → bundler}/index.d.ts +0 -0
  220. /package/{src/helpers/contractContextBase.ts → esm/helpers/contractContextBase.js} +0 -0
  221. /package/{src/helpers/contractContextBaseShortHandCtor.ts → esm/helpers/contractContextBaseShortHandCtor.js} +0 -0
  222. /package/{src/helpers/contractsContextTSX.ts → esm/helpers/contractsContextTSX.js} +0 -0
  223. /package/{types/src/helpers/index.d.ts → esm/helpers/index.js} +0 -0
  224. /package/{types/src/plugins/index.d.ts → esm/plugins/index.js} +0 -0
  225. /package/{src/utils/header.ts → esm/utils/header.js} +0 -0
  226. /package/{types/src/utils/index.d.ts → esm/utils/index.js} +0 -0
  227. /package/{types/src/file.d.ts → file.d.ts} +0 -0
  228. /package/{types/src/generators → generators}/client.d.ts +0 -0
  229. /package/{types/src/generators → generators}/create-helpers.d.ts +0 -0
  230. /package/{types/src/generators/msg-builder.d.ts → generators/message-builder.d.ts} +0 -0
  231. /package/{types/src/generators → generators}/message-composer.d.ts +0 -0
  232. /package/{types/src/generators → generators}/react-query.d.ts +0 -0
  233. /package/{types/src/generators → generators}/recoil.d.ts +0 -0
  234. /package/{types/src/generators → generators}/types.d.ts +0 -0
  235. /package/{types/src/helpers → helpers}/contractContextBase.d.ts +0 -0
  236. /package/{types/src/helpers → helpers}/contractContextBaseShortHandCtor.d.ts +0 -0
  237. /package/{types/src/helpers → helpers}/contractsContextTSX.d.ts +0 -0
  238. /package/{types/src/plugins → plugins}/client.d.ts +0 -0
  239. /package/{types/src/plugins → plugins}/message-builder.d.ts +0 -0
  240. /package/{types/src/plugins → plugins}/message-composer.d.ts +0 -0
  241. /package/{types/src/plugins → plugins}/provider-bundle.d.ts +0 -0
  242. /package/{types/src/plugins → plugins}/react-query.d.ts +0 -0
  243. /package/{types/src/plugins → plugins}/recoil.d.ts +0 -0
  244. /package/{types/src/plugins → plugins}/types.d.ts +0 -0
  245. /package/{types/src/ts-codegen.d.ts → ts-codegen.d.ts} +0 -0
  246. /package/{types/src/utils → utils}/clean.d.ts +0 -0
  247. /package/{types/src/utils → utils}/cleanse.d.ts +0 -0
  248. /package/{types/src/utils → utils}/files.d.ts +0 -0
  249. /package/{types/src/utils → utils}/header.d.ts +0 -0
  250. /package/{types/src/utils → utils}/unused.d.ts +0 -0
package/LICENSE-Apache ADDED
@@ -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) 2024 Interweb, Inc. <developers@cosmology.zone>
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/LICENSE-MIT ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Interweb, Inc. <developers@cosmology.zone>
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/README.md CHANGED
@@ -18,7 +18,7 @@ Generate TypeScript SDKs for your CosmWasm smart contracts
18
18
 
19
19
 
20
20
  ```
21
- npm install -g @cosmwasm/ts-codegen
21
+ npm install @cosmwasm/ts-codegen
22
22
  ```
23
23
 
24
24
  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.
@@ -28,7 +28,6 @@ The quickest and easiest way to interact with CosmWasm Contracts. `@cosmwasm/ts-
28
28
 
29
29
  - [@cosmwasm/ts-codegen](#cosmwasmts-codegen)
30
30
  - [Table of contents](#table-of-contents)
31
- - [QuickStart](#quickstart)
32
31
  - [Usage](#usage)
33
32
  - [Programmatic Usage](#programmatic-usage)
34
33
  - [Types](#types)
@@ -47,35 +46,9 @@ The quickest and easiest way to interact with CosmWasm Contracts. `@cosmwasm/ts-
47
46
  - [Exporting Schemas](#exporting-schemas)
48
47
  - [Developing](#developing)
49
48
  - [Related](#related)
50
- ## Quickstart
51
-
52
- Clone your project and `cd` into your contracts folder
53
-
54
- ```sh
55
- git clone https://github.com/public-awesome/launchpad.git
56
- cd launchpad/contracts/sg721-base/
57
- ```
58
-
59
- Run `cosmwasm-ts-codegen` to generate your code.
60
-
61
- ```sh
62
- cosmwasm-ts-codegen generate \
63
- --plugin client \
64
- --schema ./schema \
65
- --out ./ts \
66
- --name SG721 \
67
- --no-bundle
68
- ```
69
-
70
- The output will be in the folder specified by `--out`, enjoy!
71
49
 
72
50
  ## Usage
73
51
 
74
- You can get started quickly using our `cli` by globally installing via npm:
75
-
76
- ```
77
- npm install -g @cosmwasm/ts-codegen
78
- ```
79
52
  ### Programmatic Usage
80
53
 
81
54
  For production usage, we recommend setting up a build script that uses the main entry point:
@@ -137,7 +110,7 @@ codegen({
137
110
 
138
111
  Typescript types and interfaces are generated in separate files so they can be imported into various generated plugins.
139
112
 
140
- [see example output code](https://gist.github.com/pyramation/107d4e8e30dc5eb3ffc07bc3000f4dd0)
113
+ [see example output code](https://github.com/CosmWasm/ts-codegen/blob/main/__output__/sg721/Sg721.types.ts)
141
114
 
142
115
  #### Types Options
143
116
 
@@ -151,7 +124,7 @@ Typescript types and interfaces are generated in separate files so they can be i
151
124
 
152
125
  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.
153
126
 
154
- [see example output code](https://gist.github.com/pyramation/30508678b7563e286f06ccc5ac384817)
127
+ [see example output code](https://github.com/CosmWasm/ts-codegen/blob/main/__output__/sg721/Sg721.client.ts )
155
128
 
156
129
  #### Client Options
157
130
 
@@ -161,20 +134,12 @@ The `client` plugin will generate TS client classes for your contracts. This opt
161
134
  | `client.execExtendsQuery` | execute should extend query message clients |
162
135
  | `client.noImplicitOverride` | should match your tsconfig noImplicitOverride option |
163
136
 
164
- #### Client via CLI
165
137
 
166
- ```sh
167
- cosmwasm-ts-codegen generate \
168
- --plugin client
169
- --schema ./schema \
170
- --out ./ts \
171
- --name MyContractName
172
- ```
173
138
  ### React Query
174
139
 
175
140
  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.
176
141
 
177
- [see example output code](https://gist.github.com/pyramation/70aef28fd3af0ee164f7711704d3dfc0)
142
+ [see example output code](https://github.com/CosmWasm/ts-codegen/blob/main/__output__/sg721/Sg721.react-query.ts)
178
143
 
179
144
  #### React Query Options
180
145
 
@@ -189,50 +154,11 @@ Generate [react-query v3](https://react-query-v3.tanstack.com/) or [react-query
189
154
  | `reactQuery.camelize` | use camelCase style for property names |
190
155
 
191
156
 
192
- #### React Query via CLI
193
-
194
- Here is an example without optional client, using v3 for `react-query`, without mutations:
195
-
196
- ```sh
197
- cosmwasm-ts-codegen generate \
198
- --plugin client \
199
- --plugin react-query \
200
- --schema ./schema \
201
- --out ./ts \
202
- --name MyContractName \
203
- --version v3 \
204
- --no-optionalClient \
205
- --no-mutations
206
- ```
207
-
208
- Example with optional client, using v4, with mutations:
209
-
210
- ```sh
211
- cosmwasm-ts-codegen generate \
212
- --plugin react-query \
213
- --schema ./schema \
214
- --out ./ts \
215
- --name MyContractName \
216
- --optionalClient \
217
- --version v4 \
218
- --mutations
219
- ```
220
-
221
157
  ### Recoil
222
158
 
223
159
  Generate [recoil](https://recoiljs.org/) bindings for your contracts with the `recoil` command.
224
160
 
225
- [see example output code](https://gist.github.com/pyramation/a9520ccf131177b1841e02a97d7d3731)
226
-
227
- #### Recoil via CLI
228
-
229
- ```sh
230
- cosmwasm-ts-codegen generate \
231
- --plugin recoil \
232
- --schema ./schema \
233
- --out ./ts \
234
- --name MyContractName
235
- ```
161
+ [see example output code](https://github.com/CosmWasm/ts-codegen/blob/main/__output__/sg721/Sg721.recoil.ts)
236
162
 
237
163
  #### Recoil Options
238
164
 
@@ -244,17 +170,8 @@ cosmwasm-ts-codegen generate \
244
170
 
245
171
  Generate pure message objects with the proper `utf8` encoding and `typeUrl` configured that you can broadcast yourself via `cosmjs` with the `message-composer` command.
246
172
 
247
- [see example output code](https://gist.github.com/pyramation/43320e8b952751a0bd5a77dbc5b601f4)
173
+ [see example output code](https://github.com/CosmWasm/ts-codegen/blob/main/__output__/sg721/Sg721.message-composer.ts)
248
174
 
249
- #### Message Composer via CLI
250
-
251
- ```sh
252
- cosmwasm-ts-codegen generate \
253
- --plugin message-composer \
254
- --schema ./schema \
255
- --out ./ts \
256
- --name MyContractName
257
- ```
258
175
  #### Message Composer Options
259
176
 
260
177
  | option | description |
@@ -265,17 +182,8 @@ cosmwasm-ts-codegen generate \
265
182
 
266
183
  Generate raw message jsons for use in your application with the `message-builder` command.
267
184
 
268
- [see example output code](https://gist.github.com/adairrr/b394e62beb9856b0351883f776650f26)
269
-
270
- #### Message Builder via CLI
185
+ [see example output code](https://github.com/CosmWasm/ts-codegen/blob/main/__output__/sg721/Sg721.message-builder.ts)
271
186
 
272
- ```sh
273
- cosmwasm-ts-codegen generate \
274
- --plugin message-builder \
275
- --schema ./schema \
276
- --out ./ts \
277
- --name MyContractName
278
- ```
279
187
  #### Message Builder Options
280
188
 
281
189
  | option | description |
@@ -426,6 +334,32 @@ Without using shorthand constructor:
426
334
 
427
335
  ### CLI Usage and Examples
428
336
 
337
+ You can get started quickly using our `cli` by globally installing via npm:
338
+
339
+ ```
340
+ npm install @cosmwasm/ts-codegen
341
+ ```
342
+
343
+ Clone your project and `cd` into your contracts folder
344
+
345
+ ```sh
346
+ git clone https://github.com/public-awesome/launchpad.git
347
+ cd launchpad/contracts/whitelists/
348
+ ```
349
+
350
+ Run `cosmwasm-ts-codegen` to generate your code.
351
+
352
+ ```sh
353
+ cosmwasm-ts-codegen generate \
354
+ --plugin client \
355
+ --schema ./schema \
356
+ --out ./ts \
357
+ --name Whitelist \
358
+ --no-bundle
359
+ ```
360
+
361
+ The output will be in the folder specified by `--out`, enjoy!
362
+
429
363
  #### Interactive prompt
430
364
 
431
365
  The CLI is interactive, and if you don't specify an option, it will interactively prompt you.
@@ -506,6 +440,77 @@ cosmwasm-ts-codegen generate \
506
440
  --name SG721
507
441
  ```
508
442
 
443
+ #### Client via CLI
444
+
445
+ ```sh
446
+ cosmwasm-ts-codegen generate \
447
+ --plugin client
448
+ --schema ./schema \
449
+ --out ./ts \
450
+ --name MyContractName
451
+ ```
452
+
453
+
454
+ #### React Query via CLI
455
+
456
+ Here is an example without optional client, using v3 for `react-query`, without mutations:
457
+
458
+ ```sh
459
+ cosmwasm-ts-codegen generate \
460
+ --plugin client \
461
+ --plugin react-query \
462
+ --schema ./schema \
463
+ --out ./ts \
464
+ --name MyContractName \
465
+ --version v3 \
466
+ --no-optionalClient \
467
+ --no-mutations
468
+ ```
469
+
470
+ Example with optional client, using v4, with mutations:
471
+
472
+ ```sh
473
+ cosmwasm-ts-codegen generate \
474
+ --plugin react-query \
475
+ --schema ./schema \
476
+ --out ./ts \
477
+ --name MyContractName \
478
+ --optionalClient \
479
+ --version v4 \
480
+ --mutations
481
+ ```
482
+
483
+ #### Recoil via CLI
484
+
485
+ ```sh
486
+ cosmwasm-ts-codegen generate \
487
+ --plugin recoil \
488
+ --schema ./schema \
489
+ --out ./ts \
490
+ --name MyContractName
491
+ ```
492
+
493
+ #### Message Composer via CLI
494
+
495
+ ```sh
496
+ cosmwasm-ts-codegen generate \
497
+ --plugin message-composer \
498
+ --schema ./schema \
499
+ --out ./ts \
500
+ --name MyContractName
501
+ ```
502
+
503
+ #### Message Builder via CLI
504
+
505
+ ```sh
506
+ cosmwasm-ts-codegen generate \
507
+ --plugin message-builder \
508
+ --schema ./schema \
509
+ --out ./ts \
510
+ --name MyContractName
511
+ ```
512
+
513
+
509
514
  ### Advanced Usage
510
515
 
511
516
  for lower-level access, you can import the various plugins directly:
@@ -623,13 +628,13 @@ yarn build
623
628
  Then `cd` into a package and run the tests
624
629
 
625
630
  ```
626
- cd ./packages/wasm-ast-types
631
+ cd ./packages/ast
627
632
  yarn test:watch
628
633
  ```
629
634
 
630
635
  ### Working with ASTs
631
636
 
632
- See the [docs](https://github.com/CosmWasm/ts-codegen/blob/main/packages/wasm-ast-types/README.md) in the `wasm-ast-types` package.
637
+ See the [docs](https://github.com/CosmWasm/ts-codegen/blob/main/packages/ast/README.md) in the `wasm-ast-types` package.
633
638
 
634
639
  ## Related
635
640
 
@@ -15,7 +15,7 @@ export interface BundleOptions {
15
15
  export interface UseContractsOptions {
16
16
  enabled?: boolean;
17
17
  }
18
- export declare type TSBuilderOptions = {
18
+ export type TSBuilderOptions = {
19
19
  bundle?: BundleOptions;
20
20
  /**
21
21
  * Enable using shorthand constructor.
@@ -24,7 +24,7 @@ export declare type TSBuilderOptions = {
24
24
  useShorthandCtor?: boolean;
25
25
  useContractsHooks?: UseContractsOptions;
26
26
  } & RenderOptions;
27
- export declare type BuilderFileType = 'type' | 'client' | 'recoil' | 'react-query' | 'message-composer' | 'message-builder' | 'plugin';
27
+ export type BuilderFileType = 'type' | 'client' | 'recoil' | 'react-query' | 'message-composer' | 'message-builder' | 'plugin';
28
28
  export interface BuilderFile {
29
29
  type: BuilderFileType;
30
30
  pluginType?: string;