aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-03-14 11:41:07 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-03-14 11:41:07 +0800
commitcb612360ca4f97eb8c4aeae53a7552c4d845fbba (patch)
treed341f0ac69be7d42c5ab4e63a73549e1d1566890
parentc2f8858aabad2355e09ba65e900202b7c4edec5e (diff)
downloaddexon-sol-tools-cb612360ca4f97eb8c4aeae53a7552c4d845fbba.tar
dexon-sol-tools-cb612360ca4f97eb8c4aeae53a7552c4d845fbba.tar.gz
dexon-sol-tools-cb612360ca4f97eb8c4aeae53a7552c4d845fbba.tar.bz2
dexon-sol-tools-cb612360ca4f97eb8c4aeae53a7552c4d845fbba.tar.lz
dexon-sol-tools-cb612360ca4f97eb8c4aeae53a7552c4d845fbba.tar.xz
dexon-sol-tools-cb612360ca4f97eb8c4aeae53a7552c4d845fbba.tar.zst
dexon-sol-tools-cb612360ca4f97eb8c4aeae53a7552c4d845fbba.zip
Transform input data before encoding for callAsync and getABIEncodedTransactionData
-rw-r--r--packages/contract_templates/partials/tx.handlebars4
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