wasm-ast-types 0.26.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE-Apache +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +1 -1
- package/{types/client → client}/client.d.ts +2 -2
- package/client/client.js +275 -0
- package/client/index.js +17 -0
- package/{types/context → context}/context.d.ts +9 -22
- package/context/context.js +114 -0
- package/{types/context → context}/imports.d.ts +9 -8
- package/context/imports.js +166 -0
- package/context/index.js +18 -0
- package/esm/client/client.js +238 -0
- package/esm/client/index.js +1 -0
- package/esm/context/context.js +104 -0
- package/esm/context/imports.js +136 -0
- package/{module → esm}/context/index.js +1 -1
- package/{src/index.ts → esm/index.js} +0 -1
- package/esm/message-builder/message-builder.js +64 -0
- package/esm/message-composer/message-composer.js +105 -0
- package/esm/provider/provider.js +97 -0
- package/esm/react-query/react-query.js +458 -0
- package/esm/recoil/recoil.js +110 -0
- package/esm/utils/babel.js +231 -0
- package/esm/utils/constants.js +20 -0
- package/esm/utils/ref.js +4 -0
- package/esm/utils/types.js +343 -0
- package/{types/index.d.ts → index.d.ts} +0 -1
- package/index.js +24 -0
- package/message-builder/index.js +17 -0
- package/{types/message-builder → message-builder}/message-builder.d.ts +1 -1
- package/message-builder/message-builder.js +91 -0
- package/message-composer/index.d.ts +1 -0
- package/message-composer/index.js +17 -0
- package/{types/message-composer → message-composer}/message-composer.d.ts +1 -1
- package/message-composer/message-composer.js +133 -0
- package/package.json +19 -68
- package/provider/index.d.ts +1 -0
- package/provider/index.js +17 -0
- package/provider/provider.js +127 -0
- package/react-query/index.d.ts +1 -0
- package/react-query/index.js +17 -0
- package/{types/react-query → react-query}/react-query.d.ts +2 -3
- package/react-query/react-query.js +490 -0
- package/recoil/index.d.ts +1 -0
- package/recoil/index.js +17 -0
- package/{types/recoil → recoil}/recoil.d.ts +1 -1
- package/recoil/recoil.js +140 -0
- package/{types/utils → utils}/babel.d.ts +9 -8
- package/utils/babel.js +285 -0
- package/utils/constants.js +46 -0
- package/utils/index.js +26 -0
- package/{types/utils → utils}/ref.d.ts +1 -1
- package/utils/ref.js +8 -0
- package/{types/utils → utils}/types.d.ts +8 -8
- package/utils/types.js +379 -0
- package/main/client/client.js +0 -196
- package/main/client/index.js +0 -16
- package/main/client/test/ts-client.account-nfts.spec.js +0 -28
- package/main/client/test/ts-client.arrays-ref.spec.js +0 -19
- package/main/client/test/ts-client.arrays.spec.js +0 -26
- package/main/client/test/ts-client.cw-named-groups.test.js +0 -19
- package/main/client/test/ts-client.cw-proposal-single.test.js +0 -23
- package/main/client/test/ts-client.empty-enums.spec.js +0 -13
- package/main/client/test/ts-client.issue-101.spec.js +0 -23
- package/main/client/test/ts-client.issue-103.test.js +0 -44
- package/main/client/test/ts-client.issue-71.test.js +0 -81
- package/main/client/test/ts-client.issue-98.test.js +0 -28
- package/main/client/test/ts-client.issues.test.js +0 -81
- package/main/client/test/ts-client.overrides.spec.js +0 -33
- package/main/client/test/ts-client.sg721.spec.js +0 -19
- package/main/client/test/ts-client.spec.js +0 -87
- package/main/client/test/ts-client.vectis.spec.js +0 -46
- package/main/client/test/ts-client.wager.spec.js +0 -39
- package/main/context/context.js +0 -162
- package/main/context/imports.js +0 -159
- package/main/context/index.js +0 -27
- package/main/index.js +0 -104
- package/main/message-builder/index.js +0 -16
- package/main/message-builder/message-builder.js +0 -62
- package/main/message-builder/message-builder.spec.js +0 -20
- package/main/message-composer/index.js +0 -16
- package/main/message-composer/message-composer.js +0 -86
- package/main/message-composer/message-composer.spec.js +0 -23
- package/main/provider/index.js +0 -16
- package/main/provider/provider.js +0 -71
- package/main/provider/provider.spec.js +0 -60
- package/main/react-query/index.js +0 -16
- package/main/react-query/react-query.js +0 -413
- package/main/react-query/react-query.spec.js +0 -91
- package/main/recoil/index.js +0 -16
- package/main/recoil/recoil.js +0 -61
- package/main/recoil/recoil.spec.js +0 -20
- package/main/types.js +0 -4
- package/main/utils/babel.js +0 -282
- package/main/utils/babel.spec.js +0 -109
- package/main/utils/constants.js +0 -26
- package/main/utils/index.js +0 -65
- package/main/utils/ref.js +0 -12
- package/main/utils/types.js +0 -343
- package/module/client/client.js +0 -166
- package/module/client/index.js +0 -1
- package/module/client/test/ts-client.account-nfts.spec.js +0 -25
- package/module/client/test/ts-client.arrays-ref.spec.js +0 -16
- package/module/client/test/ts-client.arrays.spec.js +0 -23
- package/module/client/test/ts-client.cw-named-groups.test.js +0 -16
- package/module/client/test/ts-client.cw-proposal-single.test.js +0 -20
- package/module/client/test/ts-client.empty-enums.spec.js +0 -10
- package/module/client/test/ts-client.issue-101.spec.js +0 -22
- package/module/client/test/ts-client.issue-103.test.js +0 -41
- package/module/client/test/ts-client.issue-71.test.js +0 -21
- package/module/client/test/ts-client.issue-98.test.js +0 -25
- package/module/client/test/ts-client.issues.test.js +0 -21
- package/module/client/test/ts-client.overrides.spec.js +0 -30
- package/module/client/test/ts-client.sg721.spec.js +0 -16
- package/module/client/test/ts-client.spec.js +0 -84
- package/module/client/test/ts-client.vectis.spec.js +0 -43
- package/module/client/test/ts-client.wager.spec.js +0 -36
- package/module/context/context.js +0 -116
- package/module/context/imports.js +0 -127
- package/module/index.js +0 -9
- package/module/message-builder/index.js +0 -1
- package/module/message-builder/message-builder.js +0 -52
- package/module/message-builder/message-builder.spec.js +0 -17
- package/module/message-composer/index.js +0 -1
- package/module/message-composer/message-composer.js +0 -70
- package/module/message-composer/message-composer.spec.js +0 -20
- package/module/provider/index.js +0 -1
- package/module/provider/provider.js +0 -45
- package/module/provider/provider.spec.js +0 -58
- package/module/react-query/index.js +0 -1
- package/module/react-query/react-query.js +0 -403
- package/module/react-query/react-query.spec.js +0 -85
- package/module/recoil/index.js +0 -1
- package/module/recoil/recoil.js +0 -46
- package/module/recoil/recoil.spec.js +0 -14
- package/module/types.js +0 -3
- package/module/utils/babel.js +0 -203
- package/module/utils/babel.spec.js +0 -70
- package/module/utils/constants.js +0 -12
- package/module/utils/index.js +0 -6
- package/module/utils/ref.js +0 -4
- package/module/utils/types.js +0 -301
- package/src/client/client.ts +0 -584
- package/src/client/index.ts +0 -1
- package/src/client/test/__snapshots__/ts-client.account-nfts.spec.ts.snap +0 -497
- package/src/client/test/__snapshots__/ts-client.arrays-ref.spec.ts.snap +0 -452
- package/src/client/test/__snapshots__/ts-client.arrays.spec.ts.snap +0 -101
- package/src/client/test/__snapshots__/ts-client.cw-named-groups.test.ts.snap +0 -141
- package/src/client/test/__snapshots__/ts-client.cw-proposal-single.test.ts.snap +0 -341
- package/src/client/test/__snapshots__/ts-client.empty-enums.spec.ts.snap +0 -20
- package/src/client/test/__snapshots__/ts-client.issue-101.spec.ts.snap +0 -47
- package/src/client/test/__snapshots__/ts-client.issue-103.test.ts.snap +0 -79
- package/src/client/test/__snapshots__/ts-client.issue-71.test.ts.snap +0 -432
- package/src/client/test/__snapshots__/ts-client.issue-98.test.ts.snap +0 -117
- package/src/client/test/__snapshots__/ts-client.issues.test.ts.snap +0 -984
- package/src/client/test/__snapshots__/ts-client.overrides.spec.ts.snap +0 -709
- package/src/client/test/__snapshots__/ts-client.sg721.spec.ts.snap +0 -350
- package/src/client/test/__snapshots__/ts-client.spec.ts.snap +0 -723
- package/src/client/test/__snapshots__/ts-client.vectis.spec.ts.snap +0 -337
- package/src/client/test/__snapshots__/ts-client.wager.spec.ts.snap +0 -132
- package/src/client/test/ts-client.account-nfts.spec.ts +0 -55
- package/src/client/test/ts-client.arrays-ref.spec.ts +0 -48
- package/src/client/test/ts-client.arrays.spec.ts +0 -58
- package/src/client/test/ts-client.cw-named-groups.test.ts +0 -48
- package/src/client/test/ts-client.cw-proposal-single.test.ts +0 -50
- package/src/client/test/ts-client.empty-enums.spec.ts +0 -28
- package/src/client/test/ts-client.issue-101.spec.ts +0 -37
- package/src/client/test/ts-client.issue-103.test.ts +0 -106
- package/src/client/test/ts-client.issue-71.test.ts +0 -51
- package/src/client/test/ts-client.issue-98.test.ts +0 -55
- package/src/client/test/ts-client.issues.test.ts +0 -52
- package/src/client/test/ts-client.overrides.spec.ts +0 -74
- package/src/client/test/ts-client.sg721.spec.ts +0 -46
- package/src/client/test/ts-client.spec.ts +0 -166
- package/src/client/test/ts-client.vectis.spec.ts +0 -97
- package/src/client/test/ts-client.wager.spec.ts +0 -63
- package/src/context/context.ts +0 -229
- package/src/context/imports.ts +0 -195
- package/src/context/index.ts +0 -2
- package/src/message-builder/__snapshots__/message-builder.spec.ts.snap +0 -270
- package/src/message-builder/message-builder.spec.ts +0 -24
- package/src/message-builder/message-builder.ts +0 -119
- package/src/message-composer/__snapshots__/message-composer.spec.ts.snap +0 -331
- package/src/message-composer/index.ts +0 -1
- package/src/message-composer/message-composer.spec.ts +0 -46
- package/src/message-composer/message-composer.ts +0 -262
- package/src/provider/__snapshots__/provider.spec.ts.snap +0 -49
- package/src/provider/index.ts +0 -1
- package/src/provider/provider.spec.ts +0 -81
- package/src/provider/provider.ts +0 -237
- package/src/react-query/__snapshots__/react-query.spec.ts.snap +0 -1359
- package/src/react-query/index.ts +0 -1
- package/src/react-query/react-query.spec.ts +0 -116
- package/src/react-query/react-query.ts +0 -1072
- package/src/recoil/__snapshots__/recoil.spec.ts.snap +0 -203
- package/src/recoil/index.ts +0 -1
- package/src/recoil/recoil.spec.ts +0 -38
- package/src/recoil/recoil.ts +0 -307
- package/src/types.ts +0 -44
- package/src/utils/__snapshots__/babel.spec.ts.snap +0 -75
- package/src/utils/babel.spec.ts +0 -511
- package/src/utils/babel.ts +0 -352
- package/src/utils/constants.ts +0 -37
- package/src/utils/ref.ts +0 -6
- package/src/utils/types.ts +0 -478
- package/types/types.d.ts +0 -41
- /package/{types/client → client}/index.d.ts +0 -0
- /package/{types/context → context}/index.d.ts +0 -0
- /package/{src/message-builder/index.ts → esm/message-builder/index.js} +0 -0
- /package/{types/message-composer/index.d.ts → esm/message-composer/index.js} +0 -0
- /package/{types/provider/index.d.ts → esm/provider/index.js} +0 -0
- /package/{types/react-query/index.d.ts → esm/react-query/index.js} +0 -0
- /package/{types/recoil/index.d.ts → esm/recoil/index.js} +0 -0
- /package/{src/utils/index.ts → esm/utils/index.js} +0 -0
- /package/{types/message-builder → message-builder}/index.d.ts +0 -0
- /package/{types/provider → provider}/provider.d.ts +0 -0
- /package/{types/utils → utils}/constants.d.ts +0 -0
- /package/{types/utils → utils}/index.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
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as t from '@babel/types';
|
2
|
-
import { ExecuteMsg, JSONSchema, QueryMsg } from '
|
2
|
+
import { ExecuteMsg, JSONSchema, QueryMsg } from '@cosmology/ts-codegen-types';
|
3
3
|
import { RenderContext } from '../context';
|
4
|
-
export declare const CONSTANT_EXEC_PARAMS: (t.
|
4
|
+
export declare const CONSTANT_EXEC_PARAMS: (t.Identifier | t.AssignmentPattern)[];
|
5
5
|
export declare const createWasmQueryMethod: (context: RenderContext, jsonschema: any) => t.ClassProperty;
|
6
6
|
export declare const createQueryClass: (context: RenderContext, className: string, implementsClassName: string, queryMsg: QueryMsg) => t.ExportNamedDeclaration;
|
7
7
|
export declare const getWasmMethodArgs: (context: RenderContext, jsonschema: JSONSchema) => t.ObjectProperty[];
|
package/client/client.js
ADDED
@@ -0,0 +1,275 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
exports.createTypeInterface = exports.createTypeOrInterface = exports.createQueryInterface = exports.createPropertyFunctionWithObjectParamsForExec = exports.createPropertyFunctionWithObjectParams = exports.createExecuteInterface = exports.createExecuteClass = exports.createWasmExecMethod = exports.getWasmMethodArgs = exports.createQueryClass = exports.createWasmQueryMethod = exports.CONSTANT_EXEC_PARAMS = void 0;
|
27
|
+
const t = __importStar(require("@babel/types"));
|
28
|
+
const case_1 = require("case");
|
29
|
+
const utils_1 = require("../utils");
|
30
|
+
const types_1 = require("../utils/types");
|
31
|
+
const babel_1 = require("../utils/babel");
|
32
|
+
exports.CONSTANT_EXEC_PARAMS = [
|
33
|
+
t.assignmentPattern((0, babel_1.identifier)('fee', t.tsTypeAnnotation(t.tsUnionType([
|
34
|
+
t.tSNumberKeyword(),
|
35
|
+
t.tsTypeReference(t.identifier('StdFee')),
|
36
|
+
t.tsLiteralType(t.stringLiteral('auto'))
|
37
|
+
])), false), t.stringLiteral('auto')),
|
38
|
+
(0, babel_1.identifier)('memo', t.tsTypeAnnotation(t.tsStringKeyword()), true),
|
39
|
+
utils_1.OPTIONAL_FUNDS_PARAM
|
40
|
+
];
|
41
|
+
const createWasmQueryMethod = (context, jsonschema) => {
|
42
|
+
const underscoreName = Object.keys(jsonschema.properties)[0];
|
43
|
+
const methodName = (0, case_1.camel)(underscoreName);
|
44
|
+
const responseType = (0, types_1.getResponseType)(context, underscoreName);
|
45
|
+
const param = (0, types_1.createTypedObjectParams)(context, jsonschema.properties[underscoreName]);
|
46
|
+
const args = (0, exports.getWasmMethodArgs)(context, jsonschema.properties[underscoreName]);
|
47
|
+
const msgAction = t.identifier(underscoreName);
|
48
|
+
// If the param is an identifier, we can just use it as is
|
49
|
+
const msgActionValue = param?.type === 'Identifier'
|
50
|
+
? t.identifier(param.name)
|
51
|
+
: t.objectExpression(args);
|
52
|
+
return t.classProperty(t.identifier(methodName), (0, utils_1.arrowFunctionExpression)(param ? [param] : [], t.blockStatement([
|
53
|
+
t.returnStatement(t.callExpression(t.memberExpression(t.memberExpression(t.thisExpression(), t.identifier('client')), t.identifier('queryContractSmart')), [
|
54
|
+
t.memberExpression(t.thisExpression(), t.identifier('contractAddress')),
|
55
|
+
t.objectExpression([t.objectProperty(msgAction, msgActionValue)])
|
56
|
+
]))
|
57
|
+
]), t.tsTypeAnnotation(t.tsTypeReference(t.identifier('Promise'), t.tsTypeParameterInstantiation([
|
58
|
+
t.tSTypeReference(t.identifier(responseType))
|
59
|
+
]))), true));
|
60
|
+
};
|
61
|
+
exports.createWasmQueryMethod = createWasmQueryMethod;
|
62
|
+
const createQueryClass = (context, className, implementsClassName, queryMsg) => {
|
63
|
+
context.addUtil('CosmWasmClient');
|
64
|
+
const propertyNames = (0, utils_1.getMessageProperties)(queryMsg)
|
65
|
+
.map((method) => Object.keys(method.properties)?.[0])
|
66
|
+
.filter(Boolean);
|
67
|
+
const bindings = propertyNames.map(case_1.camel).map(utils_1.bindMethod);
|
68
|
+
const methods = (0, utils_1.getMessageProperties)(queryMsg).map((schema) => {
|
69
|
+
return (0, exports.createWasmQueryMethod)(context, schema);
|
70
|
+
});
|
71
|
+
return t.exportNamedDeclaration((0, utils_1.classDeclaration)(className, [
|
72
|
+
// client
|
73
|
+
(0, utils_1.classProperty)('client', t.tsTypeAnnotation(t.tsTypeReference(t.identifier('CosmWasmClient')))),
|
74
|
+
// contractAddress
|
75
|
+
(0, utils_1.classProperty)('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword())),
|
76
|
+
// constructor
|
77
|
+
t.classMethod('constructor', t.identifier('constructor'), [
|
78
|
+
(0, utils_1.typedIdentifier)('client', t.tsTypeAnnotation(t.tsTypeReference(t.identifier('CosmWasmClient')))),
|
79
|
+
(0, utils_1.typedIdentifier)('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword()))
|
80
|
+
], t.blockStatement([
|
81
|
+
// client/contract set
|
82
|
+
t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('client')), t.identifier('client'))),
|
83
|
+
t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('contractAddress')), t.identifier('contractAddress'))),
|
84
|
+
...bindings
|
85
|
+
])),
|
86
|
+
...methods
|
87
|
+
], [t.tSExpressionWithTypeArguments(t.identifier(implementsClassName))]));
|
88
|
+
};
|
89
|
+
exports.createQueryClass = createQueryClass;
|
90
|
+
const getWasmMethodArgs = (context, jsonschema) => {
|
91
|
+
let keys = Object.keys(jsonschema.properties ?? {});
|
92
|
+
// only 1 degree $ref-lookup
|
93
|
+
if (!keys.length && jsonschema.$ref) {
|
94
|
+
const obj = context.refLookup(jsonschema.$ref);
|
95
|
+
// properties
|
96
|
+
if (obj) {
|
97
|
+
keys = Object.keys(obj.properties ?? {});
|
98
|
+
}
|
99
|
+
// tuple struct or otherwise, use the name of the reference
|
100
|
+
if (!keys.length && obj?.oneOf) {
|
101
|
+
// TODO????? ADAIR
|
102
|
+
}
|
103
|
+
}
|
104
|
+
const args = keys.map((prop) => {
|
105
|
+
return t.objectProperty(t.identifier(prop), t.identifier((0, case_1.camel)(prop)), false, prop === (0, case_1.camel)(prop));
|
106
|
+
});
|
107
|
+
return args;
|
108
|
+
};
|
109
|
+
exports.getWasmMethodArgs = getWasmMethodArgs;
|
110
|
+
const createWasmExecMethod = (context, jsonschema) => {
|
111
|
+
context.addUtil('ExecuteResult');
|
112
|
+
context.addUtil('StdFee');
|
113
|
+
context.addUtil('Coin');
|
114
|
+
const underscoreName = Object.keys(jsonschema.properties)[0];
|
115
|
+
const methodName = (0, case_1.camel)(underscoreName);
|
116
|
+
const param = (0, types_1.createTypedObjectParams)(context, jsonschema.properties[underscoreName]);
|
117
|
+
const args = (0, exports.getWasmMethodArgs)(context, jsonschema.properties[underscoreName]);
|
118
|
+
const msgAction = t.identifier(underscoreName);
|
119
|
+
// If the param is an identifier, we can just use it as is
|
120
|
+
const msgActionValue = param?.type === 'Identifier'
|
121
|
+
? t.identifier(param.name)
|
122
|
+
: t.objectExpression(args);
|
123
|
+
return t.classProperty(t.identifier(methodName), (0, utils_1.arrowFunctionExpression)(param
|
124
|
+
? [
|
125
|
+
// props
|
126
|
+
param,
|
127
|
+
...exports.CONSTANT_EXEC_PARAMS
|
128
|
+
]
|
129
|
+
: exports.CONSTANT_EXEC_PARAMS, t.blockStatement([
|
130
|
+
t.returnStatement(t.awaitExpression(t.callExpression(t.memberExpression(t.memberExpression(t.thisExpression(), t.identifier('client')), t.identifier('execute')), [
|
131
|
+
t.memberExpression(t.thisExpression(), t.identifier('sender')),
|
132
|
+
t.memberExpression(t.thisExpression(), t.identifier('contractAddress')),
|
133
|
+
t.objectExpression([
|
134
|
+
t.objectProperty(msgAction, msgActionValue)
|
135
|
+
]),
|
136
|
+
t.identifier('fee'),
|
137
|
+
t.identifier('memo'),
|
138
|
+
t.identifier('_funds')
|
139
|
+
])))
|
140
|
+
]),
|
141
|
+
// return type
|
142
|
+
t.tsTypeAnnotation(t.tsTypeReference(t.identifier('Promise'), t.tsTypeParameterInstantiation([
|
143
|
+
t.tSTypeReference(t.identifier('ExecuteResult'))
|
144
|
+
]))), true));
|
145
|
+
};
|
146
|
+
exports.createWasmExecMethod = createWasmExecMethod;
|
147
|
+
const createExecuteClass = (context, className, implementsClassName, extendsClassName, execMsg) => {
|
148
|
+
context.addUtil('SigningCosmWasmClient');
|
149
|
+
const propertyNames = (0, utils_1.getMessageProperties)(execMsg)
|
150
|
+
.map((method) => Object.keys(method.properties)?.[0])
|
151
|
+
.filter(Boolean);
|
152
|
+
const bindings = propertyNames.map(case_1.camel).map(utils_1.bindMethod);
|
153
|
+
const methods = (0, utils_1.getMessageProperties)(execMsg).map((schema) => {
|
154
|
+
return (0, exports.createWasmExecMethod)(context, schema);
|
155
|
+
});
|
156
|
+
const blockStmt = [];
|
157
|
+
if (extendsClassName) {
|
158
|
+
blockStmt.push(
|
159
|
+
// super()
|
160
|
+
t.expressionStatement(t.callExpression(t.super(), [
|
161
|
+
t.identifier('client'),
|
162
|
+
t.identifier('contractAddress')
|
163
|
+
])));
|
164
|
+
}
|
165
|
+
blockStmt.push(...[
|
166
|
+
// client/contract set
|
167
|
+
t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('client')), t.identifier('client'))),
|
168
|
+
t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('sender')), t.identifier('sender'))),
|
169
|
+
t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('contractAddress')), t.identifier('contractAddress'))),
|
170
|
+
...bindings
|
171
|
+
]);
|
172
|
+
const noImplicitOverride = context.options.client.noImplicitOverride &&
|
173
|
+
extendsClassName &&
|
174
|
+
context.options.client.execExtendsQuery;
|
175
|
+
return t.exportNamedDeclaration((0, utils_1.classDeclaration)(className, [
|
176
|
+
// client
|
177
|
+
(0, utils_1.classProperty)('client', t.tsTypeAnnotation(t.tsTypeReference(t.identifier('SigningCosmWasmClient'))), false, false, noImplicitOverride),
|
178
|
+
// sender
|
179
|
+
(0, utils_1.classProperty)('sender', t.tsTypeAnnotation(t.tsStringKeyword())),
|
180
|
+
// contractAddress
|
181
|
+
(0, utils_1.classProperty)('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword()), false, false, noImplicitOverride),
|
182
|
+
// constructor
|
183
|
+
t.classMethod('constructor', t.identifier('constructor'), [
|
184
|
+
(0, utils_1.typedIdentifier)('client', t.tsTypeAnnotation(t.tsTypeReference(t.identifier('SigningCosmWasmClient')))),
|
185
|
+
(0, utils_1.typedIdentifier)('sender', t.tsTypeAnnotation(t.tsStringKeyword())),
|
186
|
+
(0, utils_1.typedIdentifier)('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword()))
|
187
|
+
], t.blockStatement(blockStmt)),
|
188
|
+
...methods
|
189
|
+
], [t.tSExpressionWithTypeArguments(t.identifier(implementsClassName))], extendsClassName ? t.identifier(extendsClassName) : null));
|
190
|
+
};
|
191
|
+
exports.createExecuteClass = createExecuteClass;
|
192
|
+
const createExecuteInterface = (context, className, extendsClassName, execMsg) => {
|
193
|
+
const methods = (0, utils_1.getMessageProperties)(execMsg).map((jsonschema) => {
|
194
|
+
const underscoreName = Object.keys(jsonschema.properties)[0];
|
195
|
+
const methodName = (0, case_1.camel)(underscoreName);
|
196
|
+
return (0, exports.createPropertyFunctionWithObjectParamsForExec)(context, methodName, 'ExecuteResult', jsonschema.properties[underscoreName]);
|
197
|
+
});
|
198
|
+
const extendsAst = extendsClassName
|
199
|
+
? [t.tSExpressionWithTypeArguments(t.identifier(extendsClassName))]
|
200
|
+
: [];
|
201
|
+
return t.exportNamedDeclaration(t.tsInterfaceDeclaration(t.identifier(className), null, extendsAst, t.tSInterfaceBody([
|
202
|
+
// contract address
|
203
|
+
t.tSPropertySignature(t.identifier('contractAddress'), t.tsTypeAnnotation(t.tsStringKeyword())),
|
204
|
+
// contract address
|
205
|
+
t.tSPropertySignature(t.identifier('sender'), t.tsTypeAnnotation(t.tsStringKeyword())),
|
206
|
+
...methods
|
207
|
+
])));
|
208
|
+
};
|
209
|
+
exports.createExecuteInterface = createExecuteInterface;
|
210
|
+
const createPropertyFunctionWithObjectParams = (context, methodName, responseType, jsonschema) => {
|
211
|
+
const obj = (0, types_1.createTypedObjectParams)(context, jsonschema);
|
212
|
+
const func = {
|
213
|
+
type: 'TSFunctionType',
|
214
|
+
typeAnnotation: (0, utils_1.promiseTypeAnnotation)(responseType),
|
215
|
+
parameters: obj ? [obj] : []
|
216
|
+
};
|
217
|
+
return t.tSPropertySignature(t.identifier(methodName), t.tsTypeAnnotation(
|
218
|
+
// @ts-ignore:next-line
|
219
|
+
func));
|
220
|
+
};
|
221
|
+
exports.createPropertyFunctionWithObjectParams = createPropertyFunctionWithObjectParams;
|
222
|
+
const createPropertyFunctionWithObjectParamsForExec = (context, methodName, responseType, jsonschema) => {
|
223
|
+
context.addUtil('Coin');
|
224
|
+
const obj = (0, types_1.createTypedObjectParams)(context, jsonschema);
|
225
|
+
const func = {
|
226
|
+
type: 'TSFunctionType',
|
227
|
+
typeAnnotation: (0, utils_1.promiseTypeAnnotation)(responseType),
|
228
|
+
parameters: obj ? [obj, ...utils_1.FIXED_EXECUTE_PARAMS] : utils_1.FIXED_EXECUTE_PARAMS
|
229
|
+
};
|
230
|
+
return t.tSPropertySignature(t.identifier(methodName), t.tsTypeAnnotation(
|
231
|
+
// @ts-ignore:next-line
|
232
|
+
func));
|
233
|
+
};
|
234
|
+
exports.createPropertyFunctionWithObjectParamsForExec = createPropertyFunctionWithObjectParamsForExec;
|
235
|
+
const createQueryInterface = (context, className, queryMsg) => {
|
236
|
+
const methods = (0, utils_1.getMessageProperties)(queryMsg).map((jsonschema) => {
|
237
|
+
const underscoreName = Object.keys(jsonschema.properties)[0];
|
238
|
+
const methodName = (0, case_1.camel)(underscoreName);
|
239
|
+
const responseType = (0, types_1.getResponseType)(context, underscoreName);
|
240
|
+
return (0, exports.createPropertyFunctionWithObjectParams)(context, methodName, responseType, jsonschema.properties[underscoreName]);
|
241
|
+
});
|
242
|
+
return t.exportNamedDeclaration(t.tsInterfaceDeclaration(t.identifier(className), null, [], t.tSInterfaceBody([
|
243
|
+
t.tSPropertySignature(t.identifier('contractAddress'), t.tsTypeAnnotation(t.tsStringKeyword())),
|
244
|
+
...methods
|
245
|
+
])));
|
246
|
+
};
|
247
|
+
exports.createQueryInterface = createQueryInterface;
|
248
|
+
const createTypeOrInterface = (context, Type, jsonschema) => {
|
249
|
+
// Handle non-object and potentially union or referenced types
|
250
|
+
if (jsonschema.type !== 'object') {
|
251
|
+
if (!jsonschema.type) {
|
252
|
+
if (jsonschema.title) {
|
253
|
+
return t.exportNamedDeclaration(t.tsTypeAliasDeclaration(t.identifier(Type), null, t.tsTypeReference(t.identifier(jsonschema.title))));
|
254
|
+
}
|
255
|
+
else {
|
256
|
+
throw new Error('Schema must have a type or title!');
|
257
|
+
}
|
258
|
+
}
|
259
|
+
// Use getTypeOrRef to handle string, array of strings, or $ref
|
260
|
+
const typeAnnotation = (0, utils_1.getTypeOrRef)(jsonschema);
|
261
|
+
return t.exportNamedDeclaration(t.tsTypeAliasDeclaration(t.identifier(Type), null, typeAnnotation));
|
262
|
+
}
|
263
|
+
// Handle object type schemas
|
264
|
+
const props = Object.keys(jsonschema.properties ?? {}).map((prop) => {
|
265
|
+
const { type, optional } = (0, types_1.getPropertyType)(context, jsonschema, prop);
|
266
|
+
return (0, babel_1.propertySignature)((0, case_1.camel)(prop), t.tsTypeAnnotation(type), optional);
|
267
|
+
});
|
268
|
+
return t.exportNamedDeclaration(t.tsInterfaceDeclaration(t.identifier(Type), null, [], t.tsInterfaceBody([...props])));
|
269
|
+
};
|
270
|
+
exports.createTypeOrInterface = createTypeOrInterface;
|
271
|
+
const createTypeInterface = (context, jsonschema) => {
|
272
|
+
const Type = jsonschema.title;
|
273
|
+
return (0, exports.createTypeOrInterface)(context, Type, jsonschema);
|
274
|
+
};
|
275
|
+
exports.createTypeInterface = createTypeInterface;
|
package/client/index.js
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./client"), exports);
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import * as t from '@babel/types';
|
2
|
+
import { JSONSchema, IDLObject } from "@cosmology/ts-codegen-types";
|
2
3
|
import { UtilMapping } from "./imports";
|
3
4
|
export interface ReactQueryOptions {
|
4
5
|
enabled?: boolean;
|
@@ -25,27 +26,14 @@ export interface RecoilOptions {
|
|
25
26
|
}
|
26
27
|
export interface TSTypesOptions {
|
27
28
|
enabled?: boolean;
|
29
|
+
itemsUseTuples?: boolean;
|
28
30
|
aliasExecuteMsg?: boolean;
|
29
31
|
aliasEntryPoints?: boolean;
|
30
32
|
}
|
31
|
-
interface KeyedSchema {
|
32
|
-
[key: string]: JSONSchema;
|
33
|
-
}
|
34
|
-
export interface IDLObject {
|
35
|
-
contract_name: string;
|
36
|
-
contract_version: string;
|
37
|
-
idl_version: string;
|
38
|
-
instantiate: JSONSchema;
|
39
|
-
execute: JSONSchema;
|
40
|
-
query: JSONSchema;
|
41
|
-
migrate: JSONSchema;
|
42
|
-
sudo: JSONSchema;
|
43
|
-
responses: KeyedSchema;
|
44
|
-
}
|
45
33
|
export interface ContractInfo {
|
46
34
|
schemas: JSONSchema[];
|
47
35
|
responses?: Record<string, JSONSchema>;
|
48
|
-
idlObject?: IDLObject
|
36
|
+
idlObject?: Partial<IDLObject>;
|
49
37
|
}
|
50
38
|
export interface RenderOptions {
|
51
39
|
enabled?: boolean;
|
@@ -62,9 +50,9 @@ export interface ProviderInfo {
|
|
62
50
|
basename: string;
|
63
51
|
}
|
64
52
|
export interface IContext {
|
65
|
-
refLookup($ref: string):
|
66
|
-
addUtil(util: string):
|
67
|
-
getImports(registeredUtils?: UtilMapping, filepath?: string):
|
53
|
+
refLookup($ref: string): JSONSchema;
|
54
|
+
addUtil(util: string): void;
|
55
|
+
getImports(registeredUtils?: UtilMapping, filepath?: string): (t.ImportNamespaceSpecifier | t.ImportDeclaration | t.ImportDefaultSpecifier)[];
|
68
56
|
}
|
69
57
|
export interface IRenderContext<TOpt = RenderOptions> extends IContext {
|
70
58
|
contract: ContractInfo;
|
@@ -99,7 +87,7 @@ export declare class BuilderContext {
|
|
99
87
|
export declare abstract class RenderContextBase<TOpt = RenderOptions> implements IRenderContext<TOpt> {
|
100
88
|
builderContext: BuilderContext;
|
101
89
|
contract: ContractInfo;
|
102
|
-
utils: string
|
90
|
+
utils: Record<string, boolean>;
|
103
91
|
schema: JSONSchema;
|
104
92
|
options: TOpt;
|
105
93
|
constructor(contract: ContractInfo, options?: TOpt, builderContext?: BuilderContext);
|
@@ -116,9 +104,8 @@ export declare abstract class RenderContextBase<TOpt = RenderOptions> implements
|
|
116
104
|
[key: string]: ProviderInfo;
|
117
105
|
};
|
118
106
|
};
|
119
|
-
getImports(registeredUtils?: UtilMapping, filepath?: string):
|
107
|
+
getImports(registeredUtils?: UtilMapping, filepath?: string): (t.ImportNamespaceSpecifier | t.ImportDeclaration | t.ImportDefaultSpecifier)[];
|
120
108
|
}
|
121
109
|
export declare class RenderContext extends RenderContextBase {
|
122
110
|
mergeDefaultOpt(options: RenderOptions): RenderOptions;
|
123
111
|
}
|
124
|
-
export {};
|