wasm-ast-types 0.1.1 → 0.1.4

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/index.js CHANGED
@@ -28,4 +28,17 @@ Object.keys(_wasm).forEach(function (key) {
28
28
  return _wasm[key];
29
29
  }
30
30
  });
31
+ });
32
+
33
+ var _recoil = require("./recoil");
34
+
35
+ Object.keys(_recoil).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (key in exports && exports[key] === _recoil[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function get() {
41
+ return _recoil[key];
42
+ }
43
+ });
31
44
  });
package/main/recoil.js ADDED
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.createWasmRecoilMethod = exports.createRecoilSelectors = exports.createRecoilSelector = exports.createRecoilQueryClientType = exports.createRecoilQueryClient = void 0;
9
+
10
+ var t = _interopRequireWildcard(require("@babel/types"));
11
+
12
+ var _case = require("case");
13
+
14
+ var _wasm = require("./wasm");
15
+
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); }
17
+
18
+ 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
+ var createWasmRecoilMethod = function createWasmRecoilMethod(jsonschema) {
21
+ var _jsonschema$propertie;
22
+
23
+ var underscoreName = Object.keys(jsonschema.properties)[0];
24
+ var methodName = (0, _case.camel)(underscoreName);
25
+ var responseType = (0, _case.pascal)("".concat(methodName, "Response"));
26
+ var properties = (_jsonschema$propertie = jsonschema.properties[underscoreName].properties) !== null && _jsonschema$propertie !== void 0 ? _jsonschema$propertie : {};
27
+
28
+ if (Object.keys(properties).length > 0) {} else {}
29
+ };
30
+
31
+ exports.createWasmRecoilMethod = createWasmRecoilMethod;
32
+
33
+ var callExpression = function callExpression(callee, _arguments, typeParameters) {
34
+ var callExpr = t.callExpression(callee, _arguments);
35
+ callExpr.typeParameters = typeParameters;
36
+ return callExpr;
37
+ };
38
+
39
+ var createRecoilSelector = function createRecoilSelector(keyPrefix, QueryClient, methodName) {
40
+ // const propertyNames = getMessageProperties(queryMsg)
41
+ // .map(method => Object.keys(method.properties)?.[0])
42
+ // .filter(Boolean);
43
+ // const methods = getMessageProperties(queryMsg)
44
+ // .map(schema => createWasmRecoilMethod(schema))
45
+ var selectorName = (0, _case.camel)("".concat(methodName, "Selector"));
46
+ var responseType = (0, _case.pascal)("".concat(methodName, "Response"));
47
+ var getterKey = (0, _case.camel)("".concat(keyPrefix).concat((0, _case.pascal)(methodName)));
48
+ return t.exportNamedDeclaration(t.variableDeclaration('const', [t.variableDeclarator(t.identifier(selectorName), 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.ifStatement(t.unaryExpression('!', t.identifier('client')), t.returnStatement(null), null), t.returnStatement(t.awaitExpression(t.callExpression(t.memberExpression(t.identifier('client'), t.identifier(methodName)), [// t.identifier('params')
49
+ t.spreadElement(t.identifier('params'))])))]), true)))])], t.tsTypeParameterInstantiation([t.tsUnionType([t.tsTypeReference(t.identifier(responseType)), t.tsUndefinedKeyword()]), 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)))]))))])])])))]));
50
+ };
51
+
52
+ exports.createRecoilSelector = createRecoilSelector;
53
+
54
+ var createRecoilSelectors = function createRecoilSelectors(keyPrefix, QueryClient, queryMsg) {
55
+ return (0, _wasm.getMessageProperties)(queryMsg).map(function (schema) {
56
+ var underscoreName = Object.keys(schema.properties)[0];
57
+ var methodName = (0, _case.camel)(underscoreName);
58
+ return createRecoilSelector(keyPrefix, QueryClient, methodName);
59
+ });
60
+ };
61
+
62
+ exports.createRecoilSelectors = createRecoilSelectors;
63
+
64
+ var createRecoilQueryClientType = function createRecoilQueryClientType() {
65
+ return {
66
+ "type": "TSTypeAliasDeclaration",
67
+ "id": {
68
+ "type": "Identifier",
69
+ "name": "QueryClientParams"
70
+ },
71
+ "typeAnnotation": {
72
+ "type": "TSTypeLiteral",
73
+ "members": [{
74
+ "type": "TSPropertySignature",
75
+ "key": {
76
+ "type": "Identifier",
77
+ "name": "contractAddress"
78
+ },
79
+ "computed": false,
80
+ "typeAnnotation": {
81
+ "type": "TSTypeAnnotation",
82
+ "typeAnnotation": {
83
+ "type": "TSStringKeyword"
84
+ }
85
+ }
86
+ }]
87
+ }
88
+ };
89
+ };
90
+
91
+ exports.createRecoilQueryClientType = createRecoilQueryClientType;
92
+
93
+ var createRecoilQueryClient = function createRecoilQueryClient(keyPrefix, QueryClient) {
94
+ var getterKey = (0, _case.camel)("".concat(keyPrefix, 'QueryClient'));
95
+ return t.exportNamedDeclaration(t.variableDeclaration('const', [t.variableDeclarator(t.identifier('queryClient'), 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.ifStatement(t.unaryExpression('!', t.identifier('client')), t.returnStatement(null), null), t.returnStatement(t.newExpression(t.identifier(QueryClient), [t.identifier('client'), t.identifier('contractAddress')]))]), false)))])], t.tsTypeParameterInstantiation([t.tsUnionType([t.tsTypeReference(t.identifier(QueryClient)), t.tsUndefinedKeyword()]), t.tsTypeReference(t.identifier('QueryClientParams'))])))]));
96
+ };
97
+
98
+ exports.createRecoilQueryClient = createRecoilQueryClient;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ var _generator = _interopRequireDefault(require("@babel/generator"));
8
+
9
+ var t = _interopRequireWildcard(require("@babel/types"));
10
+
11
+ var _query_msg = _interopRequireDefault(require("./__fixtures__/schema/query_msg.json"));
12
+
13
+ var _recoil = require("./recoil");
14
+
15
+ 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); }
16
+
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; }
18
+
19
+ var expectCode = function expectCode(ast) {
20
+ expect((0, _generator["default"])(ast).code).toMatchSnapshot();
21
+ };
22
+
23
+ var printCode = function printCode(ast) {
24
+ console.log((0, _generator["default"])(ast).code);
25
+ };
26
+
27
+ it('selector', function () {
28
+ expectCode((0, _recoil.createRecoilSelector)('SG721', 'SG721QueryClient', 'governanceModules'));
29
+ });
30
+ it('selectors', function () {
31
+ expectCode(t.program((0, _recoil.createRecoilSelectors)('SG721', 'SG721QueryClient', _query_msg["default"])));
32
+ });
33
+ it('client', function () {
34
+ printCode((0, _recoil.createRecoilQueryClient)('SG721', 'SG721QueryClient'));
35
+ });
package/main/wasm.js CHANGED
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports.propertySignature = exports.createWasmQueryMethod = exports.createWasmExecMethod = exports.createTypedObjectParams = exports.createTypeOrInterface = exports.createTypeInterface = exports.createQueryInterface = exports.createQueryClass = exports.createPropertyFunctionWithObjectParams = exports.createExecuteInterface = exports.createExecuteClass = void 0;
10
+ exports.propertySignature = exports.getMessageProperties = exports.createWasmQueryMethod = exports.createWasmExecMethod = exports.createTypedObjectParams = exports.createTypeOrInterface = exports.createTypeInterface = exports.createQueryInterface = exports.createQueryClass = exports.createPropertyFunctionWithObjectParams = exports.createExecuteInterface = exports.createExecuteClass = void 0;
11
11
 
