From 6701ec68bdbda91e63ab199510469e3e6a421b57 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 13 Sep 2018 13:45:27 +0200 Subject: Upgrade contract_templates to work with ethers 4.0 --- packages/contract_templates/partials/callAsync.handlebars | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'packages/contract_templates/partials/callAsync.handlebars') diff --git a/packages/contract_templates/partials/callAsync.handlebars b/packages/contract_templates/partials/callAsync.handlebars index 94752691d..dd1b90212 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,7 @@ async callAsync( self._web3Wrapper.getContractDefaults(), ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - let resultArray = ethersFunction.parse(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)); -- cgit