wasm-ast-types 0.21.0 → 0.23.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.
- package/main/client/client.js +4 -6
- package/main/context/imports.js +1 -1
- package/main/message-composer/message-composer.js +3 -5
- package/main/react-query/react-query.js +4 -11
- package/main/utils/babel.js +1 -0
- package/main/utils/constants.js +25 -0
- package/main/utils/index.js +22 -1
- package/module/client/client.js +3 -4
- package/module/context/imports.js +1 -1
- package/module/message-composer/message-composer.js +4 -5
- package/module/react-query/react-query.js +5 -6
- package/module/utils/babel.js +1 -0
- package/module/utils/constants.js +6 -0
- package/module/utils/index.js +3 -1
- package/package.json +2 -2
- package/src/client/client.ts +235 -323
- package/src/client/test/__snapshots__/ts-client.account-nfts.spec.ts.snap +45 -45
- package/src/client/test/__snapshots__/ts-client.arrays-ref.spec.ts.snap +42 -42
- package/src/client/test/__snapshots__/ts-client.arrays.spec.ts.snap +3 -3
- package/src/client/test/__snapshots__/ts-client.cw-named-groups.test.ts.snap +9 -9
- package/src/client/test/__snapshots__/ts-client.cw-proposal-single.test.ts.snap +27 -27
- package/src/client/test/__snapshots__/ts-client.issue-101.spec.ts.snap +6 -6
- package/src/client/test/__snapshots__/ts-client.issue-71.test.ts.snap +30 -30
- package/src/client/test/__snapshots__/ts-client.issue-98.test.ts.snap +9 -9
- package/src/client/test/__snapshots__/ts-client.issues.test.ts.snap +78 -78
- package/src/client/test/__snapshots__/ts-client.overrides.spec.ts.snap +80 -80
- package/src/client/test/__snapshots__/ts-client.sg721.spec.ts.snap +24 -24
- package/src/client/test/__snapshots__/ts-client.spec.ts.snap +46 -46
- package/src/client/test/__snapshots__/ts-client.vectis.spec.ts.snap +24 -24
- package/src/client/test/__snapshots__/ts-client.wager.spec.ts.snap +8 -8
- package/src/context/context.ts +2 -0
- package/src/context/imports.ts +1 -1
- package/src/message-composer/__snapshots__/message-composer.spec.ts.snap +30 -30
- package/src/message-composer/message-composer.ts +216 -267
- package/src/react-query/react-query.ts +28 -25
- package/src/utils/babel.ts +4 -3
- package/src/utils/constants.ts +30 -0
- package/src/utils/index.ts +2 -0
- package/types/context/context.d.ts +2 -0
@@ -1,313 +1,262 @@
|
|
1
1
|
import * as t from '@babel/types';
|
2
|
+
import { Expression } from '@babel/types';
|
2
3
|
import { camel } from 'case';
|
3
4
|
import {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
arrowFunctionExpression,
|
6
|
+
bindMethod,
|
7
|
+
classDeclaration,
|
8
|
+
classProperty,
|
9
|
+
getMessageProperties,
|
10
|
+
OPTIONAL_FUNDS_PARAM,
|
11
|
+
typedIdentifier
|
12
|
+
} from '../utils';
|
13
|
+
import { ExecuteMsg, JSONSchema } from '../types';
|
12
14
|
import { createTypedObjectParams } from '../utils/types';
|
13
|
-
import { JSONSchema } from '../types';
|
14
15
|
import { RenderContext } from '../context';
|
15
|
-
import { identifier } from '../utils/babel';
|
16
16
|
import { getWasmMethodArgs } from '../client/client';
|
17
|
-
import { Expression } from '@babel/types';
|
18
17
|
|
19
18
|
const createWasmExecMethodMessageComposer = (
|
20
|
-
|
21
|
-
|
19
|
+
context: RenderContext,
|
20
|
+
jsonschema: any
|
22
21
|
) => {
|
22
|
+
context.addUtil('Coin');
|
23
|
+
context.addUtil('MsgExecuteContractEncodeObject');
|
24
|
+
context.addUtil('MsgExecuteContract');
|
25
|
+
context.addUtil('toUtf8');
|
23
26
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
context
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
jsonschema.properties[underscoreName]
|
35
|
-
);
|
27
|
+
const underscoreName = Object.keys(jsonschema.properties)[0];
|
28
|
+
const methodName = camel(underscoreName);
|
29
|
+
const param = createTypedObjectParams(
|
30
|
+
context,
|
31
|
+
jsonschema.properties[underscoreName]
|
32
|
+
);
|
33
|
+
const args = getWasmMethodArgs(
|
34
|
+
context,
|
35
|
+
jsonschema.properties[underscoreName]
|
36
|
+
);
|
36
37
|
|
37
38
|
// what the underscore named property in the message is assigned to
|
38
|
-
let actionValue: Expression
|
39
|
+
let actionValue: Expression;
|
39
40
|
if (param?.type === 'Identifier') {
|
40
41
|
actionValue = t.identifier(param.name);
|
41
42
|
} else {
|
42
|
-
actionValue = t.objectExpression(args)
|
43
|
+
actionValue = t.objectExpression(args);
|
43
44
|
}
|
44
45
|
|
45
|
-
|
46
|
-
identifier('funds', t.tsTypeAnnotation(
|
47
|
-
t.tsArrayType(
|
48
|
-
t.tsTypeReference(
|
49
|
-
t.identifier('Coin')
|
50
|
-
)
|
51
|
-
)
|
52
|
-
), true)
|
53
|
-
];
|
46
|
+
const constantParams = [OPTIONAL_FUNDS_PARAM];
|
54
47
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
48
|
+
return t.classProperty(
|
49
|
+
t.identifier(methodName),
|
50
|
+
arrowFunctionExpression(
|
51
|
+
param
|
52
|
+
? [
|
53
|
+
// props
|
54
|
+
param,
|
55
|
+
...constantParams
|
56
|
+
]
|
57
|
+
: constantParams,
|
58
|
+
t.blockStatement([
|
59
|
+
t.returnStatement(
|
60
|
+
t.objectExpression([
|
61
|
+
t.objectProperty(
|
62
|
+
t.identifier('typeUrl'),
|
63
|
+
t.stringLiteral('/cosmwasm.wasm.v1.MsgExecuteContract')
|
64
|
+
),
|
65
|
+
t.objectProperty(
|
66
|
+
t.identifier('value'),
|
67
|
+
t.callExpression(
|
68
|
+
t.memberExpression(
|
69
|
+
t.identifier('MsgExecuteContract'),
|
70
|
+
t.identifier('fromPartial')
|
71
|
+
),
|
64
72
|
[
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
t.identifier('JSON'),
|
103
|
-
t.identifier('stringify')
|
104
|
-
),
|
105
|
-
[
|
106
|
-
t.objectExpression(
|
107
|
-
[
|
108
|
-
t.objectProperty(
|
109
|
-
t.identifier(underscoreName), actionValue
|
110
|
-
)
|
111
|
-
]
|
112
|
-
|
113
|
-
)
|
114
|
-
]
|
115
|
-
)
|
116
|
-
]
|
117
|
-
)
|
118
|
-
),
|
119
|
-
t.objectProperty(
|
120
|
-
t.identifier('funds'),
|
121
|
-
t.identifier('funds'),
|
122
|
-
false,
|
123
|
-
true
|
124
|
-
),
|
125
|
-
])
|
126
|
-
]
|
127
|
-
)
|
128
|
-
)
|
129
|
-
])
|
73
|
+
t.objectExpression([
|
74
|
+
t.objectProperty(
|
75
|
+
t.identifier('sender'),
|
76
|
+
t.memberExpression(
|
77
|
+
t.thisExpression(),
|
78
|
+
t.identifier('sender')
|
79
|
+
)
|
80
|
+
),
|
81
|
+
t.objectProperty(
|
82
|
+
t.identifier('contract'),
|
83
|
+
t.memberExpression(
|
84
|
+
t.thisExpression(),
|
85
|
+
t.identifier('contractAddress')
|
86
|
+
)
|
87
|
+
),
|
88
|
+
t.objectProperty(
|
89
|
+
t.identifier('msg'),
|
90
|
+
t.callExpression(t.identifier('toUtf8'), [
|
91
|
+
t.callExpression(
|
92
|
+
t.memberExpression(
|
93
|
+
t.identifier('JSON'),
|
94
|
+
t.identifier('stringify')
|
95
|
+
),
|
96
|
+
[
|
97
|
+
t.objectExpression([
|
98
|
+
t.objectProperty(
|
99
|
+
t.identifier(underscoreName),
|
100
|
+
actionValue
|
101
|
+
)
|
102
|
+
])
|
103
|
+
]
|
104
|
+
)
|
105
|
+
])
|
106
|
+
),
|
107
|
+
t.objectProperty(
|
108
|
+
t.identifier('funds'),
|
109
|
+
t.identifier('_funds')
|
130
110
|
)
|
111
|
+
])
|
131
112
|
]
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
t.tsTypeReference(
|
136
|
-
t.identifier('MsgExecuteContractEncodeObject')
|
137
|
-
)
|
138
|
-
),
|
139
|
-
false
|
113
|
+
)
|
114
|
+
)
|
115
|
+
])
|
140
116
|
)
|
141
|
-
|
142
|
-
|
143
|
-
|
117
|
+
]),
|
118
|
+
// return type
|
119
|
+
t.tsTypeAnnotation(
|
120
|
+
t.tsTypeReference(t.identifier('MsgExecuteContractEncodeObject'))
|
121
|
+
),
|
122
|
+
false
|
123
|
+
)
|
124
|
+
);
|
125
|
+
};
|
144
126
|
|
145
127
|
export const createMessageComposerClass = (
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
128
|
+
context: RenderContext,
|
129
|
+
className: string,
|
130
|
+
implementsClassName: string,
|
131
|
+
execMsg: ExecuteMsg
|
150
132
|
) => {
|
133
|
+
const propertyNames = getMessageProperties(execMsg)
|
134
|
+
.map((method) => Object.keys(method.properties)?.[0])
|
135
|
+
.filter(Boolean);
|
151
136
|
|
152
|
-
|
153
|
-
.map(method => Object.keys(method.properties)?.[0])
|
154
|
-
.filter(Boolean);
|
137
|
+
const bindings = propertyNames.map(camel).map(bindMethod);
|
155
138
|
|
156
|
-
|
157
|
-
|
158
|
-
|
139
|
+
const methods = getMessageProperties(execMsg).map((schema) => {
|
140
|
+
return createWasmExecMethodMessageComposer(context, schema);
|
141
|
+
});
|
159
142
|
|
160
|
-
|
161
|
-
.map(schema => {
|
162
|
-
return createWasmExecMethodMessageComposer(context, schema)
|
163
|
-
});
|
143
|
+
const blockStmt = [];
|
164
144
|
|
165
|
-
|
145
|
+
[].push.apply(blockStmt, [
|
146
|
+
t.expressionStatement(
|
147
|
+
t.assignmentExpression(
|
148
|
+
'=',
|
149
|
+
t.memberExpression(t.thisExpression(), t.identifier('sender')),
|
150
|
+
t.identifier('sender')
|
151
|
+
)
|
152
|
+
),
|
153
|
+
t.expressionStatement(
|
154
|
+
t.assignmentExpression(
|
155
|
+
'=',
|
156
|
+
t.memberExpression(t.thisExpression(), t.identifier('contractAddress')),
|
157
|
+
t.identifier('contractAddress')
|
158
|
+
)
|
159
|
+
),
|
160
|
+
...bindings
|
161
|
+
]);
|
166
162
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
163
|
+
return t.exportNamedDeclaration(
|
164
|
+
classDeclaration(
|
165
|
+
className,
|
166
|
+
[
|
167
|
+
// sender
|
168
|
+
classProperty('sender', t.tsTypeAnnotation(t.tsStringKeyword())),
|
169
|
+
|
170
|
+
// contractAddress
|
171
|
+
classProperty(
|
172
|
+
'contractAddress',
|
173
|
+
t.tsTypeAnnotation(t.tsStringKeyword())
|
177
174
|
),
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
175
|
+
|
176
|
+
// constructor
|
177
|
+
t.classMethod(
|
178
|
+
'constructor',
|
179
|
+
t.identifier('constructor'),
|
180
|
+
[
|
181
|
+
typedIdentifier('sender', t.tsTypeAnnotation(t.tsStringKeyword())),
|
182
|
+
typedIdentifier(
|
183
|
+
'contractAddress',
|
184
|
+
t.tsTypeAnnotation(t.tsStringKeyword())
|
186
185
|
)
|
186
|
+
],
|
187
|
+
t.blockStatement(blockStmt)
|
187
188
|
),
|
188
|
-
...
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
classProperty('sender', t.tsTypeAnnotation(
|
196
|
-
t.tsStringKeyword()
|
197
|
-
)),
|
198
|
-
|
199
|
-
// contractAddress
|
200
|
-
classProperty('contractAddress', t.tsTypeAnnotation(
|
201
|
-
t.tsStringKeyword()
|
202
|
-
)),
|
203
|
-
|
204
|
-
// constructor
|
205
|
-
t.classMethod('constructor',
|
206
|
-
t.identifier('constructor'),
|
207
|
-
[
|
208
|
-
typedIdentifier('sender', t.tsTypeAnnotation(t.tsStringKeyword())),
|
209
|
-
typedIdentifier('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword()))
|
210
|
-
],
|
211
|
-
t.blockStatement(
|
212
|
-
blockStmt
|
213
|
-
)),
|
214
|
-
...methods
|
215
|
-
],
|
216
|
-
[
|
217
|
-
t.tSExpressionWithTypeArguments(
|
218
|
-
t.identifier(implementsClassName)
|
219
|
-
)
|
220
|
-
],
|
221
|
-
null
|
222
|
-
)
|
223
|
-
);
|
224
|
-
}
|
189
|
+
...methods
|
190
|
+
],
|
191
|
+
[t.tSExpressionWithTypeArguments(t.identifier(implementsClassName))],
|
192
|
+
null
|
193
|
+
)
|
194
|
+
);
|
195
|
+
};
|
225
196
|
|
226
197
|
export const createMessageComposerInterface = (
|
227
|
-
|
228
|
-
|
229
|
-
|
198
|
+
context: RenderContext,
|
199
|
+
className: string,
|
200
|
+
execMsg: ExecuteMsg
|
230
201
|
) => {
|
202
|
+
const methods = getMessageProperties(execMsg).map((jsonschema) => {
|
203
|
+
const underscoreName = Object.keys(jsonschema.properties)[0];
|
204
|
+
const methodName = camel(underscoreName);
|
205
|
+
return createPropertyFunctionWithObjectParamsForMessageComposer(
|
206
|
+
context,
|
207
|
+
methodName,
|
208
|
+
'MsgExecuteContractEncodeObject',
|
209
|
+
jsonschema.properties[underscoreName]
|
210
|
+
);
|
211
|
+
});
|
231
212
|
|
232
|
-
|
233
|
-
.map(jsonschema => {
|
234
|
-
const underscoreName = Object.keys(jsonschema.properties)[0];
|
235
|
-
const methodName = camel(underscoreName);
|
236
|
-
return createPropertyFunctionWithObjectParamsForMessageComposer(
|
237
|
-
context,
|
238
|
-
methodName,
|
239
|
-
'MsgExecuteContractEncodeObject',
|
240
|
-
jsonschema.properties[underscoreName]
|
241
|
-
);
|
242
|
-
});
|
243
|
-
|
244
|
-
const extendsAst = [];
|
245
|
-
|
246
|
-
return t.exportNamedDeclaration(
|
247
|
-
t.tsInterfaceDeclaration(
|
248
|
-
t.identifier(className),
|
249
|
-
null,
|
250
|
-
extendsAst,
|
251
|
-
t.tSInterfaceBody(
|
252
|
-
[
|
213
|
+
const extendsAst = [];
|
253
214
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
215
|
+
return t.exportNamedDeclaration(
|
216
|
+
t.tsInterfaceDeclaration(
|
217
|
+
t.identifier(className),
|
218
|
+
null,
|
219
|
+
extendsAst,
|
220
|
+
t.tSInterfaceBody([
|
221
|
+
// contract address
|
222
|
+
t.tSPropertySignature(
|
223
|
+
t.identifier('contractAddress'),
|
224
|
+
t.tsTypeAnnotation(t.tsStringKeyword())
|
225
|
+
),
|
261
226
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
)
|
268
|
-
),
|
227
|
+
// contract address
|
228
|
+
t.tSPropertySignature(
|
229
|
+
t.identifier('sender'),
|
230
|
+
t.tsTypeAnnotation(t.tsStringKeyword())
|
231
|
+
),
|
269
232
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
);
|
233
|
+
...methods
|
234
|
+
])
|
235
|
+
)
|
236
|
+
);
|
275
237
|
};
|
276
238
|
|
277
239
|
const createPropertyFunctionWithObjectParamsForMessageComposer = (
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
240
|
+
context: RenderContext,
|
241
|
+
methodName: string,
|
242
|
+
responseType: string,
|
243
|
+
jsonschema: JSONSchema
|
282
244
|
) => {
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
];
|
293
|
-
const func = {
|
294
|
-
type: 'TSFunctionType',
|
295
|
-
typeAnnotation: t.tsTypeAnnotation(t.tsTypeReference(
|
296
|
-
t.identifier(responseType)
|
297
|
-
)),
|
298
|
-
parameters: obj ? [
|
299
|
-
obj,
|
300
|
-
...fixedParams
|
301
|
-
|
302
|
-
] : fixedParams
|
303
|
-
}
|
245
|
+
const obj = createTypedObjectParams(context, jsonschema);
|
246
|
+
const fixedParams = [OPTIONAL_FUNDS_PARAM];
|
247
|
+
const func = {
|
248
|
+
type: 'TSFunctionType',
|
249
|
+
typeAnnotation: t.tsTypeAnnotation(
|
250
|
+
t.tsTypeReference(t.identifier(responseType))
|
251
|
+
),
|
252
|
+
parameters: obj ? [obj, ...fixedParams] : fixedParams
|
253
|
+
};
|
304
254
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
255
|
+
return t.tSPropertySignature(
|
256
|
+
t.identifier(methodName),
|
257
|
+
t.tsTypeAnnotation(
|
258
|
+
// @ts-ignore:next-line
|
259
|
+
func
|
260
|
+
)
|
261
|
+
);
|
312
262
|
};
|
313
|
-
|
@@ -5,8 +5,10 @@ import { ExecuteMsg, QueryMsg } from '../types';
|
|
5
5
|
import {
|
6
6
|
callExpression,
|
7
7
|
createTypedObjectParams,
|
8
|
+
FIXED_EXECUTE_PARAMS,
|
8
9
|
getMessageProperties,
|
9
10
|
identifier,
|
11
|
+
OPTIONAL_FUNDS_PARAM,
|
10
12
|
tsObjectPattern,
|
11
13
|
tsPropertySignature
|
12
14
|
} from '../utils';
|
@@ -24,8 +26,8 @@ import {
|
|
24
26
|
} from '../utils/types';
|
25
27
|
import { ReactQueryOptions, RenderContext } from '../context';
|
26
28
|
import { JSONSchema } from '../types';
|
27
|
-
import { FIXED_EXECUTE_PARAMS } from '../client';
|
28
29
|
import { ArrowFunctionExpression, objectExpression } from '@babel/types';
|
30
|
+
import { OPTIONAL_FEE_PARAM, OPTIONAL_MEMO_PARAM } from '../utils/constants';
|
29
31
|
|
30
32
|
interface ReactQueryHookQuery {
|
31
33
|
context: RenderContext;
|
@@ -120,7 +122,7 @@ export const createReactQueryHooks = ({
|
|
120
122
|
context,
|
121
123
|
queryFactoryName,
|
122
124
|
queryKeysName,
|
123
|
-
queryMsgs
|
125
|
+
queryMsgs
|
124
126
|
})
|
125
127
|
);
|
126
128
|
}
|
@@ -407,7 +409,7 @@ export const createReactQueryMutationArgsInterface = ({
|
|
407
409
|
)
|
408
410
|
];
|
409
411
|
|
410
|
-
const msgType = createTypedObjectParams(context, jsonschema)?.typeAnnotation
|
412
|
+
const msgType = createTypedObjectParams(context, jsonschema)?.typeAnnotation;
|
411
413
|
|
412
414
|
if (msgType) {
|
413
415
|
body.push(
|
@@ -415,7 +417,8 @@ export const createReactQueryMutationArgsInterface = ({
|
|
415
417
|
t.identifier('msg'),
|
416
418
|
// @ts-ignore
|
417
419
|
msgType
|
418
|
-
)
|
420
|
+
)
|
421
|
+
);
|
419
422
|
}
|
420
423
|
|
421
424
|
context.addUtil('StdFee');
|
@@ -425,16 +428,11 @@ export const createReactQueryMutationArgsInterface = ({
|
|
425
428
|
t.identifier('args'),
|
426
429
|
t.tsTypeAnnotation(
|
427
430
|
// @ts-ignore:next-line
|
428
|
-
t.tsTypeLiteral(
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
param.typeAnnotation,
|
434
|
-
param.optional
|
435
|
-
) as t.TSTypeElement
|
436
|
-
)
|
437
|
-
)
|
431
|
+
t.tsTypeLiteral([
|
432
|
+
propertySignature('fee', OPTIONAL_FEE_PARAM.typeAnnotation, true),
|
433
|
+
propertySignature('memo', OPTIONAL_MEMO_PARAM.typeAnnotation, true),
|
434
|
+
propertySignature('funds', OPTIONAL_FUNDS_PARAM.typeAnnotation, true)
|
435
|
+
])
|
438
436
|
)
|
439
437
|
);
|
440
438
|
|
@@ -568,9 +566,11 @@ export const createReactQueryMutationHook = ({
|
|
568
566
|
t.objectProperty(
|
569
567
|
t.identifier('args'),
|
570
568
|
t.assignmentPattern(
|
571
|
-
t.objectPattern(
|
572
|
-
|
573
|
-
|
569
|
+
t.objectPattern([
|
570
|
+
shorthandProperty('fee'),
|
571
|
+
shorthandProperty('memo'),
|
572
|
+
shorthandProperty('funds')
|
573
|
+
]),
|
574
574
|
t.objectExpression([])
|
575
575
|
)
|
576
576
|
)
|
@@ -606,11 +606,11 @@ export const createReactQueryMutationHook = ({
|
|
606
606
|
t.identifier('client'),
|
607
607
|
t.identifier(execMethodName)
|
608
608
|
),
|
609
|
-
(hasMsg ? [t.identifier('msg')] : []).concat(
|
610
|
-
|
611
|
-
|
612
|
-
)
|
613
|
-
)
|
609
|
+
(hasMsg ? [t.identifier('msg')] : []).concat([
|
610
|
+
t.identifier('fee'),
|
611
|
+
t.identifier('memo'),
|
612
|
+
t.identifier('funds')
|
613
|
+
])
|
614
614
|
),
|
615
615
|
false // not async
|
616
616
|
),
|
@@ -787,7 +787,9 @@ function createReactQueryFactory({
|
|
787
787
|
t.tsTypeReference(
|
788
788
|
t.identifier(hookParamsTypeName),
|
789
789
|
t.tsTypeParameterInstantiation([
|
790
|
-
t.tsTypeReference(
|
790
|
+
t.tsTypeReference(
|
791
|
+
t.identifier(GENERIC_SELECT_RESPONSE_NAME)
|
792
|
+
)
|
791
793
|
])
|
792
794
|
)
|
793
795
|
)
|
@@ -840,7 +842,9 @@ function createReactQueryFactory({
|
|
840
842
|
t.tsTypeParameterInstantiation([
|
841
843
|
t.tsTypeReference(t.identifier(responseType)),
|
842
844
|
t.tsTypeReference(t.identifier('Error')),
|
843
|
-
t.tsTypeReference(
|
845
|
+
t.tsTypeReference(
|
846
|
+
t.identifier(GENERIC_SELECT_RESPONSE_NAME)
|
847
|
+
)
|
844
848
|
])
|
845
849
|
)
|
846
850
|
);
|
@@ -871,7 +875,6 @@ function createReactQueryHookGenericInterface({
|
|
871
875
|
QueryClient,
|
872
876
|
genericQueryInterfaceName
|
873
877
|
}: ReactQueryHookGenericInterface) {
|
874
|
-
|
875
878
|
const options = context.options.reactQuery;
|
876
879
|
const genericResponseTypeName = 'TResponse';
|
877
880
|
|