wasm-ast-types 0.18.2 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/main/client/client.js +16 -7
  2. package/main/client/test/ts-client.issue-101.spec.js +27 -0
  3. package/main/client/test/ts-client.issue-98.test.js +30 -0
  4. package/main/context/context.js +59 -13
  5. package/main/context/imports.js +37 -15
  6. package/main/index.js +13 -0
  7. package/main/message-composer/message-composer.js +13 -4
  8. package/main/message-composer/message-composer.spec.js +14 -4
  9. package/main/msg-builder/index.js +18 -0
  10. package/main/msg-builder/msg-builder.js +68 -0
  11. package/main/msg-builder/msg-builder.spec.js +26 -0
  12. package/main/react-query/react-query.spec.js +11 -0
  13. package/main/utils/babel.js +56 -5
  14. package/main/utils/index.js +13 -0
  15. package/main/utils/ref.js +15 -0
  16. package/main/utils/types.js +10 -2
  17. package/module/client/client.js +18 -9
  18. package/module/client/test/ts-client.issue-101.spec.js +20 -0
  19. package/module/client/test/ts-client.issue-98.test.js +23 -0
  20. package/module/context/context.js +29 -6
  21. package/module/context/imports.js +33 -14
  22. package/module/index.js +2 -1
  23. package/module/message-composer/message-composer.js +13 -4
  24. package/module/message-composer/message-composer.spec.js +16 -7
  25. package/module/msg-builder/index.js +1 -0
  26. package/module/msg-builder/msg-builder.js +47 -0
  27. package/module/msg-builder/msg-builder.spec.js +17 -0
  28. package/module/react-query/react-query.spec.js +10 -0
  29. package/module/utils/babel.js +31 -5
  30. package/module/utils/index.js +2 -1
  31. package/module/utils/ref.js +4 -0
  32. package/module/utils/types.js +10 -3
  33. package/package.json +2 -2
  34. package/src/client/client.ts +29 -24
  35. package/src/client/test/__snapshots__/ts-client.issue-101.spec.ts.snap +47 -0
  36. package/src/client/test/__snapshots__/ts-client.issue-98.test.ts.snap +117 -0
  37. package/src/client/test/__snapshots__/ts-client.vectis.spec.ts.snap +8 -8
  38. package/src/client/test/ts-client.issue-101.spec.ts +37 -0
  39. package/src/client/test/ts-client.issue-98.test.ts +55 -0
  40. package/src/context/context.ts +45 -10
  41. package/src/context/imports.ts +49 -15
  42. package/src/index.ts +2 -1
  43. package/src/message-composer/__snapshots__/message-composer.spec.ts.snap +60 -0
  44. package/src/message-composer/message-composer.spec.ts +41 -20
  45. package/src/message-composer/message-composer.ts +13 -5
  46. package/src/msg-builder/__snapshots__/msg-builder.spec.ts.snap +270 -0
  47. package/src/msg-builder/index.ts +1 -0
  48. package/src/msg-builder/msg-builder.spec.ts +25 -0
  49. package/src/msg-builder/msg-builder.ts +119 -0
  50. package/src/react-query/__snapshots__/react-query.spec.ts.snap +45 -0
  51. package/src/react-query/react-query.spec.ts +17 -1
  52. package/src/react-query/react-query.ts +1 -1
  53. package/src/utils/babel.ts +34 -5
  54. package/src/utils/index.ts +1 -0
  55. package/src/utils/ref.ts +6 -0
  56. package/src/utils/types.ts +11 -4
  57. package/types/context/context.d.ts +30 -5
  58. package/types/context/imports.d.ts +7 -2
  59. package/types/index.d.ts +1 -0
  60. package/types/msg-builder/index.d.ts +1 -0
  61. package/types/msg-builder/msg-builder.d.ts +4 -0
  62. package/types/react-query/react-query.d.ts +11 -10
  63. package/types/recoil/recoil.d.ts +1 -1
  64. package/types/utils/babel.d.ts +3 -2
  65. package/types/utils/index.d.ts +1 -0
  66. package/types/utils/ref.d.ts +2 -0
@@ -269,3 +269,63 @@ exports[`execute classes 1`] = `
269
269
  };
270
270
  }"
271
271
  `;
