eosio-abi2ts
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -47,3 +47,3 @@ "use strict"; | ||
const usedBuiltins = new Set(); | ||
let out = []; | ||
let out = ['']; | ||
const resolveType = (type) => { | ||
@@ -79,2 +79,3 @@ const { name, optional } = resolveOptional(type); | ||
} | ||
out.push(''); | ||
for (const variant of abi.variants || []) { | ||
@@ -84,2 +85,3 @@ const types = variant.types.map((t) => `['${t}', ${resolveType(t)}]`); | ||
} | ||
out.push(''); | ||
for (const struct of abi.structs || []) { | ||
@@ -96,8 +98,13 @@ let def = `${exportPrefix}interface ${typeFormatter(struct.name)}`; | ||
out.push('}'); | ||
out.push(''); | ||
} | ||
out.push(''); | ||
// future: add runtime and define interfaces for | ||
// interacting with actions and tables | ||
for (const type of [...usedBuiltins].sort((a, b) => builtins.indexOf(b) - builtins.indexOf(a))) { | ||
out.splice(1, 0, `${exportPrefix}type ${typeFormatter(type.name)} = ${type.type}`); | ||
out.splice(0, 0, `${exportPrefix}type ${typeFormatter(type.name)} = ${type.type}`); | ||
} | ||
out.push(''); | ||
// remove any double newlines | ||
out = out.filter((line, i, all) => !(line === '' && all[i - 1] === '')); | ||
if (options.namespace) { | ||
@@ -104,0 +111,0 @@ out = out.map((line) => indent + line); |
@@ -1,1 +0,1 @@ | ||
exports.default = '1.2.1'; | ||
exports.default = '1.2.2'; |
{ | ||
"name": "eosio-abi2ts", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "generates typescript type defenitions from eosio abi files", | ||
@@ -19,3 +19,4 @@ "author": "Johan Nordberg", | ||
"scripts": { | ||
"prepublishOnly": "make test && make lib" | ||
"prepublishOnly": "make test", | ||
"prepack": "make lib" | ||
}, | ||
@@ -37,2 +38,2 @@ "keywords": [ | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13423
297