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,432 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`execute class /issues/71/execute_msg.json 1`] = `
4
+ "export class SG721Client implements SG721Instance {
5
+ client: SigningCosmWasmClient;
6
+ sender: string;
7
+ contractAddress: string;
8
+
9
+ constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
10
+ this.client = client;
11
+ this.sender = sender;
12
+ this.contractAddress = contractAddress;
13
+ this.receive = this.receive.bind(this);
14
+ this.updateConfig = this.updateConfig.bind(this);
15
+ this.updatePoolConfig = this.updatePoolConfig.bind(this);
16
+ this.addToRegistery = this.addToRegistery.bind(this);
17
+ this.createPoolInstance = this.createPoolInstance.bind(this);
18
+ this.joinPool = this.joinPool.bind(this);
19
+ this.swap = this.swap.bind(this);
20
+ this.proposeNewOwner = this.proposeNewOwner.bind(this);
21
+ this.dropOwnershipProposal = this.dropOwnershipProposal.bind(this);
22
+ this.claimOwnership = this.claimOwnership.bind(this);
23
+ }
24
+
25
+ receive = async ({
26
+ amount,
27
+ msg,
28
+ sender
29
+ }: {
30
+ amount: Uint128;
31
+ msg: Binary;
32
+ sender: string;
33
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
34
+ return await this.client.execute(this.sender, this.contractAddress, {
35
+ receive: {
36
+ amount,
37
+ msg,
38
+ sender
39
+ }
40
+ }, fee, memo, funds);
41
+ };
42
+ updateConfig = async ({
43
+ feeCollector,
44
+ generatorAddress,
45
+ lpTokenCodeId
46
+ }: {
47
+ feeCollector?: string;
48
+ generatorAddress?: string;
49
+ lpTokenCodeId?: number;
50
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
51
+ return await this.client.execute(this.sender, this.contractAddress, {
52
+ update_config: {
53
+ fee_collector: feeCollector,
54
+ generator_address: generatorAddress,
55
+ lp_token_code_id: lpTokenCodeId
56
+ }
57
+ }, fee, memo, funds);
58
+ };
59
+ updatePoolConfig = async ({
60
+ isDisabled,
61
+ newFeeInfo,
62
+ poolType
63
+ }: {
64
+ isDisabled?: boolean;
65
+ newFeeInfo?: FeeInfo;
66
+ poolType: PoolType;
67
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
68
+ return await this.client.execute(this.sender, this.contractAddress, {
69
+ update_pool_config: {
70
+ is_disabled: isDisabled,
71
+ new_fee_info: newFeeInfo,
72
+ pool_type: poolType
73
+ }
74
+ }, fee, memo, funds);
75
+ };
76
+ addToRegistery = async ({
77
+ newPoolConfig
78
+ }: {
79
+ newPoolConfig: PoolConfig;
80
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
81
+ return await this.client.execute(this.sender, this.contractAddress, {
82
+ add_to_registery: {
83
+ new_pool_config: newPoolConfig
84
+ }
85
+ }, fee, memo, funds);
86
+ };
87
+ createPoolInstance = async ({
88
+ assetInfos,
89
+ initParams,
90
+ lpTokenName,
91
+ lpTokenSymbol,
92
+ poolType
93
+ }: {
94
+ assetInfos: AssetInfo[];
95
+ initParams?: Binary;
96
+ lpTokenName?: string;
97
+ lpTokenSymbol?: string;
98
+ poolType: PoolType;
99
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
100
+ return await this.client.execute(this.sender, this.contractAddress, {
101
+ create_pool_instance: {
102
+ asset_infos: assetInfos,
103
+ init_params: initParams,
104
+ lp_token_name: lpTokenName,
105
+ lp_token_symbol: lpTokenSymbol,
106
+ pool_type: poolType
107
+ }
108
+ }, fee, memo, funds);
109
+ };
110
+ joinPool = async ({
111
+ assets,
112
+ autoStake,
113
+ lpToMint,
114
+ poolId,
115
+ recipient,
116
+ slippageTolerance
117
+ }: {
118
+ assets?: Asset[];
119
+ autoStake?: boolean;
120
+ lpToMint?: Uint128;
121
+ poolId: Uint128;
122
+ recipient?: string;
123
+ slippageTolerance?: Decimal;
124
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
125
+ return await this.client.execute(this.sender, this.contractAddress, {
126
+ join_pool: {
127
+ assets,
128
+ auto_stake: autoStake,
129
+ lp_to_mint: lpToMint,
130
+ pool_id: poolId,
131
+ recipient,
132
+ slippage_tolerance: slippageTolerance
133
+ }
134
+ }, fee, memo, funds);
135
+ };
136
+ swap = async ({
137
+ recipient,
138
+ swapRequest
139
+ }: {
140
+ recipient?: string;
141
+ swapRequest: SingleSwapRequest;
142
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
143
+ return await this.client.execute(this.sender, this.contractAddress, {
144
+ swap: {
145
+ recipient,
146
+ swap_request: swapRequest
147
+ }
148
+ }, fee, memo, funds);
149
+ };
150
+ proposeNewOwner = async ({
151
+ expiresIn,
152
+ owner
153
+ }: {
154
+ expiresIn: number;
155
+ owner: string;
156
+ }, fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
157
+ return await this.client.execute(this.sender, this.contractAddress, {
158
+ propose_new_owner: {
159
+ expires_in: expiresIn,
160
+ owner
161
+ }
162
+ }, fee, memo, funds);
163
+ };
164
+ dropOwnershipProposal = async (fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
165
+ return await this.client.execute(this.sender, this.contractAddress, {
166
+ drop_ownership_proposal: {}
167
+ }, fee, memo, funds);
168
+ };
169
+ claimOwnership = async (fee: number | StdFee | \\"auto\\" = \\"auto\\", memo?: string, funds?: Coin[]): Promise<ExecuteResult> => {
170
+ return await this.client.execute(this.sender, this.contractAddress, {
171
+ claim_ownership: {}
172
+ }, fee, memo, funds);
173
+ };
174
+ }"
175
+ `;
176
+
177
+ exports[`execute interface /issues/71/execute_msg.json 1`] = `
178
+ "export interface SG721Instance {
179
+ contractAddress: string;
180
+ sender: string;
181
+ receive: ({
182
+ amount,
183
+ msg,
184
+ sender
185
+ }: {
186
+ amount: Uint128;
187
+ msg: Binary;
188
+ sender: string;
189
+ }, fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
190
+ updateConfig: ({
191
+ feeCollector,
192
+ generatorAddress,
193
+ lpTokenCodeId
194
+ }: {
195
+ feeCollector?: string;
196
+ generatorAddress?: string;
197
+ lpTokenCodeId?: number;
198
+ }, fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
199
+ updatePoolConfig: ({
200
+ isDisabled,
201
+ newFeeInfo,
202
+ poolType
203
+ }: {
204
+ isDisabled?: boolean;
205
+ newFeeInfo?: FeeInfo;
206
+ poolType: PoolType;
207
+ }, fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
208
+ addToRegistery: ({
209
+ newPoolConfig
210
+ }: {
211
+ newPoolConfig: PoolConfig;
212
+ }, fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
213
+ createPoolInstance: ({
214
+ assetInfos,
215
+ initParams,
216
+ lpTokenName,
217
+ lpTokenSymbol,
218
+ poolType
219
+ }: {
220
+ assetInfos: AssetInfo[];
221
+ initParams?: Binary;
222
+ lpTokenName?: string;
223
+ lpTokenSymbol?: string;
224
+ poolType: PoolType;
225
+ }, fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
226
+ joinPool: ({
227
+ assets,
228
+ autoStake,
229
+ lpToMint,
230
+ poolId,
231
+ recipient,
232
+ slippageTolerance
233
+ }: {
234
+ assets?: Asset[];
235
+ autoStake?: boolean;
236
+ lpToMint?: Uint128;
237
+ poolId: Uint128;
238
+ recipient?: string;
239
+ slippageTolerance?: Decimal;
240
+ }, fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
241
+ swap: ({
242
+ recipient,
243
+ swapRequest
244
+ }: {
245
+ recipient?: string;
246
+ swapRequest: SingleSwapRequest;
247
+ }, fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
248
+ proposeNewOwner: ({
249
+ expiresIn,
250
+ owner
251
+ }: {
252
+ expiresIn: number;
253
+ owner: string;
254
+ }, fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
255
+ dropOwnershipProposal: (fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
256
+ claimOwnership: (fee?: number | StdFee | \\"auto\\", memo?: string, funds?: Coin[]) => Promise<ExecuteResult>;
257
+ }"
258
+ `;
259
+
260
+ exports[`execute_msg_for__empty /issues/71/execute_msg.json 1`] = `"export type ExecuteMsg = ExecuteMsg;"`;
261
+
262
+ exports[`query classes /issues/71/execute_msg.json 1`] = `
263
+ "export class SG721QueryClient implements SG721ReadOnlyInstance {
264
+ client: CosmWasmClient;
265
+ contractAddress: string;
266
+
267
+ constructor(client: CosmWasmClient, contractAddress: string) {
268
+ this.client = client;
269
+ this.contractAddress = contractAddress;
270
+ this.receive = this.receive.bind(this);
271
+ this.updateConfig = this.updateConfig.bind(this);
272
+ this.updatePoolConfig = this.updatePoolConfig.bind(this);
273
+ this.addToRegistery = this.addToRegistery.bind(this);
274
+ this.createPoolInstance = this.createPoolInstance.bind(this);
275
+ this.joinPool = this.joinPool.bind(this);
276
+ this.swap = this.swap.bind(this);
277
+ this.proposeNewOwner = this.proposeNewOwner.bind(this);
278
+ this.dropOwnershipProposal = this.dropOwnershipProposal.bind(this);
279
+ this.claimOwnership = this.claimOwnership.bind(this);
280
+ }
281
+
282
+ receive = async ({
283
+ amount,
284
+ msg,
285
+ sender
286
+ }: {
287
+ amount: Uint128;
288
+ msg: Binary;
289
+ sender: string;
290
+ }): Promise<ReceiveResponse> => {
291
+ return this.client.queryContractSmart(this.contractAddress, {
292
+ receive: {
293
+ amount,
294
+ msg,
295
+ sender
296
+ }
297
+ });
298
+ };
299
+ updateConfig = async ({
300
+ feeCollector,
301
+ generatorAddress,
302
+ lpTokenCodeId
303
+ }: {
304
+ feeCollector?: string;
305
+ generatorAddress?: string;
306
+ lpTokenCodeId?: number;
307
+ }): Promise<UpdateConfigResponse> => {
308
+ return this.client.queryContractSmart(this.contractAddress, {
309
+ update_config: {
310
+ fee_collector: feeCollector,
311
+ generator_address: generatorAddress,
312
+ lp_token_code_id: lpTokenCodeId
313
+ }
314
+ });
315
+ };
316
+ updatePoolConfig = async ({
317
+ isDisabled,
318
+ newFeeInfo,
319
+ poolType
320
+ }: {
321
+ isDisabled?: boolean;
322
+ newFeeInfo?: FeeInfo;
323
+ poolType: PoolType;
324
+ }): Promise<UpdatePoolConfigResponse> => {
325
+ return this.client.queryContractSmart(this.contractAddress, {
326
+ update_pool_config: {
327
+ is_disabled: isDisabled,
328
+ new_fee_info: newFeeInfo,
329
+ pool_type: poolType
330
+ }
331
+ });
332
+ };
333
+ addToRegistery = async ({
334
+ newPoolConfig
335
+ }: {
336
+ newPoolConfig: PoolConfig;
337
+ }): Promise<AddToRegisteryResponse> => {
338
+ return this.client.queryContractSmart(this.contractAddress, {
339
+ add_to_registery: {
340
+ new_pool_config: newPoolConfig
341
+ }
342
+ });
343
+ };
344
+ createPoolInstance = async ({
345
+ assetInfos,
346
+ initParams,
347
+ lpTokenName,
348
+ lpTokenSymbol,
349
+ poolType
350
+ }: {
351
+ assetInfos: AssetInfo[];
352
+ initParams?: Binary;
353
+ lpTokenName?: string;
354
+ lpTokenSymbol?: string;
355
+ poolType: PoolType;
356
+ }): Promise<CreatePoolInstanceResponse> => {
357
+ return this.client.queryContractSmart(this.contractAddress, {
358
+ create_pool_instance: {
359
+ asset_infos: assetInfos,
360
+ init_params: initParams,
361
+ lp_token_name: lpTokenName,
362
+ lp_token_symbol: lpTokenSymbol,
363
+ pool_type: poolType
364
+ }
365
+ });
366
+ };
367
+ joinPool = async ({
368
+ assets,
369
+ autoStake,
370
+ lpToMint,
371
+ poolId,
372
+ recipient,
373
+ slippageTolerance
374
+ }: {
375
+ assets?: Asset[];
376
+ autoStake?: boolean;
377
+ lpToMint?: Uint128;
378
+ poolId: Uint128;
379
+ recipient?: string;
380
+ slippageTolerance?: Decimal;
381
+ }): Promise<JoinPoolResponse> => {
382
+ return this.client.queryContractSmart(this.contractAddress, {
383
+ join_pool: {
384
+ assets,
385
+ auto_stake: autoStake,
386
+ lp_to_mint: lpToMint,
387
+ pool_id: poolId,
388
+ recipient,
389
+ slippage_tolerance: slippageTolerance
390
+ }
391
+ });
392
+ };
393
+ swap = async ({
394
+ recipient,
395
+ swapRequest
396
+ }: {
397
+ recipient?: string;
398
+ swapRequest: SingleSwapRequest;
399
+ }): Promise<SwapResponse> => {
400
+ return this.client.queryContractSmart(this.contractAddress, {
401
+ swap: {
402
+ recipient,
403
+ swap_request: swapRequest
404
+ }
405
+ });
406
+ };
407
+ proposeNewOwner = async ({
408
+ expiresIn,
409
+ owner
410
+ }: {
411
+ expiresIn: number;
412
+ owner: string;
413
+ }): Promise<ProposeNewOwnerResponse> => {
414
+ return this.client.queryContractSmart(this.contractAddress, {
415
+ propose_new_owner: {
416
+ expires_in: expiresIn,
417
+ owner
418
+ }
419
+ });
420
+ };
421
+ dropOwnershipProposal = async (): Promise<DropOwnershipProposalResponse> => {
422
+ return this.client.queryContractSmart(this.contractAddress, {
423
+ drop_ownership_proposal: {}
424
+ });
425
+ };
426
+ claimOwnership = async (): Promise<ClaimOwnershipResponse> => {
427
+ return this.client.queryContractSmart(this.contractAddress, {
428
+ claim_ownership: {}
429
+ });
430
+ };
431
+ }"
432
+ `;