blob: c533712b7b2be0fca0e565fabb90412bbb02c71c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
public {{this.name}} = {
async callAsync(
{{> typed_params inputs=inputs}}
defaultBlock?: Web3.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 callDescription = self._ethersInterface.functions.{{this.name}}(
{{> params inputs=inputs}}
) as ethersContracts.CallDescription;
const callData = await self._applyDefaultsToTxDataAsync(
{
data: callDescription.data,
}
)
const rawCallResult = await self._web3Wrapper.callAsync(callData);
let resultArray = callDescription.parse(rawCallResult);
const outputAbi = _.find(this._abi, {name: '{{this.name}}'}).outputs;
resultArray = BaseContract._transformABIData(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
return resultArray{{#singleReturnValue}}[0]{{/singleReturnValue}};
},
};
|