aboutsummaryrefslogtreecommitdiffstats
path: root/packages/abi-gen
diff options
context:
space:
mode:
Diffstat (limited to 'packages/abi-gen')
-rw-r--r--packages/abi-gen/package.json2
-rw-r--r--packages/abi-gen/src/utils.ts7
2 files changed, 7 insertions, 2 deletions
diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json
index fbf3db687..50efc43a1 100644
--- a/packages/abi-gen/package.json
+++ b/packages/abi-gen/package.json
@@ -22,7 +22,7 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/abi-gen/README.md",
"dependencies": {
- "bignumber.js": "~4.1.0",
+ "@0xproject/utils": "^0.1.2",
"chalk": "^2.3.0",
"glob": "^7.1.2",
"handlebars": "^4.0.11",
diff --git a/packages/abi-gen/src/utils.ts b/packages/abi-gen/src/utils.ts
index 524c54a5e..f6291d98d 100644
--- a/packages/abi-gen/src/utils.ts
+++ b/packages/abi-gen/src/utils.ts
@@ -11,7 +11,9 @@ export const utils = {
if (solType.match(trailingArrayRegex)) {
const arrayItemSolType = solType.replace(trailingArrayRegex, '');
const arrayItemTsType = utils.solTypeToTsType(paramKind, arrayItemSolType);
- const arrayTsType = `(${arrayItemTsType})[]`;
+ const arrayTsType = utils.isUnionType(arrayItemTsType)
+ ? `Array<${arrayItemTsType}>`
+ : `${arrayItemTsType}[]`;
return arrayTsType;
} else {
const solTypeRegexToTsType = [
@@ -38,6 +40,9 @@ export const utils = {
throw new Error(`Unknown Solidity type found: ${solType}`);
}
},
+ isUnionType(tsType: string): boolean {
+ return tsType === 'number|BigNumber';
+ },
log(...args: any[]): void {
console.log(...args); // tslint:disable-line:no-console
},