wasm-ast-types 0.24.0 → 0.26.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 (77) hide show
  1. package/main/client/client.js +46 -72
  2. package/main/client/index.js +0 -2
  3. package/main/client/test/ts-client.account-nfts.spec.js +3 -5
  4. package/main/client/test/ts-client.arrays-ref.spec.js +0 -4
  5. package/main/client/test/ts-client.arrays.spec.js +3 -6
  6. package/main/client/test/ts-client.cw-named-groups.test.js +0 -4
  7. package/main/client/test/ts-client.cw-proposal-single.test.js +0 -5
  8. package/main/client/test/ts-client.empty-enums.spec.js +0 -4
  9. package/main/client/test/ts-client.issue-101.spec.js +0 -4
  10. package/main/client/test/ts-client.issue-103.test.js +0 -4
  11. package/main/client/test/ts-client.issue-71.test.js +28 -50
  12. package/main/client/test/ts-client.issue-98.test.js +3 -5
  13. package/main/client/test/ts-client.issues.test.js +28 -50
  14. package/main/client/test/ts-client.overrides.spec.js +0 -4
  15. package/main/client/test/ts-client.sg721.spec.js +0 -4
  16. package/main/client/test/ts-client.spec.js +0 -17
  17. package/main/client/test/ts-client.vectis.spec.js +0 -8
  18. package/main/client/test/ts-client.wager.spec.js +4 -5
  19. package/main/context/context.js +6 -33
  20. package/main/context/imports.js +7 -43
  21. package/main/context/index.js +0 -4
  22. package/main/index.js +4 -22
  23. package/main/{msg-builder → message-builder}/index.js +4 -6
  24. package/main/{msg-builder/msg-builder.js → message-builder/message-builder.js} +24 -30
  25. package/main/{msg-builder/msg-builder.spec.js → message-builder/message-builder.spec.js} +4 -10
  26. package/main/message-composer/index.js +0 -2
  27. package/main/message-composer/message-composer.js +18 -28
  28. package/main/message-composer/message-composer.spec.js +0 -5
  29. package/main/provider/index.js +0 -2
  30. package/main/provider/provider.js +2 -29
  31. package/main/provider/provider.spec.js +0 -3
  32. package/main/react-query/index.js +0 -2
  33. package/main/react-query/react-query.js +125 -152
  34. package/main/react-query/react-query.spec.js +0 -10
  35. package/main/recoil/index.js +0 -2
  36. package/main/recoil/recoil.js +0 -14
  37. package/main/recoil/recoil.spec.js +0 -8
  38. package/main/utils/babel.js +12 -98
  39. package/main/utils/babel.spec.js +72 -67
  40. package/main/utils/constants.js +0 -6
  41. package/main/utils/index.js +0 -7
  42. package/main/utils/ref.js +0 -3
  43. package/main/utils/types.js +22 -109
  44. package/module/client/client.js +46 -32
  45. package/module/client/test/ts-client.account-nfts.spec.js +3 -1
  46. package/module/client/test/ts-client.arrays.spec.js +3 -1
  47. package/module/client/test/ts-client.issue-101.spec.js +3 -1
  48. package/module/client/test/ts-client.issue-98.test.js +3 -1
  49. package/module/client/test/ts-client.wager.spec.js +4 -1
  50. package/module/context/context.js +9 -23
  51. package/module/context/imports.js +5 -24
  52. package/module/index.js +1 -1
  53. package/module/message-builder/index.js +1 -0
  54. package/module/{msg-builder/msg-builder.js → message-builder/message-builder.js} +22 -17
  55. package/module/{msg-builder/msg-builder.spec.js → message-builder/message-builder.spec.js} +4 -4
  56. package/module/message-composer/message-composer.js +18 -14
  57. package/module/provider/provider.js +0 -8
  58. package/module/react-query/react-query.js +77 -76
  59. package/module/utils/babel.js +4 -14
  60. package/module/utils/babel.spec.js +49 -23
  61. package/module/utils/types.js +18 -66
  62. package/package.json +2 -2
  63. package/src/context/context.ts +158 -158
  64. package/src/index.ts +1 -1
  65. package/src/{msg-builder/__snapshots__/msg-builder.spec.ts.snap → message-builder/__snapshots__/message-builder.spec.ts.snap} +2 -2
  66. package/src/message-builder/index.ts +1 -0
  67. package/src/{msg-builder/msg-builder.spec.ts → message-builder/message-builder.spec.ts} +6 -7
  68. package/src/{msg-builder/msg-builder.ts → message-builder/message-builder.ts} +5 -5
  69. package/src/react-query/react-query.spec.ts +1 -1
  70. package/types/context/context.d.ts +2 -2
  71. package/types/index.d.ts +1 -1
  72. package/types/message-builder/index.d.ts +1 -0
  73. package/types/message-builder/message-builder.d.ts +4 -0
  74. package/module/msg-builder/index.js +0 -1
  75. package/src/msg-builder/index.ts +0 -1
  76. package/types/msg-builder/index.d.ts +0 -1
  77. package/types/msg-builder/msg-builder.d.ts +0 -4
@@ -1,37 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.createReactQueryMutationHooks = exports.createReactQueryMutationHook = exports.createReactQueryMutationArgsInterface = exports.createReactQueryHooks = exports.createReactQueryHookInterface = exports.createReactQueryHook = void 0;
11
-
12
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
10
  var t = _interopRequireWildcard(require("@babel/types"));
15
-
16
11
  var _case = require("case");
17
-
18
12
  var _utils = require("../utils");
19
-
20
13
  var _babel = require("../utils/babel");
21
-
22
14
  var _types2 = require("../utils/types");
23
-
24
15
  var _constants = require("../utils/constants");
