diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2019-01-12 08:13:52 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2019-01-15 02:49:44 +0800 |
commit | b0817854e81512ad95cca4d842a671304ae3b94a (patch) | |
tree | a0061749b4877a6b020b3db2cec62a277d26d875 /packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts | |
parent | 1907ecc02edc8fb362485800b58946913387fa7d (diff) | |
download | dexon-0x-contracts-b0817854e81512ad95cca4d842a671304ae3b94a.tar.gz dexon-0x-contracts-b0817854e81512ad95cca4d842a671304ae3b94a.tar.zst dexon-0x-contracts-b0817854e81512ad95cca4d842a671304ae3b94a.zip |
strict decoding of return values using generics
Diffstat (limited to 'packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts')
-rw-r--r-- | packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts | 63 |
1 files changed, 45 insertions, 18 deletions
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts index 0d9eb524f..4f5d7f4c5 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts @@ -55,8 +55,11 @@ export class ZRXTokenContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); - const resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult); - return resultArray[0]; + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public approve = { @@ -137,8 +140,11 @@ export class ZRXTokenContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - const resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult); - return resultArray[0]; + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public totalSupply = { @@ -160,8 +166,11 @@ export class ZRXTokenContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); - const resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult); - return resultArray[0]; + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transferFrom = { @@ -251,8 +260,11 @@ export class ZRXTokenContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - const resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult); - return resultArray[0]; + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public decimals = { @@ -274,8 +286,11 @@ export class ZRXTokenContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); - const resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult); - return resultArray[0]; + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<number + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public balanceOf = { @@ -299,8 +314,11 @@ export class ZRXTokenContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - const resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult); - return resultArray[0]; + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public symbol = { @@ -322,8 +340,11 @@ export class ZRXTokenContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); - const resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult); - return resultArray[0]; + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transfer = { @@ -404,8 +425,11 @@ export class ZRXTokenContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); - const resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult); - return resultArray[0]; + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public allowance = { @@ -431,8 +455,11 @@ export class ZRXTokenContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); - const resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult); - return resultArray[0]; + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public static async deployFrom0xArtifactAsync( |