wasm-ast-types 0.15.0 → 0.17.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.
@@ -184,20 +184,23 @@ exports.createReactQueryHook = createReactQueryHook;
|
|
184
184
|
/**
|
185
185
|
* Example:
|
186
186
|
```
|
187
|
-
export interface
|
188
|
-
client:
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
}
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
187
|
+
export interface Cw721RevokeMutation {
|
188
|
+
client: Cw721Client;
|
189
|
+
msg: {
|
190
|
+
spender: string;
|
191
|
+
tokenId: string;
|
192
|
+
};
|
193
|
+
args?: {
|
194
|
+
fee?: number | StdFee | "auto";
|
195
|
+
memo?: string;
|
196
|
+
funds?: Coin[];
|
197
|
+
};
|
197
198
|
}
|
198
199
|
```
|
199
200
|
*/
|
200
201
|
var createReactQueryMutationArgsInterface = function createReactQueryMutationArgsInterface(_ref4) {
|
202
|
+
var _createTypedObjectPar;
|
203
|
+
|
201
204
|
var context = _ref4.context,
|
202
205
|
ExecuteClient = _ref4.ExecuteClient,
|
203
206
|
mutationHookParamsTypeName = _ref4.mutationHookParamsTypeName,
|
@@ -205,15 +208,15 @@ var createReactQueryMutationArgsInterface = function createReactQueryMutationArg
|
|
205
208
|
jsonschema = _ref4.jsonschema;
|
206
209
|
var typedUseMutationOptions = t.tsTypeReference(t.identifier('UseMutationOptions'), useMutationTypeParameter);
|
207
210
|
var body = [(0, _utils.tsPropertySignature)(t.identifier('client'), t.tsTypeAnnotation(t.tsTypeReference(t.identifier(ExecuteClient))), false)];
|
208
|
-
var msgType = (0,
|
211
|
+
var msgType = (_createTypedObjectPar = (0, _utils.createTypedObjectParams)(context, jsonschema)) === null || _createTypedObjectPar === void 0 ? void 0 : _createTypedObjectPar.typeAnnotation;
|
209
212
|
|
210
213
|
if (msgType) {
|
211
|
-
body.push(t.tsPropertySignature(t.identifier('msg'),
|
214
|
+
body.push(t.tsPropertySignature(t.identifier('msg'), // @ts-ignore
|
215
|
+
msgType));
|
212
216
|
}
|
213
217
|
|
214
218
|
context.addUtil('StdFee');
|
215
|
-
context.addUtil('Coin');
|
216
|
-
|
219
|
+
context.addUtil('Coin');
|
217
220
|
var optionalArgs = t.tsPropertySignature(t.identifier('args'), t.tsTypeAnnotation( // @ts-ignore:next-line
|
218
221
|
t.tsTypeLiteral(_client.FIXED_EXECUTE_PARAMS.map(function (param) {
|
219
222
|
return (0, _babel.propertySignature)(param.name, // @ts-ignore:next-line
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import * as t from '@babel/types';
|
2
2
|
import { camel, pascal } from 'case';
|
3
|
-
import { callExpression, getMessageProperties, identifier, tsObjectPattern, tsPropertySignature } from '../utils';
|
3
|
+
import { callExpression, createTypedObjectParams, getMessageProperties, identifier, tsObjectPattern, tsPropertySignature } from '../utils';
|
4
4
|
import { omitTypeReference, optionalConditionalExpression, propertySignature, shorthandProperty } from '../utils/babel';
|
5
|
-
import {
|
5
|
+
import { getPropertyType, getResponseType } from '../utils/types';
|
6
6
|
import { FIXED_EXECUTE_PARAMS } from '../client';
|
7
7
|
export const createReactQueryHooks = ({
|
8
8
|
context,
|
@@ -154,16 +154,17 @@ export const createReactQueryHook = ({
|
|
154
154
|
/**
|
155
155
|
* Example:
|
156
156
|
```
|
157
|
-
export interface
|
158
|
-
client:
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
}
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
157
|
+
export interface Cw721RevokeMutation {
|
158
|
+
client: Cw721Client;
|
159
|
+
msg: {
|
160
|
+
spender: string;
|
161
|
+
tokenId: string;
|
162
|
+
};
|
163
|
+
args?: {
|
164
|
+
fee?: number | StdFee | "auto";
|
165
|
+
memo?: string;
|
166
|
+
funds?: Coin[];
|
167
|
+
};
|
167
168
|
}
|
168
169
|
```
|
169
170
|
*/
|
@@ -176,15 +177,15 @@ export const createReactQueryMutationArgsInterface = ({
|
|
176
177
|
}) => {
|
177
178
|
const typedUseMutationOptions = t.tsTypeReference(t.identifier('UseMutationOptions'), useMutationTypeParameter);
|
178
179
|
const body = [tsPropertySignature(t.identifier('client'), t.tsTypeAnnotation(t.tsTypeReference(t.identifier(ExecuteClient))), false)];
|
179
|
-
const msgType =
|
180
|
+
const msgType = createTypedObjectParams(context, jsonschema)?.typeAnnotation;
|
180
181
|
|
181
182
|
if (msgType) {
|
182
|
-
body.push(t.tsPropertySignature(t.identifier('msg'),
|
183
|
+
body.push(t.tsPropertySignature(t.identifier('msg'), // @ts-ignore
|
184
|
+
msgType));
|
183
185
|
}
|
184
186
|
|
185
187
|
context.addUtil('StdFee');
|
186
|
-
context.addUtil('Coin');
|
187
|
-
|
188
|
+
context.addUtil('Coin');
|
188
189
|
const optionalArgs = t.tsPropertySignature(t.identifier('args'), t.tsTypeAnnotation( // @ts-ignore:next-line
|
189
190
|
t.tsTypeLiteral(FIXED_EXECUTE_PARAMS.map(param => propertySignature(param.name, // @ts-ignore:next-line
|
190
191
|
param.typeAnnotation, param.optional)))));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "wasm-ast-types",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.17.0",
|
4
4
|
"description": "CosmWasm TypeScript AST generation",
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
6
6
|
"homepage": "https://github.com/pyramation/cosmwasm-typescript-gen/tree/master/packages/wasm-ast-types#readme",
|
@@ -88,5 +88,5 @@
|
|
88
88
|
"case": "1.6.3",
|
89
89
|
"deepmerge": "4.2.2"
|
90
90
|
},
|
91
|
-
"gitHead": "
|
91
|
+
"gitHead": "cffa2acebb86f3c1f96fb00c4abae5ba0987e63e"
|
92
92
|
}
|
@@ -1149,7 +1149,12 @@ export function useSg721BurnMutation(options?: Omit<UseMutationOptions<ExecuteRe
|
|
1149
1149
|
}
|
1150
1150
|
export interface Sg721MintMutation {
|
1151
1151
|
client: Sg721Client;
|
1152
|
-
msg:
|
1152
|
+
msg: {
|
1153
|
+
extension: Empty;
|
1154
|
+
owner: string;
|
1155
|
+
tokenId: string;
|
1156
|
+
tokenUri?: string;
|
1157
|
+
};
|
1153
1158
|
args?: {
|
1154
1159
|
fee?: number | StdFee | \\"auto\\";
|
1155
1160
|
memo?: string;
|
@@ -4,11 +4,13 @@ import { camel, pascal } from 'case';
|
|
4
4
|
import { ExecuteMsg, QueryMsg } from '../types';
|
5
5
|
import {
|
6
6
|
callExpression,
|
7
|
+
createTypedObjectParams,
|
7
8
|
getMessageProperties,
|
8
9
|
identifier,
|
9
10
|
tsObjectPattern,
|
10
11
|
tsPropertySignature
|
11
12
|
} from '../utils';
|
13
|
+
|
12
14
|
import {
|
13
15
|
omitTypeReference,
|
14
16
|
optionalConditionalExpression,
|
@@ -371,16 +373,17 @@ interface ReactQueryMutationHookInterface {
|
|
371
373
|
/**
|
372
374
|
* Example:
|
373
375
|
```
|
374
|
-
export interface
|
375
|
-
client:
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
}
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
376
|
+
export interface Cw721RevokeMutation {
|
377
|
+
client: Cw721Client;
|
378
|
+
msg: {
|
379
|
+
spender: string;
|
380
|
+
tokenId: string;
|
381
|
+
};
|
382
|
+
args?: {
|
383
|
+
fee?: number | StdFee | "auto";
|
384
|
+
memo?: string;
|
385
|
+
funds?: Coin[];
|
386
|
+
};
|
384
387
|
}
|
385
388
|
```
|
386
389
|
*/
|
@@ -404,18 +407,19 @@ export const createReactQueryMutationArgsInterface = ({
|
|
404
407
|
)
|
405
408
|
];
|
406
409
|
|
407
|
-
const msgType
|
408
|
-
context,
|
409
|
-
jsonschema
|
410
|
-
);
|
410
|
+
const msgType = createTypedObjectParams(context, jsonschema)?.typeAnnotation
|
411
411
|
|
412
412
|
if (msgType) {
|
413
|
-
body.push(
|
413
|
+
body.push(
|
414
|
+
t.tsPropertySignature(
|
415
|
+
t.identifier('msg'),
|
416
|
+
// @ts-ignore
|
417
|
+
msgType
|
418
|
+
));
|
414
419
|
}
|
415
420
|
|
416
421
|
context.addUtil('StdFee');
|
417
422
|
context.addUtil('Coin');
|
418
|
-
// fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]
|
419
423
|
|
420
424
|
const optionalArgs = t.tsPropertySignature(
|
421
425
|
t.identifier('args'),
|