diff options
Diffstat (limited to 'packages/abi-gen/src/utils.ts')
-rw-r--r-- | packages/abi-gen/src/utils.ts | 7 |
1 files changed, 6 insertions, 1 deletions
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 }, |