25
-
26
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
-
28
17
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
-
30
18
  var createReactQueryHooks = function createReactQueryHooks(_ref) {
31
19
  var context = _ref.context,
32
- queryMsg = _ref.queryMsg,
33
- contractName = _ref.contractName,
34
- QueryClient = _ref.QueryClient;
20
+ queryMsg = _ref.queryMsg,
21
+ contractName = _ref.contractName,
22
+ QueryClient = _ref.QueryClient;
35
23
  var options = context.options.reactQuery;
36
24
  var genericQueryInterfaceName = "".concat((0, _case.pascal)(contractName), "ReactQuery");
37
25
  var underscoreNames = (0, _utils.getMessageProperties)(queryMsg).map(function (schema) {
@@ -39,7 +27,6 @@ var createReactQueryHooks = function createReactQueryHooks(_ref) {
39
27
  });
40
28
  var body = [];
41
29
  var queryKeysName = "".concat((0, _case.camel)(contractName), "QueryKeys");
42
-
43
30
  if (options.queryKeys) {
44
31
  body.push(createReactQueryKeys({
45
32
  context: context,
@@ -48,19 +35,18 @@ var createReactQueryHooks = function createReactQueryHooks(_ref) {
48
35
  underscoreNames: underscoreNames
49
36
  }));
50
37
  }
51
-
52
38
  var queryMsgs = (0, _utils.getMessageProperties)(queryMsg).map(function (schema) {
53
39
  // list_voters
54
- var underscoreName = Object.keys(schema.properties)[0]; // listVoters
55
-
56
- var methodName = (0, _case.camel)(underscoreName); // Cw3FlexMultisigListVotersQuery
57
-
58
- var hookParamsTypeName = "".concat((0, _case.pascal)(contractName)).concat((0, _case.pascal)(methodName), "Query"); // useCw3FlexMultisigListVotersQuery
59
-
60
- var hookName = "use".concat(hookParamsTypeName); // listVotersResponse
61
-
62
- var responseType = (0, _types2.getResponseType)(context, underscoreName); // cw3FlexMultisigListVoters
63
-
40
+ var underscoreName = Object.keys(schema.properties)[0];
41
+ // listVoters
42
+ var methodName = (0, _case.camel)(underscoreName);
43
+ // Cw3FlexMultisigListVotersQuery
44
+ var hookParamsTypeName = "".concat((0, _case.pascal)(contractName)).concat((0, _case.pascal)(methodName), "Query");
45
+ // useCw3FlexMultisigListVotersQuery
46
+ var hookName = "use".concat(hookParamsTypeName);
47
+ // listVotersResponse
48
+ var responseType = (0, _types2.getResponseType)(context, underscoreName);
49
+ // cw3FlexMultisigListVoters
64
50
  var getterKey = (0, _case.camel)("".concat(contractName).concat((0, _case.pascal)(methodName)));
65
51
  var jsonschema = schema.properties[underscoreName];
66
52
  return {
@@ -74,7 +60,6 @@ var createReactQueryHooks = function createReactQueryHooks(_ref) {
74
60
  };
75
61
  });
76
62
  var queryFactoryName = "".concat((0, _case.camel)(contractName), "Queries");
77
-
78
63
  if (options.queryFactory) {
79
64
  body.push(createReactQueryFactory({
80
65
  context: context,
@@ -83,7 +68,6 @@ var createReactQueryHooks = function createReactQueryHooks(_ref) {
83
68
  queryMsgs: queryMsgs
84
69
  }));
85
70
  }
86
-
87
71
  body.push(createReactQueryHookGenericInterface({
88
72
  context: context,
89
73
  QueryClient: QueryClient,
@@ -91,11 +75,11 @@ var createReactQueryHooks = function createReactQueryHooks(_ref) {
91
75
  }));
92
76
  body.push.apply(body, (0, _toConsumableArray2["default"])(queryMsgs.reduce(function (m, _ref2) {
93
77
  var methodName = _ref2.methodName,
94
- hookParamsTypeName = _ref2.hookParamsTypeName,
95
- hookName = _ref2.hookName,
96
- responseType = _ref2.responseType,
97
- getterKey = _ref2.getterKey,
98
- jsonschema = _ref2.jsonschema;
78
+ hookParamsTypeName = _ref2.hookParamsTypeName,
79
+ hookName = _ref2.hookName,
80
+ responseType = _ref2.responseType,
81
+ getterKey = _ref2.getterKey,
82
+ jsonschema = _ref2.jsonschema;
99
83
  return [createReactQueryHookInterface({
100
84
  context: context,
101
85
  hookParamsTypeName: hookParamsTypeName,
@@ -116,54 +100,45 @@ var createReactQueryHooks = function createReactQueryHooks(_ref) {
116
100
  }, [])));
117
101
  return body;
118
102
  };
119
-
120
103
  exports.createReactQueryHooks = createReactQueryHooks;
121
-
122
104
  function buildQueryFn(methodName, jsonschema, options) {
123
105
  var _jsonschema$propertie;
124
-
125
106
  var keys = Object.keys((_jsonschema$propertie = jsonschema.properties) !== null && _jsonschema$propertie !== void 0 ? _jsonschema$propertie : {});
126
107
  var args = [];
127
-
128
108
  if (keys.length) {
129
109
  args = [t.objectExpression((0, _toConsumableArray2["default"])(keys.map(function (prop) {
130
110
  return t.objectProperty(t.identifier((0, _case.camel)(prop)), t.memberExpression(t.identifier('args'), t.identifier((0, _case.camel)(prop))));
131
111
  })))];
132
112
  }
133
-
134
113
  var rejectInvalidClient = t.callExpression(t.memberExpression(t.identifier('Promise'), t.identifier('reject')), [t.newExpression(t.identifier('Error'), [t.stringLiteral('Invalid client')])]);
135
114
  return t.arrowFunctionExpression([], (0, _babel.optionalConditionalExpression)(t.identifier('client'), t.callExpression(t.memberExpression(t.identifier('client'), t.identifier(methodName)), args), rejectInvalidClient, options.optionalClient), false);
136
115
  }
137
-
138
- var ENABLED_QUERY_OPTION = t.objectProperty(t.identifier('enabled'), t.logicalExpression('&&', t.unaryExpression('!', t.unaryExpression('!', t.identifier('client'))), t.conditionalExpression( // explicitly check for undefined
116
+ var ENABLED_QUERY_OPTION = t.objectProperty(t.identifier('enabled'), t.logicalExpression('&&', t.unaryExpression('!', t.unaryExpression('!', t.identifier('client'))), t.conditionalExpression(
117
+ // explicitly check for undefined
139
118
  t.binaryExpression('!=', t.optionalMemberExpression(t.identifier('options'), t.identifier('enabled'), false, true), t.identifier('undefined')), t.memberExpression(t.identifier('options'), t.identifier('enabled')), t.booleanLiteral(true))));
140
-
141
119
  function buildQueryOptions(options) {
142
- return options.optionalClient ? t.objectExpression([t.spreadElement(t.identifier('options')), t.objectProperty(t.identifier('enabled'), t.logicalExpression('&&', t.unaryExpression('!', t.unaryExpression('!', t.identifier('client'))), t.conditionalExpression( // explicitly check for undefined
120
+ return options.optionalClient ? t.objectExpression([t.spreadElement(t.identifier('options')), t.objectProperty(t.identifier('enabled'), t.logicalExpression('&&', t.unaryExpression('!', t.unaryExpression('!', t.identifier('client'))), t.conditionalExpression(
121
+ // explicitly check for undefined
143
122
  t.binaryExpression('!=', t.optionalMemberExpression(t.identifier('options'), t.identifier('enabled'), false, true), t.identifier('undefined')), t.memberExpression(t.identifier('options'), t.identifier('enabled')), t.booleanLiteral(true))))]) : t.identifier('options');
144
123
  }
145
-
146
124
  var createReactQueryHook = function createReactQueryHook(_ref3) {
147
125
  var _jsonschema$propertie2;
148
-
149
126
  var context = _ref3.context,
150
- hookName = _ref3.hookName,
151
- hookParamsTypeName = _ref3.hookParamsTypeName,
152
- responseType = _ref3.responseType,
153
- hookKeyName = _ref3.hookKeyName,
154
- queryKeysName = _ref3.queryKeysName,
155
- methodName = _ref3.methodName,
156
- jsonschema = _ref3.jsonschema;
127
+ hookName = _ref3.hookName,
128
+ hookParamsTypeName = _ref3.hookParamsTypeName,
129
+ responseType = _ref3.responseType,
130
+ hookKeyName = _ref3.hookKeyName,
131
+ queryKeysName = _ref3.queryKeysName,
132
+ methodName = _ref3.methodName,
133
+ jsonschema = _ref3.jsonschema;
157
134
  context.addUtil('useQuery');
158
135
  context.addUtil('UseQueryOptions');
159
136
  var options = context.options.reactQuery;
160
137
  var keys = Object.keys((_jsonschema$propertie2 = jsonschema.properties) !== null && _jsonschema$propertie2 !== void 0 ? _jsonschema$propertie2 : {});
161
138
  var props = ['client', 'options'];
162
-
163
139
  if (keys.length) {
164
140
  props = ['client', 'args', 'options'];
165
141
  }
166
-
167
142
  var selectResponseGenericTypeName = GENERIC_SELECT_RESPONSE_NAME;
168
143
  var queryFunctionDeclaration = t.functionDeclaration(t.identifier(hookName), [(0, _utils.tsObjectPattern)((0, _toConsumableArray2["default"])(props.map(function (prop) {
169
144
  return t.objectProperty(t.identifier(prop), t.identifier(prop), false, true);
@@ -173,14 +148,13 @@ var createReactQueryHook = function createReactQueryHook(_ref3) {
173
148
  methodName: methodName,
174
149
  props: props,
175
150
  options: options
176
- }), buildQueryFn(methodName, jsonschema, options), buildQueryOptions(options)], t.tsTypeParameterInstantiation([t.tsTypeReference(t.identifier(responseType)), t.tsTypeReference(t.identifier('Error')), t.tsTypeReference(t.identifier(selectResponseGenericTypeName))])))])); // Add the TData type parameters
151
+ }), buildQueryFn(methodName, jsonschema, options), buildQueryOptions(options)], t.tsTypeParameterInstantiation([t.tsTypeReference(t.identifier(responseType)), t.tsTypeReference(t.identifier('Error')), t.tsTypeReference(t.identifier(selectResponseGenericTypeName))])))]));
177
152
 
153
+ // Add the TData type parameters
178
154
  queryFunctionDeclaration.typeParameters = t.tsTypeParameterDeclaration([t.tsTypeParameter(undefined, t.tSTypeReference(t.identifier(responseType)), selectResponseGenericTypeName)]);
179
155
  return t.exportNamedDeclaration(queryFunctionDeclaration);
180
156
  };
181
-
182
157
  exports.createReactQueryHook = createReactQueryHook;
183
-
184
158
  /**
185
159
  * Example:
186
160
  ```
@@ -200,54 +174,52 @@ exports.createReactQueryHook = createReactQueryHook;
200
174
  */
201
175
  var createReactQueryMutationArgsInterface = function createReactQueryMutationArgsInterface(_ref4) {
202
176
  var _createTypedObjectPar;
203
-
204
177
  var context = _ref4.context,
205
- ExecuteClient = _ref4.ExecuteClient,
206
- mutationHookParamsTypeName = _ref4.mutationHookParamsTypeName,
207
- useMutationTypeParameter = _ref4.useMutationTypeParameter,
208
- jsonschema = _ref4.jsonschema;
178
+ ExecuteClient = _ref4.ExecuteClient,
179
+ mutationHookParamsTypeName = _ref4.mutationHookParamsTypeName,
180
+ useMutationTypeParameter = _ref4.useMutationTypeParameter,
181
+ jsonschema = _ref4.jsonschema;
209
182
  var typedUseMutationOptions = t.tsTypeReference(t.identifier('UseMutationOptions'), useMutationTypeParameter);
210
183
  var body = [(0, _utils.tsPropertySignature)(t.identifier('client'), t.tsTypeAnnotation(t.tsTypeReference(t.identifier(ExecuteClient))), false)];
211
184
  var msgType = (_createTypedObjectPar = (0, _utils.createTypedObjectParams)(context, jsonschema)) === null || _createTypedObjectPar === void 0 ? void 0 : _createTypedObjectPar.typeAnnotation;
212
-
213
185
  if (msgType) {
214
- body.push(t.tsPropertySignature(t.identifier('msg'), // @ts-ignore
186
+ body.push(t.tsPropertySignature(t.identifier('msg'),
187
+ // @ts-ignore
215
188
  msgType));
216
189
  }
217
-
218
190
  context.addUtil('StdFee');
219
191
  context.addUtil('Coin');
220
- var optionalArgs = t.tsPropertySignature(t.identifier('args'), t.tsTypeAnnotation( // @ts-ignore:next-line
192
+ var optionalArgs = t.tsPropertySignature(t.identifier('args'), t.tsTypeAnnotation(
193
+ // @ts-ignore:next-line
221
194
  t.tsTypeLiteral([(0, _babel.propertySignature)('fee', _constants.OPTIONAL_FEE_PARAM.typeAnnotation, true), (0, _babel.propertySignature)('memo', _constants.OPTIONAL_MEMO_PARAM.typeAnnotation, true), (0, _babel.propertySignature)('funds', _utils.OPTIONAL_FUNDS_PARAM.typeAnnotation, true)])));
222
195
  optionalArgs.optional = true;
223
196
  body.push(optionalArgs);
224
197
  return t.exportNamedDeclaration(t.tsInterfaceDeclaration(t.identifier(mutationHookParamsTypeName), null, [], t.tsInterfaceBody(body)));
225
198
  };
226
-
227
199
  exports.createReactQueryMutationArgsInterface = createReactQueryMutationArgsInterface;
228
-
229
200
  var createReactQueryMutationHooks = function createReactQueryMutationHooks(_ref5) {
230
201
  var context = _ref5.context,
231
- execMsg = _ref5.execMsg,
232
- contractName = _ref5.contractName,
233
- ExecuteClient = _ref5.ExecuteClient;
202
+ execMsg = _ref5.execMsg,
203
+ contractName = _ref5.contractName,
204
+ ExecuteClient = _ref5.ExecuteClient;
234
205
  // merge the user options with the defaults
235
206
  return (0, _utils.getMessageProperties)(execMsg).reduce(function (m, schema) {
236
207
  var _jsonschema$propertie3, _Object$keys;
237
-
238
208
  // update_members
239
- var execMethodUnderscoreName = Object.keys(schema.properties)[0]; // updateMembers
240
-
241
- var execMethodName = (0, _case.camel)(execMethodUnderscoreName); // Cw20UpdateMembersMutation
242
-
243
- var mutationHookParamsTypeName = "".concat((0, _case.pascal)(contractName)).concat((0, _case.pascal)(execMethodName), "Mutation"); // useCw20UpdateMembersMutation
244
-
209
+ var execMethodUnderscoreName = Object.keys(schema.properties)[0];
210
+ // updateMembers
211
+ var execMethodName = (0, _case.camel)(execMethodUnderscoreName);
212
+ // Cw20UpdateMembersMutation
213
+ var mutationHookParamsTypeName = "".concat((0, _case.pascal)(contractName)).concat((0, _case.pascal)(execMethodName), "Mutation");
214
+ // useCw20UpdateMembersMutation
245
215
  var mutationHookName = "use".concat(mutationHookParamsTypeName);
246
216
  var jsonschema = schema.properties[execMethodUnderscoreName];
247
- var properties = (_jsonschema$propertie3 = jsonschema.properties) !== null && _jsonschema$propertie3 !== void 0 ? _jsonschema$propertie3 : {}; // TODO: there should be a better way to do this
217
+ var properties = (_jsonschema$propertie3 = jsonschema.properties) !== null && _jsonschema$propertie3 !== void 0 ? _jsonschema$propertie3 : {};
248
218
 
249
- var hasMsg = !!((_Object$keys = Object.keys(properties)) !== null && _Object$keys !== void 0 && _Object$keys.length || jsonschema !== null && jsonschema !== void 0 && jsonschema.$ref); // <ExecuteResult, Error, Cw4UpdateMembersMutation>
219
+ // TODO: there should be a better way to do this
220
+ var hasMsg = !!((_Object$keys = Object.keys(properties)) !== null && _Object$keys !== void 0 && _Object$keys.length || jsonschema !== null && jsonschema !== void 0 && jsonschema.$ref);
250
221
 
222
+ // <ExecuteResult, Error, Cw4UpdateMembersMutation>
251
223
  var useMutationTypeParameter = generateMutationTypeParameter(context, mutationHookParamsTypeName);
252
224
  return [createReactQueryMutationArgsInterface({
253
225
  context: context,
@@ -265,21 +237,21 @@ var createReactQueryMutationHooks = function createReactQueryMutationHooks(_ref5
265
237
  })].concat((0, _toConsumableArray2["default"])(m));
266
238
  }, []);
267
239
  };
240
+
268
241
  /**
269
242
  * Generates the mutation type parameter. If args exist, we use a pick. If not, we just return the params type.
270
243
  */
271
-
272
-
273
244
  exports.createReactQueryMutationHooks = createReactQueryMutationHooks;
274
-
275
245
  var generateMutationTypeParameter = function generateMutationTypeParameter(context, mutationHookParamsTypeName) {
276
246
  context.addUtil('ExecuteResult');
277
- return t.tsTypeParameterInstantiation([// Data
278
- t.tSTypeReference(t.identifier('ExecuteResult')), // Error
279
- t.tsTypeReference(t.identifier('Error')), // Variables
247
+ return t.tsTypeParameterInstantiation([
248
+ // Data
249
+ t.tSTypeReference(t.identifier('ExecuteResult')),
250
+ // Error
251
+ t.tsTypeReference(t.identifier('Error')),
252
+ // Variables
280
253
  t.tsTypeReference(t.identifier(mutationHookParamsTypeName))]);
281
254
  };
282
-
283
255
  /**
284
256
  *
285
257
  * Example:
@@ -293,11 +265,11 @@ export const useCw4UpdateMembersMutation = ({ client, options }: Omit<Cw4UpdateM
293
265
  */
294
266
  var createReactQueryMutationHook = function createReactQueryMutationHook(_ref6) {
295
267
  var context = _ref6.context,
296
- mutationHookName = _ref6.mutationHookName,
297
- mutationHookParamsTypeName = _ref6.mutationHookParamsTypeName,
298
- execMethodName = _ref6.execMethodName,
299
- useMutationTypeParameter = _ref6.useMutationTypeParameter,
300
- hasMsg = _ref6.hasMsg;
268
+ mutationHookName = _ref6.mutationHookName,
269
+ mutationHookParamsTypeName = _ref6.mutationHookParamsTypeName,
270
+ execMethodName = _ref6.execMethodName,
271
+ useMutationTypeParameter = _ref6.useMutationTypeParameter,
272
+ hasMsg = _ref6.hasMsg;
301
273
  context.addUtil('useMutation');
302
274
  context.addUtil('UseMutationOptions');
303
275
  var useMutationFunctionArgs = [(0, _babel.shorthandProperty)('client')];
@@ -306,135 +278,136 @@ var createReactQueryMutationHook = function createReactQueryMutationHook(_ref6)
306
278
  return t.exportNamedDeclaration(t.functionDeclaration(t.identifier(mutationHookName), [(0, _utils.identifier)('options', t.tsTypeAnnotation((0, _babel.omitTypeReference)(t.tsTypeReference(t.identifier('UseMutationOptions'), useMutationTypeParameter), 'mutationFn')), true)], t.blockStatement([t.returnStatement((0, _utils.callExpression)(t.identifier('useMutation'), [t.arrowFunctionExpression([t.objectPattern(useMutationFunctionArgs)], t.callExpression(t.memberExpression(t.identifier('client'), t.identifier(execMethodName)), (hasMsg ? [t.identifier('msg')] : []).concat([t.identifier('fee'), t.identifier('memo'), t.identifier('funds')])), false // not async
307
279
  ), t.identifier('options')], useMutationTypeParameter))])));
308
280
  };
309
-
310
281
  exports.createReactQueryMutationHook = createReactQueryMutationHook;
311
-
312
282
  function createReactQueryKeys(_ref7) {
313
283
  var context = _ref7.context,
314
- queryKeysName = _ref7.queryKeysName,
315
- camelContractName = _ref7.camelContractName,
316
- underscoreNames = _ref7.underscoreNames;
284
+ queryKeysName = _ref7.queryKeysName,
285
+ camelContractName = _ref7.camelContractName,
286
+ underscoreNames = _ref7.underscoreNames;
317
287
  var options = context.options.reactQuery;
318
288
  var contractAddressTypeAnnotation = t.tsTypeAnnotation(options.optionalClient ? t.tsUnionType([t.tsStringKeyword(), t.tsUndefinedKeyword()]) : t.tSStringKeyword());
319
- return t.exportNamedDeclaration(t.variableDeclaration('const', [t.variableDeclarator(t.identifier(queryKeysName), t.objectExpression([// 1: contract
320
- t.objectProperty(t.identifier('contract'), t.tSAsExpression(t.arrayExpression([t.objectExpression([t.objectProperty(t.identifier('contract'), t.stringLiteral(camelContractName))])]), t.tSTypeReference(t.identifier('const')))), // 2: address
321
- t.objectProperty(t.identifier('address'), t.arrowFunctionExpression([(0, _utils.identifier)('contractAddress', contractAddressTypeAnnotation)], t.tSAsExpression(t.arrayExpression([t.objectExpression([// 1
289
+ return t.exportNamedDeclaration(t.variableDeclaration('const', [t.variableDeclarator(t.identifier(queryKeysName), t.objectExpression([
290
+ // 1: contract
291
+ t.objectProperty(t.identifier('contract'), t.tSAsExpression(t.arrayExpression([t.objectExpression([t.objectProperty(t.identifier('contract'), t.stringLiteral(camelContractName))])]), t.tSTypeReference(t.identifier('const')))),
292
+ // 2: address
293
+ t.objectProperty(t.identifier('address'), t.arrowFunctionExpression([(0, _utils.identifier)('contractAddress', contractAddressTypeAnnotation)], t.tSAsExpression(t.arrayExpression([t.objectExpression([
294
+ // 1
322
295
  t.spreadElement(t.memberExpression(t.memberExpression(t.identifier(queryKeysName), t.identifier('contract')), t.numericLiteral(0), true // computed
323
296
  )), t.objectProperty(t.identifier('address'), t.identifier('contractAddress'))])]), t.tSTypeReference(t.identifier('const')))))].concat((0, _toConsumableArray2["default"])(underscoreNames.map(function (underscoreMethodName) {
324
- return t.objectProperty( // key id is the camel method name
325
- t.identifier((0, _case.camel)(underscoreMethodName)), t.arrowFunctionExpression([(0, _utils.identifier)('contractAddress', contractAddressTypeAnnotation), (0, _utils.identifier)('args', // Record<string, unknown>
297
+ return t.objectProperty(
298
+ // key id is the camel method name
299
+ t.identifier((0, _case.camel)(underscoreMethodName)), t.arrowFunctionExpression([(0, _utils.identifier)('contractAddress', contractAddressTypeAnnotation), (0, _utils.identifier)('args',
300
+ // Record<string, unknown>
326
301
  t.tSTypeAnnotation(t.tsTypeReference(t.identifier('Record'), t.tsTypeParameterInstantiation([t.tsStringKeyword(), t.tsUnknownKeyword()]))), true // optional
327
- )], t.tSAsExpression(t.arrayExpression([t.objectExpression([//...cw3FlexMultisigQueryKeys.address(contractAddress)[0]
302
+ )], t.tSAsExpression(t.arrayExpression([t.objectExpression([
303
+ //...cw3FlexMultisigQueryKeys.address(contractAddress)[0]
328
304
  t.spreadElement(t.memberExpression(t.callExpression(t.memberExpression(t.identifier(queryKeysName), t.identifier('address')), [t.identifier('contractAddress')]), t.numericLiteral(0), true // computed
329
- )), // method: list_voters
330
- t.objectProperty(t.identifier('method'), t.stringLiteral(underscoreMethodName)), // args
305
+ )),
306
+ // method: list_voters
307
+ t.objectProperty(t.identifier('method'), t.stringLiteral(underscoreMethodName)),
308
+ // args
331
309
  (0, _babel.shorthandProperty)('args')])]), t.tSTypeReference(t.identifier('const')))));
332
310
  })))))]));
333
311
  }
334
-
335
312
  function createReactQueryFactory(_ref8) {
336
313
  var context = _ref8.context,
337
- queryFactoryName = _ref8.queryFactoryName,
338
- queryKeysName = _ref8.queryKeysName,
339
- queryMsgs = _ref8.queryMsgs;
314
+ queryFactoryName = _ref8.queryFactoryName,
315
+ queryKeysName = _ref8.queryKeysName,
316
+ queryMsgs = _ref8.queryMsgs;
340
317
  var options = context.options.reactQuery;
341
318
  return t.exportNamedDeclaration(t.variableDeclaration('const', [t.variableDeclarator(t.identifier(queryFactoryName), t.objectExpression((0, _toConsumableArray2["default"])(queryMsgs.map(function (_ref9) {
342
319
  var _jsonschema$propertie4;
343
-
344
320
  var methodName = _ref9.methodName,
345
- hookParamsTypeName = _ref9.hookParamsTypeName,
346
- responseType = _ref9.responseType,
347
- jsonschema = _ref9.jsonschema;
321
+ hookParamsTypeName = _ref9.hookParamsTypeName,
322
+ responseType = _ref9.responseType,
323
+ jsonschema = _ref9.jsonschema;
348
324
  var hasArgs = Object.keys((_jsonschema$propertie4 = jsonschema.properties) !== null && _jsonschema$propertie4 !== void 0 ? _jsonschema$propertie4 : {}).length > 0;
349
- var methodQueryOptionsFn = t.arrowFunctionExpression([(0, _utils.tsObjectPattern)([(0, _babel.shorthandProperty)('client')].concat((0, _toConsumableArray2["default"])(hasArgs ? [(0, _babel.shorthandProperty)('args')] : []), [(0, _babel.shorthandProperty)('options')]), t.tsTypeAnnotation(t.tsTypeReference(t.identifier(hookParamsTypeName), t.tsTypeParameterInstantiation([t.tsTypeReference(t.identifier(GENERIC_SELECT_RESPONSE_NAME))]))))], t.objectExpression([// 1: queryKey
350
- t.objectProperty(t.identifier('queryKey'), t.callExpression(t.memberExpression(t.identifier(queryKeysName), t.identifier(methodName)), [t.optionalMemberExpression(t.identifier('client'), t.identifier('contractAddress'), false, true)].concat((0, _toConsumableArray2["default"])(hasArgs ? [t.identifier('args')] : [])))), // 2: queryFn
351
- t.objectProperty(t.identifier('queryFn'), buildQueryFn(methodName, jsonschema, options)), // 3: spread options
352
- t.spreadElement(t.identifier('options')), // 4. enabled
325
+ var methodQueryOptionsFn = t.arrowFunctionExpression([(0, _utils.tsObjectPattern)([(0, _babel.shorthandProperty)('client')].concat((0, _toConsumableArray2["default"])(hasArgs ? [(0, _babel.shorthandProperty)('args')] : []), [(0, _babel.shorthandProperty)('options')]), t.tsTypeAnnotation(t.tsTypeReference(t.identifier(hookParamsTypeName), t.tsTypeParameterInstantiation([t.tsTypeReference(t.identifier(GENERIC_SELECT_RESPONSE_NAME))]))))], t.objectExpression([
326
+ // 1: queryKey
327
+ t.objectProperty(t.identifier('queryKey'), t.callExpression(t.memberExpression(t.identifier(queryKeysName), t.identifier(methodName)), [t.optionalMemberExpression(t.identifier('client'), t.identifier('contractAddress'), false, true)].concat((0, _toConsumableArray2["default"])(hasArgs ? [t.identifier('args')] : [])))),
328
+ // 2: queryFn
329
+ t.objectProperty(t.identifier('queryFn'), buildQueryFn(methodName, jsonschema, options)),
330
+ // 3: spread options
331
+ t.spreadElement(t.identifier('options')),
332
+ // 4. enabled
353
333
  ENABLED_QUERY_OPTION]));
354
334
  methodQueryOptionsFn.typeParameters = t.tsTypeParameterDeclaration([t.tsTypeParameter(undefined, t.tsTypeReference(t.identifier(responseType)), GENERIC_SELECT_RESPONSE_NAME)]);
355
335
  methodQueryOptionsFn.returnType = t.tsTypeAnnotation(t.tsTypeReference(t.identifier('UseQueryOptions'), t.tsTypeParameterInstantiation([t.tsTypeReference(t.identifier(responseType)), t.tsTypeReference(t.identifier('Error')), t.tsTypeReference(t.identifier(GENERIC_SELECT_RESPONSE_NAME))])));
356
- return t.objectProperty( // key id is the camel method name
336
+ return t.objectProperty(
337
+ // key id is the camel method name
357
338
  t.identifier((0, _case.camel)(methodName)), methodQueryOptionsFn);
358
339
  }))))]));
359
340
  }
360
-
361
341
  var GENERIC_SELECT_RESPONSE_NAME = 'TData';
362
-
363
342
  function createReactQueryHookGenericInterface(_ref10) {
364
343
  var context = _ref10.context,
365
- QueryClient = _ref10.QueryClient,
366
- genericQueryInterfaceName = _ref10.genericQueryInterfaceName;
344
+ QueryClient = _ref10.QueryClient,
345
+ genericQueryInterfaceName = _ref10.genericQueryInterfaceName;
367
346
  var options = context.options.reactQuery;
368
347
  var genericResponseTypeName = 'TResponse';
369
- context.addUtil('UseQueryOptions'); // UseQueryOptions<TResponse, Error, TData>,
348
+ context.addUtil('UseQueryOptions');
370
349
 
350
+ // UseQueryOptions<TResponse, Error, TData>,
371
351
  var typedUseQueryOptions = t.tsTypeReference(t.identifier('UseQueryOptions'), t.tsTypeParameterInstantiation([t.tsTypeReference(t.identifier(genericResponseTypeName)), t.tsTypeReference(t.identifier('Error')), t.tsTypeReference(t.identifier(GENERIC_SELECT_RESPONSE_NAME))]));
372
352
  var body = [(0, _utils.tsPropertySignature)(t.identifier('client'), t.tsTypeAnnotation(options.optionalClient ? t.tsUnionType([t.tsTypeReference(t.identifier(QueryClient)), t.tsUndefinedKeyword()]) : t.tsTypeReference(t.identifier(QueryClient))), false), (0, _utils.tsPropertySignature)(t.identifier('options'), t.tsTypeAnnotation(options.version === 'v4' ? t.tSIntersectionType([(0, _babel.omitTypeReference)(typedUseQueryOptions, "'queryKey' | 'queryFn' | 'initialData'"), t.tSTypeLiteral([t.tsPropertySignature(t.identifier('initialData?'), t.tsTypeAnnotation(t.tsUndefinedKeyword()))])]) : typedUseQueryOptions), true)];
373
- return t.exportNamedDeclaration(t.tsInterfaceDeclaration(t.identifier(genericQueryInterfaceName), t.tsTypeParameterDeclaration([// 1: TResponse
374
- t.tsTypeParameter(undefined, undefined, genericResponseTypeName), // 2: TData
353
+ return t.exportNamedDeclaration(t.tsInterfaceDeclaration(t.identifier(genericQueryInterfaceName), t.tsTypeParameterDeclaration([
354
+ // 1: TResponse
355
+ t.tsTypeParameter(undefined, undefined, genericResponseTypeName),
356
+ // 2: TData
375
357
  t.tsTypeParameter(undefined, t.tSTypeReference(t.identifier(genericResponseTypeName)), GENERIC_SELECT_RESPONSE_NAME)]), [], t.tSInterfaceBody(body)));
376
358
  }
377
-
378
359
  var createReactQueryHookInterface = function createReactQueryHookInterface(_ref11) {
379
360
  var context = _ref11.context,
380
- QueryClient = _ref11.QueryClient,
381
- hookParamsTypeName = _ref11.hookParamsTypeName,
382
- queryInterfaceName = _ref11.queryInterfaceName,
383
- responseType = _ref11.responseType,
384
- jsonschema = _ref11.jsonschema;
361
+ QueryClient = _ref11.QueryClient,
362
+ hookParamsTypeName = _ref11.hookParamsTypeName,
363
+ queryInterfaceName = _ref11.queryInterfaceName,
364
+ responseType = _ref11.responseType,
365
+ jsonschema = _ref11.jsonschema;
385
366
  // merge the user options with the defaults
386
367
  var options = context.options.reactQuery;
387
368
  var body = [];
388
369
  var props = getProps(context, jsonschema);
389
-
390
370
  if (props.length) {
391
- body.push(t.tsPropertySignature(t.identifier('args'), t.tsTypeAnnotation( // @ts-ignore:next-line
371
+ body.push(t.tsPropertySignature(t.identifier('args'), t.tsTypeAnnotation(
372
+ // @ts-ignore:next-line
392
373
  t.tsTypeLiteral(props))));
393
374
  }
394
-
395
- return t.exportNamedDeclaration(t.tsInterfaceDeclaration(t.identifier(hookParamsTypeName), t.tsTypeParameterDeclaration([t.tSTypeParameter(undefined, undefined, GENERIC_SELECT_RESPONSE_NAME)]), [t.tSExpressionWithTypeArguments(t.identifier(queryInterfaceName), t.tsTypeParameterInstantiation([// 1: response
396
- t.tsTypeReference(t.identifier(responseType)), // 2: select generic
375
+ return t.exportNamedDeclaration(t.tsInterfaceDeclaration(t.identifier(hookParamsTypeName), t.tsTypeParameterDeclaration([t.tSTypeParameter(undefined, undefined, GENERIC_SELECT_RESPONSE_NAME)]), [t.tSExpressionWithTypeArguments(t.identifier(queryInterfaceName), t.tsTypeParameterInstantiation([
376
+ // 1: response
377
+ t.tsTypeReference(t.identifier(responseType)),
378
+ // 2: select generic
397
379
  t.tSTypeReference(t.identifier(GENERIC_SELECT_RESPONSE_NAME))]))], t.tsInterfaceBody(body)));
398
380
  };
399
-
400
381
  exports.createReactQueryHookInterface = createReactQueryHookInterface;
401
-
402
382
  var getProps = function getProps(context, jsonschema) {
403
383
  var _jsonschema$propertie5;
404
-
405
384
  var keys = Object.keys((_jsonschema$propertie5 = jsonschema.properties) !== null && _jsonschema$propertie5 !== void 0 ? _jsonschema$propertie5 : {});
406
385
  if (!keys.length) return [];
407
386
  return keys.map(function (prop) {
408
387
  var _getPropertyType = (0, _types2.getPropertyType)(context, jsonschema, prop),
409
- type = _getPropertyType.type,
410
- optional = _getPropertyType.optional;
411
-
388
+ type = _getPropertyType.type,
389
+ optional = _getPropertyType.optional;
412
390
  return (0, _babel.propertySignature)(context.options.reactQuery.camelize ? (0, _case.camel)(prop) : prop, t.tsTypeAnnotation(type), optional);
413
391
  });
414
392
  };
415
-
416
393
  var generateUseQueryQueryKey = function generateUseQueryQueryKey(_ref12) {
417
394
  var hookKeyName = _ref12.hookKeyName,
418
- queryKeysName = _ref12.queryKeysName,
419
- methodName = _ref12.methodName,
420
- props = _ref12.props,
421
- options = _ref12.options;
395
+ queryKeysName = _ref12.queryKeysName,
396
+ methodName = _ref12.methodName,
397
+ props = _ref12.props,
398
+ options = _ref12.options;
422
399
  var optionalClient = options.optionalClient,
423
- queryKeys = options.queryKeys;
400
+ queryKeys = options.queryKeys;
424
401
  var hasArgs = props.includes('args');
425
402
  var contractAddressExpression = t.optionalMemberExpression(t.identifier('client'), t.identifier('contractAddress'), false, optionalClient);
426
-
427
403
  if (queryKeys) {
428
404
  var callArgs = [contractAddressExpression];
429
405
  if (hasArgs) callArgs.push(t.identifier('args'));
430
406
  return t.callExpression(t.memberExpression(t.identifier(queryKeysName), t.identifier((0, _case.camel)(methodName))), callArgs);
431
407
  }
432
-
433
408
  var queryKey = [t.stringLiteral(hookKeyName), contractAddressExpression];
434
-
435
409
  if (hasArgs) {
436
410
  queryKey.push(t.callExpression(t.memberExpression(t.identifier('JSON'), t.identifier('stringify')), [t.identifier('args')]));
437
411
  }
438
-
439
412
  return t.arrayExpression(queryKey);
440
413
  };
@@ -1,25 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  var t = _interopRequireWildcard(require("@babel/types"));
8
-
9
6
  var _query_msg = _interopRequireDefault(require("../../../../__fixtures__/basic/query_msg.json"));
10
-
11
7
  var _execute_msg_for__empty = _interopRequireDefault(require("../../../../__fixtures__/basic/execute_msg_for__empty.json"));
12
-
13
8
  var _ownership = _interopRequireDefault(require("../../../../__fixtures__/basic/ownership.json"));
14
-
15
9
  var _reactQuery = require("./react-query");
16
-
17
10
  var _testUtils = require("../../test-utils");
18
-
19
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
-
21
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
-
23
13
  var execCtx = (0, _testUtils.makeContext)(_execute_msg_for__empty["default"]);
24
14
  var queryCtx = (0, _testUtils.makeContext)(_query_msg["default"]);
25
15
  it('createReactQueryHooks', function () {
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  var _recoil = require("./recoil");
8
-
9
7
  Object.keys(_recoil).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _recoil[key]) return;
@@ -1,31 +1,22 @@
1
1
  "use strict";
2
2
 
3
3
  var _typeof = require("@babel/runtime/helpers/typeof");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createRecoilSelectors = exports.createRecoilSelector = exports.createRecoilQueryClientType = exports.createRecoilQueryClient = void 0;
9
-
10
8
  var t = _interopRequireWildcard(require("@babel/types"));
11
-
12
9
  var _case = require("case");
13
-
14
10
  var _utils = require("../utils");
15
-
16
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
-
18
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
20
13
  var createRecoilSelector = function createRecoilSelector(context, keyPrefix, QueryClient, methodName, responseType) {
21
14
  context.addUtil('selectorFamily');
22
15
  var selectorName = (0, _case.camel)("".concat(methodName, "Selector"));
23
16
  var getterKey = (0, _case.camel)("".concat(keyPrefix).concat((0, _case.pascal)(methodName)));
24
17
  return t.exportNamedDeclaration(t.variableDeclaration('const', [t.variableDeclarator(t.identifier(selectorName), (0, _utils.callExpression)(t.identifier('selectorFamily'), [t.objectExpression([t.objectProperty(t.identifier('key'), t.stringLiteral(getterKey)), t.objectProperty(t.identifier('get'), t.arrowFunctionExpression([t.objectPattern([t.objectProperty(t.identifier('params'), t.identifier('params'), false, true), t.restElement(t.identifier('queryClientParams'))])], t.arrowFunctionExpression([t.objectPattern([t.objectProperty(t.identifier('get'), t.identifier('get'), false, true)])], t.blockStatement([t.variableDeclaration('const', [t.variableDeclarator(t.identifier('client'), t.callExpression(t.identifier('get'), [t.callExpression(t.identifier('queryClient'), [t.identifier('queryClientParams')])]))]), t.returnStatement(t.awaitExpression(t.callExpression(t.memberExpression(t.identifier('client'), t.identifier(methodName)), [t.spreadElement(t.identifier('params'))])))]), true)))])], t.tsTypeParameterInstantiation([t.tsTypeReference(t.identifier(responseType)), t.tsIntersectionType([t.tsTypeReference(t.identifier('QueryClientParams')), t.tsTypeLiteral([t.tsPropertySignature(t.identifier('params'), t.tsTypeAnnotation(t.tsTypeReference(t.identifier('Parameters'), t.tsTypeParameterInstantiation([t.tsIndexedAccessType(t.tsTypeReference(t.identifier(QueryClient)), t.tsLiteralType(t.stringLiteral(methodName)))]))))])])])))]));
25
18
  };
26
-
27
19
  exports.createRecoilSelector = createRecoilSelector;
28
-
29
20
  var createRecoilSelectors = function createRecoilSelectors(context, keyPrefix, QueryClient, queryMsg) {
30
21
  return (0, _utils.getMessageProperties)(queryMsg).map(function (schema) {
31
22
  var underscoreName = Object.keys(schema.properties)[0];
@@ -34,9 +25,7 @@ var createRecoilSelectors = function createRecoilSelectors(context, keyPrefix, Q
34
25
  return createRecoilSelector(context, keyPrefix, QueryClient, methodName, responseType);
35
26
  });
36
27
  };
37
-
38
28
  exports.createRecoilSelectors = createRecoilSelectors;
39
-
40
29
  var createRecoilQueryClientType = function createRecoilQueryClientType() {
41
30
  return {
42
31
  "type": "TSTypeAliasDeclaration",
@@ -63,13 +52,10 @@ var createRecoilQueryClientType = function createRecoilQueryClientType() {
63
52
  }
64
53
  };
65
54
  };
66
-
67
55
  exports.createRecoilQueryClientType = createRecoilQueryClientType;
68
-
69
56
  var createRecoilQueryClient = function createRecoilQueryClient(context, keyPrefix, QueryClient) {
70
57
  context.addUtil('selectorFamily');
71
58
  var getterKey = (0, _case.camel)("".concat(keyPrefix, 'QueryClient'));
72
59
  return t.exportNamedDeclaration(t.variableDeclaration('const', [t.variableDeclarator(t.identifier('queryClient'), (0, _utils.callExpression)(t.identifier('selectorFamily'), [t.objectExpression([t.objectProperty(t.identifier('key'), t.stringLiteral(getterKey)), t.objectProperty(t.identifier('get'), t.arrowFunctionExpression([t.objectPattern([t.objectProperty(t.identifier('contractAddress'), t.identifier('contractAddress'), false, true)])], t.arrowFunctionExpression([t.objectPattern([t.objectProperty(t.identifier('get'), t.identifier('get'), false, true)])], t.blockStatement([t.variableDeclaration('const', [t.variableDeclarator(t.identifier('client'), t.callExpression(t.identifier('get'), [t.identifier('cosmWasmClient')]))]), t.returnStatement(t.newExpression(t.identifier(QueryClient), [t.identifier('client'), t.identifier('contractAddress')]))]), false)))])], t.tsTypeParameterInstantiation([t.tsTypeReference(t.identifier(QueryClient)), t.tsTypeReference(t.identifier('QueryClientParams'))])))]));
73
60
  };
74
-
75
61
  exports.createRecoilQueryClient = createRecoilQueryClient;