12
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
13
 
@@ -27,9 +27,11 @@ var getMessageProperties = function getMessageProperties(msg) {
27
27
  if (msg.anyOf) return msg.anyOf;
28
28
  if (msg.oneOf) return msg.oneOf;
29
29
  if (msg.allOf) return msg.allOf;
30
- throw new Error('Message case not handled yet, contact maintainers.');
30
+ return [];
31
31
  };
32
32
 
33
+ exports.getMessageProperties = getMessageProperties;
34
+
33
35
  var getTypeFromRef = function getTypeFromRef($ref) {
34
36
  switch ($ref) {
35
37
  case '#/definitions/Binary':
package/module/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './utils';
2
- export * from './wasm';
2
+ export * from './wasm';
3
+ export * from './recoil';
@@ -0,0 +1,65 @@
1
+ import * as t from '@babel/types';
2
+ import { camel, pascal } from 'case';
3
+ import { getMessageProperties } from './wasm';
4
+ export const createWasmRecoilMethod = jsonschema => {
5
+ const underscoreName = Object.keys(jsonschema.properties)[0];
6
+ const methodName = camel(underscoreName);
7
+ const responseType = pascal(`${methodName}Response`);
8
+ const properties = jsonschema.properties[underscoreName].properties ?? {};
9
+
10
+ if (Object.keys(properties).length > 0) {} else {}
11
+ };
12
+
13
+ const callExpression = (callee, _arguments, typeParameters) => {
14
+ const callExpr = t.callExpression(callee, _arguments);
15
+ callExpr.typeParameters = typeParameters;
16
+ return callExpr;
17
+ };
18
+
19
+ export const createRecoilSelector = (keyPrefix, QueryClient, methodName) => {
20
+ // const propertyNames = getMessageProperties(queryMsg)
21
+ // .map(method => Object.keys(method.properties)?.[0])
22
+ // .filter(Boolean);
23
+ // const methods = getMessageProperties(queryMsg)
24
+ // .map(schema => createWasmRecoilMethod(schema))
25
+ const selectorName = camel(`${methodName}Selector`);
26
+ const responseType = pascal(`${methodName}Response`);
27
+ const getterKey = camel(`${keyPrefix}${pascal(methodName)}`);
28
+ return t.exportNamedDeclaration(t.variableDeclaration('const', [t.variableDeclarator(t.identifier(selectorName), 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.ifStatement(t.unaryExpression('!', t.identifier('client')), t.returnStatement(null), null), t.returnStatement(t.awaitExpression(t.callExpression(t.memberExpression(t.identifier('client'), t.identifier(methodName)), [// t.identifier('params')
29
+ t.spreadElement(t.identifier('params'))])))]), true)))])], t.tsTypeParameterInstantiation([t.tsUnionType([t.tsTypeReference(t.identifier(responseType)), t.tsUndefinedKeyword()]), 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)))]))))])])])))]));
30
+ };
31
+ export const createRecoilSelectors = (keyPrefix, QueryClient, queryMsg) => {
32
+ return getMessageProperties(queryMsg).map(schema => {
33
+ const underscoreName = Object.keys(schema.properties)[0];
34
+ const methodName = camel(underscoreName);
35
+ return createRecoilSelector(keyPrefix, QueryClient, methodName);
36
+ });
37
+ };
38
+ export const createRecoilQueryClientType = () => ({
39
+ "type": "TSTypeAliasDeclaration",
40
+ "id": {
41
+ "type": "Identifier",
42
+ "name": "QueryClientParams"
43
+ },
44
+ "typeAnnotation": {
45
+ "type": "TSTypeLiteral",
46
+ "members": [{
47
+ "type": "TSPropertySignature",
48
+ "key": {
49
+ "type": "Identifier",
50
+ "name": "contractAddress"
51
+ },
52
+ "computed": false,
53
+ "typeAnnotation": {
54
+ "type": "TSTypeAnnotation",
55
+ "typeAnnotation": {
56
+ "type": "TSStringKeyword"
57
+ }
58
+ }
59
+ }]
60
+ }
61
+ });
62
+ export const createRecoilQueryClient = (keyPrefix, QueryClient) => {
63
+ const getterKey = camel(`${keyPrefix}${'QueryClient'}`);
64
+ return t.exportNamedDeclaration(t.variableDeclaration('const', [t.variableDeclarator(t.identifier('queryClient'), 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.ifStatement(t.unaryExpression('!', t.identifier('client')), t.returnStatement(null), null), t.returnStatement(t.newExpression(t.identifier(QueryClient), [t.identifier('client'), t.identifier('contractAddress')]))]), false)))])], t.tsTypeParameterInstantiation([t.tsUnionType([t.tsTypeReference(t.identifier(QueryClient)), t.tsUndefinedKeyword()]), t.tsTypeReference(t.identifier('QueryClientParams'))])))]));
65
+ };
@@ -0,0 +1,22 @@
1
+ import generate from '@babel/generator';
2
+ import * as t from '@babel/types';
3
+ import query_msg from './__fixtures__/schema/query_msg.json';
4
+ import { createRecoilSelector, createRecoilSelectors, createRecoilQueryClient } from './recoil';
5
+
6
+ const expectCode = ast => {
7
+ expect(generate(ast).code).toMatchSnapshot();
8
+ };
9
+
10
+ const printCode = ast => {
11
+ console.log(generate(ast).code);
12
+ };
13
+
14
+ it('selector', () => {
15
+ expectCode(createRecoilSelector('SG721', 'SG721QueryClient', 'governanceModules'));
16
+ });
17
+ it('selectors', () => {
18
+ expectCode(t.program(createRecoilSelectors('SG721', 'SG721QueryClient', query_msg)));
19
+ });
20
+ it('client', () => {
21
+ printCode(createRecoilQueryClient('SG721', 'SG721QueryClient'));
22
+ });
package/module/wasm.js CHANGED
@@ -1,12 +1,11 @@
1
1
  import * as t from '@babel/types';
