diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-03-28 17:05:36 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-04-02 17:34:29 +0800 |
commit | 4d9029bb0e3b215efdf165704c80d3bacef0e85a (patch) | |
tree | 8f699dcd0a7b5fba3c31c065a62d640407bba8c3 /packages/contract_templates/partials/callAsync.handlebars | |
parent | bc49dde4d5d24b9a8b01459bde061f9b23fb5898 (diff) | |
download | dexon-sol-tools-4d9029bb0e3b215efdf165704c80d3bacef0e85a.tar dexon-sol-tools-4d9029bb0e3b215efdf165704c80d3bacef0e85a.tar.gz dexon-sol-tools-4d9029bb0e3b215efdf165704c80d3bacef0e85a.tar.bz2 dexon-sol-tools-4d9029bb0e3b215efdf165704c80d3bacef0e85a.tar.lz dexon-sol-tools-4d9029bb0e3b215efdf165704c80d3bacef0e85a.tar.xz dexon-sol-tools-4d9029bb0e3b215efdf165704c80d3bacef0e85a.tar.zst dexon-sol-tools-4d9029bb0e3b215efdf165704c80d3bacef0e85a.zip |
Add metacoin example project
Diffstat (limited to 'packages/contract_templates/partials/callAsync.handlebars')
-rw-r--r-- | packages/contract_templates/partials/callAsync.handlebars | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/contract_templates/partials/callAsync.handlebars b/packages/contract_templates/partials/callAsync.handlebars index e3fc2bdf9..8de69203e 100644 --- a/packages/contract_templates/partials/callAsync.handlebars +++ b/packages/contract_templates/partials/callAsync.handlebars @@ -4,9 +4,9 @@ async callAsync( callData: Partial<CallData> = {}, defaultBlock?: BlockParam, ): Promise<{{> return_type outputs=outputs}}> { - const self = this as {{contractName}}Contract; + const self = this as any as {{contractName}}Contract; const inputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).inputs; - [{{> params inputs=inputs}}] = BaseContract._transformABIData(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self)); + [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self)); const encodedData = self._ethersInterface.functions.{{this.name}}( {{> params inputs=inputs}} ).data; @@ -19,7 +19,8 @@ async callAsync( const outputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).outputs; const outputParamsTypes = _.map(outputAbi, 'type'); let resultArray = ethersContracts.Interface.decodeParams(outputParamsTypes, rawCallResult) as any; - resultArray = BaseContract._transformABIData(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); + resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); + resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); return resultArray{{#singleReturnValue}}[0]{{/singleReturnValue}}; }, {{/hasReturnValue}} |