wasm-ast-types 0.2.2 → 0.2.3

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/wasm.js CHANGED
@@ -206,7 +206,7 @@ var createWasmExecMethod = function createWasmExecMethod(jsonschema) {
206
206
  var args = Object.keys(properties).map(function (prop) {
207
207
  return t.objectProperty(t.identifier(prop), t.identifier((0, _case.camel)(prop)), false, prop === (0, _case.camel)(prop));
208
208
  });
209
- var constantParams = [t.assignmentPattern(identifier('fee', t.tsTypeAnnotation(t.tsUnionType([t.tSNumberKeyword(), t.tsTypeReference(t.identifier('StdFee'))])), false), t.stringLiteral('auto')), identifier('memo', t.tsTypeAnnotation(t.tsStringKeyword()), true), identifier('funds', t.tsTypeAnnotation(tsTypeOperator(t.tsArrayType(t.tsTypeReference(t.identifier('Coin'))), 'readonly')), true)];
209
+ var constantParams = [t.assignmentPattern(identifier('fee', t.tsTypeAnnotation(t.tsUnionType([t.tSNumberKeyword(), t.tsTypeReference(t.identifier('StdFee')), t.tsLiteralType(t.stringLiteral('auto'))])), false), t.stringLiteral('auto')), identifier('memo', t.tsTypeAnnotation(t.tsStringKeyword()), true), identifier('funds', t.tsTypeAnnotation(tsTypeOperator(t.tsArrayType(t.tsTypeReference(t.identifier('Coin'))), 'readonly')), true)];
210
210
  return t.classProperty(t.identifier(methodName), (0, _utils.arrowFunctionExpression)(obj ? [// props
211
211
  obj].concat(constantParams) : constantParams, t.blockStatement([t.returnStatement(t.awaitExpression(t.callExpression(t.memberExpression(t.memberExpression(t.thisExpression(), t.identifier('client')), t.identifier('execute')), [t.memberExpression(t.thisExpression(), t.identifier('sender')), t.memberExpression(t.thisExpression(), t.identifier('contractAddress')), t.objectExpression([t.objectProperty(t.identifier(underscoreName), t.objectExpression((0, _toConsumableArray2["default"])(args)))]), t.identifier('fee'), t.identifier('memo'), t.identifier('funds')])))]), // return type
212
212
  t.tsTypeAnnotation(t.tsTypeReference(t.identifier('Promise'), t.tsTypeParameterInstantiation([t.tSTypeReference(t.identifier('ExecuteResult'))]))), true));
@@ -329,7 +329,6 @@ var createQueryInterface = function createQueryInterface(className, queryMsg) {
329
329
  var underscoreName = Object.keys(jsonschema.properties)[0];
330
330
  var methodName = (0, _case.camel)(underscoreName);
331
331
  var responseType = (0, _case.pascal)("".concat(methodName, "Response"));
332
- var obj = createTypedObjectParams(jsonschema.properties[underscoreName]);
333
332
  return createPropertyFunctionWithObjectParams(methodName, responseType, jsonschema.properties[underscoreName]);
334
333
  });
335
334
  return t.exportNamedDeclaration(t.tsInterfaceDeclaration(t.identifier(className), null, [], t.tSInterfaceBody([t.tSPropertySignature(t.identifier('contractAddress'), t.tsTypeAnnotation(t.tsStringKeyword()))].concat((0, _toConsumableArray2["default"])(methods)))));
