diff options
author | Leonid <logvinov.leon@gmail.com> | 2018-01-10 18:18:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-10 18:18:51 +0800 |
commit | a39d3d723399e124ae617dfda67e754907312a98 (patch) | |
tree | 2084e27bad0dede62d99165453f9ec092ea8d1be /packages/abi-gen/src/utils.ts | |
parent | 40c7ee63557b1795340c315eb9fab1dcfe092bed (diff) | |
parent | 326a6b729fe6cf96f0b4787d84903282738b6863 (diff) | |
download | dexon-sol-tools-a39d3d723399e124ae617dfda67e754907312a98.tar dexon-sol-tools-a39d3d723399e124ae617dfda67e754907312a98.tar.gz dexon-sol-tools-a39d3d723399e124ae617dfda67e754907312a98.tar.bz2 dexon-sol-tools-a39d3d723399e124ae617dfda67e754907312a98.tar.lz dexon-sol-tools-a39d3d723399e124ae617dfda67e754907312a98.tar.xz dexon-sol-tools-a39d3d723399e124ae617dfda67e754907312a98.tar.zst dexon-sol-tools-a39d3d723399e124ae617dfda67e754907312a98.zip |
Merge pull request #305 from 0xProject/fix/bignumber_config
Use configured version of bignumber in all packages
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 }, |