From 285fb3deadd0413bf993557575a3f96a840f0e10 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Mon, 17 Dec 2018 18:26:03 -0800 Subject: Progress --- .../src/generated-wrappers/asset_proxy_owner.ts | 552 ++++------ .../src/generated-wrappers/dummy_erc20_token.ts | 313 ++---- .../src/generated-wrappers/dummy_erc721_token.ts | 423 +++----- .../src/generated-wrappers/erc20_proxy.ts | 188 ++-- .../src/generated-wrappers/erc20_token.ts | 163 +-- .../src/generated-wrappers/erc721_proxy.ts | 188 ++-- .../src/generated-wrappers/erc721_token.ts | 281 ++---- .../src/generated-wrappers/exchange.ts | 1054 ++++++-------------- .../src/generated-wrappers/forwarder.ts | 246 +---- .../src/generated-wrappers/i_validator.ts | 13 +- .../src/generated-wrappers/i_wallet.ts | 12 +- .../src/generated-wrappers/order_validator.ts | 80 +- .../src/generated-wrappers/weth9.ts | 245 ++--- .../src/generated-wrappers/zrx_token.ts | 187 ++-- 14 files changed, 1170 insertions(+), 2775 deletions(-) (limited to 'packages/abi-gen-wrappers') 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..d49a64456 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 @@ -110,10 +110,8 @@ export class AssetProxyOwnerContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -125,7 +123,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -138,14 +137,9 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('removeOwner(address)'); + const encodedData = abiEncoder.encode([owner + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -166,11 +160,8 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('removeOwner(address)'); + const encodedData = abiEncoder.encode([owner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -187,11 +178,8 @@ 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 abiEncoder = self._lookupAbiEncoder('removeOwner(address)'); + const abiEncodedTransactionData = abiEncoder.encode([owner ]); return abiEncodedTransactionData; }, @@ -207,10 +195,8 @@ export class AssetProxyOwnerContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([owner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -222,7 +208,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -235,14 +222,9 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('revokeConfirmation(uint256)'); + const encodedData = abiEncoder.encode([transactionId + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -263,11 +245,8 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('revokeConfirmation(uint256)'); + const encodedData = abiEncoder.encode([transactionId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -284,11 +263,8 @@ 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 abiEncoder = self._lookupAbiEncoder('revokeConfirmation(uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([transactionId ]); return abiEncodedTransactionData; }, @@ -304,10 +280,8 @@ export class AssetProxyOwnerContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([transactionId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -319,7 +293,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -339,10 +314,8 @@ export class AssetProxyOwnerContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -354,7 +327,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -377,11 +351,8 @@ export class AssetProxyOwnerContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0, index_1 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -394,7 +365,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -407,14 +379,9 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('executeRemoveAuthorizedAddressAtIndex(uint256)'); + const encodedData = abiEncoder.encode([transactionId + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -435,11 +402,8 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('executeRemoveAuthorizedAddressAtIndex(uint256)'); + const encodedData = abiEncoder.encode([transactionId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -456,11 +420,8 @@ 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 abiEncoder = self._lookupAbiEncoder('executeRemoveAuthorizedAddressAtIndex(uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([transactionId ]); return abiEncodedTransactionData; }, @@ -476,10 +437,8 @@ export class AssetProxyOwnerContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([transactionId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -491,7 +450,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -508,9 +468,8 @@ export class AssetProxyOwnerContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -521,7 +480,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -544,11 +504,8 @@ export class AssetProxyOwnerContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([pending, executed ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -561,7 +518,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -575,18 +533,10 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address,bool)'); + const encodedData = abiEncoder.encode([assetProxyContract, isRegistered - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -609,13 +559,8 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address,bool)'); + const encodedData = abiEncoder.encode([assetProxyContract, isRegistered ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -634,13 +579,8 @@ 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 abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address,bool)'); + const abiEncodedTransactionData = abiEncoder.encode([assetProxyContract, isRegistered ]); return abiEncodedTransactionData; @@ -660,11 +600,8 @@ export class AssetProxyOwnerContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([assetProxyContract, isRegistered ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -677,7 +614,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -690,14 +628,9 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('addOwner(address)'); + const encodedData = abiEncoder.encode([owner + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -718,11 +651,8 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('addOwner(address)'); + const encodedData = abiEncoder.encode([owner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -739,11 +669,8 @@ 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 abiEncoder = self._lookupAbiEncoder('addOwner(address)'); + const abiEncodedTransactionData = abiEncoder.encode([owner ]); return abiEncodedTransactionData; }, @@ -759,10 +686,8 @@ export class AssetProxyOwnerContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([owner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -774,7 +699,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -794,10 +720,8 @@ export class AssetProxyOwnerContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([transactionId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -809,7 +733,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -822,14 +747,9 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('changeTimeLock(uint256)'); + const encodedData = abiEncoder.encode([_secondsTimeLocked + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -850,11 +770,8 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('changeTimeLock(uint256)'); + const encodedData = abiEncoder.encode([_secondsTimeLocked ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -871,11 +788,8 @@ 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 abiEncoder = self._lookupAbiEncoder('changeTimeLock(uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_secondsTimeLocked ]); return abiEncodedTransactionData; }, @@ -891,10 +805,8 @@ export class AssetProxyOwnerContract extends BaseContract { [_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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_secondsTimeLocked ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -906,7 +818,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -926,10 +839,8 @@ export class AssetProxyOwnerContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -941,7 +852,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -961,10 +873,8 @@ export class AssetProxyOwnerContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([transactionId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -976,7 +886,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -996,10 +907,8 @@ export class AssetProxyOwnerContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1011,7 +920,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1028,9 +938,8 @@ export class AssetProxyOwnerContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1041,7 +950,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1070,13 +980,8 @@ export class AssetProxyOwnerContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([from, to, pending, executed @@ -1091,7 +996,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1111,10 +1017,8 @@ export class AssetProxyOwnerContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([transactionId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1126,7 +1030,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1143,9 +1048,8 @@ export class AssetProxyOwnerContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1156,7 +1060,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1169,14 +1074,9 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('changeRequirement(uint256)'); + const encodedData = abiEncoder.encode([_required + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1197,11 +1097,8 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('changeRequirement(uint256)'); + const encodedData = abiEncoder.encode([_required ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1218,11 +1115,8 @@ 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 abiEncoder = self._lookupAbiEncoder('changeRequirement(uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_required ]); return abiEncodedTransactionData; }, @@ -1238,10 +1132,8 @@ export class AssetProxyOwnerContract extends BaseContract { [_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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_required ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1253,7 +1145,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1266,14 +1159,9 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('confirmTransaction(uint256)'); + const encodedData = abiEncoder.encode([transactionId + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1294,11 +1182,8 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('confirmTransaction(uint256)'); + const encodedData = abiEncoder.encode([transactionId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1315,11 +1200,8 @@ 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 abiEncoder = self._lookupAbiEncoder('confirmTransaction(uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([transactionId ]); return abiEncodedTransactionData; }, @@ -1335,10 +1217,8 @@ export class AssetProxyOwnerContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([transactionId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1350,7 +1230,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1365,22 +1246,11 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs; - [destination, + const abiEncoder = self._lookupAbiEncoder('submitTransaction(address,uint256,bytes)'); + const encodedData = abiEncoder.encode([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, - value, - data - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1405,15 +1275,8 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('submitTransaction(address,uint256,bytes)'); + const encodedData = abiEncoder.encode([destination, value, data ]); @@ -1434,15 +1297,8 @@ 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 abiEncoder = self._lookupAbiEncoder('submitTransaction(address,uint256,bytes)'); + const abiEncodedTransactionData = abiEncoder.encode([destination, value, data ]); @@ -1466,12 +1322,8 @@ export class AssetProxyOwnerContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([destination, value, data ]); @@ -1485,7 +1337,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1505,10 +1358,8 @@ export class AssetProxyOwnerContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1520,7 +1371,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1537,9 +1389,8 @@ export class AssetProxyOwnerContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1550,7 +1401,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1567,9 +1419,8 @@ export class AssetProxyOwnerContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1580,7 +1431,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1594,18 +1446,10 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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, + const abiEncoder = self._lookupAbiEncoder('replaceOwner(address,address)'); + const encodedData = abiEncoder.encode([owner, newOwner - ]); - const encodedData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner, - newOwner - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1628,13 +1472,8 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('replaceOwner(address,address)'); + const encodedData = abiEncoder.encode([owner, newOwner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1653,13 +1492,8 @@ 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 abiEncoder = self._lookupAbiEncoder('replaceOwner(address,address)'); + const abiEncodedTransactionData = abiEncoder.encode([owner, newOwner ]); return abiEncodedTransactionData; @@ -1679,11 +1513,8 @@ export class AssetProxyOwnerContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([owner, newOwner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1696,7 +1527,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1709,14 +1541,9 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256)'); + const encodedData = abiEncoder.encode([transactionId + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1737,11 +1564,8 @@ export class AssetProxyOwnerContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256)'); + const encodedData = abiEncoder.encode([transactionId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1758,11 +1582,8 @@ 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 abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([transactionId ]); return abiEncodedTransactionData; }, @@ -1778,10 +1599,8 @@ export class AssetProxyOwnerContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([transactionId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1793,7 +1612,8 @@ export class AssetProxyOwnerContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1871,7 +1691,7 @@ _secondsTimeLocked } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial) { 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..659f95488 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 @@ -46,9 +46,8 @@ export class DummyERC20TokenContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -59,7 +58,8 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -73,18 +73,10 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const encodedData = abiEncoder.encode([_spender, _value - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -107,13 +99,8 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const encodedData = abiEncoder.encode([_spender, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -132,13 +119,8 @@ 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_spender, _value ]); return abiEncodedTransactionData; @@ -158,11 +140,8 @@ export class DummyERC20TokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_spender, _value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -175,7 +154,8 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -192,9 +172,8 @@ export class DummyERC20TokenContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -205,7 +184,8 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -220,22 +200,11 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([_from, _to, _value - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -260,15 +229,8 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([_from, _to, _value ]); @@ -289,15 +251,8 @@ 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_from, _to, _value ]); @@ -321,12 +276,8 @@ export class DummyERC20TokenContract extends BaseContract { _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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_from, _to, _value ]); @@ -340,7 +291,8 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -357,9 +309,8 @@ export class DummyERC20TokenContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -370,7 +321,8 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -390,10 +342,8 @@ export class DummyERC20TokenContract extends BaseContract { [_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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_owner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -405,7 +355,8 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -422,9 +373,8 @@ export class DummyERC20TokenContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -435,7 +385,8 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -452,9 +403,8 @@ export class DummyERC20TokenContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -465,7 +415,8 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -478,14 +429,9 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('mint(uint256)'); + const encodedData = abiEncoder.encode([_value + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -506,11 +452,8 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('mint(uint256)'); + const encodedData = abiEncoder.encode([_value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -527,11 +470,8 @@ 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 abiEncoder = self._lookupAbiEncoder('mint(uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_value ]); return abiEncodedTransactionData; }, @@ -547,10 +487,8 @@ export class DummyERC20TokenContract extends BaseContract { [_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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -562,7 +500,8 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -576,18 +515,10 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, + const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + const encodedData = abiEncoder.encode([_to, _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -610,13 +541,8 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + const encodedData = abiEncoder.encode([_to, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -635,13 +561,8 @@ 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 abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_to, _value ]); return abiEncodedTransactionData; @@ -661,11 +582,8 @@ export class DummyERC20TokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_to, _value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -678,7 +596,8 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -701,11 +620,8 @@ export class DummyERC20TokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_owner, _spender ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -718,7 +634,8 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -732,18 +649,10 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs; - [_target, + const abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)'); + const encodedData = abiEncoder.encode([_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, - _value - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -766,13 +675,8 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)'); + const encodedData = abiEncoder.encode([_target, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -791,13 +695,8 @@ 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 abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_target, _value ]); return abiEncodedTransactionData; @@ -817,11 +716,8 @@ export class DummyERC20TokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_target, _value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -834,7 +730,8 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -847,14 +744,9 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const encodedData = abiEncoder.encode([newOwner + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -875,11 +767,8 @@ export class DummyERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const encodedData = abiEncoder.encode([newOwner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -896,11 +785,8 @@ 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const abiEncodedTransactionData = abiEncoder.encode([newOwner ]); return abiEncodedTransactionData; }, @@ -916,10 +802,8 @@ export class DummyERC20TokenContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([newOwner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -931,7 +815,8 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -948,9 +833,8 @@ export class DummyERC20TokenContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -961,7 +845,8 @@ export class DummyERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1039,7 +924,7 @@ _totalSupply } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial) { 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..5a5e9670e 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 @@ -54,9 +54,8 @@ export class DummyERC721TokenContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -67,7 +66,8 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -87,10 +87,8 @@ export class DummyERC721TokenContract extends BaseContract { [_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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -102,7 +100,8 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -116,18 +115,10 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, + const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const encodedData = abiEncoder.encode([_approved, _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, - _tokenId - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -150,13 +141,8 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const encodedData = abiEncoder.encode([_approved, _tokenId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -175,13 +161,8 @@ 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_approved, _tokenId ]); return abiEncodedTransactionData; @@ -201,11 +182,8 @@ export class DummyERC721TokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_approved, _tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -218,7 +196,8 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -233,22 +212,11 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, + const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([_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, - _to, - _tokenId - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -273,15 +241,8 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([_from, _to, _tokenId ]); @@ -302,15 +263,8 @@ 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_from, _to, _tokenId ]); @@ -334,12 +288,8 @@ export class DummyERC721TokenContract extends BaseContract { _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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_from, _to, _tokenId ]); @@ -353,7 +303,8 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -367,18 +318,10 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('mint(address,uint256)').inputs; - [_to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, + const abiEncoder = self._lookupAbiEncoder('mint(address,uint256)'); + const encodedData = abiEncoder.encode([_to, _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('mint(address,uint256)').functions.mint.encode([_to, - _tokenId - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -401,13 +344,8 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('mint(address,uint256)'); + const encodedData = abiEncoder.encode([_to, _tokenId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -426,13 +364,8 @@ 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 abiEncoder = self._lookupAbiEncoder('mint(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_to, _tokenId ]); return abiEncodedTransactionData; @@ -452,11 +385,8 @@ export class DummyERC721TokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_to, _tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -469,7 +399,8 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -484,22 +415,11 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, + const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([_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, - _to, - _tokenId - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -524,15 +444,8 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([_from, _to, _tokenId ]); @@ -553,15 +466,8 @@ 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 abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_from, _to, _tokenId ]); @@ -585,12 +491,8 @@ export class DummyERC721TokenContract extends BaseContract { _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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_from, _to, _tokenId ]); @@ -604,7 +506,8 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -624,10 +527,8 @@ export class DummyERC721TokenContract extends BaseContract { [_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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -639,7 +540,8 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -659,10 +561,8 @@ export class DummyERC721TokenContract extends BaseContract { [_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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_owner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -674,7 +574,8 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -691,9 +592,8 @@ export class DummyERC721TokenContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -704,7 +604,8 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -721,9 +622,8 @@ export class DummyERC721TokenContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -734,7 +634,8 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -748,18 +649,10 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('burn(address,uint256)'); + const encodedData = abiEncoder.encode([_owner, _tokenId - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -782,13 +675,8 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('burn(address,uint256)'); + const encodedData = abiEncoder.encode([_owner, _tokenId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -807,13 +695,8 @@ 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 abiEncoder = self._lookupAbiEncoder('burn(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_owner, _tokenId ]); return abiEncodedTransactionData; @@ -833,11 +716,8 @@ export class DummyERC721TokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_owner, _tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -850,7 +730,8 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -864,18 +745,10 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); + const encodedData = abiEncoder.encode([_operator, _approved - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -898,13 +771,8 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); + const encodedData = abiEncoder.encode([_operator, _approved ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -923,13 +791,8 @@ 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 abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); + const abiEncodedTransactionData = abiEncoder.encode([_operator, _approved ]); return abiEncodedTransactionData; @@ -949,11 +812,8 @@ export class DummyERC721TokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_operator, _approved ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -966,7 +826,8 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -982,26 +843,12 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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, + const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); + const encodedData = abiEncoder.encode([_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, - _to, - _tokenId, - _data - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1028,17 +875,8 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); + const encodedData = abiEncoder.encode([_from, _to, _tokenId, _data @@ -1061,17 +899,8 @@ 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 abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); + const abiEncodedTransactionData = abiEncoder.encode([_from, _to, _tokenId, _data @@ -1099,13 +928,8 @@ export class DummyERC721TokenContract extends BaseContract { _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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_from, _to, _tokenId, _data @@ -1120,7 +944,8 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1143,11 +968,8 @@ export class DummyERC721TokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_owner, _operator ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1160,7 +982,8 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1173,14 +996,9 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const encodedData = abiEncoder.encode([newOwner + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1201,11 +1019,8 @@ export class DummyERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const encodedData = abiEncoder.encode([newOwner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1222,11 +1037,8 @@ 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const abiEncodedTransactionData = abiEncoder.encode([newOwner ]); return abiEncodedTransactionData; }, @@ -1242,10 +1054,8 @@ export class DummyERC721TokenContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([newOwner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1257,7 +1067,8 @@ export class DummyERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1321,7 +1132,7 @@ _symbol } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial) { 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/erc20_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts index 474472e43..e048f35b4 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts @@ -40,14 +40,9 @@ export class ERC20ProxyContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + const encodedData = abiEncoder.encode([target + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -68,11 +63,8 @@ export class ERC20ProxyContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + const encodedData = abiEncoder.encode([target ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -89,11 +81,8 @@ 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 abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + const abiEncodedTransactionData = abiEncoder.encode([target ]); return abiEncodedTransactionData; }, @@ -109,10 +98,8 @@ export class ERC20ProxyContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([target ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -124,7 +111,8 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -144,10 +132,8 @@ export class ERC20ProxyContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -159,7 +145,8 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -172,14 +159,9 @@ export class ERC20ProxyContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + const encodedData = abiEncoder.encode([target + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -200,11 +182,8 @@ export class ERC20ProxyContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + const encodedData = abiEncoder.encode([target ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -221,11 +200,8 @@ 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 abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + const abiEncodedTransactionData = abiEncoder.encode([target ]); return abiEncodedTransactionData; }, @@ -241,10 +217,8 @@ export class ERC20ProxyContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([target ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -256,7 +230,8 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -273,9 +248,8 @@ export class ERC20ProxyContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -286,7 +260,8 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -300,18 +275,10 @@ export class ERC20ProxyContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + const encodedData = abiEncoder.encode([target, index - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -334,13 +301,8 @@ export class ERC20ProxyContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + const encodedData = abiEncoder.encode([target, index ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -359,13 +321,8 @@ 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 abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([target, index ]); return abiEncodedTransactionData; @@ -385,11 +342,8 @@ export class ERC20ProxyContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([target, index ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -402,7 +356,8 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -419,9 +374,8 @@ export class ERC20ProxyContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -432,7 +386,8 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -452,10 +407,8 @@ export class ERC20ProxyContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -467,7 +420,8 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -484,9 +438,8 @@ export class ERC20ProxyContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -497,7 +450,8 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -510,14 +464,9 @@ export class ERC20ProxyContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const encodedData = abiEncoder.encode([newOwner + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -538,11 +487,8 @@ export class ERC20ProxyContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const encodedData = abiEncoder.encode([newOwner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -559,11 +505,8 @@ 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const abiEncodedTransactionData = abiEncoder.encode([newOwner ]); return abiEncodedTransactionData; }, @@ -579,10 +522,8 @@ export class ERC20ProxyContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([newOwner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -594,7 +535,8 @@ export class ERC20ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -644,7 +586,7 @@ export class ERC20ProxyContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial) { 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..e32f032e6 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts @@ -43,18 +43,10 @@ export class ERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, + const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const encodedData = abiEncoder.encode([_spender, _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -77,13 +69,8 @@ export class ERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const encodedData = abiEncoder.encode([_spender, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -102,13 +89,8 @@ 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_spender, _value ]); return abiEncodedTransactionData; @@ -128,11 +110,8 @@ export class ERC20TokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_spender, _value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -145,7 +124,8 @@ export class ERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -162,9 +142,8 @@ export class ERC20TokenContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -175,7 +154,8 @@ export class ERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -190,22 +170,11 @@ export class ERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, + const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([_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, - _to, - _value - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -230,15 +199,8 @@ export class ERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([_from, _to, _value ]); @@ -259,15 +221,8 @@ 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_from, _to, _value ]); @@ -291,12 +246,8 @@ export class ERC20TokenContract extends BaseContract { _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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_from, _to, _value ]); @@ -310,7 +261,8 @@ export class ERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -330,10 +282,8 @@ export class ERC20TokenContract extends BaseContract { [_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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_owner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -345,7 +295,8 @@ export class ERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -359,18 +310,10 @@ export class ERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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, + const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + const encodedData = abiEncoder.encode([_to, _value - ]); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -393,13 +336,8 @@ export class ERC20TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + const encodedData = abiEncoder.encode([_to, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -418,13 +356,8 @@ 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 abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_to, _value ]); return abiEncodedTransactionData; @@ -444,11 +377,8 @@ export class ERC20TokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_to, _value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -461,7 +391,8 @@ export class ERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -484,11 +415,8 @@ export class ERC20TokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_owner, _spender ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -501,7 +429,8 @@ export class ERC20TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -551,7 +480,7 @@ export class ERC20TokenContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial) { 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..1ad1fe014 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts @@ -40,14 +40,9 @@ export class ERC721ProxyContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + const encodedData = abiEncoder.encode([target + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -68,11 +63,8 @@ export class ERC721ProxyContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + const encodedData = abiEncoder.encode([target ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -89,11 +81,8 @@ 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 abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + const abiEncodedTransactionData = abiEncoder.encode([target ]); return abiEncodedTransactionData; }, @@ -109,10 +98,8 @@ export class ERC721ProxyContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([target ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -124,7 +111,8 @@ export class ERC721ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -144,10 +132,8 @@ export class ERC721ProxyContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -159,7 +145,8 @@ export class ERC721ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -172,14 +159,9 @@ export class ERC721ProxyContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + const encodedData = abiEncoder.encode([target + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -200,11 +182,8 @@ export class ERC721ProxyContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + const encodedData = abiEncoder.encode([target ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -221,11 +200,8 @@ 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 abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + const abiEncodedTransactionData = abiEncoder.encode([target ]); return abiEncodedTransactionData; }, @@ -241,10 +217,8 @@ export class ERC721ProxyContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([target ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -256,7 +230,8 @@ export class ERC721ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -273,9 +248,8 @@ export class ERC721ProxyContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -286,7 +260,8 @@ export class ERC721ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -300,18 +275,10 @@ export class ERC721ProxyContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + const encodedData = abiEncoder.encode([target, index - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -334,13 +301,8 @@ export class ERC721ProxyContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + const encodedData = abiEncoder.encode([target, index ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -359,13 +321,8 @@ 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 abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([target, index ]); return abiEncodedTransactionData; @@ -385,11 +342,8 @@ export class ERC721ProxyContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([target, index ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -402,7 +356,8 @@ export class ERC721ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -419,9 +374,8 @@ export class ERC721ProxyContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -432,7 +386,8 @@ export class ERC721ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -452,10 +407,8 @@ export class ERC721ProxyContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -467,7 +420,8 @@ export class ERC721ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -484,9 +438,8 @@ export class ERC721ProxyContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -497,7 +450,8 @@ export class ERC721ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -510,14 +464,9 @@ export class ERC721ProxyContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const encodedData = abiEncoder.encode([newOwner + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -538,11 +487,8 @@ export class ERC721ProxyContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const encodedData = abiEncoder.encode([newOwner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -559,11 +505,8 @@ 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const abiEncodedTransactionData = abiEncoder.encode([newOwner ]); return abiEncodedTransactionData; }, @@ -579,10 +522,8 @@ export class ERC721ProxyContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([newOwner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -594,7 +535,8 @@ export class ERC721ProxyContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -644,7 +586,7 @@ export class ERC721ProxyContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial) { 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..37a0f4ae5 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts @@ -57,10 +57,8 @@ export class ERC721TokenContract extends BaseContract { [_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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -72,7 +70,8 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -86,18 +85,10 @@ export class ERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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, + const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const encodedData = abiEncoder.encode([_approved, _tokenId - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, - _tokenId - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -120,13 +111,8 @@ export class ERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const encodedData = abiEncoder.encode([_approved, _tokenId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -145,13 +131,8 @@ 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_approved, _tokenId ]); return abiEncodedTransactionData; @@ -171,11 +152,8 @@ export class ERC721TokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_approved, _tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -188,7 +166,8 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -203,22 +182,11 @@ export class ERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, + const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([_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, - _to, - _tokenId - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -243,15 +211,8 @@ export class ERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([_from, _to, _tokenId ]); @@ -272,15 +233,8 @@ 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_from, _to, _tokenId ]); @@ -304,12 +258,8 @@ export class ERC721TokenContract extends BaseContract { _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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_from, _to, _tokenId ]); @@ -323,7 +273,8 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -338,22 +289,11 @@ export class ERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, + const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([_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, - _to, - _tokenId - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -378,15 +318,8 @@ export class ERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([_from, _to, _tokenId ]); @@ -407,15 +340,8 @@ 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 abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_from, _to, _tokenId ]); @@ -439,12 +365,8 @@ export class ERC721TokenContract extends BaseContract { _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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_from, _to, _tokenId ]); @@ -458,7 +380,8 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -478,10 +401,8 @@ export class ERC721TokenContract extends BaseContract { [_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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -493,7 +414,8 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -513,10 +435,8 @@ export class ERC721TokenContract extends BaseContract { [_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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_owner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -528,7 +448,8 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -542,18 +463,10 @@ export class ERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, + const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); + const encodedData = abiEncoder.encode([_operator, _approved - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator, - _approved - ]); - const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator, - _approved - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -576,13 +489,8 @@ export class ERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); + const encodedData = abiEncoder.encode([_operator, _approved ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -601,13 +509,8 @@ 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 abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); + const abiEncodedTransactionData = abiEncoder.encode([_operator, _approved ]); return abiEncodedTransactionData; @@ -627,11 +530,8 @@ export class ERC721TokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_operator, _approved ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -644,7 +544,8 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -660,26 +561,12 @@ export class ERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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, + const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); + const encodedData = abiEncoder.encode([_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, - _to, - _tokenId, - _data - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -706,17 +593,8 @@ export class ERC721TokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); + const encodedData = abiEncoder.encode([_from, _to, _tokenId, _data @@ -739,17 +617,8 @@ 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 abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); + const abiEncodedTransactionData = abiEncoder.encode([_from, _to, _tokenId, _data @@ -777,13 +646,8 @@ export class ERC721TokenContract extends BaseContract { _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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_from, _to, _tokenId, _data @@ -798,7 +662,8 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -821,11 +686,8 @@ export class ERC721TokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_owner, _operator ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -838,7 +700,8 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -888,7 +751,7 @@ export class ERC721TokenContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial) { 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..f5c5a87cd 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts @@ -83,10 +83,8 @@ export class ExchangeContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -98,7 +96,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -113,22 +112,11 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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, + const abiEncoder = self._lookupAbiEncoder('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + const encodedData = abiEncoder.encode([orders, takerAssetFillAmounts, signatures - ]); - const encodedData = self._lookupEthersInterface('batchFillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrders.encode([orders, - takerAssetFillAmounts, - signatures - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -153,15 +141,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + const encodedData = abiEncoder.encode([orders, takerAssetFillAmounts, signatures ]); @@ -182,15 +163,8 @@ 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 abiEncoder = self._lookupAbiEncoder('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + const abiEncodedTransactionData = abiEncoder.encode([orders, takerAssetFillAmounts, signatures ]); @@ -205,7 +179,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 functionSignature = 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'; const inputAbi = self._lookupAbi(functionSignature).inputs; [orders, takerAssetFillAmounts, @@ -214,12 +188,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([orders, takerAssetFillAmounts, signatures ]); @@ -233,7 +203,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -253,10 +224,8 @@ export class ExchangeContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -268,7 +237,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -283,22 +253,11 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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, + const abiEncoder = self._lookupAbiEncoder('preSign(bytes32,address,bytes)'); + const encodedData = abiEncoder.encode([hash, signerAddress, signature - ]); - const encodedData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash, - signerAddress, - signature - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -323,15 +282,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('preSign(bytes32,address,bytes)'); + const encodedData = abiEncoder.encode([hash, signerAddress, signature ]); @@ -352,15 +304,8 @@ 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 abiEncoder = self._lookupAbiEncoder('preSign(bytes32,address,bytes)'); + const abiEncodedTransactionData = abiEncoder.encode([hash, signerAddress, signature ]); @@ -384,12 +329,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([hash, signerAddress, signature ]); @@ -403,7 +344,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -419,26 +361,12 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 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)'); + const encodedData = abiEncoder.encode([leftOrder, rightOrder, leftSignature, rightSignature - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -465,17 +393,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 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)'); + const encodedData = abiEncoder.encode([leftOrder, rightOrder, leftSignature, rightSignature @@ -498,17 +417,8 @@ 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 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)'); + const abiEncodedTransactionData = abiEncoder.encode([leftOrder, rightOrder, leftSignature, rightSignature @@ -525,7 +435,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 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, @@ -536,13 +446,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([leftOrder, rightOrder, leftSignature, rightSignature @@ -557,7 +462,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -572,22 +478,11 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + const encodedData = abiEncoder.encode([order, takerAssetFillAmount, signature - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -612,15 +507,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + const encodedData = abiEncoder.encode([order, takerAssetFillAmount, signature ]); @@ -641,15 +529,8 @@ 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 abiEncoder = self._lookupAbiEncoder('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + const abiEncodedTransactionData = abiEncoder.encode([order, takerAssetFillAmount, signature ]); @@ -664,7 +545,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 functionSignature = 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'; const inputAbi = self._lookupAbi(functionSignature).inputs; [order, takerAssetFillAmount, @@ -673,12 +554,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([order, takerAssetFillAmount, signature ]); @@ -692,7 +569,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -712,10 +590,8 @@ export class ExchangeContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -727,7 +603,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -740,14 +617,9 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'); + const encodedData = abiEncoder.encode([orders + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -768,11 +640,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'); + const encodedData = abiEncoder.encode([orders ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -789,11 +658,8 @@ 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 abiEncoder = self._lookupAbiEncoder('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'); + const abiEncodedTransactionData = abiEncoder.encode([orders ]); return abiEncodedTransactionData; }, @@ -804,15 +670,13 @@ export class ExchangeContract extends BaseContract { ): Promise { const self = this as any as ExchangeContract; - const functionSignature = 'batchCancelOrders(tuple[])'; + const functionSignature = 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'; 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([orders ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -824,7 +688,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -839,22 +704,11 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrKillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, + const abiEncoder = self._lookupAbiEncoder('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + const encodedData = abiEncoder.encode([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, - takerAssetFillAmounts, - signatures - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -879,15 +733,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + const encodedData = abiEncoder.encode([orders, takerAssetFillAmounts, signatures ]); @@ -908,15 +755,8 @@ 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 abiEncoder = self._lookupAbiEncoder('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + const abiEncodedTransactionData = abiEncoder.encode([orders, takerAssetFillAmounts, signatures ]); @@ -931,7 +771,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 functionSignature = 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'; const inputAbi = self._lookupAbi(functionSignature).inputs; [orders, takerAssetFillAmounts, @@ -940,12 +780,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([orders, takerAssetFillAmounts, signatures ]); @@ -959,7 +795,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -972,14 +809,9 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('cancelOrdersUpTo(uint256)'); + const encodedData = abiEncoder.encode([targetOrderEpoch + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1000,11 +832,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('cancelOrdersUpTo(uint256)'); + const encodedData = abiEncoder.encode([targetOrderEpoch ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1021,11 +850,8 @@ 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 abiEncoder = self._lookupAbiEncoder('cancelOrdersUpTo(uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([targetOrderEpoch ]); return abiEncodedTransactionData; }, @@ -1041,10 +867,8 @@ export class ExchangeContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([targetOrderEpoch ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1056,7 +880,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1071,22 +896,11 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, + const abiEncoder = self._lookupAbiEncoder('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + const encodedData = abiEncoder.encode([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, - takerAssetFillAmounts, - signatures - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1111,15 +925,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + const encodedData = abiEncoder.encode([orders, takerAssetFillAmounts, signatures ]); @@ -1140,15 +947,8 @@ 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 abiEncoder = self._lookupAbiEncoder('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); + const abiEncodedTransactionData = abiEncoder.encode([orders, takerAssetFillAmounts, signatures ]); @@ -1163,7 +963,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 functionSignature = 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'; const inputAbi = self._lookupAbi(functionSignature).inputs; [orders, takerAssetFillAmounts, @@ -1172,12 +972,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([orders, takerAssetFillAmounts, signatures ]); @@ -1191,7 +987,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1211,10 +1008,8 @@ export class ExchangeContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([assetProxyId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1226,7 +1021,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1246,10 +1042,8 @@ export class ExchangeContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1261,7 +1055,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1276,22 +1071,11 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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, + const abiEncoder = self._lookupAbiEncoder('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + const encodedData = abiEncoder.encode([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, - takerAssetFillAmount, - signature - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1316,15 +1100,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + const encodedData = abiEncoder.encode([order, takerAssetFillAmount, signature ]); @@ -1345,15 +1122,8 @@ 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 abiEncoder = self._lookupAbiEncoder('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + const abiEncodedTransactionData = abiEncoder.encode([order, takerAssetFillAmount, signature ]); @@ -1368,7 +1138,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 functionSignature = 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'; const inputAbi = self._lookupAbi(functionSignature).inputs; [order, takerAssetFillAmount, @@ -1377,12 +1147,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([order, takerAssetFillAmount, signature ]); @@ -1396,7 +1162,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1410,18 +1177,10 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, + const abiEncoder = self._lookupAbiEncoder('setSignatureValidatorApproval(address,bool)'); + const encodedData = abiEncoder.encode([validatorAddress, approval - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [validatorAddress, - approval - ]); - const encodedData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress, - approval - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1444,13 +1203,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('setSignatureValidatorApproval(address,bool)'); + const encodedData = abiEncoder.encode([validatorAddress, approval ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1469,13 +1223,8 @@ 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 abiEncoder = self._lookupAbiEncoder('setSignatureValidatorApproval(address,bool)'); + const abiEncodedTransactionData = abiEncoder.encode([validatorAddress, approval ]); return abiEncodedTransactionData; @@ -1495,11 +1244,8 @@ export class ExchangeContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([validatorAddress, approval ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1512,7 +1258,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1535,11 +1282,8 @@ export class ExchangeContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0, index_1 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1552,7 +1296,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1567,22 +1312,11 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketSellOrders(tuple[],uint256,bytes[])').inputs; - [orders, + const abiEncoder = self._lookupAbiEncoder('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const encodedData = abiEncoder.encode([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, - takerAssetFillAmount, - signatures - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1607,15 +1341,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const encodedData = abiEncoder.encode([orders, takerAssetFillAmount, signatures ]); @@ -1636,15 +1363,8 @@ 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 abiEncoder = self._lookupAbiEncoder('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const abiEncodedTransactionData = abiEncoder.encode([orders, takerAssetFillAmount, signatures ]); @@ -1659,7 +1379,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 functionSignature = 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'; const inputAbi = self._lookupAbi(functionSignature).inputs; [orders, takerAssetFillAmount, @@ -1668,12 +1388,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([orders, takerAssetFillAmount, signatures ]); @@ -1687,7 +1403,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1702,15 +1419,13 @@ export class ExchangeContract extends BaseContract { ): Promise > { const self = this as any as ExchangeContract; - const functionSignature = 'getOrdersInfo(tuple[])'; + const functionSignature = 'getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'; 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([orders ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -1722,7 +1437,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1745,11 +1461,8 @@ export class ExchangeContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0, index_1 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1762,7 +1475,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1779,9 +1493,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1792,7 +1505,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1818,12 +1532,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([hash, signerAddress, signature ]); @@ -1837,7 +1547,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1852,22 +1563,11 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, + const abiEncoder = self._lookupAbiEncoder('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const encodedData = abiEncoder.encode([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, - makerAssetFillAmount, - signatures - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -1892,15 +1592,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const encodedData = abiEncoder.encode([orders, makerAssetFillAmount, signatures ]); @@ -1921,15 +1614,8 @@ 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 abiEncoder = self._lookupAbiEncoder('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const abiEncodedTransactionData = abiEncoder.encode([orders, makerAssetFillAmount, signatures ]); @@ -1944,7 +1630,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 functionSignature = 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'; const inputAbi = self._lookupAbi(functionSignature).inputs; [orders, makerAssetFillAmount, @@ -1953,12 +1639,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([orders, makerAssetFillAmount, signatures ]); @@ -1972,7 +1654,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -1987,22 +1670,11 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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, + const abiEncoder = self._lookupAbiEncoder('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + const encodedData = abiEncoder.encode([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, - takerAssetFillAmount, - signature - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2027,15 +1699,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + const encodedData = abiEncoder.encode([order, takerAssetFillAmount, signature ]); @@ -2056,15 +1721,8 @@ 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 abiEncoder = self._lookupAbiEncoder('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); + const abiEncodedTransactionData = abiEncoder.encode([order, takerAssetFillAmount, signature ]); @@ -2079,7 +1737,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 functionSignature = 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'; const inputAbi = self._lookupAbi(functionSignature).inputs; [order, takerAssetFillAmount, @@ -2088,12 +1746,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([order, takerAssetFillAmount, signature ]); @@ -2107,7 +1761,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -2123,26 +1778,12 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs; - [salt, + const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256,address,bytes,bytes)'); + const encodedData = abiEncoder.encode([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, - signerAddress, - data, - signature - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2169,17 +1810,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256,address,bytes,bytes)'); + const encodedData = abiEncoder.encode([salt, signerAddress, data, signature @@ -2202,17 +1834,8 @@ 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 abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256,address,bytes,bytes)'); + const abiEncodedTransactionData = abiEncoder.encode([salt, signerAddress, data, signature @@ -2240,13 +1863,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([salt, signerAddress, data, signature @@ -2261,7 +1879,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -2274,14 +1893,9 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); + const encodedData = abiEncoder.encode([assetProxy + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2302,11 +1916,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); + const encodedData = abiEncoder.encode([assetProxy ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2323,11 +1934,8 @@ 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 abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); + const abiEncodedTransactionData = abiEncoder.encode([assetProxy ]); return abiEncodedTransactionData; }, @@ -2343,10 +1951,8 @@ export class ExchangeContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([assetProxy ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2358,7 +1964,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -2373,15 +1980,13 @@ 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 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([order ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2393,7 +1998,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -2406,14 +2012,9 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); + const encodedData = abiEncoder.encode([order + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2434,11 +2035,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); + const encodedData = abiEncoder.encode([order ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2455,11 +2053,8 @@ 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 abiEncoder = self._lookupAbiEncoder('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); + const abiEncodedTransactionData = abiEncoder.encode([order ]); return abiEncodedTransactionData; }, @@ -2470,15 +2065,13 @@ export class ExchangeContract extends BaseContract { ): Promise { const self = this as any as ExchangeContract; - const functionSignature = 'cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})'; + 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([order ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2490,7 +2083,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -2513,11 +2107,8 @@ export class ExchangeContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0, index_1 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -2530,7 +2121,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -2547,9 +2139,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2560,7 +2151,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -2575,22 +2167,11 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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, + const abiEncoder = self._lookupAbiEncoder('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const encodedData = abiEncoder.encode([orders, takerAssetFillAmount, signatures - ]); - const encodedData = self._lookupEthersInterface('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketSellOrdersNoThrow.encode([orders, - takerAssetFillAmount, - signatures - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2615,15 +2196,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const encodedData = abiEncoder.encode([orders, takerAssetFillAmount, signatures ]); @@ -2644,15 +2218,8 @@ 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 abiEncoder = self._lookupAbiEncoder('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const abiEncodedTransactionData = abiEncoder.encode([orders, takerAssetFillAmount, signatures ]); @@ -2667,7 +2234,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 functionSignature = 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'; const inputAbi = self._lookupAbi(functionSignature).inputs; [orders, takerAssetFillAmount, @@ -2676,12 +2243,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([orders, takerAssetFillAmount, signatures ]); @@ -2695,7 +2258,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -2712,9 +2276,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2725,7 +2288,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -2740,22 +2304,11 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketBuyOrders(tuple[],uint256,bytes[])').inputs; - [orders, + const abiEncoder = self._lookupAbiEncoder('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const encodedData = abiEncoder.encode([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, - makerAssetFillAmount, - signatures - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2780,15 +2333,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const encodedData = abiEncoder.encode([orders, makerAssetFillAmount, signatures ]); @@ -2809,15 +2355,8 @@ 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 abiEncoder = self._lookupAbiEncoder('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); + const abiEncodedTransactionData = abiEncoder.encode([orders, makerAssetFillAmount, signatures ]); @@ -2832,7 +2371,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 functionSignature = 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'; const inputAbi = self._lookupAbi(functionSignature).inputs; [orders, makerAssetFillAmount, @@ -2841,12 +2380,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([orders, makerAssetFillAmount, signatures ]); @@ -2860,7 +2395,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -2877,9 +2413,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2890,7 +2425,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -2903,14 +2439,9 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const encodedData = abiEncoder.encode([newOwner + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -2931,11 +2462,8 @@ export class ExchangeContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const encodedData = abiEncoder.encode([newOwner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2952,11 +2480,8 @@ 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const abiEncodedTransactionData = abiEncoder.encode([newOwner ]); return abiEncodedTransactionData; }, @@ -2972,10 +2497,8 @@ export class ExchangeContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([newOwner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -2987,7 +2510,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -3004,9 +2528,8 @@ export class ExchangeContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -3017,7 +2540,8 @@ export class ExchangeContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -3074,7 +2598,7 @@ export class ExchangeContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial) { 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..e4d671f53 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts @@ -27,38 +27,15 @@ export class ForwarderContract extends BaseContract { txData: Partial = {}, ): Promise { 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 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)'); + const encodedData = abiEncoder.encode([orders, makerAssetFillAmount, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -91,23 +68,8 @@ export class ForwarderContract extends BaseContract { txData: Partial = {}, ): Promise { 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 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)'); + const encodedData = abiEncoder.encode([orders, makerAssetFillAmount, signatures, feeOrders, @@ -136,23 +98,8 @@ 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 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)'); + const abiEncodedTransactionData = abiEncoder.encode([orders, makerAssetFillAmount, signatures, feeOrders, @@ -175,7 +122,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 functionSignature = '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)'; const inputAbi = self._lookupAbi(functionSignature).inputs; [orders, makerAssetFillAmount, @@ -192,16 +139,8 @@ export class ForwarderContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([orders, makerAssetFillAmount, signatures, feeOrders, @@ -219,7 +158,8 @@ export class ForwarderContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -233,18 +173,10 @@ export class ForwarderContract extends BaseContract { txData: Partial = {}, ): Promise { 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, + const abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)'); + const encodedData = abiEncoder.encode([assetData, amount - ]); - const encodedData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData, - amount - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -267,13 +199,8 @@ export class ForwarderContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)'); + const encodedData = abiEncoder.encode([assetData, amount ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -292,13 +219,8 @@ 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 abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([assetData, amount ]); return abiEncodedTransactionData; @@ -318,11 +240,8 @@ export class ForwarderContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([assetData, amount ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -335,7 +254,8 @@ export class ForwarderContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -352,9 +272,8 @@ export class ForwarderContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -365,7 +284,8 @@ export class ForwarderContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -383,34 +303,14 @@ export class ForwarderContract extends BaseContract { txData: Partial = {}, ): Promise { 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, + 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)'); + const encodedData = abiEncoder.encode([orders, signatures, feeOrders, feeSignatures, feePercentage, feeRecipient - ]); - const encodedData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -441,21 +341,8 @@ export class ForwarderContract extends BaseContract { txData: Partial = {}, ): Promise { 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 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)'); + const encodedData = abiEncoder.encode([orders, signatures, feeOrders, feeSignatures, @@ -482,21 +369,8 @@ 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 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)'); + const abiEncodedTransactionData = abiEncoder.encode([orders, signatures, feeOrders, feeSignatures, @@ -517,7 +391,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 functionSignature = '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)'; const inputAbi = self._lookupAbi(functionSignature).inputs; [orders, signatures, @@ -532,15 +406,8 @@ export class ForwarderContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([orders, signatures, feeOrders, feeSignatures, @@ -557,7 +424,8 @@ export class ForwarderContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -570,14 +438,9 @@ export class ForwarderContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const encodedData = abiEncoder.encode([newOwner + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -598,11 +461,8 @@ export class ForwarderContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const encodedData = abiEncoder.encode([newOwner ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -619,11 +479,8 @@ 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + const abiEncodedTransactionData = abiEncoder.encode([newOwner ]); return abiEncodedTransactionData; }, @@ -639,10 +496,8 @@ export class ForwarderContract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([newOwner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -654,7 +509,8 @@ export class ForwarderContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -725,7 +581,7 @@ _wethAssetData } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial) { 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..8d5f4febb 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts @@ -34,12 +34,8 @@ export class IValidatorContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([hash, signerAddress, signature ]); @@ -53,7 +49,8 @@ export class IValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -103,7 +100,7 @@ export class IValidatorContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial) { 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..218de6619 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts @@ -31,11 +31,8 @@ export class IWalletContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([hash, signature ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -48,7 +45,8 @@ export class IWalletContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -98,7 +96,7 @@ export class IWalletContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial) { 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..a2daaff74 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,15 @@ 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 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([order, takerAddress ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -48,7 +45,8 @@ export class OrderValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -71,11 +69,8 @@ export class OrderValidatorContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([target, assetData ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -88,7 +83,8 @@ export class OrderValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -104,18 +100,15 @@ 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 functionSignature = 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([orders, takerAddresses ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -128,7 +121,8 @@ export class OrderValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -144,18 +138,15 @@ export class OrderValidatorContract extends BaseContract { ): Promise > { const self = this as any as OrderValidatorContract; - const functionSignature = 'getTradersInfo(tuple[],address[])'; + const functionSignature = 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([orders, takerAddresses ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -168,7 +159,8 @@ export class OrderValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -191,11 +183,8 @@ export class OrderValidatorContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([token, tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -208,7 +197,8 @@ export class OrderValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -231,11 +221,8 @@ export class OrderValidatorContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([target, assetData ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -248,7 +235,8 @@ export class OrderValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -264,18 +252,15 @@ 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 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([order, takerAddress ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -288,7 +273,8 @@ export class OrderValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -352,7 +338,7 @@ _zrxAssetData } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial) { 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..3f1e27931 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts @@ -60,9 +60,8 @@ export class WETH9Contract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -73,7 +72,8 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -87,18 +87,10 @@ export class WETH9Contract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const encodedData = abiEncoder.encode([guy, wad - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -121,13 +113,8 @@ export class WETH9Contract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const encodedData = abiEncoder.encode([guy, wad ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -146,13 +133,8 @@ 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([guy, wad ]); return abiEncodedTransactionData; @@ -172,11 +154,8 @@ export class WETH9Contract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([guy, wad ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -189,7 +168,8 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -206,9 +186,8 @@ export class WETH9Contract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -219,7 +198,8 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -234,22 +214,11 @@ export class WETH9Contract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [src, + const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([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, - dst, - wad - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -274,15 +243,8 @@ export class WETH9Contract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([src, dst, wad ]); @@ -303,15 +265,8 @@ 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([src, dst, wad ]); @@ -335,12 +290,8 @@ export class WETH9Contract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([src, dst, wad ]); @@ -354,7 +305,8 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -367,14 +319,9 @@ export class WETH9Contract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('withdraw(uint256)'); + const encodedData = abiEncoder.encode([wad + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -395,11 +342,8 @@ export class WETH9Contract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('withdraw(uint256)'); + const encodedData = abiEncoder.encode([wad ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -416,11 +360,8 @@ 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 abiEncoder = self._lookupAbiEncoder('withdraw(uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([wad ]); return abiEncodedTransactionData; }, @@ -436,10 +377,8 @@ export class WETH9Contract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([wad ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -451,7 +390,8 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -468,9 +408,8 @@ export class WETH9Contract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -481,7 +420,8 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -501,10 +441,8 @@ export class WETH9Contract extends BaseContract { [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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -516,7 +454,8 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -533,9 +472,8 @@ export class WETH9Contract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -546,7 +484,8 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -560,18 +499,10 @@ export class WETH9Contract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [dst, + const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + const encodedData = abiEncoder.encode([dst, wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [dst, - wad - ]); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([dst, - wad - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -594,13 +525,8 @@ export class WETH9Contract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + const encodedData = abiEncoder.encode([dst, wad ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -619,13 +545,8 @@ 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 abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([dst, wad ]); return abiEncodedTransactionData; @@ -645,11 +566,8 @@ export class WETH9Contract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([dst, wad ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -662,7 +580,8 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -674,10 +593,8 @@ export class WETH9Contract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('deposit()'); + const encodedData = abiEncoder.encode([], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -696,9 +613,8 @@ export class WETH9Contract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('deposit()'); + const encodedData = abiEncoder.encode([]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -713,9 +629,8 @@ 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 abiEncoder = self._lookupAbiEncoder('deposit()'); + const abiEncodedTransactionData = abiEncoder.encode([]); return abiEncodedTransactionData; }, async callAsync( @@ -727,9 +642,8 @@ export class WETH9Contract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -740,7 +654,8 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -763,11 +678,8 @@ export class WETH9Contract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([index_0, index_1 ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -780,7 +692,8 @@ export class WETH9Contract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -830,7 +743,7 @@ export class WETH9Contract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial) { 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..dd8c2041e 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts @@ -46,9 +46,8 @@ export class ZRXTokenContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -59,7 +58,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -73,18 +73,10 @@ export class ZRXTokenContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, + const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const encodedData = abiEncoder.encode([_spender, _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -107,13 +99,8 @@ export class ZRXTokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const encodedData = abiEncoder.encode([_spender, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -132,13 +119,8 @@ 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_spender, _value ]); return abiEncodedTransactionData; @@ -158,11 +140,8 @@ export class ZRXTokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_spender, _value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -175,7 +154,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -192,9 +172,8 @@ export class ZRXTokenContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -205,7 +184,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -220,22 +200,11 @@ export class ZRXTokenContract extends BaseContract { txData: Partial = {}, ): Promise { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, + const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([_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, - _to, - _value - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -260,15 +229,8 @@ export class ZRXTokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([_from, _to, _value ]); @@ -289,15 +251,8 @@ 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_from, _to, _value ]); @@ -321,12 +276,8 @@ export class ZRXTokenContract extends BaseContract { _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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_from, _to, _value ]); @@ -340,7 +291,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -357,9 +309,8 @@ export class ZRXTokenContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -370,7 +321,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -390,10 +342,8 @@ export class ZRXTokenContract extends BaseContract { [_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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_owner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -405,7 +355,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -422,9 +373,8 @@ export class ZRXTokenContract extends BaseContract { 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -435,7 +385,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -449,18 +400,10 @@ export class ZRXTokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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, + const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + const encodedData = abiEncoder.encode([_to, _value - ]); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -483,13 +426,8 @@ export class ZRXTokenContract extends BaseContract { txData: Partial = {}, ): Promise { 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 abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + const encodedData = abiEncoder.encode([_to, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -508,13 +446,8 @@ 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 abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_to, _value ]); return abiEncodedTransactionData; @@ -534,11 +467,8 @@ export class ZRXTokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_to, _value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -551,7 +481,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -574,11 +505,8 @@ export class ZRXTokenContract extends BaseContract { ] = 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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_owner, _spender ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -591,7 +519,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -641,7 +570,7 @@ export class ZRXTokenContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial) { 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 -- cgit v1.2.3