package/module/wasm.js CHANGED
@@ -160,7 +160,7 @@ export const createWasmExecMethod = jsonschema => {
160
160
  const args = Object.keys(properties).map(prop => {
161
161
  return t.objectProperty(t.identifier(prop), t.identifier(camel(prop)), false, prop === camel(prop));
162
162
  });
163
- const constantParams = [t.assignmentPattern(identifier('fee', t.tsTypeAnnotation(t.tsUnionType([t.tSNumberKeyword(), t.tsTypeReference(t.identifier('StdFee'))])), false), t.stringLiteral('auto')), identifier('memo', t.tsTypeAnnotation(t.tsStringKeyword()), true), identifier('funds', t.tsTypeAnnotation(tsTypeOperator(t.tsArrayType(t.tsTypeReference(t.identifier('Coin'))), 'readonly')), true)];
163
+ const constantParams = [t.assignmentPattern(identifier('fee', t.tsTypeAnnotation(t.tsUnionType([t.tSNumberKeyword(), t.tsTypeReference(t.identifier('StdFee')), t.tsLiteralType(t.stringLiteral('auto'))])), false), t.stringLiteral('auto')), identifier('memo', t.tsTypeAnnotation(t.tsStringKeyword()), true), identifier('funds', t.tsTypeAnnotation(tsTypeOperator(t.tsArrayType(t.tsTypeReference(t.identifier('Coin'))), 'readonly')), true)];
164
164
  return t.classProperty(t.identifier(methodName), arrowFunctionExpression(obj ? [// props
165
165
  obj, ...constantParams] : constantParams, t.blockStatement([t.returnStatement(t.awaitExpression(t.callExpression(t.memberExpression(t.memberExpression(t.thisExpression(), t.identifier('client')), t.identifier('execute')), [t.memberExpression(t.thisExpression(), t.identifier('sender')), t.memberExpression(t.thisExpression(), t.identifier('contractAddress')), t.objectExpression([t.objectProperty(t.identifier(underscoreName), t.objectExpression([...args]))]), t.identifier('fee'), t.identifier('memo'), t.identifier('funds')])))]), // return type
166
166
  t.tsTypeAnnotation(t.tsTypeReference(t.identifier('Promise'), t.tsTypeParameterInstantiation([t.tSTypeReference(t.identifier('ExecuteResult'))]))), true));
@@ -195,47 +195,7 @@ export const createExecuteInterface = (className, extendsClassName, execMsg) =>
195
195
  const extendsAst = extendsClassName ? [t.tSExpressionWithTypeArguments(t.identifier(extendsClassName))] : [];
196
196
  return t.exportNamedDeclaration(t.tsInterfaceDeclaration(t.identifier(className), null, extendsAst, t.tSInterfaceBody([// contract address
197
197
  t.tSPropertySignature(t.identifier('contractAddress'), t.tsTypeAnnotation(t.tsStringKeyword())), // contract address
198
- t.tSPropertySignature(t.identifier('sender'), t.tsTypeAnnotation(t.tsStringKeyword())), ...methods // // fee
199
- // t.tSPropertySignature(
200
- // t.identifier('fee'),
201
- // t.tsTypeAnnotation(
202
- // t.tsUnionType(
203
- // [
204
- // t.tsNumberKeyword(),
205
- // t.tsTypeReference(
206
- // t.identifier('StdFee')
207
- // ),
208
- // t.tsLiteralType(
209
- // t.stringLiteral('auto')
210
- // )
211
- // ]
212
- // )
213
- // )
214
- // ),
215
- // // memo
216
- // propertySignature(
217
- // 'memo',
218
- // t.tsTypeAnnotation(
219
- // t.tsStringKeyword()
220
- // ),
221
- // true
222
- // ),
223
- // // funds
224
- // propertySignature(
225
- // 'funds',
226
- // t.tsTypeAnnotation(
227
- // tsTypeOperator(
228
- // t.tsArrayType(
229
- // t.tsTypeReference(
230
- // t.identifier('Coin')
231
- // )
232
- // ),
233
- // 'readonly'
234
- // )
235
- // ),
236
- // true
237
- // )
238
- ])));
198
+ t.tSPropertySignature(t.identifier('sender'), t.tsTypeAnnotation(t.tsStringKeyword())), ...methods])));
239
199
  };
240
200
  export const propertySignature = (name, typeAnnotation, optional = false) => {
241
201
  // prop.leadingComments = [{
@@ -294,7 +254,6 @@ export const createQueryInterface = (className, queryMsg) => {
294
254
  const underscoreName = Object.keys(jsonschema.properties)[0];
295
255
  const methodName = camel(underscoreName);
296
256
  const responseType = pascal(`${methodName}Response`);
297
- const obj = createTypedObjectParams(jsonschema.properties[underscoreName]);
298
257
  return createPropertyFunctionWithObjectParams(methodName, responseType, jsonschema.properties[underscoreName]);
299
258
  });
300
259
  return t.exportNamedDeclaration(t.tsInterfaceDeclaration(t.identifier(className), null, [], t.tSInterfaceBody([t.tSPropertySignature(t.identifier('contractAddress'), t.tsTypeAnnotation(t.tsStringKeyword())), ...methods])));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wasm-ast-types",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
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": "c2a825ebda3fd8c1e2080ac9092148403460cc45"
88
+ "gitHead": "e7cd5b9e8bc60161c28db9a74f3c372ddd0fc6b1"
89
89
  }