wasm-ast-types 0.11.3 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. package/main/client/test/ts-client.issue-71.test.js +103 -0
  2. package/main/context/context.js +2 -1
  3. package/main/utils/types.js +20 -7
  4. package/module/client/test/ts-client.issue-71.test.js +21 -0
  5. package/module/context/context.js +2 -1
  6. package/module/utils/types.js +20 -7
  7. package/package.json +5 -3
  8. package/src/client/client.ts +665 -0
  9. package/src/client/index.ts +1 -0
  10. package/src/client/test/__snapshots__/ts-client.account-nfts.spec.ts.snap +497 -0
  11. package/src/client/test/__snapshots__/ts-client.arrays-ref.spec.ts.snap +452 -0
  12. package/src/client/test/__snapshots__/ts-client.arrays.spec.ts.snap +101 -0
  13. package/src/client/test/__snapshots__/ts-client.cw-named-groups.test.ts.snap +141 -0
  14. package/src/client/test/__snapshots__/ts-client.cw-proposal-single.test.ts.snap +341 -0
  15. package/src/client/test/__snapshots__/ts-client.empty-enums.spec.ts.snap +20 -0
  16. package/src/client/test/__snapshots__/ts-client.issue-71.test.ts.snap +432 -0
  17. package/src/client/test/__snapshots__/ts-client.issues.test.ts.snap +984 -0
  18. package/src/client/test/__snapshots__/ts-client.sg721.spec.ts.snap +350 -0
  19. package/src/client/test/__snapshots__/ts-client.spec.ts.snap +723 -0
  20. package/src/client/test/__snapshots__/ts-client.vectis.spec.ts.snap +337 -0
  21. package/src/client/test/ts-client.account-nfts.spec.ts +55 -0
  22. package/src/client/test/ts-client.arrays-ref.spec.ts +48 -0
  23. package/src/client/test/ts-client.arrays.spec.ts +58 -0
  24. package/src/client/test/ts-client.cw-named-groups.test.ts +48 -0
  25. package/src/client/test/ts-client.cw-proposal-single.test.ts +50 -0
  26. package/src/client/test/ts-client.empty-enums.spec.ts +28 -0
  27. package/src/client/test/ts-client.issue-71.test.ts +51 -0
  28. package/src/client/test/ts-client.issues.test.ts +52 -0
  29. package/src/client/test/ts-client.sg721.spec.ts +46 -0
  30. package/src/client/test/ts-client.spec.ts +166 -0
  31. package/src/client/test/ts-client.vectis.spec.ts +97 -0
  32. package/src/context/context.ts +134 -0
  33. package/src/context/imports.ts +126 -0
  34. package/src/context/index.ts +2 -0
  35. package/src/index.ts +7 -0
  36. package/src/message-composer/__snapshots__/message-composer.spec.ts.snap +271 -0
  37. package/src/message-composer/index.ts +1 -0
  38. package/src/message-composer/message-composer.spec.ts +25 -0
  39. package/src/message-composer/message-composer.ts +305 -0
  40. package/src/react-query/__snapshots__/react-query.spec.ts.snap +913 -0
  41. package/src/react-query/index.ts +1 -0
  42. package/src/react-query/react-query.spec.ts +75 -0
  43. package/src/react-query/react-query.ts +913 -0
  44. package/src/recoil/__snapshots__/recoil.spec.ts.snap +203 -0
  45. package/src/recoil/index.ts +1 -0
  46. package/src/recoil/recoil.spec.ts +38 -0
  47. package/src/recoil/recoil.ts +307 -0
  48. package/src/types.ts +44 -0
  49. package/src/utils/__snapshots__/babel.spec.ts.snap +75 -0
  50. package/src/utils/babel.spec.ts +511 -0
  51. package/src/utils/babel.ts +315 -0
  52. package/src/utils/index.ts +2 -0
  53. package/src/utils/types.ts +459 -0
  54. package/types/client/client.d.ts +1 -1
  55. package/types/context/context.d.ts +1 -0
