diff options
Diffstat (limited to 'packages/abi-gen')
-rw-r--r-- | packages/abi-gen/src/utils.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/abi-gen/src/utils.ts b/packages/abi-gen/src/utils.ts index 764daa142..f407ae23d 100644 --- a/packages/abi-gen/src/utils.ts +++ b/packages/abi-gen/src/utils.ts @@ -10,7 +10,7 @@ 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 = [ @@ -37,6 +37,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 }, |