wasm-ast-types
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -209,3 +209,3 @@ "use strict"; | ||
}); | ||
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)]; | ||
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)]; | ||
return t.classProperty(t.identifier(methodName), (0, _utils.arrowFunctionExpression)(obj ? [// props | ||
@@ -333,3 +333,2 @@ 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 | ||
var responseType = (0, _case.pascal)("".concat(methodName, "Response")); | ||
var obj = createTypedObjectParams(jsonschema.properties[underscoreName]); | ||
return createPropertyFunctionWithObjectParams(methodName, responseType, jsonschema.properties[underscoreName]); | ||
@@ -336,0 +335,0 @@ }); |
@@ -163,3 +163,3 @@ import * as t from '@babel/types'; | ||
}); | ||
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)]; | ||
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)]; | ||
return t.classProperty(t.identifier(methodName), arrowFunctionExpression(obj ? [// props | ||
@@ -199,43 +199,3 @@ 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 | ||
t.tSPropertySignature(t.identifier('contractAddress'), t.tsTypeAnnotation(t.tsStringKeyword())), // contract address | ||
t.tSPropertySignature(t.identifier('sender'), t.tsTypeAnnotation(t.tsStringKeyword())), ...methods // // fee | ||
// t.tSPropertySignature( | ||
// t.identifier('fee'), | ||
// t.tsTypeAnnotation( | ||
// t.tsUnionType( | ||
// [ | ||
// t.tsNumberKeyword(), | ||
// t.tsTypeReference( | ||
// t.identifier('StdFee') | ||
// ), | ||
// t.tsLiteralType( | ||
// t.stringLiteral('auto') | ||
// ) | ||
// ] | ||
// ) | ||
// ) | ||
// ), | ||
// // memo | ||
// propertySignature( | ||
// 'memo', | ||
// t.tsTypeAnnotation( | ||
// t.tsStringKeyword() | ||
// ), | ||
// true | ||
// ), | ||
// // funds | ||
// propertySignature( | ||
// 'funds', | ||
// t.tsTypeAnnotation( | ||
// tsTypeOperator( | ||
// t.tsArrayType( | ||
// t.tsTypeReference( | ||
// t.identifier('Coin') | ||
// ) | ||
// ), | ||
// 'readonly' | ||
// ) | ||
// ), | ||
// true | ||
// ) | ||
]))); | ||
t.tSPropertySignature(t.identifier('sender'), t.tsTypeAnnotation(t.tsStringKeyword())), ...methods]))); | ||
}; | ||
@@ -299,3 +259,2 @@ export const propertySignature = (name, typeAnnotation, optional = false) => { | ||
const responseType = pascal(`${methodName}Response`); | ||
const obj = createTypedObjectParams(jsonschema.properties[underscoreName]); | ||
return createPropertyFunctionWithObjectParams(methodName, responseType, jsonschema.properties[underscoreName]); | ||
@@ -302,0 +261,0 @@ }); |
{ | ||
"name": "wasm-ast-types", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "CosmWasm TypeScript AST generation", | ||
@@ -88,3 +88,3 @@ "author": "Dan Lynch <pyramation@gmail.com>", | ||
}, | ||
"gitHead": "c2a825ebda3fd8c1e2080ac9092148403460cc45" | ||
"gitHead": "e7cd5b9e8bc60161c28db9a74f3c372ddd0fc6b1" | ||
} |
117123
1845