diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-03-14 12:50:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-14 12:50:02 +0800 |
commit | 3f3e8be004818ddaa1921b3dff12bdd46052278b (patch) | |
tree | d341f0ac69be7d42c5ab4e63a73549e1d1566890 | |
parent | c2f8858aabad2355e09ba65e900202b7c4edec5e (diff) | |
parent | cb612360ca4f97eb8c4aeae53a7552c4d845fbba (diff) | |
download | dexon-sol-tools-3f3e8be004818ddaa1921b3dff12bdd46052278b.tar dexon-sol-tools-3f3e8be004818ddaa1921b3dff12bdd46052278b.tar.gz dexon-sol-tools-3f3e8be004818ddaa1921b3dff12bdd46052278b.tar.bz2 dexon-sol-tools-3f3e8be004818ddaa1921b3dff12bdd46052278b.tar.lz dexon-sol-tools-3f3e8be004818ddaa1921b3dff12bdd46052278b.tar.xz dexon-sol-tools-3f3e8be004818ddaa1921b3dff12bdd46052278b.tar.zst dexon-sol-tools-3f3e8be004818ddaa1921b3dff12bdd46052278b.zip |
Merge pull request #453 from 0xProject/fix/contract-templates/transformData
Transform input data before encoding
-rw-r--r-- | packages/contract_templates/partials/tx.handlebars | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/contract_templates/partials/tx.handlebars b/packages/contract_templates/partials/tx.handlebars index 347a482d6..d517a9f7f 100644 --- a/packages/contract_templates/partials/tx.handlebars +++ b/packages/contract_templates/partials/tx.handlebars @@ -32,6 +32,8 @@ public {{this.name}} = { txData: TxData = {}, ): Promise<number> { const self = this as {{contractName}}Contract; + const inputAbi = _.find(this.abi, {name: '{{this.name}}'}).inputs; + [{{> params inputs=inputs}}] = BaseContract._transformABIData(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(this)); const encodedData = this._ethersInterface.functions.{{this.name}}( {{> params inputs=inputs}} ).data @@ -49,6 +51,8 @@ public {{this.name}} = { txData: TxData = {}, ): string { const self = this as {{contractName}}Contract; + const inputAbi = _.find(this.abi, {name: '{{this.name}}'}).inputs; + [{{> params inputs=inputs}}] = BaseContract._transformABIData(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(this)); const abiEncodedTransactionData = this._ethersInterface.functions.{{this.name}}( {{> params inputs=inputs}} ).data |