diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-03-14 11:41:07 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-03-14 11:41:07 +0800 |
commit | cb612360ca4f97eb8c4aeae53a7552c4d845fbba (patch) | |
tree | d341f0ac69be7d42c5ab4e63a73549e1d1566890 /packages/contract_templates | |
parent | c2f8858aabad2355e09ba65e900202b7c4edec5e (diff) | |
download | dexon-sol-tools-cb612360ca4f97eb8c4aeae53a7552c4d845fbba.tar.gz dexon-sol-tools-cb612360ca4f97eb8c4aeae53a7552c4d845fbba.tar.zst dexon-sol-tools-cb612360ca4f97eb8c4aeae53a7552c4d845fbba.zip |
Transform input data before encoding for callAsync and getABIEncodedTransactionData
Diffstat (limited to 'packages/contract_templates')
-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 |