diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-04-02 19:57:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-02 19:57:44 +0800 |
commit | d95b1e2db499d0264a1020be1ec453c5136b5a3b (patch) | |
tree | b26623424303ff4d5ba17080b53ef40d037a1426 /packages/contract_templates/partials | |
parent | 695b697cdf6c73bb4b5f920869ce128f9a9e7523 (diff) | |
parent | c1d6c7ff66079731df405e25c4b2aa83c86fffb9 (diff) | |
download | dexon-sol-tools-d95b1e2db499d0264a1020be1ec453c5136b5a3b.tar dexon-sol-tools-d95b1e2db499d0264a1020be1ec453c5136b5a3b.tar.gz dexon-sol-tools-d95b1e2db499d0264a1020be1ec453c5136b5a3b.tar.bz2 dexon-sol-tools-d95b1e2db499d0264a1020be1ec453c5136b5a3b.tar.lz dexon-sol-tools-d95b1e2db499d0264a1020be1ec453c5136b5a3b.tar.xz dexon-sol-tools-d95b1e2db499d0264a1020be1ec453c5136b5a3b.tar.zst dexon-sol-tools-d95b1e2db499d0264a1020be1ec453c5136b5a3b.zip |
Merge pull request #485 from 0xProject/feature/metacoin
Add metacoin example project
Diffstat (limited to 'packages/contract_templates/partials')
-rw-r--r-- | packages/contract_templates/partials/callAsync.handlebars | 7 | ||||
-rw-r--r-- | packages/contract_templates/partials/tx.handlebars | 12 |
2 files changed, 10 insertions, 9 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}} diff --git a/packages/contract_templates/partials/tx.handlebars b/packages/contract_templates/partials/tx.handlebars index f76de3a70..41ba6d3f7 100644 --- a/packages/contract_templates/partials/tx.handlebars +++ b/packages/contract_templates/partials/tx.handlebars @@ -8,9 +8,9 @@ public {{this.name}} = { txData: Partial<TxData> = {}, {{/this.payable}} ): Promise<string> { - 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 @@ -31,9 +31,9 @@ public {{this.name}} = { {{> typed_params inputs=inputs}} txData: Partial<TxData> = {}, ): Promise<number> { - 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(this)); + [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(this)); const encodedData = self._ethersInterface.functions.{{this.name}}( {{> params inputs=inputs}} ).data @@ -49,9 +49,9 @@ public {{this.name}} = { getABIEncodedTransactionData( {{> typed_params inputs=inputs}} ): string { - 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 abiEncodedTransactionData = self._ethersInterface.functions.{{this.name}}( {{> params inputs=inputs}} ).data |