@@ -0,0 +1,337 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`can_execute_relay_response 1`] = `
4
+ "export interface CanExecuteRelayResponse {
5
+ canExecute: boolean;
6
+ }"
7
+ `;
8
+
9
+ exports[`cosmos_msg_for__empty 1`] = `"export type CosmosMsg_for_Empty = CosmosMsg_for_Empty;"`;
10
+
11
+ exports[`execute classes array types 1`] = `
12
+ "export class SG721Client implements SG721Instance {
13
+ client: SigningCosmWasmClient;
14
+ sender: string;
15
+ contractAddress: string;
16
+
17
+ constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
18
+ this.client = client;
19
+ this.sender = sender;
20
+ this.contractAddress = contractAddress;
21
+ this.execute = this.execute.bind(this);
22
+ this.revertFreezeStatus = this.revertFreezeStatus.bind(this);
23
+ this.relay = this.relay.bind(this);
24
+ this.rotateUserKey = this.rotateUserKey.bind(this);
25
+ this.addRelayer = this.addRelayer.bind(this);
26
+ this.removeRelayer = this.removeRelayer.bind(this);
27
+ this.updateGuardians = this.updateGuardians.bind(this);
28
+ this.updateLabel = this.updateLabel.bind(this);
29
+ }
30
+
31
+ execute = async ({
32
+ msgs
33
+ }: {
34
+ msgs: CosmosMsg_for_Empty[];
35
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
36
+ return await this.client.execute(this.sender, this.contractAddress, {
37
+ execute: {
38
+ msgs
39
+ }
40
+ }, fee, memo, funds);
41
+ };
42
+ revertFreezeStatus = async (fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
43
+ return await this.client.execute(this.sender, this.contractAddress, {
44
+ revert_freeze_status: {}
45
+ }, fee, memo, funds);
46
+ };
47
+ relay = async ({
48
+ transaction
49
+ }: {
50
+ transaction: RelayTransaction;
51
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
52
+ return await this.client.execute(this.sender, this.contractAddress, {
53
+ relay: {
54
+ transaction
55
+ }
56
+ }, fee, memo, funds);
57
+ };
58
+ rotateUserKey = async ({
59
+ newUserAddress
60
+ }: {
61
+ newUserAddress: string;
62
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
63
+ return await this.client.execute(this.sender, this.contractAddress, {
64
+ rotate_user_key: {
65
+ new_user_address: newUserAddress
66
+ }
67
+ }, fee, memo, funds);
68
+ };
69
+ addRelayer = async ({
70
+ newRelayerAddress
71
+ }: {
72
+ newRelayerAddress: Addr;
73
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
74
+ return await this.client.execute(this.sender, this.contractAddress, {
75
+ add_relayer: {
76
+ new_relayer_address: newRelayerAddress
77
+ }
78
+ }, fee, memo, funds);
79
+ };
80
+ removeRelayer = async ({
81
+ relayerAddress
82
+ }: {
83
+ relayerAddress: Addr;
84
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
85
+ return await this.client.execute(this.sender, this.contractAddress, {
86
+ remove_relayer: {
87
+ relayer_address: relayerAddress
88
+ }
89
+ }, fee, memo, funds);
90
+ };
91
+ updateGuardians = async ({
92
+ guardians,
93
+ newMultisigCodeId
94
+ }: {
95
+ guardians: Guardians;
96
+ newMultisigCodeId?: number;
97
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
98
+ return await this.client.execute(this.sender, this.contractAddress, {
99
+ update_guardians: {
100
+ guardians,
101
+ new_multisig_code_id: newMultisigCodeId
102
+ }
103
+ }, fee, memo, funds);
104
+ };
105
+ updateLabel = async ({
106
+ newLabel
107
+ }: {
108
+ newLabel: string;
109
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
110
+ return await this.client.execute(this.sender, this.contractAddress, {
111
+ update_label: {
112
+ new_label: newLabel
113
+ }
114
+ }, fee, memo, funds);
115
+ };
116
+ }"
117
+ `;
118
+
119
+ exports[`execute interfaces no extends 1`] = `
120
+ "export interface SG721Instance {
121
+ contractAddress: string;
122
+ sender: string;
123
+ execute: ({
124
+ msgs
125
+ }: {
126
+ msgs: CosmosMsg_for_Empty[];
127
+ }, fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
128
+ revertFreezeStatus: (fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
129
+ relay: ({
130
+ transaction
131
+ }: {
132
+ transaction: RelayTransaction;
133
+ }, fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
134
+ rotateUserKey: ({
135
+ newUserAddress
136
+ }: {
137
+ newUserAddress: string;
138
+ }, fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
139
+ addRelayer: ({
140
+ newRelayerAddress
141
+ }: {
142
+ newRelayerAddress: Addr;
143
+ }, fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
144
+ removeRelayer: ({
145
+ relayerAddress
146
+ }: {
147
+ relayerAddress: Addr;
148
+ }, fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
149
+ updateGuardians: ({
150
+ guardians,
151
+ newMultisigCodeId
152
+ }: {
153
+ guardians: Guardians;
154
+ newMultisigCodeId?: number;
155
+ }, fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
156
+ updateLabel: ({
157
+ newLabel
158
+ }: {
159
+ newLabel: string;
160
+ }, fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
161
+ }"
162
+ `;
163
+
164
+ exports[`execute_msg_for__empty 1`] = `"export type ExecuteMsg_for_Empty = ExecuteMsg_for_Empty;"`;
165
+
166
+ exports[`info_response 1`] = `
167
+ "export interface InfoResponse {
168
+ codeId: number;
169
+ guardians: Addr[];
170
+ isFrozen: boolean;
171
+ label: string;
172
+ multisigAddress?: Addr;
173
+ multisigCodeId: number;
174
+ nonce: number;
175
+ relayers: Addr[];
176
+ userAddr: Addr;
177
+ version: ContractVersion;
178
+ }"
179
+ `;
180
+
181
+ exports[`query classes 1`] = `
182
+ "export class SG721QueryClient implements SG721ReadOnlyInstance {
183
+ client: CosmWasmClient;
184
+ contractAddress: string;
185
+
186
+ constructor(client: CosmWasmClient, contractAddress: string) {
187
+ this.client = client;
188
+ this.contractAddress = contractAddress;
189
+ this.bank = this.bank.bind(this);
190
+ this.custom = this.custom.bind(this);
191
+ this.staking = this.staking.bind(this);
192
+ this.distribution = this.distribution.bind(this);
193
+ this.wasm = this.wasm.bind(this);
194
+ }
195
+
196
+ bank = async (): Promise<BankResponse> => {
197
+ return this.client.queryContractSmart(this.contractAddress, {
198
+ bank: {}
199
+ });
200
+ };
201
+ custom = async (): Promise<CustomResponse> => {
202
+ return this.client.queryContractSmart(this.contractAddress, {
203
+ custom: {}
204
+ });
205
+ };
206
+ staking = async (): Promise<StakingResponse> => {
207
+ return this.client.queryContractSmart(this.contractAddress, {
208
+ staking: {}
209
+ });
210
+ };
211
+ distribution = async (): Promise<DistributionResponse> => {
212
+ return this.client.queryContractSmart(this.contractAddress, {
213
+ distribution: {}
214
+ });
215
+ };
216
+ wasm = async (): Promise<WasmResponse> => {
217
+ return this.client.queryContractSmart(this.contractAddress, {
218
+ wasm: {}
219
+ });
220
+ };
221
+ }"
222
+ `;
223
+
224
+ exports[`query classes 2`] = `
225
+ "export class SG721QueryClient implements SG721ReadOnlyInstance {
226
+ client: CosmWasmClient;
227
+ contractAddress: string;
228
+
229
+ constructor(client: CosmWasmClient, contractAddress: string) {
230
+ this.client = client;
231
+ this.contractAddress = contractAddress;
232
+ this.execute = this.execute.bind(this);
233
+ this.revertFreezeStatus = this.revertFreezeStatus.bind(this);
234
+ this.relay = this.relay.bind(this);
235
+ this.rotateUserKey = this.rotateUserKey.bind(this);
236
+ this.addRelayer = this.addRelayer.bind(this);
237
+ this.removeRelayer = this.removeRelayer.bind(this);
238
+ this.updateGuardians = this.updateGuardians.bind(this);
239
+ this.updateLabel = this.updateLabel.bind(this);
240
+ }
241
+
242
+ execute = async ({
243
+ msgs
244
+ }: {
245
+ msgs: CosmosMsg_for_Empty[];
246
+ }): Promise<ExecuteResponse> => {
247
+ return this.client.queryContractSmart(this.contractAddress, {
248
+ execute: {
249
+ msgs
250
+ }
251
+ });
252
+ };
253
+ revertFreezeStatus = async (): Promise<RevertFreezeStatusResponse> => {
254
+ return this.client.queryContractSmart(this.contractAddress, {
255
+ revert_freeze_status: {}
256
+ });
257
+ };
258
+ relay = async ({
259
+ transaction
260
+ }: {
261
+ transaction: RelayTransaction;
262
+ }): Promise<RelayResponse> => {
263
+ return this.client.queryContractSmart(this.contractAddress, {
264
+ relay: {
265
+ transaction
266
+ }
267
+ });
268
+ };
269
+ rotateUserKey = async ({
270
+ newUserAddress
271
+ }: {
272
+ newUserAddress: string;
273
+ }): Promise<RotateUserKeyResponse> => {
274
+ return this.client.queryContractSmart(this.contractAddress, {
275
+ rotate_user_key: {
276
+ new_user_address: newUserAddress
277
+ }
278
+ });
279
+ };
280
+ addRelayer = async ({
281
+ newRelayerAddress
282
+ }: {
283
+ newRelayerAddress: Addr;
284
+ }): Promise<AddRelayerResponse> => {
285
+ return this.client.queryContractSmart(this.contractAddress, {
286
+ add_relayer: {
287
+ new_relayer_address: newRelayerAddress
288
+ }
289
+ });
290
+ };
291
+ removeRelayer = async ({
292
+ relayerAddress
293
+ }: {
294
+ relayerAddress: Addr;
295
+ }): Promise<RemoveRelayerResponse> => {
296
+ return this.client.queryContractSmart(this.contractAddress, {
297
+ remove_relayer: {
298
+ relayer_address: relayerAddress
299
+ }
300
+ });
301
+ };
302
+ updateGuardians = async ({
303
+ guardians,
304
+ newMultisigCodeId
305
+ }: {
306
+ guardians: Guardians;
307
+ newMultisigCodeId?: number;
308
+ }): Promise<UpdateGuardiansResponse> => {
309
+ return this.client.queryContractSmart(this.contractAddress, {
310
+ update_guardians: {
311
+ guardians,
312
+ new_multisig_code_id: newMultisigCodeId
313
+ }
314
+ });
315
+ };
316
+ updateLabel = async ({
317
+ newLabel
318
+ }: {
319
+ newLabel: string;
320
+ }): Promise<UpdateLabelResponse> => {
321
+ return this.client.queryContractSmart(this.contractAddress, {
322
+ update_label: {
323
+ new_label: newLabel
324
+ }
325
+ });
326
+ };
327
+ }"
328
+ `;
329
+
330
+ exports[`relay_transaction 1`] = `
331
+ "export interface RelayTransaction {
332
+ message: Binary;
333
+ nonce: number;
334
+ signature: Binary;
335
+ userPubkey: Binary;
336
+ }"
337
+ `;
@@ -0,0 +1,55 @@
1
+ import contract from '../../../../../__fixtures__/idl-version/accounts-nft/account-nft.json';
2
+
3
+ import {
4
+ createQueryClass,
5
+ createExecuteClass,
6
+ createExecuteInterface,
7
+ createTypeInterface
8
+ } from '../client'
9
+ import { expectCode, printCode, makeContext } from '../../../test-utils';
10
+
11
+ const message = contract.query
12
+ const ctx = makeContext(message);
13
+
14
+ it('execute_msg_for__empty', () => {
15
+ expectCode(createTypeInterface(
16
+ ctx,
17
+ message
18
+ ))
19
+ })
20
+
21
+
22
+ it('query classes', () => {
23
+ expectCode(createQueryClass(
24
+ ctx,
25
+ 'SG721QueryClient',
26
+ 'SG721ReadOnlyInstance',
27
+ message
28
+ ))
29
+ });
30
+
31
+ // it('query classes response', () => {
32
+ // expectCode(createTypeInterface(
33
+ // ctx,
34
+ // contract.responses.all_debt_shares
35
+ // ))
36
+ // });
37
+
38
+ it('execute classes array types', () => {
39
+ expectCode(createExecuteClass(
40
+ ctx,
41
+ 'SG721Client',
42
+ 'SG721Instance',
43
+ null,
44
+ message
45
+ ))
46
+ });
47
+
48
+ it('execute interfaces no extends', () => {
49
+ expectCode(createExecuteInterface(
50
+ ctx,
51
+ 'SG721Instance',
52
+ null,
53
+ message
54
+ ))
55
+ });
@@ -0,0 +1,48 @@
1
+ import message from '../../../../../__fixtures__/misc/schema/arrays-ref.json';
2
+
3
+ import {
4
+ createQueryClass,
5
+ createExecuteClass,
6
+ createExecuteInterface,
7
+ createTypeInterface
8
+ } from '../client'
9
+ import { RenderContext } from '../../context';
10
+ import { expectCode, makeContext } from '../../../test-utils';
11
+
12
+ const ctx = makeContext(message);
13
+
14
+ it('execute_msg_for__empty', () => {
15
+ expectCode(createTypeInterface(
16
+ ctx,
17
+ message
18
+ ))
19
+ })
20
+
21
+
22
+ it('query classes', () => {
23
+ expectCode(createQueryClass(
24
+ ctx,
25
+ 'SG721QueryClient',
26
+ 'SG721ReadOnlyInstance',
27
+ message
28
+ ))
29
+ });
30
+
31
+ it('execute classes array types', () => {
32
+ expectCode(createExecuteClass(
33
+ ctx,
34
+ 'SG721Client',
35
+ 'SG721Instance',
36
+ null,
37
+ message
38
+ ))
39
+ });
40
+
41
+ it('execute interfaces no extends', () => {
42
+ expectCode(createExecuteInterface(
43
+ ctx,
44
+ 'SG721Instance',
45
+ null,
46
+ message
47
+ ))
48
+ });
@@ -0,0 +1,58 @@
1
+ import message from '../../../../../__fixtures__/misc/schema/arrays.json';
2
+
3
+ import {
4
+ createQueryClass,
5
+ createExecuteClass,
6
+ createExecuteInterface,
7
+ createTypeInterface
8
+ } from '../client'
9
+ import { expectCode, printCode, makeContext } from '../../../test-utils';
10
+ import { getPropertyType } from '../../utils';
11
+
12
+ const ctx = makeContext(message);
13
+
14
+ it('getPropertyType', () => {
15
+ const ast = getPropertyType(
16
+ ctx,
17
+ message.oneOf[0].properties.update_edges,
18
+ 'edges3'
19
+ );
20
+ expectCode(ast.type)
21
+ // printCode(ast.type)
22
+ })
23
+
24
+ it('execute_msg_for__empty', () => {
25
+ expectCode(createTypeInterface(
26
+ ctx,
27
+ message
28
+ ))
29
+ })
30
+
31
+
32
+ it('query classes', () => {
33
+ expectCode(createQueryClass(
34
+ ctx,
35
+ 'SG721QueryClient',
36
+ 'SG721ReadOnlyInstance',
37
+ message
38
+ ))
39
+ });
40
+
41
+ it('execute classes array types', () => {
42
+ expectCode(createExecuteClass(
43
+ ctx,
44
+ 'SG721Client',
45
+ 'SG721Instance',
46
+ null,
47
+ message
48
+ ))
49
+ });
50
+
51
+ it('execute interfaces no extends', () => {
52
+ expectCode(createExecuteInterface(
53
+ ctx,
54
+ 'SG721Instance',
55
+ null,
56
+ message
57
+ ))
58
+ });
@@ -0,0 +1,48 @@
1
+ import execute_msg from '../../../../../__fixtures__/daodao/cw-named-groups/execute_msg.json';
2
+
3
+ import {
4
+ createQueryClass,
5
+ createExecuteClass,
6
+ createExecuteInterface,
7
+ createTypeInterface
8
+ } from '../client'
9
+ import { RenderContext } from '../../context';
10
+ import { expectCode, makeContext } from '../../../test-utils';
11
+
12
+ const ctx = makeContext(execute_msg);
13
+
14
+ it('execute_msg', () => {
15
+ expectCode(createTypeInterface(
16
+ ctx,
17
+ execute_msg
18
+ ))
19
+ })
20
+
21
+
22
+ it('query classes', () => {
23
+ expectCode(createQueryClass(
24
+ ctx,
25
+ 'SG721QueryClient',
26
+ 'SG721ReadOnlyInstance',
27
+ execute_msg
28
+ ))
29
+ });
30
+
31
+ it('execute classes array types', () => {
32
+ expectCode(createExecuteClass(
33
+ ctx,
34
+ 'SG721Client',
35
+ 'SG721Instance',
36
+ null,
37
+ execute_msg
38
+ ))
39
+ });
40
+
41
+ it('execute interfaces no extends', () => {
42
+ expectCode(createExecuteInterface(
43
+ ctx,
44
+ 'SG721Instance',
45
+ null,
46
+ execute_msg
47
+ ))
48
+ });
@@ -0,0 +1,50 @@
1
+ import execute_msg from '../../../../../__fixtures__/daodao/cw-proposal-single/execute_msg.json';
2
+ import query_msg from '../../../../../__fixtures__/daodao/cw-proposal-single/query_msg.json';
3
+
4
+ import {
5
+ createQueryClass,
6
+ createExecuteClass,
7
+ createExecuteInterface,
8
+ createTypeInterface
9
+ } from '../client'
10
+ import { expectCode, makeContext } from '../../../test-utils';
11
+
12
+ it('execute_msg_for', () => {
13
+ const ctx = makeContext(execute_msg);
14
+ expectCode(createTypeInterface(
15
+ ctx,
16
+ execute_msg
17
+ ))
18
+ })
19
+
20
+
21
+ it('query classes', () => {
22
+ const ctx = makeContext(query_msg);
23
+ expectCode(createQueryClass(
24
+ ctx,
25
+ 'SG721QueryClient',
26
+ 'SG721ReadOnlyInstance',
27
+ query_msg
28
+ ))
29
+ });
30
+
31
+ it('execute classes array types', () => {
32
+ const ctx = makeContext(execute_msg);
33
+ expectCode(createExecuteClass(
34
+ ctx,
35
+ 'SG721Client',
36
+ 'SG721Instance',
37
+ null,
38
+ execute_msg
39
+ ))
40
+ });
41
+
42
+ it('execute interfaces no extends', () => {
43
+ const ctx = makeContext(execute_msg);
44
+ expectCode(createExecuteInterface(
45
+ ctx,
46
+ 'SG721Instance',
47
+ null,
48
+ execute_msg
49
+ ))
50
+ });
@@ -0,0 +1,28 @@
1
+ import query_msg from '../../../../../__fixtures__/daodao/cw-admin-factory/query_msg.json';
2
+
3
+ import {
4
+ createQueryClass,
5
+ createQueryInterface
6
+ } from '../client'
7
+ import { expectCode, makeContext } from '../../../test-utils';
8
+
9
+ const ctx = makeContext(query_msg);
10
+
11
+ it('query classes', () => {
12
+ expectCode(createQueryClass(
13
+ ctx,
14
+ 'SG721QueryClient',
15
+ 'SG721ReadOnlyInstance',
16
+ query_msg
17
+ ))
18
+ });
19
+
20
+ it('query interface', () => {
21
+ expectCode(
22
+ createQueryInterface(
23
+ ctx,
24
+ 'ReadOnlyInstance',
25
+ query_msg
26
+ )
27
+ )
28
+ });
@@ -0,0 +1,51 @@
1
+ import { globContracts, makeContext } from '../../../test-utils'
2
+ import {
3
+ createQueryClass,
4
+ createExecuteClass,
5
+ createExecuteInterface,
6
+ createTypeInterface
7
+ } from '../client'
8
+ import { expectCode } from '../../../test-utils';
9
+ import cases from 'jest-in-case';
10
+
11
+ const contracts = globContracts('issues/71');
12
+
13
+ cases('execute_msg_for__empty', async opts => {
14
+ const ctx = makeContext(opts.content);
15
+ expectCode(createTypeInterface(
16
+ ctx,
17
+ opts.content
18
+ ));
19
+ }, contracts);
20
+
21
+ cases('query classes', async opts => {
22
+ const ctx = makeContext(opts.content);
23
+ expectCode(createQueryClass(
24
+ ctx,
25
+ 'SG721QueryClient',
26
+ 'SG721ReadOnlyInstance',
27
+ opts.content
28
+ ))
29
+ }, contracts);
30
+
31
+ cases('execute class', async opts => {
32
+ const ctx = makeContext(opts.content);
33
+ expectCode(createExecuteClass(
34
+ ctx,
35
+ 'SG721Client',
36
+ 'SG721Instance',
37
+ null,
38
+ opts.content
39
+ ))
40
+ }, contracts);
41
+
42
+ cases('execute interface', async opts => {
43
+ const ctx = makeContext(opts.content);
44
+ expectCode(createExecuteInterface(
45
+ ctx,
46
+ 'SG721Instance',
47
+ null,
48
+ opts.content
49
+ ))
50
+ }, contracts);
51
+