2
2
  import { camel, pascal } from 'case';
3
3
  import { bindMethod, typedIdentifier, promiseTypeAnnotation, classDeclaration, classProperty, arrowFunctionExpression } from './utils';
4
-
5
- const getMessageProperties = msg => {
4
+ export const getMessageProperties = msg => {
6
5
  if (msg.anyOf) return msg.anyOf;
7
6
  if (msg.oneOf) return msg.oneOf;
8
7
  if (msg.allOf) return msg.allOf;
9
- throw new Error('Message case not handled yet, contact maintainers.');
8
+ return [];
10
9
  };
11
10
 
12
11
  const getTypeFromRef = $ref => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wasm-ast-types",
3
- "version": "0.1.1",
3
+ "version": "0.1.4",
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",
@@ -85,5 +85,5 @@
85
85
  "ast-stringify": "0.1.0",
86
86
  "case": "1.6.3"
87
87
  },
88
- "gitHead": "205c770b11ce9ea868d58af0567e5ff006cc5381"
88
+ "gitHead": "57d9d1a5952b455cf73e7813724812ca54593d9c"
89
89
  }
package/types/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './types';
2
1
  export * from './utils';
3
2
  export * from './wasm';
3
+ export * from './recoil';
@@ -0,0 +1,37 @@
1
+ import * as t from '@babel/types';
2
+ interface QueryMsg {
3
+ $schema: string;
4
+ title: "QueryMsg";
5
+ oneOf?: any;
6
+ allOf?: any;
7
+ anyOf?: any;
8
+ }
9
+ export declare const createWasmRecoilMethod: (jsonschema: any) => void;
10
+ export declare const createRecoilSelector: (keyPrefix: string, QueryClient: string, methodName: string) => t.ExportNamedDeclaration;
11
+ export declare const createRecoilSelectors: (keyPrefix: string, QueryClient: string, queryMsg: QueryMsg) => any;
12
+ export declare const createRecoilQueryClientType: () => {
13
+ type: string;
14
+ id: {
15
+ type: string;
16
+ name: string;
17
+ };
18
+ typeAnnotation: {
19
+ type: string;
20
+ members: {
21
+ type: string;
22
+ key: {
23
+ type: string;
24
+ name: string;
25
+ };
26
+ computed: boolean;
27
+ typeAnnotation: {
28
+ type: string;
29
+ typeAnnotation: {
30
+ type: string;
31
+ };
32
+ };
33
+ }[];
34
+ };
35
+ };
36
+ export declare const createRecoilQueryClient: (keyPrefix: string, QueryClient: string) => t.ExportNamedDeclaration;
37
+ export {};
package/types/utils.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import * as t from '@babel/types';
2
- import { Field } from './types';
3
2
  import { TSTypeAnnotation, TSExpressionWithTypeArguments } from '@babel/types';