272
+
273
+ exports[`ownershipClass 1`] = `
274
+ "export class OwnershipMessageComposer implements OwnershipMessage {
275
+ sender: string;
276
+ contractAddress: string;
277
+
278
+ constructor(sender: string, contractAddress: string) {
279
+ this.sender = sender;
280
+ this.contractAddress = contractAddress;
281
+ this.setFactory = this.setFactory.bind(this);
282
+ this.updateOwnership = this.updateOwnership.bind(this);
283
+ }
284
+
285
+ setFactory = ({
286
+ newFactory
287
+ }: {
288
+ newFactory: string;
289
+ }, funds?: Coin[]): MsgExecuteContractEncodeObject => {
290
+ return {
291
+ typeUrl: \\"/cosmwasm.wasm.v1.MsgExecuteContract\\",
292
+ value: MsgExecuteContract.fromPartial({
293
+ sender: this.sender,
294
+ contract: this.contractAddress,
295
+ msg: toUtf8(JSON.stringify({
296
+ set_factory: {
297
+ new_factory: newFactory
298
+ }
299
+ })),
300
+ funds
301
+ })
302
+ };
303
+ };
304
+ updateOwnership = (action: Action, funds?: Coin[]): MsgExecuteContractEncodeObject => {
305
+ return {
306
+ typeUrl: \\"/cosmwasm.wasm.v1.MsgExecuteContract\\",
307
+ value: MsgExecuteContract.fromPartial({
308
+ sender: this.sender,
309
+ contract: this.contractAddress,
310
+ msg: toUtf8(JSON.stringify({
311
+ update_ownership: action
312
+ })),
313
+ funds
314
+ })
315
+ };
316
+ };
317
+ }"
318
+ `;
319
+
320
+ exports[`ownershipInterface 1`] = `
321
+ "export interface OwnershipMessage {
322
+ contractAddress: string;
323
+ sender: string;
324
+ setFactory: ({
325
+ newFactory
326
+ }: {
327
+ newFactory: string;
328
+ }, funds?: Coin[]) => MsgExecuteContractEncodeObject;
329
+ updateOwnership: (action: Action, funds?: Coin[]) => MsgExecuteContractEncodeObject;
330
+ }"
331
+ `;
@@ -1,25 +1,46 @@
1
- import execute_msg from '../../../../__fixtures__/basic/execute_msg_for__empty.json';
1
+ import execute_msg from "../../../../__fixtures__/basic/execute_msg_for__empty.json";
2
+ import ownership from "../../../../__fixtures__/basic/ownership.json";
3
+
2
4
  import {
3
- createMessageComposerClass,
4
- createMessageComposerInterface
5
- } from './message-composer'
6
- import { expectCode, makeContext } from '../../test-utils';
5
+ createMessageComposerClass,
6
+ createMessageComposerInterface,
7
+ } from "./message-composer";
8
+ import { expectCode, makeContext } from "../../test-utils";
9
+ import * as t from "@babel/types";
10
+ import { createReactQueryMutationHooks } from "../react-query";
11
+
12
+ it("execute classes", () => {
13
+ const ctx = makeContext(execute_msg);
14
+ expectCode(
15
+ createMessageComposerClass(
16
+ ctx,
17
+ "SG721MessageComposer",
18
+ "SG721Message",
19
+ execute_msg
20
+ )
21
+ );
22
+ });
23
+
24
+ it("createMessageComposerInterface", () => {
25
+ const ctx = makeContext(execute_msg);
26
+ expectCode(createMessageComposerInterface(ctx, "SG721Message", execute_msg));
27
+ });
7
28
 
