aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract_templates/partials/callAsync.handlebars
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-03-30 01:02:46 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-03-30 01:02:46 +0800
commit665011174bab7cfc6ec53e0044d60e1463222aee (patch)
tree44bc55bd390044d6cbfe8e0f7dddb621a8be7249 /packages/contract_templates/partials/callAsync.handlebars
parentd106079d9b69191d9cdc6d9323dbae3e4b45daf2 (diff)
parentc4dd9658e791a9f821ea3b6eb4326bcba53b081a (diff)
downloaddexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar
dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.gz
dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.bz2
dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.lz
dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.xz
dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.tar.zst
dexon-sol-tools-665011174bab7cfc6ec53e0044d60e1463222aee.zip
Merge branch 'development' into feature/website/wallet-wrap
* development: (35 commits) Fix CHANGELOG Update Yarn.lock Standardize changelog dates and format Fix stubbing of a non-existent property Remove redundant cast Move common types out of web3 types Add monorepo_scripts to npmignore Add typeRoots Add clean-state tests Remove nested .gitignore files since `yarn publish` gets confused by them and ignores their contents on the top-level scope Remove WETH hack now that updated WETH address is in TokenRegistry Revert TokenRegistry address on Kovan Improve rounding error message Portal fill with mixed decimals Add error popover if TokenRegistry on network user is browsing on don't include the requisite default tokens for 0x Portal to function Set timeout for compiler tests Remove redundant types Add missing param comments Fix a comment Add a comment ...
Diffstat (limited to 'packages/contract_templates/partials/callAsync.handlebars')
-rw-r--r--packages/contract_templates/partials/callAsync.handlebars19
1 files changed, 7 insertions, 12 deletions
diff --git a/packages/contract_templates/partials/callAsync.handlebars b/packages/contract_templates/partials/callAsync.handlebars
index 93d347145..e3fc2bdf9 100644
--- a/packages/contract_templates/partials/callAsync.handlebars
+++ b/packages/contract_templates/partials/callAsync.handlebars
@@ -1,27 +1,22 @@
{{#hasReturnValue}}
async callAsync(
{{> typed_params inputs=inputs}}
-{{#this.payable}}
- txData: TxDataPayable = {},
-{{/this.payable}}
-{{^this.payable}}
- txData: TxData = {},
-{{/this.payable}}
- defaultBlock?: Web3.BlockParam,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
): Promise<{{> return_type outputs=outputs}}> {
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 inputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).inputs;
+ [{{> params inputs=inputs}}] = BaseContract._transformABIData(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
const encodedData = self._ethersInterface.functions.{{this.name}}(
{{> params inputs=inputs}}
).data;
- const callData = await self._applyDefaultsToTxDataAsync(
+ const callDataWithDefaults = await self._applyDefaultsToTxDataAsync(
{
data: encodedData,
}
)
- const rawCallResult = await self._web3Wrapper.callAsync(callData, defaultBlock);
- const outputAbi = _.find(this.abi, {name: '{{this.name}}'}).outputs as Web3.DataItem[];
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ 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));