diff options
Diffstat (limited to 'packages/abi-gen-wrappers')
15 files changed, 1357 insertions, 4346 deletions
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts b/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts index 27f108ebc..cc42e7fb5 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts @@ -105,15 +105,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<string > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'owners(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.owners; - const encodedData = ethersFunction.encode([index_0 + const encodedData = self._strictEncodeArguments('owners(uint256)', [index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -125,11 +117,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owners'}) 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('owners(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public removeOwner = { @@ -138,13 +131,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('removeOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const encodedData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -166,11 +153,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('removeOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -187,11 +170,7 @@ export class AssetProxyOwnerContract extends BaseContract { owner: string, ): string { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('removeOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner + const abiEncodedTransactionData = self._strictEncodeArguments('removeOwner(address)', [owner ]); return abiEncodedTransactionData; }, @@ -202,15 +181,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<void > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'removeOwner(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeOwner; - const encodedData = ethersFunction.encode([owner + const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -222,11 +193,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'removeOwner'}) 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('removeOwner(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public revokeConfirmation = { @@ -235,13 +207,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId + const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -263,11 +229,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId + const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -284,11 +246,7 @@ export class AssetProxyOwnerContract extends BaseContract { transactionId: BigNumber, ): string { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId + const abiEncodedTransactionData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId ]); return abiEncodedTransactionData; }, @@ -299,15 +257,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<void > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'revokeConfirmation(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.revokeConfirmation; - const encodedData = ethersFunction.encode([transactionId + const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -319,11 +269,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'revokeConfirmation'}) 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('revokeConfirmation(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public isOwner = { @@ -334,15 +285,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<boolean > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'isOwner(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.isOwner; - const encodedData = ethersFunction.encode([index_0 + const encodedData = self._strictEncodeArguments('isOwner(address)', [index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -354,11 +297,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isOwner'}) 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('isOwner(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public confirmations = { @@ -370,18 +314,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<boolean > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'confirmations(uint256,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmations; - const encodedData = ethersFunction.encode([index_0, + const encodedData = self._strictEncodeArguments('confirmations(uint256,address)', [index_0, index_1 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -394,11 +327,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'confirmations'}) 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('confirmations(uint256,address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public executeRemoveAuthorizedAddressAtIndex = { @@ -407,13 +341,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeRemoveAuthorizedAddressAtIndex(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('executeRemoveAuthorizedAddressAtIndex(uint256)').functions.executeRemoveAuthorizedAddressAtIndex.encode([transactionId + const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -435,11 +363,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeRemoveAuthorizedAddressAtIndex(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('executeRemoveAuthorizedAddressAtIndex(uint256)').functions.executeRemoveAuthorizedAddressAtIndex.encode([transactionId + const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -456,11 +380,7 @@ export class AssetProxyOwnerContract extends BaseContract { transactionId: BigNumber, ): string { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeRemoveAuthorizedAddressAtIndex(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('executeRemoveAuthorizedAddressAtIndex(uint256)').functions.executeRemoveAuthorizedAddressAtIndex.encode([transactionId + const abiEncodedTransactionData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId ]); return abiEncodedTransactionData; }, @@ -471,15 +391,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<void > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'executeRemoveAuthorizedAddressAtIndex(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeRemoveAuthorizedAddressAtIndex; - const encodedData = ethersFunction.encode([transactionId + const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -491,11 +403,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'executeRemoveAuthorizedAddressAtIndex'}) 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('executeRemoveAuthorizedAddressAtIndex(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public secondsTimeLocked = { @@ -505,12 +418,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'secondsTimeLocked()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.secondsTimeLocked; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('secondsTimeLocked()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -521,11 +429,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'secondsTimeLocked'}) 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('secondsTimeLocked()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getTransactionCount = { @@ -537,18 +446,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'getTransactionCount(bool,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [pending, - executed - ] = BaseContract._formatABIDataItemList(inputAbi, [pending, - executed - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [pending, - executed - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTransactionCount; - const encodedData = ethersFunction.encode([pending, + const encodedData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [pending, executed ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -561,11 +459,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getTransactionCount'}) 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('getTransactionCount(bool,bool)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public registerAssetProxy = { @@ -575,16 +474,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address,bool)').inputs; - [assetProxyContract, - isRegistered - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract, - isRegistered - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyContract, - isRegistered - ]); - const encodedData = self._lookupEthersInterface('registerAssetProxy(address,bool)').functions.registerAssetProxy.encode([assetProxyContract, + const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract, isRegistered ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -609,13 +499,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address,bool)').inputs; - [assetProxyContract, - isRegistered - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract, - isRegistered - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('registerAssetProxy(address,bool)').functions.registerAssetProxy.encode([assetProxyContract, + const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract, isRegistered ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -634,13 +518,7 @@ export class AssetProxyOwnerContract extends BaseContract { isRegistered: boolean, ): string { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address,bool)').inputs; - [assetProxyContract, - isRegistered - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract, - isRegistered - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('registerAssetProxy(address,bool)').functions.registerAssetProxy.encode([assetProxyContract, + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract, isRegistered ]); return abiEncodedTransactionData; @@ -653,18 +531,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<void > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'registerAssetProxy(address,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [assetProxyContract, - isRegistered - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract, - isRegistered - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyContract, - isRegistered - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.registerAssetProxy; - const encodedData = ethersFunction.encode([assetProxyContract, + const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract, isRegistered ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -677,11 +544,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'registerAssetProxy'}) 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('registerAssetProxy(address,bool)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public addOwner = { @@ -690,13 +558,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('addOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const encodedData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -718,11 +580,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('addOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -739,11 +597,7 @@ export class AssetProxyOwnerContract extends BaseContract { owner: string, ): string { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('addOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner + const abiEncodedTransactionData = self._strictEncodeArguments('addOwner(address)', [owner ]); return abiEncodedTransactionData; }, @@ -754,15 +608,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<void > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'addOwner(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addOwner; - const encodedData = ethersFunction.encode([owner + const encodedData = self._strictEncodeArguments('addOwner(address)', [owner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -774,11 +620,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'addOwner'}) 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('addOwner(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public isConfirmed = { @@ -789,15 +636,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<boolean > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'isConfirmed(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isConfirmed; - const encodedData = ethersFunction.encode([transactionId + const encodedData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -809,11 +648,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isConfirmed'}) 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('isConfirmed(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public changeTimeLock = { @@ -822,13 +662,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs; - [_secondsTimeLocked - ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_secondsTimeLocked - ]); - const encodedData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked + const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -850,11 +684,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs; - [_secondsTimeLocked - ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked + const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -871,11 +701,7 @@ export class AssetProxyOwnerContract extends BaseContract { _secondsTimeLocked: BigNumber, ): string { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs; - [_secondsTimeLocked - ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked + const abiEncodedTransactionData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked ]); return abiEncodedTransactionData; }, @@ -886,15 +712,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<void > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'changeTimeLock(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_secondsTimeLocked - ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_secondsTimeLocked - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.changeTimeLock; - const encodedData = ethersFunction.encode([_secondsTimeLocked + const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -906,11 +724,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'changeTimeLock'}) 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('changeTimeLock(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public isAssetProxyRegistered = { @@ -921,15 +740,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<boolean > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'isAssetProxyRegistered(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.isAssetProxyRegistered; - const encodedData = ethersFunction.encode([index_0 + const encodedData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -941,11 +752,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isAssetProxyRegistered'}) 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('isAssetProxyRegistered(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getConfirmationCount = { @@ -956,15 +768,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'getConfirmationCount(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getConfirmationCount; - const encodedData = ethersFunction.encode([transactionId + const encodedData = self._strictEncodeArguments('getConfirmationCount(uint256)', [transactionId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -976,11 +780,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getConfirmationCount'}) 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('getConfirmationCount(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transactions = { @@ -991,15 +796,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<[string, BigNumber, string, boolean] > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'transactions(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.transactions; - const encodedData = ethersFunction.encode([index_0 + const encodedData = self._strictEncodeArguments('transactions(uint256)', [index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1011,11 +808,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transactions'}) 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('transactions(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<[string, BigNumber, string, boolean] + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getOwners = { @@ -1025,12 +823,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<string[] > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'getOwners()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOwners; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('getOwners()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1041,11 +834,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getOwners'}) 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('getOwners()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string[] + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getTransactionIds = { @@ -1059,24 +853,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<BigNumber[] > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'getTransactionIds(uint256,uint256,bool,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [from, - to, - pending, - executed - ] = BaseContract._formatABIDataItemList(inputAbi, [from, - to, - pending, - executed - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [from, - to, - pending, - executed - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTransactionIds; - const encodedData = ethersFunction.encode([from, + const encodedData = self._strictEncodeArguments('getTransactionIds(uint256,uint256,bool,bool)', [from, to, pending, executed @@ -1091,11 +868,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getTransactionIds'}) 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('getTransactionIds(uint256,uint256,bool,bool)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber[] + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getConfirmations = { @@ -1106,15 +884,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<string[] > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'getConfirmations(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getConfirmations; - const encodedData = ethersFunction.encode([transactionId + const encodedData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1126,11 +896,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getConfirmations'}) 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('getConfirmations(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string[] + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transactionCount = { @@ -1140,12 +911,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'transactionCount()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactionCount; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('transactionCount()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1156,11 +922,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transactionCount'}) 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('transactionCount()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public changeRequirement = { @@ -1169,13 +936,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_required - ]); - const encodedData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required + const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1197,11 +958,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required + const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1218,11 +975,7 @@ export class AssetProxyOwnerContract extends BaseContract { _required: BigNumber, ): string { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required + const abiEncodedTransactionData = self._strictEncodeArguments('changeRequirement(uint256)', [_required ]); return abiEncodedTransactionData; }, @@ -1233,15 +986,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<void > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'changeRequirement(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_required - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.changeRequirement; - const encodedData = ethersFunction.encode([_required + const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1253,11 +998,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'changeRequirement'}) 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('changeRequirement(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public confirmTransaction = { @@ -1266,13 +1012,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId + const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1294,11 +1034,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId + const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1315,11 +1051,7 @@ export class AssetProxyOwnerContract extends BaseContract { transactionId: BigNumber, ): string { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId + const abiEncodedTransactionData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId ]); return abiEncodedTransactionData; }, @@ -1330,15 +1062,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<void > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'confirmTransaction(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmTransaction; - const encodedData = ethersFunction.encode([transactionId + const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1350,11 +1074,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'confirmTransaction'}) 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('confirmTransaction(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public submitTransaction = { @@ -1365,19 +1090,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [destination, - value, - data - ]); - const encodedData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination, + const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination, value, data ]); @@ -1405,15 +1118,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination, + const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination, value, data ]); @@ -1434,15 +1139,7 @@ export class AssetProxyOwnerContract extends BaseContract { data: string, ): string { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination, + const abiEncodedTransactionData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination, value, data ]); @@ -1457,21 +1154,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'submitTransaction(address,uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [destination, - value, - data - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.submitTransaction; - const encodedData = ethersFunction.encode([destination, + const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination, value, data ]); @@ -1485,11 +1168,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'submitTransaction'}) 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('submitTransaction(address,uint256,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public confirmationTimes = { @@ -1500,15 +1184,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'confirmationTimes(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.confirmationTimes; - const encodedData = ethersFunction.encode([index_0 + const encodedData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1520,11 +1196,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'confirmationTimes'}) 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('confirmationTimes(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public MAX_OWNER_COUNT = { @@ -1534,12 +1211,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'MAX_OWNER_COUNT()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.MAX_OWNER_COUNT; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('MAX_OWNER_COUNT()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1550,11 +1222,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'MAX_OWNER_COUNT'}) 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('MAX_OWNER_COUNT()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public required = { @@ -1564,12 +1237,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'required()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.required; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('required()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1580,11 +1248,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'required'}) 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('required()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public replaceOwner = { @@ -1594,16 +1263,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner, - newOwner - ]); - const encodedData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner, + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner, newOwner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1628,13 +1288,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner, + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner, newOwner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1653,13 +1307,7 @@ export class AssetProxyOwnerContract extends BaseContract { newOwner: string, ): string { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner, + const abiEncodedTransactionData = self._strictEncodeArguments('replaceOwner(address,address)', [owner, newOwner ]); return abiEncodedTransactionData; @@ -1672,18 +1320,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<void > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'replaceOwner(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner, - newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.replaceOwner; - const encodedData = ethersFunction.encode([owner, + const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner, newOwner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1696,11 +1333,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'replaceOwner'}) 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('replaceOwner(address,address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public executeTransaction = { @@ -1709,13 +1347,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId + const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1737,11 +1369,7 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId + const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1758,11 +1386,7 @@ export class AssetProxyOwnerContract extends BaseContract { transactionId: BigNumber, ): string { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId + const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId ]); return abiEncodedTransactionData; }, @@ -1773,15 +1397,7 @@ export class AssetProxyOwnerContract extends BaseContract { ): Promise<void > { const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'executeTransaction(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeTransaction; - const encodedData = ethersFunction.encode([transactionId + const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1793,11 +1409,12 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'executeTransaction'}) 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('executeTransaction(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public static async deployFrom0xArtifactAsync( @@ -1871,7 +1488,7 @@ _secondsTimeLocked } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('AssetProxyOwner', 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 diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts index 3995c6d87..cab09c4d2 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts @@ -43,12 +43,7 @@ export class DummyERC20TokenContract extends BaseContract { ): Promise<string > { const self = this as any as DummyERC20TokenContract; - const functionSignature = 'name()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -59,11 +54,12 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'name'}) 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('name()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public approve = { @@ -73,16 +69,7 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -107,13 +94,7 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -132,13 +113,7 @@ export class DummyERC20TokenContract extends BaseContract { _value: BigNumber, ): string { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value ]); return abiEncodedTransactionData; @@ -151,18 +126,7 @@ export class DummyERC20TokenContract extends BaseContract { ): Promise<boolean > { const self = this as any as DummyERC20TokenContract; - const functionSignature = 'approve(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([_spender, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -175,11 +139,12 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approve'}) 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('approve(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public totalSupply = { @@ -189,12 +154,7 @@ export class DummyERC20TokenContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as DummyERC20TokenContract; - const functionSignature = 'totalSupply()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -205,11 +165,12 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) 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('totalSupply()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transferFrom = { @@ -220,19 +181,7 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _value ]); @@ -260,15 +209,7 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _value ]); @@ -289,15 +230,7 @@ export class DummyERC20TokenContract extends BaseContract { _value: BigNumber, ): string { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _value ]); @@ -312,21 +245,7 @@ export class DummyERC20TokenContract extends BaseContract { ): Promise<boolean > { const self = this as any as DummyERC20TokenContract; - const functionSignature = 'transferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _value ]); @@ -340,11 +259,12 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) 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('transferFrom(address,address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public decimals = { @@ -354,12 +274,7 @@ export class DummyERC20TokenContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as DummyERC20TokenContract; - const functionSignature = 'decimals()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.decimals; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('decimals()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -370,11 +285,12 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'decimals'}) 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('decimals()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public balanceOf = { @@ -385,15 +301,7 @@ export class DummyERC20TokenContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as DummyERC20TokenContract; - const functionSignature = 'balanceOf(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf; - const encodedData = ethersFunction.encode([_owner + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -405,11 +313,12 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) 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('balanceOf(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public owner = { @@ -419,12 +328,7 @@ export class DummyERC20TokenContract extends BaseContract { ): Promise<string > { const self = this as any as DummyERC20TokenContract; - 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, @@ -435,11 +339,12 @@ export class DummyERC20TokenContract 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 symbol = { @@ -449,12 +354,7 @@ export class DummyERC20TokenContract extends BaseContract { ): Promise<string > { const self = this as any as DummyERC20TokenContract; - const functionSignature = 'symbol()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -465,11 +365,12 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'symbol'}) 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('symbol()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public mint = { @@ -478,13 +379,7 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('mint(uint256)').inputs; - [_value - ] = BaseContract._formatABIDataItemList(inputAbi, [_value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_value - ]); - const encodedData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value + const encodedData = self._strictEncodeArguments('mint(uint256)', [_value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -506,11 +401,7 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('mint(uint256)').inputs; - [_value - ] = BaseContract._formatABIDataItemList(inputAbi, [_value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value + const encodedData = self._strictEncodeArguments('mint(uint256)', [_value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -527,11 +418,7 @@ export class DummyERC20TokenContract extends BaseContract { _value: BigNumber, ): string { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('mint(uint256)').inputs; - [_value - ] = BaseContract._formatABIDataItemList(inputAbi, [_value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value + const abiEncodedTransactionData = self._strictEncodeArguments('mint(uint256)', [_value ]); return abiEncodedTransactionData; }, @@ -542,15 +429,7 @@ export class DummyERC20TokenContract extends BaseContract { ): Promise<void > { const self = this as any as DummyERC20TokenContract; - const functionSignature = 'mint(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_value - ] = BaseContract._formatABIDataItemList(inputAbi, [_value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.mint; - const encodedData = ethersFunction.encode([_value + const encodedData = self._strictEncodeArguments('mint(uint256)', [_value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -562,11 +441,12 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'mint'}) 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('mint(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transfer = { @@ -576,16 +456,7 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -610,13 +481,7 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -635,13 +500,7 @@ export class DummyERC20TokenContract extends BaseContract { _value: BigNumber, ): string { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value ]); return abiEncodedTransactionData; @@ -654,18 +513,7 @@ export class DummyERC20TokenContract extends BaseContract { ): Promise<boolean > { const self = this as any as DummyERC20TokenContract; - const functionSignature = 'transfer(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer; - const encodedData = ethersFunction.encode([_to, + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -678,11 +526,12 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transfer'}) 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('transfer(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public allowance = { @@ -694,18 +543,7 @@ export class DummyERC20TokenContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as DummyERC20TokenContract; - const functionSignature = 'allowance(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner, - _spender - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _spender - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _spender - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance; - const encodedData = ethersFunction.encode([_owner, + const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner, _spender ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -718,11 +556,12 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'allowance'}) 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('allowance(address,address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public setBalance = { @@ -732,16 +571,7 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs; - [_target, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_target, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_target, - _value - ]); - const encodedData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target, + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -766,13 +596,7 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs; - [_target, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_target, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target, + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -791,13 +615,7 @@ export class DummyERC20TokenContract extends BaseContract { _value: BigNumber, ): string { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs; - [_target, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_target, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target, + const abiEncodedTransactionData = self._strictEncodeArguments('setBalance(address,uint256)', [_target, _value ]); return abiEncodedTransactionData; @@ -810,18 +628,7 @@ export class DummyERC20TokenContract extends BaseContract { ): Promise<void > { const self = this as any as DummyERC20TokenContract; - const functionSignature = 'setBalance(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_target, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_target, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_target, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setBalance; - const encodedData = ethersFunction.encode([_target, + const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target, _value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -834,11 +641,12 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'setBalance'}) 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('setBalance(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transferOwnership = { @@ -847,13 +655,7 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as DummyERC20TokenContract; - 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( { @@ -875,11 +677,7 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as DummyERC20TokenContract; - 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( { @@ -896,11 +694,7 @@ export class DummyERC20TokenContract extends BaseContract { newOwner: string, ): string { const self = this as any as DummyERC20TokenContract; - 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; }, @@ -911,15 +705,7 @@ export class DummyERC20TokenContract extends BaseContract { ): Promise<void > { const self = this as any as DummyERC20TokenContract; - 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( { @@ -931,11 +717,12 @@ export class DummyERC20TokenContract 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 MAX_MINT_AMOUNT = { @@ -945,12 +732,7 @@ export class DummyERC20TokenContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as DummyERC20TokenContract; - const functionSignature = 'MAX_MINT_AMOUNT()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.MAX_MINT_AMOUNT; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('MAX_MINT_AMOUNT()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -961,11 +743,12 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'MAX_MINT_AMOUNT'}) 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('MAX_MINT_AMOUNT()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public static async deployFrom0xArtifactAsync( @@ -1039,7 +822,7 @@ _totalSupply } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('DummyERC20Token', 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 diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts index a7af2d158..9cb54442b 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts @@ -51,12 +51,7 @@ export class DummyERC721TokenContract extends BaseContract { ): Promise<string > { const self = this as any as DummyERC721TokenContract; - const functionSignature = 'name()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -67,11 +62,12 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'name'}) 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('name()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getApproved = { @@ -82,15 +78,7 @@ export class DummyERC721TokenContract extends BaseContract { ): Promise<string > { const self = this as any as DummyERC721TokenContract; - const functionSignature = 'getApproved(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getApproved; - const encodedData = ethersFunction.encode([_tokenId + const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -102,11 +90,12 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getApproved'}) 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('getApproved(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public approve = { @@ -116,16 +105,7 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -150,13 +130,7 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -175,13 +149,7 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, ): string { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId ]); return abiEncodedTransactionData; @@ -194,18 +162,7 @@ export class DummyERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as DummyERC721TokenContract; - const functionSignature = 'approve(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([_approved, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -218,11 +175,12 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approve'}) 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('approve(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transferFrom = { @@ -233,19 +191,7 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -273,15 +219,7 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -302,15 +240,7 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, ): string { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -325,21 +255,7 @@ export class DummyERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as DummyERC721TokenContract; - const functionSignature = 'transferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -353,11 +269,12 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) 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('transferFrom(address,address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public mint = { @@ -367,16 +284,7 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('mint(address,uint256)').inputs; - [_to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('mint(address,uint256)').functions.mint.encode([_to, + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to, _tokenId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -401,13 +309,7 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('mint(address,uint256)').inputs; - [_to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('mint(address,uint256)').functions.mint.encode([_to, + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to, _tokenId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -426,13 +328,7 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, ): string { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('mint(address,uint256)').inputs; - [_to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('mint(address,uint256)').functions.mint.encode([_to, + const abiEncodedTransactionData = self._strictEncodeArguments('mint(address,uint256)', [_to, _tokenId ]); return abiEncodedTransactionData; @@ -445,18 +341,7 @@ export class DummyERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as DummyERC721TokenContract; - const functionSignature = 'mint(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.mint; - const encodedData = ethersFunction.encode([_to, + const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to, _tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -469,11 +354,12 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'mint'}) 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('mint(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public safeTransferFrom1 = { @@ -484,19 +370,7 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -524,15 +398,7 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -553,15 +419,7 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, ): string { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from, + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -576,21 +434,7 @@ export class DummyERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as DummyERC721TokenContract; - const functionSignature = 'safeTransferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.safeTransferFrom; - const encodedData = ethersFunction.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -604,11 +448,12 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'safeTransferFrom'}) 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('safeTransferFrom(address,address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public ownerOf = { @@ -619,15 +464,7 @@ export class DummyERC721TokenContract extends BaseContract { ): Promise<string > { const self = this as any as DummyERC721TokenContract; - const functionSignature = 'ownerOf(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ownerOf; - const encodedData = ethersFunction.encode([_tokenId + const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -639,11 +476,12 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'ownerOf'}) 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('ownerOf(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public balanceOf = { @@ -654,15 +492,7 @@ export class DummyERC721TokenContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as DummyERC721TokenContract; - const functionSignature = 'balanceOf(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf; - const encodedData = ethersFunction.encode([_owner + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -674,11 +504,12 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) 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('balanceOf(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public owner = { @@ -688,12 +519,7 @@ export class DummyERC721TokenContract extends BaseContract { ): Promise<string > { const self = this as any as DummyERC721TokenContract; - 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, @@ -704,11 +530,12 @@ export class DummyERC721TokenContract 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 symbol = { @@ -718,12 +545,7 @@ export class DummyERC721TokenContract extends BaseContract { ): Promise<string > { const self = this as any as DummyERC721TokenContract; - const functionSignature = 'symbol()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -734,11 +556,12 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'symbol'}) 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('symbol()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public burn = { @@ -748,16 +571,7 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('burn(address,uint256)').inputs; - [_owner, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('burn(address,uint256)').functions.burn.encode([_owner, + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner, _tokenId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -782,13 +596,7 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('burn(address,uint256)').inputs; - [_owner, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('burn(address,uint256)').functions.burn.encode([_owner, + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner, _tokenId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -807,13 +615,7 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, ): string { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('burn(address,uint256)').inputs; - [_owner, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('burn(address,uint256)').functions.burn.encode([_owner, + const abiEncodedTransactionData = self._strictEncodeArguments('burn(address,uint256)', [_owner, _tokenId ]); return abiEncodedTransactionData; @@ -826,18 +628,7 @@ export class DummyERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as DummyERC721TokenContract; - const functionSignature = 'burn(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.burn; - const encodedData = ethersFunction.encode([_owner, + const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner, _tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -850,11 +641,12 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'burn'}) 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('burn(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public setApprovalForAll = { @@ -864,16 +656,7 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator, - _approved - ]); - const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator, + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -898,13 +681,7 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator, + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -923,13 +700,7 @@ export class DummyERC721TokenContract extends BaseContract { _approved: boolean, ): string { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator, + const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved ]); return abiEncodedTransactionData; @@ -942,18 +713,7 @@ export class DummyERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as DummyERC721TokenContract; - const functionSignature = 'setApprovalForAll(address,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator, - _approved - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setApprovalForAll; - const encodedData = ethersFunction.encode([_operator, + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -966,11 +726,12 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'setApprovalForAll'}) 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('setApprovalForAll(address,bool)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public safeTransferFrom2 = { @@ -982,22 +743,7 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId, - _data - ]); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from, _to, _tokenId, _data @@ -1028,17 +774,7 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from, _to, _tokenId, _data @@ -1061,17 +797,7 @@ export class DummyERC721TokenContract extends BaseContract { _data: string, ): string { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from, + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from, _to, _tokenId, _data @@ -1088,24 +814,7 @@ export class DummyERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as DummyERC721TokenContract; - const functionSignature = 'safeTransferFrom(address,address,uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId, - _data - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.safeTransferFrom; - const encodedData = ethersFunction.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from, _to, _tokenId, _data @@ -1120,11 +829,12 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'safeTransferFrom'}) 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('safeTransferFrom(address,address,uint256,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public isApprovedForAll = { @@ -1136,18 +846,7 @@ export class DummyERC721TokenContract extends BaseContract { ): Promise<boolean > { const self = this as any as DummyERC721TokenContract; - const functionSignature = 'isApprovedForAll(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner, - _operator - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _operator - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _operator - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isApprovedForAll; - const encodedData = ethersFunction.encode([_owner, + const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner, _operator ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1160,11 +859,12 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isApprovedForAll'}) 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('isApprovedForAll(address,address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transferOwnership = { @@ -1173,13 +873,7 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as DummyERC721TokenContract; - 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( { @@ -1201,11 +895,7 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as DummyERC721TokenContract; - 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( { @@ -1222,11 +912,7 @@ export class DummyERC721TokenContract extends BaseContract { newOwner: string, ): string { const self = this as any as DummyERC721TokenContract; - 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; }, @@ -1237,15 +923,7 @@ export class DummyERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as DummyERC721TokenContract; - 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( { @@ -1257,11 +935,12 @@ export class DummyERC721TokenContract 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( @@ -1321,7 +1000,7 @@ _symbol } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('DummyERC721Token', 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 diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts index 90e233756..9be95af65 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts @@ -21,13 +21,7 @@ export class DutchAuctionContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as DutchAuctionContract; - const inputAbi = self._lookupAbi('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order - ]); - const encodedData = self._lookupEthersInterface('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.getAuctionDetails.encode([order + const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -49,11 +43,7 @@ export class DutchAuctionContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as DutchAuctionContract; - const inputAbi = self._lookupAbi('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.getAuctionDetails.encode([order + const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -70,11 +60,7 @@ export class DutchAuctionContract extends BaseContract { order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, ): string { const self = this as any as DutchAuctionContract; - const inputAbi = self._lookupAbi('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.getAuctionDetails.encode([order + const abiEncodedTransactionData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order ]); return abiEncodedTransactionData; }, @@ -85,15 +71,7 @@ export class DutchAuctionContract extends BaseContract { ): Promise<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber} > { const self = this as any as DutchAuctionContract; - const functionSignature = 'getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuctionDetails; - const encodedData = ethersFunction.encode([order + const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -105,11 +83,12 @@ export class DutchAuctionContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getAuctionDetails'}) 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('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber} + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public matchOrders = { @@ -121,22 +100,7 @@ export class DutchAuctionContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as DutchAuctionContract; - const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs; - [buyOrder, - sellOrder, - buySignature, - sellSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder, - sellOrder, - buySignature, - sellSignature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [buyOrder, - sellOrder, - buySignature, - sellSignature - ]); - const encodedData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([buyOrder, + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, sellOrder, buySignature, sellSignature @@ -167,17 +131,7 @@ export class DutchAuctionContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as DutchAuctionContract; - const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs; - [buyOrder, - sellOrder, - buySignature, - sellSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder, - sellOrder, - buySignature, - sellSignature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([buyOrder, + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, sellOrder, buySignature, sellSignature @@ -200,17 +154,7 @@ export class DutchAuctionContract extends BaseContract { sellSignature: string, ): string { const self = this as any as DutchAuctionContract; - const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs; - [buyOrder, - sellOrder, - buySignature, - sellSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder, - sellOrder, - buySignature, - sellSignature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([buyOrder, + const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, sellOrder, buySignature, sellSignature @@ -227,24 +171,7 @@ export class DutchAuctionContract extends BaseContract { ): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} > { const self = this as any as DutchAuctionContract; - const functionSignature = 'matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [buyOrder, - sellOrder, - buySignature, - sellSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder, - sellOrder, - buySignature, - sellSignature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [buyOrder, - sellOrder, - buySignature, - sellSignature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.matchOrders; - const encodedData = ethersFunction.encode([buyOrder, + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, sellOrder, buySignature, sellSignature @@ -259,11 +186,12 @@ export class DutchAuctionContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'matchOrders'}) 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('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public static async deployFrom0xArtifactAsync( @@ -316,7 +244,7 @@ export class DutchAuctionContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('DutchAuction', 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 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 diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts index ab208cbf5..5070111e1 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts @@ -43,16 +43,7 @@ export class ERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -77,13 +68,7 @@ export class ERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -102,13 +87,7 @@ export class ERC20TokenContract extends BaseContract { _value: BigNumber, ): string { const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value ]); return abiEncodedTransactionData; @@ -121,18 +100,7 @@ export class ERC20TokenContract extends BaseContract { ): Promise<boolean > { const self = this as any as ERC20TokenContract; - const functionSignature = 'approve(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([_spender, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -145,11 +113,12 @@ export class ERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approve'}) 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('approve(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public totalSupply = { @@ -159,12 +128,7 @@ export class ERC20TokenContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as ERC20TokenContract; - const functionSignature = 'totalSupply()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -175,11 +139,12 @@ export class ERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) 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('totalSupply()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transferFrom = { @@ -190,19 +155,7 @@ export class ERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _value ]); @@ -230,15 +183,7 @@ export class ERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _value ]); @@ -259,15 +204,7 @@ export class ERC20TokenContract extends BaseContract { _value: BigNumber, ): string { const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _value ]); @@ -282,21 +219,7 @@ export class ERC20TokenContract extends BaseContract { ): Promise<boolean > { const self = this as any as ERC20TokenContract; - const functionSignature = 'transferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _value ]); @@ -310,11 +233,12 @@ export class ERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) 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('transferFrom(address,address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public balanceOf = { @@ -325,15 +249,7 @@ export class ERC20TokenContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as ERC20TokenContract; - const functionSignature = 'balanceOf(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf; - const encodedData = ethersFunction.encode([_owner + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -345,11 +261,12 @@ export class ERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) 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('balanceOf(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transfer = { @@ -359,16 +276,7 @@ export class ERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -393,13 +301,7 @@ export class ERC20TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -418,13 +320,7 @@ export class ERC20TokenContract extends BaseContract { _value: BigNumber, ): string { const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value ]); return abiEncodedTransactionData; @@ -437,18 +333,7 @@ export class ERC20TokenContract extends BaseContract { ): Promise<boolean > { const self = this as any as ERC20TokenContract; - const functionSignature = 'transfer(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer; - const encodedData = ethersFunction.encode([_to, + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -461,11 +346,12 @@ export class ERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transfer'}) 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('transfer(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public allowance = { @@ -477,18 +363,7 @@ export class ERC20TokenContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as ERC20TokenContract; - const functionSignature = 'allowance(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner, - _spender - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _spender - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _spender - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance; - const encodedData = ethersFunction.encode([_owner, + const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner, _spender ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -501,11 +376,12 @@ export class ERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'allowance'}) 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('allowance(address,address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public static async deployFrom0xArtifactAsync( @@ -551,7 +427,7 @@ export class ERC20TokenContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('ERC20Token', 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 diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts index f9730a072..5a9fcc7d1 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts @@ -40,13 +40,7 @@ export class ERC721ProxyContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract extends BaseContract { target: string, ): string { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract extends BaseContract { ): Promise<void > { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract 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 ERC721ProxyContract extends BaseContract { ): Promise<string > { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract 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 ERC721ProxyContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract extends BaseContract { target: string, ): string { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract extends BaseContract { ): Promise<void > { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract 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 ERC721ProxyContract extends BaseContract { ): Promise<string > { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract 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 ERC721ProxyContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract extends BaseContract { index: BigNumber, ): string { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract extends BaseContract { ): Promise<void > { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract 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 ERC721ProxyContract extends BaseContract { ): Promise<string > { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract 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 ERC721ProxyContract extends BaseContract { ): Promise<boolean > { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract 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 ERC721ProxyContract extends BaseContract { ): Promise<string[] > { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract 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 ERC721ProxyContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract extends BaseContract { newOwner: string, ): string { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract extends BaseContract { ): Promise<void > { const self = this as any as ERC721ProxyContract; - 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 ERC721ProxyContract 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 ERC721ProxyContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('ERC721Proxy', 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 diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts index 251dfa5f9..aaae2ab76 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts @@ -52,15 +52,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<string > { const self = this as any as ERC721TokenContract; - const functionSignature = 'getApproved(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getApproved; - const encodedData = ethersFunction.encode([_tokenId + const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -72,11 +64,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getApproved'}) 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('getApproved(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public approve = { @@ -86,16 +79,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -120,13 +104,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -145,13 +123,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, ): string { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId ]); return abiEncodedTransactionData; @@ -164,18 +136,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as ERC721TokenContract; - const functionSignature = 'approve(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([_approved, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -188,11 +149,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approve'}) 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('approve(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transferFrom = { @@ -203,19 +165,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -243,15 +193,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -272,15 +214,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, ): string { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -295,21 +229,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as ERC721TokenContract; - const functionSignature = 'transferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -323,11 +243,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) 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('transferFrom(address,address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public safeTransferFrom1 = { @@ -338,19 +259,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -378,15 +287,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -407,15 +308,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, ): string { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from, + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -430,21 +323,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as ERC721TokenContract; - const functionSignature = 'safeTransferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.safeTransferFrom; - const encodedData = ethersFunction.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -458,11 +337,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'safeTransferFrom'}) 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('safeTransferFrom(address,address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public ownerOf = { @@ -473,15 +353,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<string > { const self = this as any as ERC721TokenContract; - const functionSignature = 'ownerOf(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ownerOf; - const encodedData = ethersFunction.encode([_tokenId + const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -493,11 +365,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'ownerOf'}) 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('ownerOf(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public balanceOf = { @@ -508,15 +381,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as ERC721TokenContract; - const functionSignature = 'balanceOf(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf; - const encodedData = ethersFunction.encode([_owner + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -528,11 +393,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) 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('balanceOf(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public setApprovalForAll = { @@ -542,16 +408,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator, - _approved - ]); - const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator, + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -576,13 +433,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator, + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -601,13 +452,7 @@ export class ERC721TokenContract extends BaseContract { _approved: boolean, ): string { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator, + const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved ]); return abiEncodedTransactionData; @@ -620,18 +465,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as ERC721TokenContract; - const functionSignature = 'setApprovalForAll(address,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator, - _approved - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setApprovalForAll; - const encodedData = ethersFunction.encode([_operator, + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -644,11 +478,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'setApprovalForAll'}) 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('setApprovalForAll(address,bool)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public safeTransferFrom2 = { @@ -660,22 +495,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId, - _data - ]); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from, _to, _tokenId, _data @@ -706,17 +526,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from, _to, _tokenId, _data @@ -739,17 +549,7 @@ export class ERC721TokenContract extends BaseContract { _data: string, ): string { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from, + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from, _to, _tokenId, _data @@ -766,24 +566,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as ERC721TokenContract; - const functionSignature = 'safeTransferFrom(address,address,uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId, - _data - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.safeTransferFrom; - const encodedData = ethersFunction.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from, _to, _tokenId, _data @@ -798,11 +581,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'safeTransferFrom'}) 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('safeTransferFrom(address,address,uint256,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public isApprovedForAll = { @@ -814,18 +598,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<boolean > { const self = this as any as ERC721TokenContract; - const functionSignature = 'isApprovedForAll(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner, - _operator - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _operator - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _operator - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isApprovedForAll; - const encodedData = ethersFunction.encode([_owner, + const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner, _operator ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -838,11 +611,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isApprovedForAll'}) 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('isApprovedForAll(address,address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public static async deployFrom0xArtifactAsync( @@ -888,7 +662,7 @@ export class ERC721TokenContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('ERC721Token', 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 diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts index 11b5e7024..146fa7c2a 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts @@ -78,15 +78,7 @@ export class ExchangeContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as ExchangeContract; - const functionSignature = 'filled(bytes32)'; - 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.filled; - const encodedData = ethersFunction.encode([index_0 + const encodedData = self._strictEncodeArguments('filled(bytes32)', [index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -98,11 +90,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'filled'}) 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('filled(bytes32)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public batchFillOrders = { @@ -113,19 +106,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const encodedData = self._lookupEthersInterface('batchFillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrders.encode([orders, + const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, takerAssetFillAmounts, signatures ]); @@ -153,15 +134,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('batchFillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrders.encode([orders, + const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, takerAssetFillAmounts, signatures ]); @@ -182,15 +155,7 @@ export class ExchangeContract extends BaseContract { signatures: string[], ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('batchFillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrders.encode([orders, + const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, takerAssetFillAmounts, signatures ]); @@ -205,21 +170,7 @@ export class ExchangeContract extends BaseContract { ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} > { const self = this as any as ExchangeContract; - const functionSignature = 'batchFillOrders(tuple[],uint256[],bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchFillOrders; - const encodedData = ethersFunction.encode([orders, + const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, takerAssetFillAmounts, signatures ]); @@ -233,11 +184,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'batchFillOrders'}) 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('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public cancelled = { @@ -248,15 +200,7 @@ export class ExchangeContract extends BaseContract { ): Promise<boolean > { const self = this as any as ExchangeContract; - const functionSignature = 'cancelled(bytes32)'; - 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.cancelled; - const encodedData = ethersFunction.encode([index_0 + const encodedData = self._strictEncodeArguments('cancelled(bytes32)', [index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -268,11 +212,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'cancelled'}) 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('cancelled(bytes32)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public preSign = { @@ -283,19 +228,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const encodedData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash, + const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, signerAddress, signature ]); @@ -323,15 +256,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash, + const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, signerAddress, signature ]); @@ -352,15 +277,7 @@ export class ExchangeContract extends BaseContract { signature: string, ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash, + const abiEncodedTransactionData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, signerAddress, signature ]); @@ -375,21 +292,7 @@ export class ExchangeContract extends BaseContract { ): Promise<void > { const self = this as any as ExchangeContract; - const functionSignature = 'preSign(bytes32,address,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.preSign; - const encodedData = ethersFunction.encode([hash, + const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, signerAddress, signature ]); @@ -403,11 +306,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'preSign'}) 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('preSign(bytes32,address,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public matchOrders = { @@ -419,22 +323,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs; - [leftOrder, - rightOrder, - leftSignature, - rightSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - const encodedData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([leftOrder, + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, rightOrder, leftSignature, rightSignature @@ -465,17 +354,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs; - [leftOrder, - rightOrder, - leftSignature, - rightSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([leftOrder, + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, rightOrder, leftSignature, rightSignature @@ -498,17 +377,7 @@ export class ExchangeContract extends BaseContract { rightSignature: string, ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs; - [leftOrder, - rightOrder, - leftSignature, - rightSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([leftOrder, + const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, rightOrder, leftSignature, rightSignature @@ -525,24 +394,7 @@ export class ExchangeContract extends BaseContract { ): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} > { const self = this as any as ExchangeContract; - const functionSignature = 'matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [leftOrder, - rightOrder, - leftSignature, - rightSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.matchOrders; - const encodedData = ethersFunction.encode([leftOrder, + const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, rightOrder, leftSignature, rightSignature @@ -557,11 +409,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'matchOrders'}) 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('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public fillOrderNoThrow = { @@ -572,19 +425,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const encodedData = self._lookupEthersInterface('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrderNoThrow.encode([order, + const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, takerAssetFillAmount, signature ]); @@ -612,15 +453,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrderNoThrow.encode([order, + const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, takerAssetFillAmount, signature ]); @@ -641,15 +474,7 @@ export class ExchangeContract extends BaseContract { signature: string, ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrderNoThrow.encode([order, + const abiEncodedTransactionData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, takerAssetFillAmount, signature ]); @@ -664,21 +489,7 @@ export class ExchangeContract extends BaseContract { ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} > { const self = this as any as ExchangeContract; - const functionSignature = 'fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrderNoThrow; - const encodedData = ethersFunction.encode([order, + const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, takerAssetFillAmount, signature ]); @@ -692,11 +503,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'fillOrderNoThrow'}) 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('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public assetProxies = { @@ -707,15 +519,7 @@ export class ExchangeContract extends BaseContract { ): Promise<string > { const self = this as any as ExchangeContract; - const functionSignature = 'assetProxies(bytes4)'; - 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.assetProxies; - const encodedData = ethersFunction.encode([index_0 + const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -727,11 +531,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'assetProxies'}) 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('assetProxies(bytes4)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public batchCancelOrders = { @@ -740,13 +545,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchCancelOrders(tuple[])').inputs; - [orders - ] = BaseContract._formatABIDataItemList(inputAbi, [orders - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders - ]); - const encodedData = self._lookupEthersInterface('batchCancelOrders(tuple[])').functions.batchCancelOrders.encode([orders + const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -768,11 +567,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchCancelOrders(tuple[])').inputs; - [orders - ] = BaseContract._formatABIDataItemList(inputAbi, [orders - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('batchCancelOrders(tuple[])').functions.batchCancelOrders.encode([orders + const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -789,11 +584,7 @@ export class ExchangeContract extends BaseContract { orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchCancelOrders(tuple[])').inputs; - [orders - ] = BaseContract._formatABIDataItemList(inputAbi, [orders - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('batchCancelOrders(tuple[])').functions.batchCancelOrders.encode([orders + const abiEncodedTransactionData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders ]); return abiEncodedTransactionData; }, @@ -804,15 +595,7 @@ export class ExchangeContract extends BaseContract { ): Promise<void > { const self = this as any as ExchangeContract; - const functionSignature = 'batchCancelOrders(tuple[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders - ] = BaseContract._formatABIDataItemList(inputAbi, [orders - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchCancelOrders; - const encodedData = ethersFunction.encode([orders + const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -824,11 +607,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'batchCancelOrders'}) 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('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public batchFillOrKillOrders = { @@ -839,19 +623,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrKillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const encodedData = self._lookupEthersInterface('batchFillOrKillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrKillOrders.encode([orders, + const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, takerAssetFillAmounts, signatures ]); @@ -879,15 +651,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrKillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('batchFillOrKillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrKillOrders.encode([orders, + const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, takerAssetFillAmounts, signatures ]); @@ -908,15 +672,7 @@ export class ExchangeContract extends BaseContract { signatures: string[], ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrKillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('batchFillOrKillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrKillOrders.encode([orders, + const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, takerAssetFillAmounts, signatures ]); @@ -931,21 +687,7 @@ export class ExchangeContract extends BaseContract { ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} > { const self = this as any as ExchangeContract; - const functionSignature = 'batchFillOrKillOrders(tuple[],uint256[],bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchFillOrKillOrders; - const encodedData = ethersFunction.encode([orders, + const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, takerAssetFillAmounts, signatures ]); @@ -959,11 +701,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'batchFillOrKillOrders'}) 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('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public cancelOrdersUpTo = { @@ -972,13 +715,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256)').inputs; - [targetOrderEpoch - ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [targetOrderEpoch - ]); - const encodedData = self._lookupEthersInterface('cancelOrdersUpTo(uint256)').functions.cancelOrdersUpTo.encode([targetOrderEpoch + const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1000,11 +737,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256)').inputs; - [targetOrderEpoch - ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('cancelOrdersUpTo(uint256)').functions.cancelOrdersUpTo.encode([targetOrderEpoch + const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1021,11 +754,7 @@ export class ExchangeContract extends BaseContract { targetOrderEpoch: BigNumber, ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256)').inputs; - [targetOrderEpoch - ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('cancelOrdersUpTo(uint256)').functions.cancelOrdersUpTo.encode([targetOrderEpoch + const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch ]); return abiEncodedTransactionData; }, @@ -1036,15 +765,7 @@ export class ExchangeContract extends BaseContract { ): Promise<void > { const self = this as any as ExchangeContract; - const functionSignature = 'cancelOrdersUpTo(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [targetOrderEpoch - ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [targetOrderEpoch - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelOrdersUpTo; - const encodedData = ethersFunction.encode([targetOrderEpoch + const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1056,11 +777,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'cancelOrdersUpTo'}) 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('cancelOrdersUpTo(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public batchFillOrdersNoThrow = { @@ -1071,19 +793,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const encodedData = self._lookupEthersInterface('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').functions.batchFillOrdersNoThrow.encode([orders, + const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, takerAssetFillAmounts, signatures ]); @@ -1111,15 +821,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').functions.batchFillOrdersNoThrow.encode([orders, + const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, takerAssetFillAmounts, signatures ]); @@ -1140,15 +842,7 @@ export class ExchangeContract extends BaseContract { signatures: string[], ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').functions.batchFillOrdersNoThrow.encode([orders, + const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, takerAssetFillAmounts, signatures ]); @@ -1163,21 +857,7 @@ export class ExchangeContract extends BaseContract { ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} > { const self = this as any as ExchangeContract; - const functionSignature = 'batchFillOrdersNoThrow(tuple[],uint256[],bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchFillOrdersNoThrow; - const encodedData = ethersFunction.encode([orders, + const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, takerAssetFillAmounts, signatures ]); @@ -1191,11 +871,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'batchFillOrdersNoThrow'}) 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('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getAssetProxy = { @@ -1206,15 +887,7 @@ export class ExchangeContract extends BaseContract { ): Promise<string > { const self = this as any as ExchangeContract; - const functionSignature = 'getAssetProxy(bytes4)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [assetProxyId - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAssetProxy; - const encodedData = ethersFunction.encode([assetProxyId + const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1226,11 +899,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getAssetProxy'}) 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('getAssetProxy(bytes4)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transactions = { @@ -1241,15 +915,7 @@ export class ExchangeContract extends BaseContract { ): Promise<boolean > { const self = this as any as ExchangeContract; - const functionSignature = 'transactions(bytes32)'; - 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.transactions; - const encodedData = ethersFunction.encode([index_0 + const encodedData = self._strictEncodeArguments('transactions(bytes32)', [index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1261,11 +927,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transactions'}) 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('transactions(bytes32)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public fillOrKillOrder = { @@ -1276,19 +943,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const encodedData = self._lookupEthersInterface('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrKillOrder.encode([order, + const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, takerAssetFillAmount, signature ]); @@ -1316,15 +971,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrKillOrder.encode([order, + const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, takerAssetFillAmount, signature ]); @@ -1345,15 +992,7 @@ export class ExchangeContract extends BaseContract { signature: string, ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrKillOrder.encode([order, + const abiEncodedTransactionData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, takerAssetFillAmount, signature ]); @@ -1368,21 +1007,7 @@ export class ExchangeContract extends BaseContract { ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} > { const self = this as any as ExchangeContract; - const functionSignature = 'fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrKillOrder; - const encodedData = ethersFunction.encode([order, + const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, takerAssetFillAmount, signature ]); @@ -1396,11 +1021,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'fillOrKillOrder'}) 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('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public setSignatureValidatorApproval = { @@ -1410,16 +1036,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, - approval - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [validatorAddress, - approval - ]); - const encodedData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress, + const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress, approval ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1444,13 +1061,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, - approval - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress, + const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress, approval ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1469,13 +1080,7 @@ export class ExchangeContract extends BaseContract { approval: boolean, ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, - approval - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress, + const abiEncodedTransactionData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress, approval ]); return abiEncodedTransactionData; @@ -1488,18 +1093,7 @@ export class ExchangeContract extends BaseContract { ): Promise<void > { const self = this as any as ExchangeContract; - const functionSignature = 'setSignatureValidatorApproval(address,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, - approval - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [validatorAddress, - approval - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setSignatureValidatorApproval; - const encodedData = ethersFunction.encode([validatorAddress, + const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress, approval ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1512,11 +1106,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'setSignatureValidatorApproval'}) 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('setSignatureValidatorApproval(address,bool)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public allowedValidators = { @@ -1528,18 +1123,7 @@ export class ExchangeContract extends BaseContract { ): Promise<boolean > { const self = this as any as ExchangeContract; - const functionSignature = 'allowedValidators(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowedValidators; - const encodedData = ethersFunction.encode([index_0, + const encodedData = self._strictEncodeArguments('allowedValidators(address,address)', [index_0, index_1 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1552,11 +1136,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'allowedValidators'}) 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('allowedValidators(address,address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public marketSellOrders = { @@ -1567,19 +1152,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketSellOrders(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmount, - signatures - ]); - const encodedData = self._lookupEthersInterface('marketSellOrders(tuple[],uint256,bytes[])').functions.marketSellOrders.encode([orders, + const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, takerAssetFillAmount, signatures ]); @@ -1607,15 +1180,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketSellOrders(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('marketSellOrders(tuple[],uint256,bytes[])').functions.marketSellOrders.encode([orders, + const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, takerAssetFillAmount, signatures ]); @@ -1636,15 +1201,7 @@ export class ExchangeContract extends BaseContract { signatures: string[], ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketSellOrders(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('marketSellOrders(tuple[],uint256,bytes[])').functions.marketSellOrders.encode([orders, + const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, takerAssetFillAmount, signatures ]); @@ -1659,21 +1216,7 @@ export class ExchangeContract extends BaseContract { ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} > { const self = this as any as ExchangeContract; - const functionSignature = 'marketSellOrders(tuple[],uint256,bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmount, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketSellOrders; - const encodedData = ethersFunction.encode([orders, + const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, takerAssetFillAmount, signatures ]); @@ -1687,11 +1230,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'marketSellOrders'}) 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('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getOrdersInfo = { @@ -1702,15 +1246,7 @@ export class ExchangeContract extends BaseContract { ): Promise<Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}> > { const self = this as any as ExchangeContract; - const functionSignature = 'getOrdersInfo(tuple[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders - ] = BaseContract._formatABIDataItemList(inputAbi, [orders - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrdersInfo; - const encodedData = ethersFunction.encode([orders + const encodedData = self._strictEncodeArguments('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1722,11 +1258,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getOrdersInfo'}) 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('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}> + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public preSigned = { @@ -1738,18 +1275,7 @@ export class ExchangeContract extends BaseContract { ): Promise<boolean > { const self = this as any as ExchangeContract; - const functionSignature = 'preSigned(bytes32,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.preSigned; - const encodedData = ethersFunction.encode([index_0, + const encodedData = self._strictEncodeArguments('preSigned(bytes32,address)', [index_0, index_1 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1762,11 +1288,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'preSigned'}) 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('preSigned(bytes32,address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public owner = { @@ -1776,12 +1303,7 @@ export class ExchangeContract extends BaseContract { ): Promise<string > { const self = this as any as ExchangeContract; - 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, @@ -1792,11 +1314,12 @@ export class ExchangeContract 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 isValidSignature = { @@ -1809,21 +1332,7 @@ export class ExchangeContract extends BaseContract { ): Promise<boolean > { const self = this as any as ExchangeContract; - const functionSignature = 'isValidSignature(bytes32,address,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature; - const encodedData = ethersFunction.encode([hash, + const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, signerAddress, signature ]); @@ -1837,11 +1346,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) 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('isValidSignature(bytes32,address,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public marketBuyOrdersNoThrow = { @@ -1852,19 +1362,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - makerAssetFillAmount, - signatures - ]); - const encodedData = self._lookupEthersInterface('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketBuyOrdersNoThrow.encode([orders, + const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, makerAssetFillAmount, signatures ]); @@ -1892,15 +1390,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketBuyOrdersNoThrow.encode([orders, + const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, makerAssetFillAmount, signatures ]); @@ -1921,15 +1411,7 @@ export class ExchangeContract extends BaseContract { signatures: string[], ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketBuyOrdersNoThrow.encode([orders, + const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, makerAssetFillAmount, signatures ]); @@ -1944,21 +1426,7 @@ export class ExchangeContract extends BaseContract { ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} > { const self = this as any as ExchangeContract; - const functionSignature = 'marketBuyOrdersNoThrow(tuple[],uint256,bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - makerAssetFillAmount, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketBuyOrdersNoThrow; - const encodedData = ethersFunction.encode([orders, + const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, makerAssetFillAmount, signatures ]); @@ -1972,11 +1440,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'marketBuyOrdersNoThrow'}) 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('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public fillOrder = { @@ -1987,19 +1456,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const encodedData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrder.encode([order, + const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, takerAssetFillAmount, signature ]); @@ -2027,15 +1484,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrder.encode([order, + const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, takerAssetFillAmount, signature ]); @@ -2056,15 +1505,7 @@ export class ExchangeContract extends BaseContract { signature: string, ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrder.encode([order, + const abiEncodedTransactionData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, takerAssetFillAmount, signature ]); @@ -2079,21 +1520,7 @@ export class ExchangeContract extends BaseContract { ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} > { const self = this as any as ExchangeContract; - const functionSignature = 'fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrder; - const encodedData = ethersFunction.encode([order, + const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, takerAssetFillAmount, signature ]); @@ -2107,11 +1534,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'fillOrder'}) 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('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public executeTransaction = { @@ -2123,22 +1551,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs; - [salt, - signerAddress, - data, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [salt, - signerAddress, - data, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [salt, - signerAddress, - data, - signature - ]); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt, + const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, signerAddress, data, signature @@ -2169,17 +1582,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs; - [salt, - signerAddress, - data, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [salt, - signerAddress, - data, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt, + const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, signerAddress, data, signature @@ -2202,17 +1605,7 @@ export class ExchangeContract extends BaseContract { signature: string, ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs; - [salt, - signerAddress, - data, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [salt, - signerAddress, - data, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt, + const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, signerAddress, data, signature @@ -2229,24 +1622,7 @@ export class ExchangeContract extends BaseContract { ): Promise<void > { const self = this as any as ExchangeContract; - const functionSignature = 'executeTransaction(uint256,address,bytes,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [salt, - signerAddress, - data, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [salt, - signerAddress, - data, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [salt, - signerAddress, - data, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeTransaction; - const encodedData = ethersFunction.encode([salt, + const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, signerAddress, data, signature @@ -2261,11 +1637,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'executeTransaction'}) 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('executeTransaction(uint256,address,bytes,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public registerAssetProxy = { @@ -2274,13 +1651,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs; - [assetProxy - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxy - ]); - const encodedData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2302,11 +1673,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs; - [assetProxy - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2323,11 +1690,7 @@ export class ExchangeContract extends BaseContract { assetProxy: string, ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs; - [assetProxy - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy ]); return abiEncodedTransactionData; }, @@ -2338,15 +1701,7 @@ export class ExchangeContract extends BaseContract { ): Promise<void > { const self = this as any as ExchangeContract; - const functionSignature = 'registerAssetProxy(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [assetProxy - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxy - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.registerAssetProxy; - const encodedData = ethersFunction.encode([assetProxy + const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2358,11 +1713,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'registerAssetProxy'}) 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('registerAssetProxy(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getOrderInfo = { @@ -2373,15 +1729,7 @@ export class ExchangeContract extends BaseContract { ): Promise<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber} > { const self = this as any as ExchangeContract; - const functionSignature = 'getOrderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrderInfo; - const encodedData = ethersFunction.encode([order + const encodedData = self._strictEncodeArguments('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2393,11 +1741,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getOrderInfo'}) 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('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber} + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public cancelOrder = { @@ -2406,13 +1755,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order - ]); - const encodedData = self._lookupEthersInterface('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.cancelOrder.encode([order + const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2434,11 +1777,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.cancelOrder.encode([order + const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2455,11 +1794,7 @@ export class ExchangeContract extends BaseContract { order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.cancelOrder.encode([order + const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order ]); return abiEncodedTransactionData; }, @@ -2470,15 +1805,7 @@ export class ExchangeContract extends BaseContract { ): Promise<void > { const self = this as any as ExchangeContract; - const functionSignature = 'cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelOrder; - const encodedData = ethersFunction.encode([order + const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2490,11 +1817,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'cancelOrder'}) 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('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public orderEpoch = { @@ -2506,18 +1834,7 @@ export class ExchangeContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as ExchangeContract; - const functionSignature = 'orderEpoch(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.orderEpoch; - const encodedData = ethersFunction.encode([index_0, + const encodedData = self._strictEncodeArguments('orderEpoch(address,address)', [index_0, index_1 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -2530,11 +1847,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'orderEpoch'}) 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('orderEpoch(address,address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public ZRX_ASSET_DATA = { @@ -2544,12 +1862,7 @@ export class ExchangeContract extends BaseContract { ): Promise<string > { const self = this as any as ExchangeContract; - const functionSignature = 'ZRX_ASSET_DATA()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ZRX_ASSET_DATA; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('ZRX_ASSET_DATA()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2560,11 +1873,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'ZRX_ASSET_DATA'}) 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('ZRX_ASSET_DATA()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public marketSellOrdersNoThrow = { @@ -2575,19 +1889,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmount, - signatures - ]); - const encodedData = self._lookupEthersInterface('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketSellOrdersNoThrow.encode([orders, + const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, takerAssetFillAmount, signatures ]); @@ -2615,15 +1917,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketSellOrdersNoThrow.encode([orders, + const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, takerAssetFillAmount, signatures ]); @@ -2644,15 +1938,7 @@ export class ExchangeContract extends BaseContract { signatures: string[], ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketSellOrdersNoThrow.encode([orders, + const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, takerAssetFillAmount, signatures ]); @@ -2667,21 +1953,7 @@ export class ExchangeContract extends BaseContract { ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} > { const self = this as any as ExchangeContract; - const functionSignature = 'marketSellOrdersNoThrow(tuple[],uint256,bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmount, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketSellOrdersNoThrow; - const encodedData = ethersFunction.encode([orders, + const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, takerAssetFillAmount, signatures ]); @@ -2695,11 +1967,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'marketSellOrdersNoThrow'}) 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('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public EIP712_DOMAIN_HASH = { @@ -2709,12 +1982,7 @@ export class ExchangeContract extends BaseContract { ): Promise<string > { const self = this as any as ExchangeContract; - const functionSignature = 'EIP712_DOMAIN_HASH()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.EIP712_DOMAIN_HASH; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('EIP712_DOMAIN_HASH()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2725,11 +1993,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'EIP712_DOMAIN_HASH'}) 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('EIP712_DOMAIN_HASH()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public marketBuyOrders = { @@ -2740,19 +2009,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketBuyOrders(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - makerAssetFillAmount, - signatures - ]); - const encodedData = self._lookupEthersInterface('marketBuyOrders(tuple[],uint256,bytes[])').functions.marketBuyOrders.encode([orders, + const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, makerAssetFillAmount, signatures ]); @@ -2780,15 +2037,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketBuyOrders(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('marketBuyOrders(tuple[],uint256,bytes[])').functions.marketBuyOrders.encode([orders, + const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, makerAssetFillAmount, signatures ]); @@ -2809,15 +2058,7 @@ export class ExchangeContract extends BaseContract { signatures: string[], ): string { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketBuyOrders(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('marketBuyOrders(tuple[],uint256,bytes[])').functions.marketBuyOrders.encode([orders, + const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, makerAssetFillAmount, signatures ]); @@ -2832,21 +2073,7 @@ export class ExchangeContract extends BaseContract { ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} > { const self = this as any as ExchangeContract; - const functionSignature = 'marketBuyOrders(tuple[],uint256,bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - makerAssetFillAmount, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketBuyOrders; - const encodedData = ethersFunction.encode([orders, + const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, makerAssetFillAmount, signatures ]); @@ -2860,11 +2087,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'marketBuyOrders'}) 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('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public currentContextAddress = { @@ -2874,12 +2102,7 @@ export class ExchangeContract extends BaseContract { ): Promise<string > { const self = this as any as ExchangeContract; - const functionSignature = 'currentContextAddress()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.currentContextAddress; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('currentContextAddress()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2890,11 +2113,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'currentContextAddress'}) 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('currentContextAddress()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transferOwnership = { @@ -2903,13 +2127,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ExchangeContract; - 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( { @@ -2931,11 +2149,7 @@ export class ExchangeContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ExchangeContract; - 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( { @@ -2952,11 +2166,7 @@ export class ExchangeContract extends BaseContract { newOwner: string, ): string { const self = this as any as ExchangeContract; - 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; }, @@ -2967,15 +2177,7 @@ export class ExchangeContract extends BaseContract { ): Promise<void > { const self = this as any as ExchangeContract; - 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( { @@ -2987,11 +2189,12 @@ export class ExchangeContract 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 VERSION = { @@ -3001,12 +2204,7 @@ export class ExchangeContract extends BaseContract { ): Promise<string > { const self = this as any as ExchangeContract; - const functionSignature = 'VERSION()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.VERSION; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('VERSION()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3017,11 +2215,12 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'VERSION'}) 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('VERSION()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public static async deployFrom0xArtifactAsync( @@ -3074,7 +2273,7 @@ export class ExchangeContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('Exchange', 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 diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts index 8a88431b3..530320792 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts @@ -27,31 +27,7 @@ export class ForwarderContract extends BaseContract { txData: Partial<TxDataPayable> = {}, ): Promise<string> { const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs; - [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - const encodedData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders, + const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, makerAssetFillAmount, signatures, feeOrders, @@ -91,23 +67,7 @@ export class ForwarderContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs; - [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders, + const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, makerAssetFillAmount, signatures, feeOrders, @@ -136,23 +96,7 @@ export class ForwarderContract extends BaseContract { feeRecipient: string, ): string { const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs; - [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders, + const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, makerAssetFillAmount, signatures, feeOrders, @@ -175,33 +119,7 @@ export class ForwarderContract extends BaseContract { ): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] > { const self = this as any as ForwarderContract; - const functionSignature = 'marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketBuyOrdersWithEth; - const encodedData = ethersFunction.encode([orders, + const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, makerAssetFillAmount, signatures, feeOrders, @@ -219,11 +137,12 @@ export class ForwarderContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'marketBuyOrdersWithEth'}) 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('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public withdrawAsset = { @@ -233,16 +152,7 @@ export class ForwarderContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs; - [assetData, - amount - ] = BaseContract._formatABIDataItemList(inputAbi, [assetData, - amount - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData, - amount - ]); - const encodedData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData, + const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, amount ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -267,13 +177,7 @@ export class ForwarderContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs; - [assetData, - amount - ] = BaseContract._formatABIDataItemList(inputAbi, [assetData, - amount - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData, + const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, amount ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -292,13 +196,7 @@ export class ForwarderContract extends BaseContract { amount: BigNumber, ): string { const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs; - [assetData, - amount - ] = BaseContract._formatABIDataItemList(inputAbi, [assetData, - amount - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData, + const abiEncodedTransactionData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, amount ]); return abiEncodedTransactionData; @@ -311,18 +209,7 @@ export class ForwarderContract extends BaseContract { ): Promise<void > { const self = this as any as ForwarderContract; - const functionSignature = 'withdrawAsset(bytes,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [assetData, - amount - ] = BaseContract._formatABIDataItemList(inputAbi, [assetData, - amount - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData, - amount - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.withdrawAsset; - const encodedData = ethersFunction.encode([assetData, + const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, amount ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -335,11 +222,12 @@ export class ForwarderContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'withdrawAsset'}) 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('withdrawAsset(bytes,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public owner = { @@ -349,12 +237,7 @@ export class ForwarderContract extends BaseContract { ): Promise<string > { const self = this as any as ForwarderContract; - 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, @@ -365,11 +248,12 @@ export class ForwarderContract 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 marketSellOrdersWithEth = { @@ -383,28 +267,7 @@ export class ForwarderContract extends BaseContract { txData: Partial<TxDataPayable> = {}, ): Promise<string> { const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs; - [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - const encodedData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders, + const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, signatures, feeOrders, feeSignatures, @@ -441,21 +304,7 @@ export class ForwarderContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs; - [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders, + const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, signatures, feeOrders, feeSignatures, @@ -482,21 +331,7 @@ export class ForwarderContract extends BaseContract { feeRecipient: string, ): string { const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs; - [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders, + const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, signatures, feeOrders, feeSignatures, @@ -517,30 +352,7 @@ export class ForwarderContract extends BaseContract { ): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] > { const self = this as any as ForwarderContract; - const functionSignature = 'marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketSellOrdersWithEth; - const encodedData = ethersFunction.encode([orders, + const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, signatures, feeOrders, feeSignatures, @@ -557,11 +369,12 @@ export class ForwarderContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'marketSellOrdersWithEth'}) 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('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transferOwnership = { @@ -570,13 +383,7 @@ export class ForwarderContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ForwarderContract; - 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( { @@ -598,11 +405,7 @@ export class ForwarderContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ForwarderContract; - 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( { @@ -619,11 +422,7 @@ export class ForwarderContract extends BaseContract { newOwner: string, ): string { const self = this as any as ForwarderContract; - 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; }, @@ -634,15 +433,7 @@ export class ForwarderContract extends BaseContract { ): Promise<void > { const self = this as any as ForwarderContract; - 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( { @@ -654,11 +445,12 @@ export class ForwarderContract 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( @@ -725,7 +517,7 @@ _wethAssetData } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('Forwarder', 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 diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts index 5f38ffdac..6cb9f64fb 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts @@ -25,21 +25,7 @@ export class IValidatorContract extends BaseContract { ): Promise<boolean > { const self = this as any as IValidatorContract; - const functionSignature = 'isValidSignature(bytes32,address,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature; - const encodedData = ethersFunction.encode([hash, + const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, signerAddress, signature ]); @@ -53,11 +39,12 @@ export class IValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) 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('isValidSignature(bytes32,address,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public static async deployFrom0xArtifactAsync( @@ -103,7 +90,7 @@ export class IValidatorContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('IValidator', 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 diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts index 5fa6f1577..2185c7999 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts @@ -24,18 +24,7 @@ export class IWalletContract extends BaseContract { ): Promise<boolean > { const self = this as any as IWalletContract; - const functionSignature = 'isValidSignature(bytes32,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature; - const encodedData = ethersFunction.encode([hash, + const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash, signature ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -48,11 +37,12 @@ export class IWalletContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) 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('isValidSignature(bytes32,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public static async deployFrom0xArtifactAsync( @@ -98,7 +88,7 @@ export class IWalletContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('IWallet', 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 diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts index ce47b76fc..366b207ad 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts @@ -24,18 +24,7 @@ export class OrderValidatorContract extends BaseContract { ): Promise<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}] > { const self = this as any as OrderValidatorContract; - const functionSignature = 'getOrderAndTraderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAddress - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAddress - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAddress - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrderAndTraderInfo; - const encodedData = ethersFunction.encode([order, + const encodedData = self._strictEncodeArguments('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, takerAddress ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -48,11 +37,12 @@ export class OrderValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getOrderAndTraderInfo'}) 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('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}] + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getBalanceAndAllowance = { @@ -64,18 +54,7 @@ export class OrderValidatorContract extends BaseContract { ): Promise<[BigNumber, BigNumber] > { const self = this as any as OrderValidatorContract; - const functionSignature = 'getBalanceAndAllowance(address,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target, - assetData - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - assetData - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target, - assetData - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getBalanceAndAllowance; - const encodedData = ethersFunction.encode([target, + const encodedData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [target, assetData ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -88,11 +67,12 @@ export class OrderValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getBalanceAndAllowance'}) 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('getBalanceAndAllowance(address,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber] + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getOrdersAndTradersInfo = { @@ -104,18 +84,7 @@ export class OrderValidatorContract extends BaseContract { ): Promise<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>] > { const self = this as any as OrderValidatorContract; - const functionSignature = 'getOrdersAndTradersInfo(tuple[],address[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAddresses - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAddresses - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAddresses - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrdersAndTradersInfo; - const encodedData = ethersFunction.encode([orders, + const encodedData = self._strictEncodeArguments('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, takerAddresses ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -128,11 +97,12 @@ export class OrderValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getOrdersAndTradersInfo'}) 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('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>] + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getTradersInfo = { @@ -144,18 +114,7 @@ export class OrderValidatorContract extends BaseContract { ): Promise<Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}> > { const self = this as any as OrderValidatorContract; - const functionSignature = 'getTradersInfo(tuple[],address[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAddresses - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAddresses - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAddresses - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTradersInfo; - const encodedData = ethersFunction.encode([orders, + const encodedData = self._strictEncodeArguments('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, takerAddresses ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -168,11 +127,12 @@ export class OrderValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getTradersInfo'}) 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('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}> + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getERC721TokenOwner = { @@ -184,18 +144,7 @@ export class OrderValidatorContract extends BaseContract { ): Promise<string > { const self = this as any as OrderValidatorContract; - const functionSignature = 'getERC721TokenOwner(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [token, - tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [token, - tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [token, - tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getERC721TokenOwner; - const encodedData = ethersFunction.encode([token, + const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [token, tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -208,11 +157,12 @@ export class OrderValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getERC721TokenOwner'}) 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('getERC721TokenOwner(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getBalancesAndAllowances = { @@ -224,18 +174,7 @@ export class OrderValidatorContract extends BaseContract { ): Promise<[BigNumber[], BigNumber[]] > { const self = this as any as OrderValidatorContract; - const functionSignature = 'getBalancesAndAllowances(address,bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target, - assetData - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - assetData - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target, - assetData - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getBalancesAndAllowances; - const encodedData = ethersFunction.encode([target, + const encodedData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [target, assetData ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -248,11 +187,12 @@ export class OrderValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getBalancesAndAllowances'}) 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('getBalancesAndAllowances(address,bytes[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]] + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public getTraderInfo = { @@ -264,18 +204,7 @@ export class OrderValidatorContract extends BaseContract { ): Promise<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber} > { const self = this as any as OrderValidatorContract; - const functionSignature = 'getTraderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAddress - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAddress - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAddress - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTraderInfo; - const encodedData = ethersFunction.encode([order, + const encodedData = self._strictEncodeArguments('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, takerAddress ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -288,11 +217,12 @@ export class OrderValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getTraderInfo'}) 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('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber} + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public static async deployFrom0xArtifactAsync( @@ -352,7 +282,7 @@ _zrxAssetData } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('OrderValidator', 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 diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts index 12ec55ae9..5af169e03 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts @@ -57,12 +57,7 @@ export class WETH9Contract extends BaseContract { ): Promise<string > { const self = this as any as WETH9Contract; - const functionSignature = 'name()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -73,11 +68,12 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'name'}) 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('name()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public approve = { @@ -87,16 +83,7 @@ export class WETH9Contract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [guy, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [guy, - wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [guy, - wad - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([guy, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy, wad ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -121,13 +108,7 @@ export class WETH9Contract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [guy, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [guy, - wad - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([guy, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy, wad ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -146,13 +127,7 @@ export class WETH9Contract extends BaseContract { wad: BigNumber, ): string { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [guy, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [guy, - wad - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([guy, + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [guy, wad ]); return abiEncodedTransactionData; @@ -165,18 +140,7 @@ export class WETH9Contract extends BaseContract { ): Promise<boolean > { const self = this as any as WETH9Contract; - const functionSignature = 'approve(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [guy, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [guy, - wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [guy, - wad - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([guy, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy, wad ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -189,11 +153,12 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approve'}) 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('approve(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public totalSupply = { @@ -203,12 +168,7 @@ export class WETH9Contract extends BaseContract { ): Promise<BigNumber > { const self = this as any as WETH9Contract; - const functionSignature = 'totalSupply()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -219,11 +179,12 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) 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('totalSupply()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transferFrom = { @@ -234,19 +195,7 @@ export class WETH9Contract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [src, - dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [src, - dst, - wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [src, - dst, - wad - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([src, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src, dst, wad ]); @@ -274,15 +223,7 @@ export class WETH9Contract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [src, - dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [src, - dst, - wad - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([src, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src, dst, wad ]); @@ -303,15 +244,7 @@ export class WETH9Contract extends BaseContract { wad: BigNumber, ): string { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [src, - dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [src, - dst, - wad - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([src, + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src, dst, wad ]); @@ -326,21 +259,7 @@ export class WETH9Contract extends BaseContract { ): Promise<boolean > { const self = this as any as WETH9Contract; - const functionSignature = 'transferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [src, - dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [src, - dst, - wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [src, - dst, - wad - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([src, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src, dst, wad ]); @@ -354,11 +273,12 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) 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('transferFrom(address,address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public withdraw = { @@ -367,13 +287,7 @@ export class WETH9Contract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('withdraw(uint256)').inputs; - [wad - ] = BaseContract._formatABIDataItemList(inputAbi, [wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [wad - ]); - const encodedData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw.encode([wad + const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -395,11 +309,7 @@ export class WETH9Contract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('withdraw(uint256)').inputs; - [wad - ] = BaseContract._formatABIDataItemList(inputAbi, [wad - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw.encode([wad + const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -416,11 +326,7 @@ export class WETH9Contract extends BaseContract { wad: BigNumber, ): string { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('withdraw(uint256)').inputs; - [wad - ] = BaseContract._formatABIDataItemList(inputAbi, [wad - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw.encode([wad + const abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad ]); return abiEncodedTransactionData; }, @@ -431,15 +337,7 @@ export class WETH9Contract extends BaseContract { ): Promise<void > { const self = this as any as WETH9Contract; - const functionSignature = 'withdraw(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [wad - ] = BaseContract._formatABIDataItemList(inputAbi, [wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [wad - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.withdraw; - const encodedData = ethersFunction.encode([wad + const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -451,11 +349,12 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'withdraw'}) 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('withdraw(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public decimals = { @@ -465,12 +364,7 @@ export class WETH9Contract extends BaseContract { ): Promise<number > { const self = this as any as WETH9Contract; - const functionSignature = 'decimals()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.decimals; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('decimals()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -481,11 +375,12 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'decimals'}) 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('decimals()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<number + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public balanceOf = { @@ -496,15 +391,7 @@ export class WETH9Contract extends BaseContract { ): Promise<BigNumber > { const self = this as any as WETH9Contract; - const functionSignature = 'balanceOf(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.balanceOf; - const encodedData = ethersFunction.encode([index_0 + const encodedData = self._strictEncodeArguments('balanceOf(address)', [index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -516,11 +403,12 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) 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('balanceOf(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public symbol = { @@ -530,12 +418,7 @@ export class WETH9Contract extends BaseContract { ): Promise<string > { const self = this as any as WETH9Contract; - const functionSignature = 'symbol()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -546,11 +429,12 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'symbol'}) 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('symbol()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transfer = { @@ -560,16 +444,7 @@ export class WETH9Contract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [dst, - wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [dst, - wad - ]); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([dst, + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst, wad ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -594,13 +469,7 @@ export class WETH9Contract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [dst, - wad - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([dst, + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst, wad ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -619,13 +488,7 @@ export class WETH9Contract extends BaseContract { wad: BigNumber, ): string { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [dst, - wad - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([dst, + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [dst, wad ]); return abiEncodedTransactionData; @@ -638,18 +501,7 @@ export class WETH9Contract extends BaseContract { ): Promise<boolean > { const self = this as any as WETH9Contract; - const functionSignature = 'transfer(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [dst, - wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [dst, - wad - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer; - const encodedData = ethersFunction.encode([dst, + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst, wad ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -662,11 +514,12 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transfer'}) 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('transfer(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public deposit = { @@ -674,10 +527,7 @@ export class WETH9Contract extends BaseContract { txData: Partial<TxDataPayable> = {}, ): Promise<string> { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('deposit()').inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const encodedData = self._lookupEthersInterface('deposit()').functions.deposit.encode([]); + const encodedData = self._strictEncodeArguments('deposit()', []); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -696,9 +546,7 @@ export class WETH9Contract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('deposit()').inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('deposit()').functions.deposit.encode([]); + const encodedData = self._strictEncodeArguments('deposit()', []); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -713,9 +561,7 @@ export class WETH9Contract extends BaseContract { getABIEncodedTransactionData( ): string { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('deposit()').inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('deposit()').functions.deposit.encode([]); + const abiEncodedTransactionData = self._strictEncodeArguments('deposit()', []); return abiEncodedTransactionData; }, async callAsync( @@ -724,12 +570,7 @@ export class WETH9Contract extends BaseContract { ): Promise<void > { const self = this as any as WETH9Contract; - const functionSignature = 'deposit()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.deposit; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('deposit()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -740,11 +581,12 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'deposit'}) 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('deposit()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public allowance = { @@ -756,18 +598,7 @@ export class WETH9Contract extends BaseContract { ): Promise<BigNumber > { const self = this as any as WETH9Contract; - const functionSignature = 'allowance(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance; - const encodedData = ethersFunction.encode([index_0, + const encodedData = self._strictEncodeArguments('allowance(address,address)', [index_0, index_1 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -780,11 +611,12 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'allowance'}) 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('allowance(address,address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public static async deployFrom0xArtifactAsync( @@ -830,7 +662,7 @@ export class WETH9Contract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('WETH9', 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 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 877ffd12d..4f5d7f4c5 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts @@ -43,12 +43,7 @@ export class ZRXTokenContract extends BaseContract { ): Promise<string > { const self = this as any as ZRXTokenContract; - const functionSignature = 'name()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('name()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -59,11 +54,12 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'name'}) 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('name()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public approve = { @@ -73,16 +69,7 @@ export class ZRXTokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -107,13 +94,7 @@ export class ZRXTokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -132,13 +113,7 @@ export class ZRXTokenContract extends BaseContract { _value: BigNumber, ): string { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value ]); return abiEncodedTransactionData; @@ -151,18 +126,7 @@ export class ZRXTokenContract extends BaseContract { ): Promise<boolean > { const self = this as any as ZRXTokenContract; - const functionSignature = 'approve(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([_spender, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender, _value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -175,11 +139,12 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approve'}) 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('approve(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public totalSupply = { @@ -189,12 +154,7 @@ export class ZRXTokenContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as ZRXTokenContract; - const functionSignature = 'totalSupply()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('totalSupply()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -205,11 +165,12 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) 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('totalSupply()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transferFrom = { @@ -220,19 +181,7 @@ export class ZRXTokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _value ]); @@ -260,15 +209,7 @@ export class ZRXTokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _value ]); @@ -289,15 +230,7 @@ export class ZRXTokenContract extends BaseContract { _value: BigNumber, ): string { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _value ]); @@ -312,21 +245,7 @@ export class ZRXTokenContract extends BaseContract { ): Promise<boolean > { const self = this as any as ZRXTokenContract; - const functionSignature = 'transferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _value ]); @@ -340,11 +259,12 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) 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('transferFrom(address,address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public decimals = { @@ -354,12 +274,7 @@ export class ZRXTokenContract extends BaseContract { ): Promise<number > { const self = this as any as ZRXTokenContract; - const functionSignature = 'decimals()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.decimals; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('decimals()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -370,11 +285,12 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'decimals'}) 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('decimals()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<number + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public balanceOf = { @@ -385,15 +301,7 @@ export class ZRXTokenContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as ZRXTokenContract; - const functionSignature = 'balanceOf(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf; - const encodedData = ethersFunction.encode([_owner + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -405,11 +313,12 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) 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('balanceOf(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public symbol = { @@ -419,12 +328,7 @@ export class ZRXTokenContract extends BaseContract { ): Promise<string > { const self = this as any as ZRXTokenContract; - const functionSignature = 'symbol()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol; - const encodedData = ethersFunction.encode([]); + const encodedData = self._strictEncodeArguments('symbol()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -435,11 +339,12 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'symbol'}) 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('symbol()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transfer = { @@ -449,16 +354,7 @@ export class ZRXTokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -483,13 +379,7 @@ export class ZRXTokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -508,13 +398,7 @@ export class ZRXTokenContract extends BaseContract { _value: BigNumber, ): string { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value ]); return abiEncodedTransactionData; @@ -527,18 +411,7 @@ export class ZRXTokenContract extends BaseContract { ): Promise<boolean > { const self = this as any as ZRXTokenContract; - const functionSignature = 'transfer(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer; - const encodedData = ethersFunction.encode([_to, + const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to, _value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -551,11 +424,12 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transfer'}) 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('transfer(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public allowance = { @@ -567,18 +441,7 @@ export class ZRXTokenContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as ZRXTokenContract; - const functionSignature = 'allowance(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner, - _spender - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _spender - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _spender - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance; - const encodedData = ethersFunction.encode([_owner, + const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner, _spender ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -591,11 +454,12 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'allowance'}) 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('allowance(address,address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public static async deployFrom0xArtifactAsync( @@ -641,7 +505,7 @@ export class ZRXTokenContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('ZRXToken', 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 |