wasm-ast-types 0.15.0 → 0.16.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,16 +184,17 @@ 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
|
*/
|
@@ -205,15 +206,12 @@ var createReactQueryMutationArgsInterface = function createReactQueryMutationArg
|
|
205
206
|
jsonschema = _ref4.jsonschema;
|
206
207
|
var typedUseMutationOptions = t.tsTypeReference(t.identifier('UseMutationOptions'), useMutationTypeParameter);
|
207
208
|
var body = [(0, _utils.tsPropertySignature)(t.identifier('client'), t.tsTypeAnnotation(t.tsTypeReference(t.identifier(ExecuteClient))), false)];
|
208
|
-
var msgType = (0,
|
209
|
+
var msgType = (0, _utils.createTypedObjectParams)(context, jsonschema).typeAnnotation;
|
209
210
|
|
210
211
|
if (msgType) {
|
211
212
|
body.push(t.tsPropertySignature(t.identifier('msg'), msgType));
|
212
213
|
}
|
213
214
|
|
214
|
-
context.addUtil('StdFee');
|
215
|
-
context.addUtil('Coin'); // fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]
|
216
|
-
|
217
215
|
var optionalArgs = t.tsPropertySignature(t.identifier('args'), t.tsTypeAnnotation( // @ts-ignore:next-line
|
218
216
|
t.tsTypeLiteral(_client.FIXED_EXECUTE_PARAMS.map(function (param) {
|
219
217
|
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,12 @@ 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
183
|
body.push(t.tsPropertySignature(t.identifier('msg'), msgType));
|
183
184
|
}
|
184
185
|
|
185
|
-
context.addUtil('StdFee');
|
186
|
-
context.addUtil('Coin'); // fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]
|
187
|
-
|
188
186
|
const optionalArgs = t.tsPropertySignature(t.identifier('args'), t.tsTypeAnnotation( // @ts-ignore:next-line
|
189
187
|
t.tsTypeLiteral(FIXED_EXECUTE_PARAMS.map(param => propertySignature(param.name, // @ts-ignore:next-line
|
190
188
|
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.16.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": "9724a2787e6427b62e874ece3b733b5bfa5be2af"
|
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,19 +407,16 @@ export const createReactQueryMutationArgsInterface = ({
|
|
404
407
|
)
|
405
408
|
];
|
406
409
|
|
407
|
-
const msgType
|
408
|
-
context,
|
409
|
-
jsonschema
|
410
|
-
);
|
410
|
+
const msgType = createTypedObjectParams(context, jsonschema).typeAnnotation as unknown as t.TSTypeAnnotation
|
411
411
|
|
412
412
|
if (msgType) {
|
413
|
-
body.push(
|
413
|
+
body.push(
|
414
|
+
t.tsPropertySignature(
|
415
|
+
t.identifier('msg'),
|
416
|
+
msgType
|
417
|
+
));
|
414
418
|
}
|
415
419
|
|
416
|
-
context.addUtil('StdFee');
|
417
|
-
context.addUtil('Coin');
|
418
|
-
// fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]
|
419
|
-
|
420
420
|
const optionalArgs = t.tsPropertySignature(
|
421
421
|
t.identifier('args'),
|
422
422
|
t.tsTypeAnnotation(
|