4
3
  export declare const bindMethod: (name: string) => t.ExpressionStatement;
5
4
  export declare const typedIdentifier: (name: string, typeAnnotation: TSTypeAnnotation, optional?: boolean) => t.Identifier;
@@ -21,9 +20,9 @@ export declare const shorthandProperty: (prop: string) => t.ObjectProperty;
21
20
  export declare const importStmt: (names: string[], path: string) => t.ImportDeclaration;
22
21
  export declare const importAminoMsg: () => t.ImportDeclaration;
23
22
  export declare const getFieldDimensionality: (field: Field) => {
24
- typeName: string;
23
+ typeName: any;
25
24
  dimensions: number;
26
- isArray: boolean;
25
+ isArray: any;
27
26
  };
28
27
  export declare const memberExpressionOrIdentifier: (names: any) => any;
29
28
  export declare const memberExpressionOrIdentifierSnake: (names: any) => any;
package/types/wasm.d.ts CHANGED
@@ -2,20 +2,32 @@ import * as t from '@babel/types';
2
2
  interface QueryMsg {
3
3
  $schema: string;
4
4
  title: "QueryMsg";
5
- oneOf: any;
5
+ oneOf?: any;
6
+ allOf?: any;
7
+ anyOf?: any;
6
8
  }
7
9
  interface ExecuteMsg {
8
10
  $schema: string;
9
11
  title: "ExecuteMsg" | "ExecuteMsg_for_Empty";
10
- oneOf: any;
12
+ oneOf?: any;
13
+ allOf?: any;
14
+ anyOf?: any;
11
15
  }
