diff options
Diffstat (limited to 'packages/contract_templates/partials/callAsync.handlebars')
-rw-r--r-- | packages/contract_templates/partials/callAsync.handlebars | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/packages/contract_templates/partials/callAsync.handlebars b/packages/contract_templates/partials/callAsync.handlebars index 94752691d..ddbbe7508 100644 --- a/packages/contract_templates/partials/callAsync.handlebars +++ b/packages/contract_templates/partials/callAsync.handlebars @@ -8,10 +8,8 @@ async callAsync( const inputAbi = self._lookupAbi(functionSignature).inputs; [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self)); BaseContract.strictArgumentEncodingCheck(inputAbi, [{{> params inputs=inputs}}]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.{{this.name}}( - {{> params inputs=inputs}} - ) as ethers.CallDescription; - const encodedData = ethersFunction.data; + const ethersFunction = self._lookupEthersInterface(functionSignature).functions.{{this.name}}; + const encodedData = ethersFunction.encode([{{> params inputs=inputs}}]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -21,7 +19,8 @@ async callAsync( self._web3Wrapper.getContractDefaults(), ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - let resultArray = ethersFunction.parse(rawCallResult); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let resultArray = ethersFunction.decode(rawCallResult); const outputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).outputs; resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); |