wasm-ast-types
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -222,3 +222,3 @@ "use strict"; | ||
t.expressionStatement(t.callExpression(t["super"](), [t.identifier('client'), t.identifier('contractAddress')])), // client/contract set | ||
t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('client')), t.identifier('client'))), t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('contractAddress')), t.identifier('contractAddress')))].concat((0, _toConsumableArray2["default"])(bindings))))].concat((0, _toConsumableArray2["default"])(methods)), [t.tSExpressionWithTypeArguments(t.identifier(implementsClassName))], t.identifier(extendsClassName))); | ||
t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('client')), t.identifier('client'))), t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('contractAddress')), t.identifier('contractAddress')))].concat((0, _toConsumableArray2["default"])(bindings))))].concat((0, _toConsumableArray2["default"])(methods)), [t.tSExpressionWithTypeArguments(t.identifier(implementsClassName))], extendsClassName ? t.identifier(extendsClassName) : null)); | ||
}; | ||
@@ -240,3 +240,4 @@ | ||
}); | ||
return t.exportNamedDeclaration(t.tsInterfaceDeclaration(t.identifier(className), null, [t.tSExpressionWithTypeArguments(t.identifier(extendsClassName))], t.tSInterfaceBody([// contract address | ||
var extendsAst = extendsClassName ? [t.tSExpressionWithTypeArguments(t.identifier(extendsClassName))] : []; | ||
return t.exportNamedDeclaration(t.tsInterfaceDeclaration(t.identifier(className), null, extendsAst, t.tSInterfaceBody([// contract address | ||
t.tSPropertySignature(t.identifier('contractAddress'), t.tsTypeAnnotation(t.tsStringKeyword())), // contract address | ||
@@ -243,0 +244,0 @@ t.tSPropertySignature(t.identifier('sender'), t.tsTypeAnnotation(t.tsStringKeyword()))].concat((0, _toConsumableArray2["default"])(methods))))); |
@@ -82,7 +82,10 @@ "use strict"; | ||
}); | ||
it('execute interfaces', function () { | ||
expectCode((0, _wasm.createExecuteInterface)('SG721Instance', 'SG721ReadOnlyInstance', _execute_msg_for__empty["default"])); | ||
it('execute classes no extends', function () { | ||
expectCode((0, _wasm.createExecuteClass)('SG721Client', 'SG721Instance', null, _execute_msg_for__empty["default"])); | ||
}); | ||
it('execute interfaces no extends', function () { | ||
expectCode((0, _wasm.createExecuteInterface)('SG721Instance', null, _execute_msg_for__empty["default"])); | ||
}); | ||
it('query interfaces', function () { | ||
expectCode((0, _wasm.createQueryInterface)('SG721ReadOnlyInstance', _query_msg["default"])); | ||
}); |
@@ -175,3 +175,3 @@ import * as t from '@babel/types'; | ||
t.expressionStatement(t.callExpression(t.super(), [t.identifier('client'), t.identifier('contractAddress')])), // client/contract set | ||
t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('client')), t.identifier('client'))), t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('contractAddress')), t.identifier('contractAddress'))), ...bindings])), ...methods], [t.tSExpressionWithTypeArguments(t.identifier(implementsClassName))], t.identifier(extendsClassName))); | ||
t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('client')), t.identifier('client'))), t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('contractAddress')), t.identifier('contractAddress'))), ...bindings])), ...methods], [t.tSExpressionWithTypeArguments(t.identifier(implementsClassName))], extendsClassName ? t.identifier(extendsClassName) : null)); | ||
}; | ||
@@ -188,3 +188,4 @@ export const createExecuteInterface = (className, extendsClassName, execMsg) => { | ||
}); | ||
return t.exportNamedDeclaration(t.tsInterfaceDeclaration(t.identifier(className), null, [t.tSExpressionWithTypeArguments(t.identifier(extendsClassName))], t.tSInterfaceBody([// contract address | ||
const extendsAst = extendsClassName ? [t.tSExpressionWithTypeArguments(t.identifier(extendsClassName))] : []; | ||
return t.exportNamedDeclaration(t.tsInterfaceDeclaration(t.identifier(className), null, extendsAst, t.tSInterfaceBody([// contract address | ||
t.tSPropertySignature(t.identifier('contractAddress'), t.tsTypeAnnotation(t.tsStringKeyword())), // contract address | ||
@@ -191,0 +192,0 @@ t.tSPropertySignature(t.identifier('sender'), t.tsTypeAnnotation(t.tsStringKeyword())), ...methods]))); |
@@ -64,7 +64,10 @@ import generate from '@babel/generator'; | ||
}); | ||
it('execute interfaces', () => { | ||
expectCode(createExecuteInterface('SG721Instance', 'SG721ReadOnlyInstance', execute_msg)); | ||
it('execute classes no extends', () => { | ||
expectCode(createExecuteClass('SG721Client', 'SG721Instance', null, execute_msg)); | ||
}); | ||
it('execute interfaces no extends', () => { | ||
expectCode(createExecuteInterface('SG721Instance', null, execute_msg)); | ||
}); | ||
it('query interfaces', () => { | ||
expectCode(createQueryInterface('SG721ReadOnlyInstance', query_msg)); | ||
}); |
{ | ||
"name": "wasm-ast-types", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "CosmWasm TypeScript AST generation", | ||
@@ -88,3 +88,3 @@ "author": "Dan Lynch <pyramation@gmail.com>", | ||
}, | ||
"gitHead": "e2b5cd65b9caf2cc9f916533bc78dded5ea32b40" | ||
"gitHead": "a326d6904c01635ce0eeedd31a600e515392dc80" | ||
} |
76267
1193