wasm-ast-types 0.26.4 → 1.1.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
@@ -1,203 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`client 1`] = `
|
4
|
-
"export const queryClient = selectorFamily<SG721QueryClient, QueryClientParams>({
|
5
|
-
key: \\"sG721QueryClient\\",
|
6
|
-
get: ({
|
7
|
-
contractAddress
|
8
|
-
}) => ({
|
9
|
-
get
|
10
|
-
}) => {
|
11
|
-
const client = get(cosmWasmClient);
|
12
|
-
return new SG721QueryClient(client, contractAddress);
|
13
|
-
}
|
14
|
-
});"
|
15
|
-
`;
|
16
|
-
|
17
|
-
exports[`selector 1`] = `
|
18
|
-
"export const governanceModulesSelector = selectorFamily<GovernanceModulesResponse, QueryClientParams & {
|
19
|
-
params: Parameters<SG721QueryClient[\\"governanceModules\\"]>;
|
20
|
-
}>({
|
21
|
-
key: \\"sG721GovernanceModules\\",
|
22
|
-
get: ({
|
23
|
-
params,
|
24
|
-
...queryClientParams
|
25
|
-
}) => async ({
|
26
|
-
get
|
27
|
-
}) => {
|
28
|
-
const client = get(queryClient(queryClientParams));
|
29
|
-
return await client.governanceModules(...params);
|
30
|
-
}
|
31
|
-
});"
|
32
|
-
`;
|
33
|
-
|
34
|
-
exports[`selectors 1`] = `
|
35
|
-
"export const ownerOfSelector = selectorFamily<OwnerOfResponse, QueryClientParams & {
|
36
|
-
params: Parameters<SG721QueryClient[\\"ownerOf\\"]>;
|
37
|
-
}>({
|
38
|
-
key: \\"sG721OwnerOf\\",
|
39
|
-
get: ({
|
40
|
-
params,
|
41
|
-
...queryClientParams
|
42
|
-
}) => async ({
|
43
|
-
get
|
44
|
-
}) => {
|
45
|
-
const client = get(queryClient(queryClientParams));
|
46
|
-
return await client.ownerOf(...params);
|
47
|
-
}
|
48
|
-
});
|
49
|
-
export const approvalSelector = selectorFamily<ApprovalResponse, QueryClientParams & {
|
50
|
-
params: Parameters<SG721QueryClient[\\"approval\\"]>;
|
51
|
-
}>({
|
52
|
-
key: \\"sG721Approval\\",
|
53
|
-
get: ({
|
54
|
-
params,
|
55
|
-
...queryClientParams
|
56
|
-
}) => async ({
|
57
|
-
get
|
58
|
-
}) => {
|
59
|
-
const client = get(queryClient(queryClientParams));
|
60
|
-
return await client.approval(...params);
|
61
|
-
}
|
62
|
-
});
|
63
|
-
export const approvalsSelector = selectorFamily<ApprovalsResponse, QueryClientParams & {
|
64
|
-
params: Parameters<SG721QueryClient[\\"approvals\\"]>;
|
65
|
-
}>({
|
66
|
-
key: \\"sG721Approvals\\",
|
67
|
-
get: ({
|
68
|
-
params,
|
69
|
-
...queryClientParams
|
70
|
-
}) => async ({
|
71
|
-
get
|
72
|
-
}) => {
|
73
|
-
const client = get(queryClient(queryClientParams));
|
74
|
-
return await client.approvals(...params);
|
75
|
-
}
|
76
|
-
});
|
77
|
-
export const allOperatorsSelector = selectorFamily<AllOperatorsResponse, QueryClientParams & {
|
78
|
-
params: Parameters<SG721QueryClient[\\"allOperators\\"]>;
|
79
|
-
}>({
|
80
|
-
key: \\"sG721AllOperators\\",
|
81
|
-
get: ({
|
82
|
-
params,
|
83
|
-
...queryClientParams
|
84
|
-
}) => async ({
|
85
|
-
get
|
86
|
-
}) => {
|
87
|
-
const client = get(queryClient(queryClientParams));
|
88
|
-
return await client.allOperators(...params);
|
89
|
-
}
|
90
|
-
});
|
91
|
-
export const numTokensSelector = selectorFamily<NumTokensResponse, QueryClientParams & {
|
92
|
-
params: Parameters<SG721QueryClient[\\"numTokens\\"]>;
|
93
|
-
}>({
|
94
|
-
key: \\"sG721NumTokens\\",
|
95
|
-
get: ({
|
96
|
-
params,
|
97
|
-
...queryClientParams
|
98
|
-
}) => async ({
|
99
|
-
get
|
100
|
-
}) => {
|
101
|
-
const client = get(queryClient(queryClientParams));
|
102
|
-
return await client.numTokens(...params);
|
103
|
-
}
|
104
|
-
});
|
105
|
-
export const contractInfoSelector = selectorFamily<ContractInfoResponse, QueryClientParams & {
|
106
|
-
params: Parameters<SG721QueryClient[\\"contractInfo\\"]>;
|
107
|
-
}>({
|
108
|
-
key: \\"sG721ContractInfo\\",
|
109
|
-
get: ({
|
110
|
-
params,
|
111
|
-
...queryClientParams
|
112
|
-
}) => async ({
|
113
|
-
get
|
114
|
-
}) => {
|
115
|
-
const client = get(queryClient(queryClientParams));
|
116
|
-
return await client.contractInfo(...params);
|
117
|
-
}
|
118
|
-
});
|
119
|
-
export const nftInfoSelector = selectorFamily<NftInfoResponse, QueryClientParams & {
|
120
|
-
params: Parameters<SG721QueryClient[\\"nftInfo\\"]>;
|
121
|
-
}>({
|
122
|
-
key: \\"sG721NftInfo\\",
|
123
|
-
get: ({
|
124
|
-
params,
|
125
|
-
...queryClientParams
|
126
|
-
}) => async ({
|
127
|
-
get
|
128
|
-
}) => {
|
129
|
-
const client = get(queryClient(queryClientParams));
|
130
|
-
return await client.nftInfo(...params);
|
131
|
-
}
|
132
|
-
});
|
133
|
-
export const allNftInfoSelector = selectorFamily<AllNftInfoResponse, QueryClientParams & {
|
134
|
-
params: Parameters<SG721QueryClient[\\"allNftInfo\\"]>;
|
135
|
-
}>({
|
136
|
-
key: \\"sG721AllNftInfo\\",
|
137
|
-
get: ({
|
138
|
-
params,
|
139
|
-
...queryClientParams
|
140
|
-
}) => async ({
|
141
|
-
get
|
142
|
-
}) => {
|
143
|
-
const client = get(queryClient(queryClientParams));
|
144
|
-
return await client.allNftInfo(...params);
|
145
|
-
}
|
146
|
-
});
|
147
|
-
export const tokensSelector = selectorFamily<TokensResponse, QueryClientParams & {
|
148
|
-
params: Parameters<SG721QueryClient[\\"tokens\\"]>;
|
149
|
-
}>({
|
150
|
-
key: \\"sG721Tokens\\",
|
151
|
-
get: ({
|
152
|
-
params,
|
153
|
-
...queryClientParams
|
154
|
-
}) => async ({
|
155
|
-
get
|
156
|
-
}) => {
|
157
|
-
const client = get(queryClient(queryClientParams));
|
158
|
-
return await client.tokens(...params);
|
159
|
-
}
|
160
|
-
});
|
161
|
-
export const allTokensSelector = selectorFamily<AllTokensResponse, QueryClientParams & {
|
162
|
-
params: Parameters<SG721QueryClient[\\"allTokens\\"]>;
|
163
|
-
}>({
|
164
|
-
key: \\"sG721AllTokens\\",
|
165
|
-
get: ({
|
166
|
-
params,
|
167
|
-
...queryClientParams
|
168
|
-
}) => async ({
|
169
|
-
get
|
170
|
-
}) => {
|
171
|
-
const client = get(queryClient(queryClientParams));
|
172
|
-
return await client.allTokens(...params);
|
173
|
-
}
|
174
|
-
});
|
175
|
-
export const minterSelector = selectorFamily<MinterResponse, QueryClientParams & {
|
176
|
-
params: Parameters<SG721QueryClient[\\"minter\\"]>;
|
177
|
-
}>({
|
178
|
-
key: \\"sG721Minter\\",
|
179
|
-
get: ({
|
180
|
-
params,
|
181
|
-
...queryClientParams
|
182
|
-
}) => async ({
|
183
|
-
get
|
184
|
-
}) => {
|
185
|
-
const client = get(queryClient(queryClientParams));
|
186
|
-
return await client.minter(...params);
|
187
|
-
}
|
188
|
-
});
|
189
|
-
export const collectionInfoSelector = selectorFamily<CollectionInfoResponse, QueryClientParams & {
|
190
|
-
params: Parameters<SG721QueryClient[\\"collectionInfo\\"]>;
|
191
|
-
}>({
|
192
|
-
key: \\"sG721CollectionInfo\\",
|
193
|
-
get: ({
|
194
|
-
params,
|
195
|
-
...queryClientParams
|
196
|
-
}) => async ({
|
197
|
-
get
|
198
|
-
}) => {
|
199
|
-
const client = get(queryClient(queryClientParams));
|
200
|
-
return await client.collectionInfo(...params);
|
201
|
-
}
|
202
|
-
});"
|
203
|
-
`;
|
package/src/recoil/index.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './recoil';
|
@@ -1,38 +0,0 @@
|
|
1
|
-
import * as t from '@babel/types';
|
2
|
-
import query_msg from '../../../../__fixtures__/basic/query_msg.json';
|
3
|
-
import {
|
4
|
-
createRecoilSelector,
|
5
|
-
createRecoilSelectors,
|
6
|
-
createRecoilQueryClient,
|
7
|
-
} from './recoil';
|
8
|
-
import { RenderContext } from '../context';
|
9
|
-
import { expectCode, makeContext } from '../../test-utils';
|
10
|
-
|
11
|
-
const ctx = makeContext(query_msg);
|
12
|
-
|
13
|
-
it('selector', () => {
|
14
|
-
expectCode(createRecoilSelector(
|
15
|
-
ctx,
|
16
|
-
'SG721',
|
17
|
-
'SG721QueryClient',
|
18
|
-
'governanceModules',
|
19
|
-
'GovernanceModulesResponse'
|
20
|
-
))
|
21
|
-
});
|
22
|
-
|
23
|
-
it('selectors', () => {
|
24
|
-
expectCode(t.program(createRecoilSelectors(
|
25
|
-
ctx,
|
26
|
-
'SG721',
|
27
|
-
'SG721QueryClient',
|
28
|
-
query_msg
|
29
|
-
)))
|
30
|
-
});
|
31
|
-
|
32
|
-
it('client', () => {
|
33
|
-
expectCode(createRecoilQueryClient(
|
34
|
-
ctx,
|
35
|
-
'SG721',
|
36
|
-
'SG721QueryClient'
|
37
|
-
))
|
38
|
-
});
|
package/src/recoil/recoil.ts
DELETED
@@ -1,307 +0,0 @@
|
|
1
|
-
import * as t from '@babel/types';
|
2
|
-
import { camel, pascal } from 'case';
|
3
|
-
import {
|
4
|
-
callExpression,
|
5
|
-
getMessageProperties,
|
6
|
-
getResponseType
|
7
|
-
} from '../utils';
|
8
|
-
import { QueryMsg } from '../types';
|
9
|
-
import { RenderContext } from '../context';
|
10
|
-
|
11
|
-
export const createRecoilSelector = (
|
12
|
-
context: RenderContext,
|
13
|
-
keyPrefix: string,
|
14
|
-
QueryClient: string,
|
15
|
-
methodName: string,
|
16
|
-
responseType: string
|
17
|
-
) => {
|
18
|
-
|
19
|
-
context.addUtil('selectorFamily');
|
20
|
-
|
21
|
-
const selectorName = camel(`${methodName}Selector`);
|
22
|
-
const getterKey = camel(`${keyPrefix}${pascal(methodName)}`);
|
23
|
-
|
24
|
-
return t.exportNamedDeclaration(
|
25
|
-
t.variableDeclaration(
|
26
|
-
'const',
|
27
|
-
[t.variableDeclarator(
|
28
|
-
t.identifier(selectorName),
|
29
|
-
callExpression(
|
30
|
-
t.identifier('selectorFamily'),
|
31
|
-
[
|
32
|
-
t.objectExpression(
|
33
|
-
[
|
34
|
-
t.objectProperty(
|
35
|
-
t.identifier('key'),
|
36
|
-
t.stringLiteral(getterKey)
|
37
|
-
),
|
38
|
-
t.objectProperty(
|
39
|
-
t.identifier('get'),
|
40
|
-
t.arrowFunctionExpression(
|
41
|
-
[
|
42
|
-
t.objectPattern(
|
43
|
-
[
|
44
|
-
t.objectProperty(
|
45
|
-
t.identifier('params'),
|
46
|
-
t.identifier('params'),
|
47
|
-
false,
|
48
|
-
true
|
49
|
-
),
|
50
|
-
t.restElement(
|
51
|
-
t.identifier('queryClientParams')
|
52
|
-
)
|
53
|
-
]
|
54
|
-
)
|
55
|
-
],
|
56
|
-
t.arrowFunctionExpression(
|
57
|
-
[
|
58
|
-
t.objectPattern(
|
59
|
-
[
|
60
|
-
t.objectProperty(
|
61
|
-
t.identifier('get'),
|
62
|
-
t.identifier('get'),
|
63
|
-
false,
|
64
|
-
true
|
65
|
-
)
|
66
|
-
]
|
67
|
-
)
|
68
|
-
],
|
69
|
-
t.blockStatement(
|
70
|
-
[
|
71
|
-
t.variableDeclaration('const',
|
72
|
-
[
|
73
|
-
t.variableDeclarator(
|
74
|
-
t.identifier('client'),
|
75
|
-
t.callExpression(
|
76
|
-
t.identifier('get'),
|
77
|
-
[
|
78
|
-
t.callExpression(
|
79
|
-
t.identifier('queryClient'),
|
80
|
-
[
|
81
|
-
t.identifier('queryClientParams')
|
82
|
-
]
|
83
|
-
)
|
84
|
-
]
|
85
|
-
)
|
86
|
-
)
|
87
|
-
]),
|
88
|
-
t.returnStatement(
|
89
|
-
t.awaitExpression(
|
90
|
-
t.callExpression(
|
91
|
-
t.memberExpression(
|
92
|
-
t.identifier('client'),
|
93
|
-
t.identifier(methodName)
|
94
|
-
),
|
95
|
-
[
|
96
|
-
t.spreadElement(
|
97
|
-
t.identifier('params')
|
98
|
-
)
|
99
|
-
]
|
100
|
-
)
|
101
|
-
)
|
102
|
-
)
|
103
|
-
]
|
104
|
-
),
|
105
|
-
true
|
106
|
-
)
|
107
|
-
)
|
108
|
-
)
|
109
|
-
]
|
110
|
-
)
|
111
|
-
],
|
112
|
-
t.tsTypeParameterInstantiation(
|
113
|
-
[
|
114
|
-
t.tsTypeReference(
|
115
|
-
t.identifier(responseType)
|
116
|
-
),
|
117
|
-
t.tsIntersectionType(
|
118
|
-
[
|
119
|
-
t.tsTypeReference(
|
120
|
-
t.identifier('QueryClientParams')
|
121
|
-
),
|
122
|
-
t.tsTypeLiteral(
|
123
|
-
[
|
124
|
-
t.tsPropertySignature(
|
125
|
-
t.identifier('params'),
|
126
|
-
t.tsTypeAnnotation(
|
127
|
-
t.tsTypeReference(
|
128
|
-
t.identifier('Parameters'),
|
129
|
-
t.tsTypeParameterInstantiation(
|
130
|
-
[
|
131
|
-
t.tsIndexedAccessType(
|
132
|
-
t.tsTypeReference(
|
133
|
-
t.identifier(QueryClient)
|
134
|
-
),
|
135
|
-
t.tsLiteralType(
|
136
|
-
t.stringLiteral(methodName)
|
137
|
-
)
|
138
|
-
)
|
139
|
-
]
|
140
|
-
)
|
141
|
-
)
|
142
|
-
)
|
143
|
-
)
|
144
|
-
]
|
145
|
-
)
|
146
|
-
]
|
147
|
-
)
|
148
|
-
]
|
149
|
-
)
|
150
|
-
)
|
151
|
-
)]
|
152
|
-
)
|
153
|
-
)
|
154
|
-
|
155
|
-
};
|
156
|
-
|
157
|
-
export const createRecoilSelectors = (
|
158
|
-
context: RenderContext,
|
159
|
-
keyPrefix: string,
|
160
|
-
QueryClient: string,
|
161
|
-
queryMsg: QueryMsg
|
162
|
-
) => {
|
163
|
-
return getMessageProperties(queryMsg)
|
164
|
-
.map(schema => {
|
165
|
-
|
166
|
-
const underscoreName = Object.keys(schema.properties)[0];
|
167
|
-
const methodName = camel(underscoreName);
|
168
|
-
const responseType = getResponseType(context, underscoreName);
|
169
|
-
|
170
|
-
return createRecoilSelector(
|
171
|
-
context,
|
172
|
-
keyPrefix,
|
173
|
-
QueryClient,
|
174
|
-
methodName,
|
175
|
-
responseType
|
176
|
-
);
|
177
|
-
|
178
|
-
});
|
179
|
-
};
|
180
|
-
|
181
|
-
export const createRecoilQueryClientType = () => ({
|
182
|
-
"type": "TSTypeAliasDeclaration",
|
183
|
-
"id": {
|
184
|
-
"type": "Identifier",
|
185
|
-
"name": "QueryClientParams"
|
186
|
-
},
|
187
|
-
"typeAnnotation": {
|
188
|
-
"type": "TSTypeLiteral",
|
189
|
-
"members": [
|
190
|
-
{
|
191
|
-
"type": "TSPropertySignature",
|
192
|
-
"key": {
|
193
|
-
"type": "Identifier",
|
194
|
-
"name": "contractAddress"
|
195
|
-
},
|
196
|
-
"computed": false,
|
197
|
-
"typeAnnotation": {
|
198
|
-
"type": "TSTypeAnnotation",
|
199
|
-
"typeAnnotation": {
|
200
|
-
"type": "TSStringKeyword"
|
201
|
-
}
|
202
|
-
}
|
203
|
-
}
|
204
|
-
]
|
205
|
-
}
|
206
|
-
});
|
207
|
-
|
208
|
-
export const createRecoilQueryClient = (
|
209
|
-
context: RenderContext,
|
210
|
-
keyPrefix: string,
|
211
|
-
QueryClient: string
|
212
|
-
) => {
|
213
|
-
|
214
|
-
context.addUtil('selectorFamily');
|
215
|
-
|
216
|
-
const getterKey = camel(`${keyPrefix}${'QueryClient'}`);
|
217
|
-
|
218
|
-
return t.exportNamedDeclaration(
|
219
|
-
t.variableDeclaration(
|
220
|
-
'const',
|
221
|
-
[t.variableDeclarator(
|
222
|
-
t.identifier('queryClient'),
|
223
|
-
callExpression(
|
224
|
-
t.identifier('selectorFamily'),
|
225
|
-
[
|
226
|
-
t.objectExpression(
|
227
|
-
[
|
228
|
-
t.objectProperty(
|
229
|
-
t.identifier('key'),
|
230
|
-
t.stringLiteral(getterKey)
|
231
|
-
),
|
232
|
-
t.objectProperty(
|
233
|
-
t.identifier('get'),
|
234
|
-
t.arrowFunctionExpression(
|
235
|
-
[
|
236
|
-
t.objectPattern(
|
237
|
-
[
|
238
|
-
t.objectProperty(
|
239
|
-
t.identifier('contractAddress'),
|
240
|
-
t.identifier('contractAddress'),
|
241
|
-
false,
|
242
|
-
true
|
243
|
-
)
|
244
|
-
]
|
245
|
-
)
|
246
|
-
],
|
247
|
-
t.arrowFunctionExpression(
|
248
|
-
[
|
249
|
-
t.objectPattern(
|
250
|
-
[
|
251
|
-
t.objectProperty(
|
252
|
-
t.identifier('get'),
|
253
|
-
t.identifier('get'),
|
254
|
-
false,
|
255
|
-
true
|
256
|
-
)
|
257
|
-
]
|
258
|
-
)
|
259
|
-
],
|
260
|
-
t.blockStatement(
|
261
|
-
[
|
262
|
-
t.variableDeclaration('const',
|
263
|
-
[
|
264
|
-
t.variableDeclarator(
|
265
|
-
t.identifier('client'),
|
266
|
-
t.callExpression(
|
267
|
-
t.identifier('get'),
|
268
|
-
[
|
269
|
-
t.identifier('cosmWasmClient')
|
270
|
-
]
|
271
|
-
)
|
272
|
-
)
|
273
|
-
]),
|
274
|
-
t.returnStatement(
|
275
|
-
t.newExpression(
|
276
|
-
t.identifier(QueryClient),
|
277
|
-
[
|
278
|
-
t.identifier('client'),
|
279
|
-
t.identifier('contractAddress')
|
280
|
-
]
|
281
|
-
)
|
282
|
-
)
|
283
|
-
]
|
284
|
-
),
|
285
|
-
false
|
286
|
-
)
|
287
|
-
)
|
288
|
-
)
|
289
|
-
]
|
290
|
-
)
|
291
|
-
],
|
292
|
-
t.tsTypeParameterInstantiation(
|
293
|
-
[
|
294
|
-
t.tsTypeReference(
|
295
|
-
t.identifier(QueryClient)
|
296
|
-
),
|
297
|
-
t.tsTypeReference(
|
298
|
-
t.identifier('QueryClientParams')
|
299
|
-
)
|
300
|
-
]
|
301
|
-
)
|
302
|
-
)
|
303
|
-
)]
|
304
|
-
)
|
305
|
-
)
|
306
|
-
|
307
|
-
};
|
package/src/types.ts
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
export declare type fieldType = 'Long' | 'Coin' | 'Duration' | 'Height' | string;
|
2
|
-
export interface Field {
|
3
|
-
name: string;
|
4
|
-
type: fieldType;
|
5
|
-
node: any;
|
6
|
-
};
|
7
|
-
export interface Interface {
|
8
|
-
name: string;
|
9
|
-
fields: Field[]
|
10
|
-
};
|
11
|
-
|
12
|
-
export interface QueryMsg {
|
13
|
-
$schema: string;
|
14
|
-
title: "QueryMsg";
|
15
|
-
oneOf?: any;
|
16
|
-
allOf?: any;
|
17
|
-
anyOf?: any;
|
18
|
-
}
|
19
|
-
|
20
|
-
export interface ExecuteMsg {
|
21
|
-
$schema: string;
|
22
|
-
title: "ExecuteMsg" | "ExecuteMsg_for_Empty";
|
23
|
-
oneOf?: any;
|
24
|
-
allOf?: any;
|
25
|
-
anyOf?: any;
|
26
|
-
}
|
27
|
-
|
28
|
-
export interface JSONSchema {
|
29
|
-
$ref?: string;
|
30
|
-
$schema?: string;
|
31
|
-
additionalProperties?: boolean;
|
32
|
-
allOf?: JSONSchema[];
|
33
|
-
anyOf?: JSONSchema[];
|
34
|
-
definitions?: Record<string, JSONSchema>;
|
35
|
-
description?: string;
|
36
|
-
oneOf?: JSONSchema[];
|
37
|
-
properties?: Record<string, JSONSchema>;
|
38
|
-
patternProperties?: Record<string, JSONSchema>;
|
39
|
-
items?: JSONSchema | JSONSchema[];
|
40
|
-
additionalItems?: JSONSchema;
|
41
|
-
required?: string[];
|
42
|
-
title?: string;
|
43
|
-
type?: string;
|
44
|
-
}
|
@@ -1,75 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`interfaces 1`] = `
|
4
|
-
"export interface SG721ReadOnlyInstance {
|
5
|
-
contractAddress: string;
|
6
|
-
tokens: (owner: string, startAfter?: string, limit?: string) => Promise<TokensResponse>;
|
7
|
-
}
|
8
|
-
export interface SG721Instance extends SG721ReadOnlyInstance {
|
9
|
-
contractAddress: string;
|
10
|
-
mint: (sender: string, anotherProp: string, prop3: string) => Promise<ExecuteResult>;
|
11
|
-
}"
|
12
|
-
`;
|
13
|
-
|
14
|
-
exports[`mutation classes 1`] = `
|
15
|
-
"export class SG721Client extends SG721QueryClient implements SG721ReadOnlyInstance {
|
16
|
-
client: SigningCosmWasmClient;
|
17
|
-
contractAddress: string;
|
18
|
-
|
19
|
-
constructor(client: SigningCosmWasmClient, contractAddress: string) {
|
20
|
-
super(client, contractAddress);
|
21
|
-
this.client = client;
|
22
|
-
this.contractAddress = contractAddress;
|
23
|
-
this.approval = this.approval.bind(this);
|
24
|
-
this.otherProp = this.otherProp.bind(this);
|
25
|
-
this.hello = this.hello.bind(this);
|
26
|
-
this.mintme = this.mintme.bind(this);
|
27
|
-
}
|
28
|
-
|
29
|
-
mint = async (sender: string, tokenId: string, owner: string, token_uri: string): Promise<ExecuteResult> => {
|
30
|
-
return await this.client.execute(sender, this.contractAddress, {
|
31
|
-
mint: {
|
32
|
-
token_id: tokenId,
|
33
|
-
owner: owner,
|
34
|
-
token_uri: token_uri,
|
35
|
-
expression: {}
|
36
|
-
}
|
37
|
-
}, \\"auto\\");
|
38
|
-
};
|
39
|
-
}"
|
40
|
-
`;
|
41
|
-
|
42
|
-
exports[`object parms 1`] = `
|
43
|
-
"ownerOf = ({
|
44
|
-
includeExpired,
|
45
|
-
tokenId
|
46
|
-
}: {
|
47
|
-
includeExpired: boolean;
|
48
|
-
tokenId: string;
|
49
|
-
}): Promise<OwnerOfResponse> => {};"
|
50
|
-
`;
|
51
|
-
|
52
|
-
exports[`readonly classes 1`] = `
|
53
|
-
"export class SG721QueryClient implements SG721ReadOnlyInstance {
|
54
|
-
client: CosmWasmClient;
|
55
|
-
contractAddress: string;
|
56
|
-
|
57
|
-
constructor(client: CosmWasmClient, contractAddress: string) {
|
58
|
-
this.client = client;
|
59
|
-
this.contractAddress = contractAddress;
|
60
|
-
this.approval = this.approval.bind(this);
|
61
|
-
this.otherProp = this.otherProp.bind(this);
|
62
|
-
this.hello = this.hello.bind(this);
|
63
|
-
this.mintme = this.mintme.bind(this);
|
64
|
-
}
|
65
|
-
|
66
|
-
approval = async (owner: string, spender: string): Promise<ApprovalResponse> => {
|
67
|
-
return this.client.queryContractSmart(this.contractAddress, {
|
68
|
-
owner,
|
69
|
-
spender
|
70
|
-
});
|
71
|
-
};
|
72
|
-
}"
|
73
|
-
`;
|
74
|
-
|
75
|
-
exports[`top import 1`] = `"import { CosmWasmClient, ExecuteResult, SigningCosmWasmClient } from \\"@cosmjs/cosmwasm-stargate\\";"`;
|