8
- it('execute classes', () => {
9
- const ctx = makeContext(execute_msg);
10
- expectCode(createMessageComposerClass(
11
- ctx,
12
- 'SG721MessageComposer',
13
- 'SG721Message',
14
- execute_msg
15
- ))
29
+ it("ownershipClass", () => {
30
+ const ctx = makeContext(ownership);
31
+ expectCode(
32
+ createMessageComposerClass(
33
+ ctx,
34
+ "OwnershipMessageComposer",
35
+ "OwnershipMessage",
36
+ ownership
37
+ )
38
+ );
16
39
  });
17
40
 
18
- it('createMessageComposerInterface', () => {
19
- const ctx = makeContext(execute_msg);
20
- expectCode(createMessageComposerInterface(
21
- ctx,
22
- 'SG721Message',
23
- execute_msg
24
- ))
41
+ it("ownershipInterface", () => {
42
+ const ownershipCtx = makeContext(ownership);
43
+ expectCode(
44
+ createMessageComposerInterface(ownershipCtx, "OwnershipMessage", ownership)
45
+ );
25
46
  });
@@ -14,6 +14,7 @@ import { JSONSchema } from '../types';
14
14
  import { RenderContext } from '../context';
15
15
  import { identifier } from '../utils/babel';
16
16
  import { getWasmMethodArgs } from '../client/client';
17
+ import { Expression } from '@babel/types';
17
18
 
18
19
  const createWasmExecMethodMessageComposer = (
19
20
  context: RenderContext,
@@ -27,12 +28,20 @@ const createWasmExecMethodMessageComposer = (
27
28
 
28
29
  const underscoreName = Object.keys(jsonschema.properties)[0];
29
30
  const methodName = camel(underscoreName);
30
- const obj = createTypedObjectParams(context, jsonschema.properties[underscoreName]);
31
+ const param = createTypedObjectParams(context, jsonschema.properties[underscoreName]);
31
32
  const args = getWasmMethodArgs(
32
33
  context,
33
34
  jsonschema.properties[underscoreName]
34
35
  );
35
36
 
37
+ // what the underscore named property in the message is assigned to
38
+ let actionValue: Expression
39
+ if (param?.type === 'Identifier') {
40
+ actionValue = t.identifier(param.name);
41
+ } else {
42
+ actionValue = t.objectExpression(args)
43
+ }
44
+
36
45
  const constantParams = [
37
46
  identifier('funds', t.tsTypeAnnotation(
38
47
  t.tsArrayType(
@@ -46,9 +55,9 @@ const createWasmExecMethodMessageComposer = (
46
55
  return t.classProperty(
47
56
  t.identifier(methodName),
48
57
  arrowFunctionExpression(
49
- obj ? [
58
+ param ? [
50
59
  // props
51
- obj,
60
+ param,
52
61
  ...constantParams
53
62
  ] : constantParams,
54
63
  t.blockStatement(
@@ -95,10 +104,9 @@ const createWasmExecMethodMessageComposer = (
95
104
  ),
96
105
  [
97
106
  t.objectExpression(
98
-
99
107
  [
100
108
  t.objectProperty(
101
- t.identifier(underscoreName), t.objectExpression(args)
109
+ t.identifier(underscoreName), actionValue
102
110
  )
103
111
  ]
104
112
 
@@ -0,0 +1,270 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`execute class 1`] = `
4
+ "export abstract class SG721MsgBuilder {
5
+ static transferNft = ({
6
+ recipient,
7
+ tokenId
8
+ }: CamelCasedProperties<Extract<ExecuteMsg_for_Empty, {
9
+ transfer_nft: unknown;
10
+ }>[\\"transfer_nft\\"]>): ExecuteMsg_for_Empty => {
11
+ return {
12
+ transfer_nft: ({
13
+ recipient,
14
+ token_id: tokenId
15
+ } as const)
16
+ };
17
+ };
18
+ static sendNft = ({
19
+ contract,
20
+ msg,
21
+ tokenId
22
+ }: CamelCasedProperties<Extract<ExecuteMsg_for_Empty, {
23
+ send_nft: unknown;
24
+ }>[\\"send_nft\\"]>): ExecuteMsg_for_Empty => {
25
+ return {
26
+ send_nft: ({
27
+ contract,
28
+ msg,
29
+ token_id: tokenId
30
+ } as const)
31
+ };
32
+ };
33
+ static approve = ({
34
+ expires,
35
+ spender,
36
+ tokenId
37
+ }: CamelCasedProperties<Extract<ExecuteMsg_for_Empty, {
38
+ approve: unknown;
39
+ }>[\\"approve\\"]>): ExecuteMsg_for_Empty => {
40
+ return {
41
+ approve: ({
42
+ expires,
43
+ spender,
44
+ token_id: tokenId
45
+ } as const)
46
+ };
47
+ };
48
+ static revoke = ({
49
+ spender,
50
+ tokenId
51
+ }: CamelCasedProperties<Extract<ExecuteMsg_for_Empty, {
52
+ revoke: unknown;
53
+ }>[\\"revoke\\"]>): ExecuteMsg_for_Empty => {
54
+ return {
55
+ revoke: ({
56
+ spender,
57
+ token_id: tokenId
58
+ } as const)
59
+ };
60
+ };
61
+ static approveAll = ({
62
+ expires,
63
+ operator
64
+ }: CamelCasedProperties<Extract<ExecuteMsg_for_Empty, {
65
+ approve_all: unknown;
66
+ }>[\\"approve_all\\"]>): ExecuteMsg_for_Empty => {
67
+ return {
68
+ approve_all: ({
69
+ expires,
70
+ operator
71
+ } as const)
72
+ };
73
+ };
74
+ static revokeAll = ({
75
+ operator
76
+ }: CamelCasedProperties<Extract<ExecuteMsg_for_Empty, {
77
+ revoke_all: unknown;
78
+ }>[\\"revoke_all\\"]>): ExecuteMsg_for_Empty => {
79
+ return {
80
+ revoke_all: ({
81
+ operator
82
+ } as const)
83
+ };
84
+ };
85
+ static mint = ({
86
+ extension,
87
+ owner,
88
+ tokenId,
89
+ tokenUri
90
+ }: CamelCasedProperties<Extract<ExecuteMsg_for_Empty, {
91
+ mint: unknown;
92
+ }>[\\"mint\\"]>): ExecuteMsg_for_Empty => {
93
+ return {
94
+ mint: ({
95
+ extension,
96
+ owner,
97
+ token_id: tokenId,
98
+ token_uri: tokenUri
99
+ } as const)
100
+ };
101
+ };
102
+ static burn = ({
103
+ tokenId
104
+ }: CamelCasedProperties<Extract<ExecuteMsg_for_Empty, {
105
+ burn: unknown;
106
+ }>[\\"burn\\"]>): ExecuteMsg_for_Empty => {
107
+ return {
108
+ burn: ({
109
+ token_id: tokenId
110
+ } as const)
111
+ };
112
+ };
113
+ }"
114
+ `;
115
+
116
+ exports[`ownership 1`] = `
117
+ "export abstract class Ownership {
118
+ static setFactory = ({
119
+ newFactory
120
+ }: CamelCasedProperties<Extract<ExecuteMsg, {
121
+ set_factory: unknown;
122
+ }>[\\"set_factory\\"]>): ExecuteMsg => {
123
+ return {
124
+ set_factory: ({
125
+ new_factory: newFactory
126
+ } as const)
127
+ };
128
+ };
129
+ static updateOwnership = (action: Action): ExecuteMsg => {
130
+ return {
131
+ update_ownership: action
132
+ };
133
+ };
134
+ }"
135
+ `;
136
+
137
+ exports[`query class 1`] = `
138
+ "export abstract class SG721MsgBuilder {
139
+ static ownerOf = ({
140
+ includeExpired,
141
+ tokenId
142
+ }: CamelCasedProperties<Extract<QueryMsg, {
143
+ owner_of: unknown;
144
+ }>[\\"owner_of\\"]>): QueryMsg => {
145
+ return {
146
+ owner_of: ({
147
+ include_expired: includeExpired,
148
+ token_id: tokenId
149
+ } as const)
150
+ };
151
+ };
152
+ static approval = ({
153
+ includeExpired,
154
+ spender,
155
+ tokenId
156
+ }: CamelCasedProperties<Extract<QueryMsg, {
157
+ approval: unknown;
158
+ }>[\\"approval\\"]>): QueryMsg => {
159
+ return {
160
+ approval: ({
161
+ include_expired: includeExpired,
162
+ spender,
163
+ token_id: tokenId
164
+ } as const)
165
+ };
166
+ };
167
+ static approvals = ({
168
+ includeExpired,
169
+ tokenId
170
+ }: CamelCasedProperties<Extract<QueryMsg, {
171
+ approvals: unknown;
172
+ }>[\\"approvals\\"]>): QueryMsg => {
173
+ return {
174
+ approvals: ({
175
+ include_expired: includeExpired,
176
+ token_id: tokenId
177
+ } as const)
178
+ };
179
+ };
180
+ static allOperators = ({
181
+ includeExpired,
182
+ limit,
183
+ owner,
184
+ startAfter
185
+ }: CamelCasedProperties<Extract<QueryMsg, {
186
+ all_operators: unknown;
187
+ }>[\\"all_operators\\"]>): QueryMsg => {
188
+ return {
189
+ all_operators: ({
190
+ include_expired: includeExpired,
191
+ limit,
192
+ owner,
193
+ start_after: startAfter
194
+ } as const)
195
+ };
196
+ };
197
+ static numTokens = (): QueryMsg => {
198
+ return {
199
+ num_tokens: ({} as const)
200
+ };
201
+ };
202
+ static contractInfo = (): QueryMsg => {
203
+ return {
204
+ contract_info: ({} as const)
205
+ };
206
+ };
207
+ static nftInfo = ({
208
+ tokenId
209
+ }: CamelCasedProperties<Extract<QueryMsg, {
210
+ nft_info: unknown;
211
+ }>[\\"nft_info\\"]>): QueryMsg => {
212
+ return {
213
+ nft_info: ({
214
+ token_id: tokenId
215
+ } as const)
216
+ };
217
+ };
218
+ static allNftInfo = ({
219
+ includeExpired,
220
+ tokenId
221
+ }: CamelCasedProperties<Extract<QueryMsg, {
222
+ all_nft_info: unknown;
223
+ }>[\\"all_nft_info\\"]>): QueryMsg => {
224
+ return {
225
+ all_nft_info: ({
226
+ include_expired: includeExpired,
227
+ token_id: tokenId
228
+ } as const)
229
+ };
230
+ };
231
+ static tokens = ({
232
+ limit,
233
+ owner,
234
+ startAfter
235
+ }: CamelCasedProperties<Extract<QueryMsg, {
236
+ tokens: unknown;
237
+ }>[\\"tokens\\"]>): QueryMsg => {
238
+ return {
239
+ tokens: ({
240
+ limit,
241
+ owner,
242
+ start_after: startAfter
243
+ } as const)
244
+ };
245
+ };
246
+ static allTokens = ({
247
+ limit,
248
+ startAfter
249
+ }: CamelCasedProperties<Extract<QueryMsg, {
250
+ all_tokens: unknown;
251
+ }>[\\"all_tokens\\"]>): QueryMsg => {
252
+ return {
253
+ all_tokens: ({
254
+ limit,
255
+ start_after: startAfter
256
+ } as const)
257
+ };
258
+ };
259
+ static minter = (): QueryMsg => {
260
+ return {
261
+ minter: ({} as const)
262
+ };
263
+ };
264
+ static collectionInfo = (): QueryMsg => {
265
+ return {
266
+ collection_info: ({} as const)
267
+ };
268
+ };
269
+ }"
270
+ `;
@@ -0,0 +1 @@
1
+ export * from './msg-builder';
@@ -0,0 +1,25 @@
1
+ import execute_msg from '../../../../__fixtures__/basic/execute_msg_for__empty.json';
2
+ import query_msg from '../../../../__fixtures__/basic/query_msg.json';
3
+ import ownership from '../../../../__fixtures__/basic/ownership.json';
4
+
5
+ import {
6
+ createMsgBuilderClass,
7
+ } from './msg-builder'
8
+ import { expectCode, makeContext } from '../../test-utils';
9
+ import { findExecuteMsg } from '@cosmwasm/ts-codegen/src';
10
+
11
+ it('execute class', () => {
12
+ const ctx = makeContext(execute_msg);
13
+ expectCode(createMsgBuilderClass(ctx, 'SG721MsgBuilder', execute_msg))
14
+ });
15
+
16
+
17
+ it('query class', () => {
18
+ const ctx = makeContext(query_msg);
19
+ expectCode(createMsgBuilderClass(ctx, 'SG721MsgBuilder', query_msg))
20
+ });
21
+
22
+ it('ownership', () => {
23
+ const ctx = makeContext(ownership);
24
+ expectCode(createMsgBuilderClass(ctx, 'Ownership', ownership))
25
+ });
@@ -0,0 +1,119 @@
1
+ import * as t from '@babel/types';
2
+ import { camel } from 'case';
3
+ import { abstractClassDeclaration, arrowFunctionExpression, getMessageProperties } from '../utils';
4
+ import { ExecuteMsg, QueryMsg } from '../types';
5
+ import { createTypedObjectParams } from '../utils/types';
6
+ import { RenderContext } from '../context';
7
+ import { getWasmMethodArgs } from '../client/client';
8
+ import { Expression, Identifier, PatternLike, TSAsExpression } from '@babel/types';
9
+
10
+ export const createMsgBuilderClass = (
11
+ context: RenderContext,
12
+ className: string,
13
+ msg: ExecuteMsg | QueryMsg
14
+ ): t.ExportNamedDeclaration => {
15
+ const staticMethods = getMessageProperties(msg).map((schema) => {
16
+ return createStaticExecMethodMsgBuilder(context, schema, msg.title);
17
+ });
18
+
19
+ // const blockStmt = bindings;
20
+
21
+ return t.exportNamedDeclaration(
22
+ abstractClassDeclaration(className, staticMethods, [], null)
23
+ );
24
+ };
25
+
26
+ /**
27
+ * CamelCasedProperties<Extract<ExecuteMsg, { exec_on_module: unknown }>['exec_on_module']>
28
+ */
29
+ function createExtractTypeAnnotation(underscoreName: string, msgTitle: string) {
30
+ return t.tsTypeAnnotation(
31
+ t.tsTypeReference(
32
+ t.identifier('CamelCasedProperties'),
33
+ t.tsTypeParameterInstantiation([
34
+ t.tsIndexedAccessType(
35
+ t.tsTypeReference(t.identifier('Extract'),
36
+ t.tsTypeParameterInstantiation([
37
+ t.tsTypeReference(t.identifier(msgTitle)),
38
+ t.tsTypeLiteral([
39
+ t.tsPropertySignature(
40
+ t.identifier(underscoreName),
41
+ t.tsTypeAnnotation(t.tsUnknownKeyword())
42
+ )
43
+ ])
44
+ ])
45
+ ),
46
+ t.tsLiteralType(t.stringLiteral(underscoreName))
47
+ )
48
+ ])
49
+ )
50
+ );
51
+ }
52
+
53
+ const createStaticExecMethodMsgBuilder = (
54
+ context: RenderContext,
55
+ jsonschema: any,
56
+ msgTitle: string
57
+ ) => {
58
+ const underscoreName = Object.keys(jsonschema.properties)[0];
59
+ const methodName = camel(underscoreName);
60
+ const param = createTypedObjectParams(
61
+ context,
62
+ jsonschema.properties[underscoreName]
63
+ );
64
+ const args = getWasmMethodArgs(
65
+ context,
66
+ jsonschema.properties[underscoreName]
67
+ );
68
+
69
+ // what the underscore named property in the message is assigned to
70
+ let actionValue: Expression
71
+ if (param?.type === 'Identifier') {
72
+ actionValue = t.identifier(param.name);
73
+ } else {
74
+ actionValue = t.tsAsExpression(t.objectExpression(args), t.tsTypeReference(t.identifier('const')));
75
+ }
76
+
77
+
78
+ // TODO: this is a hack to get the type annotation to work
79
+ // all type annotations in the future should be the extracted and camelized type
80
+ if (
81
+ param &&
82
+ param.typeAnnotation.type === 'TSTypeAnnotation' &&
83
+ param.typeAnnotation.typeAnnotation.type === 'TSTypeLiteral'
84
+ ) {
85
+ param.typeAnnotation = createExtractTypeAnnotation(underscoreName, msgTitle);
86
+ }
87
+
88
+ return t.classProperty(
89
+ t.identifier(methodName),
90
+ arrowFunctionExpression(
91
+ // params
92
+ param
93
+ ? [
94
+ // props
95
+ param
96
+ ]
97
+ : [],
98
+ // body
99
+ t.blockStatement([
100
+ t.returnStatement(
101
+ t.objectExpression([
102
+ t.objectProperty(
103
+ t.identifier(underscoreName),
104
+ actionValue
105
+ )
106
+ ])
107
+ )
108
+ ]),
109
+ // return type
110
+ t.tsTypeAnnotation(t.tsTypeReference(t.identifier(msgTitle))),
111
+ false
112
+ ),
113
+ null,
114
+ null,
115
+ false,
116
+ // static
117
+ true
118
+ );
119
+ };
@@ -1312,3 +1312,48 @@ export function useSg721TransferNftMutation(options?: Omit<UseMutationOptions<Ex
1312
1312
  }) => client.transferNft(msg, fee, memo, funds), options);
1313
1313
  }"
1314
1314
  `;
1315
+
1316
+ exports[`ownership 1`] = `
1317
+ "export interface OwnershipUpdateOwnershipMutation {
1318
+ client: OwnershipClient;
1319
+ msg: Action;
1320
+ args?: {
1321
+ fee?: number | StdFee | \\"auto\\";
1322
+ memo?: string;
1323
+ funds?: Coin[];
1324
+ };
1325
+ }
1326
+ export function useOwnershipUpdateOwnershipMutation(options?: Omit<UseMutationOptions<ExecuteResult, Error, OwnershipUpdateOwnershipMutation>, \\"mutationFn\\">) {
1327
+ return useMutation<ExecuteResult, Error, OwnershipUpdateOwnershipMutation>(({
1328
+ client,
1329
+ msg,
1330
+ args: {
1331
+ fee,
1332
+ memo,
1333
+ funds
1334
+ } = {}
1335
+ }) => client.updateOwnership(msg, fee, memo, funds), options);
1336
+ }
1337
+ export interface OwnershipSetFactoryMutation {
1338
+ client: OwnershipClient;
1339
+ msg: {
1340
+ newFactory: string;
1341
+ };
1342
+ args?: {
1343
+ fee?: number | StdFee | \\"auto\\";
1344
+ memo?: string;
1345
+ funds?: Coin[];
1346
+ };
1347
+ }
1348
+ export function useOwnershipSetFactoryMutation(options?: Omit<UseMutationOptions<ExecuteResult, Error, OwnershipSetFactoryMutation>, \\"mutationFn\\">) {
1349
+ return useMutation<ExecuteResult, Error, OwnershipSetFactoryMutation>(({
1350
+ client,
1351
+ msg,
1352
+ args: {
1353
+ fee,
1354
+ memo,
1355
+ funds
1356
+ } = {}
1357
+ }) => client.setFactory(msg, fee, memo, funds), options);
1358
+ }"
1359
+ `;
@@ -1,13 +1,15 @@
1
1
  import * as t from '@babel/types';
2
2
  import query_msg from '../../../../__fixtures__/basic/query_msg.json';
3
3
  import execute_msg from '../../../../__fixtures__/basic/execute_msg_for__empty.json';
4
- import { RenderContext } from '../context';
4
+ import ownership from '../../../../__fixtures__/basic/ownership.json';
5
+
5
6
 
6
7
  import {
7
8
  createReactQueryHooks,
8
9
  createReactQueryMutationHooks,
9
10
  } from './react-query'
10
11
  import { expectCode, makeContext } from '../../test-utils';
12
+ import { createMsgBuilderClass } from '../msg-builder';
11
13
 
12
14
  const execCtx = makeContext(execute_msg);
13
15
  const queryCtx = makeContext(query_msg);
@@ -90,3 +92,17 @@ it('createReactQueryHooks', () => {
90
92
  )))
91
93
  });
92
94
 
95
+ it('ownership', () => {
96
+ const ownershipCtx = makeContext(ownership);
97
+ expectCode(t.program(
98
+ createReactQueryMutationHooks(
99
+ {
100
+ context: ownershipCtx,
101
+ execMsg: ownership,
102
+ contractName: 'Ownership',
103
+ ExecuteClient: 'OwnershipClient',
104
+ }
105
+ )))
106
+ });
107
+
108
+
@@ -432,7 +432,7 @@ export const createReactQueryMutationArgsInterface = ({
432
432
  // @ts-ignore:next-line
433
433
  param.typeAnnotation,
434
434
  param.optional
435
- )
435
+ ) as t.TSTypeElement
436
436
  )
437
437
  )
438
438
  )