wasm-ast-types 0.0.5 → 0.0.8
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 +10 -3
- package/module/wasm.js +10 -3
- package/package.json +5 -5
package/main/wasm.js
CHANGED
@@ -213,13 +213,20 @@ var createExecuteClass = function createExecuteClass(className, implementsClassN
|
|
213
213
|
var methods = execMsg.oneOf.map(function (schema) {
|
214
214
|
return createWasmExecMethod(schema);
|
215
215
|
});
|
216
|
+
var blockStmt = [];
|
217
|
+
|
218
|
+
if (extendsClassName) {
|
219
|
+
blockStmt.push( // super()
|
220
|
+
t.expressionStatement(t.callExpression(t["super"](), [t.identifier('client'), t.identifier('contractAddress')])));
|
221
|
+
}
|
222
|
+
|
223
|
+
[].push.apply(blockStmt, [// client/contract set
|
224
|
+
t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('client')), t.identifier('client'))), t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('sender')), t.identifier('sender'))), t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('contractAddress')), t.identifier('contractAddress')))].concat((0, _toConsumableArray2["default"])(bindings)));
|
216
225
|
return t.exportNamedDeclaration((0, _utils.classDeclaration)(className, [// client
|
217
226
|
(0, _utils.classProperty)('client', t.tsTypeAnnotation(t.tsTypeReference(t.identifier('SigningCosmWasmClient')))), // sender
|
218
227
|
(0, _utils.classProperty)('sender', t.tsTypeAnnotation(t.tsStringKeyword())), // contractAddress
|
219
228
|
(0, _utils.classProperty)('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword())), // constructor
|
220
|
-
t.classMethod('constructor', t.identifier('constructor'), [(0, _utils.typedIdentifier)('client', t.tsTypeAnnotation(t.tsTypeReference(t.identifier('SigningCosmWasmClient')))), (0, _utils.typedIdentifier)('sender', t.tsTypeAnnotation(t.tsStringKeyword())), (0, _utils.typedIdentifier)('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword()))], t.blockStatement([
|
221
|
-
t.expressionStatement(t.callExpression(t["super"](), [t.identifier('client'), t.identifier('contractAddress')])), // client/contract set
|
222
|
-
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));
|
229
|
+
t.classMethod('constructor', t.identifier('constructor'), [(0, _utils.typedIdentifier)('client', t.tsTypeAnnotation(t.tsTypeReference(t.identifier('SigningCosmWasmClient')))), (0, _utils.typedIdentifier)('sender', t.tsTypeAnnotation(t.tsStringKeyword())), (0, _utils.typedIdentifier)('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword()))], t.blockStatement(blockStmt))].concat((0, _toConsumableArray2["default"])(methods)), [t.tSExpressionWithTypeArguments(t.identifier(implementsClassName))], extendsClassName ? t.identifier(extendsClassName) : null));
|
223
230
|
};
|
224
231
|
|
225
232
|
exports.createExecuteClass = createExecuteClass;
|
package/module/wasm.js
CHANGED
@@ -166,13 +166,20 @@ export const createExecuteClass = (className, implementsClassName, extendsClassN
|
|
166
166
|
const methods = execMsg.oneOf.map(schema => {
|
167
167
|
return createWasmExecMethod(schema);
|
168
168
|
});
|
169
|
+
const blockStmt = [];
|
170
|
+
|
171
|
+
if (extendsClassName) {
|
172
|
+
blockStmt.push( // super()
|
173
|
+
t.expressionStatement(t.callExpression(t.super(), [t.identifier('client'), t.identifier('contractAddress')])));
|
174
|
+
}
|
175
|
+
|
176
|
+
[].push.apply(blockStmt, [// client/contract set
|
177
|
+
t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('client')), t.identifier('client'))), t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('sender')), t.identifier('sender'))), t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.thisExpression(), t.identifier('contractAddress')), t.identifier('contractAddress'))), ...bindings]);
|
169
178
|
return t.exportNamedDeclaration(classDeclaration(className, [// client
|
170
179
|
classProperty('client', t.tsTypeAnnotation(t.tsTypeReference(t.identifier('SigningCosmWasmClient')))), // sender
|
171
180
|
classProperty('sender', t.tsTypeAnnotation(t.tsStringKeyword())), // contractAddress
|
172
181
|
classProperty('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword())), // constructor
|
173
|
-
t.classMethod('constructor', t.identifier('constructor'), [typedIdentifier('client', t.tsTypeAnnotation(t.tsTypeReference(t.identifier('SigningCosmWasmClient')))), typedIdentifier('sender', t.tsTypeAnnotation(t.tsStringKeyword())), typedIdentifier('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword()))], t.blockStatement([
|
174
|
-
t.expressionStatement(t.callExpression(t.super(), [t.identifier('client'), t.identifier('contractAddress')])), // client/contract set
|
175
|
-
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));
|
182
|
+
t.classMethod('constructor', t.identifier('constructor'), [typedIdentifier('client', t.tsTypeAnnotation(t.tsTypeReference(t.identifier('SigningCosmWasmClient')))), typedIdentifier('sender', t.tsTypeAnnotation(t.tsStringKeyword())), typedIdentifier('contractAddress', t.tsTypeAnnotation(t.tsStringKeyword()))], t.blockStatement(blockStmt)), ...methods], [t.tSExpressionWithTypeArguments(t.identifier(implementsClassName))], extendsClassName ? t.identifier(extendsClassName) : null));
|
176
183
|
};
|
177
184
|
export const createExecuteInterface = (className, extendsClassName, execMsg) => {
|
178
185
|
const methods = execMsg.oneOf.map(jsonschema => {
|
package/package.json
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "wasm-ast-types",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.8",
|
4
4
|
"description": "CosmWasm TypeScript AST generation",
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
6
|
-
"homepage": "https://github.com/pyramation/
|
6
|
+
"homepage": "https://github.com/pyramation/cosmwasm-typescript-gen/tree/master/packages/wasm-ast-types#readme",
|
7
7
|
"license": "SEE LICENSE IN LICENSE",
|
8
8
|
"main": "main/index.js",
|
9
9
|
"module": "module/index.js",
|
@@ -42,11 +42,11 @@
|
|
42
42
|
},
|
43
43
|
"repository": {
|
44
44
|
"type": "git",
|
45
|
-
"url": "https://github.com/pyramation/
|
45
|
+
"url": "https://github.com/pyramation/cosmwasm-typescript-gen/tree/master/packages/wasm-ast-types"
|
46
46
|
},
|
47
47
|
"keywords": [],
|
48
48
|
"bugs": {
|
49
|
-
"url": "https://github.com/pyramation/
|
49
|
+
"url": "https://github.com/pyramation/cosmwasm-typescript-gen/tree/master/packages/wasm-ast-types/issues"
|
50
50
|
},
|
51
51
|
"devDependencies": {
|
52
52
|
"@babel/cli": "7.17.6",
|
@@ -85,5 +85,5 @@
|
|
85
85
|
"ast-stringify": "0.1.0",
|
86
86
|
"case": "1.6.3"
|
87
87
|
},
|
88
|
-
"gitHead": "
|
88
|
+
"gitHead": "f3aed801c61181b4592442cbf0be24c5a7322e5b"
|
89
89
|
}
|