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/erc20_proxy.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/erc20_proxy.ts')
-rw-r--r-- | packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts | 63 |
1 files changed, 45 insertions, 18 deletions
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts index 57ce08c10..1d53df6b8 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts @@ -103,8 +103,11 @@ export class ERC20ProxyContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - const resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult); - return resultArray; + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public authorities = { @@ -128,8 +131,11 @@ export class ERC20ProxyContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); - 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 removeAuthorizedAddress = { @@ -201,8 +207,11 @@ export class ERC20ProxyContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - const resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult); - return resultArray; + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public owner = { @@ -224,8 +233,11 @@ export class ERC20ProxyContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); - 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 removeAuthorizedAddressAtIndex = { @@ -306,8 +318,11 @@ export class ERC20ProxyContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - const resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult); - return resultArray; + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getProxyId = { @@ -329,8 +344,11 @@ export class ERC20ProxyContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - 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 authorized = { @@ -354,8 +372,11 @@ export class ERC20ProxyContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); - 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 getAuthorizedAddresses = { @@ -377,8 +398,11 @@ export class ERC20ProxyContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); - 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 transferOwnership = { @@ -450,8 +474,11 @@ export class ERC20ProxyContract extends BaseContract { const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - const resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult); - return resultArray; + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public static async deployFrom0xArtifactAsync( |