16
+ export declare const getMessageProperties: (msg: QueryMsg | ExecuteMsg) => any;
12
17
  export declare const createWasmQueryMethod: (jsonschema: any) => t.ClassProperty;
13
18
  export declare const createQueryClass: (className: string, implementsClassName: string, queryMsg: QueryMsg) => t.ExportNamedDeclaration;
14
19
  export declare const createWasmExecMethod: (jsonschema: any) => t.ClassProperty;
15
20
  export declare const createExecuteClass: (className: string, implementsClassName: string, extendsClassName: string, execMsg: ExecuteMsg) => t.ExportNamedDeclaration;
16
- export declare const createExecuteInterface: (className: string, extendsClassName: string, execMsg: ExecuteMsg) => t.ExportNamedDeclaration;
21
+ export declare const createExecuteInterface: (className: string, extendsClassName: string | null, execMsg: ExecuteMsg) => t.ExportNamedDeclaration;
22
+ export declare const propertySignature: (name: string, typeAnnotation: t.TSTypeAnnotation, optional?: boolean) => {
23
+ type: string;
24
+ key: t.Identifier;
25
+ typeAnnotation: t.TSTypeAnnotation;
26
+ optional: boolean;
27
+ };
28
+ export declare const createTypedObjectParams: (jsonschema: any, camelize?: boolean) => t.ObjectPattern;
29
+ export declare const createPropertyFunctionWithObjectParams: (methodName: string, responseType: string, jsonschema: any) => t.TSPropertySignature;
17
30
  export declare const createQueryInterface: (className: string, queryMsg: QueryMsg) => t.ExportNamedDeclaration;
18
- export declare const propertySignature: (name: string, typeAnnotation: t.TSTypeAnnotation, optional?: boolean) => t.TSPropertySignature;
19
31
  export declare const createTypeOrInterface: (Type: string, jsonschema: any) => t.ExportNamedDeclaration;
20
32
  export declare const createTypeInterface: (jsonschema: any) => t.ExportNamedDeclaration;
21
33
  export {};