diff options
author | Greg Hysen <hysz@users.noreply.github.com> | 2019-01-15 03:48:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-15 03:48:17 +0800 |
commit | 1c25d8e997456c248470d925cf6702e46d959a62 (patch) | |
tree | 4e2c77924445247b2916d7713e058ba3466b70a5 /packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts | |
parent | fc89b97818eda9c7447273b5728c1ba8fbb5cdf5 (diff) | |
parent | b0817854e81512ad95cca4d842a671304ae3b94a (diff) | |
download | dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar.gz dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar.bz2 dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar.lz dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar.xz dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar.zst dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.zip |
Merge pull request #1475 from 0xProject/feature/monorepo/useNewAbiEncoder
Use Compressed Calldata in Contract Wrappers
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 | 272 |
1 files changed, 76 insertions, 196 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 474472e43..1d53df6b8 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts @@ -40,13 +40,7 @@ export class ERC20ProxyContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -68,11 +62,7 @@ export class ERC20ProxyContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -89,11 +79,7 @@ export class ERC20ProxyContract extends BaseContract { target: string, ): string { const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target ]); return abiEncodedTransactionData; }, @@ -104,15 +90,7 @@ export class ERC20ProxyContract extends BaseContract { ): Promise<void > { const self = this as any as ERC20ProxyContract; - const functionSignature = 'addAuthorizedAddress(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addAuthorizedAddress; - const encodedData = ethersFunction.encode([target + const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -124,11 +102,12 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'addAuthorizedAddress'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; + const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public authorities = { @@ -139,15 +118,7 @@ export class ERC20ProxyContract extends BaseContract { ): Promise<string > { const self = this as any as ERC20ProxyContract; - const functionSignature = 'authorities(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorities; - const encodedData = ethersFunction.encode([index_0 + const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -159,11 +130,12 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'authorities'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; + const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public removeAuthorizedAddress = { @@ -172,13 +144,7 @@ export class ERC20ProxyContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -200,11 +166,7 @@ export class ERC20ProxyContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -221,11 +183,7 @@ export class ERC20ProxyContract extends BaseContract { target: string, ): string { const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target ]); return abiEncodedTransactionData; }, @@ -236,15 +194,7 @@ export class ERC20ProxyContract extends BaseContract { ): Promise<void > { const self = this as any as ERC20ProxyContract; - const functionSignature = 'removeAuthorizedAddress(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddress; - const encodedData = ethersFunction.encode([target + const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -256,11 +206,12 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddress'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public owner = { @@ -270,12 +221,7 @@ export class ERC20ProxyContract extends BaseContract { ): Promise<string > { const self = this as any as ERC20ProxyContract; - const functionSignature = 'owner()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('owner()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -286,11 +232,12 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; + const abiEncoder = self._lookupAbiEncoder('owner()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public removeAuthorizedAddressAtIndex = { @@ -300,16 +247,7 @@ export class ERC20ProxyContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target, - index - ]); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target, + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target, index ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -334,13 +272,7 @@ export class ERC20ProxyContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target, + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target, index ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -359,13 +291,7 @@ export class ERC20ProxyContract extends BaseContract { index: BigNumber, ): string { const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target, + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target, index ]); return abiEncodedTransactionData; @@ -378,18 +304,7 @@ export class ERC20ProxyContract extends BaseContract { ): Promise<void > { const self = this as any as ERC20ProxyContract; - const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target, - index - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddressAtIndex; - const encodedData = ethersFunction.encode([target, + const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target, index ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -402,11 +317,12 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddressAtIndex'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getProxyId = { @@ -416,12 +332,7 @@ export class ERC20ProxyContract extends BaseContract { ): Promise<string > { const self = this as any as ERC20ProxyContract; - const functionSignature = 'getProxyId()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getProxyId; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('getProxyId()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -432,11 +343,12 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getProxyId'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; + const abiEncoder = self._lookupAbiEncoder('getProxyId()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public authorized = { @@ -447,15 +359,7 @@ export class ERC20ProxyContract extends BaseContract { ): Promise<boolean > { const self = this as any as ERC20ProxyContract; - const functionSignature = 'authorized(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorized; - const encodedData = ethersFunction.encode([index_0 + const encodedData = self._strictEncodeArguments('authorized(address)', [index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -467,11 +371,12 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'authorized'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; + const abiEncoder = self._lookupAbiEncoder('authorized(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getAuthorizedAddresses = { @@ -481,12 +386,7 @@ export class ERC20ProxyContract extends BaseContract { ): Promise<string[] > { const self = this as any as ERC20ProxyContract; - const functionSignature = 'getAuthorizedAddresses()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuthorizedAddresses; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -497,11 +397,12 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getAuthorizedAddresses'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; + const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string[] + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transferOwnership = { @@ -510,13 +411,7 @@ export class ERC20ProxyContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -538,11 +433,7 @@ export class ERC20ProxyContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -559,11 +450,7 @@ export class ERC20ProxyContract extends BaseContract { newOwner: string, ): string { const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner ]); return abiEncodedTransactionData; }, @@ -574,15 +461,7 @@ export class ERC20ProxyContract extends BaseContract { ): Promise<void > { const self = this as any as ERC20ProxyContract; - const functionSignature = 'transferOwnership(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership; - const encodedData = ethersFunction.encode([newOwner + const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -594,11 +473,12 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; + const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public static async deployFrom0xArtifactAsync( @@ -644,7 +524,7 @@ export class ERC20ProxyContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('ERC20Proxy', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); + classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); } } // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method |